mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-30 09:05:54 +00:00
Add get_one and fix ordering
This commit is contained in:
1 parent
767740865f
commit
ac610f7bad
1 file changed
+6
-6
+6
-6
@@ -112,9 +112,6 @@ fn run() -> Result<(), AnyhowError> {
|
|||||||
goes to an interactive terminal",
|
goes to an interactive terminal",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(Arg::new("plain").short('p').long("plain").action(ArgAction::SetTrue).help(
|
|
||||||
"Display output with --no-characters, --no-position, --border=none, and --color=never.",
|
|
||||||
))
|
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("border")
|
Arg::new("border")
|
||||||
.long("border")
|
.long("border")
|
||||||
@@ -128,6 +125,9 @@ fn run() -> Result<(), AnyhowError> {
|
|||||||
or none at all",
|
or none at all",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.arg(Arg::new("plain").short('p').long("plain").action(ArgAction::SetTrue).help(
|
||||||
|
"Display output with --no-characters, --no-position, --border=none, and --color=never.",
|
||||||
|
))
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("no_chars")
|
Arg::new("no_chars")
|
||||||
.short('C')
|
.short('C')
|
||||||
@@ -268,13 +268,13 @@ fn run() -> Result<(), AnyhowError> {
|
|||||||
reader.into_inner()
|
reader.into_inner()
|
||||||
};
|
};
|
||||||
|
|
||||||
let show_color = match matches.value_of("color") {
|
let show_color = match matches.get_one::<String>("color").map(String::as_ref) {
|
||||||
Some("never") => false,
|
Some("never") => false,
|
||||||
Some("auto") => atty::is(Stream::Stdout),
|
Some("auto") => atty::is(Stream::Stdout),
|
||||||
_ => true,
|
_ => true,
|
||||||
};
|
};
|
||||||
|
|
||||||
let border_style = match matches.value_of("border") {
|
let border_style = match matches.get_one::<String>("border").map(String::as_ref) {
|
||||||
Some("unicode") => BorderStyle::Unicode,
|
Some("unicode") => BorderStyle::Unicode,
|
||||||
Some("ascii") => BorderStyle::Ascii,
|
Some("ascii") => BorderStyle::Ascii,
|
||||||
_ => BorderStyle::None,
|
_ => BorderStyle::None,
|
||||||
@@ -309,7 +309,7 @@ fn run() -> Result<(), AnyhowError> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let panels = if matches.value_of("panels") == Some("auto") {
|
let panels = if matches.get_one::<String>("panels").map(String::as_ref) == Some("auto") {
|
||||||
max_panels_fn(terminal_size().ok_or_else(|| anyhow!("not a TTY"))?.0 .0 as u64)
|
max_panels_fn(terminal_size().ok_or_else(|| anyhow!("not a TTY"))?.0 .0 as u64)
|
||||||
} else if let Some(panels) = matches
|
} else if let Some(panels) = matches
|
||||||
.get_one::<String>("panels")
|
.get_one::<String>("panels")
|
||||||
|
|||||||
Reference in new issue
Block a user