mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-30 09:05:54 +00:00
Add c long/c short and hide values
This commit is contained in:
1 parent
170573fad0
commit
c8e65d7528
1 file changed
+11
-1
+11
-1
@@ -228,13 +228,19 @@ fn run() -> Result<(), Box<::std::error::Error>> {
|
|||||||
.arg(Arg::with_name("file").help("File to display"))
|
.arg(Arg::with_name("file").help("File to display"))
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("length")
|
Arg::with_name("length")
|
||||||
.alias("c")
|
|
||||||
.short("n")
|
.short("n")
|
||||||
.long("length")
|
.long("length")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.value_name("N")
|
.value_name("N")
|
||||||
.help("Read only N bytes from the input"),
|
.help("Read only N bytes from the input"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("c")
|
||||||
|
.short("c")
|
||||||
|
.long("c")
|
||||||
|
.takes_value(true)
|
||||||
|
.hidden(true),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("color")
|
Arg::with_name("color")
|
||||||
.long("color")
|
.long("color")
|
||||||
@@ -264,6 +270,10 @@ fn run() -> Result<(), Box<::std::error::Error>> {
|
|||||||
reader = Box::new(reader.take(length));
|
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") {
|
let show_color = match matches.value_of("color") {
|
||||||
Some("never") => false,
|
Some("never") => false,
|
||||||
Some("auto") => atty::is(Stream::Stdout),
|
Some("auto") => atty::is(Stream::Stdout),
|
||||||
|
|||||||
Reference in new issue
Block a user