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:
+2
-2
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user