Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(cli): exit with non-zero code when there are diagnostics #50

Closed
Boshen opened this issue Feb 25, 2023 · 1 comment
Closed

Feat(cli): exit with non-zero code when there are diagnostics #50

Boshen opened this issue Feb 25, 2023 · 1 comment
Labels
good first issue Experience Level - Good for newcomers

Comments

@Boshen
Copy link
Member

Boshen commented Feb 25, 2023

The current prototype always exit with 0 because I haven't implemented anything related to exit code.

In this good first issue, you will learn about the std::process::Termination trait and the std::process::ExitCode struct.

In oxc_cli, you may define a wrapper enum for all the possible exit states

#[derive(Debug)]
pub enum CliRunResult {
    None,
    PathNotFound {
        path: PathBuf,
    },
    LintResult {
        ... bunch of stats and stuff
    },
}

and nice messages inside the report method.

Finally inside main.rs, you can return the run result with std::process::Termination implemented on it.

fn main() -> CliRunResult {}

Have fun!

@Boshen Boshen added the good first issue Experience Level - Good for newcomers label Feb 25, 2023
@Boshen Boshen added this to the Linter milestone Feb 25, 2023
@Boshen Boshen assigned Boshen and unassigned Boshen Feb 25, 2023
@thepassle
Copy link
Contributor

this was implemented in #52 and #56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Experience Level - Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants