mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-26 20:16:34 +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("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),
|
||||
|
||||
Reference in new issue
Block a user