Add styler zsh completions
Can list available commands, specific options for commands (such as list), and a complete list of installed themes that can be applied.
This commit is contained in:
parent
b344242dff
commit
1d28202f17
1 changed files with 50 additions and 0 deletions
50
styler/.config/zsh/completions/_styler
Executable file
50
styler/.config/zsh/completions/_styler
Executable file
|
@ -0,0 +1,50 @@
|
|||
#compdef styler
|
||||
# the above line should contain all commands to be completed using this file
|
||||
# zsh autocompletions for styler script
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
local cmdnames=(theme set download list help version)
|
||||
|
||||
_arguments -C \
|
||||
'1: :->cmds' \
|
||||
'2: :->args' \
|
||||
'3: :->subrout' && ret=0
|
||||
|
||||
local -a initial_commands=(
|
||||
'theme:Temporarily switch theme to specified argument'
|
||||
'set:Permanently set theme to specified argument'
|
||||
'download:Download a base16 compatible template'
|
||||
'list:Display installed processors, templates, or themes'
|
||||
'help:Display help text and exit'
|
||||
'version:Display styler information and exit'
|
||||
)
|
||||
|
||||
__themes() {
|
||||
echo "$(styler list themes)"
|
||||
}
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
_describe -t commands 'styler cmd' initial_commands && ret=0
|
||||
;;
|
||||
|
||||
args)
|
||||
case $words[2] in
|
||||
theme | set)
|
||||
_values 'themes' $(__themes) && ret=0
|
||||
;;
|
||||
|
||||
list)
|
||||
_values 'listopts' \
|
||||
'processors[Display available application processors]' \
|
||||
'templates[Display available base16 templates]' \
|
||||
'themes[Display available base16 themes]' && ret=0
|
||||
;;
|
||||
|
||||
*)
|
||||
((ret)) && _message 'no more arguments'
|
||||
;;
|
||||
|
||||
esac
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue