summaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2019-08-25 02:45:48 +0200
committerOliver Kiddle <okiddle@yahoo.co.uk>2019-08-25 02:45:48 +0200
commitd86eff6f1446092b22543be4ce549b5411a49c19 (patch)
tree413810a063a5b44a658755e6e2922c5a5db8e82a /extra
parentad0365219f7f264ef0fdf0b3e4401bad7ac40e55 (diff)
Follow zsh conventions in zsh completion
Declaring curcontext etc local is superfluous as _arguments states are not used. It is also superfluous to include an outer function definition syntax in zsh autoloadable functions. Zsh convention is not to capitalize descriptions. It is also better to use the imperative mood verb form for descriptions as this allows them to start with the shortest form of the verb - e.g. "reduce" instead of "reduces" and results in better grammar in the absence of a sentence subject. I'd recommend this in the --help output too. Using _guard for the position and dimensions was unnecessary given that the values are not mixed with other matches.
Diffstat (limited to 'extra')
-rw-r--r--extra/completions/_alacritty42
1 files changed, 19 insertions, 23 deletions
diff --git a/extra/completions/_alacritty b/extra/completions/_alacritty
index a0e38bad..e9b0656f 100644
--- a/extra/completions/_alacritty
+++ b/extra/completions/_alacritty
@@ -1,26 +1,22 @@
#compdef alacritty
-_alacritty() {
- local context curcontext="$curcontext" state line
- typeset -A opt_args
+local ign
- _arguments \
- "(-h --help)"{-h,--help}"[Prints help information]" \
- "(-V --version)"{-V,--version}"[Prints version information]" \
- "(--no-live-config-reload)--live-config-reload[Enable automatic config reloading]" \
- "(--live-config-reload)--no-live-config-reload[Disable automatic config reloading]" \
- "(--persistent-logging)--persistent-logging[Keep the log file after quitting Alacritty]" \
- "--print-events[Print all events to stdout]" \
- {-q,-qq}"[Reduces the level of verbosity (min is -qq)]" \
- {-v,-vv,-vvv}"[Increases the level of verbosity (max is -vvv)]" \
- "--ref-test[Generates ref test]" \
- "--config-file[Specify an alternative config file]:file:_files" \
- "(-d --dimensions)"{-d,--dimensions}"[Window dimensions]:dimensions:_guard '<->' width: :_guard '<->' length" \
- "--position[Window position]:position:_guard '<->' x-pos: :_guard '<->' y-pos" \
- "(-t --title)"{-t,--title}"[Defines the window title]:title:" \
- "--class[Defines the window class]:class:" \
- "--working-directory[Start shell in specified directory]:directory:_dir_list" \
- "(-e --command)"{-e,--command}"[Execute command (must be last arg)]:program: _command_names -e:*::program arguments: _normal"
-}
-
-_alacritty "$@"
+(( $#words > 2 )) && ign='!'
+_arguments \
+ "$ign(-)"{-h,--help}"[print help information]" \
+ "(--no-live-config-reload)--live-config-reload[enable automatic config reloading]" \
+ "(--live-config-reload)--no-live-config-reload[disable automatic config reloading]" \
+ "(--persistent-logging)--persistent-logging[keep the log file after quitting Alacritty]" \
+ "--print-events[print all events to stdout]" \
+ '(-v)'{-q,-qq}"[reduce the level of verbosity (min is -qq)]" \
+ "--ref-test[generate ref test]" \
+ '(-q)'{-v,-vv,-vvv}"[increase the level of verbosity (max is -vvv)]" \
+ "$ign(-)"{-V,--version}"[print version information]" \
+ "--class=[define the window class]:class" \
+ "(-e --command)"{-e,--command}"[execute command (must be last arg)]:program: _command_names -e:*::program arguments: _normal" \
+ "--config-file=[specify an alternative config file]:file:_files" \
+ "(-d --dimensions)"{-d,--dimensions}"[specify window dimensions]:columns: :lines" \
+ "--position[specify window position]:x position: :y position" \
+ "(-t --title)"{-t+,--title=}"[define the window title]:title" \
+ "--working-directory=[start shell in specified directory]:directory:_directories"