From c8e65d75284f5449cbacb9fa9b25ee68204ccad1 Mon Sep 17 00:00:00 2001 From: selfup Date: Mon, 4 Feb 2019 17:04:26 -0600 Subject: [PATCH] Add c long/c short and hide values --- src/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 38245da..84f6e92 100644 --- a/src/main.rs +++ b/src/main.rs @@ -228,13 +228,19 @@ fn run() -> Result<(), Box<::std::error::Error>> { .arg(Arg::with_name("file").help("File to display")) .arg( Arg::with_name("length") - .alias("c") .short("n") .long("length") .takes_value(true) .value_name("N") .help("Read only N bytes from the input"), ) + .arg( + Arg::with_name("c") + .short("c") + .long("c") + .takes_value(true) + .hidden(true), + ) .arg( Arg::with_name("color") .long("color") @@ -264,6 +270,10 @@ fn run() -> Result<(), Box<::std::error::Error>> { reader = Box::new(reader.take(length)); } + if let Some(length) = matches.value_of("c").and_then(|n| n.parse::().ok()) { + reader = Box::new(reader.take(length)); + } + let show_color = match matches.value_of("color") { Some("never") => false, Some("auto") => atty::is(Stream::Stdout),