1
0
mirror of https://github.com/sharkdp/bat synced 2026-08-06 19:21:43 +00:00

refactor: Port to clap3

Ths does remove the specialization of version's description.  The way
this is done (internally through `mut_arg`) doesn't play well with
subcommands.  Clap tries to force this version of `version` into the
subcommand despite not being needed.  Clap v4 dramatically changes how
version customization works.

clap also does more error checks now to prevent programmer mistake, so
we can't have a conflict with an argument that is conditionally there,
so I swapped the condition.
This commit is contained in:
Ed Page
2022-09-01 15:41:07 -05:00
committed by David Peter
parent 49875d6ce7
commit 2323804f7e
5 changed files with 61 additions and 56 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ fn is_truecolor_terminal() -> bool {
}
pub struct App {
pub matches: ArgMatches<'static>,
pub matches: ArgMatches,
interactive_output: bool,
}
@@ -49,7 +49,7 @@ impl App {
})
}
fn matches(interactive_output: bool) -> Result<ArgMatches<'static>> {
fn matches(interactive_output: bool) -> Result<ArgMatches> {
let args = if wild::args_os().nth(1) == Some("cache".into())
|| wild::args_os().any(|arg| arg == "--no-config")
{