From 80203a7a024cd916755eb0c7a83b96ac44feab07 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 11 May 2020 00:18:23 +0200 Subject: [PATCH] fix(more) Return a proper error message when no argument is provided Fix #1509 --- src/uu/more/src/more.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 44a61dc20..32350e58e 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -41,6 +41,12 @@ static VERSION: &str = env!("CARGO_PKG_VERSION"); pub fn uumain(args: Vec) -> i32 { 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("v", "version", "output version information and exit");