diff --git a/CHANGELOG.md b/CHANGELOG.md index c744c5fe..f19ce5bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ## Other - Various bash completion improvements, see #2310 (@scop) +- Disable completion of `cache` subcommand, see #2399 (@cyqsimon) ## Syntaxes diff --git a/assets/completions/_bat.ps1.in b/assets/completions/_bat.ps1.in index cd8818b4..a8458e97 100644 --- a/assets/completions/_bat.ps1.in +++ b/assets/completions/_bat.ps1.in @@ -68,7 +68,8 @@ 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 removed for better UX + ## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802 break } '{{PROJECT_EXECUTABLE}};cache' { diff --git a/assets/completions/bat.bash.in b/assets/completions/bat.bash.in index 40481b48..05e4326a 100644 --- a/assets/completions/bat.bash.in +++ b/assets/completions/bat.bash.in @@ -184,6 +184,7 @@ _bat() { fi _filedir - ((cword == 1)) && COMPREPLY+=($(compgen -W cache -- "$cur")) - + + ## Completion of the 'cache' command itself is removed for better UX + ## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802 } && complete -F _bat {{PROJECT_EXECUTABLE}} diff --git a/assets/completions/bat.fish.in b/assets/completions/bat.fish.in index f3a5f9b8..54c8413a 100644 --- a/assets/completions/bat.fish.in +++ b/assets/completions/bat.fish.in @@ -198,7 +198,8 @@ 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 removed for better UX +## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802 complete -c $bat -l build -f -d "Parse new definitions into cache" -n __bat_cache_no_excl diff --git a/assets/completions/bat.zsh.in b/assets/completions/bat.zsh.in index d37022a2..ec8109de 100644 --- a/assets/completions/bat.zsh.in +++ b/assets/completions/bat.zsh.in @@ -80,20 +80,14 @@ _{{PROJECT_EXECUTABLE}}_main() { esac } -# first positional argument -if (( ${#words} == 2 )); then - local -a subcommands - subcommands=('cache:Modify the syntax-definition and theme cache') - _describe subcommand subcommands - _{{PROJECT_EXECUTABLE}}_main -else - case $words[2] in - cache) - _{{PROJECT_EXECUTABLE}}_cache_subcommand - ;; +case $words[2] in + cache) + ## Completion of the 'cache' command itself is removed for better UX + ## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802 + _{{PROJECT_EXECUTABLE}}_cache_subcommand + ;; - *) - _{{PROJECT_EXECUTABLE}}_main - ;; - esac -fi + *) + _{{PROJECT_EXECUTABLE}}_main + ;; +esac