Skip to content

Commit cbfe831

Browse files
committed
add validations and long help for ascii flag
1 parent a72b1ae commit cbfe831

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Diff for: src/onefetch/cli.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,19 @@ impl Cli {
7979
.long("ascii")
8080
.value_name("STRING")
8181
.takes_value(true)
82-
.help("Takes a STRING as input to replace the ASCII logo")
82+
.max_values(1)
83+
.help("Takes a non-empty STRING as input to replace the ASCII logo.")
84+
.long_help("Takes a non-empty STRING as input to replace the ASCII logo. \
85+
It is possible to pass a generated STRING by command substitution. \
86+
Example: onefetch --ascii \"$(fortune | cowsay -W 25)\"")
87+
.validator(
88+
|t| {
89+
if t.is_empty() {
90+
return Err(String::from("must not be empty"));
91+
}
92+
Ok(())
93+
},
94+
),
8395
)
8496
.arg(
8597
Arg::with_name("ascii-colors")

0 commit comments

Comments
 (0)