mirror of
https://github.com/uutils/coreutils
synced 2024-11-16 09:48:03 +00:00
Merge pull request #816 from nathanross/minor-fixes
basename: error message for too few or many args messages should go to stderr
This commit is contained in:
commit
76cfcba306
1 changed files with 12 additions and 6 deletions
|
@ -52,15 +52,21 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
|
||||
// too few arguments
|
||||
if args.len() < 2 {
|
||||
println!("{}: {}", NAME, "missing operand");
|
||||
println!("Try '{} --help' for more information.", NAME);
|
||||
return 1;
|
||||
crash!(
|
||||
1,
|
||||
"{0}: {1}\nTry '{0} --help' for more information.",
|
||||
NAME,
|
||||
"missing operand"
|
||||
);
|
||||
}
|
||||
// too many arguments
|
||||
else if args.len() > 3 {
|
||||
println!("{}: extra operand '{}'", NAME, args[3]);
|
||||
println!("Try '{} --help' for more information.", NAME);
|
||||
return 1;
|
||||
crash!(
|
||||
1,
|
||||
"{0}: extra operand '{1}'\nTry '{0} --help' for more information.",
|
||||
NAME,
|
||||
args[3]
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue