Fix zsh completion

* Fix completion for -p option (#1320)
* Use prefixed function names to avoid name clash
This commit is contained in:
Albert Safin 2020-10-17 06:47:09 +00:00 committed by David Peter
parent 5d9adc14e7
commit 6bf7b79f13
1 changed files with 10 additions and 10 deletions

View File

@ -3,8 +3,8 @@
local context state state_descr line
typeset -A opt_args
(( $+functions[_cache_subcommand] )) ||
_cache_subcommand() {
(( $+functions[_{{PROJECT_EXECUTABLE}}_cache_subcommand] )) ||
_{{PROJECT_EXECUTABLE}}_cache_subcommand() {
local -a args
args=(
'(-b --build -c --clear)'{-b,--build}'[Initialize or update the syntax/theme cache]'
@ -19,12 +19,12 @@ _cache_subcommand() {
_arguments -S -s $args
}
(( $+functions[_main] )) ||
_main() {
(( $+functions[_{{PROJECT_EXECUTABLE}}_main] )) ||
_{{PROJECT_EXECUTABLE}}_main() {
local -a args
args=(
'(-A --show-all)'{-A,--show-all}'[Show non-printable characters (space, tab, newline, ..)]'
{-p,--plain}'[Show plain style (alias for `--style=plain`)]:When `-p` is used twice (`-pp`), it also disables automatic paging (alias for `--style=plain --paging=never`)'
'*'{-p,--plain}'[Show plain style (alias for `--style=plain`), repeat twice to disable disable automatic paging (alias for `--paging=never`)]'
'(-l --language)'{-l+,--language=}'[Set the language for syntax highlighting]:<language>:->language'
'(-H --highlight-line)'{-H,--highlight-line}'[Highlight lines N through M]:<N\:M>...'
'(--file-name)'--file-name'[Specify the name to display for a file]:<name>...:_files'
@ -79,15 +79,15 @@ if (( ${#words} == 2 )); then
local -a subcommands
subcommands=('cache:Modify the syntax-definition and theme cache')
_describe subcommand subcommands
_main
_{{PROJECT_EXECUTABLE}}_main
else
case $words[2] in
cache)
_cache_subcommand
_{{PROJECT_EXECUTABLE}}_cache_subcommand
;;
*)
_main
_{{PROJECT_EXECUTABLE}}_main
;;
esac
fi