-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
coreutils: output expected error for unrecognized options #9869
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
base: main
Are you sure you want to change the base?
coreutils: output expected error for unrecognized options #9869
Conversation
|
GNU testsuite comparison: |
dd4938b to
155a215
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
| /// Prints an "unrecognized option" error and exits | ||
| pub fn unrecognized_option(binary_name: &str, option: &OsStr) -> ! { | ||
| eprintln!( | ||
| "{}: unrecognized option '{}'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use translate!()
|
could you please add a test? thanks |
|
Adding integration tests and adding translate is two pr's on their own I think because this doesn't have integration tests yet and doesn't have a translation utility, theres a few details about adding both of those because this utility is unique. Going to work on both of those in seperate PR's before updating this one |
The coreutils multicall binary doesn't use clap for argument parsing - it manually handles a few known options (--list, --version, --help) and treats everything else as a utility name.
When given an unrecognized option like
--unknownor-/, it was outputting:This was causing the
usage_vs_getopt.shGNU test to fail because it expects the standard error format:This PR adds detection for option-like arguments (starting with
-) and outputs the proper error message.