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
@@ -293,11 +293,11 @@ fn run() -> Result<bool> {
}
match app.matches.subcommand() {
("cache", Some(cache_matches)) => {
Some(("cache", cache_matches)) => {
// If there is a file named 'cache' in the current working directory,
// arguments for subcommand 'cache' are not mandatory.
// If there are non-zero arguments, execute the subcommand cache, else, open the file cache.
if !cache_matches.args.is_empty() {
if cache_matches.args_present() {
run_cache_subcommand(cache_matches)?;
Ok(true)
} else {