Disable completion of `cache` subcommand (#2399)

* Disable completion of `cache` subcommand

* Fully removed completion code for `cache`

* Add to changelog
This commit is contained in:
cyqsimon 2022-12-18 18:46:43 +08:00 committed by GitHub
parent e19bebc1f6
commit b6b9d3a629
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 20 deletions

View File

@ -12,6 +12,7 @@
## Other ## Other
- Various bash completion improvements, see #2310 (@scop) - Various bash completion improvements, see #2310 (@scop)
- Disable completion of `cache` subcommand, see #2399 (@cyqsimon)
## Syntaxes ## Syntaxes

View File

@ -68,7 +68,8 @@ Register-ArgumentCompleter -Native -CommandName '{{PROJECT_EXECUTABLE}}' -Script
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print this help message.') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print this help message.')
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Show version information.') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Show version information.')
[CompletionResult]::new('--version', 'version', [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 break
} }
'{{PROJECT_EXECUTABLE}};cache' { '{{PROJECT_EXECUTABLE}};cache' {

View File

@ -184,6 +184,7 @@ _bat() {
fi fi
_filedir _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}} } && complete -F _bat {{PROJECT_EXECUTABLE}}

View File

@ -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 complete -c $bat -l wrap -x -a "$wrap_opts" -d "Text-wrapping mode" -n __bat_no_excl_args
# Sub-command 'cache' completions # 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 complete -c $bat -l build -f -d "Parse new definitions into cache" -n __bat_cache_no_excl

View File

@ -80,20 +80,14 @@ _{{PROJECT_EXECUTABLE}}_main() {
esac esac
} }
# first positional argument case $words[2] in
if (( ${#words} == 2 )); then cache)
local -a subcommands ## Completion of the 'cache' command itself is removed for better UX
subcommands=('cache:Modify the syntax-definition and theme cache') ## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802
_describe subcommand subcommands _{{PROJECT_EXECUTABLE}}_cache_subcommand
_{{PROJECT_EXECUTABLE}}_main ;;
else
case $words[2] in
cache)
_{{PROJECT_EXECUTABLE}}_cache_subcommand
;;
*) *)
_{{PROJECT_EXECUTABLE}}_main _{{PROJECT_EXECUTABLE}}_main
;; ;;
esac esac
fi