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
Use precise exit code on usage error #1327
Comments
danielthegray
added a commit
to danielthegray/clap
that referenced
this issue
Jan 17, 2020
The reason to do this is described well in issue clap-rs#1327. It is also a recommendation of the Rust book itself: https://rust-cli.github.io/book/in-depth/exit-code.html
danielthegray
added a commit
to danielthegray/clap
that referenced
this issue
Jan 17, 2020
The reason to do this is described well in issue clap-rs#1327. It is also a recommendation of the Rust book itself: https://rust-cli.github.io/book/in-depth/exit-code.html
pksunkara
added a commit
that referenced
this issue
Jan 30, 2020
imp: Add exitcode::USAGE exit code as suggested in #1327
Merged the relevant PR. |
Dylan-DPC-zz
pushed a commit
that referenced
this issue
Feb 1, 2020
pksunkara
pushed a commit
that referenced
this issue
Feb 3, 2020
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Most people exit their program status code
1
on an error. To differentiate between program errors, the BSD folks made a guideline with exit codes (>1) to be more specific. For example, if the user doesn't have the necessary permissions, you should exit with77
.I'm not trying to advocate rigorously following this. I want to argue from a different perspective: If people tend to use
1
for generic errors, clap should probably not use1
, so if people want to detect usage errors, they have a chance to do so. Thus, I propose changing the exit code to64
(orexitcode::USAGE
).It seems that only these places need to be touched:
clap/src/build/app/mod.rs
Line 1209 in eaa0700
clap/src/build/app/mod.rs
Line 1285 in eaa0700
As one might see this as a breaking change for consumers, it need to land before the 3.0 release.
The text was updated successfully, but these errors were encountered: