Compare commits

...

42 Commits

Author SHA1 Message Date
F.B. 68d87279d0
Merge 5359bbf0e7 into 64f802936c 2026-05-18 20:20:56 -07:00
Shohei YOSHIDA 64f802936c
Merge pull request #1265 from zsh-users/update-jest
Update jest completion to version 30.4.0
2026-05-11 14:18:35 +09:00
Shohei YOSHIDA 41f6ed736a
Merge pull request #1264 from zsh-users/update-node
Update node.js completion to 26.1.0
2026-05-09 14:05:41 +09:00
Shohei YOSHIDA 69c9a70759
Update jest completion to version 30.4.0 2026-05-08 17:53:21 +09:00
Shohei YOSHIDA 70a2e272b8
Merge pull request #1263 from zsh-users/bug/clang-format
Remove needless '='
2026-05-08 11:38:49 +09:00
Shohei YOSHIDA 12c24c1bec
Update node.js completion to 26.1.0
- Remove outdated flags
- Cleanup experimental flags
- Add flags related to node:ffi
2026-05-08 11:37:01 +09:00
Mikael Magnusson 398b4b7477 Some typo fixes 2026-05-07 19:40:20 +02:00
Shohei YOSHIDA 42f28eb83a
Remove needless '=' 2026-05-07 10:28:39 +09:00
Shohei YOSHIDA 7a7ed4ea32
Merge pull request #1262 from zsh-users/update_openssl
Update openssl completion to 4.0.0
2026-05-06 14:02:16 +09:00
Shohei YOSHIDA d215391952
Update openssl completion to 4.0.0 2026-05-03 15:28:01 +09:00
Mikael Magnusson d4d30592c2 _tmuxp: typo expl 2026-05-03 04:19:53 +02:00
Mikael Magnusson 7a2db2fe49 _yarn: return values and _wanted 2026-05-03 04:19:53 +02:00
Mikael Magnusson 21621f3458 _tsc: remove stray backslash 2026-05-03 04:19:53 +02:00
Mikael Magnusson 8dd06dfaaf _sbt: add missing ret=0 2026-05-03 04:19:53 +02:00
Mikael Magnusson 96420d8c73 _pm2: consistent capitalization 2026-05-03 04:19:53 +02:00
Mikael Magnusson 32cff31cca _nano: set ret=0 for all the state stuff 2026-05-03 04:19:53 +02:00
Mikael Magnusson 41d22dc6e4 _mcookie: more useful heading for -m 2026-05-03 04:19:53 +02:00
Mikael Magnusson 4be40305ba _kitchen: don't use bare compadd 2026-05-03 04:19:53 +02:00
Mikael Magnusson 9a94ecb9c9 _hledger: fix bogus -A option placement
It got offered as a completion instead
2026-05-03 04:19:53 +02:00
Mikael Magnusson f916eeb8a3 _fallocate: mutually exclusive options
-n is disallowed with -c, and implied with -d/-p, so there's no point passing it there
2026-05-03 04:19:53 +02:00
Mikael Magnusson ef53598cbd _bundle: remove nonsensical -A options 2026-05-03 04:19:53 +02:00
Mikael Magnusson c4d76587ae Remove the 'this' from 'show this help and exit' in completers 2026-05-03 04:19:41 +02:00
Mikael Magnusson 5879b07714 _chmem: update with new options 2026-05-03 04:18:54 +02:00
Mikael Magnusson d5bf7ae200 _chcpu: improve help text for cpu list 2026-05-03 04:18:54 +02:00
Mikael Magnusson cf98cc27ba _cask: update a bit
It's unclear to me what arguments link actually takes from the
documentation so no attempt there.
2026-05-03 04:18:54 +02:00
Mikael Magnusson 8d536db182 _bower: fix completing options
the (--foo)--foo is harmless but redundant and makes things hard to
read, we only need that syntax when we want to prevent an option being
completed together with *another* option, such as the instance with
(-t --token){-t,--token} where _arguments doesn't know those do the same
thing.
2026-05-03 04:18:21 +02:00
Shohei YOSHIDA d3578edb5f
Merge pull request #1261 from zsh-users/update-rubocop
Update rubocop completion to version 1.86.1
2026-04-28 09:15:55 +09:00
Shohei YOSHIDA d862f3b114
Update rubocop completion to version 1.86.1 2026-04-27 11:48:13 +09:00
fishBone000 5359bbf0e7
Forgot to change ToC 2024-09-18 06:07:34 +00:00
fishBone000 a3e89f7c56
Reread to make the doc more fluent 2024-09-18 06:06:48 +00:00
fishBone000 cf57a3266c
Try to fix ToC 2024-09-18 04:52:48 +00:00
fishBone000 41896a6013
Finish most TODOs 2024-09-18 04:43:01 +00:00
fishBone000 0d8667bb6a
Fix Table of Contents
I forgot to change it
2024-09-18 04:17:10 +00:00
fishBone000 79c6d1715f
Finish Other resources 2024-09-18 04:15:31 +00:00
fishBone000 f5e58a5ca7
Finish Tips 2024-09-18 04:12:15 +00:00
fishBone000 6c8cd1b111
Finish Gotchas (things to look out for) 2024-09-18 04:01:09 +00:00
fishBone000 eb711299c5
Finish Testing & debugging 2024-09-18 03:53:13 +00:00
fishBone000 d71c3c84cc
Finish Writing your own completion code 2024-09-18 03:43:52 +00:00
fishBone000 c3f1f7748d
Finish Getting started 2024-09-17 07:40:59 +00:00
fishBone000 45fd6f398a
Fix document file extension 2024-09-17 07:15:24 +00:00
fishBone000 26b538f012
Finish Intro 2024-09-17 07:13:14 +00:00
fishBone000 fd43209f3a
Beginning of zh_cn translation 2024-09-17 06:37:21 +00:00
56 changed files with 672 additions and 173 deletions

View File

@ -91,7 +91,7 @@ case $service in
;;
(mp4dash)
options+=(
'(- *)'{-h,--help}'[Show this help message and exit]'
'(- *)'{-h,--help}'[Show help message and exit]'
'(-v --verbose)'{-v,--verbose}'[Be verbose]'
'(-d --debug)'{-d,--debug}'[Print out debugging information]'
'(-o --output-dir)'{-o,--output-dir=}'[Output directory]:dir:_files -/'
@ -148,7 +148,7 @@ case $service in
;;
(mp4dashclone)
options+=(
'(- *)'{-h,--help}'[Show this help message and exit]'
'(- *)'{-h,--help}'[Show help message and exit]'
'--quiet[Be quiet]'
'--encrypt=[Encrypt the media with KID and KEY specified in HEX(32 characters each)]:key'
'--exec-dir=[Directory where the Bento4 executables are located]:dir:_files -/'
@ -226,7 +226,7 @@ case $service in
;;
(mp4hls)
options+=(
'(- *)'{-h,--help}'[Show this help message and exit]'
'(- *)'{-h,--help}'[Show help message and exit]'
'(-v --verbose)'{-v,--verbose}'[Be verbose]'
'(-d --debug)'{-d,--debug}'[Print out debugging information]'
'(-o --output-dir)'{-o,--output-dir=}'[Output directory]:dir:_files -/'

View File

@ -43,7 +43,7 @@ _bitcoin-cli() {
local ret=1
_arguments -C \
-?'[This help message]' \
-?'[Show help message]' \
-addrinfo'[Get the number of addresses known to the node, per network and total]' \
-chain='[Use the chain <chain> (default: main). Allowed values: main, test, signet, regtest]:chain:(main test signet regtest)' \
-color='[Color setting for CLI output (default: auto)]:when:(always auto never)' \

View File

@ -43,6 +43,15 @@ local curcontext="$curcontext" state line _opts ret=1
_arguments -C \
'(- 1 *)'{-v,--version}'[display version information]' \
'--force[make various commands more forceful]' \
'--json[output consumable JSON]' \
'--log-level[what level of logs to report]:log level:(error conflict warn action info debug)' \
"--offline[don't hit the network]" \
'--quiet[only output important information]' \
"--silent[don't output anything, besides errors]" \
'--verbose[make output more verbose]' \
'--allow-root[allow running commands as root]' \
'--no-color[disable colors]' \
'1: :->cmds' \
'*:: :->args' && ret=0
@ -66,17 +75,6 @@ case $state in
"uninstall[remove a local package]" \
"unregister[remove a package from the registry]" \
"version[bump a package version]" && ret=0
_arguments \
'(--force)--force[make various commands more forceful]' \
'(--json)--json[output consumable JSON]' \
'(--log-level)--log-level[what level of logs to report]' \
"(--offline)--offline[don't hit the network]" \
'(--quiet)--quiet[only output important information]' \
"(--silent)--silent[don't output anything, besides errors]" \
'(--verbose)--verbose[make output more verbose]' \
'(--allow-root)--allow-root[allow running commands as root]' \
'(--version)--version[output Bower version]' \
'(--no-color)--no-color[disable colors]' && ret=0
;;
args)
case $line[1] in
@ -101,42 +99,42 @@ case $state in
;;
(home|info|init|link|lookup|prune|register|search|unregister)
_arguments \
'(--help)--help[show help message]' && ret=0
'--help[show help message]' && ret=0
;;
install)
_arguments \
'(--force-latest)--force-latest[force latest version on conflict]' \
'(--help)--help[show help message]' \
"(--production)--production[don't install project devDependencies]" \
"(--save)--save[save installed packages into the project's bower.json dependencies]" \
"(--save-dev)--save-dev[save installed packages into the project's bower.json devDependencies]" && ret=0
'--force-latest[force latest version on conflict]' \
'--help[show help message]' \
"--production[don't install project devDependencies]" \
"--save[save installed packages into the project's bower.json dependencies]" \
"--save-dev[save installed packages into the project's bower.json devDependencies]" && ret=0
;;
list)
_arguments \
'(--help)--help[show help message]' \
'(--paths)--paths[generate a simple JSON source mapping]' \
'(--relative)--relative[make paths relative to the directory config property, which defaults to bower_components]' && ret=0
'--help[show help message]' \
'--paths[generate a simple JSON source mapping]' \
'--relative[make paths relative to the directory config property, which defaults to bower_components]' && ret=0
;;
login)
_arguments \
'(--help)--help[show help message]' \
'--help[show help message]' \
'(-t --token)'{-t,--token}'[Pass GitHub auth token (will not prompt for username/password)]' && ret=0
;;
uninstall)
_arguments \
'(--help)--help[show help message]' \
"(--save)--save[save installed packages into the project's bower.json dependencies]" \
"(--save-dev)--save-dev[save installed packages into the project's bower.json devDependencies]" && ret=0
'--help[show help message]' \
"--save[save installed packages into the project's bower.json dependencies]" \
"--save-dev[save installed packages into the project's bower.json devDependencies]" && ret=0
;;
update)
_arguments \
'(--force-latest)--force-latest[force latest version on conflict]' \
'(--help)--help[show help message]' \
"(--production)--production[don't install project devDependencies]" && ret=0
'--force-latest[force latest version on conflict]' \
'--help[show help message]' \
"--production[don't install project devDependencies]" && ret=0
;;
version)
_arguments \
'(--message)--message[custom git commit and tag message]' && ret=0
'--message[custom git commit and tag message]' && ret=0
;;
exec)
_normal && ret=0

View File

@ -46,9 +46,9 @@ _bundle() {
local ret=1
_arguments -C -A "-v" -A "--version" \
_arguments -C \
'(- 1 *)'{-v,--version}'[display version information]' \
'(-r --retry)'{-r,--retry}'[specify the number of times you with to attempt network commands]:number:' \
'(-r --retry)'{-r,--retry}'[specify the number of times to attempt network commands]:number:' \
'(-V --verbose)'{-V,--verbose}'[print out additional logging information]' \
'--no-color[print all output without color]' \
'1: :_bundle_commands' \
@ -226,7 +226,7 @@ _bundle() {
'--bundler=-[update the locked version of bundler to the given version or the latest version]:version' \
'--local[do not attempt to connect to rubygems.org]' \
'--print[prints the lockfile to STDOUT instead of writing to the file system]' \
'--lockfile=[the path where the lick file should be written to]: :_files' \
'--lockfile=[the path where the lock file should be written to]: :_files' \
'--full-index[fall back to using the single file index of all gems]' \
'--gemfile=[use the specified gemfile instead of Gemfile]:file:_files' \
'--add-checksums[add checksums to the lockfile]' \

View File

@ -46,17 +46,16 @@ function _cask() {
local curcontext="$curcontext"
_arguments -C \
'(--proxy --http-proxy --https-proxy)--proxy[Set emacs proxy for HTTPS and HTTPS]:host:_hosts' \
'(--proxy --http-proxy)--http-proxy[Set emacs proxy for HTTP]:host:_hosts' \
'(--proxy --http-proxy )--http-proxy[Set emacs proxy for HTTP]:host:_hosts' \
'(--proxy --https-proxy)--https-proxy[Set emacs proxy for HTTPS]:host:_hosts' \
'(--proxy --http-proxy --https-proxy)--proxy[Set emacs proxy for HTTPS and HTTPS]:host:_hosts' \
'--no-proxy[Set Emacs no-proxy to HOST]:host:_hosts' \
'( --http-proxy --https-proxy)--proxy[Set emacs proxy for HTTPS and HTTPS]:host:_hosts' \
'--no-proxy[Set Emacs no-proxy to HOST (emacs pattern of hosts to not use proxy for)]:pattern:_hosts' \
'(- *)--version[Print Cask version and exit]' \
'(- *)'{-h,--help}'[Display usage or information for command]::command:->subcommand' \
'--debug[Turn on debug output]' \
'--path[Run command in this PATH instead of default-directory]:dir:_files -/' \
'(--verbose --silent)--verbose[Be verbose and show debug output]' \
'(--verbose --silent)--verbose[Be slient and do not show anything]' \
'(--verbose --silent)--silent[Be silent and do not show anything]' \
':subcommand:->subcommand' \
'*:: :->subcmds' \
&& ret=0
@ -66,6 +65,8 @@ function _cask() {
local -a subcommands=(
"build:build all Elisp files in the files directive"
"clean-elc:remove all byte compiled Elisp files in the files directive"
"emacs:run emacs"
"eval:evaluate FORM as a lisp form"
"exec:execute command with correct 'exec-path' and 'load-path'"
"exec-path:print 'exec-path' for all packages and dependencies"
"files:print list of files specified in the files directive"
@ -99,6 +100,19 @@ function _cask() {
(exec)
_generic
;;
(emacs)
_as_if emacs && ret=0
;;
(help)
_as_if cask --help && ret=0
;;
(link)
_message "completion unimplemented"
ret=0
;;
(package)
_wanted package-dir expl 'package directory' _files -/ && ret=0
;;
esac
;;
esac

View File

@ -19,7 +19,7 @@ _chatblade() {
typeset -A opt_args
args+=(
'(- *)'{-h,--help}'[show this help message and exit]'
'(- *)'{-h,--help}'[show help message and exit]'
'(- *)--version[display the chatblade version]'
'--openai-api-key[the OpenAI API key can also be set as env variable OPENAI_API_KEY]:key'
'--openai-base-url[a custom URL to use the openAI against a local or custom model]:key'

View File

@ -35,12 +35,12 @@
# ------------------------------------------------------------------------------
_arguments \
'(- *)'{-h,--help}'[display this help]' \
'(- *)'{-h,--help}'[display help]' \
'(- *)'{-V,--version}'[display version]' \
'(-c --configure)'{-c,--configure}'[configure the specified CPUs]:cpu_list' \
'(-d --disable)'{-d,--disable}'[disable the specified CPUs]:cpu_list' \
'(-e --enable)'{-e,--enable}'[enable the specified CPUs]:cpu_list' \
'(-g --deconfigure)'{-g,--deconfigure}'[deconfigure the specified CPUs]:cpu_list' \
'(-c --configure)'{-c,--configure}'[configure the specified CPUs]:cpu list (0,5,7,9-11)' \
'(-d --disable)'{-d,--disable}'[disable the specified CPUs]:cpu list (0,5,7,9-11)' \
'(-e --enable)'{-e,--enable}'[enable the specified CPUs]:cpu list (0,5,7,9-11)' \
'(-g --deconfigure)'{-g,--deconfigure}'[deconfigure the specified CPUs]:cpu_list (0,5,7,9-11)' \
'(-p --dispatch)'{-p,--dispatch}'[set the CPU dispatching mode]:mode:(horizontal vertical)' \
'(-r --rescan)'{-r,--rescan}'[trigger a rescan of CPUs]'

View File

@ -35,14 +35,29 @@
# *Aditi Sharma (https://github.com/Aditi76117)
# ------------------------------------------------------------------------------
local arg
if (( ${words[(I)(-b|--blocks)]} )); then
arg=blockrange
else
arg='size or range'
fi
if (( ${words[(I)(-e|-d|-c|-m|--disable|--enable|--deconfigure|--configure)]} )); then
arg="1:${arg}"
else
unset arg
fi
_arguments -s \
'(-b --blocks)'{-b,--blocks}'[Use a BLOCKRANGE parameter instead of RANGE or SIZE]' \
'(-d --disable)'{-d,--disable}'[Set the specified RANGE, SIZE, or BLOCKRANGE of memory offline]' \
'(-e --enable)'{-e,--enable}'[Set the specified RANGE, SIZE, or BLOCKRANGE of memory online]' \
'(-z --zone)'{-z,--zone}'[Select the memory ZONE where to set the specified RANGE, SIZE, or BLOCKRANGE of memory online or offline]' \
'(-e --enable -d --disable -c --configure -g --deconfigure -m --memmap-on-memory)'{-d,--disable}'[Set the specified RANGE, SIZE, or BLOCKRANGE of memory offline]' \
'(-e --enable -d --disable -c --configure -g --deconfigure -m --memmap-on-memory)'{-e,--enable}'[Set the specified RANGE, SIZE, or BLOCKRANGE of memory online]' \
'(-e --enable -d --disable -c --configure -g --deconfigure -m --memmap-on-memory)'{-g,--deconfigure}'[Deconfigure the specified RANGE, SIZE, or BLOCKRANGE of memory]' \
'(-e --enable -d --disable -c --configure -g --deconfigure )'{-c,--configure}'[Configure the specified RANGE, SIZE, or BLOCKRANGE of memory]' \
'(-e --enable -d --disable -g --deconfigure -m --memmap-on-memory)'{-m,--memmap-on-memory}'[Select memmap-on-memory for the specified memory]:memmap-on-memory' \
'(-z --zone)'{-z,--zone}'[Select the memory ZONE where to set the specified RANGE, SIZE, or BLOCKRANGE of memory online or offline]:zone' \
'(-v --verbose)'{-v,--verbose}'[Verbose mode]' \
'(- *)'{-h,--help}'[Display help text and exit]' \
'(- *)'{-V,--version}'[Print version and exit]'
'(- *)'{-V,--version}'[Print version and exit]' \
${arg}
# Local Variables:
# mode: Shell-Script

View File

@ -35,7 +35,7 @@
# ------------------------------------------------------------------------------
_arguments \
'(- *)'{-h,--help}'[display this help]' \
'(- *)'{-h,--help}'[display help]' \
'(-c --crypt-method)'{-c,--crypt-method}'[use the specified method to encrypt the passwords]:method:(DES MD5 SHA256 SHA512 YESCRYPT NONE)' \
'(-e --encrypted)'{-e,--encrypted}'[supplied passwords are in encrypted form]' \
'(-m --md5)'{-m,--md5}'[use MD5 encryption instead of DES]' \

View File

@ -42,7 +42,7 @@ _arguments \
'(- *)--help-list[Display list of available options]' \
'(- *)--help-list-hidden[Display list of more available options]' \
'--Wclang-format-violations[Warnings about individual formatting changes needed]' \
'--Werror=[If set, changes formatting warnings to errors]' \
'--Werror[If set, changes formatting warnings to errors]' \
'*--Wno-error=[If set, do not error out on the specified warning type]:warn' \
'--assume-filename=[Set filename used to determine the language and to find .clang-format file]: :_files' \
'--cursor=[The position of the cursor when invoking clang-format from an editor integration]:pos' \

View File

@ -47,7 +47,7 @@ _arguments -s -S \
'(-b --bare)'{-b,--bare}'[compile without a top-level function wrapper]' \
'(-c --compile)'{-c,--compile}'[compile to JavaScript and save as .js files]' \
'(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \
'(- *)'{-h,--help}'[display this help message]' \
'(- *)'{-h,--help}'[display help message]' \
'(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \
'(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]: :_files -g "*.coffee"' \
'(-l --literate)'{-l,--literate}'[treat stdio as literate style coffeescript]' \

View File

@ -78,7 +78,7 @@ _cppcheck() {
"(-f --force)"{-f,--force}"[Force checking of all configurations in files]" \
"(--fsigned-char --funsigned-char)--fsigned-char[Treat char type as signed]" \
"(--fsigned-char --funsigned-char)--funsigned-char[Treat char type as unsigned]" \
"(- 1 *)"{-h,--help}"[Print this help]" \
"(- 1 *)"{-h,--help}"[Print help]" \
"-I[A file that contains a list of config-excludes]:directory:_files -/" \
"--include-file=[Specify directory paths to search for included header files in a text file]:file:_files" \
"--include=[Force inclusion of a file before the checked file]:file:_files" \

View File

@ -176,8 +176,8 @@ _dart() {
'--write-service-info=[Outputs information necessary to connect to the VM service]:service_info:_files' \
'(--no-dds --dds)--dds[Use the Dart Development Service for enhanced debugging functionality]' \
'(--no-dds --dds)--no-dds[Not use the Dart Development Service for enhanced debugging functionality]' \
'(--no-serve-observatory --serve-observatory)--serve-observatory[Enable hosting Observatory throught the VM service]' \
'(--no-serve-observatory --serve-observatory)--no-serve-observatory[Disable hosting Observatory throught the VM service]' \
'(--no-serve-observatory --serve-observatory)--serve-observatory[Enable hosting Observatory through the VM service]' \
'(--no-serve-observatory --serve-observatory)--no-serve-observatory[Disable hosting Observatory through the VM service]' \
'(--no-print-dtd --print-dtd)--print-dtd[Prints connection details for the Dart Tooling Daemon]' \
'(--no-print-dtd --print-dtd)--no-print-dtd[Not print connection details for the Dart Tooling Daemon]' \
'--enable-experiment=[Enable one or more experimental features]:features:_dart_run_enable_experiment' \
@ -679,7 +679,7 @@ _dart_run_timeline_streams() {
(( $+functions[_dart_run_enable_experiment] )) ||
_dart_run_enable_experiment() {
local -a features=(
'augumentations:Augumentations - enhancing declarations from outside'
'augumentations:Augmentations - enhancing declarations from outside'
'const-function:Allow more of the Dart language to be executed in const expression'
'dot-shorthands:Shorter dot syntax for static accesses'
'enhanced-parts:Generalize parts to be nested and have exports/imports'

View File

@ -49,7 +49,7 @@ _direnv_commands() {
'exec:Executes a command after loading the first .envrc or .env found in DIR'
'export:Loads an .envrc or .env and prints the diff in terms of exports'
"fetchurl:Fetches a given URL into direnv's CAS"
'help:shows this help'
'help:shows help'
'hook:Used to setup the shell hook'
'prune:removes old allowed files'
'reload:triggers an env reload'

View File

@ -35,7 +35,7 @@
# ------------------------------------------------------------------------------
_arguments \
'(- *)'{-h,--help}'[Show this help message and exit]' \
'(- *)'{-h,--help}'[Show help message and exit]' \
'(- *)'{-v,--version}'[Show version and exit]' \
'(-d --devel-release)'{-d,--devel-release}'[Upgrade to the development release]' \
'--data-dir=[Directory that contains the data files]:dir:_files -/' \

View File

@ -40,7 +40,7 @@
# ------------------------------------------------------------------------------
local -a args=(
'(-h --help)'{-h+,--help}'[show this help message and exit]'
'(-h --help)'{-h+,--help}'[show help message and exit]'
'(-)'--version'[display version information and exit]'
'(-)1:directory: _path_files -/'
'(-)2:command: _command_names -e'

View File

@ -54,7 +54,7 @@ _fail2ban_client() {
'-b[start server in background]' \
'-f[start server in foreground]' \
'--str2sec[convert time abbreviation format to seconds]:_message str2sec' \
'(-h --help)'{-h,--help}'[display this help message]' \
'(-h --help)'{-h,--help}'[display help message]' \
'(-V --version)'{-V,--version}'[print the version]' \
'1:fail2ban command:_fail2ban_client_commands' \
'*:fail2ban command argument:_fail2ban_client_command_arguments'

View File

@ -38,16 +38,16 @@
# ------------------------------------------------------------------------------
_arguments \
'(-c --collapse-range)'{-c,--collapse-range}'[Removes a byte range from a file without leaving a hole]' \
'(-d --dig-holes)'{-d,--dig-holes}'[Detect and dig holes]' \
'(-c --collapse-range -d --dig-holes -p --punch-hole -z --zero-range -n --keep-size)'{-c,--collapse-range}'[Removes a byte range from a file without leaving a hole]' \
'(-c --collapse-range -d --dig-holes -p --punch-hole -z --zero-range -n --keep-size)'{-d,--dig-holes}'[Detect and dig holes]' \
'(-c --collapse-range -d --dig-holes -p --punch-hole -z --zero-range -n --keep-size)'{-p,--punch-hole}'[Deallocates space in the byte range starting at offset and continuing for length bytes]' \
'(-c --collapse-range -d --dig-holes -p --punch-hole -z --zero-range )'{-z,--zero-range}'[Zeroes space in the byte range starting at offset and continuing for length bytes]' \
'(-c --collapse-range -d --dig-holes -p --punch-hole -n --keep-size)'{-n,--keep-size}'[Do not modify the apparent length of the file]' \
'(-i --insert-range)'{-i,--insert-range}'[Insert a hole of length bytes from offset]' \
'(-l --length)'{-l+,--length}'[Specifies the length of the range, in bytes]:bytes' \
'(-n --keep-size)'{-n,--keep-size}'[Do not modify the apparent length of the file]' \
'(-o --offset)'{-o+,--offset}'[Specifies the beginning offset of the range, in bytes]:offset' \
'(-p --punch-hole)'{-p,--punch-hole}'[Deallocates space in the byte range starting at offset and continuing for length bytes]' \
'(-v --verbose)'{-v,--verbose}'[Enable verbose mode]' \
'(-x --posix)'{-x,--posix}'[Enable POSIX operation mode]' \
'(-z --zero-range)'{-z,--zero-range}'[Zeroes space in the byte range starting at offset and continuing for length bytes]' \
'(- *)'{-h,--help}'[Display help text and exit]' \
'(- *)'{-V,--version}'[Print version and exit]' \
'*:filename:_files'

View File

@ -463,7 +463,7 @@ _flutter() {
_arguments \
'(- *)'{-h,--help}'[Print this usage information]' \
'(-d --debug-info)'{-d,--debug-info=}'[A path to the symbols file generated with "--split-debug-info"]: :_files' \
'(-u --unit-id-debug-info)'{-d,--unit-id-debug}'[A loading unit id and the path to the symbols file]:id' \
'(-u --unit-id-debug-info)'{-u,--unit-id-debug}'[A loading unit id and the path to the symbols file]:id' \
'(-i --input)'{-i,--input=}'[A file path containing a Dart stack trace]: :_files' \
'(-o --output)'{-o,--output=}'[A file path for a symbolized stack trace to be written to]: :_files' \
&& ret=0
@ -936,7 +936,7 @@ _flutter_pub_cache() {
(clean)
_arguments \
'(- *)'{-h,--help}'[Print this usage information]' \
'(-f --force)'{f,--force}'[Do not ask for confirmation]' \
'(-f --force)'{-f,--force}'[Do not ask for confirmation]' \
&& ret=0
;;
(repair)

View File

@ -141,7 +141,7 @@ _fwupdmgr_commands() {
'set-approved-firmware:sets the list of approved firmware'
'set-bios-setting:sets one or more BIOS settings'
'switch-branch:switch the firmware branch on device'
'sync-bkc:sync firmware versions to the host best known configuration '
'sync-bkc:sync firmware versions to the host best known configuration'
'unblock-firmware:unblocks a specific firmware from being installed'
'uninhibit:uninhibit the system to allow upgrades'
'unlock:unlocks the device for firmware access'

View File

@ -922,7 +922,7 @@ _ghc_pkg() {
'--expand-env-vars[expand environment variables in input package descriptions]'
'(--expand-pkgroot --no-expand-pkgroot)--expand-pkgroot[expand pkgroot-relative paths in output package descriptions]'
'(--expand-pkgroot --no-expand-pkgroot)--no-expand-pkgroot[preserve pkgroot-relative paths in output package descriptions]'
'(- *)'{-?,--help}'[display this help and exit]'
'(- *)'{-?,--help}'[display help and exit]'
'(- *)'{-V,--version}'[output version information and exit]'
'--simple-output[print output in easy-to-parse format for some commands]'
'--show-unit-ids[print unit-ids instead of package identifiers]'

View File

@ -104,8 +104,8 @@ __git-flow-release () {
'start:Start a new release branch.'
'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git flow release`)'
'publish:Publish this release branch to origin.`)'
'track:Track a release branch from origin.`)'
'publish:Publish this release branch to origin.'
'track:Track a release branch from origin.'
)
_describe -t commands 'git flow release' subcommands
_arguments \
@ -162,7 +162,7 @@ __git-flow-hotfix () {
'start:Start a new hotfix branch.'
'finish:Finish a hotfix branch.'
'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
'publish:Publish this hotfix branch to origin`)'
'publish:Publish this hotfix branch to origin'
)
_describe -t commands 'git flow hotfix' subcommands
_arguments \

View File

@ -41,7 +41,7 @@
_glances() {
_arguments \
'(- *)'{-h,--help}'[show this help message and exit]' \
'(- *)'{-h,--help}'[show help message and exit]' \
'--print-completion[print shell completion script]:shell:(bash zsh tcsh)' \
'(- *)'{-V,--version}"[show program's version number and exit]" \
'(-d --debug)'{-d,--debug}'[enable debug mode]' \

View File

@ -427,7 +427,6 @@ case $state in
local -a fix_flags=(
'-fixtool=[specify fix analyzer]:analyzer:__golang_fix_analyzers'
'-diff[display diffs instead of rewriting files]'
'-fixtool=[select analysis tool]:analyzer:'
'(- *)-V[print version and exit]'
'-any[enable any analysis]'
'-buildtag[enable buildtag analysis]'
@ -747,7 +746,6 @@ case $state in
'-test.fuzzminimizetime[time to spend minimizing a value after finding a failing input (default 1m0s)]:t' \
'-test.fuzztime[time to spend fuzzing; default is to run indefinitely]:t' \
'-test.fuzzworker[coordinate with the parent process to fuzz random values (for use only by cmd/go)]' \
'-test.list[list tests, examples, and benchmarks matching regexp then exit]:regexp' \
'-test.memprofile[write an allocation profile to file]:file:_files' \
'-test.memprofilerate[set memory allocation profiling rate (see runtime.MemProfileRate)]:rate' \
'-test.mutexprofile[write a mutex contention profile to the named file after execution]:string' \

View File

@ -14,7 +14,7 @@
# ------------------------------------------------------------------------------
_arguments -s \
'(- *)'{-h,--help}'[display this help and exit]' \
'(- *)'{-h,--help}'[display help and exit]' \
'(- *)'{-v,--version}'[display version information and exit]' \
{-t,--traditional}'[use traditional greeting]' \
{-g,--greeting=}'[use TEXT as the greeting message]:TEXT'

View File

@ -64,7 +64,7 @@ args=(
'--forecast=[apply periodic transaction rules to generate future transactions]'
)
_arguments -C "$args[@]" -A "-*" \
_arguments -C -A "-*" "$args[@]" \
'(- *)--version[print version information]' \
'--debug[show debug output]' \
'1: :->cmds' \

View File

@ -167,7 +167,7 @@ _arguments -n -C -s \
'--unsorted[Disables all sorting while formatting output]' \
'--sorted[Re-enables all sorting options while formatting output]' \
'--response-charset=[Override the response encoding for terminal display purposes]:encoding' \
'--response-mime=[Override the response mime type for coloring and formatting for the terminal]:mine' \
'--response-mime=[Override the response mime type for coloring and formatting for the terminal]:mime' \
'--format-options=[Controls output formatting]:format' \
'(-p --print)'{-p,--print}'=[String specifying what the output should contain]:print flags:_httpie_printflags' \
'(-v --verbose)'{-v,--verbose}'[Print the whole request as well as the response]' \

View File

@ -28,7 +28,7 @@
# Description
# -----------
#
# Completion script for Jest 30.1.3 (https://jestjs.io/)
# Completion script for Jest 30.4.0 (https://jestjs.io/)
#
# ------------------------------------------------------------------------------
# Authors
@ -58,6 +58,7 @@ _arguments -C -s \
'--clearCache[Clear the configured Jest cache directory and then exits]' \
'--clearMocks[Automatically clear mock calls, instances, contexts and results before every test]' \
'--collectCoverageFrom[A glob pattern for collecting coverage info]:string' \
'--collectTests[Discover and report all test cases without executing them]' \
'(--color --colors)'{--color,--colors}'[Force test results output color highlighting (even if stdout is not a TTY)]' \
'(-c --config)'{-c,--config}'[The path to a jest config file specifying how to find and execute tests]:files:_files' \
'(--coverage --collectCoverage)'{--coverage,--collectCoverage}'[Indicate that test coverage information should be collected and reported in the output]' \
@ -142,12 +143,13 @@ _arguments -C -s \
'(-u --updateSnapshot)'{-u,--updateSnapshot}'[Re-record snapshots]' \
'--useStderr[Divert all output to stderr]' \
'--verbose[Display individual test results with the test suite hierarchy]' \
'--waitForUnhandledRejections[Give one event loop turn to handle unhandles rejections]' \
'--waitForUnhandledRejections[Give one event loop turn to handle unhandled rejections]' \
'--watch[Watch files for changes and rerun tests related to changed files]' \
'--watchAll[Watch files for changes and rerun all tests]' \
'--watchPathIgnorePatterns[Ignore patterns of watch path]:array' \
'(--watchman --no-watchman)--watchman[Use watchman for file crawling]' \
'(--watchman --no-watchman)--no-watchman[Do not use watchman for file crawling]' \
'--workerGracefulExitTimeout[Timeout msecs for worker processes to exit gracefully after test complete(Default 500ms)]:ms' \
'--workerThreads[Use worker threads for parallelization]' \
'*: :->file' \
&& ret=0

View File

@ -54,7 +54,7 @@ _kitchen() {
args)
case $line[1] in
converge|create|destroy|diagnose|list|setup|test|verify)
compadd 'all'
_wanted all-instances expl 'all instances' compadd 'all'
_kitchen_instances
;;
login)

View File

@ -90,7 +90,7 @@ case $state in
'gs-load-lily-fonts[load only LilyPond fonts via Ghostscript]:gs-load-lily-fonts:(\#t \#f)' \
'gs-never-embed-fonts[make Ghostscript embed only TrueType fonts and no other font format]:gs-never-embed-fonts:(\#t \#f)' \
'gui[run LilyPond from a GUI and redirect stderr to a log file]:gui:(\#t \#f)' \
'help[show this help]:help:(\#t \#f)' \
'help[show help]:help:(\#t \#f)' \
'include-book-title-preview[include book titles in preview images]:include-book-title-preview:(\#t \#f)' \
'include-eps-fonts[include fonts in separate-system EPS files]:include-eps-fonts:(\#t \#f)' \
'include-settings[included file before the score is processed]:include-settings:_files -g "*.(#i)ly(-.)"' \

View File

@ -80,7 +80,7 @@ _lscpu_cache() {
}
_arguments \
'(- *)'{-h,--help}'[display this help]' \
'(- *)'{-h,--help}'[display help]' \
'(- *)'{-V,--version}'[display version]' \
'(-a --all)'{-a,--all}'[print both online and offline CPUs(default for -e)]' \
'(-b --online)'{-b,--online}'[print online CPUs only]' \

View File

@ -91,7 +91,7 @@ _lsipc_output_columns() {
}
_arguments \
'(- *)'{-h,--help}'[display this help]' \
'(- *)'{-h,--help}'[display help]' \
'(- *)'{-V,--version}'[display version]' \
'(-m --shmems)'{-m,--shmems}'[shared memory segments]' \
'(-M --posix-shmems)'{-M,--posix-shmems}'[POSIX shared memory segments]' \

View File

@ -56,7 +56,7 @@ _lslocks_output_columns() {
}
_arguments \
'(- *)'{-h,--help}'[display this help]' \
'(- *)'{-h,--help}'[display help]' \
'(- *)'{-V,--version}'[display version]' \
'(-b --bytes)'{-b,--bytes}'[print SIZE in bytes rather]' \
'(-J --json)'{-J,--json}'[use the JSON output format]' \

View File

@ -70,7 +70,7 @@ _lslogins_output_columns() {
}
_arguments \
'(- *)'{-h,--help}'[display this help]' \
'(- *)'{-h,--help}'[display help]' \
'(- *)'{-V,--version}'[display version]' \
'(-a --acc-expiration)'{-a,--acc-expiration}'[display info about passwords expiration]' \
'(-c --colon-separate)'{-c,--colon-separate}'[display data in a format similar to /etc/passwd]' \

View File

@ -50,7 +50,7 @@ _lsmem_output_columns() {
}
_arguments \
'(- *)'{-h,--help}'[display this help]' \
'(- *)'{-h,--help}'[display help]' \
'(- *)'{-V,--version}'[display version]' \
'(-J --json)'{-J,--json}'[use the JSON output format]' \
'(-P --pairs)'{-P,--pairs}'[use key=value output format]' \

View File

@ -37,7 +37,7 @@
_arguments \
{-f,--file}'[Use file as as cookie seed]:file:_files' \
{-m,--max-size}'[Set maximum length of output]:number' \
{-m,--max-size}'[Set maximum length of output]:bytes' \
{-v,--verbose}'[Print entropy source and random seed info]' \
'(- *)'{-h,--help}'[Display help message and exit]' \
'(- *)'{-V,--version}'[Display version information and exit]'

View File

@ -362,7 +362,7 @@ _mix() {
'--partitions[set the amount of partitions to split tests in]:partition' \
'--preload-modules[preload all modules defined in applications]' \
'--profile-require[profile the time spent to require test files]:type:(time)' \
'--raise[immediate raise if the the test suite fails instead of continuing]' \
'--raise[immediate raise if the test suite fails instead of continuing]' \
'--repeat-until-failure[set the number of repetitions for running the suite until it fails]:num' \
'--seed[seed the random generator used to randomize the order of tests(0 means disable randomization)]:seed' \
'--slowest[print timing information for the N slowest tests]:num' \
@ -751,7 +751,7 @@ _mix_hex_tasks() {
local -a tasks=(
'add:Add a repository'
'set:Set config for repository'
'remove:Remote repository'
'remove:Remove repository'
'show:Show repository config'
'list:List all repos'
)

View File

@ -39,7 +39,7 @@
# ------------------------------------------------------------------------------
_arguments \
'(- *)--help[display this help message]' \
'(- *)--help[display help message]' \
'-d-[Verbose debug]:level:(0 1 2)' \
'-v-[SSH debug levels]:level:(0 1 2 3)' \
'-m-[Run concurrently on the specified hosts at a time. "0" is used for infinite]:count' \

View File

@ -77,8 +77,8 @@ if [[ -n $state ]]; then
+) _message -e lines "start at a given line" ;;
+[crCR]#[/?]) _message -e 'search string' ;;
+<->,) _message -e 'column number' ;;
*) _files && ret=0 ;;
esac
*) _files ;;
esac && ret=0
fi
return ret

View File

@ -28,7 +28,7 @@
# Description
# -----------
#
# Completion script for Node.js v25.9.0 (https://nodejs.org)
# Completion script for Node.js v26.1.0 (https://nodejs.org)
#
# ------------------------------------------------------------------------------
# Authors
@ -95,6 +95,7 @@ _node() {
'--abort-on-uncaught-exception[aborting instead of exiting causes a core file to be generated for analysis]' \
'--allow-addons[allow use of addons when any permissions are set]' \
'--allow-child-process[allow use of child process when any permissions are set]' \
'--allow-ffi[allow use of FFI when any permissions are set]' \
'--allow-fs-read=[allow permissions to read the filesystem]: :_files' \
'--allow-fs-write=[allow permissions to write in the filesystem]: :_files' \
'--allow-inspector[allow use of inspector when any permissions are set]' \
@ -129,6 +130,7 @@ _node() {
'--experimental-config-file=[set config file from supplied file]:file:_files' \
'--experimental-default-config-file[set config file from default config file]' \
'--experimental-eventsource[enable experimental EventSource API]' \
'--experimental-ffi[enable experimental node:ffi module]' \
'--experimental-import-meta-resolve[experimental ES Module import.meta.resolve() support]' \
'--experimental-inspector-network-resource[experimental load network resources via the inspector]' \
'(--loader --experimental-loader)'{--loader,--experimental-loader}'=[Specify the module of a custom ECMAScript Module loader]: :_files' \
@ -138,7 +140,6 @@ _node() {
'--experimental-storage-inspection[experimental storage inspection support]' \
'--experimental-test-coverage[enable code coverage in the test runner]' \
'--experimental-test-module-mocks[enable module mocking in the test runner]' \
'--experimental-transform-types[enable transformation of TypeScript-onlysyntax into JavaScript code]' \
'--experimental-vm-modules[experimental ES Module support in vm module]' \
'--experimental-worker-inspection[experimental worker inspection support]' \
'--expose-gc[expose gc extension]' \
@ -175,15 +176,18 @@ _node() {
'--no-experimental-global-navigator[expose experimental Navigator API on the global scope]' \
'--no-experimental-repl-await[disable experimental await keyword support in REPL]' \
'--no-experimental-sqlite[disable experimental node sqlite module]' \
'(--no-strip-types --no-experimental-strip-types)'{--no-strip-types,--no-experimental-strip-types}'[disable type-stripping for TypeScript files]' \
'--no-experimental-websocket[experimental WebSocket API (currently set)]' \
'--no-experimental-websocket[disable experimental WebSocket API]' \
'(--webstorage --no-experimental-webstorage)--webstorage[enable experimental Web Storage API]' \
'(--webstorage --no-experimental-webstorage)--no-experimental-webstorage[disable experimental Web Storage API]' \
'--no-extra-info-on-fatal-exception[hide extra information on fatal exception that causes exit]' \
'--no-force-async-hooks-checks[disable checks for async_hooks]' \
'--no-global-search-paths[disable global module search paths]' \
'(--no-network-family-autoselection --enable-network-family-autoselection)'{--no-network-family-autoselection,--enable-network-family-autoselection}'[disable network address family autodetection algorithm]' \
'(--require-module --no-require-module --no-experimental-require-module)'{--no-require-module,--no-experimental-require-module}'[disable support for loading a synchronous ES module graph in require()]' \
'(--no-network-family-autoselection --enable-network-family-autoselection)--enable-network-family-autoselection[enable network address family autodetection algorithm]' \
'(--no-network-family-autoselection --enable-network-family-autoselection)--no-network-family-autoselection[disable network address family autodetection algorithm]' \
'(--require-module --no-require-module)--no-require-module[disable support for loading a synchronous ES module graph in require()]' \
'(--experimental-strip-types --no-strip-types)--experimental-strip-types[enable Type-stripping for TypeScript files]' \
'(--experimental-strip-types --no-strip-types)--no-strip-types[disable Type-stripping for TypeScript files]' \
'--no-warnings[silence all process warnings]' \
'(--no-webstorage --no-experimental-webstorage)'{--no-webstorage,--no-experimental-webstorage}'[disable Web Storage API]' \
'--node-memory-debug[run with extra debug checks for memory leaks in Node.js itself]' \
'--openssl-config=[load OpenSSL configuration from the specified file (overrides OPENSSL_CONF)]:file:_files' \
'--openssl-legacy-provider[enable OpenSSL 3.0 legacy provider]' \
@ -244,7 +248,7 @@ _node() {
'--trace-deprecation[show stack traces on deprecations]' \
'--trace-env[print accesses to the environment variables]' \
'--trace-env-js-stack[print accesses to the environment variables and the JavaScript stack trace]' \
'--trace-env-native-stack[print accesses to the environment variables and the native stack trace ]' \
'--trace-env-native-stack[print accesses to the environment variables and the native stack trace]' \
'--trace-event-categories[comma separated list of trace event categories to record]: :{_values -s , categories node node.async_hooks node.bootstrap node.perf node.perf.usertiming node.perf.timerify node.fs.sync node.vm.script v8}' \
'--trace-event-file-pattern[Template string specifying the filepath for the trace-events data, it supports ${rotation} and ${pid} log-rotation id. %2$u is the pid.]:template string' \
'--trace-exit[show stack trace when an environment exits]' \

View File

@ -28,7 +28,7 @@
# Description
# -----------
#
# Completion script for OpenSSL 3.5.3 (https://www.openssl-library.org/)
# Completion script for OpenSSL 4.0.0 (https://www.openssl-library.org/)
#
# ------------------------------------------------------------------------------
# Authors
@ -844,6 +844,8 @@ _openssl_dgst() {
'-prverify[private key file to verify the signature]:file:_files' \
'-signature[actual signature file to verify]:file:_files' \
'-hmac[key to create a hashed MAC]:key' \
'-hmac-env[create a hashed MAC using a key from the given environment variable]:var:_parameters -g "*export*"' \
'-hmac-stdin[create a hashed MAC using a key obtained from the standard input]' \
'-mac[MAC algorithm]:alg:_openssl_mac_algorithms' \
'-macopt[options of MAC algorithm]:options' \
'-fips-fingerprint[compute HMAC using a specific key for certain OpenSSL-FIPS operations]' \
@ -1830,6 +1832,15 @@ _openssl_s_client() {
$openssl_verification_options[@] \
'-enable_server_rpk[enable support for receiving raw public keys from the server]' \
'-enable_client_rpk[enable support for sending raw public keys to the server]' \
'*-expected-rpks[specify public keys expected from the remote peer used to authenticate the connection]:file:_files' \
'-ech_outer_alpn[specify ALPN values to use in the outer ClientHello]:protocol' \
'-ech_grease[emit a GREASE value]' \
'-ech_grease_suite[specify ECH ciphersuites to use when -ech_grease is specified]:suite' \
'-ech_grease_type[specify a GREASEd ECH value]:type' \
'-ech_ignore_cid[use random value for ECH]' \
'-ech_outer_sni[specify a subject name indication value to use in hte outer ClientHello]:value' \
'-ech_no_outer_sni[no SNI will be emitted in the outer ClientHello]' \
'-ech_select[specify which ECHConfigList to use using a zero-based index]:index' \
'*::host_port'
}
@ -1957,7 +1968,13 @@ _openssl_s_server() {
$openssl_provider_options[@] \
$openssl_verification_options[@] \
'-enable_server_rpk[enable support for sending raw public keys to the client]' \
'-enable_client_rpk[enable support for receiving raw public keys from the client]'
'-enable_client_rpk[enable support for receiving raw public keys from the client]' \
'*-expected-rpks[specify public keys expected from the remote peer used to authenticate the connection]:file:_files' \
'-ech_key[load one Encrypted Client Hello(ECH) key pair]:file:_files' \
'-ech_dir[load an ECH key pair from every file in the named directory]:dir:_files -/' \
'-ech_noretry_dir[load an ECH key pair from every file in the named directory. not return in "retry_configs"]:file:_files -/' \
'-ech_trialdecrypt[ECH config_id is used to match against the loaded ECH private keys and decryption is only attempted]' \
'-ech_greaseretries[servers will add GREASEy ECHConfigList values to those sent in retry_configs]'
}
_openssl_s_time() {

View File

@ -53,7 +53,7 @@ _openvpn3_config-acl() {
_arguments \
{-s,--show}"[Show the current access control lists]" \
{-o,--path}"[OBJ-PATH Path to the configuration in the configuration manager]: :($configs_paths)" \
{-h,--help}"[This help screen]" \
{-h,--help}"[Show help screen]" \
{-c,--config}"[CONFIG-NAME Alternative to --path, where configuration profile name is used instead]: :($configs_names)" \
{-S,--seal}"[Make the configuration profile permanently read-only]" \
{-R,--revoke}"[<UID | username> Revoke this user access from this configuration profile]" \
@ -67,7 +67,7 @@ _openvpn3_config-import() {
_arguments \
{-p,--persistent}"[Make the configuration profile persistent through service restarts]" \
{-n,--name}"[NAME Provide a different name for the configuration (default: CFG-FILE)]" \
{-h,--help}"[This help screen]" \
{-h,--help}"[Show help screen]" \
{-c,--config}"[CFG-FILE Configuration file to import]: :_files"
}
@ -76,7 +76,7 @@ _openvpn3_config-manage() {
{-s,--show}"[Show current configuration options]" \
{-r,--rename}"[NEW-CONFIG-NAME Renames the configuration]" \
{-o,--path}"[CONFIG-PATH Path to the configuration in the configuration manager]: :($configs_paths)" \
{-h,--help}"[This help screen]" \
{-h,--help}"[Show help screen]" \
{-c,--config}"[CONFIG-NAME Alternative to --path, where configuration profile name is used instead]: :($configs_names)" \
"--unset-override[<name> Removes the <name> override]" \
"--tls-version-min[<tls_1_0|tls_1_1|tls_1_2|tls_1_3> Sets the minimal TLS version for the control channel]: :(tls_1_0 tls_1_1 tls_1_2 tls_1_3)" \
@ -103,7 +103,7 @@ _openvpn3_config-manage() {
_openvpn3_config-remove() {
_arguments \
{-o,--path}"[OBJ-PATH Path to the configuration in the configuration manager]: :($configs_paths)" \
{-h,--help}"[This help screen]" \
{-h,--help}"[Show help screen]" \
{-c,--config}"[CONFIG-NAME Alternative to --path, where configuration profile name is used instead]: :($configs_names)" \
"--force[Force the deletion process without asking for confirmation]" \
"--config-path[OBJ-PATH Alias for --path]: :($configs_paths)"
@ -113,24 +113,24 @@ _openvpn3_config-show() {
_arguments \
{-o,--path}"[OBJ-PATH Path to the configuration in the configuration manager]: :($configs_paths)" \
{-j,--json}"[Dump the configuration in JSON format]" \
{-h,--help}"[This help screen]" \
{-h,--help}"[Show help screen]" \
{-c,--config}"[CONFIG-NAME Alternative to --path, where configuration profile name is used instead]: :($configs_names)" \
"--config-path[OBJ-PATH Alias for --path]: :($configs_paths)"
}
_openvpn3_configs-list() {
_arguments \
{-h,--help}"[This help screen]"
{-h,--help}"[Show help screen]"
}
_openvpn3_help() {
_arguments \
{-h,--help}"[This help screen]"
{-h,--help}"[Show help screen]"
}
_openvpn3_log() {
_arguments \
{-h,--help}"[This help screen]" \
{-h,--help}"[Show help screen]" \
{-c,--config}"[CONFIG-NAME Alternative to --session-path, where configuration profile name is used instead]: :($sessions_configs_names $configs_names)" \
{-I,--interface}"[INTERFACE Alternative to --session-path, where tun interface name is used instead]: :($sessions_interfaces)" \
"--session-path[SESSION-PATH Receive log events for a specific session]: :($sessions_paths)" \
@ -142,7 +142,7 @@ _openvpn3_session-acl() {
_arguments \
{-s,--show}"[Show the current access control lists]" \
{-o,--path}"[SESSION-PATH Path to the session in the session manager]: :($sessions_paths)" \
{-h,--help}"[This help screen]" \
{-h,--help}"[Show help screen]" \
{-c,--config}"[CONFIG-NAME Alternative to --path, where configuration profile name is used instead]: :($sessions_configs_names)" \
{-R,--revoke}"[<UID | username> Revoke this user access from this session]" \
{-I,--interface}"[INTERFACE Alternative to --path, where tun interface name is used instead]: :($sessions_interfaces)" \
@ -155,7 +155,7 @@ _openvpn3_session-acl() {
_openvpn3_session-manage() {
_arguments \
{-o,--path}"[SESSION-PATH Path to the session in the session manager]: :($sessions_paths)" \
{-h,--help}"[This help screen]" \
{-h,--help}"[Show help screen]" \
{-c,--config}"[CONFIG-NAME Alternative to --path, where configuration profile name is used instead]: :($sessions_configs_names)" \
{-R,--resume}"[Resumes a paused VPN session]" \
{-P,--pause}"[Pauses the VPN session]" \
@ -169,7 +169,7 @@ _openvpn3_session-manage() {
_openvpn3_session-start() {
_arguments \
{-p,--config-path}"[CONFIG-PATH Configuration path to an already imported configuration]: :($configs_paths)" \
{-h,--help}"[This help screen]" \
{-h,--help}"[Show help screen]" \
{-c,--config}"[CONFIG-FILE Configuration file to start directly]: :_files" \
"--persist-tun[Enforces persistent tun/seamless tunnel (requires --config)]"
}
@ -178,7 +178,7 @@ _openvpn3_session-stats() {
_arguments \
{-o,--path}"[SESSION-PATH Path to the configuration in the configuration manager]: :($sessions_paths)" \
{-j,--json}"[Dump the configuration in JSON format]" \
{-h,--help}"[This help screen]" \
{-h,--help}"[Show help screen]" \
{-c,--config}"[CONFIG-NAME Alternative to --path, where configuration profile name is used instead]: :($sessions_configs_names)" \
{-I,--interface}"[INTERFACE Alternative to --path, where tun interface name is used instead]: :($sessions_interfaces)" \
"--session-path[SESSION-PATH Alias for --path]: :($sessions_paths)"
@ -186,12 +186,12 @@ _openvpn3_session-stats() {
_openvpn3_sessions-list() {
_arguments \
{-h,--help}"[This help screen]"
{-h,--help}"[Show help screen]"
}
_openvpn3_shell-completion() {
_arguments \
{-h,--help}"[This help screen]" \
{-h,--help}"[Show help screen]" \
"--list-commands[List all available commands]" \
"--list-options[COMMAND List all available options for a specific command]: :($(openvpn3 shell-completion --list-commands))" \
"--arg-helper[OPTION Used together with --list-options, lists value hint to an option]"
@ -199,7 +199,7 @@ _openvpn3_shell-completion() {
_openvpn3_version() {
_arguments \
{-h,--help}"[This help screen]"
{-h,--help}"[Show help screen]"
}
_openvpn3_command() {
@ -210,7 +210,7 @@ _openvpn3_command() {
"config-remove: Remove an available configuration profile"
"config-show: Show/dump a configuration profile"
"configs-list: List all available configuration profiles"
"help: This help screen"
"help: Show help screen"
"log: Receive log events as they occur"
"session-acl: Manage access control lists for sessions"
"session-manage: Manage VPN sessions"
@ -239,7 +239,7 @@ _openvpn3_command() {
}
_arguments \
{-h,--help}"[that This help screen]" \
{-h,--help}"[Show help screen]" \
"*::openvpn3 commands:_openvpn3_command" \
# Local Variables:

View File

@ -54,7 +54,7 @@ _pm2() {
'--max-restarts[only start the script COUNT times]:count' \
'(-u --user)'{-u,--user}'[define user when generating startup script]:username' \
'--uid[run target script with <uid> rights]:uid' \
'--gid[run target script with <gid> rights]:gui' \
'--gid[run target script with <gid> rights]:gid' \
'--namespace[start application within specified namespace]:namespace' \
'--cwd[run target script from path <cwd>]:cwd:_files -/' \
'--hp[define home path when generating startup script]: :_paths -/' \
@ -72,8 +72,8 @@ _pm2() {
'*--ignore-watch[list of paths to ignore]: :_files' \
'--no-color[skip colors]' \
'--no-vizion[start an app without vizion feature]' \
'--np-autorestart[start an app without automatic restart]' \
'--no-treekill[Only kill the main process, not detached children]' \
'--no-autorestart[start an app without automatic restart]' \
'--no-treekill[only kill the main process, not detached children]' \
'--no-pmx[start an app without pmx]' \
'--no-automation[start an app without automation]' \
'(--disable-trace --trace)--trace[enable transaction tracing with km]' \
@ -93,9 +93,9 @@ _pm2() {
(start)
_arguments \
'--watch[watch folder for changes]' \
'--fresh[Rebuild Dockerfile]' \
'--daemon[Run container in Daemon mode(debug purposes)]' \
'--container[Start application in container mode]' \
'--fresh[rebuild Dockerfile]' \
'--daemon[run container in daemon mode(debug purposes)]' \
'--container[start application in container mode]' \
'--dist[--with-container; change local Dockerfile to containerize all files in current directory]' \
'--image-name[with --dist; set the exported image name]:name' \
'--node-version[with --container, set a specific major Node.js version]:version' \
@ -119,7 +119,7 @@ _pm2() {
(stop|restart)
_arguments \
'(- *)'{-h,--help}'[output usage information]' \
'--watch[Stop watching folder for changes]' \
'--watch[stop watching folder for changes]' \
'*: :_pm2_id_namespace_all' \
&& ret=0
;;
@ -231,8 +231,8 @@ _pm2_subcommands() {
"stop:stop a process"
"restart:restart a process"
"scale:scale up/down a process in cluster mode depending on total_number param"
"profile\:mem:Sample PM2 heap memory"
"profile\:cpu:Profile PM2 cpu"
"profile\:mem:sample PM2 heap memory"
"profile\:cpu:profile PM2 cpu"
"reload:reload processes (note that its for app using HTTP/HTTPS)"
"id:get process id by name"
"inspect:inspect a process"
@ -244,12 +244,12 @@ _pm2_subcommands() {
"install:install or update a module and run it forever"
"module\:install:install or update a module and run it forever"
"module\:update:update a module and run it forever"
"module\:generate:Generate a sample module in current folder"
"module\:generate:generate a sample module in current folder"
"uninstall:stop and uninstall a module"
"module\:uninstall:stop and uninstall a module"
"package:Check & Package TAR type module"
"publish:Publish the module you are currently on"
"module\:publish:Publish the module you are currently on"
"package:check & package TAR type module"
"publish:publish the module you are currently on"
"module\:publish:publish the module you are currently on"
"set:sets the specified config <key> <value>"
"multiset:multiset eg \"key1 val1 key2 val2\""
"get:get value for <key>"
@ -263,11 +263,11 @@ _pm2_subcommands() {
"unmonitor:unmonitor target process"
"open:open the pm2 monitoring dashboard"
"plus:enable pm2 plus"
"login:Login to pm2 plus"
"logout:Logout from pm2 plus"
"login:login to pm2 plus"
"logout:logout from pm2 plus"
"dump:dump all processes for resurrecting them later"
"save:dump all processes for resurrecting them later"
"cleardump:Create empty dump file"
"cleardump:create empty dump file"
"send:send stdin to <pm_id>"
"attach:attach stdin/stdout to application identified by <pm_id>"
"resurrect:resurrect previously dumped processes"
@ -297,7 +297,7 @@ _pm2_subcommands() {
"dash:launch dashboard with monitoring and logs"
"flush:flush logs"
"reloadLogs:reload all logs"
"logs:stream logs file. Default stream all logs"
"logs:stream logs file (default is to stream all logs)"
"kill:kill daemon"
"pull:updates repository for a given app"
"forward:updates repository to the next commit for a given app"

View File

@ -29,7 +29,7 @@ _pre_commit() {
case "$state" in
(args)
local -a options=(
'(- : *)'{-h,--help}'[show this help message and exit]'
'(- : *)'{-h,--help}'[show help message and exit]'
"--color[Whether to use color in output(default: auto)]:color:(auto always never)"
)
local -a hook_types=(
@ -89,7 +89,7 @@ _pre_commit() {
'--commit-msg-filename[file name to check when running during "commit-msg"]:file:_files'
'--prepare-commit-message-source[source of the commit message]:source'
'--commit-object-name[commit object name]:object_name'
'--remote-name[Remote name used by "git push"]:name:remote:_pre_commit_git_remotes'
'--remote-name[Remote name used by "git push"]:remote:_pre_commit_git_remotes'
'--remote-url[Remote url used by "git push"]:url:_urls'
'--checkout-type[branch check out or a file checkout]:type:_pre_commit_commit_types'
'--is-squash-merge[use squash merge]:flag:(0 1)'

View File

@ -45,7 +45,7 @@ _rails() {
local -a runtime_options rails_options
runtime_options=(
'(- *)'{-h,--help}'[Show this help message and quit]'
'(- *)'{-h,--help}'[Show help message and quit]'
'(- *)'{-v,--version}'[Show Rails version and quit]'
)
@ -74,14 +74,14 @@ _rails() {
;;
(console|c)
_arguments \
'(- *)'{-h,--help}'[Show this help message and quit]' \
'(- *)'{-h,--help}'[Show help message and quit]' \
'(-e --environment)'{-e,--environment=}'[The environment to run "console" in]:env:(test development production)' \
'(-s --sandbox)'{-s,--sandbox}'[Rollback database modifications on exit]' \
&& ret=0
;;
(server|s)
_arguments \
'(- *)'{-h,--help}'[Show this help message and quit]' \
'(- *)'{-h,--help}'[Show help message and quit]' \
'(-e --environment)'{-e,--environment=}'[The environment to run "server" in]:env:(test development production)' \
'(-p --port)'{-p,--port}'[Run Rails on the specified port]:port' \
'(-b --binding)'{-b,--binding=}'[Bind Rails to the specified IP]:binding' \
@ -98,7 +98,7 @@ _rails() {
;;
(dbconsole|db)
_arguments \
'(- *)'{-h,--help}'[Show this help message and quit]' \
'(- *)'{-h,--help}'[Show help message and quit]' \
'(-e --environment)'{-e,--environment=}'[The environment to run "server" in]:env:(test development production)' \
'(-p --include-password)'{-p,--include-password}'[Automatically provide the password from database.yml]' \
'--mode=[Automatically put the sqlite3 database in the specified mode]:mode:(html list line column)' \
@ -109,7 +109,7 @@ _rails() {
;;
(test|t|test:system)
_arguments \
'(- *)'{-h,--help}'[Show this help message and quit]' \
'(- *)'{-h,--help}'[Show help message and quit]' \
'--no-plugins[Bypass minitest plugin auto-loading]' \
'(-s --seed)'{-s,--seed=}'[Sets random seed]:seed' \
'(-v --verbose -q --quiet)'{-v,--verbose}'[Show progress processing files]' \
@ -133,7 +133,7 @@ _rails() {
;;
(runner|r)
_arguments \
'(- *)'{-h,--help}'[Show this help message and quit]' \
'(- *)'{-h,--help}'[Show help message and quit]' \
'(-e --environment)'{-e,--environment=}'[The environment to run "runner"]:env:(test development production)' \
'(-w --skip-executor)'{-w,--skip-executor}'[Do not wrap with Rails Executor]' \
'*:: :_files -g "*.rb"' \
@ -147,7 +147,7 @@ _rails() {
;;
(routes)
_arguments \
'(- *)'{-h,--help}'[Show this help message and quit]' \
'(- *)'{-h,--help}'[Show help message and quit]' \
'(-c --controller)'{-c,--controller=}'[Filter by a specific controller]:controller' \
'(-g --grep)'{-g,--grep}'[Grep routes by a specific pattern]' \
'(-E --expanded)'{-E,--expanded}'[Print routes expanded vertically with parts explained]' \
@ -353,7 +353,7 @@ _rails_generate() {
(generate)
local -a opts
opts=(
'(- *)'{-h,--help}'[Show this help message and quit]'
'(- *)'{-h,--help}'[Show help message and quit]'
$runtime_options
'--skip-namespace[Skip namespace]'
'--skip-collision-check[Skip collision check]'

View File

@ -35,7 +35,7 @@
# ------------------------------------------------------------------------------
_arguments \
'(- *)'{-h,--help}'[display this help]' \
'(- *)'{-h,--help}'[display help]' \
'(- *)'{-V,--version}'[display version]' \
'(-0 --zero)'{-0,--zero}'[use the nul character as line separator]'

View File

@ -28,7 +28,7 @@
# Description
# -----------
#
# Completion script for rubocop 1.82.1 (https://github.com/rubocop/rubocop)
# Completion script for rubocop 1.86.1 (https://github.com/rubocop/rubocop)
#
# ------------------------------------------------------------------------------
# Authors
@ -73,6 +73,7 @@ _arguments \
'(-C --cache)'{-C,--cache}'[Use result caching or not]:flag:(true false)' \
'--cache-root[Set the cache root directory]:dir:_files -/' \
'--lsp[Start a language server listening on STDIN]' \
'--mcp[Start an MCP server that communicates over stdio]' \
'--server[If a server process has not been started yet start the server process and execute inspection with server]' \
'(--restart-server --start-server --stop-server)--restart-server[Restart server process]' \
'(--restart-server --start-server --stop-server)--start-server[Start server process]' \
@ -89,7 +90,7 @@ _arguments \
'--display-only-failed[Only output offense messages]' \
'--display-only-fail-level-offenses[Only output offense messages at the specified --fail-level or above]' \
'--display-only-correctable[Only output correctable offense messages]' \
'--display-only-safe-correctable[Only output safe-correctable offense messages with combined with --display-only-correctable]' \
'--display-only-safe-correctable[Only output safe-correctable offense messages when combined with --display-only-correctable]' \
'(-a --autocorrect)'{-a,--autocorrect}"[Auto-correct offenses(only when it's safe)]" \
'(-A --autocorrect-all)'{-A,--autocorrect-all}'[Autocorrect offenses(safe and unsafe)]' \
'--disable-uncorrectable[used with --autocorrect to annotate any offenses that do not support autocorrect with comments]' \
@ -99,7 +100,7 @@ _arguments \
'(--no-exclude-limit --exclude-limit)--no-exclude-limit[Do not set the limit for how many files to exclude]' \
'--offense-counts[Include offense counts in configuration file generated by --auto-gen-config]' \
'--auto-gen-only-exclude[Generate only Exclude parameters and not Max when running --auto-gen-config]' \
'--auto-gen-timestamp[Include the data and time when the --auto-gen-config was run in the file it generates]' \
'--auto-gen-timestamp[Include the date and time when the --auto-gen-config was run in the file it generates]' \
'--auto-gen-enforced-style[Add a setting to the TODO configuration file to enforce the style used]' \
'(-L --list-target-files)'{-L,--list-target-files}'[List all files RuboCop will inspect]' \
'*--show-cops[Show the given cops or all cops]::cops' \

View File

@ -93,7 +93,7 @@ _sbt() {
unfiltered/unfiltered.g8
scalatra/scalatra-sbt.g8
)
_values 'g8_templates' $g8_templates
_values 'g8_templates' $g8_templates && ret=0
;;
esac
;;

View File

@ -173,7 +173,7 @@ __tmuxp_import() {
(project)
if [[ $line[1] == 'tmuxinator' ]]
then
_wanted tmuxinator-projects exp 'tmuxinator projects' compadd $(tmuxinator completions start)
_wanted tmuxinator-projects expl 'tmuxinator projects' compadd $(tmuxinator completions start)
fi
;;
esac

View File

@ -194,7 +194,7 @@ local -a opts=(
"--excludeFiles[Remove a list of files from the watch mode's processing]:files:_files"
"--libReplacement[Enable library replacement]"
"--erasableSyntaxOnly[Ensures that runtime constructs which are not part of ECMAScript are not allowed]"
'*:: :_files' \
'*:: :_files'
)
if (( $+opt_args[--build] )); then

View File

@ -61,7 +61,7 @@ case $OSTYPE in
;;
(*)
_arguments \
'(- *)'{-h,--help}'[display this help]' \
'(- *)'{-h,--help}'[display help]' \
'(- *)'{-V,--version}'[display version]' \
'(-r --random)'{-r,--random}'[generate random-based uuid]' \
'(-t --time)'{-t,--time}'[generate time-based uuid]' \

View File

@ -35,7 +35,7 @@
# ------------------------------------------------------------------------------
_arguments \
'(- *)'{-h,--help}'[display this help]' \
'(- *)'{-h,--help}'[display help]' \
'(-g --group -p --passwd)'{-g,--group}'[edit group database]' \
'(-g --group -p --passwd)'{-p,--passwd}'[edit passwd database]' \
'(-q --quiet)'{-q,--quiet}'[quiet mode]' \

View File

@ -48,7 +48,7 @@ _wdctl_output_columns() {
}
_arguments -s \
'(- *)'{-h,--help}'[display this help]' \
'(- *)'{-h,--help}'[display help]' \
'(- *)'{-V,--version}'[display version]' \
'(-f --flags)'{-f,--flags}'[print selected flags only]:flags' \
'(-F --noflags)'{-F,--noflags}'[do not print information about flags]' \

View File

@ -147,7 +147,7 @@ _yarn() {
'--immutable-cache[abort if the cache folder was to be modified]' \
'--refresh-lockfile[refresh the package metadata stored in the lockfile]' \
'--check-cache[always refetch the packages and ensure that their checksums are consistent]' \
'--check-resolutions[valudata that the package resolutions are coherent]' \
'--check-resolutions[validate that the package resolutions are coherent]' \
'--inline-builds[verbosely print the output of the build steps of dependencies]' \
'--mode[change what artifacts installs generate]:mode:(skip-build update-lockfile)' \
&& ret=0
@ -189,7 +189,7 @@ _yarn() {
(patch-commit)
_arguments \
'(- *)'{-h,--help}'[show help message and exit]' \
'(-s --save)'{-s,--save}'[add the patch to your resoltion entries]' \
'(-s --save)'{-s,--save}'[add the patch to your resolution entries]' \
'*:dir:_files -/' \
&& ret=0
;;
@ -345,7 +345,8 @@ _yarn_cache() {
_arguments \
'(- *)'{-h,--help}'[show help message and exit]' \
'--mirror[remove the global cache files instead of the local cache files]' \
'--all[remove both the global cache files and the local cache files of the current project]'
'--all[remove both the global cache files and the local cache files of the current project]' \
&& ret=0
;;
esac
;;
@ -379,7 +380,7 @@ _yarn_config() {
(set)
_arguments \
'(- *)'{-h,--help}'[show help message and exit]' \
'--json[set complete configuration settins to JSON values]' \
'--json[set complete configuration settings to JSON values]' \
'(-H --home)'{-H,--home}'[update the home configuration instead of the project one]' \
'1:name' \
'2:value' \
@ -640,8 +641,6 @@ _yarn_plugin_subcommands() {
(( $+functions[_yarn_run] )) ||
_yarn_run() {
local ret=1
_arguments \
'(- *)'{-h,--help}'[show help message and exit]' \
'--json[format the output as an NDJSON stream]' \
@ -651,10 +650,7 @@ _yarn_run() {
'(-B --binaries-only)'{-B,--binaries-only}'[ignore any user defined scripts and only check binaries]' \
'*--require[preload given module]:module' \
'1: :_yarn_scripts' \
'*:: :_files' \
&& ret=0
return ret
'*:: :_files'
}
(( $+functions[_yarn_set] )) ||
@ -809,7 +805,7 @@ _yarn_workspaces() {
_arguments \
'(- *)'{-h,--help}'[show help message and exit]' \
'--json[format the output as an NDJSON stream]' \
'--production[only install regular dependencies by ommiting dev dependencies]' \
'--production[only install regular dependencies by omitting dev dependencies]' \
'(-A --all)'{-A,--all}'[install the entire project]' \
&& ret=0
;;
@ -908,7 +904,7 @@ _yarn_scripts() {
fi
local -a candidates=($scripts $binaries)
compadd -a candidates
_wanted candidates expl 'scripts' compadd -a candidates
}
_yarn "$@"

View File

@ -56,7 +56,7 @@ _zramctl_output_columns() {
}
_arguments \
'(- *)'{-h,--help}'[display this help]' \
'(- *)'{-h,--help}'[display help]' \
'(- *)'{-V,--version}'[display version]' \
'(-a --algorithm)'{-a,--algorithm}'[compression algorithm to use]:algorithm:(lzo lz4 lz4hc deflate 842 zstd)' \
'(-b --bytes)'{-b,--bytes}'[print sizes in bytes rather than in human readable format]:bytes' \

View File

@ -0,0 +1,454 @@
* 目录
- [[#介绍][介绍]]
- [[#开始][开始]]
- [[#让zsh知道用哪个函数补全命令][让zsh知道用哪个函数补全命令]]
- [[#补全gnu格式命令][补全gnu格式命令]]
- [[#从其它命令复制补全][从其它命令复制补全]]
- [[#编写你自己的补全代码][编写你自己的补全代码]]
- [[#工具函数][工具函数]]
- [[#用_describe编写简单的补全函数][用_describe编写简单的补全函数]]
- [[#用_alternative编写补全函数][用_alternative编写补全函数]]
- [[#用_arguments编写补全函数][用_arguments编写补全函数]]
- [[#用_regex_arguments和_regex_words编写补全函数][用_regex_arguments和_regex_words编写补全函数]]
- [[#用_values_sep_parts和_multi_parts实现复杂补全][用_values、_sep_parts和_multi_parts实现复杂补全]]
- [[#用compadd直接添加补全词][用compadd直接添加补全词]]
- [[#测试与debug][测试与debug]]
- [[#踩坑了吧-需要小心的东西][踩坑了吧 (需要小心的东西)]]
- [[#小贴士][小贴士]]
- [[#其它资源][其它资源]]
> 译注:本文可能有不通顺的地方,或者采用的词汇不是很正确。
> 如果你有更好的主意欢迎提交PR。
* 介绍
Zsh官方的补全函数文档令人费解而且也没提供多少示例。
写这份文档的当下我已经在网上找到了其它几份教程,但是那些教程只涉及了补全系统的一小部分。
这份文档目的在于补全网上其它地方没涵盖的部分,同时附带示例,这样读者就可以学会如何写更高级的补全函数。
我不会展开每一细节,但给你提供的内容和示例足以从零开始。
如果你需要了解更多细节,你可以自行查询[[https://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-System][官方文档]]。
还请公开你所创作的任何脚本比如fork这个仓库然后[[id:64bcd501-b0f0-48c7-b8e2-07af708b95ec][pr]])。
此外如果你有任何更多补充内容或对此教程的改进,欢迎做贡献。
* 开始
** 让zsh知道用哪个函数补全命令
补全命令用的补全函数储存于名字以下划线“_”起始的文件这些文件应存于$fpath变量所列出的某目录中。
你可以将下面的代码写入你的~/.zshrc以在$fpath中新增目录
#+BEGIN_SRC sh
fpath=(~/newdir $fpath)
#+END_SRC
一个补全函数文件的第一行长这个样:
#+BEGIN_SRC sh
#compdef foobar
#+END_SRC
这行代码表示这个文件含有补全foobar命令的代码。
多数情况下第一行都采用这个格式,但你也可以用同一个文件补全多个不同的函数。
查阅[[https://zsh.sourceforge.net/Doc/Release/Completion-System.html#Autoloaded-files][官方文档]]以了解更多细节。
你也可以直接使用compdef命令(比如在你的~/.zshrc文件里)来告诉zsh用哪个函数补全命令
#+BEGIN_SRC sh
> compdef _function foobar
#+END_SRC
或者对多个命令使用同一种补全:
#+BEGIN_SRC sh
> compdef _function foobar goocar hoodar
#+END_SRC
如果你想提供参数的话:
#+BEGIN_SRC sh
> compdef '_function arg1 arg2' foobar
#+END_SRC
查阅[[https://zsh.sourceforge.net/Doc/Release/Completion-System.html#Functions-4][官方文档]]以了解更多细节。
** 补全gnu格式命令
很多[[https://www.gnu.org/][gnu]]命令以标准化的方式列出选项描述(使用--help选项时
对于这些命令你可以使用_gnu_generic函数自动创建补全比如这样
#+BEGIN_SRC sh
> compdef _gnu_generic foobar
#+END_SRC
或者对多个不同命令使用_gnu_generic
#+BEGIN_SRC sh
> compdef _gnu_generic foobar goocar hoodar
#+END_SRC
你可以把这行代码放进~/.zshrc文件里。
** 从其它命令复制补全
如果你想要让一个命令比如cmd1和另一个已有补全的命令比如cmd2)拥有相同的补全,你可以:
#+BEGIN_SRC sh
> compdef cmd1=cmd2
#+END_SRC
比如当你给一个命令创建了一个助记alias的时候会很有帮助。
* 编写你自己的补全代码
你可以通过阅读已有的补全函数来开始入门。
在我的Linux系统上这些补全函数在/usr/share/zsh/functions/Completion/Unix、
/usr/share/zsh/functions/Completion/Linux和一些其它子目录下。
你会注意到这些文件频繁使用_arguments函数。
该函数是一个工具函数,可用于编写简单的补全函数。
_arguments函数是一个compadd内置函数的包装函数。
compadd内置函数是一个核心函数用于向命令行加入补全词并控制其行为。
不过多数情况下你不需要使用compadd因为有很多更易于使用的工具函数如_arguments和_describe。
对于非常基础的补全_describe函数已经够用了。
** 工具函数
下面是一个工具函数列表,你或许会用到它们。
工具函数的完整列表及使用方法在[[https://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions][]]可供查阅。
这些函数的使用示例在下一节给出。
> 译注从这里开始会出现一些术语如定义specification、描述description、动作action、词汇word等。
> 初次阅读可能会觉得比较困难,尤其是下面的工具函数表格,稍后教程开始一一讲解并给出示例的时候就好懂多了。
> 定义指的是对补全规则的定义,如`_describe 定义`。
> 描述当然指的是对命令行选项和参数的用户友好描述,补全时会显示在屏幕上,如:'-o 输出文件'
> 词汇指的是如同'word'、'-o'、'--help'、'start'等连续的一小段字符串
> 动作指的是匹配成功后执行的操作,比如执行某函数生成补全,或直接补全等等。
> 选项option和参数指给命令提供的选项和参数如`cp -r src dst`中,`-r`为选项,`src`和`dst`为参数。有些选项带参,如`tar -f file ...`中`-f`选项带`file`参数。
> 候选candidate指可能的补全结果如补全`tar -f`时目录下所有文件会被作为候选,补全`systemctl`时`start`、`stop`、`list-units`等指令会被作为候选。
> 还请不要感到灰心,读下去就是了。
*** 用于大部分补全的主要工具函数
| _alternative | 从其它工具函数或shell代码生成补全候选。 |
| _arguments | 指定如何补全一命令的各选项和参数命令选项风格为unix风格。 |
| _describe | 创建由带描述的词汇但不包含动作组成的简单补全。比_arguments更简单。 |
| _gnu_generic | 为带有“--help”选项的命令补全选项。 |
| _regex_arguments | 创建一先用regex表达式匹配命令行参数再执行动作/补全的函数。 |
*** 对单个词汇进行复杂补全的工具函数
| _values | 补全任意词汇(值)及其参数,或逗号分隔的词汇与参数列表。 |
| _combination | 补全值的组合,比如域名和用户名的二元组。 |
| _multi_parts | 对词汇的由符号分隔的多个部分分别补全,比如补全路径:/u/i/sy -> /usr/include/sys |
| _sep_parts | 类似_multi_parts但在补全的不同部分中允许不同的分隔符。 |
| _sequence | 包装另一补全函数,并补全由该函数生成的匹配列表。 |
*** 用于补全特定对象种类的函数
| _path_files | 补全文件目录。用多个选项控制行为。 |
| _files | 使用所有选项调用_path_files除了-g和-/。这些选项取决于file-patterns风格设置。 |
| _net_interfaces | 补全网络接口名称。 |
| _users | 补全用户名 |
| _groups | 补全组名 |
| _options | 补全shell选项名。 |
| _parameters | 补全shell参数/变量名(可用模式匹配限制要补全的参数/变量名)。 |
*** 处理已缓存的补全的函数
如果你有大量的补全,你可以将补全保存于一个缓存文件以快速加载。
| _cache_invalid | 指明补全缓存是否需要重新构建rebuild缓存由标识符指定 |
| _retrieve_cache | 从缓存文件获取补全信息 |
| _store_cache | 储存缓存于缓存文件,缓存由标识符指定 |
*** 其它函数
| _message | 当无补全可生成时显示帮助信息。 |
| _regex_words | 为_regex_arguments命令生成参数。比手写参数更简单。 |
| _guard | 检查被补全的词汇用于_arguments和类似函数的定义的ACTION中。 |
*** 动作Actions
许多工具函数如_arguments、_regex_arguments、_alternative和_values在选项/参数末尾有一个action。
这个action指定如何补全对应的参数。
这些action可以是如下形式之一
| ( ) | 需要提供参数但未生成任何匹配 |
| (ITEM1 ITEM2) | 匹配列表 |
| ((ITEM1\:'DESC1' ITEM2\:'DESC2')) | 匹配列表,带有描述。引号必须和整个定义所使用的引号不同。 |
| ->STRING | 将$state设为STRING然后继续可在调用工具函数后用case语句检查$state的值 |
| FUNCTION | 生成匹配或完成其它操作的函数的函数名比如_files或_message |
| {EVAL-STRING} | 把字符串当作shell代码执行evaluate。可用于带参调用工具函数如_values或_describe |
| =ACTION | 在补全命令行中插入占位词汇不改变补全点。 |
并非所有的action种类都可用于使用action的工具函数。比如->STRING类不可用于_regex_arguments或_alternative函数。
** 用_describe编写简单的补全函数
_describe函数可以用于简单的补全此类补全的选项/参数的位置与顺序无关紧要。
你只需用一个数组参数储存这些选项和其描述然后将数组参数的名作为参数传入_describe。
下面的示例创建补全候选c和d注意代码文件名应为_cmd并且文件存于$fpath所列出的目录之下
#+BEGIN_SRC sh
#compdef cmd
local -a subcmds
subcmds=('c:c命令描述' 'd:d命令描述')
_describe 'command' subcmds
#+END_SRC
你可以像下面一样使用由双横杠分隔的列表,但注意实操时会混合匹配结果,所以不应该用于不同种类的补全候选:
#+BEGIN_SRC sh
local -a subcmds topics
subcmds=('c:c命令描述' 'd:d命令的描述')
topics=('e:e帮助主题的描述' 'f:f帮助主题的描述')
_describe 'command' subcmds -- topics
#+END_SRC
如果两个候选有相同的描述_describe把它们集于一行并确保描述严格按列对齐。
_describe函数可用在_alternative、_arguments或_regex_arguments的ACTION中。
在这种情况下你需要用括号将_describe和参数包起来比如'TAG:DESCRIPTION:{_describe 'values' options}'
** 用_alternative编写补全函数
如同_describe该函数进行简单补全其选项/参数的顺序和位置并不重要。
然而与_describe的固定匹配不同_alternative可进一步调用函数生成补全候选。
此外_alternative允许混合不同种类的补全候选。
关于参数该函数接受一列定义specification每项定义的形式为“TAG:DESCRIPTION:ACTION”即“标签:描述:动作”其中TAG是一个标识补全匹配种类的特殊标签。
DESCRIPTION以标题heading的形式描述补全候选组而ACTION是先前列出的动作种类之一除了->STRING和=ACTION之外
例如:
#+BEGIN_SRC sh
_alternative 'arguments:自定义参数:(a b c)' 'files:文件名:_files'
#+END_SRC
第一个定义增加了补全候选a、b和c而第二个定义调用_files函数以补全文件目录。
我们可以用反斜杠 \ 将不同定义分成几行并给每个自定义参数加入描述文字:
#+BEGIN_SRC sh
_alternative \
'args:自定义参数:((a\:"描述a" b\:"描述b" c\:"描述c"))' \
'files:文件名:_files'
#+END_SRC
如果我们想向_files传递参数我们可以直接写在_files后面
#+BEGIN_SRC sh
_alternative \
'args:自定义参数:((a\:"描述a" b\:"描述b" c\:"描述c"))' \
'files:文件名:_files -/'
#+END_SRC
如要用变量展开创建补全列表,必须用双引号将定义括起来,
如:
#+BEGIN_SRC sh
_alternative \
"dirs:用户目录:($userdirs)" \
"pids:进程ID:($(ps -A o pid=))"
#+END_SRC
在此例子中第一个定义加入$userdirs变量中的词汇第二个定义执行'ps -A o pid='并获取pid表pid表用作补全候选。
实操中我们使用已有的_pids函数而不是像上面那样手写。
我们可以在ACTION中使用_values等其它工具函数以完成更复杂的补全
#+BEGIN_SRC sh
_alternative \
"directories:用户目录:($userdirs)" \
'options:逗号分隔选项: _values -s , letter a b c'
#+END_SRC
该示例补全$userdirs里的项目以及用逗号分隔的、含有a、b和/或c的列表。
注意_values前面的空格。空格不可省略因为_values不能接受标准compadd描述选项。
和_describe一样_alternative可用作ACTION并作为_arguments或_regex_arguments的一部分。
** 用_arguments编写补全函数
只需要调用_arguments函数一次就可以创造出非常智能的补全函数。该函数本身就是用于处理这种带有带参选项的命令的。
如同_alternative函数_arguments接受一列定义字符串参数。
这些定义字符串指定选项和任何对应的选项参数(如:-f 文件名),或命令参数。
简单的选项定义用'-OPT[DESCRIPTION]'(即'-选项[描述]'),比如:
#+BEGIN_SRC sh
_arguments '-s[排序后输出]' '--l[更多输出]' '-l[更多输出]'
#+END_SRC
选项参数可在选项描述后指定,形式用'-OPT[DESCRIPTION]:MESSAGE:ACTION'(即'-选项[描述]:消息:动作',
其中MESSAGE是待显示的信息而ACTION可以是前面的动作Actions章节提到的任何形式。
比如:
#+BEGIN_SRC sh
_arguments '-f[输入文件]:文件名:_files'
#+END_SRC
命令参数定义用'N:MESSAGE:ACTION'(即'N:消息:动作'其中N指定这是第N个命令参数而MESSAGE和ACTION都和前面的一样。
如果N被省略则其仅表示这是在所有已定义的参数之后的下一个参数。如果开头在N后面用的是双冒号则参数非必需。
比如:
#+BEGIN_SRC sh
_arguments '-s[排序后输出]' '1:第一个参数:_net_interfaces' '::可选参数:_files' ':下一个参数:(a b c)'
#+END_SRC
这里第一个参数是网络接口下一个可选参数是一个文件名最后一个参数可以是a、b或c而-s选项可以在任何位置被补全。
_arguments函数允许所有ACTION形式在前面的动作(Actions)章节列出)。
这表示你可以用动作来选择case语句分支
#+BEGIN_SRC sh
_arguments '-m[音乐文件]:文件名:->files' '-f[flags]:flag:->flags'
case "$state" in
files)
local -a music_files
music_files=( Music/**/*.{mp3,wav,flac,ogg} )
_multi_parts / music_files
;;
flags)
_values -s , 'flags' a b c d e
;;
esac
#+END_SRC
在此例子中指向音乐文件的路径被_multi_parts一步步地沿目录下降补全
而flags被_values函数按照逗号分隔列表补全。
我已经介绍了_arguments定义的基础部分你还可以定义互斥选项、重复选项和参数、以+开头的选项等。有关更多细节,查阅[[https://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-System][官方文档]]。
同时你也可以看看本文末尾列出的教程,以及[[https://github.com/vapniks/zsh-completions/tree/master/src][src目录]]下的补全函数。
** 用_regex_arguments和_regex_words编写补全函数
如果你的命令行定义比较复杂有多个可能的参数序列那你可能需要_regex_arguments函数。
该函数也适用于有一系列跟着多个参数的关键词的情况。
_regex_arguments创建名字由第一个参数给出的补全函数。
因此你需要先调用_regex_arguments来创建补全函数然后再调用该函数比如
#+BEGIN_SRC sh
_regex_arguments _cmd OTHER_ARGS..
_cmd "$@"
#+END_SRC
OTHER_ARGS即“其它参数”是一序列用于在命令行上匹配和补全词汇的定义。
这些序列可被'|'分隔来表示备选词汇序列。
你可以用任意嵌套深度的括号来指定备选序列,但括号必须带反斜杠前缀,如\( \),或用引号括起来,如'(' ')'。
比如:
#+BEGIN_SRC sh
_regex_arguments _cmd 序列1 '|' 序列2 \( 序列2a '|' 序列2b \)
_cmd "$@"
#+END_SRC
该示例定义一个匹配序列1或序列2后跟着序列2a或序列2b的命令行。这种方式和正则表达式语法类似。
一个序列中的每个定义必须在开头包含一个/ PATTERN/ (即/ 模式/)部分,后跟着可选的':TAG:DESCRIPTION:ACTION'(即':标签:描述:动作')部分。
每个PATTERN是一个匹配一命令行词汇的正则表达式。这些模式按顺序匹配直到某个模式不匹配不匹配的模式将执行对应的ACTION动作以进行补全。
注意,一定要有一个匹配命令自身的模式。
下面有对PATTERN模式更详细的解释。
':TAG:DESCRIPTION:ACTION'的使用方法和_alternative相同只是开头多了个冒号“:”并且前面列出的所有ACTION格式都可用。
例如:
#+BEGIN_SRC sh
_regex_arguments _cmd /$'[^\0]##\0'/ \( /$'word1(a|b|c)\0'/ ':word:first word:(word1a word1b word1c)' '|'\
/$'word11(a|b|c)\0'/ ':word:first word:(word11a word11b word11c)' \( /$'word2(a|b|c)\0'/ ':word:second word:(word2a word2b word2c)'\
'|' /$'word22(a|b|c)\0'/ ':word:second word:(word22a word22b word22c)' \) \)
_cmd "$@"
#+END_SRC
TODO 英文原文和例子有出入
在这个例子中第一个词可以是word1即“词1”下同或者word11后紧跟a、b或c并且如果第一个词含有11则第二个词可以是word2后紧跟a、b或c或一个文件名。
如果感觉太复杂你也可以用更简单的_regex_words函数达到相同效果。
*** 模式
你可能注意到了上个例子中的/ PATTERN/和普通的正则表达式不太一样。
通常使用的是形如$'foo\0'的字符串参数。这是为了让\0表示成null字符而zsh内部用来分隔词汇的也是null字符。
如果不在末尾包含\0的话可能会无法匹配下一个词。如果你要把一个变量的值作为模式的一部分你可以用双括号包起来
这样变量就会展开然后再在后面加个包含null字符的字符串参数比如"$somevar"$'\0'somevar即“某变量”
表示模式用的正则表达式语法和正常的正则表达式不太一样,但我也找不到有关的文档。
不过我还是试图搞清楚了这些特殊字符的意义:
| * | 通配符 - 任何数量的字符 |
| ? | 通配符 - 单个字符 |
| # | 零个或更多的上一个字符(和一般正则表达式里的*一样) |
| ## | 一个或更多的上一个字符(和一般正则表达式里的+一样) |
*** _regex_words
_regex_words函数比_regex_arguments更简单易用。
调用_regex_words后的结果可以存在变量里。
要用_regex_words创建一个定义specification你需要提供一个标签后跟一段描述后跟一个定义不同词汇的列表。
这些定义采用'WORD:DESCRIPTION:SPEC'(即'词汇:描述:定义'的格式WORD即待补全的词DESCRIPTION是对应的描述
SPEC可以是由_regex_words创建的另一个变量以指定当前词后的下一个词汇也可以留空以表示没有更多的词。
比如:
#+BEGIN_SRC sh
_regex_words firstword '第一个词' 'word1a:词a:' 'word1b:词b:' 'word1c:词c'
#+END_SRC
该函数的返回结果将被存入$replyreply即“回复”、“回应”数组里所以我们需要在$reply变化前将结果存进另一个数组里
#+BEGIN_SRC sh
local -a firstword
_regex_words word 'The first word' 'word1a:a word:' 'word1b:b word:' 'word1c:c word'
firstword="$reply[@]"
#+END_SRC
firstword即“第一个词”。
然后我们可以把结果用在_regex_arguments里
#+BEGIN_SRC sh
_regex_arguments _cmd /$'[^\0]##\0'/ "$firstword[@]"
_cmd "$@"
#+END_SRC
注意到我给命令自身也加了模式。
这里还有个更复杂的词汇我们调用_regex_words以匹配不同词汇
#+BEGIN_SRC sh
local -a firstword firstword2 secondword secondword2
_regex_words word1 '第二个词' 'woo:鄧族' 'hoo:不关我事'
secondword=("$reply[@]")
_regex_words word2 '另一个第二个词' 'yee:汝' 'haa:很搞笑!'
secondword2=("$reply[@]")
_regex_words commands '第一个词' 'foo:做foo' 'man:yeah man' 'chu:at chu' # 译注作者在自嗨at chu除了比较像at you外没什么特殊意义
firstword=("$reply[@]")
_regex_words word4 '另一个第一个词' 'boo:吓死某人:$secondword' 'ga:嘤嘤嘤:$secondword'\
'loo:上厕所:$secondword2'
firstword2=("$reply[@]")
_regex_arguments _hello /$'[^\0]##\0'/ "${firstword[@]}" "${firstword2[@]}"
_hello "$@"
#+END_SRC
在这个例子中第一个词可以是"foo"、"man"、"chu"、"boo"、"ga"或"loo"。
如果第一个词是"boo"或"ga",那下一个词可以是"woo"或"hoo"
而如果第一个词是"loo"则第二个词可以是"yee"或"haa",其它情况下没有第二个词。
_ip函数是_regex_words的一个好用例。
** 用_values、_sep_parts和_multi_parts实现复杂补全
_values、_sep_parts和_multi_parts可以单独使用也可以作为_alternative、_arguments或_regex_arguments定义里的ACTION。可以看看下面的例子。
查阅[[https://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-System][官方文档]]以了解更多信息。
空格分隔的mp3文件列表
#+BEGIN_SRC sh
_values 'mp3文件' ~/*.mp3
#+END_SRC
逗号分隔的会话id列表
#+BEGIN_SRC sh
_values -s , '会话id' "${(uonzf)$(ps -A o sid=)}"
#+END_SRC
补全foo@news:woo、foo@news:laa或bar@news:woo等
#+BEGIN_SRC sh
_sep_parts '(foo bar)' @ '(news ftp)' : '(woo laa)'
#+END_SRC
补全MAC地址一次补全一个字节
#+BEGIN_SRC sh
_multi_parts : '(00:11:22:33:44:55 00:23:34:45:56:67 00:23:45:56:67:78)'
#+END_SRC
** 用compadd直接添加补全词
你可以使用内置的compadd函数增加补全词以获得更细致的控制。
这个函数有各种选项控制如何显示补全以及补全时如何替换命令行上的文字。
阅读[[https://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-System][官方文档]]以获得更多细节。
这里我只给出几个简单的示例。
向补全列表里加入若干词汇:
#+BEGIN_SRC sh
compadd foo bar blah
#+END_SRC
同上但显示注释:
#+BEGIN_SRC sh
compadd -X '一些注释' foo bar blah
#+END_SRC
同上但在补全前自动插入"what_"前缀
#+BEGIN_SRC sh
compadd -P what_ foo bar blah
#+END_SRC
同上但补全后自动插入"_todo"后缀:
#+BEGIN_SRC sh
compadd -S _todo foo bar blah
#+END_SRC
同上但在后缀后打空格时自动移除"_todo"后缀:
#+BEGIN_SRC sh
compadd -P _todo -q foo bar blah
#+END_SRC
向补全数组$wordsarraywordsarray即“词数组”加入词汇
#+BEGIN_SRC sh
compadd -a wordsarray
#+END_SRC
* 测试与debug
重新加载补全函数:
#+BEGIN_SRC sh
> unfunction _func
> autoload -U _func
#+END_SRC
这些函数会提供有用的信息。
如果默认按键没有用你可以尝试Alt+x然后再输入命令名。
| 函数 | 默认按键 | 作用 |
|-----------------+--------------------+----------------------------------------------------------------|
| _complete_help | Ctrl+x h | 在当前光标位置补全时显示有关上下文名称、标签和补全函数的信息 |
| _complete_help | Alt+2 Ctrl+x h | 同上但显示更多信息 |
| _complete_debug | Ctrl+x ? | 执行正常补全但跟踪补全系统执行的shell命令并存入一个临时文件 |
* 踩坑了吧 (需要小心的东西)
记得在补全函数的文件开头加那行#compdef
_arguments或_regex_arguments的定义中要使用正确的引号
如果定义中有变量要展开,用双引号,其它情况用单引号,
并且记得在ITEM项目描述处用不同的引号。译注见[[#动作Actions][动作Actions]]章节)
_arguments、_alternative、_regex_arguments等的定义处要在正确的地方使用正确数量的冒号“:”。
使用_regex_arguments时要记得在开头写匹配命令的模式不需要加入匹配动作action
记得在_regex_arguments的任何PATTERN模式参数后加上null字符$'\0'
* 小贴士
有时一个子命令后只会跟一个选项这时zsh会在tab在子命令后按下时自动补全。如果你想要在补全前先列出选项和描述
你可以向ACTION动作加入另一个空选项比如\:),如':TAG:DESCRIPTION:((opt1\:"opt1描述" \:))'
注意这只对在定义参数中使用ACTION的工具函数_arguments、_regex_arguments等有效。
* 其它资源
[[https://wikimatze.de/writing-zsh-completion-for-padrino/][]]是个展示_arguments函数的基本使用方法的教程短小精悍
而[[https://web.archive.org/web/20190411104837/http://www.linux-mag.com/id/1106/][]]是_arguments函数的稍稍更进阶的教程。
[[https://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-System][]]是zshcompsys手册页man page