From 859071698a0f4e545a45ac226f8f858230ad634c Mon Sep 17 00:00:00 2001 From: Nathan Fisher Date: Sat, 4 Feb 2023 11:20:45 -0500 Subject: [PATCH] Use `args::file()` for input spec - base32/base64/rev --- src/cmd/base32/mod.rs | 7 ++----- src/cmd/base64/mod.rs | 2 +- src/cmd/rev/mod.rs | 5 +---- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/cmd/base32/mod.rs b/src/cmd/base32/mod.rs index 60ea587..ee48c7e 100644 --- a/src/cmd/base32/mod.rs +++ b/src/cmd/base32/mod.rs @@ -33,7 +33,7 @@ impl Cmd for Base32 { } _ => ColorChoice::Never, }; - if let Some(files) = matches.get_many::("files") { + if let Some(files) = matches.get_many::("file") { let (len, _) = files.size_hint(); for (index, file) in files.into_iter().enumerate() { if { len > 1 || matches.get_flag("verbose") } && !matches.get_flag("QUIET") { @@ -75,10 +75,7 @@ impl Cmd for Base32 { pub fn args() -> [Arg; 7] { [ - Arg::new("INPUT") - .help("The input file to use") - .num_args(1..) - .default_value("-"), + args::file(), Arg::new("DECODE") .help("Decode rather than encode") .short('d') diff --git a/src/cmd/base64/mod.rs b/src/cmd/base64/mod.rs index c707c69..8e176ca 100644 --- a/src/cmd/base64/mod.rs +++ b/src/cmd/base64/mod.rs @@ -32,7 +32,7 @@ impl Cmd for Base64 { } _ => ColorChoice::Never, }; - if let Some(files) = matches.get_many::("INPUT") { + if let Some(files) = matches.get_many::("file") { let (len, _) = files.size_hint(); for (index, file) in files.enumerate() { if { len > 1 || matches.get_flag("VERBOSE") } && !matches.get_flag("QUIET") { diff --git a/src/cmd/rev/mod.rs b/src/cmd/rev/mod.rs index 2ae69d3..06d5b94 100644 --- a/src/cmd/rev/mod.rs +++ b/src/cmd/rev/mod.rs @@ -18,10 +18,7 @@ impl Cmd for Rev { .args([ args::header(), args::color(), - Arg::new("file") - .help("if file is '-' read from stdin") - .num_args(1..) - .default_value("-"), + args::file(), ]) }