Compare commits

...

28 Commits

Author SHA1 Message Date
Shohei YOSHIDA bce05f9352
Merge pull request #1236 from zsh-users/refactor_gist
Refactor gist and fix cache broken cache implementation
2026-03-16 15:10:54 +09:00
Shohei YOSHIDA 504b84f000
Merge pull request #1235 from zsh-users/refactor_cmake
Refactor cmake completion
2026-03-16 15:09:55 +09:00
Shohei YOSHIDA 84d9053354
Merge pull request #1234 from zsh-users/refactor_cf
Refactoring _cf completion
2026-03-16 14:54:01 +09:00
Shohei YOSHIDA 51025ba738
Merge pull request #1237 from zsh-users/refactor-cask
Refactor cask completion
2026-03-16 14:37:26 +09:00
Shohei YOSHIDA 83748eefc0
Merge pull request #1238 from zsh-users/refactor_git_flow
Refactor git flow
2026-03-16 14:13:23 +09:00
Shohei YOSHIDA 8ef1a35c32
Merge pull request #1239 from zsh-users/refactor_openvpn3
Refactor openvpn3
2026-03-16 14:12:18 +09:00
Shohei YOSHIDA f1cd0e8940
Merge pull request #1233 from zsh-users/refactor_tmuxp
refactoring _tmuxp
2026-03-16 14:11:56 +09:00
Shohei YOSHIDA 31236f26de
Use git_flow prefix instead of git for functions 2026-03-15 22:14:52 +09:00
Shohei YOSHIDA 8758ee4809
Use local variables 2026-03-15 22:11:41 +09:00
Shohei YOSHIDA 45f8084e70
Don't use global variables 2026-03-15 22:09:37 +09:00
Shohei YOSHIDA d1180f126a
Add global options 2026-03-15 15:14:40 +09:00
Shohei YOSHIDA 96316552ea
Merge two switch-case 2026-03-15 15:08:37 +09:00
Shohei YOSHIDA 0dce3a833b
Don't overwrite context variables 2026-03-15 15:08:30 +09:00
Shohei YOSHIDA da6814a485
Don't use global variables 2026-03-15 15:04:17 +09:00
Shohei YOSHIDA b9c943a9e8
Fix cache implementation 2026-03-15 13:24:57 +09:00
Shohei YOSHIDA 5c4fd5c1c5
Don't use global variables 2026-03-15 12:08:49 +09:00
Shohei YOSHIDA e534d39076
simplify assignments and remove needless functions 2026-03-14 21:04:01 +09:00
Shohei YOSHIDA 8e505348f3
Reduce top level local variables, use function local variables instead 2026-03-14 20:56:20 +09:00
Shohei YOSHIDA 309d615eb5
Simplify cmake targets
- Don't use for loop
- Use reduce filtering commands
2026-03-14 20:27:54 +09:00
Shohei YOSHIDA 9240b691d0
Do not use global variables 2026-03-14 20:06:03 +09:00
Shohei YOSHIDA 003afbe513
Refactoring _cf completion
- don't overwrite global variables
- add `__cf_` prefix to private functions
- improve command function dispatch
- use zsh way for array value check
2026-03-14 01:01:16 +09:00
Shohei YOSHIDA f1153d7a9d
add command name prefix to functions 2026-03-14 00:17:55 +09:00
Shohei YOSHIDA ce3bdfed22
Merge pull request #1232 from zsh-users/fix-format
Fix format issues
2026-03-13 16:30:56 +09:00
Shohei YOSHIDA fe94956940
Merge pull request #1231 from zsh-users/issue-1214
`--build` option should be an optional parameter
2026-03-13 16:01:19 +09:00
Shohei YOSHIDA b5da595150
Fix indentation size 2026-03-13 11:46:25 +09:00
Shohei YOSHIDA 7ea6b7a971
Add editor settings to all files 2026-03-13 11:38:48 +09:00
Shohei YOSHIDA 32210c83c5
Use spaces instead of tabs 2026-03-13 11:31:47 +09:00
Shohei YOSHIDA 867fb5a09c
`--build` option should be an optional parameter 2026-03-12 13:38:49 +09:00
27 changed files with 1548 additions and 1706 deletions

View File

@ -69,3 +69,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

@ -41,14 +41,29 @@
# ------------------------------------------------------------------------------
function _cask() {
local ret=1 state
_arguments \
typeset -A opt_args
local context state line ret=1
local curcontext="$curcontext"
_arguments -C \
'(--proxy --http-proxy --https-proxy)--proxy[Set emacs proxy for HTTPS and HTTPS]:host:_hosts' \
'(--proxy --http-proxy)--http-proxy[Set emacs proxy for HTTP]:host:_hosts' \
'(--proxy --https-proxy)--https-proxy[Set emacs proxy for HTTPS]:host:_hosts' \
'(--proxy --http-proxy --https-proxy)--proxy[Set emacs proxy for HTTPS and HTTPS]:host:_hosts' \
'--no-proxy[Set Emacs no-proxy to HOST]:host:_hosts' \
'(- *)--version[Print Cask version and exit]' \
'(- *)'{-h,--help}'[Display usage or information for command]::command:->subcommand' \
'--debug[Turn on debug output]' \
'--path[Run command in this PATH instead of default-directory]:dir:_files -/' \
'(--verbose --silent)--verbose[Be verbose and show debug output]' \
'(--verbose --silent)--verbose[Be slient and do not show anything]' \
':subcommand:->subcommand' \
'*:: :->subcmds' && ret=0
'*:: :->subcmds' \
&& ret=0
case $state in
subcommand)
subcommands=(
(subcommand)
local -a subcommands=(
"build:build all Elisp files in the files directive"
"clean-elc:remove all byte compiled Elisp files in the files directive"
"exec:execute command with correct 'exec-path' and 'load-path'"
@ -71,15 +86,20 @@ function _cask() {
"upgrade:upgrade Cask itself and its dependencies"
"version:print program version"
)
_describe -t subcommands 'cask subcommands' subcommands && ret=0
esac
case "$words[1]" in
init)
_arguments \
'(--dev)--dev[Run in dev mode]' && ret=0 ;;
exec)
_generic
_describe -t subcommands 'cask subcommands' subcommands && ret=0
;;
(subcmds)
case "$words[1]" in
(init)
_arguments \
'(--dev)--dev[Run in dev mode]' \
&& ret=0
;;
(exec)
_generic
;;
esac
;;
esac
@ -87,3 +107,11 @@ function _cask() {
}
_cask "$@"
# 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

@ -248,7 +248,7 @@ __ccache_config_keys() {
if compset -P '--set-config=*='; then
case $IPREFIX in
( *=absolute_paths_in_stderr= | *=compression= | *=debug= | *=depend_mode= | *=direct_mode= | *=disable= | *=file_clone= | *=hard_link= | *=hash_dir= | *=inode_cache= | *=keep_comments_cpp= | *=read_only= | *=read_only_direct= | *=recache= | *=run_second_cpp= | *=stats= | *=unify= )
( *=absolute_paths_in_stderr= | *=compression= | *=debug= | *=depend_mode= | *=direct_mode= | *=disable= | *=file_clone= | *=hard_link= | *=hash_dir= | *=inode_cache= | *=keep_comments_cpp= | *=read_only= | *=read_only_direct= | *=recache= | *=run_second_cpp= | *=stats= | *=unify= )
local -a booleans=('true' 'false')
_describe -t booleans 'boolean' booleans
;;

719
src/_cf

File diff suppressed because it is too large Load Diff

View File

@ -108,8 +108,8 @@ _chromium_proxyurls () {
do
while _next_label prefixes expl 'URL prefix' -S '' "$@"
do
compset -S '[^:/]*' && compstate[to_end]=''
compadd "$expl[@]" http:// socks:// socks4:// socks5:// && ret=0
compset -S '[^:/]*' && compstate[to_end]=''
compadd "$expl[@]" http:// socks:// socks4:// socks5:// && ret=0
done
(( ret )) || return 0
done
@ -123,27 +123,27 @@ _chromium_proxyurls () {
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 ;;
[[ -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
@ -153,10 +153,10 @@ _chromium_proxyurls () {
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
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
@ -171,28 +171,28 @@ _chromium_proxyurls () {
then
if ! compset -P '(#b)([^/]#)/'
then
_users -S/ "$@"
return
_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
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
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
@ -200,8 +200,8 @@ _chromium_proxyurls () {
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
_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

View File

@ -79,12 +79,12 @@ local -a cmake_build_options=(
'--list-presets[List available presets]'
'--workflow[Run a workflow preset]'
'-E[CMake command mode]:command:_cmake_command_help'
'-E[CMake command mode]:command:_cmake_commands'
'-L-[List cache variables]::_values "options" "[non-advanced cache variables]" "A[advanced cache variables]" "H[non-advanced cached variables with help]" "AH[advanced cache variables with help]"'
'--fresh[Configure a fresh build tree, removing any existing cache file]'
'--build[Build a CMake-generated project binary tree]:project directory:_path_files -/'
'--build[Build a CMake-generated project binary tree]::project directory:_path_files -/'
'--install[Install a CMake-generated project binary tree]:project directory:_path_files -/'
'--open[Open generated project in the associated application]:project directory:_path_files -/'
@ -149,11 +149,11 @@ _cmake_generator_options() {
# --------------
(( $+functions[_cmake_presets] )) ||
_cmake_presets() {
local invoke; invoke=(${(Q)words})
local invoke=(${(Q)words})
invoke[$CURRENT]=()
# TODO: remove all arguments -* except -S
local list_presets; list_presets=(${(f)"$(${invoke} --list-presets 2>/dev/null |
local list_presets=(${(f)"$(${invoke} --list-presets 2>/dev/null |
sed -n -e 's,^[[:space:]]*"\([^"]*\)"[[:space:]]*-[[:space:]]*\(.*\),\1:\2,p' \
-e 's,^[[:space:]]*"\([^"]*\)"[[:space:]]*$,\1,p')"})
@ -165,24 +165,16 @@ _cmake_presets() {
# --------------
(( $+functions[_cmake_targets] )) ||
_cmake_targets() {
local -a targets
if [ -f $1/Makefile ]
then
local dir="$1"
local -a targets=()
if [[ -f "${dir}/Makefile" && $+commands[make] ]]; then
# `make help` doesn't work for Makefiles in general, but for CMake generated Makefiles it does.
i=1
for target in $(make -f $1/Makefile help | \grep -e "\.\.\." | sed "s/\.\.\. //" | sed "s/ (the default.*//") ; do
targets[$i]=$target
(( i = $i + 1 ))
done
elif [ -f $1/build.ninja ]
then
targets=(${(f)"$(make -f $dir/Makefile help 2>/dev/null | awk '/^\.\.\./ { print $2 }')"})
elif [[ -f "${dir}/build.ninja" && $+commands[ninja] ]]; then
# `ninja help` doesn't seem to be the list of targets we're interested in
i=1
for target in $(ninja -C $1 -t targets all 2&>/dev/null | awk -F: '{print $1}') ; do
targets[$i]="$target"
(( i++ ))
done
targets=(${(f)"$(ninja -C $dir -t targets all 2>/dev/null | awk -F: '{print $1}' )"})
fi
_describe 'build targets' targets
}
@ -195,44 +187,53 @@ _cmake_suggest_installdirs() {
}
_cmake_on_build() {
local build_extras;build_extras=(
local build_extras=(
'--[Native build tool options]'
'--target[specify build target]'
'--clean-first[build target clean first]'
'--config[For multi-configuration tools]'
'--parallel[maximum number of build processes]'
'--use-stderr')
'--use-stderr'
)
local -a undescribed_build_extras
i=1
local i=1
for be in $build_extras ; do
undescribed_build_extras[$i]=$(echo $be | sed "s/\[.*//")
(( i++ ))
done
inbuild=false
dashdashposition=-1
local in_build=false
local dash_dash_position=-1
local build_at=$CURRENT
for ((i = (($CURRENT - 1)); i > 1 ; i--)); do
if [[ $words[$i] == --build ]] ; then
inbuild=true
buildat=$i
if [[ $words[$i] == --build ]]; then
in_build=true
build_at=$i
(( difference = $CURRENT - $i ))
elif [[ $words[$i] == -- ]] ; then
dashdashposition=$i
elif [[ $words[$i] == -- ]]; then
dash_dash_position=$i
fi
done
# check if build mode has been left
outofbuild=false
for ((i = (($CURRENT - 1)); i > (($buildat + 1)); i--)); do
local out_of_build=false
for ((i = (($CURRENT - 1)); i > (($build_at + 1)); i--)); do
# don't check the word after --build (should be a directory)
if [[ ${undescribed_build_extras[(r)$words[$i]]} == $words[$i] ]] ; then continue ; fi
if [[ $words[(($i - 1))] == --target ]] ; then continue ; fi
if [[ $words[(($i - 1))] == --config ]] ; then continue ; fi
if [[ ${undescribed_build_extras[(r)$words[$i]]} == $words[$i] ]]; then
continue
fi
if [[ $words[(($i - 1))] == --target ]]; then continue ; fi
if [[ $words[(($i - 1))] == --config ]]; then continue ; fi
if [[ $words[(($i - 1))] == --parallel ]] ; then continue ; fi
outofbuild=true
out_of_build=true
done
if (( $dashdashposition > 0 )) ; then
_cmake_generator_options $words[(($buildat + 1))] $dashdashposition && return 0
if (( $dash_dash_position > 0 )) ; then
_cmake_generator_options $words[(($build_at + 1))] $dash_dash_position && return 0
fi
if [[ "$inbuild" == false || "$difference" -eq 1 ]] ; then
if [[ "$in_build" == false || "$difference" -eq 1 ]] ; then
# either there is no --build or completing the directory after --build
_arguments -C -s \
- build_opts \
@ -241,14 +242,14 @@ _cmake_on_build() {
"$cmake_suggest_build[@]" && return 0
elif [[ $words[(($CURRENT - 1))] == --target ]] ; then
# after --build <dir> --target, suggest targets
_cmake_targets $words[(($buildat + 1))] && return 0
_cmake_targets $words[(($build_at + 1))] && return 0
elif [[ $words[(($CURRENT - 1))] == --config ]] ; then
# after --build <dir> --config, no idea
return 0
elif [[ $words[(($CURRENT - 1))] == --parallel ]] ; then
# after --build <dir> --parallel
return 0
elif [ "$outofbuild" = true ] ; then
elif [ "$out_of_build" = true ] ; then
# after --build <dir> --<not a --build option>, suggest other cmake_build_options (like -Wno-dev)
_arguments "$cmake_build_options[@]" && return 0
else
@ -258,43 +259,49 @@ _cmake_on_build() {
}
_cmake_on_install() {
local build_extras;build_extras=(
local build_extras=(
'--[Native build tool options]'
'--prefix[Override the installation prefix, CMAKE_INSTALL_PREFIX]'
'--config[For multi-configuration generators(e.g. Visual Studio)]'
'--component[Component-based install]'
'--strip[Strip before installing.]'
)
)
local -a undescribed_build_extras
i=1
local i=1
for be in $build_extras ; do
undescribed_build_extras[$i]=$(echo $be | sed "s/\[.*//")
(( i++ ))
done
inbuild=false
dashdashposition=-1
local in_build=false
local dash_dash_position=-1
local build_at=$CURRENT
for ((i = (($CURRENT - 1)); i > 1 ; i--)); do
if [[ $words[$i] == --install ]] ; then
inbuild=true
buildat=$i
if [[ $words[$i] == --install ]]; then
in_build=true
build_at=$i
(( difference = $CURRENT - $i ))
elif [[ $words[$i] == -- ]] ; then
dashdashposition=$i
elif [[ $words[$i] == -- ]]; then
dash_dash_position=$i
fi
done
outofbuild=false
for ((i = (($CURRENT - 1)); i > (($buildat + 1)); i--)); do
local out_of_build=false
for ((i = (($CURRENT - 1)); i > (($build_at + 1)); i--)); do
# don't check the word after --install (should be a directory)
if [[ ${undescribed_build_extras[(r)$words[$i]]} == $words[$i] ]] ; then continue ; fi
if [[ $words[(($i - 1))] == --prefix ]] ; then continue ; fi
if [[ $words[(($i - 1))] == --config ]] ; then continue ; fi
if [[ $words[(($i - 1))] == --component ]] ; then continue ; fi
outofbuild=true
if [[ $words[(($i - 1))] == --prefix ]]; then continue ; fi
if [[ $words[(($i - 1))] == --config ]]; then continue ; fi
if [[ $words[(($i - 1))] == --component ]]; then continue ; fi
out_of_build=true
done
if (( $dashdashposition > 0 )) ; then
_cmake_generator_options $words[(($buildat + 1))] $dashdashposition && return 0
if (( $dash_dash_position > 0 )) ; then
_cmake_generator_options $words[(($build_at + 1))] $dash_dash_position && return 0
fi
if [[ "$inbuild" == false || "$difference" -eq 1 ]] ; then
if [[ "$in_build" == false || "$difference" -eq 1 ]] ; then
# either there is no --install or completing the directory after --install
_arguments -C -s \
- build_opts \
@ -310,7 +317,7 @@ _cmake_on_install() {
elif [[ $words[(($CURRENT - 1))] == --component ]] ; then
# after --build <dir> --component, no idea
return 0
elif [ "$outofbuild" = true ] ; then
elif [ "$out_of_build" = true ] ; then
# after --build <dir> --<not a --build option>, suggest other cmake_build_options (like -Wno-dev)
_arguments "$cmake_build_options[@]" && return 0
else
@ -341,19 +348,16 @@ local -a cmake_help_actions=(
'(- 1)--help-variable-list[List variables with help available and exit]'
'(- 1)--help-variables[Print cmake-variables manual and exit]'
)
_cmake_help() {
_arguments -C -s - help "$cmake_help_actions[@]"
}
# -----------------
# _cmake_list_names
# -----------------
(( $+functions[_cmake_list_names] )) ||
_cmake_list_names() {
local command; command="$@[1]"
local desc; desc="$@[2]"
local opts; opts=($@[3])
local list_names; list_names=(${(f)"$($service $command 2> /dev/null)"})
local command="$@[1]"
local desc="$@[2]"
local opts=($@[3])
local list_names=(${(f)"$($service $command 2> /dev/null)"})
# Older CMake (< 3.0) writes out the version
list_names=(${^list_names##cmake version*})
@ -382,7 +386,7 @@ _cmake_define_property() {
# ----------------------------
(( $+functions[_cmake_define_property_names] )) ||
_cmake_define_property_names() {
local alternatives; alternatives=(
local alternatives=(
'common-property-names:common property name:_cmake_define_common_property_names -qS='
)
local -A cmake_langs
@ -402,8 +406,9 @@ _cmake_define_property_names() {
# ---------------------------------
(( $+functions[_cmake_define_lang_property_names] )) ||
_cmake_define_lang_property_names() {
local cmake_lang="$@[-2]" cmake_lang_desc="$@[-1]"
local properties; properties=(
local cmake_lang="$@[-2]"
local cmake_lang_desc="$@[-1]"
local -a properties=(
"CMAKE_${cmake_lang}_COMPILER:${cmake_lang_desc} compiler"
"CMAKE_${cmake_lang}_COMPILER_LAUNCHER:${cmake_lang_desc} compiler launcher (e.g. ccache)"
"CMAKE_${cmake_lang}_FLAGS:${cmake_lang_desc} compiler flags for all builds"
@ -424,7 +429,7 @@ _cmake_define_lang_property_names() {
# -----------------------------------
(( $+functions[_cmake_define_common_property_names] )) ||
_cmake_define_common_property_names() {
local properties; properties=(
local -a properties=(
'CMAKE_MODULE_PATH:Search path for CMake modules (FindPROJECT.cmake)'
'CMAKE_PREFIX_PATH:Search path for installations (PROJECTConfig.cmake)'
'CMAKE_BUILD_TYPE:Specifies the build type for make based generators'
@ -438,51 +443,87 @@ _cmake_define_common_property_names() {
'CMAKE_UNITY_BUILD:Batch include source files'
)
_describe -t 'common-property-names' 'common property name' properties $@
_describe -t 'common-property-names' 'common property name' properties "$@"
}
local _cmake_build_types=('Debug' 'Release' 'RelWithDebInfo' 'MinSizeRel')
local _cmake_c_standards=(90 99 11)
local _cmake_cxx_standards=(98 11 14 17 20)
# ----------------------------
# _cmake_define_property_values
# ----------------------------
(( $+functions[_cmake_define_property_values] )) ||
_cmake_define_property_values() {
local ret=1
local build_types=('Debug' 'Release' 'RelWithDebInfo' 'MinSizeRel')
local c_standards=(90 99 11 17 23)
local cxx_standards=(98 11 14 17 20 23)
setopt localoptions extendedglob
case $@[-1] in
(CMAKE_BUILD_TYPE) _wanted build-types expl 'build type' _values 'build type' ${_cmake_build_types[@]} && ret=0;;
(BUILD_SHARED_LIBS) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;;
(CMAKE_CXX_STANDARD) _wanted cxx-standards expl 'cxx standard' _values 'cxx standard' ${_cmake_cxx_standards[@]} && ret=0;;
(CMAKE_C_STANDARD) _wanted c-standards expl 'c standard' _values 'c standard' ${_cmake_c_standards[@]} && ret=0;;
(CMAKE_TOOLCHAIN_FILE) _wanted toolchain-files expl 'file' _cmake_toolchain_files && ret=0;;
(CMAKE_COLOR_MAKEFILE) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;;
(CMAKE_RULE_MESSAGES) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;;
(CMAKE_VERBOSE_MAKEFILE) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;;
(CMAKE_UNITY_BUILD) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;;
(CMAKE_INSTALL_PREFIX) _files -/ && ret=0;;
(CMAKE_EXPORT_COMPILE_COMMANDS) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;;
(CMAKE_*_COMPILER) _wanted compilers expl 'compiler' _cmake_compilers && ret=0;;
(CMAKE_*_COMPILER_LAUNCHER) _wanted compilers expl 'compiler launcher' _cmake_launchers && ret=0;;
(CMAKE_*_FLAGS(|_?*)) _message -e compiler-flags 'compiler flags' && _dispatch $service -value-,CPPFLAGS,-default- && ret=0;;
(CMAKE_*_STANDARD_REQUIRED) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;;
(CMAKE_*_EXTENSIONS) _wanted booleans expl 'boolean' _cmake_booleans && ret=0;;
(*) _files && ret=0;;
(CMAKE_BUILD_TYPE)
_wanted build-types expl 'build type' _values 'build type' ${build_types[@]} && ret=0
;;
(BUILD_SHARED_LIBS)
_wanted booleans expl 'boolean' _cmake_booleans && ret=0
;;
(CMAKE_CXX_STANDARD)
_wanted cxx-standards expl 'cxx standard' _values 'cxx standard' ${cxx_standards[@]} && ret=0
;;
(CMAKE_C_STANDARD)
_wanted c-standards expl 'c standard' _values 'c standard' ${c_standards[@]} && ret=0
;;
(CMAKE_TOOLCHAIN_FILE)
_wanted toolchain-files expl 'file' _cmake_toolchain_files && ret=0
;;
(CMAKE_COLOR_MAKEFILE)
_wanted booleans expl 'boolean' _cmake_booleans && ret=0
;;
(CMAKE_RULE_MESSAGES)
_wanted booleans expl 'boolean' _cmake_booleans && ret=0
;;
(CMAKE_VERBOSE_MAKEFILE)
_wanted booleans expl 'boolean' _cmake_booleans && ret=0
;;
(CMAKE_UNITY_BUILD)
_wanted booleans expl 'boolean' _cmake_booleans && ret=0
;;
(CMAKE_INSTALL_PREFIX)
_files -/ && ret=0
;;
(CMAKE_EXPORT_COMPILE_COMMANDS)
_wanted booleans expl 'boolean' _cmake_booleans && ret=0
;;
(CMAKE_*_COMPILER)
_wanted compilers expl 'compiler' _cmake_compilers && ret=0
;;
(CMAKE_*_COMPILER_LAUNCHER)
_wanted compilers expl 'compiler launcher' _cmake_launchers && ret=0
;;
(CMAKE_*_FLAGS(|_?*))
_message -e compiler-flags 'compiler flags' && _dispatch $service -value-,CPPFLAGS,-default- && ret=0
;;
(CMAKE_*_STANDARD_REQUIRED)
_wanted booleans expl 'boolean' _cmake_booleans && ret=0
;;
(CMAKE_*_EXTENSIONS)
_wanted booleans expl 'boolean' _cmake_booleans && ret=0
;;
(*)
_files && ret=0
;;
esac
return ret
}
local -a _cmake_generator_list=(${(f)"$(cmake --help | awk '/^Generators/{flag=1} flag && /^[* ] [^ ]/ {sub(/^[* ] /, ""); sub(/=.*$/, ""); sub(/\[arch\]/, ""); sub(/ *$/, ""); print}')"})
# -----------------
# _cmake_generators
# -----------------
(( $+functions[_cmake_generators] )) ||
_cmake_generators() {
_describe -t generators 'generator' _cmake_generator_list
local -a generators=(
${(f)"$(cmake --help | awk '/^Generators/{flag=1} flag && /^[* ] [^ ]/ {sub(/^[* ] /, ""); sub(/=.*$/, ""); sub(/\[arch\]/, ""); sub(/ *$/, ""); print}')"}
)
_describe -t generators 'generator' generators
}
# ----------------------
@ -519,45 +560,46 @@ _cmake_launchers() {
_command_names -e
}
local -a _cmake_commands=(
'capabilities:Report capabilities built into cmake in JSON format' \
'cat:concat the files and print them to the standard output' \
'chdir:run command in a given directory' \
'compare_files:check if file1 is same as file2' \
'copy:copy files to destination (either file or directory)' \
'copy_directory:copy content of <dir>... directories to destination directory' \
'copy_if_different:copy files if it has changed' \
'echo:displays arguments as text' \
'echo_append:displays arguments as text but no new line' \
'env:run command in a modified environment' \
'environment:display the current environment' \
'make_directory:create parent and <dir> directories' \
'md5sum:create MD5 checksum of files' \
'sha1sum:create SHA1 checksum of files' \
'sha224sum:create SHA224 checksum of files' \
'sha256sum:create SHA256 checksum of files' \
'sha384sum:create SHA384 checksum of files' \
'sha512sum:create SHA512 checksum of files' \
'remove:remove the file(s), use -f to force it' \
'remove_directory:remove directories and their contents' \
'rename:rename a file or directory (on one volume)' \
'rm:remove files or directories' \
'server:start cmake in server mode' \
'sleep:sleep for given number of seconds' \
'tar:create or extract a tar or zip archive' \
'time:run command and display elapsed time' \
'touch:touch a <file>' \
'touch_nocreate:touch a <file> but do not create it' \
'create_symlink:create a symbolic link new -> old' \
'create_hardlink:create a hard link new -> old' \
'true:do nothing with an exit code of 0' \
'false:do nothing with an exit code of 1'
)
_cmake_command() {
_arguments -C \
'-E[CMake command mode]:command:(("${_cmake_commands[@]}"))'
(( $+functions[_cmake_commands] )) ||
_cmake_commands() {
local -a commands=(
'capabilities:Report capabilities built into cmake in JSON format'
'cat:concat the files and print them to the standard output'
'chdir:run command in a given directory'
'compare_files:check if file1 is same as file2'
'copy:copy files to destination (either file or directory)'
'copy_directory:copy content of <dir>... directories to destination directory'
'copy_if_different:copy files if it has changed'
'echo:displays arguments as text'
'echo_append:displays arguments as text but no new line'
'env:run command in a modified environment'
'environment:display the current environment'
'make_directory:create parent and <dir> directories'
'md5sum:create MD5 checksum of files'
'sha1sum:create SHA1 checksum of files'
'sha224sum:create SHA224 checksum of files'
'sha256sum:create SHA256 checksum of files'
'sha384sum:create SHA384 checksum of files'
'sha512sum:create SHA512 checksum of files'
'remove:remove the file(s), use -f to force it'
'remove_directory:remove directories and their contents'
'rename:rename a file or directory (on one volume)'
'rm:remove files or directories'
'server:start cmake in server mode'
'sleep:sleep for given number of seconds'
'tar:create or extract a tar or zip archive'
'time:run command and display elapsed time'
'touch:touch a <file>'
'touch_nocreate:touch a <file> but do not create it'
'create_symlink:create a symbolic link new -> old'
'create_hardlink:create a hard link new -> old'
'true:do nothing with an exit code of 0'
'false:do nothing with an exit code of 1'
)
_describe -t commands 'command' commands
}
local cmake_suggest_build;cmake_suggest_build=(
'--build[build]:build dir:_cmake_suggest_builddirs'
)
@ -573,21 +615,17 @@ elif [ $CURRENT -eq 2 ] ; then
- help \
"$cmake_help_actions[@]" \
- command \
'-E[CMake command mode]:command:( )' \
'-E[CMake command mode]:command:_cmake_commands' \
- build_opts \
"$cmake_build_options[@]" \
- build_cmds \
"$cmake_suggest_build[@]" \
- install_cmds \
"$cmake_suggest_install[@]" && return 0
elif [[ $words[2] = --help* ]] ; then
_cmake_help
elif [[ $words[2] == --build ]] ; then
_cmake_on_build
elif [[ $words[2] == --install ]] ; then
_cmake_on_install
elif [[ $words[2] == -E ]]; then
_cmake_command
else
_arguments "$cmake_build_options[@]"
fi

View File

@ -151,9 +151,9 @@ _conan_cache() {
local ret=1
_arguments -C \
'(- *)'{-h,--help}'[show help message and exit]' \
'1: :(clean path)' \
'*:: :->args'
'(- *)'{-h,--help}'[show help message and exit]' \
'1: :(clean path)' \
'*:: :->args'
case $state in
(args)

View File

@ -48,7 +48,7 @@ _arguments \
'--waitip=[Wait for an address to assigned before forking to the background]: :(4 6)' \
\*{-x,--exit}'[This will signal an existing dhcpcd process running on the interface to exit]: :_net_interfaces' \
'(-y --reboot)'{-y,--reboot}'[Allow reboot seconds before moving to the discover phase if we have an old lease to use]:seconds' \
'1:network interface:_net_interfaces'
'1:network interface:_net_interfaces'
# Local Variables:
# mode: Shell-Script

View File

@ -727,8 +727,8 @@ _flutter_custom_devices() {
_arguments -C \
'(- *)'{-h,--help}'[Print this usage information]' \
'1: :_flutter_custom_devices_subcommands' \
'*:: :->args' \
'1: :_flutter_custom_devices_subcommands' \
'*:: :->args' \
&& ret=0
case $state in

View File

@ -40,29 +40,34 @@
#
# ------------------------------------------------------------------------------
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
_gist() {
local ret=1
_arguments -C \
'(--login)--login[Authenticate gist on this computer.]' \
'(-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.]' \
'(-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]' \
'(-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' \
'(-h --help)'{-h,--help}'[print options help]' \
'(-v --version)'{-v,--version}'[print version]' \
'(-r --read)'{-r,--read}'[Read a gist and print out the contents]:user gists:_gist_read_gists' \
'*: :_files' && ret=0
_arguments \
'(--login)--login[Authenticate gist on this computer.]' \
'(-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.]' \
'(-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:_gist_ids' \
'(-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]' \
'--skip-empty[Skip gisting empty files]' \
'(-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' \
'--delete[Delete a gist]:id:_gist_ids' \
'(- *)'{-h,--help}'[print options help]' \
'(-v --version)'{-v,--version}'[print version]' \
'(-r --read)'{-r,--read}'[Read a gist and print out the contents]:user gists:_gist_ids' \
'*: :_files' && ret=0
return ret
}
_gist_cache_policy() {
# rebuild if cache is more than a day old
@ -71,7 +76,7 @@ _gist_cache_policy() {
(( $#oldp ))
}
_gist_read_gists() {
_gist_ids() {
local update_policy ret=1
zstyle -s ":completion:${curcontext}:" cache-policy update_policy
if [[ -z "$update_policy" ]]; then
@ -79,43 +84,33 @@ _gist_read_gists() {
fi
# stores the gists of the logged in user in the format ID[Description]
_list=()
_cached_gists="user_gists"
local -a gist_list
# retrieve/Write gists from/to cache
if _cache_invalid $_cached_gists || ! _retrieve_cache $_cached_gists; then
_gists=$(gist -l)
if _cache_invalid gist_cached_list || ! _retrieve_cache gist_cached_list; then
if (( $+commands[ruby] )); then
gist_list=(${(f)"$(gist -l | ruby -ne 'puts "#{$1}:#{$2}" if $_ =~ %r{/([^/ ]+)\s+(.+)}')"})
elif (( $+commands[perl])); then
gist_list=(${(f)"$(gist -l | perl -wln -e 'm{/([^/ ]+)\s+(.+)} and print qq($1:$2)')"})
fi
if [ $? -eq 0 ]; then
_store_cache $_cached_gists _gists
if [[ $? -eq 0 ]]; then
_store_cache gist_cached_list gist_list
else
# some error occurred, the user is probably not logged in
# set _gists to an empty string so that no completion is attempted
_gists=""
gist_list=()
fi
else
_retrieve_cache $_cached_gists
fi
if [ -n "$_gists" ]; then
echo "$_gists" | while read -r line; do
# Splitting the gist -l output
url="$(echo "$line" | cut -d " " -f 1 | cut -d "/" -f 4)"
# gists w/o descriptions can have only one column in the output, those
# have their description set to an empty string
description="$(echo "$line" | awk '{if(NF > 1){$1=""; print $0}}')"
_list+=( "${url}[${description}]" )
done
_values "gists" $_list
ret=0
if [[ $#gist_list ]]; then
_describe -t gist_ids 'gist_ids' gist_list
fi
return ret
}
return ret
_gist "$@"
# Local Variables:
# mode: Shell-Script

View File

@ -40,397 +40,357 @@
#
# ------------------------------------------------------------------------------
_git-flow () {
local curcontext="$curcontext" state line
typeset -A opt_args
_git-flow ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'init:Initialize a new git repo with support for the branching model.'
'feature:Manage your feature branches.'
'release:Manage your release branches.'
'hotfix:Manage your hotfix branches.'
'support:Manage your support branches.'
'version:Shows version information.'
)
_describe -t commands 'git flow' subcommands
;;
case $state in
(command)
(options)
case $line[1] in
(init)
_arguments \
-f'[Force setting of gitflow branches, even if already configured]' \
-d'[Use default branch naming conventions and prefixes]'
;;
(version)
;;
(hotfix)
__git-flow-hotfix
;;
(release)
__git-flow-release
;;
(feature)
__git-flow-feature
;;
(support)
__git-flow-support
;;
local -a subcommands
subcommands=(
'init:Initialize a new git repo with support for the branching model.'
'feature:Manage your feature branches.'
'release:Manage your release branches.'
'hotfix:Manage your hotfix branches.'
'support:Manage your support branches.'
'version:Shows version information.'
)
_describe -t commands 'git flow' subcommands
;;
(options)
case $line[1] in
(init)
_arguments \
-f'[Force setting of gitflow branches, even if already configured]' \
-d'[Use default branch naming conventions and prefixes]'
;;
(version)
;;
(hotfix)
__git-flow-hotfix
;;
(release)
__git-flow-release
;;
(feature)
__git-flow-feature
;;
(support)
__git-flow-support
;;
esac
;;
esac
esac
;;
esac
}
__git-flow-release ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
__git-flow-release () {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new release branch.'
'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git flow release`)'
'publish:Publish this release branch to origin.`)'
'track:Track a release branch from origin.`)'
)
_describe -t commands 'git flow release' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
local -a subcommands
subcommands=(
'start:Start a new release branch.'
'finish:Finish a release branch.'
'list:List all your release branches. (Alias to `git flow release`)'
'publish:Publish this release branch to origin.`)'
'track:Track a release branch from origin.`)'
)
_describe -t commands 'git flow release' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':version:__git_flow_version_list'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\
-n'[Don'\''t tag this release]'\
-p'[Push to $ORIGIN after performing finish]'\
-k'[Keep branch after performing finish]'\
':version:__git_flow_version_list'
;;
(publish)
_arguments \
':version:__git_flow_version_list'
;;
(track)
_arguments \
':version:__git_flow_version_list'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':version:__git_flow_version_list'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\
-n'[Don'\''t tag this release]'\
-p'[Push to $ORIGIN after performing finish]'\
-k'[Keep branch after performing finish]'\
':version:__git_flow_version_list'
;;
(publish)
_arguments \
':version:__git_flow_version_list'
;;
(track)
_arguments \
':version:__git_flow_version_list'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git-flow-hotfix ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
__git-flow-hotfix () {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new hotfix branch.'
'finish:Finish a hotfix branch.'
'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
'publish:Publish this hotfix branch to origin`)'
)
_describe -t commands 'git flow hotfix' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
local -a subcommands
subcommands=(
'start:Start a new hotfix branch.'
'finish:Finish a hotfix branch.'
'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
'publish:Publish this hotfix branch to origin`)'
)
_describe -t commands 'git flow hotfix' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':hotfix:__git_flow_version_list'\
':branch-name:__git_flow_branch_names'
;;
(options)
case $line[1] in
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\
-p'[Push to $ORIGIN after performing finish]'\
':hotfix:__git_flow_hotfix_list'
;;
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':hotfix:__git_flow_version_list'\
':branch-name:__git_branch_names'
;;
(publish)
_arguments \
':hotfix:__git_flow_hotfix_list'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-s'[Sign the release tag cryptographically]'\
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
-m'[Use the given tag message]'\
-p'[Push to $ORIGIN after performing finish]'\
':hotfix:__git_flow_hotfix_list'
;;
(publish)
_arguments \
':hotfix:__git_flow_hotfix_list'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git-flow-feature ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
__git-flow-feature () {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new feature branch.'
'finish:Finish a feature branch.'
'list:List all your feature branches. (Alias to `git flow feature`)'
'publish:Publish this feature branch to origin.'
'track:Track a feature branch from origin.'
'diff:Show a diff of changes since this feature branched off.'
'rebase:Rebase a feature branch on top of develop.'
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new feature branch.'
'finish:Finish a feature branch.'
'list:List all your feature branches. (Alias to `git flow feature`)'
'publish:Publish this feature branch to origin.'
'track:Track a feature branch from origin.'
'diff:Show a diff of changes since this feature branched off.'
'rebase:Rebase a feature branch on top of develop.'
'checkout:Check out (switch to) the given feature branch.'
'pull:Pull a feature branch from a remote peer.'
)
_describe -t commands 'git flow feature' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
'pull:Pull a feature branch from a remote peer.'
)
_describe -t commands 'git flow feature' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':feature:__git_flow_feature_list'\
':branch-name:__git_flow_branch_names'
;;
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':feature:__git_flow_feature_list'\
':branch-name:__git_branch_names'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-r'[Finish branch by rebasing first]'\
-k'[Keep branch after performing finish]'\
-D'[Force delete feature branch after finish]'\
':feature:__git_flow_feature_list'
;;
(finish)
_arguments \
-F'[Fetch from origin before performing finish]' \
-r'[Finish branch by rebasing first]'\
-k'[Keep branch after performing finish]'\
-D'[Force delete feature branch after finish]'\
':feature:__git_flow_feature_list'
;;
(publish)
_arguments \
':feature:__git_flow_feature_list'\
;;
(publish)
_arguments \
':feature:__git_flow_feature_list'\
;;
(track)
_arguments \
':feature:__git_flow_feature_list'\
;;
(track)
_arguments \
':feature:__git_flow_feature_list'\
;;
(diff)
_arguments \
':branch:__git_flow_branch_names'\
;;
(diff)
_arguments \
':branch:__git_branch_names'\
;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_flow_branch_names'
;;
(rebase)
_arguments \
-i'[Do an interactive rebase]' \
':branch:__git_branch_names'
;;
(checkout)
_arguments \
':branch:__git_flow_feature_list'\
;;
(checkout)
_arguments \
':branch:__git_flow_feature_list'\
;;
(pull)
_arguments \
':remote:__git_flow_remote'\
':branch:__git_flow_branch_names'
;;
(pull)
_arguments \
':remote:__git_remotes'\
':branch:__git_branch_names'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git-flow-support ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
__git-flow-support() {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
case $state in
(command)
local -a subcommands
subcommands=(
'start:Start a new support branch.'
'list:List all your support branches. (Alias to `git flow support`)'
)
_describe -t commands 'git flow support' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
local -a subcommands
subcommands=(
'start:Start a new support branch.'
'list:List all your support branches. (Alias to `git flow support`)'
)
_describe -t commands 'git flow support' subcommands
_arguments \
-v'[Verbose (more) output]'
;;
(options)
case $line[1] in
(options)
case $line[1] in
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':feature:__git_flow_support_list'\
':branch-name:__git_branch_names'
;;
(start)
_arguments \
-F'[Fetch from origin before performing finish]'\
':feature:__git_flow_support_list'\
':branch-name:__git_flow_branch_names'
;;
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
*)
_arguments \
-v'[Verbose (more) output]'
;;
esac
;;
esac
}
__git_flow_version_list ()
{
local expl
declare -a versions
__git_flow_version_list() {
local expl
local -a versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}})
__git_flow_command_successful || return
versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted versions expl 'version' compadd $versions
_wanted versions expl 'version' compadd $versions
}
__git_flow_feature_list ()
{
local expl
declare -a features
__git_flow_feature_list() {
local expl
local -a features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}})
__git_flow_command_successful || return
features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted features expl 'feature' compadd $features
_wanted features expl 'feature' compadd $features
}
__git_remotes () {
local expl gitdir remotes
__git_flow_remote() {
local expl gitdir remotes
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
__git_command_successful || return
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
__git_flow_command_successful || return
remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
__git_command_successful || return
remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
__git_flow_command_successful || return
# TODO: Should combine the two instead of either or.
if (( $#remotes > 0 )); then
_wanted remotes expl remote compadd $* - $remotes
else
_wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
fi
# TODO: Should combine the two instead of either or.
if (( $#remotes > 0 )); then
_wanted remotes expl remote compadd $* - $remotes
else
_wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
fi
}
__git_flow_hotfix_list ()
{
local expl
declare -a hotfixes
__git_flow_hotfix_list() {
local expl
local -a hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}})
__git_flow_command_successful || return
hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted hotfixes expl 'hotfix' compadd $hotfixes
_wanted hotfixes expl 'hotfix' compadd $hotfixes
}
__git_flow_support_list ()
{
local expl
declare -a support
__git_flow_support_list() {
local expl
local -a support=(${${(f)"$(_call_program support git flow support list 2> /dev/null | tr -d ' |*')"}})
__git_flow_command_successful || return
support=(${${(f)"$(_call_program support git flow support list 2> /dev/null | tr -d ' |*')"}})
__git_command_successful || return
_wanted hotfixes expl 'support' compadd $support
_wanted hotfixes expl 'support' compadd $support
}
__git_flow_branch_names() {
local expl
local -a branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
__git_flow_command_successful || return
__git_branch_names () {
local expl
declare -a branch_names
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
__git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names
_wanted branch-names expl branch-name compadd $* - $branch_names
}
__git_command_successful () {
if (( ${#pipestatus:#0} > 0 )); then
_message 'not a git repository'
return 1
fi
return 0
__git_flow_command_successful() {
if (( ${#pipestatus:#0} > 0 )); then
_message 'not a git repository'
return 1
fi
return 0
}
_git-flow "$@"

View File

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

@ -284,3 +284,11 @@ while (( $#state )); do
done
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

@ -84,3 +84,11 @@ _kitchen_instances() {
}
_kitchen "$@"
# 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

@ -230,7 +230,7 @@ _language_codes() {
case $command in
ISO-639-1)
_language_codes_${${command//-/_}:l} "${@[1,-2]}" && ret=0
_language_codes_${${command//-/_}:l} "${@[1,-2]}" && ret=0
;;
*)
_message "unknown command: $command"

View File

@ -154,3 +154,11 @@ case $state in
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

346
src/_mix
View File

@ -45,196 +45,198 @@
local -a _1st_arguments
_1st_arguments=(
'app.start:Starts all registered apps'
'app.tree:Prints the application tree'
'archive:Lists installed archives'
'archive.build:Archives this project into a .ez file'
'archive.install:Installs an archive locally'
'archive.uninstall:Uninstalls archives'
'clean:Deletes generated application files'
'cmd:Executes the given command'
'compile:Compiles source files'
'deps:Lists dependencies and their status'
"deps.clean:Deletes the given dependencies' files"
'deps.compile:Compiles dependencies'
'deps.get:Gets all out of date dependencies'
'deps.tree:Prints the dependency tree'
'deps.unlock:Unlocks the given dependencies'
'deps.update:Updates the given dependencies'
'do:Executes the tasks separated by comma'
'ecto:Prints Ecto help information'
'ecto.create:Creates the repository storage'
'ecto.drop:Drops the repository storage'
'ecto.dump:Dumps the repository database structure'
'ecto.gen.migration:Generates a new migration for the repo'
'ecto.gen.repo:Generates a new repository'
'ecto.load:Loads previously dumped database structure'
'ecto.migrate:Runs the repository migrations'
'ecto.migrations:Displays the repository migration status'
'ecto.rollback:Rolls back the repository migrations'
'escript:Lists installed escripts'
'escript.build:Builds an escript for the project'
'escript.install:Installs an escript locally'
'escript.uninstall:Uninstalls escripts'
'gettext.extract:Extracts translations from source code'
'gettext.merge:Merge template files into translation files'
'help:Prints help information for tasks'
'hex:Prints Hex help information'
'hex.build:Builds a new package version locally'
'hex.config:Reads, updates or deletes Hex config'
'hex.docs:Fetch or open documentation of a package'
'hex.info:Prints Hex information'
'hex.key:Manages Hex API key'
'hex.outdated:Shows outdated Hex deps for the current project'
'hex.owner:Manages Hex package ownership'
'hex.public_keys:Manages Hex public keys'
'hex.publish:Publishes a new package version'
'hex.retire:Retires a package version'
'hex.search:Searches for package names'
'hex.user:Registers or manages Hex user'
'loadconfig:Loads and persists the given configuration'
'local:Lists local tasks'
'local.hex:Installs Hex locally'
'local.phoenix:Updates Phoenix locally'
'local.phx:Updates the Phoenix project generator locally'
'local.public_keys:Manages public keys'
'local.rebar:Installs Rebar locally'
'new:Creates a new Elixir project'
'phoenix.gen.html:Generates controller, model and views for an HTML based resource'
'phoenix.server:Starts applications and their servers'
'phx.digest:Digests and compresses static files'
'phx.digest.clean:Removes old versions of static assets.'
'phx.gen.auth:Generates a flexible, pre-built authentication system'
'phx.gen.channel:Generates a Phoenix channel'
'phx.gen.context:Generates a context with functions around an Ecto schema'
'phx.gen.html:Generates controller, views, and context for an HTML resource'
'phx.gen.live:Generates controller, context and helper for a LiveView resource'
'phx.gen.json:Generates controller, views, and context for a JSON resource'
'phx.gen.presence:Generates a Presence tracker'
'phx.gen.schema:Generates an Ecto schema and migration file'
'phx.gen.secret:Generates a secret'
'phx.new:Creates a new Phoenix application'
'phx.new.ecto:Creates a new Ecto project within an umbrella project'
'phx.new.web:Creates a new Phoenix web project within an umbrella project'
'phx.routes:Prints all routes'
'phx.server:Starts applications and their servers'
'profile.fprof:Profiles the given file or expression with fprof'
'run:Runs the given file or expression'
"test:Runs a project's tests"
'xref:Performs cross reference checks'
'--help:Describe available tasks'
'--version:Prints the Elixir version information'
'app.start:Starts all registered apps'
'app.tree:Prints the application tree'
'archive:Lists installed archives'
'archive.build:Archives this project into a .ez file'
'archive.install:Installs an archive locally'
'archive.uninstall:Uninstalls archives'
'clean:Deletes generated application files'
'cmd:Executes the given command'
'compile:Compiles source files'
'deps:Lists dependencies and their status'
"deps.clean:Deletes the given dependencies' files"
'deps.compile:Compiles dependencies'
'deps.get:Gets all out of date dependencies'
'deps.tree:Prints the dependency tree'
'deps.unlock:Unlocks the given dependencies'
'deps.update:Updates the given dependencies'
'do:Executes the tasks separated by comma'
'ecto:Prints Ecto help information'
'ecto.create:Creates the repository storage'
'ecto.drop:Drops the repository storage'
'ecto.dump:Dumps the repository database structure'
'ecto.gen.migration:Generates a new migration for the repo'
'ecto.gen.repo:Generates a new repository'
'ecto.load:Loads previously dumped database structure'
'ecto.migrate:Runs the repository migrations'
'ecto.migrations:Displays the repository migration status'
'ecto.rollback:Rolls back the repository migrations'
'escript:Lists installed escripts'
'escript.build:Builds an escript for the project'
'escript.install:Installs an escript locally'
'escript.uninstall:Uninstalls escripts'
'gettext.extract:Extracts translations from source code'
'gettext.merge:Merge template files into translation files'
'help:Prints help information for tasks'
'hex:Prints Hex help information'
'hex.build:Builds a new package version locally'
'hex.config:Reads, updates or deletes Hex config'
'hex.docs:Fetch or open documentation of a package'
'hex.info:Prints Hex information'
'hex.key:Manages Hex API key'
'hex.outdated:Shows outdated Hex deps for the current project'
'hex.owner:Manages Hex package ownership'
'hex.public_keys:Manages Hex public keys'
'hex.publish:Publishes a new package version'
'hex.retire:Retires a package version'
'hex.search:Searches for package names'
'hex.user:Registers or manages Hex user'
'loadconfig:Loads and persists the given configuration'
'local:Lists local tasks'
'local.hex:Installs Hex locally'
'local.phoenix:Updates Phoenix locally'
'local.phx:Updates the Phoenix project generator locally'
'local.public_keys:Manages public keys'
'local.rebar:Installs Rebar locally'
'new:Creates a new Elixir project'
'phoenix.gen.html:Generates controller, model and views for an HTML based resource'
'phoenix.server:Starts applications and their servers'
'phx.digest:Digests and compresses static files'
'phx.digest.clean:Removes old versions of static assets.'
'phx.gen.auth:Generates a flexible, pre-built authentication system'
'phx.gen.channel:Generates a Phoenix channel'
'phx.gen.context:Generates a context with functions around an Ecto schema'
'phx.gen.html:Generates controller, views, and context for an HTML resource'
'phx.gen.live:Generates controller, context and helper for a LiveView resource'
'phx.gen.json:Generates controller, views, and context for a JSON resource'
'phx.gen.presence:Generates a Presence tracker'
'phx.gen.schema:Generates an Ecto schema and migration file'
'phx.gen.secret:Generates a secret'
'phx.new:Creates a new Phoenix application'
'phx.new.ecto:Creates a new Ecto project within an umbrella project'
'phx.new.web:Creates a new Phoenix web project within an umbrella project'
'phx.routes:Prints all routes'
'phx.server:Starts applications and their servers'
'profile.fprof:Profiles the given file or expression with fprof'
'run:Runs the given file or expression'
"test:Runs a project's tests"
'xref:Performs cross reference checks'
'--help:Describe available tasks'
'--version:Prints the Elixir version information'
)
__task_list ()
{
local expl
declare -a tasks
__task_list () {
local expl
declare -a tasks
tasks=(
'app.start'
'app.tree'
'archive'
'archive.build'
'archive.install'
'archive.uninstall'
'clean'
'cmd'
'compile'
'deps'
'deps.clean'
'deps.compile'
'deps.get'
'deps.tree'
'deps.unlock'
'deps.update'
'do'
'ecto'
'ecto.create'
'ecto.drop'
'ecto.dump'
'ecto.gen.migration'
'ecto.gen.repo'
'ecto.load'
'ecto.migrate'
'ecto.migrations'
'ecto.rollback'
'escript'
'escript.build'
'escript.install'
'escript.uninstall'
'gettext.extract'
'gettext.merge'
'format'
'help'
'hex'
'hex.build'
'hex.config'
'hex.docs'
'hex.info'
'hex.key'
'hex.outdated'
'hex.owner'
'hex.public_keys'
'hex.publish'
'hex.retire'
'hex.search'
'hex.user'
'loadconfig'
'local'
'local.hex'
'local.public_keys'
'local.rebar'
'new'
'phoenix.gen.html'
'phoenix.server'
'phx.digest'
'phx.digest.clean'
'phx.gen.auth'
'phx.gen.channel'
'phx.gen.context'
'phx.gen.html'
'phx.gen.live'
'phx.gen.json'
'phx.gen.presence'
'phx.gen.schema'
'phx.gen.secret'
'phx.routes'
'phx.server'
'profile.fprof'
'run'
'test'
'xref'
)
tasks=(
'app.start'
'app.tree'
'archive'
'archive.build'
'archive.install'
'archive.uninstall'
'clean'
'cmd'
'compile'
'deps'
'deps.clean'
'deps.compile'
'deps.get'
'deps.tree'
'deps.unlock'
'deps.update'
'do'
'ecto'
'ecto.create'
'ecto.drop'
'ecto.dump'
'ecto.gen.migration'
'ecto.gen.repo'
'ecto.load'
'ecto.migrate'
'ecto.migrations'
'ecto.rollback'
'escript'
'escript.build'
'escript.install'
'escript.uninstall'
'gettext.extract'
'gettext.merge'
'format'
'help'
'hex'
'hex.build'
'hex.config'
'hex.docs'
'hex.info'
'hex.key'
'hex.outdated'
'hex.owner'
'hex.public_keys'
'hex.publish'
'hex.retire'
'hex.search'
'hex.user'
'loadconfig'
'local'
'local.hex'
'local.public_keys'
'local.rebar'
'new'
'phoenix.gen.html'
'phoenix.server'
'phx.digest'
'phx.digest.clean'
'phx.gen.auth'
'phx.gen.channel'
'phx.gen.context'
'phx.gen.html'
'phx.gen.live'
'phx.gen.json'
'phx.gen.presence'
'phx.gen.schema'
'phx.gen.secret'
'phx.routes'
'phx.server'
'profile.fprof'
'run'
'test'
'xref'
)
_wanted tasks expl 'help' compadd $tasks
_wanted tasks expl 'help' compadd $tasks
}
local expl
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
':command:->command' \
'*::options:->options'
case $state in
(command)
_describe -t commands "mix subcommand" _1st_arguments
return
;;
_describe -t commands "mix subcommand" _1st_arguments
;;
(options)
case $line[1] in
(help)
_arguments ':feature:__task_list'
return
;;
_arguments ':feature:__task_list'
;;
(test|format|run)
_arguments ':PATH:_files'
return
;;
_arguments ':PATH:_files'
;;
esac
;;
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

@ -106,3 +106,11 @@ _describe 'command' instances
# Reference:
# https://zsh.sourceforge.net/Doc/Release/Completion-System.html
# https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org
# 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

@ -104,11 +104,11 @@ _mvn() {
if [[ $maven_version == 'maven4' ]]; then
opts+=(
"($excl_opts -canf --cache-artifact-not-found)"{-canf,--cache-artifact-not-found}'[defines caching behaviour for not found artifacts]: :(false true)'
"($excl_opts -fos --fail-on-severity)"{-fos,--fail-on-severity}'[configure which severity of logging should cause the build to fail]: :(WARN ERROR)'
"($excl_opts -itr --ignore-transitive-repositories)"{-itr,--ignore-transitive-repositories}'[if set, Maven will ignore remote repositories introduced by transitive dependencies]'
"($excl_opts --non-interactive)"'--non-interactive[run in non-interactive mode. Alias for --batch-mode]'
"($excl_opts -r --resume)"{-r,--resume}'[resume reactor from the last failed project, using the resume.properties file in the build directory]'
"($excl_opts -canf --cache-artifact-not-found)"{-canf,--cache-artifact-not-found}'[defines caching behaviour for not found artifacts]: :(false true)'
"($excl_opts -fos --fail-on-severity)"{-fos,--fail-on-severity}'[configure which severity of logging should cause the build to fail]: :(WARN ERROR)'
"($excl_opts -itr --ignore-transitive-repositories)"{-itr,--ignore-transitive-repositories}'[if set, Maven will ignore remote repositories introduced by transitive dependencies]'
"($excl_opts --non-interactive)"'--non-interactive[run in non-interactive mode. Alias for --batch-mode]'
"($excl_opts -r --resume)"{-r,--resume}'[resume reactor from the last failed project, using the resume.properties file in the build directory]'
)
fi

View File

@ -144,3 +144,11 @@ local options=(
)
_arguments $options "*::func_name:($func_names)"
# 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

@ -12,278 +12,280 @@
# * Markus Richter ( https://github.com/mqus , <mqus@disroot.org>)
#
# ------------------------------------------------------------------------------
_nft(){
local -a rules states prev args families options descriptors
local state="start" line nextstate cmd_obj cmd_subcmd cmd_fam cmd_tab cmd_chain #curcontext="$curcontext"
local -a rules states prev args families options descriptors
local state="start" line nextstate cmd_obj cmd_subcmd cmd_fam cmd_tab cmd_chain #curcontext="$curcontext"
options=(
'(-)'{-h,--help}'[show help]' \
'(-)'{-v,--version}'[print version information]' \
"(-i --interactive)"{-i,--interactive}'[read input from interactive CLI]: :->end' \
"(-f --file)"{-f,--file}'[read input from <filename>]:nftables rule file:_files' \
'(-c --check -n --numeric -N)'{-c,--check}"[check command's validity without actually applying the changes]" \
'(-j --json)'{-j,--json}'[format output in json]' \
'(-c --check -N)*'{-n,--numeric}'[can be specified up to 3 times, Shows 1:network addresses(default behaviour), 2:internet services (port numbers) and 3:protocols, user IDs, and group IDs numerically]' \
'(-s --stateless)'{-s,--stateless}'[omit stateful information of ruleset]' \
'(-N -n --numeric -c --check)'-N'[translate IP addresses to names]' \
'(-a --handle)'{-a,--handle}'[output rule handle]' \
'(-e --echo)'{-e,--echo}'[echo what has been added, inserted or replaced]' \
{-I,--includepath}'[add specified directory to the paths searched for include files]:include directory [/usr/share]:include directory:_directories'
)
options=(
'(-)'{-h,--help}'[show help]'
'(-)'{-v,--version}'[print version information]'
"(-i --interactive)"{-i,--interactive}'[read input from interactive CLI]: :->end'
"(-f --file)"{-f,--file}'[read input from <filename>]:nftables rule file:_files'
'(-c --check -n --numeric -N)'{-c,--check}"[check command's validity without actually applying the changes]"
'(-j --json)'{-j,--json}'[format output in json]'
'(-c --check -N)*'{-n,--numeric}'[can be specified up to 3 times, Shows 1:network addresses(default behaviour), 2:internet services (port numbers) and 3:protocols, user IDs, and group IDs numerically]'
'(-s --stateless)'{-s,--stateless}'[omit stateful information of ruleset]'
'(-N -n --numeric -c --check)'-N'[translate IP addresses to names]'
'(-a --handle)'{-a,--handle}'[output rule handle]'
'(-e --echo)'{-e,--echo}'[echo what has been added, inserted or replaced]'
{-I,--includepath}'[add specified directory to the paths searched for include files]:include directory [/usr/share]:include directory:_directories'
)
# start a state machine. The state is modified by _arguments if the
# current argument (descriptors) cannot be completed. Each state has to define is successive state and the
# 'descriptors' for _arguments, which essentially tells _arguments how to complete
local _i=0
while true;do
(( _i+=1 ))
#Guard for endless loops
[[ $_i -gt 100 ]] && return 1
# start a state machine. The state is modified by _arguments if the
# current argument (descriptors) cannot be completed. Each state has to define is successive state and the
# 'descriptors' for _arguments, which essentially tells _arguments how to complete
local _i=0
while true;do
(( _i+=1 ))
#Guard for endless loops
[[ $_i -gt 100 ]] && return 1
descriptors=()
nextstate="end"
case $state in
(start)
##if line is empty (at the start) or ends with semicolon, autocomplete subcommands,
# else if we are after a space,complete a semicolon (end the current nft command) and start anew
if [[ $line[1] = "" || $line[1] =~ ';$' ]] ; then
descriptors=( ":: :_nft_subcommands" )
nextstate="category"
else
if [[ $words =~ ' $' ]]; then
descriptors=(':: :(\;)')
else
descriptors=(':argument: ')
fi
descriptors=()
nextstate="end"
case $state in
(start)
##if line is empty (at the start) or ends with semicolon, autocomplete subcommands,
# else if we are after a space,complete a semicolon (end the current nft command) and start anew
if [[ $line[1] = "" || $line[1] =~ ';$' ]] ; then
descriptors=( ":: :_nft_subcommands" )
nextstate="category"
else
if [[ $words =~ ' $' ]]; then
descriptors=(':: :(\;)')
else
descriptors=(':argument: ')
fi
nextstate="start"
fi
;;
(category)
case $line[1] in
(add | list | flush | delete | create | rename | insert | replace | reset)
descriptors=( ":: :_nft_${line[1]}" )
nextstate=$line[1]
;;
(monitor)
descriptors=( ":: : _nft_mon_filter" )
nextstate="mon1"
;;
(export)
descriptors=( ":: :(ruleset)" ":: :_nft_out_format" )
nextstate="preend"
;;
(describe)
descriptors=( ":expression: ")
nextstate="start" #x restart
;;
(*)
return 1;
;;
esac
#descriptors=( "(ruleset)" )
#nextstate="end"
;;
(mon1)
case $line[1] in
(new | destroy)
# descriptors=( ":: :_nft_mon_keywords" ":: :_nft_out_format")
descriptors=( ":: : _nft_mon_keywords")
nextstate="mon1"
;;
(tables | chains | sets | rules | elements | ruleset)
descriptors=( ":: : _nft_out_format")
nextstate="preend"
;;
esac
;;
#all completions for create and insert match with the completions of add
(create | insert)
state="add"
;|
#all completions for reset and flush match with the completions of list
(reset | flush)
state="list"
;|
#(add(^table)/create(^table)/delete/flush(^ruleset)/insert/list(^ruleset)/rename/replace)[family]table
(reset | delete | insert | rename | replace | add | create | flush | list)
if [[ $state = "add" && $line[1] = "table" ]]; then
descriptors=( ":: :_nft_families" ":table name:")
nextstate="start" #x restart
elif [[ $state = "list" && ( $line[1] = "ruleset" || $line[1] = "tables" ) ]]; then
descriptors=( ":: :_nft_families")
nextstate="start" #x restart
elif [[ $state = "delete" && $line[1] = "table" ]]; then
descriptors=(": : _nft_table all-handle")
nextstate="tcomplete-delete-table"
else
cmd_obj=$line[1]
cmd_subcmd=$state
descriptors=(": : _nft_table all")
nextstate="tcomplete"
fi
;;
(tcomplete-delete-table)
# if only a family was completed, complete the table name.
case $line[1] in
(arp | bridge | inet | ip | ip6 | netdev)
descriptors=(": : _nft_table ${line[1]}-handle")
cmd_fam=$line[1]
;;
# if 'handle' was completed, complete the handle number.
(handle)
descriptors=(": : _nft_table_handle_all " )
;;
# else, complete nothing and go to the next state. default family is 'ip'
(*)
descriptors=()
cmd_fam="ip"
;;
esac
nextstate="delete-table"
;;
(tcomplete)
# if only a family was completed, complete the table name.
case $line[1] in
(arp | bridge | inet | ip | ip6 | netdev)
descriptors=(": : _nft_table ${line[1]}")
cmd_fam=$line[1]
;;
# else, complete nothing and go to the next state. default family is 'ip'
(*)
descriptors=()
cmd_fam="ip"
;;
esac
nextstate="$cmd_subcmd-$cmd_obj"
;;
(list-table)
descriptors=(":: :(\;)")
nextstate="start"
;;
(delete-table)
#if family AND handle were input, complete handle number for given family.
if [[ $line[1] == "handle" ]]; then
descriptors=(":table handle: _nft_table_handle $cmd_fam" )
else
descriptors=()
fi
nextstate="start"
;;
(delete-chain | delete-set | delete-quota | delete-counter | delete-ct\\ helper)
cmd_tab=$line[1]
descriptors=(": : _nft_object $cmd_fam $cmd_tab $cmd_obj true")
nextstate="delete-obj-handle"
;;
(delete-obj-handle)
if [[ $line[1] == "handle" ]]; then
descriptors=(": : _nft_object_handle $cmd_fam $cmd_tab $cmd_obj")
else
descriptors=(": :(\;)")
fi
nextstate="start"
;;
(add-chain)
descriptors=(":chain name:")
nextstate="start"
;;
(rename-chain)
cmd_tab=$line[1]
descriptors=(": : _nft_object $cmd_fam $cmd_tab chain false")
nextstate="add-chain"
;;
(replace-rule | delete-rule)
cmd_tab=$line[1]
descriptors=(": : _nft_object $cmd_fam $cmd_tab chain false")
nextstate="repdel-rule"
;;
(repdel-rule)
cmd_chain=$line[1]
descriptors=(": :(handle)" ": : _nft_rule_handle $cmd_fam $cmd_tab ${line[1]}")
if [[ $cmd_subcmd = "replace" ]];then
nextstate="rule-stmt"
else
nextstate="start"
fi
;;
(add-rule)
cmd_tab=$line[1]
descriptors=(": : _nft_object $cmd_fam $cmd_tab chain false")
nextstate="add-rule-2"
;;
(add-rule-2)
cmd_chain=$line[1]
descriptors=(": :(handle index position)")
nextstate="add-rule-3"
;;
(add-rule-3)
case $line[1] in
(index | position)
descriptors=(":${line[1]}:")
;;
(handle)
descriptors=(": : _nft_rule_handle $cmd_fam $cmd_tab $cmd_chain")
;;
(*)
descriptors=()
;;
esac
nextstate="rule-stmt"
;;
(rule-stmt)
#TODO
# _nft_rule $cmd_fam $cmd_tab $cmd_chain\
# && return 0;
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)
cmd_tab=$line[1]
descriptors=(": : _nft_object $cmd_fam $cmd_tab $cmd_obj false")
nextstate="start"
fi
;;
(category)
case $line[1] in
(add | list | flush | delete | create | rename | insert | replace | reset)
descriptors=( ":: :_nft_${line[1]}" )
nextstate=$line[1]
;;
(monitor)
descriptors=( ":: : _nft_mon_filter" )
nextstate="mon1"
;;
(export)
descriptors=( ":: :(ruleset)" ":: :_nft_out_format" )
nextstate="preend"
;;
(describe)
descriptors=( ":expression: ")
nextstate="start" #x restart
;;
(*)
return 1;
;;
esac
;;
(add-element | delete-element)
cmd_tab=$line[1]
descriptors=(": : _nft_object $cmd_fam $cmd_tab '\(map\|set\)' false")
nextstate="start"
;;
#TODO:
#(add-set | add-map)
#(add-flowtable)
#("add-ct\ helper")
#(add-counter)
#(add-quota)
#descriptors=( "(ruleset)" )
#nextstate="end"
;;
(mon1)
case $line[1] in
(new | destroy)
# descriptors=( ":: :_nft_mon_keywords" ":: :_nft_out_format")
descriptors=( ":: : _nft_mon_keywords")
nextstate="mon1"
;;
(tables | chains | sets | rules | elements | ruleset)
descriptors=( ":: : _nft_out_format")
nextstate="preend"
;;
(*)
return 1;
;;
esac
;;
#all completions for create and insert match with the completions of add
(create | insert)
state="add"
;|
#all completions for reset and flush match with the completions of list
(reset | flush)
state="list"
;|
#(add(^table)/create(^table)/delete/flush(^ruleset)/insert/list(^ruleset)/rename/replace)[family]table
(reset | delete | insert | rename | replace | add | create | flush | list)
if [[ $state = "add" && $line[1] = "table" ]]; then
descriptors=( ":: :_nft_families" ":table name:")
nextstate="start" #x restart
elif [[ $state = "list" && ( $line[1] = "ruleset" || $line[1] = "tables" ) ]]; then
descriptors=( ":: :_nft_families")
nextstate="start" #x restart
elif [[ $state = "delete" && $line[1] = "table" ]]; then
descriptors=(": : _nft_table all-handle")
nextstate="tcomplete-delete-table"
else
cmd_obj=$line[1]
cmd_subcmd=$state
descriptors=(": : _nft_table all")
nextstate="tcomplete"
fi
;;
(tcomplete-delete-table)
# if only a family was completed, complete the table name.
case $line[1] in
(arp | bridge | inet | ip | ip6 | netdev)
descriptors=(": : _nft_table ${line[1]}-handle")
cmd_fam=$line[1]
;;
# if 'handle' was completed, complete the handle number.
(handle)
descriptors=(": : _nft_table_handle_all " )
;;
# else, complete nothing and go to the next state. default family is 'ip'
(*)
descriptors=()
cmd_fam="ip"
;;
esac
nextstate="delete-table"
;;
(tcomplete)
# if only a family was completed, complete the table name.
case $line[1] in
(arp | bridge | inet | ip | ip6 | netdev)
descriptors=(": : _nft_table ${line[1]}")
cmd_fam=$line[1]
;;
# else, complete nothing and go to the next state. default family is 'ip'
(*)
descriptors=()
cmd_fam="ip"
;;
esac
nextstate="$cmd_subcmd-$cmd_obj"
;;
(list-table)
descriptors=(":: :(\;)")
nextstate="start"
;;
(delete-table)
#if family AND handle were input, complete handle number for given family.
if [[ $line[1] == "handle" ]]; then
descriptors=(":table handle: _nft_table_handle $cmd_fam" )
else
descriptors=()
fi
nextstate="start"
;;
(delete-chain | delete-set | delete-quota | delete-counter | delete-ct\\ helper)
cmd_tab=$line[1]
descriptors=(": : _nft_object $cmd_fam $cmd_tab $cmd_obj true")
nextstate="delete-obj-handle"
;;
(delete-obj-handle)
if [[ $line[1] == "handle" ]]; then
descriptors=(": : _nft_object_handle $cmd_fam $cmd_tab $cmd_obj")
else
descriptors=(": :(\;)")
fi
nextstate="start"
;;
(add-chain)
descriptors=(":chain name:")
nextstate="start"
;;
(rename-chain)
cmd_tab=$line[1]
descriptors=(": : _nft_object $cmd_fam $cmd_tab chain false")
nextstate="add-chain"
;;
(replace-rule | delete-rule)
cmd_tab=$line[1]
descriptors=(": : _nft_object $cmd_fam $cmd_tab chain false")
nextstate="repdel-rule"
;;
(repdel-rule)
cmd_chain=$line[1]
descriptors=(": :(handle)" ": : _nft_rule_handle $cmd_fam $cmd_tab ${line[1]}")
if [[ $cmd_subcmd = "replace" ]];then
nextstate="rule-stmt"
else
nextstate="start"
fi
;;
(add-rule)
cmd_tab=$line[1]
descriptors=(": : _nft_object $cmd_fam $cmd_tab chain false")
nextstate="add-rule-2"
;;
(add-rule-2)
cmd_chain=$line[1]
descriptors=(": :(handle index position)")
nextstate="add-rule-3"
;;
(add-rule-3)
case $line[1] in
(index | position)
descriptors=(":${line[1]}:")
;;
(handle)
descriptors=(": : _nft_rule_handle $cmd_fam $cmd_tab $cmd_chain")
;;
(*)
descriptors=()
;;
esac
nextstate="rule-stmt"
;;
(rule-stmt)
#TODO
# _nft_rule $cmd_fam $cmd_tab $cmd_chain\
# && return 0;
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)
cmd_tab=$line[1]
descriptors=(": : _nft_object $cmd_fam $cmd_tab $cmd_obj false")
nextstate="start"
;;
(add-element | delete-element)
cmd_tab=$line[1]
descriptors=(": : _nft_object $cmd_fam $cmd_tab '\(map\|set\)' false")
nextstate="start"
;;
#TODO:
#(add-set | add-map)
#(add-flowtable)
#("add-ct\ helper")
#(add-counter)
#(add-quota)
_arguments -C -s \
"${options[@]}" \
"${descriptors[@]}" \
"*:: :->$nextstate" \
&& return 0;
(*)
return 1;
;;
esac
_arguments -C -s \
"${options[@]}" \
"${descriptors[@]}" \
"*:: :->$nextstate" \
&& return 0;
done
done
} # end _nft
_nft_subcommands(){
local commands=(
'add:add a table, chain, rule, set, map, or object'
'list:list a ruleset, table, chain, set, map, or object'
'flush:flush (delete everything from) a ruleset, table, chain, set, or map'
'export:print the ruleset in a machine readable format (json or xml)'
'delete:delete a table, chain, rule, set, element, map, or object'
'create:similar to add but returns an error for existing chain'
'rename:rename the specified chain'
'insert:similar to the add command, but the rule is prepended to the beginning of the chain or before the rule at the given position'
'replace:similar to the add command, but replaces the specified rule'
'reset:list-and-reset stateful object'
'monitor:listen to Netlink events'
'describe:show information about the type of an expression and its data type'
'add:add a table, chain, rule, set, map, or object'
'list:list a ruleset, table, chain, set, map, or object'
'flush:flush (delete everything from) a ruleset, table, chain, set, or map'
'export:print the ruleset in a machine readable format (json or xml)'
'delete:delete a table, chain, rule, set, element, map, or object'
'create:similar to add but returns an error for existing chain'
'rename:rename the specified chain'
'insert:similar to the add command, but the rule is prepended to the beginning of the chain or before the rule at the given position'
'replace:similar to the add command, but replaces the specified rule'
'reset:list-and-reset stateful object'
'monitor:listen to Netlink events'
'describe:show information about the type of an expression and its data type'
)
_describe -t commands 'nft subcommand' commands "$@"
}
_nft_mon_filter(){
local monitor_filters=(
'new:show only events of created objects'

View File

@ -1112,22 +1112,22 @@ _openssl_genpkey() {
done
_arguments \
'(- *)-help[print help message]' \
'-out[output private key file]:file:_files' \
'-outpubkey[output public key file]:file:_files' \
'-outform[output format]:format:(DER PEM)' \
'-verbose[output "status dots" while generating keys]' \
'-quiet[do not output "status dots" while generating keys]' \
'-pass[output file password source]:source:_openssl_pass_phrase_options' \
$cipher_flags[@] \
'-algorithm[public key algorithm]:alg:(($builtin_algorithms))' \
'-pkeyopt[public key algorithm option]:option' \
'-genparam[generate a set of parameters instead of a private key]' \
'-paramfile[file to supply public key parameters]:file:_files' \
'-text[print an (unencrypted) text representation of private and public keys and parameters]' \
$openssl_random_state_options[@] \
$openssl_provider_options[@] \
'-config[configuration file]:file:_files'
'(- *)-help[print help message]' \
'-out[output private key file]:file:_files' \
'-outpubkey[output public key file]:file:_files' \
'-outform[output format]:format:(DER PEM)' \
'-verbose[output "status dots" while generating keys]' \
'-quiet[do not output "status dots" while generating keys]' \
'-pass[output file password source]:source:_openssl_pass_phrase_options' \
$cipher_flags[@] \
'-algorithm[public key algorithm]:alg:(($builtin_algorithms))' \
'-pkeyopt[public key algorithm option]:option' \
'-genparam[generate a set of parameters instead of a private key]' \
'-paramfile[file to supply public key parameters]:file:_files' \
'-text[print an (unencrypted) text representation of private and public keys and parameters]' \
$openssl_random_state_options[@] \
$openssl_provider_options[@] \
'-config[configuration file]:file:_files'
}
_openssl_genrsa() {
@ -1441,17 +1441,17 @@ _openssl_pkcs12() {
_openssl_pkcs7() {
_arguments \
'(- *)-help[print help message]' \
'-inform[input format]:format:(DER PEM)' \
'-outform[output format]:format:(DER PEM)' \
'-in[input file name]:file:_files' \
'-out[output file name]:file:_files' \
'-print[print out the full PKCS7 object]' \
'-print_certs[print out any certificates or CRLs contained in the file]' \
'-quiet[print out just the PEM-encoded certificates without any other output]' \
'-text[print out certificate details in full]' \
'-noout[do not output the encoded version of the PKCS#7 structure]' \
$openssl_provider_options[@]
'(- *)-help[print help message]' \
'-inform[input format]:format:(DER PEM)' \
'-outform[output format]:format:(DER PEM)' \
'-in[input file name]:file:_files' \
'-out[output file name]:file:_files' \
'-print[print out the full PKCS7 object]' \
'-print_certs[print out any certificates or CRLs contained in the file]' \
'-quiet[print out just the PEM-encoded certificates without any other output]' \
'-text[print out certificate details in full]' \
'-noout[do not output the encoded version of the PKCS#7 structure]' \
$openssl_provider_options[@]
}
_openssl_pkcs8() {
@ -1460,51 +1460,51 @@ _openssl_pkcs8() {
)
_arguments \
'(- *)-help[print help message]' \
'-topk8[read a private key and write a PkCS#8 format key]' \
'-inform[input format]:format:(DER PEM)' \
'-outform[output format]:format:(DER PEM)' \
'-traditional[traditional format]' \
'-in[input file name]:file:_files' \
'-passin[input password source]:source:_openssl_pass_phrase_options' \
'-passout[output password source]:source:_openssl_pass_phrase_options' \
'-out[output file name]:files:_files' \
'-iter[number of iterations to create PKCS#8 containers]:count' \
'-noiter[use 1 as iteration count]' \
'-nocrypt[output unencrypted PrivateKeyInfo structure]' \
'-v2[algorithm for PKCS#5 v2.0]:alg:_openssl_cipher_algorithms' \
'-v2prf[PRF algorithm to use with PKCS#5 v2.0]:alg:(($prf_algorithms))' \
'-v1[algorithm for PKCS#5 v1.5 or PKCS#12]:alg:_openssl_cipher_algorithms' \
'-scrypt[use the script algorithm for private key encryption]' \
'-scrypt_N[scrypt "N" parameter]:n' \
'-scrypt_r[scrypt "r" parameter]:r' \
'-scrypt_p[scrypt "p" parameter]:p' \
'-saltlen[length of the salt to use for the PBE algorithm]:length' \
$openssl_random_state_options[@] \
$openssl_provider_options[@]
'(- *)-help[print help message]' \
'-topk8[read a private key and write a PkCS#8 format key]' \
'-inform[input format]:format:(DER PEM)' \
'-outform[output format]:format:(DER PEM)' \
'-traditional[traditional format]' \
'-in[input file name]:file:_files' \
'-passin[input password source]:source:_openssl_pass_phrase_options' \
'-passout[output password source]:source:_openssl_pass_phrase_options' \
'-out[output file name]:files:_files' \
'-iter[number of iterations to create PKCS#8 containers]:count' \
'-noiter[use 1 as iteration count]' \
'-nocrypt[output unencrypted PrivateKeyInfo structure]' \
'-v2[algorithm for PKCS#5 v2.0]:alg:_openssl_cipher_algorithms' \
'-v2prf[PRF algorithm to use with PKCS#5 v2.0]:alg:(($prf_algorithms))' \
'-v1[algorithm for PKCS#5 v1.5 or PKCS#12]:alg:_openssl_cipher_algorithms' \
'-scrypt[use the script algorithm for private key encryption]' \
'-scrypt_N[scrypt "N" parameter]:n' \
'-scrypt_r[scrypt "r" parameter]:r' \
'-scrypt_p[scrypt "p" parameter]:p' \
'-saltlen[length of the salt to use for the PBE algorithm]:length' \
$openssl_random_state_options[@] \
$openssl_provider_options[@]
}
_openssl_pkey() {
_arguments \
'(- *)-help[print help message]' \
$openssl_provider_options[@] \
'-check[check the consistency of a key pair for both public and private components]' \
'-pubcheck[check the correctness of either a public key or the public components of a key pair]' \
'-in[input file or URI]:file_or_uri:_files' \
'-inform[key input format]:format:(DER PEM P12 ENGINE)' \
'-passin[password source for the key input]:source:_openssl_pass_phrase_options' \
'-pubin[read public key instead of private key]' \
'-out[output file name]' \
'-outform[key output format]:format:(DER PEM)' \
'-cipher[cipher to encrypt the PEM encoded private key]:cipher:_openssl_ciphers' \
'-passout[password source for the output file]:source:_openssl_pass_phrase_options' \
'-traditional[use older "traditional" format]' \
'-pubout[output the public components]' \
'-noout[do not output the key in encoded form]' \
'-text[output the various key components in plain text]' \
'-text_pub[output only the public key components in text form]' \
'-ec_conv_form[specify how the points on the elliptic-curve curve are converted into octet strings]:type:(compressed uncompressed hybrid)' \
'-ec_param_enc[specify how the elliptic curve parameters are encoded]:type:(named_curve explicit)'
'(- *)-help[print help message]' \
$openssl_provider_options[@] \
'-check[check the consistency of a key pair for both public and private components]' \
'-pubcheck[check the correctness of either a public key or the public components of a key pair]' \
'-in[input file or URI]:file_or_uri:_files' \
'-inform[key input format]:format:(DER PEM P12 ENGINE)' \
'-passin[password source for the key input]:source:_openssl_pass_phrase_options' \
'-pubin[read public key instead of private key]' \
'-out[output file name]' \
'-outform[key output format]:format:(DER PEM)' \
'-cipher[cipher to encrypt the PEM encoded private key]:cipher:_openssl_ciphers' \
'-passout[password source for the output file]:source:_openssl_pass_phrase_options' \
'-traditional[use older "traditional" format]' \
'-pubout[output the public components]' \
'-noout[do not output the key in encoded form]' \
'-text[output the various key components in plain text]' \
'-text_pub[output only the public key components in text form]' \
'-ec_conv_form[specify how the points on the elliptic-curve curve are converted into octet strings]:type:(compressed uncompressed hybrid)' \
'-ec_param_enc[specify how the elliptic curve parameters are encoded]:type:(named_curve explicit)'
}
_openssl_pkeyparam() {
@ -1721,8 +1721,8 @@ _openssl_s_client() {
local tls_start_protocols=(smtp pop3 imap ftp xmpp xmpp-server irc postgres mysql lmtp nntp sieve ldap)
_arguments \
'(- *)-help[print help message]' \
'-ssl_config[section of the configuration file to configure the SSL_CTX object]:section' \
'(- *)-help[print help message]' \
'-ssl_config[section of the configuration file to configure the SSL_CTX object]:section' \
'-connect[host and optional port to connect to]:host_port' \
'-host[host to connect to]:host' \
'-port[port to connect to]:port' \
@ -1835,129 +1835,129 @@ _openssl_s_client() {
_openssl_s_server() {
_arguments \
'(- *)-help[print help message]' \
'-port[TCP port to listen on for connections(default: 4433)]:port' \
'-accept[optional TCP host and port to listen on for connections(default: *:4433)]:host_port' \
'-unix[Unix domain socket path]:path:_files' \
'(-4 -6)-4[use IPv4 only]' \
'(-4 -6)-6[use IPv6 only]' \
'-unlink[for -unix, unlink any existing socket first]' \
'-context[SSL context ID]:id' \
'(-verify -Verify)'{-verify,-Verify}'[verify depth]:depth' \
'-cert[certificate file]:file:_files' \
'-cert2[certificate file to use for servername(default: server2.pem)]:file:_files' \
'-certform[server certificate file format]:format:(DER PEM P12)' \
'-cert_chain[file or URI of untrusted certificates to build the certificate chain]:file_or_uri:_files' \
'-build_chain[application should build the server certificate chain]' \
'-serverinfo[file containing one or more blocks of PEM data]:file:_files' \
'-key[private key file or URI]:file_or_uri:_files' \
'-key2[private key file or URI to use for servername]:file_or_uri:_files' \
'-keyform[key format]:format:(DER PEM P12 ENGINE)' \
'-pass[private key and certificate file password source]:source:_openssl_pass_phrase_options' \
'-dcert[additional certificate file]:file:_files' \
'-dkey[additional private key file or URI]:file_or_uri:_files' \
'-dcert_chain[file or URI of untrusted certificates to build the server certificate chain]:file_or_uri:_files' \
'-dcertform[format of the additional certificate file]:format:(DER PEM P12)' \
'-dkeyform[format of the additional private key]:format:(DER PEM P12 ENGINE)' \
'-dpass[passphrase for the additional private key and certificate]:pass:_openssl_pass_phrase_options' \
'-nbio_test[test non blocking I/O]' \
'-crlf[translate a line feed from the terminal into CR+LF]' \
'-debug[print extensive debugging information including a hex dump of all traffic]' \
'-security_debug[print output from SSL/TLS security framework]' \
'-security_debug_verbose[print more output from SSL/TLS security framework]' \
'-msg[show all protocol messages with hex dump]' \
'-msgfile[file to send output of -msg or -trace to]:file:_files' \
'-state[print the SSL session states]' \
'-CRL[CRL file]:file:_files' \
'-CRLform[CRL file format]:format:(DER PEM)' \
'-crl_download[download CRLs from distribution points]' \
'-verifyCAfile[file in PEM format CA containing trusted certificates to verify client certificates]:file:_files' \
'-verifyCApath[directory containing trusted certificates to verify client certificates]:dir:_files -/' \
'-verifyCAstore[URI of a store containing trusted certificates to verify client certificates]:uri:_urls' \
'-chainCAfile[file in PEM format containing trusted certificates to build the server certificate chain]:file:_files' \
'-chainCApath[directory containing trusted certificates for building server certificate chain]:dir:_files -/' \
'-chainCAstore[URI of a store containing trusted certificates for building server certificate chain]:uri:_urls' \
'-nocert[no certificate is used]' \
'-quiet[inhibit printing of session and certificate information]' \
'-no_resume_ephemeral[disable caching and tickets if ephemeral (EC)DH is used]' \
'-tlsextdebug[print a hex dump of any TLS extensions received from the server]' \
'-www[send a status message back to the client when it connects]' \
'(-WWW -HTTP)'{-WWW,-HTTP}'[emulate a simple web server]' \
'-http_server_binmode[acting as web-server open files in binary mode]' \
'-no_ca_names[disable TLS Extension CA Names]' \
'-ignore_unexpected_eof[peer does not need to send the close_notify alert]' \
'-servername[servername for HostName TLS extension]' \
'-servername_fatal[send fatal alert on servername mismatch]' \
'-id_prefix[generate SSL/TLS session IDs prefixed by this ID]:id' \
'-keymatexport[export keying material using label]:label' \
'-keymatexportlen[export the given number of bytes of keying material(default: 20)]:length' \
'-no_cache[disable session cache]' \
'-ext_cache[disable internal cache]' \
'-verify_return_error[close the connection when verification errors occur]' \
'-verify_quiet[no verify output except verify errors]' \
'(-no_ign_eof -ign_eof)-ign_eof[ignore input EOF]' \
'(-no_ign_eof -ign_eof)-no_ign_eof[do not ignore input EOF]' \
'-no_ems[disable Extended master secret negotiation]' \
'-status[enable certificate status request support]' \
'-status_verbose[enable certificate status request support and verbose output of OCSP response]' \
'-status_timeout[set the timeout for OCSP reponse to the given seconds]:seconds' \
'-proxy[HTTP(S) proxy server]:proxy' \
'-no_proxy[list of IP addresses and/or DNS names not to use an HTTP(S) proxy for]:addresses' \
'-status_url[set a fallback responder URL]:url:_urls' \
'-status_file[status file]:file:_files' \
'-ssl_config[configure SSL_CTX using the given configure value]:config' \
'-trace[show verbose trace output of protocol messages]' \
'-brief[provide a brief summary of connection parameters]' \
'-rev[simple echo server that sends back received text reserved]' \
'-async[switch on asynchronous mode]' \
'-max_send_frag[maximum size of data fragment to send]:size' \
'-split_send_frag[size used to split data for encrypt pipelines]:size' \
'-max_pipelines[maximum number of encrypt/decrypt pipelines]:number' \
'-naccept[server will exit after receiving the specified number of connections(default: unlimited)]:number' \
'-read_buf[default read buffer size for connections]:size' \
'-no_tx_cert_comp[disable support for sending TLSv1.3 compressed certificates]' \
'-no_rx_cert_comp[disable support for receiving TLSv1.3 compressed certificates]' \
'-no_comp[disable negotiation of TLS compression]' \
'-num_tickets[control the number of tickets that will be sent to the client after a full handshake in TLSv1.3]' \
'-dhparam[DH parameter file to use]:file:_files' \
'-nbio[turn on non blocking I/O]' \
'-timeout[enable timeout]' \
'-mtu[set link-layer MTU]:size' \
'-psk_identity[PSK identify when using a PSK cipher suite]:id' \
'-psk_hint[PSK identity hint when using a PSK cipher suite]:hint' \
'-psk[PSK key when using a PSK cipher suite]:key' \
'-psk_session[file contains pem encoded SSL_SESSION data]:file:_files' \
'-srpvfile[verifier file for SRP]:file:_files' \
'-listen[listen on a UDP port for incoming connections]' \
'-sctp[use SCTP for the transport protocol instead of UDP in DTLS]' \
'-sctp_label_bug[allow communication with older broken implementations]' \
'-use_srtp[offer SRTP key management with a colon-separated profile list]:list' \
'-no_dhe[no DH parameters will be loaded]' \
'-alpn[enable the Application-Layer Protocol Negotiation extension]:protocol' \
'-nextprotoneg[enable the Next Protocol Negotiation extension]:protocol' \
'-ktls[enable kernel TLS for sending and receiving]' \
'-sendfile[SSL_sendfile will be used instead of BIO_write to send response]' \
'-zerocopy_sendfile[SSL_sendfile will use the zerocopy TX mode]' \
'-keylogfile[append TLS secrets to the specified keylog file]:file:_files' \
'-max_early_data[change the default maximum early data bytes for new sessions and incoming early data]:size' \
'-recv_max_early_data[hard limit on the maximum number of early data bytes that will be accepted]:bytes' \
'-early_data[accept early data where possible]' \
'-stateless[require TLSv1.3 cookies]' \
'(-anti_replay -no_anti_replay)-anti_replay[switch replay protection on]' \
'(-anti_replay -no_anti_replay)-no_anti_replay[switch replay protection off]' \
'-tfo[enable acceptance of TCP fast Open connections]' \
'-cert_comp[pre-compresses certificates that will be sent during the handshake]' \
'-nameopt[how the subject or issuer names are displayed]:how:_openssl_name_display_options' \
$openssl_tls_flags[@] \
$openssl_dtls_flags[@] \
$openssl_supported_commands_flags[@] \
$openssl_extended_verification_flags[@] \
$openssl_trusted_certificate_options[@] \
$openssl_random_state_options[@] \
$openssl_provider_options[@] \
$openssl_verification_options[@] \
'-enable_server_rpk[enable support for sending raw public keys to the client]' \
'-enable_client_rpk[enable support for receiving raw public keys from the client]'
'(- *)-help[print help message]' \
'-port[TCP port to listen on for connections(default: 4433)]:port' \
'-accept[optional TCP host and port to listen on for connections(default: *:4433)]:host_port' \
'-unix[Unix domain socket path]:path:_files' \
'(-4 -6)-4[use IPv4 only]' \
'(-4 -6)-6[use IPv6 only]' \
'-unlink[for -unix, unlink any existing socket first]' \
'-context[SSL context ID]:id' \
'(-verify -Verify)'{-verify,-Verify}'[verify depth]:depth' \
'-cert[certificate file]:file:_files' \
'-cert2[certificate file to use for servername(default: server2.pem)]:file:_files' \
'-certform[server certificate file format]:format:(DER PEM P12)' \
'-cert_chain[file or URI of untrusted certificates to build the certificate chain]:file_or_uri:_files' \
'-build_chain[application should build the server certificate chain]' \
'-serverinfo[file containing one or more blocks of PEM data]:file:_files' \
'-key[private key file or URI]:file_or_uri:_files' \
'-key2[private key file or URI to use for servername]:file_or_uri:_files' \
'-keyform[key format]:format:(DER PEM P12 ENGINE)' \
'-pass[private key and certificate file password source]:source:_openssl_pass_phrase_options' \
'-dcert[additional certificate file]:file:_files' \
'-dkey[additional private key file or URI]:file_or_uri:_files' \
'-dcert_chain[file or URI of untrusted certificates to build the server certificate chain]:file_or_uri:_files' \
'-dcertform[format of the additional certificate file]:format:(DER PEM P12)' \
'-dkeyform[format of the additional private key]:format:(DER PEM P12 ENGINE)' \
'-dpass[passphrase for the additional private key and certificate]:pass:_openssl_pass_phrase_options' \
'-nbio_test[test non blocking I/O]' \
'-crlf[translate a line feed from the terminal into CR+LF]' \
'-debug[print extensive debugging information including a hex dump of all traffic]' \
'-security_debug[print output from SSL/TLS security framework]' \
'-security_debug_verbose[print more output from SSL/TLS security framework]' \
'-msg[show all protocol messages with hex dump]' \
'-msgfile[file to send output of -msg or -trace to]:file:_files' \
'-state[print the SSL session states]' \
'-CRL[CRL file]:file:_files' \
'-CRLform[CRL file format]:format:(DER PEM)' \
'-crl_download[download CRLs from distribution points]' \
'-verifyCAfile[file in PEM format CA containing trusted certificates to verify client certificates]:file:_files' \
'-verifyCApath[directory containing trusted certificates to verify client certificates]:dir:_files -/' \
'-verifyCAstore[URI of a store containing trusted certificates to verify client certificates]:uri:_urls' \
'-chainCAfile[file in PEM format containing trusted certificates to build the server certificate chain]:file:_files' \
'-chainCApath[directory containing trusted certificates for building server certificate chain]:dir:_files -/' \
'-chainCAstore[URI of a store containing trusted certificates for building server certificate chain]:uri:_urls' \
'-nocert[no certificate is used]' \
'-quiet[inhibit printing of session and certificate information]' \
'-no_resume_ephemeral[disable caching and tickets if ephemeral (EC)DH is used]' \
'-tlsextdebug[print a hex dump of any TLS extensions received from the server]' \
'-www[send a status message back to the client when it connects]' \
'(-WWW -HTTP)'{-WWW,-HTTP}'[emulate a simple web server]' \
'-http_server_binmode[acting as web-server open files in binary mode]' \
'-no_ca_names[disable TLS Extension CA Names]' \
'-ignore_unexpected_eof[peer does not need to send the close_notify alert]' \
'-servername[servername for HostName TLS extension]' \
'-servername_fatal[send fatal alert on servername mismatch]' \
'-id_prefix[generate SSL/TLS session IDs prefixed by this ID]:id' \
'-keymatexport[export keying material using label]:label' \
'-keymatexportlen[export the given number of bytes of keying material(default: 20)]:length' \
'-no_cache[disable session cache]' \
'-ext_cache[disable internal cache]' \
'-verify_return_error[close the connection when verification errors occur]' \
'-verify_quiet[no verify output except verify errors]' \
'(-no_ign_eof -ign_eof)-ign_eof[ignore input EOF]' \
'(-no_ign_eof -ign_eof)-no_ign_eof[do not ignore input EOF]' \
'-no_ems[disable Extended master secret negotiation]' \
'-status[enable certificate status request support]' \
'-status_verbose[enable certificate status request support and verbose output of OCSP response]' \
'-status_timeout[set the timeout for OCSP reponse to the given seconds]:seconds' \
'-proxy[HTTP(S) proxy server]:proxy' \
'-no_proxy[list of IP addresses and/or DNS names not to use an HTTP(S) proxy for]:addresses' \
'-status_url[set a fallback responder URL]:url:_urls' \
'-status_file[status file]:file:_files' \
'-ssl_config[configure SSL_CTX using the given configure value]:config' \
'-trace[show verbose trace output of protocol messages]' \
'-brief[provide a brief summary of connection parameters]' \
'-rev[simple echo server that sends back received text reserved]' \
'-async[switch on asynchronous mode]' \
'-max_send_frag[maximum size of data fragment to send]:size' \
'-split_send_frag[size used to split data for encrypt pipelines]:size' \
'-max_pipelines[maximum number of encrypt/decrypt pipelines]:number' \
'-naccept[server will exit after receiving the specified number of connections(default: unlimited)]:number' \
'-read_buf[default read buffer size for connections]:size' \
'-no_tx_cert_comp[disable support for sending TLSv1.3 compressed certificates]' \
'-no_rx_cert_comp[disable support for receiving TLSv1.3 compressed certificates]' \
'-no_comp[disable negotiation of TLS compression]' \
'-num_tickets[control the number of tickets that will be sent to the client after a full handshake in TLSv1.3]' \
'-dhparam[DH parameter file to use]:file:_files' \
'-nbio[turn on non blocking I/O]' \
'-timeout[enable timeout]' \
'-mtu[set link-layer MTU]:size' \
'-psk_identity[PSK identify when using a PSK cipher suite]:id' \
'-psk_hint[PSK identity hint when using a PSK cipher suite]:hint' \
'-psk[PSK key when using a PSK cipher suite]:key' \
'-psk_session[file contains pem encoded SSL_SESSION data]:file:_files' \
'-srpvfile[verifier file for SRP]:file:_files' \
'-listen[listen on a UDP port for incoming connections]' \
'-sctp[use SCTP for the transport protocol instead of UDP in DTLS]' \
'-sctp_label_bug[allow communication with older broken implementations]' \
'-use_srtp[offer SRTP key management with a colon-separated profile list]:list' \
'-no_dhe[no DH parameters will be loaded]' \
'-alpn[enable the Application-Layer Protocol Negotiation extension]:protocol' \
'-nextprotoneg[enable the Next Protocol Negotiation extension]:protocol' \
'-ktls[enable kernel TLS for sending and receiving]' \
'-sendfile[SSL_sendfile will be used instead of BIO_write to send response]' \
'-zerocopy_sendfile[SSL_sendfile will use the zerocopy TX mode]' \
'-keylogfile[append TLS secrets to the specified keylog file]:file:_files' \
'-max_early_data[change the default maximum early data bytes for new sessions and incoming early data]:size' \
'-recv_max_early_data[hard limit on the maximum number of early data bytes that will be accepted]:bytes' \
'-early_data[accept early data where possible]' \
'-stateless[require TLSv1.3 cookies]' \
'(-anti_replay -no_anti_replay)-anti_replay[switch replay protection on]' \
'(-anti_replay -no_anti_replay)-no_anti_replay[switch replay protection off]' \
'-tfo[enable acceptance of TCP fast Open connections]' \
'-cert_comp[pre-compresses certificates that will be sent during the handshake]' \
'-nameopt[how the subject or issuer names are displayed]:how:_openssl_name_display_options' \
$openssl_tls_flags[@] \
$openssl_dtls_flags[@] \
$openssl_supported_commands_flags[@] \
$openssl_extended_verification_flags[@] \
$openssl_trusted_certificate_options[@] \
$openssl_random_state_options[@] \
$openssl_provider_options[@] \
$openssl_verification_options[@] \
'-enable_server_rpk[enable support for sending raw public keys to the client]' \
'-enable_client_rpk[enable support for receiving raw public keys from the client]'
}
_openssl_s_time() {

View File

@ -225,7 +225,7 @@ _openvpn3_command() {
_describe -t commands 'openvpn3 commands' openvpn3_cmds
else
local curcontext="$curcontext"
cmd="${${openvpn3_cmds[(r)$words[1]:*]%%:*}}"
local cmd="${${openvpn3_cmds[(r)$words[1]:*]%%:*}}"
if (($#cmd)); then
if (( $+functions[_openvpn3_$cmd] )); then
_openvpn3_$cmd

View File

@ -208,13 +208,13 @@ _scala() {
;;
(*)
case $service in
(scala)
_arguments $scala_options $common_options "*::filename:_files" && ret=0
;;
(scalac)
_arguments $common_options "*::filename:_files" && ret=0
;;
esac
(scala)
_arguments $scala_options $common_options "*::filename:_files" && ret=0
;;
(scalac)
_arguments $common_options "*::filename:_files" && ret=0
;;
esac
;;
esac

View File

@ -121,10 +121,10 @@ _setcap_capabilities() {
_setcap "$@"
# Local variables:
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# ex: sw=2 ts=2 et filetype=sh
# vim: ft=zsh sw=2 ts=2 et

View File

@ -93,8 +93,8 @@ _tmuxp() {
&& ret=0
;;
(shell)
local sessions="$(__tmux_sessions)"
local windows="$(__tmux_windows)"
local sessions="$(__tmuxp_tmux_sessions)"
local windows="$(__tmuxp_tmux_windows)"
_arguments \
'(- *)'{-h,--help}'[show help message and exit]' \
'-S[pass-through for tmux -S]: :_files' \
@ -179,15 +179,13 @@ __tmuxp_import() {
esac
}
__tmux_sessions () {
local tmux_sessions
tmux_sessions=($(_call_program tmux_sessions 'tmux ls -F "#{session_name}"'))
__tmuxp_tmux_sessions() {
local tmux_sessions=($(_call_program tmux_sessions 'tmux ls -F "#{session_name}"'))
echo $tmux_sessions
}
__tmux_windows () {
local tmux_windows
tmux_windows=($(_call_program tmux_sessions 'tmux ls -F "#{window_name}"'))
__tmuxp_tmux_windows() {
local tmux_windows=($(_call_program tmux_sessions 'tmux ls -F "#{window_name}"'))
echo $tmux_windows
}

View File

@ -23,3 +23,11 @@ local modes=('up\:"bring a wireguard interface up"'\
# 2: Complete interface with all .conf files in /etc/wireguard without the filename extension.
_arguments "1:mode:((${modes}))"\
'2:interface:_path_files -W /etc/wireguard -g "*.conf(^/:r)"'
# 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