Skip to content

Commit b6b9d3a

Browse files
authored
Disable completion of cache subcommand (#2399)
* Disable completion of `cache` subcommand * Fully removed completion code for `cache` * Add to changelog
1 parent e19bebc commit b6b9d3a

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
## Other
1313

1414
- Various bash completion improvements, see #2310 (@scop)
15+
- Disable completion of `cache` subcommand, see #2399 (@cyqsimon)
1516

1617
## Syntaxes
1718

assets/completions/_bat.ps1.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ Register-ArgumentCompleter -Native -CommandName '{{PROJECT_EXECUTABLE}}' -Script
6868
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print this help message.')
6969
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Show version information.')
7070
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Show version information.')
71-
[CompletionResult]::new('cache', 'cache', [CompletionResultType]::ParameterValue, 'Modify the syntax-definition and theme cache')
71+
## Completion of the 'cache' command itself is removed for better UX
72+
## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802
7273
break
7374
}
7475
'{{PROJECT_EXECUTABLE}};cache' {

assets/completions/bat.bash.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ _bat() {
184184
fi
185185

186186
_filedir
187-
((cword == 1)) && COMPREPLY+=($(compgen -W cache -- "$cur"))
188-
187+
188+
## Completion of the 'cache' command itself is removed for better UX
189+
## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802
189190
} && complete -F _bat {{PROJECT_EXECUTABLE}}

assets/completions/bat.fish.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ complete -c $bat -s V -l version -f -d "Show version information" -n __fish_is_f
198198
complete -c $bat -l wrap -x -a "$wrap_opts" -d "Text-wrapping mode" -n __bat_no_excl_args
199199

200200
# Sub-command 'cache' completions
201-
complete -c $bat -a cache -d "Modify the syntax/language definition cache" -n __fish_use_subcommand
201+
## Completion of the 'cache' command itself is removed for better UX
202+
## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802
202203

203204
complete -c $bat -l build -f -d "Parse new definitions into cache" -n __bat_cache_no_excl
204205

assets/completions/bat.zsh.in

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,14 @@ _{{PROJECT_EXECUTABLE}}_main() {
8080
esac
8181
}
8282

83-
# first positional argument
84-
if (( ${#words} == 2 )); then
85-
local -a subcommands
86-
subcommands=('cache:Modify the syntax-definition and theme cache')
87-
_describe subcommand subcommands
88-
_{{PROJECT_EXECUTABLE}}_main
89-
else
90-
case $words[2] in
91-
cache)
92-
_{{PROJECT_EXECUTABLE}}_cache_subcommand
93-
;;
83+
case $words[2] in
84+
cache)
85+
## Completion of the 'cache' command itself is removed for better UX
86+
## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802
87+
_{{PROJECT_EXECUTABLE}}_cache_subcommand
88+
;;
9489

95-
*)
96-
_{{PROJECT_EXECUTABLE}}_main
97-
;;
98-
esac
99-
fi
90+
*)
91+
_{{PROJECT_EXECUTABLE}}_main
92+
;;
93+
esac

0 commit comments

Comments
 (0)