Compare commits

...

106 Commits

Author SHA1 Message Date
F.B. 044b8788e4
Merge 5359bbf0e7 into 28c5bdcaf8 2026-03-10 01:16:06 +08:00
Shohei YOSHIDA 28c5bdcaf8
Merge pull request #1230 from zsh-users/ai_review
Fix various issues that are detected claude code
2026-03-09 23:54:39 +09:00
Shohei YOSHIDA 9dfdcf43c3
fix fail2ban-client completion
- Add missing option description
2026-03-08 23:15:40 +09:00
Shohei YOSHIDA fc2ebff046
Fix openssl completion
- fix typo
2026-03-08 23:15:28 +09:00
Shohei YOSHIDA 8c58e5f118
Fix textutil completion
- fix array value expansion
2026-03-08 23:15:05 +09:00
Shohei YOSHIDA 83ac2d1e89
fix ldattach
- improve description of 1st argument
2026-03-08 23:14:45 +09:00
Shohei YOSHIDA 71ac28d2e0
fix fail2ban-client completion
- fix wrong value completions
2026-03-08 23:05:29 +09:00
Shohei YOSHIDA c2ecb21e86
fix concourse completion
- add missing '='
2026-03-08 23:05:06 +09:00
Shohei YOSHIDA 0b0867f708
fix chromium completion
- correct exclusive flags
2026-03-08 23:04:45 +09:00
Shohei YOSHIDA 6a445e594b
fix dart completion
- fix wrong value completion
2026-03-08 23:04:28 +09:00
Shohei YOSHIDA b9cd906208
fix afew completion
- fix typo
2026-03-08 23:03:41 +09:00
Shohei YOSHIDA 586a4eb4a8
fix fwupdmgr completion
- fix quoting
2026-03-08 23:03:15 +09:00
Shohei YOSHIDA 002a11fdb7
Fix gio completion
- fix quoting
2026-03-08 23:02:56 +09:00
Shohei YOSHIDA 970077590a
fix gist completion
- fix quoting
2026-03-08 23:02:30 +09:00
Shohei YOSHIDA d330cb594f
Fix glances completion
- add missing argument description
2026-03-08 23:02:04 +09:00
Shohei YOSHIDA eca213e017
Fix gtk-launch completion
- fix quoting
2026-03-08 23:01:45 +09:00
Shohei YOSHIDA 5f2fad31ae
Fix inxi completion
Add missing variable definition
2026-03-08 23:01:06 +09:00
Shohei YOSHIDA 370c7e4e58
Fix ldattach completion
- Add first argument definition
2026-03-08 23:00:48 +09:00
Shohei YOSHIDA fe05ed6ed6
Fix nvm completion
- remove needless '='
2026-03-08 23:00:31 +09:00
Shohei YOSHIDA 95b96b10ba
Fix openssl completion
- fix wrong value completions
2026-03-08 23:00:06 +09:00
Shohei YOSHIDA a535d6d789
Fix openvpn3 completion
- fix wrong variable name
2026-03-08 22:59:40 +09:00
Shohei YOSHIDA eeb33f99ce
fix _port completion
- fix wrong option definitions
2026-03-08 22:59:16 +09:00
Shohei YOSHIDA d9dd3f1a56
Fix protoc completion
- add missing '='
2026-03-08 22:58:56 +09:00
Shohei YOSHIDA eeda4af31d
fix qmk completion
- fix wrong short flag name
2026-03-08 22:57:21 +09:00
Shohei YOSHIDA c1b7ac5bf0
Fix rails completion
- fix wrong variable usage
2026-03-08 22:56:44 +09:00
Shohei YOSHIDA ee1514fc41
Fix rubocop completion
- fix wrong short flag name
2026-03-08 22:56:19 +09:00
Shohei YOSHIDA 5d8642a3e8
Fix svm completion
- fix wrong function name
2026-03-08 22:56:03 +09:00
Shohei YOSHIDA cf3aafe66c
fix textutil completion
- fix wrong variable expantion
2026-03-08 22:55:42 +09:00
Shohei YOSHIDA 1f058a345f
fix tsc completion
- set '-C' flag of _arguments
- remove duplicated flags
2026-03-08 22:55:10 +09:00
Shohei YOSHIDA 6a282fe7fa
fix ufw completion
- fix the case when empty string is passed
2026-03-08 22:54:27 +09:00
Shohei YOSHIDA c7f779e025
fix uuidd completion
- fix typo
2026-03-08 22:53:58 +09:00
Shohei YOSHIDA 0737ba0f1e
Fix virtualbox completion
- avoid overriding internal variable names
- fix wrong switch case labels
2026-03-08 22:53:14 +09:00
Shohei YOSHIDA 81438c5a2e
Fix vnstat completion
- update exclusive flags
2026-03-08 22:52:49 +09:00
Shohei YOSHIDA 1fd073d384
fix yarn completion
- do not use global variable
2026-03-08 22:52:32 +09:00
Shohei YOSHIDA 4a9df2bdc8
fix fail2ban-client
- fix wrong switch syntax
- rename function names according to the convention
2026-03-08 22:15:05 +09:00
Shohei YOSHIDA ce1145e8ad
fix dhcpcd completion
- fix wrong short option name
2026-03-08 22:12:39 +09:00
Shohei YOSHIDA a110107c61
Fix chromium completion
- fix wrong _alternative usage
2026-03-08 22:12:07 +09:00
Shohei YOSHIDA 5021b01fd3
Fix bitcoin-cli completion
- fix using global variable issue
2026-03-08 22:11:43 +09:00
Shohei YOSHIDA 68549429e8
Fix bundle completion
- fix wrong option name
- fix typo
2026-03-08 22:11:15 +09:00
Shohei YOSHIDA 5988583ac4
Fix conan completion
- add missing completion
2026-03-08 22:10:54 +09:00
Shohei YOSHIDA 271e06295a
Fix chcpu completion
- fix wrong short option name
2026-03-08 22:10:33 +09:00
Shohei YOSHIDA 7b58f23040
Fix ecdsautil completion
- Add missing '\\'
2026-03-08 22:09:52 +09:00
Shohei YOSHIDA 88527a2778
Fix cppcheck completion
- remove duplicated options
- fix file name completion
2026-03-08 22:09:19 +09:00
Shohei YOSHIDA 85543dcb35
Fix cf completion
- fix a lot of broken syntax
2026-03-08 22:08:49 +09:00
Shohei YOSHIDA 324622c0d7
Fix dad completion
- remove needless colon
2026-03-08 22:08:22 +09:00
Shohei YOSHIDA 047e1a84fd
Fix dart completion
- fix wrong option name
2026-03-08 22:07:58 +09:00
Shohei YOSHIDA d6e87d4bb0
Fix emacs completion
- fix wrong option names
- fix wrong description syntax
2026-03-08 22:07:27 +09:00
Shohei YOSHIDA 81a016309d
Fix blkid completion
- fix wrong short name option
- correct _files flag to complete device files
2026-03-08 22:06:47 +09:00
Shohei YOSHIDA 63fb9ca323
Fix distro_info completion
- fix typo
2026-03-08 22:06:33 +09:00
Shohei YOSHIDA 96821fc50a
fix bento4 completion
- quote array strings for value that contains spaces
2026-03-08 22:05:58 +09:00
Shohei YOSHIDA 3acc91b1d6
fix archlinux-java completion
- fix wrong name of _describe
2026-03-08 22:05:12 +09:00
Shohei YOSHIDA 3f222623a2
Fix afew
- fix eclusive option definition
2026-03-08 22:04:45 +09:00
Shohei YOSHIDA 189ee541a1
fix fail2ban-regex completion
- fix wrong exclusive option syntax
2026-03-08 22:03:58 +09:00
Shohei YOSHIDA 9b16dadea5
Fix fallocate
- fix wrong short name option
2026-03-08 22:03:37 +09:00
Shohei YOSHIDA b835a4a76e
fix fwupdmgr completion
- fix wrong _alternative usage
- fix `-v` definition
- fix exclusive option syntax
2026-03-08 22:02:25 +09:00
Shohei YOSHIDA 95b7c563b2
Fix gas completion
- remove needless '|'
2026-03-08 22:02:04 +09:00
Shohei YOSHIDA 53e705a257
Fix glances completion
- fix typo
2026-03-08 22:01:47 +09:00
Shohei YOSHIDA d5ac886499
Fix inxi completion
- fix typo
2026-03-08 22:01:12 +09:00
Shohei YOSHIDA 84e54cb11a
Fix ipcrm completion
- remove needless '-'
2026-03-08 22:00:46 +09:00
Shohei YOSHIDA 3fefbee79e
fix jmeter completion
- remove duplicated options
2026-03-08 22:00:25 +09:00
Shohei YOSHIDA c852be29ac
fix kak completion
- `-l` option doesn't take any values
2026-03-08 21:59:43 +09:00
Shohei YOSHIDA 759f22227d
Fix l3build completion
- fix typo
2026-03-08 21:59:27 +09:00
Shohei YOSHIDA d101590b86
Fix language_code completion
- remove incorrect value
2026-03-08 21:58:53 +09:00
Shohei YOSHIDA 1b5eb7da8c
fix ldattach
- remove needless comma from exclusive option list
2026-03-08 21:58:29 +09:00
Shohei YOSHIDA 0b18ad83fc
Fix lsipc completion
- Fix wrong description
- Fix wrong short option name
2026-03-08 21:57:58 +09:00
Shohei YOSHIDA fc4f116cec
fix mc completion
- remove obsoleted options
2026-03-08 21:57:33 +09:00
Shohei YOSHIDA bff5ba4c7a
fix neo completion
- fix wrong option description
2026-03-08 21:57:10 +09:00
Shohei YOSHIDA d736522d58
Fix nftables completion
- remove needless debug print
- fix wrong value overwriting
2026-03-08 21:56:09 +09:00
Shohei YOSHIDA f6d745a6ef
Fix node completion
- fix wrong value completions
2026-03-08 21:55:46 +09:00
Shohei YOSHIDA 8a714f0ab2
fix openssl completion
- correct option value format
2026-03-08 21:54:24 +09:00
Shohei YOSHIDA 2bcf6ca857
Fix openvpn3 completion
And apply formatting
2026-03-08 21:54:02 +09:00
Shohei YOSHIDA 6a6e4a9d5f
Fix phing completion
- remove duplicate options
2026-03-08 21:53:05 +09:00
Shohei YOSHIDA 41aee557c2
fix pixz completion
- fix unquoted pattern
2026-03-08 21:52:07 +09:00
Shohei YOSHIDA ae43a3a125
Fix pkcon completion
- fix wrong short option name
2026-03-08 21:51:27 +09:00
Shohei YOSHIDA 106235197b
Fix pm2 completion
- fix exclusive options
- fix wrong function name
2026-03-08 21:48:55 +09:00
Shohei YOSHIDA a54108c932
Fix qmk
fix exclusive option syntax
2026-03-08 21:48:26 +09:00
Shohei YOSHIDA 769b2aac92
Fix _rails completion
fix directory traversal
2026-03-08 21:44:09 +09:00
Shohei YOSHIDA 410498264d
fix shallow-backup completion
- fix wrong syntax
- simplify code
2026-03-08 21:43:42 +09:00
Shohei YOSHIDA 0f350f3bdb
Fix shellcheck completion
- fix wrong path completion
2026-03-08 21:42:35 +09:00
Shohei YOSHIDA cc7816fefc
Fix sox_ng completion
- remove needless period
2026-03-08 21:41:43 +09:00
Shohei YOSHIDA 66dd5eb527
fix subliminal completion
- Remove needless comma
2026-03-08 21:41:25 +09:00
Shohei YOSHIDA 18e6e3557a
fix supervisord completion
- fix typo
- `--help` doesn't take any arguments
- fix wrong short option name
2026-03-08 21:41:08 +09:00
Shohei YOSHIDA 530a4f68ed
fix tmuxp completion
- fix wrong exclusive options
2026-03-08 21:40:00 +09:00
Shohei YOSHIDA f103e01de0
fix tox completion
- fix typos
2026-03-08 21:39:19 +09:00
Shohei YOSHIDA e4c9b686cd
fix tsc completion
- add missing ':'
2026-03-08 21:38:58 +09:00
Shohei YOSHIDA 9d7f1bd8b6
Fix ufw completion
- remove the needless function
2026-03-08 21:38:37 +09:00
Shohei YOSHIDA ba9b7bb7d3
Fix uuid completion
- fix wrong option names
2026-03-08 21:37:51 +09:00
Shohei YOSHIDA 48cd968441
fix _vipw completion
- fix typo
2026-03-08 21:37:00 +09:00
Shohei YOSHIDA d255543a98
Fix yarn completion
- fix typo
- fix exclusive option syntax
2026-03-08 21:36:23 +09:00
Shohei YOSHIDA 14d065df4f
Remove artisan completion
Because artisan support zsh(and another shell completion) by itself
2026-03-08 20:58:58 +09:00
Shohei YOSHIDA fb925c30a5
Remove deprecated android command completion
It has been deprecated since 2017.
2026-03-08 20:55:07 +09:00
Shohei YOSHIDA f4b2b49aa2
Remove homestead completion
It has been depreacted for several years.
2026-03-08 20:38:30 +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
72 changed files with 1328 additions and 1244 deletions

View File

@ -45,14 +45,14 @@ _arguments \
"(-t --tag -m --move-mails)"{-w,--watch}"[continuously monitor the mailbox for new messages matching the given query]" \
"(-m --move-mails -w --watch)"{-t,--tag}"[run the tag filters]" \
"(-w --watch -m --move-mails)"{-m,--move-mails}"[move mail files between maildir folders]" \
"(-n --all)"{-a,--all}"[operate on all email]" \
"(-a --new)"{-n,--new}"[operate on all new email]" \
"(-a --all)"{-a,--all}"[operate on all email]" \
"(-n --new)"{-n,--new}"[operate on all new email]" \
{-C,--notmuch-config=}"[specify path to notmuch configuration file]:files:_files" \
{-e,--enable-filters=}"[specify filter classes to use]:filter" \
{-d,--dry-run}"[don't change the DB]" \
{-R,--reference-set-size=}"[specify size of the reference set]:size [1000]" \
{-T,--reference-set-timeframe-days=}"[don't use emails older than specified age]:age (days) [30]" \
{-N,--notmuch-args=}"[arguments for nutmuch new(in move mode)]:notmuch arg" \
{-N,--notmuch-args=}"[arguments for notmuch new(in move mode)]:notmuch arg" \
{-v,--verbose}"[be more verbose]" \
'*: :_guard "^-*" query'

View File

@ -1,308 +0,0 @@
#compdef android
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for the android command (Revision 12)
# (http://developer.android.com/guide/developing/tools/android.html).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Julien Nicoulaud <julien.nicoulaud@gmail.com>
#
# ------------------------------------------------------------------------------
_android() {
typeset -A opt_args
local context state line curcontext="$curcontext"
local ret=1
_arguments -C -A "-*" \
'(- : *)'{-h,--help}'[get help on a specific command]:command:_android_cmds' \
'(-s --silent -v --verbose)'{-v,--verbose}'[verbose mode: errors, warnings and informational messages are printed]' \
'(-v --verbose -s --silent)'{-s,--silent}'[silent mode: only errors are printed out]' \
'1: :_android_cmds' \
'*::arg:->args' \
&& ret=0
case "$state" in
(args)
curcontext="${curcontext%:*:*}:android-cmd-$words[1]:"
case $words[1] in
(list)
_arguments -C \
'1: :_android_list_entities' \
'*::list-arg:->list-args' \
&& ret=0
case "$state" in
(list-args)
case $words[1] in
(avd|target)
_arguments \
'(-0 --null)'{-0,--null}'[terminate lines with \0 instead of \n (e.g. for xargs -0)]' \
'(-c --compact)'{-c,--compact}'[compact output (suitable for scripts)]' \
&& ret=0
;;
(sdk)
_arguments \
'(-o --obsolete)'{-o,--obsolete}'[install obsolete packages]' \
'--proxy-host[HTTP/HTTPS proxy host (overrides settings if defined)]:proxy host:_hosts' \
'--proxy-port[HTTP/HTTPS proxy port (overrides settings if defined)]:proxy port number' \
'(-s --no-https)'{-s,--no-https}'[use HTTP instead of HTTPS (the default) for downloads]' \
'(-u --no-ui)'{-u,--no-ui}'[display list result on console (no GUI)]' \
&& ret=0
;;
esac
;;
esac
;;
(create)
_arguments -C \
'1: :_android_create_entities' \
'*::create-arg:->create-args' \
&& ret=0
case "$state" in
(create-args)
case $words[1] in
(avd)
_arguments \
'(-c --sdcard)'{-c,--sdcard}'[path to a shared SD card image, or size of a new sdcard for the new AVD]:SD card image or size:_files -g "*.img"' \
'(-n --name)'{-n,--name}'[name of the new AVD]:name' \
'(-a --snapshot)'{-a,--snapshot}'[place a snapshots file in the AVD, to enable persistence]' \
'(-p --path)'{-p,--path}'[directory where the new AVD will be created]: :_files -/' \
'(-f --force)'{-f,--force}'[forces creation (overwrites an existing AVD)]' \
'(-s --skin)'{-s,--skin}'[skin for the new AVD]:skin' \
'(-t --target)'{-t,--target}'[target ID of the new AVD]: :_android_targets' \
&& ret=0
;;
(project)
_arguments \
'(-n --name)'{-n,--name}'[project name]:project name' \
'(-p --path)'{-p,--path}'[the new project'\''s directory]: :_files -/' \
'(-k --package)'{-k,--package}'[Android package name for the application]:package name' \
'(-a --activity)'{-a,--activity}'[name of the default Activity that is created]:activity name' \
'(-t --target)'{-t,--target}'[target ID of the new project]: :_android_targets' \
&& ret=0
;;
(test-project)
_arguments \
'(-n --name)'{-n,--name}'[project name]:project name' \
'(-p --path)'{-p,--path}'[the new project'\''s directory]: :_files -/' \
'(-m --main)'{-m,--main}'[path to directory of the app under test, relative to the test project directory]:path' \
&& ret=0
;;
(lib-project)
_arguments \
'(-n --name)'{-n,--name}'[project name]:project name' \
'(-p --path)'{-p,--path}'[the new project'\''s directory]: :_files -/' \
'(-k --package)'{-k,--package}'[Android package name for the application]:package name' \
'(-t --target)'{-t,--target}'[target ID of the new project]: :_android_targets' \
&& ret=0
;;
esac
;;
esac
;;
(update)
_arguments -C \
'1: :_android_update_entities' \
'*::update-arg:->update-args' \
&& ret=0
case "$state" in
(update-args)
case $words[1] in
(avd)
_arguments \
'(-n --name)'{-n,--name}'[name of the AVD to update]: :_android_avd_names' \
&& ret=0
;;
(project)
_arguments \
'(-l --library)'{-l,--library}'[directory of an Android library to add, relative to this project'\''s directory]: :_files -/' \
'(-p --path)'{-p,--path}'[the project'\''s directory]: :_files -/' \
'(-n --name)'{-n,--name}'[project name]:name' \
'(-t --target)'{-t,--target}'[target ID to set for the project]: :_android_targets' \
'(-s --subprojects)'{-s,--subprojects}'[also updates any projects in sub-folders, such as test projects]' \
&& ret=0
;;
(test-project)
_arguments \
'(-p --path)'{-p,--path}'[the project'\''s directory]: :_files -/' \
'(-m --main)'{-m,--main}'[directory of the app under test, relative to the test project directory]:path' \
&& ret=0
;;
(lib-project)
_arguments \
'(-p --path)'{-p,--path}'[the project'\''s directory]: :_files -/' \
'(-t --target)'{-t,--target}'[target ID to set for the project]: :_android_targets' \
&& ret=0
;;
(sdk)
_arguments \
'(-o --obsolete)'{-o,--obsolete}'[install obsolete packages]' \
'--proxy-host[HTTP/HTTPS proxy host (overrides settings if defined)]:proxy host:_hosts' \
'--proxy-port[HTTP/HTTPS proxy port (overrides settings if defined)]:proxy port number' \
'(-s --no-https)'{-s,--no-https}'[use HTTP instead of HTTPS (the default) for downloads]' \
'(-u --no-ui)'{-u,--no-ui}'[update from command-line (no GUI)]' \
'(-f --force)'{-f,--force}'[force replacement of a package or its parts, even if something has been modified]' \
'(-t --filter)'{-t,--filter}'[a filter that limits the update to the specified types of packages]: :_android_sdk_update_filters -s ,' \
'(-n --dry-mode)'{-n,--dry-mode}'[simulate the update but does not download or install anything]' \
&& ret=0
;;
esac
;;
esac
;;
(move)
_arguments -C \
'1: :_android_move_entities' \
'*::move-arg:->move-args' \
&& ret=0
case "$state" in
(move-args)
case $words[1] in
(avd)
_arguments \
'(-n --name)'{-n,--name}'[name of the AVD to move or rename]: :_android_avd_names' \
'(-p --path)'{-p,--path}'[path to the AVD'\''s new directory]: :_files -/' \
'(-r --rename)'{-r,--rename}'[new name of the AVD]:name' \
&& ret=0
;;
esac
;;
esac
;;
(delete)
_arguments -C \
'1: :_android_delete_entities' \
'*::delete-arg:->delete-args' \
&& ret=0
case "$state" in
(delete-args)
case $words[1] in
(avd)
_arguments \
'(-n --name)'{-n,--name}'[name of the AVD to delete]: :_android_avd_names' \
&& ret=0
;;
esac
;;
esac
;;
(display)
_arguments \
'1: :_android_display_entities' \
&& ret=0
;;
esac
;;
esac
return ret
}
(( $+functions[_android_cmds] )) ||
_android_cmds() {
local commands; commands=(
'list:list existing targets or virtual devices'
'create:create new virtual devices or projects'
'update:update a virtual device, project, SDK or adb'
'move:move a virtual device'
'delete:delete a virtual device'
'avd:displays the AVD Manager window'
'sdk:displays the SDK Manager window'
'display:display manager windows'
)
_describe -t commands 'command' commands "$@"
}
(( $+functions[_android_list_entities] )) ||
_android_list_entities() {
local entities; entities=(
'avd:list existing Android Virtual Devices'
'target:list existing targets'
'sdk:list remote SDK repository'
)
_describe -t entities 'entity' entities "$@"
}
(( $+functions[_android_create_entities] )) ||
_android_create_entities() {
local entities; entities=(
'avd:create a new Android Virtual Device'
'project:create a new Android project'
'test-project:create a new Android project for a test package'
'lib-project:create a new Android library project'
)
_describe -t entities 'entity' entities "$@"
}
(( $+functions[_android_update_entities] )) ||
_android_update_entities() {
local entities; entities=(
'avd:update an Android Virtual Device to match the folders of a new SDK'
'project:update an Android project'
'test-project:update the Android project for a test package'
'lib-project:update an Android library project'
'adb:update adb to support the USB devices declared in the SDK add-ons'
'sdk:update the SDK by suggesting new platforms to install if available'
)
_describe -t entities 'entity' entities "$@"
}
(( $+functions[_android_move_entities] )) ||
_android_move_entities() {
local entities; entities=(
'avd:move or rename an Android Virtual Device'
)
_describe -t entities 'entity' commands "$@"
}
(( $+functions[_android_delete_entities] )) ||
_android_delete_entities() {
local entities; entities=(
'avd:delete an Android Virtual Device'
)
_describe -t entities 'entity' entities "$@"
}
(( $+functions[_android_display_entities] )) ||
_android_display_entities() {
local entities; entities=(
'sdk:display the SDK Manager window'
'avd:display the AVD Manager window'
)
_describe -t entities 'entity' entities "$@"
}
(( $+functions[_android_targets] )) ||
_android_targets() {
local targets; targets=(${(f)"$(_call_program targets $service list target --compact)"//:/\\:})
_describe -t targets 'target' targets "$@"
}
(( $+functions[_android_avd_names] )) ||
_android_avd_names() {
local avd_names; avd_names=(${(f)"$(_call_program targets $service list avd --compact)"//:/\\:})
_describe -t avd-names 'AVD name' avd_names "$@"
}
(( $+functions[_android_sdk_update_filters] )) ||
_android_sdk_update_filters() {
local filters; filters=(platform tool platform-tool doc sample extra)
_values $@ 'filter' "${filters[@]}"
}
_android "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -43,7 +43,7 @@ _archlinux-java_command_arguments() {
case $words[1] in
(set)
local java_versions=("${(@f)$(archlinux-java status | tail -n +2 | tr -s ' ' | cut -d ' ' -f2)}")
_describe -t output 'Downloads to delete' java_versions
_describe -t output 'Java environments' java_versions
;;
esac
}

View File

@ -1,63 +0,0 @@
#compdef artisan
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - https://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for artisan (http://laravel.com/docs/artisan).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * loranger (https://github.com/loranger)
# * Yohan Tambè (https://github.com/Cronos87)
#
# ------------------------------------------------------------------------------
_artisan_get_command_list () {
IFS=" "
php artisan --no-ansi | \
sed "1,/Available commands/d" | \
awk '/ [a-z]+/ { print $1 }' | \
sed -E 's/^[ ]+//g' | \
sed -E 's/[:]+/\\:/g' | \
sed -E 's/[ ]{2,}/\:/g'
}
_artisan () {
if [ -f artisan ]; then
local -a commands
IFS=$'\n'
commands=(`_artisan_get_command_list`)
_describe 'commands' commands
fi
}
compdef _artisan php artisan
compdef _artisan artisan

View File

@ -306,7 +306,7 @@ case $service in
esac
_arguments \
$options[@] \
"${options[@]}" \
"*::file:_files"
# Local Variables:

View File

@ -40,6 +40,7 @@
_bitcoin-cli() {
local context state line curcontext="$curcontext"
local ret=1
_arguments -C \
-?'[This help message]' \

View File

@ -50,14 +50,14 @@ _arguments \
'(-o --output)'{-o+,--output}'[Use the specified output format]:format:(full value list device udev export)' \
'(-O --offset)'{-O+,--offset}'[Probe at the given offset]:offset' \
'(-p --probe)'{-p,--probe}'[Switch to low-level superblock probing mode]' \
'(-s --match-tag)'{-m+,--match-tag}'[Show only the tags that match tag]:tag' \
'(-s --match-tag)'{-s+,--match-tag}'[Show only the tags that match tag]:tag' \
'(-S --size)'{-S,--size}'[Override the size of device/file]' \
'(-t --match-token)'{-t+,--match-token}'[Search for block devices with tokens named NAME that have the VALUE]:name' \
'(-u --usages)'{-u,--usages}'[Restrict the probing functions to the specified comma-separated list of usage types]:list' \
'(-U --uuid)'{-U,--uuid}'[Look up the device that uses this filesystem uuid]:uuid' \
'(- *)'{-h,--help}'[Display help text and exit]' \
'(- *)'{-V,--version}'[Print version and exit]' \
'*:device:_files -g /dev'
'*:device:_files -W /dev'
# Local Variables:
# mode: Shell-Script

View File

@ -49,7 +49,7 @@ _bundle() {
_arguments -C -A "-v" -A "--version" \
'(- 1 *)'{-v,--version}'[display version information]' \
'(-r --retry)'{-r,--retry}'[specify the number of times you with to attempt network commands]:number:' \
'(-v --verbose)'{-V,--verbose}'[print out additional logging information]' \
'(-V --verbose)'{-V,--verbose}'[print out additional logging information]' \
'--no-color[print all output without color]' \
'1: :_bundle_commands' \
'*:: :->args' && ret=0
@ -111,7 +111,7 @@ _bundle() {
'--cache-path=-[specify a different cache path than the default(vendor/cache)]: :_files -/' \
'--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile:_files' \
"--no-install[don't install the gems, only update the cache]" \
'--quite[only output warnings and errors]' \
'--quiet[only output warnings and errors]' \
&& ret=0
;;
(exec)

135
src/_cf
View File

@ -38,117 +38,130 @@
# Output a selectable list of organizations
__cf_orgs() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf orgs | awk 'NR>3{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'ORG' cont_cmd
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf orgs | awk 'NR>3{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'ORG' cont_cmd
fi
}
# Output a selectable list of spaces
__cf_spaces() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf spaces | awk 'NR>3{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'SPACE' cont_cmd
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf spaces | awk 'NR>3{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'SPACE' cont_cmd
fi
}
# Output a selectable list of applications
__cf_apps() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf apps | awk 'NR>4{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'APP' cont_cmd
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf apps | awk 'NR>4{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'APP' cont_cmd
fi
}
# Output a selectable list of stacks
__cf_stacks() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf stacks | awk 'NR>4{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'STACK' cont_cmd
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf stacks | awk 'NR>4{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'STACK' cont_cmd
fi
}
# Output a selectable list of services
__cf_marketplace_services() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf marketplace | awk 'NR>4{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'SERVICE' cont_cmd
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf marketplace | awk 'NR>4{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'SERVICE' cont_cmd
fi
}
# Output a selectable list of services
__cf_services() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf services | awk 'NR>4{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'SERVICE' cont_cmd
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf services | awk 'NR>4{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'SERVICE' cont_cmd
fi
}
# Output a selectable list of domains
__cf_domains() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf domains | grep -v shared | awk 'NR>2{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'DOMAIN' cont_cmd
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf domains | grep -v shared | awk 'NR>2{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'DOMAIN' cont_cmd
fi
}
# Output a selectable list of shared domains
__cf_shared_domains() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf domains | grep -v owned | awk 'NR>2{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'SHARED-DOMAIN' cont_cmd
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf domains | grep -v owned | awk 'NR>2{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'SHARED-DOMAIN' cont_cmd
fi
}
# Output a selectable list of hostnames
__cf_hostnames() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf routes | awk 'NR>3{print $2}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'ROUTE' cont_cmd
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf routes | awk 'NR>3{print $2}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'ROUTE' cont_cmd
fi
}
# Output a selectable list of buildpacks
__cf_buildpacks() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf buildpacks | awk 'NR>3{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'BUILDPACK' cont_cmd
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf buildpacks | awk 'NR>3{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'BUILDPACK' cont_cmd
fi
}
# Output a selectable list of feature flags
__cf_feature_flags() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf feature-flags | awk 'NR>4{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'FEATURE-FLAG' cont_cmd
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf feature-flags | awk 'NR>4{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'FEATURE-FLAG' cont_cmd
fi
}
# Output a selectable list of plugin repos
__cf_repo_plugins() {
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf list-plugin-repos | awk 'NR>3{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'REPO-PLUGIN' cont_cmd
declare -a cont_cmd
cont_cmd=($(CF_COLOR=false CF_TRACE=false cf list-plugin-repos | awk 'NR>3{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'REPO-PLUGIN' cont_cmd
fi
}
# Output a selectable list of plugins
__cf_plugins() {
declare -a cont_cmd
cont_cmd=($(cf plugins | awk 'NR>4{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'PLUGIN' cont_cmd
declare -a cont_cmd
cont_cmd=($(cf plugins | awk 'NR>4{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'PLUGIN' cont_cmd
fi
}
# Output a selectable list of targets (requires cf-targets plugin)
__cf_targets() {
declare -a cont_cmd
cont_cmd=($(cf targets | awk '{print $1}'))
if [[ 'X$cont_cmd' != 'X' ]]
_describe 'TARGET' cont_cmd
declare -a cont_cmd
cont_cmd=($(cf targets | awk '{print $1}'))
if [[ "X$cont_cmd" != 'X' ]]; then
_describe 'TARGET' cont_cmd
fi
}
# --------------------------
# ----- end Helper functions
# --------------------------
@ -992,3 +1005,11 @@ case "$words[1]" in
delete-target)
__delete-target ;;
esac
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -40,7 +40,7 @@ _arguments \
'(-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)'{-d,--deconfigure}'[deconfigure the specified CPUs]:cpu_list' \
'(-g --deconfigure)'{-g,--deconfigure}'[deconfigure the specified CPUs]:cpu_list' \
'(-p --dispatch)'{-p,--dispatch}'[set the CPU dispatching mode]:mode:(horizontal vertical)' \
'(-r --rescan)'{-r,--rescan}'[trigger a rescan of CPUs]'

View File

@ -33,17 +33,17 @@
# or submit itself to any jurisdiction.
_arguments \
"--user-data-dir=[Specify the directory that user data is kept in]:directory:_path_files -/" \
"--app=[Runs URL in app mode]:url:_urls" \
"--incognito[Open in incognito mode]" \
"--new-window[open in new window]" \
"(--no-proxy-server --proxy-auto-detect --proxy-pac-url --password-store)--proxy-server=[specify proxy server]:[<proxy-scheme>\://]<proxy-host>[\:<proxy-port>]:_chromium_proxyurls" \
"--no-proxy-server[Disables the proxy server]" \
"--proxy-auto-detect[Autodetect proxy configuration]" \
"--proxy-pac-url=[Specify proxy autoconfiguration URL]:proxy autoconfiguration url:_urls" \
"--password-store=[Set the password store to use]:password store: _wanted arguments expl 'wallet store' compadd -- basic gnome kwallet" \
"--version[print version]" \
"*:: :{ _alternative _urls _files }"
"--user-data-dir=[Specify the directory that user data is kept in]:directory:_path_files -/" \
"--app=[Runs URL in app mode]:url:_urls" \
"--incognito[Open in incognito mode]" \
"--new-window[open in new window]" \
"(--no-proxy-server --proxy-auto-detect --proxy-pac-url)--proxy-server=[specify proxy server]:[<proxy-scheme>\://]<proxy-host>[\:<proxy-port>]:_chromium_proxyurls" \
"--no-proxy-server[Disables the proxy server]" \
"--proxy-auto-detect[Autodetect proxy configuration]" \
"--proxy-pac-url=[Specify proxy autoconfiguration URL]:proxy autoconfiguration url:_urls" \
"--password-store=[Set the password store to use]:password store: _wanted arguments expl 'wallet store' compadd -- basic gnome kwallet" \
"--version[print version]" \
'*:: :{ _alternative "urls\:url\:_urls" "file\:file\:_files" }'
# excerpt from the chromium help message:
#
@ -84,128 +84,136 @@ _arguments \
_chromium_proxyurls () {
#TODO: semicolon separated urls not yet implemented
# mostly copied from _urls
local ipre scheme host user uhosts ret=1 expl match glob suf
local localhttp
zstyle -a ":completion:${curcontext}:urls" local localhttp
local localhttp_servername="$localhttp[1]"
local localhttp_documentroot="$localhttp[2]"
local localhttp_userdir="$localhttp[3]"
zstyle -a ":completion:${curcontext}:urls" urls urls
if [[ $#urls -gt 1 || ( $#urls -eq 1 && ! -d $urls[1] ) ]]
then
[[ $#urls -eq 1 && -f $urls[1] ]] && urls=($(< $urls[1]))
_wanted urls expl 'URL' compadd "$@" -a urls && return 0
urls=()
fi
urls="$urls[1]"
glob=(-g '*(^/)')
zparseopts -D -K -E 'g:=glob'
ipre="$IPREFIX"
if ! compset -P '(#b)([-+.a-z0-9]#):'
then
_tags -C argument prefixes
while _tags
do
while _next_label prefixes expl 'URL prefix' -S '' "$@"
do
compset -S '[^:/]*' && compstate[to_end]=''
compadd "$expl[@]" http:// socks:// socks4:// socks5:// && ret=0
done
(( ret )) || return 0
done
return 1
fi
scheme="$match[1]"
case "$scheme" in
local ipre scheme host user uhosts ret=1 expl match glob suf
local localhttp
zstyle -a ":completion:${curcontext}:urls" local localhttp
local localhttp_servername="$localhttp[1]"
local localhttp_documentroot="$localhttp[2]"
local localhttp_userdir="$localhttp[3]"
zstyle -a ":completion:${curcontext}:urls" urls urls
if [[ $#urls -gt 1 || ( $#urls -eq 1 && ! -d $urls[1] ) ]]
then
[[ $#urls -eq 1 && -f $urls[1] ]] && urls=($(< $urls[1]))
_wanted urls expl 'URL' compadd "$@" -a urls && return 0
urls=()
fi
urls="$urls[1]"
glob=(-g '*(^/)')
zparseopts -D -K -E 'g:=glob'
ipre="$IPREFIX"
if ! compset -P '(#b)([-+.a-z0-9]#):'
then
_tags -C argument prefixes
while _tags
do
while _next_label prefixes expl 'URL prefix' -S '' "$@"
do
compset -S '[^:/]*' && compstate[to_end]=''
compadd "$expl[@]" http:// socks:// socks4:// socks5:// && ret=0
done
(( ret )) || return 0
done
return 1
fi
scheme="$match[1]"
case "$scheme" in
(http(|s)|socks(|4|5)) if ! compset -P //
then
_wanted -C "$scheme" prefixes expl 'end of prefix' compadd -S '' "$@" //
return
fi ;;
(file) [[ -prefix //(127.0.0.1|localhost)/ ]] && compset -P '//(127.0.0.1|localhost)'
[[ -prefix /// ]] && compset -P //
if ! compset -P //
then
_tags -C file files
while _tags
do
while _next_label files expl 'local file'
do
if [[ -prefix / ]]
then
_path_files "$expl[@]" -S '' "${glob[@]}" && ret=0
_path_files "$expl[@]" -S/ -r '/' -/ && ret=0
elif [[ -z "$PREFIX" ]]
then
compadd -S '/' -r '/' "$expl[@]" "$@" - "${PWD%/}" && ret=0
fi
done
(( ret )) || return 0
done
return 1
fi ;;
esac
if ! compset -P '(#b)([^:/]#)([:/])'
then
uhosts=($urls/$scheme/$PREFIX*$SUFFIX(/:t))
_tags hosts
while _tags
do
while _next_label hosts expl host
do
compset -S '[:/]*' || suf="/"
(( $#uhosts )) || _hosts -S "$suf" -r '/:' "$expl[@]" && ret=0
[[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername)
compadd -S "$suf" -r '/:' "$expl[@]" -a uhosts && ret=0
done
(( ret )) || return 0
done
return 1
fi
host="$match[1]"
[[ $match[2] = ':' ]] && ! compset -P '<->/' && _message -e ports 'port number' && return 0
_tags remote-files files || return 1
if [[ "$localhttp_servername" = "$host" ]]
then
if compset -P \~
then
if ! compset -P '(#b)([^/]#)/'
then
_users -S/ "$@"
return
fi
user="$match[1]"
while _tags
do
while _next_label files expl 'local file'
do
_path_files "$expl[@]" "$@" -W ~$user/$localhttp_userdir "${glob[@]}" && ret=0
_path_files -S/ -r '/' "$expl[@]" -W ~$user/$localhttp_userdir-/ && ret=0
done
(( ret )) || return 0
done
else
while _tags
do
while _next_label files expl 'local file'
do
_path_files "$expl[@]" "$@" -W $localhttp_documentroot "${glob[@]}" && ret=0
_path_files -S/ -r '/' "$expl[@]" -W $localhttp_documentroot -/ && ret=0
done
(( ret )) || return 0
done
fi
else
while _tags
do
(( $#urls )) && while _next_label files expl 'local file'
do
_path_files "$expl[@]" "$@" -W $urls/$scheme/$host "${glob[@]}" && ret=0
_path_files -S/ -r '/' "$expl[@]" -W $urls/$scheme/$host -/ && ret=0
done
[[ $scheme = (scp|sftp) ]] && _requested remote-files && _remote_files -h $host -- ssh && ret=0
(( ret )) || return 0
done
fi
return $ret
then
_wanted -C "$scheme" prefixes expl 'end of prefix' compadd -S '' "$@" //
return
fi ;;
(file) [[ -prefix //(127.0.0.1|localhost)/ ]] && compset -P '//(127.0.0.1|localhost)'
[[ -prefix /// ]] && compset -P //
if ! compset -P //
then
_tags -C file files
while _tags
do
while _next_label files expl 'local file'
do
if [[ -prefix / ]]
then
_path_files "$expl[@]" -S '' "${glob[@]}" && ret=0
_path_files "$expl[@]" -S/ -r '/' -/ && ret=0
elif [[ -z "$PREFIX" ]]
then
compadd -S '/' -r '/' "$expl[@]" "$@" - "${PWD%/}" && ret=0
fi
done
(( ret )) || return 0
done
return 1
fi ;;
esac
if ! compset -P '(#b)([^:/]#)([:/])'
then
uhosts=($urls/$scheme/$PREFIX*$SUFFIX(/:t))
_tags hosts
while _tags
do
while _next_label hosts expl host
do
compset -S '[:/]*' || suf="/"
(( $#uhosts )) || _hosts -S "$suf" -r '/:' "$expl[@]" && ret=0
[[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername)
compadd -S "$suf" -r '/:' "$expl[@]" -a uhosts && ret=0
done
(( ret )) || return 0
done
return 1
fi
host="$match[1]"
[[ $match[2] = ':' ]] && ! compset -P '<->/' && _message -e ports 'port number' && return 0
_tags remote-files files || return 1
if [[ "$localhttp_servername" = "$host" ]]
then
if compset -P \~
then
if ! compset -P '(#b)([^/]#)/'
then
_users -S/ "$@"
return
fi
user="$match[1]"
while _tags
do
while _next_label files expl 'local file'
do
_path_files "$expl[@]" "$@" -W ~$user/$localhttp_userdir "${glob[@]}" && ret=0
_path_files -S/ -r '/' "$expl[@]" -W ~$user/$localhttp_userdir-/ && ret=0
done
(( ret )) || return 0
done
else
while _tags
do
while _next_label files expl 'local file'
do
_path_files "$expl[@]" "$@" -W $localhttp_documentroot "${glob[@]}" && ret=0
_path_files -S/ -r '/' "$expl[@]" -W $localhttp_documentroot -/ && ret=0
done
(( ret )) || return 0
done
fi
else
while _tags
do
(( $#urls )) && while _next_label files expl 'local file'
do
_path_files "$expl[@]" "$@" -W $urls/$scheme/$host "${glob[@]}" && ret=0
_path_files -S/ -r '/' "$expl[@]" -W $urls/$scheme/$host -/ && ret=0
done
[[ $scheme = (scp|sftp) ]] && _requested remote-files && _remote_files -h $host -- ssh && ret=0
(( ret )) || return 0
done
fi
return $ret
}
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -509,6 +509,8 @@ _conan_remote() {
)
;;
esac
_arguments "${opts[@]}"
;;
esac
}

View File

@ -102,7 +102,7 @@ _concourse_quickstart_or_web() {
'--debug-bind-port=[port on which to listen for the pprof debugger endpoints]: :_concourse_ports'
'--intercept-idle-timeout=[length of time for a intercepted session to be idle before terminating]: :_concourse_durations'
'--component-runner-interval=[interval on which runners are kicked off for builds, locks, scans and checks]:interval:_concourse_durations'
'--lidar-scanner-interval[interval on which the resource scanner will run to see if new checkes need to be scheduled]:interval:_concourse_durations'
'--lidar-scanner-interval=[interval on which the resource scanner will run to see if new checks need to be scheduled]:interval:_concourse_durations'
'--global-resource-check-timeout=[time limit on checking for new versions of resources]: :_concourse_durations'
'--resource-checking-interval=[interval on which to check for new versions of resources]: :_concourse_durations'
'--resource-type-checking-interval=[interval on which to check for new versions of resource types]: :_concourse_durations'

View File

@ -68,14 +68,13 @@ _cppcheck() {
"*--disable=[Disable individual checks]:id:$check_ids" \
"--dump[Dump xml data for each translation unit]" \
"-D[Define preprocessor symbol]" \
"-U[Undefine preprocessor symbol]" \
"-E[Print preprocessor output on stdout and don't do any further processing]" \
"--enable=[Enable additional checks]:id:$check_ids" \
"--error-exitcode=[Integer to return if errors are found]" \
"--errorlist[Print a list of all the error messages in XML format]" \
"--exitcode-suppressions=[Used when certain messages should be displayed but should not cause a non-zero exitcode]:_files" \
"*--file-filter=[Analyze only those files matching the given filter str]:filter" \
"--file-list=[Specify the files to check in a text file]:_files" \
"--file-list=[Specify the files to check in a text file]:file:_files" \
"(-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]" \
@ -95,12 +94,11 @@ _cppcheck() {
"--output-file=[File to save results]:file:_files" \
"--output-format=[Specify the output format]:format:(text sarif xml)" \
"--platform=[Specified platform specific types and sizes]:platform:$platforms" \
"--plist-output=[Generate Clang-plist output files in folder]:_files" \
"--plist-output=[Generate Clang-plist output files in folder]:file:_files" \
"--project=[Run Cppcheck on project]:file:_files" \
"--project-configuration=[Limit the configuration cppcheck should check]:configuration" \
"--platform=[Set platform specific types and sizes]:platforms:(unix32 unix64 win32A win32W win64 avr8 elbrus-e1cp pic8 pic8-enhanced pic16 mips32 native unspecified)" \
"(-q --quiet)"{-q,--quiet}"[Do not show progress reports]" \
{-rp,--relative-paths}"=[Use relative paths in output (separated with ;)]:_files" \
{-rp,--relative-paths}"=[Use relative paths in output (separated with ;)]:file:_files" \
"--report-progress[Report progress messages while checking a file]" \
"--report-type=[Add guideline and classification fields for specified coding standard]:standard:$coding_standards" \
"--rule=[Match regular expression]:rule" \
@ -108,8 +106,8 @@ _cppcheck() {
"--showtime=[show timing information]:type:(none file file-total summary top5_file top5_summary top5)" \
"--std=[Set standard]:std:(c89 c99 c11 c++03 c++11 c++14 c++17 c++20)" \
"--suppress=[Suppress warnings (format: \[error id\]:\[filename\]:\[line\])]" \
"--suppressions-list=[Suppress warnings listed in the file]:_files" \
"--suppress-xml=[Suppress warnings listed in a xml file]:_files" \
"--suppressions-list=[Suppress warnings listed in the file]:file:_files" \
"--suppress-xml=[Suppress warnings listed in a xml file]:file:_files" \
"--template=[Format the error messages]" \
"--template-location=[Format the error message location]" \
"*-U[Undefine preprocessor symbol]:symbol" \

View File

@ -55,12 +55,12 @@ _dad() {
"-u[Set aria2c username]:username:->val" \
"-p[Set aria2c password]:password:->val" \
'1:cmd:->cmds' \
'*: : :->args'
'*: :->args'
case "$state" in
(cmds)
_describe -t commands 'commands' commands
;;
(cmds)
_describe -t commands 'commands' commands
;;
esac
}

View File

@ -170,7 +170,7 @@ _dart() {
'--disable-service-auth-codes[Disables the requirement for an authentication code]' \
'--enable-service-port-fallback[Use 0 if binding port is failed]' \
'--root-certs-file=[The path to a file containing the trusted root certificates]:file:_files' \
'--root-certs-cache=[The path to a cache directory containing the trusted root certificates]:_files -/' \
'--root-certs-cache=[The path to a cache directory containing the trusted root certificates]:file:_files -/' \
'--trace-loading[Enable tracing of library and script loading]' \
'--packages=[The path to the package resolution configuration file]:file:_files'\
'--write-service-info=[Outputs information necessary to connect to the VM service]:service_info:_files' \
@ -334,7 +334,7 @@ _dart_pub() {
'(-v --verbose)'{-v,--verbose}'[Print detailed logging]' \
'(--color --no-color)--color[Use colors in terminal output]' \
'(--color --no-color)--no-color[Do not use colors in terminal output]' \
'(-C --directory)'{-d,--directory=}'[Run the subcommand in the directory]:dir:_files -/'\
'(-C --directory)'{-C,--directory=}'[Run the subcommand in the directory]:dir:_files -/'\
'1: :_dart_pub_subcommands' \
'*:: :->arg' \
&& ret=0

View File

@ -16,7 +16,7 @@
_arguments \
'(-b --background)'{-b,--background}'[Background immediately]' \
'(-c --script)'{-c,--script}'[Use this script instead of the default]: :_files' \
'(-D --duid)'{-d,--duid}'[Use a DHCP Unique Identifier]:id' \
'(-D --duid)'{-D,--duid}'[Use a DHCP Unique Identifier]:id' \
'(-d --debug)'{-d,--debug}'[Echo debug messages to the stderr and syslog]' \
'(-E --lastlease)'{-E,--lastlease}'[If dhcpcd cannot obtain a lease, then try to use the last lease acquired for the interface]' \
'--lastleaseextend[Same as the -E/--lastlease, but the lease will be retained even if it expires]' \

View File

@ -38,7 +38,7 @@
_arguments \
'(- *)'{-h,--help}'[display help message and exit]' \
'--date=[data for calculating the version]:date' \
'--date=[date for calculating the version]:date' \
'(-a --all)'{-a,--all}'[list all known versions]' \
'(-y --days)'{-y,--days=}'[display number of days until specified version reaches the specified milestone]:milestone:(created release eol eol-server)' \
'(-d --devel)'{-d,--devel}'[latest development version]' \

View File

@ -19,16 +19,15 @@ _ecdsautil_args() {
_arguments '1:somefile:_files'
;;
(verify)
_arguments '-s[signature]:secret:_files' '-p[publickey]:pubkey:_files'
'-n[signaturecount]:signaturecount:""' ':file:_files'
_arguments \
'-s[signature]:secret:_files' '-p[publickey]:pubkey:_files' \
'-n[signaturecount]:signaturecount:""' ':file:_files'
;;
esac
}
_ecdsautil() {
local -a commands
commands=(
local -a commands=(
"help:Show help"
"generate-key:generate a new secret on stdout"
"show-key:output public key of secret read from stdin"
@ -38,16 +37,24 @@ _ecdsautil() {
_arguments -C \
'1:cmd:->cmds' \
'*:: :->args' \
'*:: :->args'
case "$state" in
(cmds)
_describe -t commands 'commands' commands
;;
(*)
_ecdsautil_args
;;
_ecdsautil_args
;;
esac
}
_ecdsautil "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -72,7 +72,7 @@ case $service in
\*{-l,--load}'[load Emacs Lisp FILE using the load function]: :_files' \
'(-bg --background-color)'{-bg,--background-color}'[window background color]:color' \
'(-D --basic-display)'{-D,--basic-display}'[disable many display features]' \
'(-bg --border-color)'{-bg,--border-color}'[main border color]:color' \
'(-bd --border-color)'{-bd,--border-color}'[main border color]:color' \
'(-bw --border-width)'{-bw,--border-width}'[width of main border]' \
'--color=-[override color mode for character terminals]:: :(auto never always ansi8)' \
'(-cr --cursor-color)'{-cr,--cursor-color}'[color of the Emacs cursor indicating point]:color' \
@ -89,12 +89,12 @@ case $service in
'(-lsp --line-spacing)'{-lsp,--line-spacing}'[additional space to put between lines]' \
'(-ms --mouse-color)'{-ms,--mouse-color}'[mouse cursor color in Emacs window]:color' \
'(-T --name --title)'{-T,--name,--title}'[title for initial Emacs frame]:title' \
'(-nbc,--no-blinking-cursor)'{-nbc,--no-blinking-cursor}'[disable blinking cursor]' \
'(-nbc --no-blinking-cursor)'{-nbc,--no-blinking-cursor}'[disable blinking cursor]' \
'(-r -rv --reverse-video)'{-r,-rv,--reverse-video}'[switch foreground and background]' \
'(-vb --vertical-scroll-bars)'{-vb,--vertical-scroll-bars}'[enable vertical scroll bars]' \
'--xrm[set additional X resources]:resource' \
'--parent-id[set parent window]:xid' \
'(- *)--help{display help and exit}' \
'(- *)--help[display help and exit]' \
'(- *)--version[output version information and exit]' \
'*:: :_files'
;;

View File

@ -35,11 +35,32 @@
#
# ------------------------------------------------------------------------------
_f2bc_jails() {
LANG=C fail2ban-client status 2> /dev/null | sed -n -e 's/.*Jail list:\s\+//' -e 'T' -e 's/,\s\+/\'$'\n/g' -e 'p'
_fail2ban_client() {
integer NORMARG
_arguments -A "-*" -n \
'-c[configuration directory]:dir:_files -/' \
'-s[socket path]:file:_files' \
'-p[pidfile path]:file:_files' \
'--loglevel[logging level]:level:(CRITICAL ERROR WARNING NOTICE INFO DEBUG TRACEDEBUG HEAVYDEBUG)' \
'--logtarget[logging target]:target:(stdout stderr syslog sysout)' \
'--syslogsocket[syslog socket path]:file:_files' \
'-d[dump configuration]' \
'(--dp --dump-pretty)'{--dp,--dump-pretty}'[dump the configuration using more human readable representation]' \
'(-t --test)'{-t,--test}'[test configuration]' \
'-i[interactive mode]' \
'-v[increase verbosity]' \
'-q[decrease verbosity]' \
'-x[force execution of the server (remove socket file)]' \
'-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]' \
'(-V --version)'{-V,--version}'[print the version]' \
'1:fail2ban command:_fail2ban_client_commands' \
'*:fail2ban command argument:_fail2ban_client_command_arguments'
}
_complete_f2bc_cmds() {
_fail2ban_client_commands() {
local cmds=(
'unban:unbans all IP addresses'
'set:set property'
@ -58,14 +79,14 @@ _complete_f2bc_cmds() {
_describe -V "fail2ban commands" cmds
}
_complete_f2bc_cmdargs() {
_fail2ban_client_command_arguments() {
local f2barg="$words[$NORMARG]"
case "$f2barg" in
unban)
(unban)
local jail
if (( $words[(I)(--all)] == 0 )) ; then
for jail in $(_f2bc_jails) ; do
_complete_f2bc_ips $jail
if (( $words[(I)(--all)] == 0 )); then
for jail in $(_fail2ban_client_print_jails); do
_fail2ban_client_jails "$jail"
done
local unban_opts=(--all)
_describe -o "unban options" unban_opts
@ -73,18 +94,18 @@ _complete_f2bc_cmdargs() {
_nothing
fi
;;
(set|get))
if (( $NORMARG + 1 == $CURRENT )) ; then
_complete_f2bc_jails
_complete_f2bc_settings
(set|get)
if (( $NORMARG + 1 == $CURRENT )); then
_fail2ban_client_jails
_fail2ban_client_settings
else
_complete_f2bc_jail${f2barg}
_fail2ban_client_jail_${f2barg}
fi
;;
status)
if (( $NORMARG + 1 == $CURRENT )) ; then
_complete_f2bc_jails
elif (( $NORMARG + 2 == $CURRENT )) ; then
(status)
if (( $NORMARG + 1 == $CURRENT )); then
_fail2ban_client_jails
elif (( $NORMARG + 2 == $CURRENT )); then
_values "flavor" basic cymru
else
_nothing
@ -93,69 +114,40 @@ _complete_f2bc_cmdargs() {
esac
}
_complete_f2bc_jails() {
local jails=($(_f2bc_jails))
_describe -V "jails" jails
}
_complete_f2bc_ips() {
local ips=("${(@f)$(LANG=C fail2ban-client status $1 2> /dev/null | sed -n -e 's/^.*Banned IP list:\s\+//' -e 'T' -e 's/\s\+/\'$'\n/g' -e 'p')}")
if [[ -n "${ips[@]}" ]] ; then
_describe -t "f2b_jail_$1" -V "banned ips of jail $1" ips
else
_nothing
fi
}
_complete_f2bc_jailset() {
if (( $NORMARG + 2 == $CURRENT )) ; then
_fail2ban_client_jail_set() {
if (( $NORMARG + 2 == $CURRENT )); then
case $words[$NORMARG+1] in
loglevel)
(loglevel)
local loglevel=(CRITICAL ERROR WARNING NOTICE INFO DEBUG TRACEDEBUG HEAVYDEBUG)
_describe -V "loglevel" loglevel ;;
logtarget)
_describe -V "loglevel" loglevel
;;
(logtarget)
local logtarget=(STDOUT STDERR SYSLOG)
_describe -V "logtarget" logtarget
_files ;;
syslogsocket)
_files
;;
(syslogsocket)
local syslogsocket=(auto)
_describe -V "logtarget" syslogsocket
_files ;;
dbfile)
_files ;;
dbpurgeage)
_message "sets the max age in <SECONDS> that history of bans will be kept" ;;
*)
# jail
local jailsettings=(
unbanip
banip
action
addaction
addfailregex
addignoreip
addignoreregex
addjournalmatch
addlogpath
bantime
datepattern
delaction
delfailregex
delignoreip
delignorerexgex
deljournalmatch
dellogpath
findtime
idle
ignorecache
ignorecommand
ignoreself
logencoding
maxlines
maxretry
usedns
)
_describe -t "f2b_jail_setting" -V "jail setting" jailsettings ;;
_files
;;
(dbfile)
_files
;;
(dbpurgeage)
_message "sets the max age in <SECONDS> that history of bans will be kept"
;;
(*)
local jailsettings=(
unbanip banip action addaction addfailregex addignoreip
addignoreregex addjournalmatch addlogpath bantime
datepattern delaction delfailregex delignoreip
delignorerexgex deljournalmatch dellogpath findtime idle
ignorecache ignorecommand ignoreself logencoding maxlines
maxretry usedns
)
_describe -t "f2b_jail_setting" -V "jail setting" jailsettings
;;
esac
else
local jail="$words[$NORMARG+1]"
@ -163,11 +155,14 @@ _complete_f2bc_jailset() {
if (( $NORMARG + 3 == $CURRENT )) ; then
case $words[$NORMARG+2] in
unbanip)
_complete_f2bc_ips "$jail" ;;
_fail2ban_client_ips "$jail"
;;
delfailregex)
_complete_f2bc_regex fail "$jail" ;;
_fail2ban_client_regexs fail "$jail"
;;
delignorerexgex)
_complete_f2bc_regex ignore "$jail" ;;
_fail2ban_client_regexs ignore "$jail"
;;
dellogpath)
local filelist=("${(@f)$(LANG=C fail2ban-client status $jail 2> /dev/null | sed -n -e 's/^.*File list:\s\+//' -e 'T' -e 's/\s\+/\'$'\n/g' -e 'p')}")
@ -175,45 +170,56 @@ _complete_f2bc_jailset() {
_describe -t "f2b_filelist" -V "filelist of jail $1" filelist
else
_nothing
fi ;;
fi
;;
idle)
_values 'fail2ban idle' on off ;;
_values 'fail2ban idle' on off
;;
ignoreself)
_values 'fail2ban ignoreself' true false ;;
_values 'fail2ban ignoreself' true false
;;
delignoreip)
local ignoreips=("${(@f)$(fail2ban-client get "$jail" ignoreip 2> /dev/null | sed -e 's/^[|`]-\s\+//p')}")
if [[ -n "${ignoreips[@]}" ]] ; then
_describe -t "f2b_ignoreip" -V "fail2ban ignored ips" ignoreips
else
_nothing
fi ;;
delaction|action)
_complete_f2bc_action "$jail" ;;
addlogpath)
_files ;;
*)
_message "No completion for ${words[NORMARG+2]}" ;;
esac
elif (( $NORMARG + 4 == $CURRENT )) ; then
case $words[$NORMARG+2] in
action)
_complete_f2bc_actionproperties "$jail" $words[$NORMARG+3] ;;
addaction)
_files ;;
*)
_nothing ;;
esac
else
fi
;;
delaction|action)
_fail2ban_client_actions "$jail"
;;
addlogpath)
_files
;;
*)
_message "No completion for ${words[NORMARG+2]}"
;;
esac
elif (( $NORMARG + 4 == $CURRENT )) ; then
case $words[$NORMARG+2] in
action)
_fail2ban_client_actionproperties "$jail" $words[$NORMARG+3]
;;
addaction)
_files
;;
*)
_nothing
;;
esac
else
_nothing
fi
fi
}
_complete_f2bc_jailget() {
_fail2ban_client_jail_get() {
if (( $NORMARG + 2 == $CURRENT )) ; then
case $words[$NORMARG+1] in
(loglevel|logtarget|syslogsocket|dbfile|dbpurgeage))
_nothing ;;
(loglevel|logtarget|syslogsocket|dbfile|dbpurgeage)
_nothing
;;
*)
# jail
local jailprops=(
@ -236,24 +242,29 @@ _complete_f2bc_jailget() {
actionproperties
actionmethods
)
_describe -t "f2b_jail_props" -V "jail properties" jailprops ;;
_describe -t "f2b_jail_props" -V "jail properties" jailprops
;;
esac
else
local jail="$words[$NORMARG+1]"
if (( $NORMARG + 3 == $CURRENT )) ; then
if (( $NORMARG + 3 == $CURRENT )); then
case $words[$NORMARG+2] in
(action|actionproperties|actionmethods))
_complete_f2bc_action "$jail" ;;
(action|actionproperties|actionmethods)
_fail2ban_client_actions "$jail"
;;
*)
_nothing ;;
_nothing
;;
esac
elif (( $NORMARG + 4 == $CURRENT )) ; then
elif (( $NORMARG + 4 == $CURRENT )); then
case $words[$NORMARG+2] in
(action|actionproperties|actionmethods))
_complete_f2bc_actionproperties "$jail" $words[$NORMARG+3] ;;
(action|actionproperties|actionmethods)
_fail2ban_client_actionproperties "$jail" $words[$NORMARG+3]
;;
*)
_nothing ;;
_nothing
;;
esac
else
_nothing
@ -261,7 +272,21 @@ _complete_f2bc_jailget() {
fi
}
_complete_f2bc_action() {
_fail2ban_client_settings() {
local setargs=(loglevel logtarget syslogsocket dbfile dbpurgeage)
_describe -t "f2b_settings" -V "fail2ban-client settings" setargs
}
_fail2ban_client_regexs() {
local regex=("${(@f)$(fail2ban-client get $2 ${1}regex 2> /dev/null | sed -n -e 's/[|`]- \[\([0-9]\+\)\]:\s\+/\1:/p')}")
if [[ -n "${regex[@]}" ]] ; then
_describe -t "f2b_regex" -V "jail $2 ${1}regex" regex
else
_nothing
fi
}
_fail2ban_client_actions() {
local jailactions=("${(@f)$(fail2ban-client get $1 actions 2>/dev/null | sed -e '1d' -e 's/,\s\+/\'$'\n/g')}")
if [[ -n "${jailactions[@]}" ]] ; then
@ -271,8 +296,22 @@ _complete_f2bc_action() {
fi
}
_complete_f2bc_actionproperties() {
local default_actionproperties=(
_fail2ban_client_jails() {
local jails=($(_fail2ban_client_print_jails))
_describe -V "jails" jails
}
_fail2ban_client_ips() {
local ips=("${(@f)$(LANG=C fail2ban-client status $1 2> /dev/null | sed -n -e 's/^.*Banned IP list:\s\+//' -e 'T' -e 's/\s\+/\'$'\n/g' -e 'p')}")
if [[ -n "${ips[@]}" ]]; then
_describe -t "f2b_jail_$1" -V "banned ips of jail $1" ips
else
_nothing
fi
}
_fail2ban_client_actionproperties() {
local default_actionproperties=(
actionstart
actionstop
actioncheck
@ -292,43 +331,11 @@ _complete_f2bc_actionproperties() {
fi
}
_complete_f2bc_regex() {
local regex=("${(@f)$(fail2ban-client get $2 ${1}regex 2> /dev/null | sed -n -e 's/[|`]- \[\([0-9]\+\)\]:\s\+/\1:/p')}")
if [[ -n "${regex[@]}" ]] ; then
_describe -t "f2b_regex" -V "jail $2 ${1}regex" regex
else
_nothing
fi
_fail2ban_client_print_jails() {
LANG=C fail2ban-client status 2> /dev/null | sed -n -e 's/.*Jail list:\s\+//' -e 'T' -e 's/,\s\+/\'$'\n/g' -e 'p'
}
_complete_f2bc_settings() {
local setargs=(loglevel logtarget syslogsocket dbfile dbpurgeage)
_describe -t "f2b_settings" -V "fail2ban-client settings" setargs
}
integer NORMARG
_arguments -A "-*" -n \
'-c[configuration directory]:_files -/' \
'-s[socket path]:_files' \
'-p[pidfile path]:_files' \
'--loglevel[logging level]:(CRITICAL ERROR WARNING, NOTICE INFO, DEBUG, TRACEDEBUG HEAVYDEBUG)' \
'--logtarget[logging target]:(stdout stderr syslog sysout)' \
'--syslogsocket:_files' \
'-d[dump configuration]' \
'(--dp --dump-pretty)'{--dp,--dump-pretty}'[dump the configuration using more human readable representation]' \
'(-t --test)'{-t,--test}'[test configuration]' \
'-i[interactive mode]' \
'-v[increase verbosity]' \
'-q[decrease verbosity]' \
'-x[force execution of the server (remove socket file)]' \
'-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]' \
'(-V --version)'{-V,--version}'[print the version]' \
'1:fail2ban command:_complete_f2bc_cmds' \
'*:fail2ban command argument:_complete_f2bc_cmdargs'
_fail2ban_client "$@"
# Local Variables:
# mode: Shell-Script

View File

@ -25,12 +25,12 @@ _arguments -A "-*" -n \
'(-c --config)'{-c,--config=}'[set alternate config directory]:directory:_files -/' \
'(-d --datepattern)'{-d,--datepattern=}'[set custom pattern used to match date/times]:DATEPATTERN' \
'(--timezone= --TZ=)'{--timezone=,--TZ=}'[set time-zone used by convert time format]:TIMEZONE' \
'(-e --encoding=)'{-e,--encoding=}'[use different encoding from system locale]:ENCODING' \
'(-e --encoding)'{-e,--encoding=}'[use different encoding from system locale]:ENCODING' \
'(-r --raw)'{-r,--raw}'[raw hosts,don''t resolve dns]' \
'--usedns=[DNS specified replacement of tags <HOST> in regexp]::((yes\:matches all form of hosts no\:IP addresses only))' \
'(-L --maxlines=)'{-L,--maxlines}'[maxlines for multi-line regex]:MAXLINES' \
'(-L --maxlines)'{-L,--maxlines}'[maxlines for multi-line regex]:MAXLINES' \
'(-m --journalmatch=)'{-m,--journalmatch=}'[journalctl style matches overriding filter file; "systemd-journal" only]:JOURNALMATCH' \
'(-l --log-level=)'{-l,--log-level}'[log level for the Fail2Ban logger to use]:LOG_LEVEL' \
'(-l --log-level)'{-l,--log-level}'[log level for the Fail2Ban logger to use]:LOG_LEVEL' \
'-V[get version in machine-readable short format]' \
'--verbosity=[set numerical level of verbosity]:(0 1 2 3 4)' \
'(--verbose-date --VD)'{--verbose-date,--VD}'[verbose date patterns/regex in output]' \

View File

@ -46,7 +46,7 @@ _arguments \
'(-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)'{-p,--posix}'[Enable POSIX operation 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]' \

View File

@ -21,35 +21,35 @@ _fwupdmgr() {
_arguments -C \
'(- : *)'{-h,--help}'[display help information]' \
'(- : *)'{-v,--version}'[display version information]' \
{-v,--verbose}'[show extra debugging information]' \
--offline'[schedule installation for next reboot when possible]' \
--allow-reinstall'[allow re-installing existing firmware versions]' \
--allow-older'[allow downgrading firmware versions]' \
--allow-branch-switch'[allow switching firmware branch]' \
--force'[override warnings and force the action]' \
'(-y, --assume-yes)'{-y,--assume-yes}'[answer yes to all questions]' \
--sign'[sign the uploaded data with the client certificate]' \
--no-unreported-check'[do not check for unreported history]' \
--no-metadata-check'[do not check for old metadata]' \
--no-reboot-check'[do not check for reboot after update]' \
--no-safety-check'[do not perform device safety checks]' \
--no-device-prompt'[do not prompt for devices]' \
--no-history'[do not write to the history database]' \
--show-all'[show all results]' \
--disable-ssl-strict'[ignore SSL strict checks when downloading files]' \
--ipfs'[only use IPFS when downloading files]' \
--filter'[filter with a set of device flags using a ~ prefix to exclude]:filter' \
--json'[output in JSON format]' \
--no-authenticate'[do not prompt for authentication]' \
'(- : *)--version[display version information]' \
'(-v --verbose)'{-v,--verbose}'[show extra debugging information]' \
'--offline[schedule installation for next reboot when possible]' \
'--allow-reinstall[allow re-installing existing firmware versions]' \
'--allow-older[allow downgrading firmware versions]' \
'--allow-branch-switch[allow switching firmware branch]' \
'--force[override warnings and force the action]' \
'(-y --assume-yes)'{-y,--assume-yes}'[answer yes to all questions]' \
'--sign[sign the uploaded data with the client certificate]' \
'--no-unreported-check[do not check for unreported history]' \
'--no-metadata-check[do not check for old metadata]' \
'--no-reboot-check[do not check for reboot after update]' \
'--no-safety-check[do not perform device safety checks]' \
'--no-device-prompt[do not prompt for devices]' \
'--no-history[do not write to the history database]' \
'--show-all[show all results]' \
'--disable-ssl-strict[ignore SSL strict checks when downloading files]' \
'--ipfs[only use IPFS when downloading files]' \
'--filter[filter with a set of device flags using a ~ prefix to exclude]:filter' \
'--json[output in JSON format]' \
'--no-authenticate[do not prompt for authentication]' \
'(-): :->command' \
'(-)*:: :->arguments' \
&& ret=0
&& ret=0
case $state in
(command)
_fwupdmgr_commands
;;
;;
(arguments)
case $words[1] in
(activate|downgrade|emulation-tag|emulation-untag|get-releases|get-updates|reinstall|update|verify|verify-update)
@ -86,7 +86,7 @@ _fwupdmgr() {
;;
(refresh)
_arguments \
'1:file or remote ID:_alternative _files _fwupdmgr_remote_ids' \
'1:file or remote ID:_alternative "file\:file\:_files" "remotes\:remote ID\:_fwupdmgr_remote_ids"' \
&& ret=0
;;
(switch-branch)

View File

@ -38,7 +38,7 @@ local curcontext="$curcontext" state line cmds ret=1
_arguments -C \
'(- 1 *)'{-v,--version}'[display version information]' \
'(-h|--help)'{-h,--help}'[show help information]' \
'(-h --help)'{-h,--help}'[show help information]' \
'1: :->cmds' \
'*: :->args' && ret=0
@ -67,3 +67,10 @@ esac
return ret
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -48,7 +48,7 @@ _gio() {
_arguments -C \
'(- : *)'{-h,--help}'[show help information]' \
'(- : *)'--version'[display version information]' \
'(- : *)--version[display version information]' \
'1:command:->command' \
'*::arg:->args' \
&& ret=0

View File

@ -48,14 +48,14 @@ _arguments -C \
'(-f --filename)'{-f,--filename}'[Sets the filename and syntax type.]:NAME' \
'(-t --type)'{-t,--type}'[Sets the file extension and syntax type.]:EXT' \
'(-p --private --no-private)'{-p,--private}'[Makes your gist private.]' \
'(--no-private -p --private)'--no-private'[Makes your gist no private.]' \
'(--no-private -p --private)--no-private[Makes your gist no private.]' \
'(-d --description)'{-d,--description}'[Adds a description to your gist.]:DESCRIPTION' \
'(-s --shorten)'{-s,--shorten}'[Shorten the gist URL using git.io.]' \
'(-u --update)'{-u,--update}'[Update an existing gist.]:URL ID:user_gists' \
'(-c --copy)'{-c,--copy}'[Copy the resulting URL to the clipboard]' \
'(-e --embed)'{-e,--embed}'[Copy the embed code for the gist to the clipboard]' \
'(-o --open --no-open)'{-o,--open}'[Open the resulting URL in a browser]' \
'(--no-open -o --open)'--no-open'[No open the resulting URL in a browser]' \
'(--no-open -o --open)--no-open[No open the resulting URL in a browser]' \
'(-P --paste)'{-P,--paste}'[Paste from the clipboard to gist]' \
'(-R --raw)'{-R,--raw}'[Display raw URL of the new gist]' \
'(-l --list)'{-l,--list}'[List all gists for user ]::user' \

View File

@ -53,7 +53,7 @@ _glances() {
'--disable-webui[disable the Web Interface]' \
'(--light --enable-light)'{--light,--enable-light}'[light mode for Curses UI]' \
'(-0 --disable-irix)'{-0,--disable-irix}"[task's cpu usage will be divided by the total number of CPUs]" \
'(-1 --percpu)'{-1,--percpu}'[start Clances in per CPU mode]' \
'(-1 --percpu)'{-1,--percpu}'[start Glances in per CPU mode]' \
'(-2 --disable-left-sidebar)'{-2,--disable-left-sidebar}'[disable network, disk I/O, FS and sensors modules]' \
'(-3 --disable-quicklook)'{-3,--disable-quicklook}'[disable quick look module]' \
'(-4 --full-quicklook)'{-4,--full-quicklook}'[disable all but quick look and load]' \
@ -92,7 +92,7 @@ _glances() {
'(-t --time)'{-t,--time}'[set minimum refresh rate in seconds(default: 2 sec)]:seconds' \
'(-w --webserver)'{-w,--webserver}'[run Glances in web server mode]' \
'--cached-time[set the server cache time(default: 1 sec)]:seconds' \
'--stop-after[stop Glances after n fresh]:' \
'--stop-after[stop Glances after n fresh]:times' \
'--open-web-browser[try to open the Web UI in the default browser]' \
'(-q --quiet)'{-q,--quiet}'[do not display the curses interface]' \
'(-f --process-filter)'{-f,--process-filter}'[set the process filter pattern]:regexp' \

View File

@ -46,9 +46,9 @@ _gtk-launch() {
_arguments -S -A "-*" \
'(- *)'{-h,--help}'[Show help options]' \
'(- *)'{-v,--version}'[Show program version]' \
'(- *)'--help-all'[Show all help options]' \
'(- *)'--help-gtk'[Show GTK+ Options]' \
'(- *)'--display='[X display to use]:display:_x_display' \
'(- *)--help-all[Show all help options]' \
'(- *)--help-gtk[Show GTK+ Options]' \
'(- *)--display=[X display to use]:display:_x_display' \
'--class=[Program class as used by the window manager]:class' \
'--name=[Program name as used by the window manager]:name' \
'--gtk-module=[Load additional GTK+ modules]:module' \

View File

@ -1,53 +0,0 @@
#compdef homestead
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - https://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for homestead (http://laravel.com/docs/homestead).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * loranger (https://github.com/loranger)
#
# ------------------------------------------------------------------------------
_homestead_get_command_list () {
homestead --no-ansi | sed "1,/Available commands/d" | awk '/ [a-z]+/ { print $1 }'
}
_homestead () {
if [ -f homestead ]; then
compadd `_homestead_get_command_list`
fi
}
compdef _homestead php homestead
compdef _homestead homestead

View File

@ -78,7 +78,7 @@ _inxi() {
"--indent=[Change default wide mode primary indentation width]:integer:(11 12 13 14 15 16 17 18 19 20)" \
"--indents=[Change wrapped mode primary indentation width]:integer:(0 1 2 3 4 5 6 7 8 9 10)" \
"--limit[Limit max IP addresses for -i]:limit (-1 removes the limit): " \
'(--max-wrap --wrap-max)'{--max-wrap,--warp-max}='[Set maximum width where inxi autowraps line starters]' \
'(--max-wrap --wrap-max)'{--max-wrap,--wrap-max}='[Set maximum width where inxi autowraps line starters]:width' \
"--output[Change data output type]:type:(json screen xml)" \
"--output-file[Path to output file]:output file:->output_file" \
"--partition-sort[Change default sort order of partition output]:order:_inxi_partition_sort" \

View File

@ -36,7 +36,7 @@
# ------------------------------------------------------------------------------
_arguments -s \
'(-a --all)'{-a,--all}'-[Remove all resources]:resource:(shm msg sem)' \
'(-a --all)'{-a,--all}'[Remove all resources]:resource:(shm msg sem)' \
'(-M --shmem-key)'{-M,--shmem-key}'[Remove the shared memory segment created with shemkey]:shmkey' \
'(-m --shmem-id)'{-m,--shmem-id}'[Remove the shared memory segment identified by shmid]:shmid' \
'(-Q --queue-key)'{-Q,--queue-key}'[Remove the message queue created with msgkey]:msgkey' \

View File

@ -23,7 +23,6 @@ _arguments \
{-j,--jmeterlogfile}'[the jmeter log file]: :_files -g "*.log"' \
{-l,--logfile}'[the file to log samples to]: :_files -g "*.jtl"' \
{-i,--jmeterlogconf}'[jmeter logging configuration file]: :_files -g "*.xml"' \
{-j,--jmeterlogfile}'[jmeter run file]: :_files -g "*.log"' \
{-n,--nongui}'[run JMeter in nongui mode]' \
{-s,--server}'[run the JMeter server]' \
{-H,--proxyHost}'[set a proxy server for JMeter to use]: :_hosts' \

View File

@ -58,7 +58,7 @@ _kak() {
'-i[backup the files on which a filter is applied using the given suffix]:suffix' \
'-q[in filter mode, do not print any errors]' \
'-ui[set the type of user interface to use (terminal, dummy, or json)]:ui_type:(terminal dummy json)' \
'-l[list existing sessions]:session_id:_kak_sessions' \
'-l[list existing sessions]' \
'-clear[clear dead sessions]' \
'-debug[initial debug option value]:arg' \
'(- *)-version[display Kakoune version and quit]' \

View File

@ -40,7 +40,7 @@ _l3build() {
'(-c --config)'\*{-c,--config}'[Set the config(s) used for running tests]:lua_file:_files -g "*.(lua|tlg)"' \
'(-d --date)'{-d,--date}'[Set the date to insert into sources]:date' \
'--debug[Run target in debug mode]' \
'--dev[Use the development LaTex format]' \
'--dev[Use the development LaTeX format]' \
'--dirty[Skip cleaning up the test area]' \
'--dry-run[Dry run for install or upload]' \
'--email[Email address of CTAN uploader]:email' \

View File

@ -211,7 +211,6 @@ _language_codes_iso_639_1() {
'uz:Uzbek'
've:Venda'
'vi:Vietnamese'
'vietnamien'
'vo:Volapük'
'cy:Welsh'
'wa:Walloon'

View File

@ -41,10 +41,10 @@ local context state line
local curcontext="$curcontext"
_arguments -s -C \
'(-1,--onestopbit)'{-1,--onestopbit}'[Set the number of stop bits of the serial line to one]' \
'(-2,--twostopbits)'{-2,--twostopbits}'[Set the number of stop bits of the serial line to two]' \
'(-7,--sevenbits)'{-7,--sevenbits}'[Set the character size of the srial line to 7 bits]' \
'(-8,--eightbits)'{-8,--eightbits}'[Set the character size of the srial line to 8 bits]' \
'(-1 --onestopbit)'{-1,--onestopbit}'[Set the number of stop bits of the serial line to one]' \
'(-2 --twostopbits)'{-2,--twostopbits}'[Set the number of stop bits of the serial line to two]' \
'(-7 --sevenbits)'{-7,--sevenbits}'[Set the character size of the serial line to 7 bits]' \
'(-8 --eightbits)'{-8,--eightbits}'[Set the character size of the serial line to 8 bits]' \
'(-d --debug)'{-d,--debug}'[Enable debugging output]' \
'(-e --evenparity)'{-e,--evenparity}'[Set the parity of the serial line to even]' \
'(-i --iflag)'{-i,--iflag}'[Set the specified bits in the c_iflag word of the serial line]:value' \
@ -55,6 +55,7 @@ _arguments -s -C \
'(-p --pause)'{-p,--pause}'[Sleep for given seconds before the invocation of ldattach]:value' \
'(- *)'{-h,--help}'[Display help text and exit]'\
'(- *)'{-V,--version}'[Print version and exit]' \
'1:line discipline' \
'2::device:->device'
# Complete device argument

View File

@ -95,7 +95,7 @@ _arguments \
'(- *)'{-V,--version}'[display version]' \
'(-m --shmems)'{-m,--shmems}'[shared memory segments]' \
'(-M --posix-shmems)'{-M,--posix-shmems}'[POSIX shared memory segments]' \
'(-q --queues)'{-q,--queues}'[POSIX shared memory segments]' \
'(-q --queues)'{-q,--queues}'[message queues]' \
'(-Q --posix-mqueues)'{-Q,--posix-mqueues}'[POSIX message queues]' \
'(-s --semaphores)'{-s,--semaphores}'[semaphores]' \
'(-S --posix-semaphores)'{-S,--posix-semaphores}'[POSIX semaphores]' \
@ -111,7 +111,7 @@ _arguments \
'(-n --newline)'{-n,--newline}'[display each piece of information on a new line]' \
'(-l --list)'{-l,--list}'[force list output format]' \
'(-o --output)'{-o,--output=-}'[define the columns to output]:columns:_lsipc_output_columns' \
'(-P --numeric-perms)'{-p,--numeric-perms}'[print numeric permissions]' \
'(-P --numeric-perms)'{-P,--numeric-perms}'[print numeric permissions]' \
'(-r --raw)'{-r,--raw}'[display in raw mode]' \
'(-t --time)'{-t,--time}'[show attach, detach and change times]' \
'(-y --shell)'{-y,--shell}'[use column names to be usable as shell variables]'

View File

@ -35,8 +35,7 @@
setopt localoptions warncreateglobal typesetsilent
local -a opts
opts=(
local -a opts=(
{-h,--help}'[show help on options]'
--help-all'[show help on all options]'
--help-terminal'[terminal options help]'
@ -47,7 +46,6 @@ opts=(
{-C,--colors=}'[specifies a color configuration]:arg:'
--configure-options'[print configure options]'
{-d,--nomouse}'[disable mouse support in text version]'
{-d,--debuglevel=}'[save the debug level for SMB VFS]:debug level:(0 1 2 3 4 5 6 7 8 9 10)'
{-e,--edit=}'[edit files]:file:_files'
{-f,--datadir}'[print data directory]'
{-F,--datadir-info}'[print extended info about used data directories]'

View File

@ -23,7 +23,7 @@ _arguments \
'(-F --fullwidth)'{-F,--fullwidth}'[use two columns per character]' \
'(-f --fps)'{-f+,--fps=}'[set a frame rate target]: :_numbers -d 60' \
'(-G --glitchpct)'{-G+,--glitchpct=}'[set the percentage of characters onscreen that glitch]: :_numbers -f -d 10.0' \
'(-g --glitchms)'{-g+,--glitchms=}'[control how often the characters on screen glitch]:N [300,400]]' \
'(-g --glitchms)'{-g+,--glitchms=}'[control how often the characters on screen glitch]:N [300,400]' \
'(-h --help)'{-h,--help}'[shows the help message]' \
'(-l --lingerms)'{-l+,--lingerms=}'[control how long characters stay onscreen after they finish scrolling]:N [1,3000]' \
'(-M --shadingmode)'{-M+,--shadingmode=}'[control how neo assigns color values to characters on the screen]:choice [1]:((0\:random\ \(default\) 1\:gradient))' \

View File

@ -234,7 +234,7 @@ while true;do
#TODO
# _nft_rule $cmd_fam $cmd_tab $cmd_chain\
# && return 0;
descriptors=":expression: "
descriptors=(":expression: ")
nextstate="start"
;;
(list-set | list-map | delete-map | list-chain | list-flowtable | delete-flowtable | list-ct\\ helper | list-counter | list-quota | list-meter)
@ -454,7 +454,6 @@ _nft_table_handle(){
#$1:protocol family
local tables=( ${(f)"$(_call_program -p tables nft -a list ruleset 2>/dev/null \
| grep '^table '"$1" | sed 's/table // ;s/{ # handle // ;s/\(\S*\) \(\S*\) \(\S*\)/\3:\2(type \1)/' )"} )
echo $1 > /tmp/znfttab
_describe -t tables "table handle" tables
}
@ -502,3 +501,11 @@ _nft_rule_handle(){
#currently, only the `nft` command is covered by this script.
_nft "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -79,7 +79,7 @@ _node() {
'--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-fs-read=[allow permissions to read the filesystem]: :_files' \
'--allow-fs-write=[allow permissions to write in 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]' \
'--allow-net[allow use of network when any permissions are set]' \
'--allow-wasi[allow wasi when any permissions are set]' \
@ -131,7 +131,7 @@ _node() {
'--frozen-intrinsics[experimental frozen intrinsics support]' \
'--heap-prof[Start the V8 heap profiler on start up]' \
'--heap-prof-dir=[Directory where the V8 profiles generated by --heap-prof]: :_files -/' \
'--heap-prof-interval=[sampling interval in bytes for the V8 heap profile]: :number' \
'--heap-prof-interval=[sampling interval in bytes for the V8 heap profile]:number' \
'--heap-prof-name=[file name of the V8 heap profile generated]: :_files' \
'--heapsnapshot-near-heap-limit=[Generate heapsnapshots whenever V8 is approaching the heap limit]:limit' \
'--heapsnapshot-signal=[Generate heap snapshot on specified signal]:signals:_signals -s' \
@ -148,7 +148,7 @@ _node() {
'--interpreted-frames-native-stack[help system profilers to translate JavaScript interpreted frames]' \
'--jitless[Disable runtime allocation of executable memory]' \
'--localstorage-file=[file used to persist localStorage data]:file:_files' \
'--max-http-header-size=[set the maximum size of HTTP headers]: :number' \
'--max-http-header-size=[set the maximum size of HTTP headers]:number' \
"--max-old-space-size-percentage=[set V8's max old space size as a percentage of available memory]:memory" \
'--network-family-autoselection-attempt-timeout=[sets the default value for the network family autoselection attempt timeout]:timeout' \
'--no-addons[disable loading native addons]' \
@ -192,7 +192,7 @@ _node() {
'(--require-module --no-require-module --no-experimental-require-module)--require-module[support for loading a synchronous ES module graph in require()]' \
'*'{-r,--require}'[module to preload (option can be repeated)]: :_node_files' \
'--run=[run a script specified in package.json]:script:_node_scripts' \
'--secure-heap=[total size of the OpenSSL secure heap]: :number' \
'--secure-heap=[total size of the OpenSSL secure heap]:number' \
'--secure-heap-min=[minimum allocation size from the OpenSSL secure heap]' \
'--snapshot-blob=[path to the snapshot blob that is used to restore the application state]:snapshot:_files' \
'--test[launch test runner on startup]' \

View File

@ -122,7 +122,7 @@ __nvm() {
;;
(deactivate)
_arguments \
'--silent=[Silences stdout/stderr output]' \
'--silent[Silences stdout/stderr output]' \
&& ret=0
;;
(alias)
@ -138,7 +138,7 @@ __nvm() {
;;
(reinstall-package)
_arguments \
'--silent=[Silences stdout/stderr output]' \
'--silent[Silences stdout/stderr output]' \
'1: :__nvm_installed_versions' \
&& ret=0
;;

View File

@ -70,7 +70,7 @@ _openssl() {
'-xcert[extra certificate file]:file:_files'
'-xchain[extra certificate chain file]:file:_files'
'-xchain_build[build the certificate chain for the extra certificates]'
'-xcertform[extra certificate format]:format[DER PEM P12]'
'-xcertform[extra certificate format]:format:(DER PEM P12)'
)
local -a openssl_supported_commands_flags=(
@ -348,55 +348,55 @@ _openssl_subcommands() {
'chacha20:Chacha20 Cipher'
'des:DES Ciper'
'des-cbc:DES CBC Ciper'
'des-cfb:DES CFB Ciper'
'des-ecb:DES ECB Ciper'
'des-ede:DES EDE Ciper'
'des-ede-cbc:DES EDE CBC Ciper'
'des-ede-cfb:DES EDE CFB Ciper'
'des-ede-ofb:DES EDE OFB Ciper'
'des-ofb:DES OFB Ciper'
'des:DES Cipher'
'des-cbc:DES CBC Cipher'
'des-cfb:DES CFB Cipher'
'des-ecb:DES ECB Cipher'
'des-ede:DES EDE Cipher'
'des-ede-cbc:DES EDE CBC Cipher'
'des-ede-cfb:DES EDE CFB Cipher'
'des-ede-ofb:DES EDE OFB Cipher'
'des-ofb:DES OFB Cipher'
'des3:Triple-DES Ciper'
'desx:Triple-DES X Ciper'
'des-ede3:Triple-DES EDE Ciper'
'des-ede3-cbc:Triple-DES EDE CBC Ciper'
'des-ede3-cfb:Triple-DES EDE CFB Ciper'
'des-ede3-ofb:Triple-DES EDE OFB Ciper'
'des3:Triple-DES Cipher'
'desx:Triple-DES X Cipher'
'des-ede3:Triple-DES EDE Cipher'
'des-ede3-cbc:Triple-DES EDE CBC Cipher'
'des-ede3-cfb:Triple-DES EDE CFB Cipher'
'des-ede3-ofb:Triple-DES EDE OFB Cipher'
'idea:IDEA Ciper'
'idea-cbc:IDEA CBC Ciper'
'idea-cfb:IDEA CFB Ciper'
'idea-ecb:IDEA ECB Ciper'
'idea-ofb:IDEA OFB Ciper'
'idea:IDEA Cipher'
'idea-cbc:IDEA CBC Cipher'
'idea-cfb:IDEA CFB Cipher'
'idea-ecb:IDEA ECB Cipher'
'idea-ofb:IDEA OFB Cipher'
'rc2:RC2 Ciper'
'rc2-cbc:RC2 CBC Ciper'
'rc2-cfb:RC2 CFB Ciper'
'rc2-ecb:RC2 ECB Ciper'
'rc2-ofb:RC2 OFB Ciper'
'rc2:RC2 Cipher'
'rc2-cbc:RC2 CBC Cipher'
'rc2-cfb:RC2 CFB Cipher'
'rc2-ecb:RC2 ECB Cipher'
'rc2-ofb:RC2 OFB Cipher'
'rc4:RC4 Ciper'
'rc4:RC4 Cipher'
'rc5:RC5 Ciper'
'rc5-cbc:RC5 CBC Ciper'
'rc5-cfb:RC5 CFB Ciper'
'rc5-ecb:RC5 ECB Ciper'
'rc5-ofb:RC5 OFB Ciper'
'rc5:RC5 Cipher'
'rc5-cbc:RC5 CBC Cipher'
'rc5-cfb:RC5 CFB Cipher'
'rc5-ecb:RC5 ECB Cipher'
'rc5-ofb:RC5 OFB Cipher'
'seed:SEED Ciper'
'seed-cbc:SEED CBC Ciper'
'seed-cfb:SEED CFB Ciper'
'seed-ecb:SEED ECB Ciper'
'seed-ofb:SEED OFB Ciper'
'seed:SEED Cipher'
'seed-cbc:SEED CBC Cipher'
'seed-cfb:SEED CFB Cipher'
'seed-ecb:SEED ECB Cipher'
'seed-ofb:SEED OFB Cipher'
'sm4:SM4 Ciper'
'sm4-cbc:SM4 CBC Ciper'
'sm4-cfb:SM4 CFB Ciper'
'sm4-ctr:SM4 CTR Ciper'
'sm4-ecb:SM4 ECB Ciper'
'sm4-ofb:SM4 OFB Ciper'
'sm4:SM4 Cipher'
'sm4-cbc:SM4 CBC Cipher'
'sm4-cfb:SM4 CFB Cipher'
'sm4-ctr:SM4 CTR Cipher'
'sm4-ecb:SM4 ECB Cipher'
'sm4-ofb:SM4 OFB Cipher'
)
_describe -t commands 'command' commands "$@"
@ -582,7 +582,7 @@ _openssl_cmp() {
'-extracerts[certificates files or URIs to append in extraCerts field]:file_or_uri:_files' \
'-unprotected_errors[send request messages without CMP-level protection]' \
'-certform[file format to use when saving a certificate]:format:(PEM DER)' \
'-crlform[file format to use when saving a CRL]:format(PEM DER)' \
'-crlform[file format to use when saving a CRL]:format:(PEM DER)' \
'-keyform[format of the key input]:format:(PEM DER P12 ENGINE)' \
'-otherpass[pass phrase source for certificate]:source:_openssl_pass_phrase_options' \
$openssl_provider_options[@] \
@ -1029,7 +1029,7 @@ _openssl_fipsinstall() {
'(- *)-help[print help message]' \
'-module[file name of the FIPS module]:file:_files' \
'-out[file name to output configuration data to]:file:_files' \
'-in[input file name to load configuration data from]:_files' \
'-in[input file name to load configuration data from]:file:_files' \
'-verify[verify the input configuration file]' \
'-provider_name[name of the provider inside the configuration file(default: "fips")]:name' \
'-section_name[name of the section inside the configuration file(default: "fips_sect")]:name' \
@ -2012,13 +2012,13 @@ _openssl_smime() {
'-in[input message file]:file:_files' \
'-out[output file name]:file:_files' \
'-inform[input format]:format:(DER PEM SMIME)' \
'-outform[output format]:format(DER PEM SMIME)' \
'-outform[output format]:format:(DER PEM SMIME)' \
'-keyform[key format]:format:(DER PEM P12 ENGINE)' \
'(-stream -indef)'{-stream,-indef}'[enable streaming I/O for encoding operations]' \
'-noindef[disable streaming I/O]' \
'-content[file containing the detached content]:file:_files' \
'-text[add plain text MIME headers to the supplied message]' \
'-md[digest algorithm to use when signing or resigning]:digest:(sha256 sha1 md5' \
'-md[digest algorithm to use when signing or resigning]:digest:(sha256 sha1 md5)' \
$cipher_flags[@] \
'-nointern[use only the certificate in the -certificate]' \
'-noverify[do not verify the signers certificate of a signed message]' \
@ -2069,7 +2069,7 @@ _openssl_speed() {
'(- *)-help[print help message]' \
'-config[configuration file]:file:_files' \
'-elapsed[use wall-clock time instead of CPU user time as divisor]' \
'-evp[use specified cipher or message digest algorithm via the EVP interface]:alg: _alternative "ciphers\:cipher\:_openssl_digests" "digests\:digest\:_openssl_cipher_algorithms"' \
'-evp[use specified cipher or message digest algorithm via the EVP interface]:alg: _alternative "ciphers\:cipher\:_openssl_cipher_algorithms" "digests\:digest\:_openssl_digests"' \
'-multi[run multiple operations in parallel]:number' \
'-async_jobs[enable async mode and start specified number of jobs]:number' \
'-misalign[misalign the buffers by the specified number of bytes]:number' \

View File

@ -49,198 +49,203 @@ local sessions_names=$(openvpn3 sessions-list | grep 'Session name:' | awk '{pri
local configs_names=$(openvpn3 configs-list | awk 'count&&!--count; /\/net\/openvpn\//{count=2}' | awk '{print $1}' | xargs)
local configs_paths=$(openvpn3 configs-list | grep '/net/openvpn/v3/configuration/' | xargs)
_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]" \
{-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]" \
{-G,--grant}"[<UID | username> Grant this user access to this configuration profile]" \
"--public-access[<true|false> Set/unset the public access flag]" \
"--lock-down[<true|false> Set/unset the lock-down flag.Will disable config retrieval for users]: :(true false)" \
"--config-path[OBJ-PATH Alias for --path]: :($configs_paths)" \
_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]" \
{-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]" \
{-G,--grant}"[<UID | username> Grant this user access to this configuration profile]" \
"--public-access[<true|false> Set/unset the public access flag]" \
"--lock-down[<true|false> Set/unset the lock-down flag.Will disable config retrieval for users]: :(true false)" \
"--config-path[OBJ-PATH Alias for --path]: :($configs_paths)"
}
_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]" \
{-c,--config}"[CFG-FILE Configuration file to import]: :_files" \
_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]" \
{-c,--config}"[CFG-FILE Configuration file to import]: :_files"
}
_openvpn3_config-manage(){
_arguments \
{-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]" \
{-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)" \
"--tls-cert-profile[<legacy preferred suiteb> Sets the control channel tls profile]: :(legacy preferred suiteb)" \
"--server-override[<value> Replace the remote, connecting to this server instead the server specified in the configuration]" \
"--proxy-username[<value> HTTP Proxy username to authenticate as]" \
"--proxy-port[<value> HTTP Proxy port to connect on]" \
"--proxy-password[<value> HTTP Proxy password to use for authentication]" \
"--proxy-host[<value> HTTP Proxy to connect via, overrides configuration file http-proxy]" \
"--proxy-auth-cleartext[<true|false> Adds the boolean override proxy-auth-cleartext]: :(true false)" \
"--proto-override[<tcp|udp> Overrides the protocol being used]: :(tcp upd)" \
"--port-override[<value> Replace the remote port, connecting to this port instead of the configuration value]" \
"--persist-tun[<true|false> Adds the boolean override persist-tun]: :(true false)" \
"--ipv6[<yes|no|default> Sets the IPv6 policy of the client]: :(yes no default)" \
"--force-cipher-aes-cbc[<true|false> Adds the boolean override force-cipher-aes-cbc]: :(true false)" \
"--dns-sync-lookup[<true|false> Adds the boolean override dns-sync-lookup]: :(true false)" \
"--dns-setup-disabled[<true|false> Adds the boolean override dns-setup-disabled]: :(true false)" \
"--dns-fallback-google[<true|false> Adds the boolean override dns-fallback-google]: :(true false)" \
"--config-path[CONFIG-PATH Alias for --path]: :($configs_paths)" \
"--auth-fail-retry[<true|false> Adds the boolean override auth-fail-retry]: :(true false)" \
"--allow-compression[<no asym yes> Set compression mode]: :(no asym yes)" \
_openvpn3_config-manage() {
_arguments \
{-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]" \
{-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)" \
"--tls-cert-profile[<legacy preferred suiteb> Sets the control channel tls profile]: :(legacy preferred suiteb)" \
"--server-override[<value> Replace the remote, connecting to this server instead the server specified in the configuration]" \
"--proxy-username[<value> HTTP Proxy username to authenticate as]" \
"--proxy-port[<value> HTTP Proxy port to connect on]" \
"--proxy-password[<value> HTTP Proxy password to use for authentication]" \
"--proxy-host[<value> HTTP Proxy to connect via, overrides configuration file http-proxy]" \
"--proxy-auth-cleartext[<true|false> Adds the boolean override proxy-auth-cleartext]: :(true false)" \
"--proto-override[<tcp|udp> Overrides the protocol being used]: :(tcp udp)" \
"--port-override[<value> Replace the remote port, connecting to this port instead of the configuration value]" \
"--persist-tun[<true|false> Adds the boolean override persist-tun]: :(true false)" \
"--ipv6[<yes|no|default> Sets the IPv6 policy of the client]: :(yes no default)" \
"--force-cipher-aes-cbc[<true|false> Adds the boolean override force-cipher-aes-cbc]: :(true false)" \
"--dns-sync-lookup[<true|false> Adds the boolean override dns-sync-lookup]: :(true false)" \
"--dns-setup-disabled[<true|false> Adds the boolean override dns-setup-disabled]: :(true false)" \
"--dns-fallback-google[<true|false> Adds the boolean override dns-fallback-google]: :(true false)" \
"--config-path[CONFIG-PATH Alias for --path]: :($configs_paths)" \
"--auth-fail-retry[<true|false> Adds the boolean override auth-fail-retry]: :(true false)" \
"--allow-compression[<no asym yes> Set compression mode]: :(no asym yes)" \
}
_openvpn3_config-remove() {
_arguments \
{-o,--path}"[OBJ-PATH Path to the configuration in the configuration manager]: :($configs_paths)" \
{-h,--help}"[This 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)"
}
_openvpn3_config-remove(){
_arguments \
{-o,--path}"[OBJ-PATH Path to the configuration in the configuration manager]: :($configs_paths)" \
{-h,--help}"[This 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)" \
_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]" \
{-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_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]" \
{-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]"
}
_openvpn3_configs-list(){
_arguments \
{-h,--help}"[This help screen]" \
_openvpn3_help() {
_arguments \
{-h,--help}"[This help screen]"
}
_openvpn3_help(){
_arguments \
{-h,--help}"[This help screen]" \
_openvpn3_log() {
_arguments \
{-h,--help}"[This 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)" \
"--log-level[LOG-LEVEL Set the log verbosity level of messages to be shown (default: 4)]" \
"--config-events[Receive log events issued by the configuration manager]"
}
_openvpn3_log(){
_arguments \
{-h,--help}"[This 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)" \
"--log-level[LOG-LEVEL Set the log verbosity level of messages to be shown (default: 4)]" \
"--config-events[Receive log events issued by the configuration manager]" \
_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]" \
{-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)" \
{-G,--grant}"[<UID | username> Grant this user access to this session]" \
"--session-path[SESSION-PATH Alias for --path]: :($sessions_paths)" \
"--public-access[<true|false> Set/unset the public access flag]: :(true false)" \
"--allow-log-access[<true|false> Can users granted access also access the session log?]: :(true false)"
}
_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]" \
{-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)" \
{-G,--grant}"[<UID | username> Grant this user access to this session]" \
"--session-path[SESSION-PATH Alias for --path]: :($sessions_paths)" \
"--public-access[<true|false> Set/unset the public access flag]: :(true false)" \
"--allow-log-access[<true|false> Can users granted access also access the session log?]: :(true false)" \
_openvpn3_session-manage() {
_arguments \
{-o,--path}"[SESSION-PATH Path to the session in the session manager]: :($sessions_paths)" \
{-h,--help}"[This 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]" \
{-I,--interface}"[INTERFACE Alternative to --path, where tun interface name is used instead]: :($sessions_interfaces)" \
{-D,--disconnect}"[Disconnects a VPN session]" \
"--session-path[SESSION-PATH Alias for --path]: :($sessions_paths)" \
"--restart[Disconnect and reconnect a running VPN session]" \
"--cleanup[Clean up stale sessions]"
}
_openvpn3_session-manage(){
_arguments \
{-o,--path}"[SESSION-PATH Path to the session in the session manager]: :($sessions_paths)" \
{-h,--help}"[This 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]" \
{-I,--interface}"[INTERFACE Alternative to --path, where tun interface name is used instead]: :($sessions_interfaces)" \
{-D,--disconnect}"[Disconnects a VPN session]" \
"--session-path[SESSION-PATH Alias for --path]: :($sessions_paths)" \
"--restart[Disconnect and reconnect a running VPN session]" \
"--cleanup[Clean up stale sessions]" \
_openvpn3_session-start() {
_arguments \
{-p,--config-path}"[CONFIG-PATH Configuration path to an already imported configuration]: :($configs_paths)" \
{-h,--help}"[This help screen]" \
{-c,--config}"[CONFIG-FILE Configuration file to start directly]: :_files" \
"--persist-tun[Enforces persistent tun/seamless tunnel (requires --config)]"
}
_openvpn3_session-start(){
_arguments \
{-p,--config-path}"[CONFIG-PATH Configuration path to an already imported configuration]: :($configs_paths)" \
{-h,--help}"[This help screen]" \
{-c,--config}"[CONFIG-FILE Configuration file to start directly]: :_files" \
"--persist-tun[Enforces persistent tun/seamless tunnel (requires --config)]" \
_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]" \
{-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)"
}
_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]" \
{-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)" \
_openvpn3_sessions-list() {
_arguments \
{-h,--help}"[This help screen]"
}
_openvpn3_sessions-list(){
_arguments \
{-h,--help}"[This help screen]" \
_openvpn3_shell-completion() {
_arguments \
{-h,--help}"[This 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]"
}
_openvpn3_shell-completion(){
_arguments \
{-h,--help}"[This 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]"
_openvpn3_version() {
_arguments \
{-h,--help}"[This help screen]"
}
_openvpn3_version(){
_arguments \
{-h,--help}"[This help screen]" \
}
_openvpn3_command() {
local -a openvpn3_cmds=(
"config-acl: Manage access control lists for configurations"
"config-import: Import configuration profiles"
"config-manage: Manage configuration properties"
"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"
"log: Receive log events as they occur"
"session-acl: Manage access control lists for sessions"
"session-manage: Manage VPN sessions"
"session-start: Start a new VPN session"
"session-stats: Show session statistics"
"sessions-list: List available VPN sessions"
"shell-completion: Helper function to provide shell completion data"
"version: Show program version information"
)
_openvpn3_command(){
local -a _openvpn3_cmds
_openvpn3_cmds=(
"config-acl: Manage access control lists for configurations" \
"config-import: Import configuration profiles" \
"config-manage: Manage configuration properties" \
"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" \
"log: Receive log events as they occur" \
"session-acl: Manage access control lists for sessions" \
"session-manage: Manage VPN sessions" \
"session-start: Start a new VPN session" \
"session-stats: Show session statistics" \
"sessions-list: List available VPN sessions" \
"shell-completion: Helper function to provide shell completion data" \
"version: Show program version information" \
)
if ((CURRENT == 1)); then
_describe -t commands 'openvpn3 commands' _openvpn3_cmds
if ((CURRENT == 1)); then
_describe -t commands 'openvpn3 commands' openvpn3_cmds
else
local curcontext="$curcontext"
cmd="${${openvpn3_cmds[(r)$words[1]:*]%%:*}}"
if (($#cmd)); then
if (( $+functions[_openvpn3_$cmd] )); then
_openvpn3_$cmd
else
_message "no options for $cmd"
fi
else
local curcontext="$curcontext"
cmd="${${_openvpn3_cmds[(r)$words[1]:*]%%:*}}"
if (($#cmd)); then
if (( $+functions[_openvpn3_$cmd] )); then
_openvpn3_$cmd
else
_message "no options for $cmd"
fi
else
_message "no more options"
fi
_message "no more options"
fi
fi
}
_arguments \
{-h,--help}"[that This help screen]" \
"*::openvpn3 commands:_openvpn3_command" \
{-h,--help}"[that This help screen]" \
"*::openvpn3 commands:_openvpn3_command" \
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -41,7 +41,6 @@ _phing() {
# Follow https://www.phing.info/guide/chunkhtml/sec.commandlineargs.html for more information
_arguments -C \
'(-h -help)'{-h,-help}'[display the help screen]' \
'(-v -version)'{-v,-version}'[print version information and exit]' \
'(-l -list)'{-l,-list}'[list all available targets in buildfile]' \
'(-i -init)'{-i,-init}'[generates an initial buildfile]:file:_files' \
'(-q -quiet)'{-q,-quiet}'[quiet operation, no output at all]' \
@ -63,7 +62,7 @@ _phing() {
'-propertyfileoverride[values in property file override existing values]' \
'-find[search for buildfile towards the root of the filesystem and use it]:file:_files' \
'-inputhandler[the class to use to handle user input]:class' \
'(- *)'{-v,-version}'[show version]' \
'(- *)'{-v,-version}'[show version and exit]' \
'1: :->targets' \
'*:: :->args' \
&& ret=0

View File

@ -55,7 +55,7 @@ _pixz() {
'(- 1 *)'-h"[Show help and exit]" \
'(- 1 *)-l[List tarball contents very fast]:file:_files -g "*.(tpxz|xz)"' \
'(- 1 *)-x[Extract one file very fast]:filepath' \
'(- 1 *)-d[Decompress]:file:_files -g "*.(tpxz|xz)' \
'(- 1 *)-d[Decompress]:file:_files -g "*.(tpxz|xz)"' \
'-i[Input]:file:_files' \
'-o[Output]:output:_files' \
'-p[Use a maximum of NUM CPU-intensive threads]:cpu:_pixz_cpus' \

View File

@ -36,13 +36,12 @@
# ------------------------------------------------------------------------------
local -a command_options
command_options=(
local -a command_options=(
'--version[Show the program version and exit]'
'--filter[Set the filter, e.g. installed]'
"--root[Set the install root, e.g. '/' or '/mnt/ltsp']"
'(-n --nowait)'{-n,--nowait}'[Exit without waiting for actions to complete]'
'(-y --noninteractive)'{-g,--noninteractive}'[Install the packages without asking for confirmation]'
'(-y --noninteractive)'{-y,--noninteractive}'[Install the packages without asking for confirmation]'
'--background[Run the command using idle network bandwidth and also using less power]'
'(-p --plain)'{-p,--plain}'[Print to screen a machine readable output, rather than using animated widgets]'
'(-c --cache-age)'{-c,--cache-age}"[The maximum metadata cache age. Use -1 for 'never'.]"
@ -50,8 +49,7 @@ command_options=(
'(-v --verbose)'{-v,--verbose}'[Show debugging information for all files]'
)
local -a actions
actions=(
local -a actions=(
'accept-eula'
'get-roles'
'get-distro-upgrades'

View File

@ -50,13 +50,13 @@ _pm2() {
'--max-memory-restart[restart the app if an amount of memory is exceeded (in bytes)]:bytes' \
'--restart-delay[specify a delay between restarts(in milliseconds)]:delay' \
'--exp-backoff-restart-delay[specify a delay between restarts(in milliseconds)]:delay' \
'(-x --execute-command)'{-e,--execute-command}'[execute a program using fork system]' \
'(-x --execute-command)'{-x,--execute-command}'[execute a program using fork system]' \
'--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' \
'--namespace[start application within specified namespace]:namespace' \
'--cwd[run target script from path <cwd>]:cwd:_paths -/' \
'--cwd[run target script from path <cwd>]:cwd:_files -/' \
'--hp[define home path when generating startup script]: :_paths -/' \
'--wait-ip[override systemd script to wait for full internet connectivity to launch pm2]' \
'--service-name[define service name when generating startup script]' \

View File

@ -250,10 +250,10 @@ _port() {
;;
(select)
options+=(
'--summary:Display summary of selected options'
'--list:List available versions for the group'
'--set:Select the given version for the group'
'--show:Show which version is currently selected for the group (default if none given)'
'--summary[Display summary of selected options]'
'--list[List available versions for the group]'
'--set[Select the given version for the group]'
'--show[Show which version is currently selected for the group (default if none given)]'
'1:group:_port_select_groups'
'2:variant:_port_select_variants'
)

View File

@ -69,7 +69,7 @@ _protoc() {
'--cpp_out=[Generate C++ header and source]:out_dir:_files -/' \
'--csharp_out=[Generate C# source file]:out_dir:_files -/' \
'--java_out=[Generate Java source file]:out_dir:_files -/' \
'--kotlin_out[Generate Kotlin file]:out_dir:_files -/' \
'--kotlin_out=[Generate Kotlin file]:out_dir:_files -/' \
'--js_out=[Generate JavaScript source]:out_dir:_files -/' \
'--objc_out=[Generate Objective C header and source]:out_dir:_files -/' \
'--php_out=[Generate PHP source file]:out_dir:_files -/' \

View File

@ -203,7 +203,7 @@ _qmk_chibios-confmigrate() {
'(-f --force)'{-f,--force}'[Re-migrates an already migrated file, even if it does not detect a full ChibiOS config]' \
'(-d --delete)'{-d,--delete}'[If the file has no overrides, migration will delete the input file]' \
'(-o --overwrite)'{-o,--overwrite}'[Overwrites the input file during migration]' \
'(-r,--reference)'{-r,--reference}'[Specify the reference file to compare against]:reference' \
'(-r --reference)'{-r,--reference}'[Specify the reference file to compare against]:reference' \
'(-i --input)'{-i,--input}'[Specify input config file]: :_files'
}
@ -221,7 +221,7 @@ _qmk_compile() {
'(-c --clean)'{-c,--clean}'[Remove object files before compiling]' \
\*{-e,--env}'[Set a variable to be passed to make]:env' \
'(-j --parallel)'{-j,--parallel}'[Set the number of parallel make jobs; 0 means unlimited]' \
'(-n --dry-run)'{-d,--dry-run}"[Don't actually build, just show the make command to be run]" \
'(-n --dry-run)'{-n,--dry-run}"[Don't actually build, just show the make command to be run]" \
'(-km --keymap)'{-km,--keymap}'[The keymap to build a firmware for]:keymap' \
'(-kb --keyboard)'{-kb,--keyboard}'[The keyboard to build a firmware for]:keyboard' \
'*: :_files'
@ -242,7 +242,7 @@ _qmk_flash() {
'(-c --clean)'{-c,--clean}'[Remove object files before compiling]' \
\*{-e,--env}'[Set a variable to be passed to make]:env' \
'(-j --parallel)'{-j,--parallel}'[Set the number of parallel make jobs; 0 means unlimited]' \
'(-n --dry-run)'{-d,--dry-run}"[Don't actually build, just show the make command to be run]" \
'(-n --dry-run)'{-n,--dry-run}"[Don't actually build, just show the make command to be run]" \
'(-km --keymap)'{-km,--keymap}'[The keymap to build a firmware for]:keymap' \
'(-kb --keyboard)'{-kb,--keyboard}'[The keyboard to build a firmware for]:keyboard' \
'(-m --mcu)'{-m,--mcu}'[The MCS name]:mcu' \

View File

@ -49,7 +49,7 @@ _rails() {
'(- *)'{-v,--version}'[Show Rails version and quit]'
)
runtime_options=(
rails_options=(
'(-f --force)'{-f,--force}'[Overwrite files that already exist]'
'(-p --pretend)'{-p,--pretend}'[Run but do not make any changes]'
'(-q --quiet)'{-q,--quiet}'[Suppress status output]'
@ -59,7 +59,7 @@ _rails() {
local ret=1
_arguments -C \
$rails_options \
$runtime_options \
'1: :_rails_subcommands' \
'*:: :->command' && ret=0
@ -513,7 +513,7 @@ _rails_is_in_app() {
if [[ -f "${dir}/bin/rails" ]]; then
return 0
fi
dir="${dir/*}"
dir="${dir%/*}"
done
return 1

View File

@ -66,7 +66,7 @@ _arguments \
'--force-default-config[Use default configuration even if configuration files are present in the directory tree]' \
'(-s --stdin)'{-s,--stdin}'[Pipe source from STDIN, using FILE in offense reports]: :_files' \
'--editor-mode[Optimize real-time feedback in editors, adjusting behaviors for editing experience]' \
'(-P --parallel --no-parallel)'{-p,--parallel}'[Use available CPUs to execute inspection in parallel]' \
'(-P --parallel --no-parallel)'{-P,--parallel}'[Use available CPUs to execute inspection in parallel]' \
'(-P --parallel --no-parallel)--no-parallel[Execute not parallel]' \
'--raise-cop-error[Raise cop-related errors with cause and location]' \
'--fail-level[Minimum severity for exit with error code]:severity:(autocorrect info refactor convention warning error fatal)' \

View File

@ -38,33 +38,29 @@
#
# ------------------------------------------------------------------------------
_shallow-backup() {
_arguments \
'(- 1 *)'{-h,--help}'[Show help and exit]' \
'(- 1 *)'{-v,--version}'[Print version]' \
'--add-dot[Add a dotfile or dotfolder to config by path]:PATH:_files' \
'--backup-all[Full back up]' \
'--backup-configs[Back up app config files]' \
'--backup-dots[Back up dotfiles]' \
'--backup-fonts[Back up installed fonts]' \
'--backup-packages[Back up package libraries]' \
'--delete-config[Delete config file]' \
'--destroy-backup[Delete backup directory]' \
'--dry-run[Do not backup or reinstall any files, just give verbose output]' \
'--new-path[Input a new back up directory path]:PATH:_files -/' \
'--no-new-backup-path-prompt[Skip setting new back up directory path prompt]' \
'--no-splash[Do not display splash screen]' \
'--reinstall-all[Full reinstallation]' \
'--reinstall-configs[Reinstall configs]' \
'--reinstall-dots[Reinstall dotfiles and dotfolders]' \
'--reinstall-fonts[Reinstall fonts]' \
'--reinstall-packages[Reinstall packages]' \
'--remote[Set remote URL for the git repo]':url \
'--edit[Open config file in $EDITOR]' \
'--show[Display config file]'
}
_shallow-backup
_arguments \
'(- 1 *)'{-h,--help}'[Show help and exit]' \
'(- 1 *)'{-v,--version}'[Print version]' \
'--add-dot[Add a dotfile or dotfolder to config by path]:PATH:_files' \
'--backup-all[Full back up]' \
'--backup-configs[Back up app config files]' \
'--backup-dots[Back up dotfiles]' \
'--backup-fonts[Back up installed fonts]' \
'--backup-packages[Back up package libraries]' \
'--delete-config[Delete config file]' \
'--destroy-backup[Delete backup directory]' \
'--dry-run[Do not backup or reinstall any files, just give verbose output]' \
'--new-path[Input a new back up directory path]:PATH:_files -/' \
'--no-new-backup-path-prompt[Skip setting new back up directory path prompt]' \
'--no-splash[Do not display splash screen]' \
'--reinstall-all[Full reinstallation]' \
'--reinstall-configs[Reinstall configs]' \
'--reinstall-dots[Reinstall dotfiles and dotfolders]' \
'--reinstall-fonts[Reinstall fonts]' \
'--reinstall-packages[Reinstall packages]' \
'--remote[Set remote URL for the git repo]:url' \
'--edit[Open config file in $EDITOR]' \
'--show[Display config file]'
# Local Variables:
# mode: Shell-Script

View File

@ -49,7 +49,7 @@ _arguments \
"--norc[don't look for .shellcheckrc files]" \
'--rcfile=[specify configuration file over searching for one]:rcfile:_files' \
{-o,--enable=}"[give list of optional checks to enable (or 'all')]:error code" \
{-P,--source-path=}'[specify path when looking for sourced files]:_files -/' \
{-P,--source-path=}'[specify path when looking for sourced files]:path:_files -/' \
{-s,--shell=}'[specify dialect]:dialect:(sh bash dash ksh busybox)' \
{-S,--severity=}'[specify minimum severity of errors to consider]:severity:(error warning info style)' \
{-V,--version}'[print version information]' \

View File

@ -425,7 +425,7 @@ _sox_ng_supported_formats() {
local -a formats=(
'raw:Raw audio files'
'3gp:Third Generation Partnership Project format'
'3g2:Third Generation Partnership Project 2 format'.
'3g2:Third Generation Partnership Project 2 format'
'8svx:Amiga 8SVX musical instrument description format'
'aac:Advanced Audio Coding format'
'ac3:Audio Codec 3 (Dolby Digital) format'

View File

@ -53,7 +53,7 @@ _subliminal() {
'(-e --encoding)'{-e,--encoding}'[Subtitle file encoding]:encoding' \
'(-s --single)'{-s,--single}'[Save subtitle without language code in the file name]' \
'(-f --force)'{-f,--force}'[Force download even if a subtitle already exist]' \
'(-hi,--hearing-impaired)'{-hi,--hearing-impaired}'[Prefer hearing impaired subtitles]' \
'(-hi --hearing-impaired)'{-hi,--hearing-impaired}'[Prefer hearing impaired subtitles]' \
'(-m --min-score)'{-m,--min-score}'[Minimum score for a subtitle to be downloaded]:integer range:' \
'(-w --max-worked)'{-w,--max-workers}'[Maximum number of threads to use]:integer range:' \
'(-z --archives -Z --no-archives)'{-z,--archives}'[Scan archives for videos]' \

View File

@ -46,7 +46,7 @@ _supervisorctl() {
_arguments -C \
{--configuration,-c}='[configuration file path (default /etc/supervisor.conf)]:filename:_files' \
'(- *)'{--help,-h}'[print usage message and exit]:' \
'(- *)'{--help,-h}'[print usage message and exit]' \
{--interactive,-i}'[start an interactive shell after executing commands]' \
{--serverurl,-s}='[URL on which supervisord server is listening (default "http://localhost:9001")]:url:_urls' \
{--username,-u}='[username to use for authentication with server]:username:_users' \
@ -206,7 +206,7 @@ _supervisorctl_collect_procs() {
| awk "/$pattern/"'{n=$1;gsub(":","\\:",n); printf "%s\n%s\\:\n",n,substr($1,1,index($1,":")-1)}' \
| uniq)"})
procs+=(all)
_describe 'stooped processes or groups' procs
_describe 'stoped processes or groups' procs
}
(( $+functions[_supervisorctl_groups] )) ||
@ -242,7 +242,7 @@ case $service in
'(-i --identifier)'{-i,--identifier}'[identifier used for this instance of supervisord]:id' \
'(-q --childlogdir)'{-q,--childlogdir}'[the log directory for child process logs]:log dir:_files -/' \
'(-k --nocleanup)'{-k,--nocleanup}'[prevent the process from performing cleanup]' \
'(-a --minfds)'{-m,--minfds}'[the minimum number of file descriptors for start success]:min fds' \
'(-a --minfds)'{-a,--minfds}'[the minimum number of file descriptors for start success]:min fds' \
'(-t --strip_ansi)'{-t,--strip_ansi}'[strip ansi escape codes from process output]' \
'--profile_options[profile options]:profile option:_values -s , "field" cumulative calls callers'
;;

View File

@ -47,7 +47,7 @@ _svm() {
'-c[show the currently use scala version]' \
"-l[show the scala version installed in svm_path(default is ${HOME}/.svm)]" \
'-v[show the available scala version not installed]' \
'-i[install specific scala version]: :_svm_completion_not_installed_scala_versions' \
'-i[install specific scala version]: :_svm_not_installed_scala_versions' \
'-r[uninstall specific scala version and remove their sources]: :_svm_installed_scala_versions' \
'(-s -u)'{-s,-u}'[setup to use a specific scala version]: :_svm_not_selected_scala_versions' \
'1: :_svm_commands' \

View File

@ -39,15 +39,15 @@ local -a format=(txt html rtf rtfd doc docx wordml odt webarchive)
_arguments -S \
'-help[Show the usage information for the command and exit]' \
'-info[Display information about the specified files]' \
'-convert[Convert the specified files to the indicated format and write]:format:(($format))' \
'-cat[Read the specified files, concatenate them in the indicated format]:format:(($format))' \
'-convert[Convert the specified files to the indicated format and write]:format:($format)' \
'-cat[Read the specified files, concatenate them in the indicated format]:format:($format)' \
'-extension[Specify an extension to be used for output files]:ext' \
'-output[Specify the file name to be used for the first output file]:path:_files' \
'-stdin[Specify that input should be read from stdin rather than from files]' \
'-stdout[Specify that the first output file should go to stdout]' \
'-encoding[Specify the encoding to be used for plain text or HTML output files]:name' \
'-inputencoding[Force all plain text input files to be interpreted using the specified encoding]' \
'-format[Force all input files to be interpreted using the indicated format]:format:(($format))' \
'-format[Force all input files to be interpreted using the indicated format]:format:($format)' \
'-font[Specify the name of the font to be used for converting plain to rich text]:font' \
'-fontsize[Specify the size in points of the font to be used for converting plain to rich text]:size' \
'-noload[Do not load subsidiary resources]' \

View File

@ -40,8 +40,7 @@
# ------------------------------------------------------------------------------
_tmuxp() {
local curcontext="$curcontext" state line
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
_arguments -C \
@ -49,81 +48,87 @@ _tmuxp() {
"*::options:->options" \
"--log-level[log level(default info)]: :(debug info warning error critical)" \
'(- *)'{-h,--help}'[display usage information]' \
'(- *)'{-V,--version}'[show version number and exit]'
'(- *)'{-V,--version}'[show version number and exit]' \
&& ret=0
case $state in
(command)
local -a subcommands
subcommands=(
'load:Load tmuxp workspaces'
'shell:launch python shell for tmux server, session, window and pane'
'import:Import a teamocil/tmuxinator config'
'convert:Convert a tmuxp config between JSON and YAML'
'debug-info:print out all diagnostic info'
'ls:list sessions in config directory'
'edit: run $EDITOR on config'
'freeze:Snapshot a session into a config'
)
_describe -t commands 'commands' subcommands
;;
(options)
case $line[1] in
(load)
__tmuxp_load
;;
(import)
__tmuxp_import
;;
(freeze)
local sessions="$(__tmux_sessions)"
_arguments -C \
'(- *)'{-h,--help}'[show help message and exit]' \
'-S[pass-through for tmux -S]: :_files' \
'-L[pass-through for tmux -L]: :' \
'(-f --config-format)'{-f,--config-format}'[format to save in]: :(yaml json)' \
'(-o --save-to)'{-o,--save-to}'[file to save to]: :_files' \
'(-y --yes)'{-y,--yes}'[always answer yes]' \
'(-q --quiet)'{-q,--quiet}"[don't prompt for confirmation]" \
'--force[overwrite the config file]'\
"1::session name:compadd $sessions"
;;
(convert)
_arguments -C \
'1:: :_files -g "*.(json|yaml|yml)"'
;;
(shell)
local sessions="$(__tmux_sessions)"
local windows="$(__tmux_windows)"
_arguments -C \
'(- *)'{-h,--help}'[show help message and exit]' \
'-S[pass-through for tmux -S]: :_files' \
'-L[pass-through for tmux -L]: :' \
'--best[use best shell available in site packages]' \
'--pdb[use plain pdb]' \
"--code[use stdlib's code.interact()]" \
'--ptipython[use ptpython + ipython]' \
'--ptpython[use ptpython]' \
'--ipython[use ipython]' \
'--bpython[use bpython]' \
(--no-startup)'--use-pythonrc[load PYTHONSTARTUP env var and ~/.pythonrc.py script in --code]' \
(--use-pythonrc)'--no-startup[do not load PYTHONSTARTUP env var and ~/.pythonrc.py script in --code]' \
(--no-vi-mode)'--use-vi-mode[use vi-mode in ptpython/ptipython]' \
(--vi-mode)'--no-vi-mode[do not use vi-mode in ptpython/ptipython]' \
"1::session name:compadd $sessions" \
"2::window name:compadd $windows"
;;
(ls|debug-info)
_arguments -C \
'(- *)'{-h,--help}'[show help message and exit]'
;;
(edit)
_arguments -C \
'(- *)'{-h,--help}'[show help message and exit]' \
'1:: :_files -g "*.(json|yaml|yml)"'
;;
esac
esac
case $state in
(command)
local -a subcommands=(
'load:Load tmuxp workspaces'
'shell:launch python shell for tmux server, session, window and pane'
'import:Import a teamocil/tmuxinator config'
'convert:Convert a tmuxp config between JSON and YAML'
'debug-info:print out all diagnostic info'
'ls:list sessions in config directory'
'edit: run $EDITOR on config'
'freeze:Snapshot a session into a config'
)
_describe -t commands 'commands' subcommands && ret=0
;;
(options)
case $line[1] in
(load)
__tmuxp_load && ret=0
;;
(import)
__tmuxp_import && ret=0
;;
(freeze)
local sessions="$(__tmux_sessions)"
_arguments \
'(- *)'{-h,--help}'[show help message and exit]' \
'-S[pass-through for tmux -S]: :_files' \
'-L[pass-through for tmux -L]: :' \
'(-f --config-format)'{-f,--config-format}'[format to save in]: :(yaml json)' \
'(-o --save-to)'{-o,--save-to}'[file to save to]: :_files' \
'(-y --yes)'{-y,--yes}'[always answer yes]' \
'(-q --quiet)'{-q,--quiet}"[don't prompt for confirmation]" \
'--force[overwrite the config file]'\
"1::session name:compadd $sessions" \
&& ret=0
;;
(convert)
_arguments \
'1:: :_files -g "*.(json|yaml|yml)"' \
&& ret=0
;;
(shell)
local sessions="$(__tmux_sessions)"
local windows="$(__tmux_windows)"
_arguments \
'(- *)'{-h,--help}'[show help message and exit]' \
'-S[pass-through for tmux -S]: :_files' \
'-L[pass-through for tmux -L]: :' \
'--best[use best shell available in site packages]' \
'--pdb[use plain pdb]' \
"--code[use stdlib's code.interact()]" \
'--ptipython[use ptpython + ipython]' \
'--ptpython[use ptpython]' \
'--ipython[use ipython]' \
'--bpython[use bpython]' \
'(--no-startup --use-pythonrc)--use-pythonrc[load PYTHONSTARTUP env var and ~/.pythonrc.py script in --code]' \
'(--no-startup --use-pythonrc)--no-startup[do not load PYTHONSTARTUP env var and ~/.pythonrc.py script in --code]' \
'(--use-vi-mode --no-vi-mode)--use-vi-mode[use vi-mode in ptpython/ptipython]' \
'(--use-vi-mode --no-vi-mode)--no-vi-mode[do not use vi-mode in ptpython/ptipython]' \
"1::session name:compadd $sessions" \
"2::window name:compadd $windows" \
&& ret=0
;;
(ls|debug-info)
_arguments \
'(- *)'{-h,--help}'[show help message and exit]' \
&& ret=0
;;
(edit)
_arguments \
'(- *)'{-h,--help}'[show help message and exit]' \
'1:: :_files -g "*.(json|yaml|yml)"' \
&& ret=0
;;
esac
esac
return ret
}
__tmuxp_load() {
@ -188,7 +193,6 @@ __tmux_windows () {
_tmuxp "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2

View File

@ -70,14 +70,14 @@ _tox() {
(run|run-parallel|depends|exec|list|quickstart|schema|config|devenv)
options+=(
'--result-json[write a JSON file with detailed information]:file:_files'
'--hashseed[set PYTHONHASHSEED to the specified seed before running commands]:sed'
'--hashseed[set PYTHONHASHSEED to the specified seed before running commands]:seed'
'--discover[for Python discovery first try these Python executables]:file:_files'
'(--list-dependencies --no-list-dependencies)--list-dependencies[list the dependencies installed during environment setup]'
'(--list-dependencies --no-list-dependencies)--no-list-dependencies[never list the dependencies]'
'--develop[install package in development mode]'
)
;|
(run|run-parallel|direnv)
(run|run-parallel|devenv)
options+=(
'-m[label to evaluate]:label'
'-f[factor to evaluate]:factor'
@ -136,7 +136,7 @@ _tox_commands() {
'depends:visualize tox environment dependencies'
'list:list environment'
'devenv:set up a development environment at ENVDIR'
'schema:ganerate schema for tox configuration'
'schema:generate schema for tox configuration'
'config:show tox configuration'
'quickstart:quickly create a tox config file for a Python project'
'exec:execute an arbitrary command within a tox environment'

View File

@ -34,6 +34,9 @@
#
# ------------------------------------------------------------------------------
typeset -A opt_args
local context state line
local -a module_types=(
none commonjs amd umd system es6/es2015 es2020 es2022 esnext node16 node18 nodenext preserve
)
@ -168,7 +171,7 @@ local -a opts=(
'--plugins[Specify a list of language service plugins to include]:plugins'
'--emitDecoratorMetadata[Emit design-type metadata for decorated declarations in source files]'
'--experimentalDecorators[Enable experimental support for legacy experimental decorators]'
'--jsx[Specify what JSX code is generated]:type(preserve react react-native react-jsx react-jsxdev)'
'--jsx[Specify what JSX code is generated]:type:(preserve react react-native react-jsx react-jsxdev)'
"--jsxFactory[Specify the JSX factory function used when targeting React JSX emit]:funcname"
"--jsxFragmentFactory[Specify the JSX Fragment reference used for fragments when targeting React JSX emit]:reference"
'--jsxImportSource[Specify module specifier used to import the JSX factory functions]'
@ -197,7 +200,7 @@ local -a opts=(
if (( $+opt_args[--build] )); then
opts+=(
'(-v --verbose)'{-v,--verbose}"[Enable verbose logging]"
'(-d --dry)'{-d,--dry}'[Show what would be built]'
'--dry[Show what would be built]'
'(-f --force)'{-f,--force}'[Build all projects, including those that appear to be up to date]'
'--clean[Delete the outputs of all projects]'
'--stopBuildOnErrors[Skip building downstream projects on error in upstream project]'
@ -208,7 +211,7 @@ else
)
fi
_arguments $opts && return 0
_arguments -C $opts && return 0
# Local Variables:
# mode: Shell-Script

View File

@ -42,7 +42,7 @@ _ufw_logging() {
local params additional second
second=$words[2]
if [ ! -z $second ]; then
if [[ ! -z "$second" ]]; then
return
fi
@ -58,7 +58,7 @@ _ufw_delete() {
second=$words[2]
if [ ! -z $second ]; then
if [[ ! -z "$second" ]]; then
return
fi
@ -89,14 +89,6 @@ _ufw_app() {
return ret
}
(( $+functions[_flutter_pub_token_subcommand] )) ||
_flutter_pub_token_subcommand() {
local -a subcommands=(
)
_describe -t subcommands 'subcommand' subcommands "$@"
}
_ufw() {
local curcontext="$curcontext" ret=1
local -a state line commands

View File

@ -45,7 +45,7 @@ _arguments \
'(-q --quiet)'{-q,--quiet}'[suppress some failure messages]' \
'(-r --random)'{-r,--random}'[connect to running uuid daemon and request to return a random-based UUID]' \
'(-S --socket-activation -s --socket)'{-S,--socket-activation}'[do not create a socket]' \
'(-S --socket-activation -s --socket)'{-s,--socket}'[make uuidd use this path name for the unix-domain socket]:sokect:_files' \
'(-S --socket-activation -s --socket)'{-s,--socket}'[make uuidd use this path name for the unix-domain socket]:socket:_files' \
'(-T --timeout)'{-T,--timeout}'[make uuidd exit after number seconds of inactivity]:seconds' \
'(-t --time)'{-t,--time}'[connect to running uuid daemon and request to return a time-based UUID]' \
'(- *)'{-h,--help}'[display help text and exit]' \

View File

@ -66,11 +66,11 @@ case $OSTYPE in
'(-r --random)'{-r,--random}'[generate random-based uuid]' \
'(-t --time)'{-t,--time}'[generate time-based uuid]' \
'(-n --namespace)'{-n,--namespace}'[generate hash-based uuid in this namespace]:namespace:(@dns @url @oid @x500)' \
'(-N --name)'{-n,--name}'[generate hash-based uuid from this name]:name' \
'(-N --name)'{-N,--name}'[generate hash-based uuid from this name]:name' \
'(-C --count -s --sha1 -m --md5)'{-m,--md5}'[generate md5 hash]' \
'(-C --count -s --sha1 -m --md5)'{-C,--count}'[generate more uuids in loop]:count' \
'(-C --count -s --sha1 -m --md5)'{-s,--sha1}'[generate sha1 hash]' \
'(-x --hex)'{-h,--hex}'[interpret name as hex string]'
'(-x --hex)'{-x,--hex}'[interpret name as hex string]'
;;
esac

View File

@ -40,7 +40,7 @@ _arguments \
'(-g --group -p --passwd)'{-p,--passwd}'[edit passwd database]' \
'(-q --quiet)'{-q,--quiet}'[quiet mode]' \
'(-R --root)'{-R,--root}'[apply changes in the given directory]:dir:_files -/' \
'(-s --shadow)'{-s,--shadow}'[eedit shadow or gshadow database]'
'(-s --shadow)'{-s,--shadow}'[edit shadow or gshadow database]'
# Local Variables:
# mode: Shell-Script

View File

@ -481,17 +481,17 @@ _vboxmanage_cloud_list() {
case $state in
(arg)
local -a state
local -a instance_states
if [[ $words[1] == "instances" ]]; then
state=(running paused terminated)
instance_states=(running paused terminated)
else
state=(available disabled deleted)
instance_states=(available disabled deleted)
fi
_arguments \
'--provider=[Short cloud provider name]:provider' \
'--profile=[Cloud profile name]:profile' \
'--state=[The state of cloud instance]: :'"($state)" \
'--state=[The state of cloud instance]: :'"($instance_states)" \
'--compartment-id[A compartment is the logical container used]'
;;
esac
@ -1058,7 +1058,7 @@ _vboxmanage_guestcontrol() {
'--recursive[Recursively removes directories from the specified from the guest VM]' \
&& ret=0
;;
(rmdir)
(rm)
_arguments \
'--quiet[Specifies that the command produce quieter output]' \
'--verbose[Specifies that the command produce more detailed output]' \
@ -1102,7 +1102,8 @@ _vboxmanage_guestcontrol() {
'--wait-ready[Waits for the current Guest Additions being ready to handle the Guest Additions update]' \
'--wait-start[Starts the VBoxManage update process on the guest VM and then waits for the Guest Additions update]' \
&& ret=0
(start|start)
;;
(run|start)
_arguments \
'--quiet[Specifies that the command produce quieter output]' \
'--verbose[Specifies that the command produce more detailed output]' \
@ -1533,7 +1534,7 @@ _vboxmanage_modifynvram() {
'--owner-uuid=[The UUID identifying the owner of the variable to delete]:uuid' \
&& ret=0
;;
(queryvar)
(changevar)
_arguments \
'--name=[UEFI variable name to change the data for]:name' \
'--filename=[The file to read the data from]: :_files' \

View File

@ -41,7 +41,7 @@
local curcontext="$curcontext" state state_descr line ret=1
typeset -A opt_args
local period="-d --days -h --hours -m --months -w --weeks"
local period="-d --days -h --hours -m --months -w --weeks -y --years -5 --fiveminutes"
_arguments -C : \
'--95th[show 95th percentile output for the ongoing month]' \

View File

@ -320,7 +320,7 @@ _yarn_subcommands() {
'search:open the search interface'
'upgrade-interactive:open the upgrade interface'
'plugin:plugin related commands'
'version:version relarelated commands'
'version:version related commands'
'workspace:workspace related commands'
'workspaces:command for workspaces'
)
@ -731,6 +731,7 @@ _yarn_version() {
(( $+functions[_yarn_workspace] )) ||
_yarn_workspace() {
local ret=1
local package_json=$(_yarn_package_json_path)
local package_dir=$(dirname $package_json)
@ -798,7 +799,7 @@ _yarn_workspaces() {
_arguments \
'(- *)'{-h,--help}'[show help message and exit]' \
'--since[only include workspaces that have been changed since the specified ref]' \
'(-R,--recursive)'{-R,--recursive}'[find packages via dependencies/devDependencies]' \
'(-R --recursive)'{-R,--recursive}'[find packages via dependencies/devDependencies]' \
'--no-private[exclude workspaces that have the private field set to true]' \
'(-v --verbose)'{-v,--verbose}'[also return the cross-dependencies between workspaces]' \
'--json[format the output as an NDJSON stream]' \

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