1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

fix(more) Return a proper error message when no argument is provided

Fix #1509
This commit is contained in:
Sylvestre Ledru 2020-05-11 00:18:23 +02:00 committed by Roy Ivy III
parent 279de2d664
commit 80203a7a02

View file

@ -41,6 +41,12 @@ static VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn uumain(args: Vec<String>) -> i32 { pub fn uumain(args: Vec<String>) -> i32 {
let mut opts = Options::new(); let mut opts = Options::new();
// FixME: fail without panic for now; but `more` should work with no arguments (ie, for piped input)
if args.len() < 2 {
println!("{}: incorrect usage", args[0]);
return 1;
}
opts.optflag("h", "help", "display this help and exit"); opts.optflag("h", "help", "display this help and exit");
opts.optflag("v", "version", "output version information and exit"); opts.optflag("v", "version", "output version information and exit");