summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheDoctor314 <darsh.rajan95@gmail.com>2021-07-02 19:34:06 +0530
committerDavid Peter <sharkdp@users.noreply.github.com>2021-07-11 19:57:55 +0200
commit19d2805729e6cabc34c916045056490e2c987233 (patch)
treea1685a1e3b0a2ca64e36734743fe1eda5b0ca42b
parent06387bba3eabf3021ca21daa8698c425c074b958 (diff)
Add alias '-l' for '-n/--length'
Set `.hidden(true)` option This won't clutter the help text too much.
-rw-r--r--src/bin/hexyl.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bin/hexyl.rs b/src/bin/hexyl.rs
index 71a9999..b161d22 100644
--- a/src/bin/hexyl.rs
+++ b/src/bin/hexyl.rs
@@ -50,6 +50,14 @@ fn run() -> Result<(), AnyhowError> {
.help("An alias for -n/--length"),
)
.arg(
+ Arg::with_name("count")
+ .short("l")
+ .takes_value(true)
+ .value_name("N")
+ .hidden(true)
+ .help("Yet another alias for -n/--length"),
+ )
+ .arg(
Arg::with_name("skip")
.short("s")
.long("skip")
@@ -177,6 +185,7 @@ fn run() -> Result<(), AnyhowError> {
let mut reader = if let Some(length) = matches
.value_of("length")
.or_else(|| matches.value_of("bytes"))
+ .or_else(|| matches.value_of("count"))
.map(|s| {
parse_byte_count(s).context(anyhow!(
"failed to parse `--length` arg {:?} as byte count",