Use `args::file()` for input spec - base32/base64/rev

This commit is contained in:
Nathan Fisher 2023-02-04 11:20:45 -05:00
parent aa89efe63a
commit 859071698a
3 changed files with 4 additions and 10 deletions

View File

@ -33,7 +33,7 @@ impl Cmd for Base32 {
}
_ => ColorChoice::Never,
};
if let Some(files) = matches.get_many::<String>("files") {
if let Some(files) = matches.get_many::<String>("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')

View File

@ -32,7 +32,7 @@ impl Cmd for Base64 {
}
_ => ColorChoice::Never,
};
if let Some(files) = matches.get_many::<String>("INPUT") {
if let Some(files) = matches.get_many::<String>("file") {
let (len, _) = files.size_hint();
for (index, file) in files.enumerate() {
if { len > 1 || matches.get_flag("VERBOSE") } && !matches.get_flag("QUIET") {

View File

@ -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(),
])
}