Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable completion of cache subcommand #2399

Merged
merged 3 commits into from
Dec 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion assets/completions/_bat.ps1.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ Register-ArgumentCompleter -Native -CommandName '{{PROJECT_EXECUTABLE}}' -Script
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print this help message.')
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Show version information.')
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Show version information.')
[CompletionResult]::new('cache', 'cache', [CompletionResultType]::ParameterValue, 'Modify the syntax-definition and theme cache')
## Completion of the 'cache' command itself is disabled for better UX
## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802
#[CompletionResult]::new('cache', 'cache', [CompletionResultType]::ParameterValue, 'Modify the syntax-definition and theme cache')
break
}
'{{PROJECT_EXECUTABLE}};cache' {
Expand Down
5 changes: 4 additions & 1 deletion assets/completions/bat.bash.in
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ _bat() {
fi

_filedir
((cword == 1)) && COMPREPLY+=($(compgen -W cache -- "$cur"))

## Completion of the 'cache' command itself is disabled for better UX
## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802
#((cword == 1)) && COMPREPLY+=($(compgen -W cache -- "$cur"))

} && complete -F _bat {{PROJECT_EXECUTABLE}}
4 changes: 3 additions & 1 deletion assets/completions/bat.fish.in
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ complete -c $bat -s V -l version -f -d "Show version information" -n __fish_is_f
complete -c $bat -l wrap -x -a "$wrap_opts" -d "Text-wrapping mode" -n __bat_no_excl_args

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

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

Expand Down
9 changes: 6 additions & 3 deletions assets/completions/bat.zsh.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,12 @@ _{{PROJECT_EXECUTABLE}}_main() {

# first positional argument
if (( ${#words} == 2 )); then
local -a subcommands
subcommands=('cache:Modify the syntax-definition and theme cache')
_describe subcommand subcommands
## Completion of the 'cache' command itself is disabled for better UX
## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802
#local -a subcommands
#subcommands=('cache:Modify the syntax-definition and theme cache')
#_describe subcommand subcommands

_{{PROJECT_EXECUTABLE}}_main
else
case $words[2] in
Expand Down