Add c long/c short and hide values

This commit is contained in:
selfup authored and David Peter committed 2019-02-05 23:15:43 +01:00
1 parent 170573fad0
commit c8e65d7528
1 file changed
+11 -1
+11 -1
View File
@@ -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::<u64>().ok()) {
reader = Box::new(reader.take(length));
}
let show_color = match matches.value_of("color") {
Some("never") => false,
Some("auto") => atty::is(Stream::Stdout),