Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
401e8d8daf
79
src/_cmake
79
src/_cmake
|
@ -128,6 +128,10 @@ _cmake_suggest_builddirs() {
|
|||
_alternative ':current directory:(.)' 'directory::_directories' && return 0
|
||||
}
|
||||
|
||||
_cmake_suggest_installdirs() {
|
||||
_alternative ':current directory:(.)' 'directory::_directories' && return 0
|
||||
}
|
||||
|
||||
_cmake_on_build() {
|
||||
local build_extras;build_extras=(
|
||||
'--[Native build tool options]'
|
||||
|
@ -191,6 +195,68 @@ _cmake_on_build() {
|
|||
fi
|
||||
}
|
||||
|
||||
_cmake_on_install() {
|
||||
local build_extras;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
|
||||
for be in $build_extras ; do
|
||||
undescribed_build_extras[$i]=$(echo $be | sed "s/\[.*//")
|
||||
(( i++ ))
|
||||
done
|
||||
inbuild=false
|
||||
dashdashposition=-1
|
||||
for ((i = (($CURRENT - 1)); i > 1 ; i--)); do
|
||||
if [[ $words[$i] == --install ]] ; then
|
||||
inbuild=true
|
||||
buildat=$i
|
||||
(( difference = $CURRENT - $i ))
|
||||
elif [[ $words[$i] == -- ]] ; then
|
||||
dashdashposition=$i
|
||||
fi
|
||||
done
|
||||
outofbuild=false
|
||||
for ((i = (($CURRENT - 1)); i > (($buildat + 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
|
||||
done
|
||||
if (( $dashdashposition > 0 )) ; then
|
||||
_cmake_generator_options $words[(($buildat + 1))] $dashdashposition && return 0
|
||||
fi
|
||||
if [[ "$inbuild" == false || "$difference" -eq 1 ]] ; then
|
||||
# either there is no --install or completing the directory after --install
|
||||
_arguments -C -s \
|
||||
- build_opts \
|
||||
"$cmake_build_options[@]" \
|
||||
- build_cmds \
|
||||
"$cmake_suggest_install[@]" && return 0
|
||||
elif [[ $words[(($CURRENT - 1))] == --prefix ]] ; then
|
||||
# after --install <dir> --prefix, no idea
|
||||
return 0
|
||||
elif [[ $words[(($CURRENT - 1))] == --config ]] ; then
|
||||
# after --install <dir> --config, no idea
|
||||
return 0
|
||||
elif [[ $words[(($CURRENT - 1))] == --component ]] ; then
|
||||
# after --build <dir> --component, no idea
|
||||
return 0
|
||||
elif [ "$outofbuild" = true ] ; then
|
||||
# after --build <dir> --<not a --build option>, suggest other cmake_build_options (like -Wno-dev)
|
||||
_arguments "$cmake_build_options[@]" && return 0
|
||||
else
|
||||
# after --build <dir>, suggest other cmake_build_options (like -Wno-dev) or --build options (like --clean-first)
|
||||
_arguments "$build_extras[@]" "$cmake_build_options[@]" && return 0
|
||||
fi
|
||||
}
|
||||
|
||||
local cmake_help_actions;cmake_help_actions=(
|
||||
'(- 1)--help-command[Print help for a single command and exit]:command-name:_cmake_command_names'
|
||||
'(- 1)--help-command-list[List available listfile commands and exit]'
|
||||
|
@ -479,6 +545,10 @@ local cmake_suggest_build;cmake_suggest_build=(
|
|||
'--build[build]:build dir:_cmake_suggest_builddirs'
|
||||
)
|
||||
|
||||
local cmake_suggest_install;cmake_suggest_install=(
|
||||
'--install[install]:install dir:_cmake_suggest_installdirs'
|
||||
)
|
||||
|
||||
if [[ "$service" = -value-*CMAKE_GENERATOR* ]]; then
|
||||
_cmake_generators
|
||||
elif [ $CURRENT -eq 2 ] ; then
|
||||
|
@ -490,11 +560,16 @@ elif [ $CURRENT -eq 2 ] ; then
|
|||
- build_opts \
|
||||
"$cmake_build_options[@]" \
|
||||
- build_cmds \
|
||||
"$cmake_suggest_build[@]" && return 0
|
||||
"$cmake_suggest_build[@]" \
|
||||
- install_cmds \
|
||||
"$cmake_suggest_install[@]" && return 0
|
||||
elif [[ $words[2] = --help* ]] ; then
|
||||
_cmake_help
|
||||
elif [[ $words[2] != -E ]] ; then
|
||||
#elif [[ $words[2] != -E ]] ; then
|
||||
elif [[ $words[2] == --build ]] ; then
|
||||
_cmake_on_build
|
||||
elif [[ $words[2] == --install ]] ; then
|
||||
_cmake_on_install
|
||||
else
|
||||
_cmake_command
|
||||
fi
|
|
@ -0,0 +1,115 @@
|
|||
#compdef cppcheck
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2019 Github zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for cppcheck -- a tool for static C/C++ code analysis (http://cppcheck.sourceforge.net)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Georgy Komarov (https://github.com/jubnzv)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Notes
|
||||
# -----
|
||||
#
|
||||
# Created for Cppcheck version 1.90.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_cppcheck_files() {
|
||||
_path_files -/ -g "*.(c|cpp|cxx|h|hpp|C)"
|
||||
}
|
||||
|
||||
_cppcheck() {
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
"--addon=[Execute addon]" \
|
||||
"--cppcheck-build-dir=[Analysis output directory]:directory:_files -/" \
|
||||
"--check-config[Check cppcheck configuration]" \
|
||||
"--check-library[Show information when library files have incomplete info]" \
|
||||
"--config-exclude=[Path to be excluded from configuration checking]:directory:_files -/" \
|
||||
"--config-exclude-files=[A file that contains a list of config-excludes]:file:_files" \
|
||||
"--doc[Print a list of all available checks]" \
|
||||
"--dump[Dump xml data for each translation unit]" \
|
||||
"-D[Define preprocessor symbol]" \
|
||||
"-U[Undefine preprocessor symbol]" \
|
||||
"-E[Print preprocessor output on stdout and don't do any further processing]" \
|
||||
"--enable[Enable additional checks]:id:(all warning style performance portability information unusedFunction missingInclude)" \
|
||||
"--error-exitcode=[Integer to return if errors are found]" \
|
||||
"--errorlist[Print a list of all the error messages in XML format]" \
|
||||
"--exitcode-suppressions=[Used when certain messages should be displayed but should not cause a non-zero exitcode]:_files" \
|
||||
"--file-list=[Specify the files to check in a text file]:_files" \
|
||||
{-f,--force}"[Force checking of all configurations in files]" \
|
||||
{-h,--help}"[Print this help]" \
|
||||
"-I[A file that contains a list of config-excludes]:directory:_files -/" \
|
||||
"--include-file=[Specify directory paths to search for included header files in a text file]:file:_files" \
|
||||
"--include=[Force inclusion of a file before the checked file]:file:_files" \
|
||||
"-i[Give a source file or source file directory to exclude from the check]:directory or file:_files" \
|
||||
"--inconclusive[Report even though the analysis is inconclusive]" \
|
||||
"--inline-suppr[Enable inline suppressions]" \
|
||||
"-j[Number of threads to do the checking simultaneously]" \
|
||||
"-l[No new threads should be started if the load average is exceeds this value]" \
|
||||
{-x,--language=}"[Forces cppcheck to check all files as the given language]:language:(c c++)" \
|
||||
"--cfg=[Load file that contains information about types and functions]" \
|
||||
"--max-ctu-depth=[Maximum depth in whole program analysis]" \
|
||||
"--output-file=[File to save results]:file:_files" \
|
||||
"--project=[Run Cppcheck on project]:file:_files" \
|
||||
"--max-configs=[Maximum number of configurations to check in a file]" \
|
||||
"--platform=[Set platform specific types and sizes]:platforms:(unix32 unix64 win32A win32W win64 native unspecified)" \
|
||||
"--plist-output=[Generate Clang-plist output files in folder]:_files" \
|
||||
{-q,--quiet}"[Do not show progress reports]" \
|
||||
{-rp,--relative-paths}"[Use relative paths in output]" \
|
||||
{-rp,--relative-paths}"=[Use relative paths in output (separated with ;)]:_files" \
|
||||
"--report-progress[Report progress messages while checking a file]" \
|
||||
"--std=[Set standard]:std:(c89 c99 c11 c++03 c++11 c++14 c++17 c++20)" \
|
||||
"--suppress=[Suppress warnings (format: \[error id\]:\[filename\]:\[line\])]" \
|
||||
"--suppressions-list=[Suppress warnings listed in the file]:_files" \
|
||||
"--template=[Format the error messages]" \
|
||||
"--template=[Format the error message location]" \
|
||||
{-v,--verbose}"[Output more detailed error information]" \
|
||||
"--version[Print out version number]" \
|
||||
"--xml[Write results in xml format to stderr]" \
|
||||
"--xml-version=[Select the XML file version]" \
|
||||
'*: :_cppcheck_files'
|
||||
}
|
||||
|
||||
_cppcheck "$@"
|
||||
|
||||
# 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
|
||||
|
|
@ -0,0 +1,339 @@
|
|||
#compdef fail2ban-client
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2020 Github zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for fail2ban-client (https://www.fail2ban.org/).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Felix Neumärker <xdch47@posteo.de>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_f2bc_jails() {
|
||||
LANG=C fail2ban-client status 2> /dev/null | sed -n -e 's/.*Jail list:\s\+//' -e 'T' -e 's/,\s\+/\'$'\n/g' -e 'p'
|
||||
}
|
||||
|
||||
_complete_f2bc_cmds() {
|
||||
local cmds=(
|
||||
'unban:unbans all IP addresses'
|
||||
'set:set property'
|
||||
'get:get property'
|
||||
'status:gets the current status of the server'
|
||||
'reload:reloads the configuration/jails'
|
||||
'restart:restarts the server'
|
||||
'start:starts the server and the jails'
|
||||
'stop:stops all jails and terminate the server'
|
||||
'ping:tests if the server is alive'
|
||||
'flushlogs:flushes the logtarget if a file and reopens it'
|
||||
'help:return this output'
|
||||
'version:return the server version'
|
||||
)
|
||||
|
||||
_describe -V "fail2ban commands" cmds
|
||||
}
|
||||
|
||||
_complete_f2bc_cmdargs() {
|
||||
local f2barg="$words[$NORMARG]"
|
||||
case "$f2barg" in
|
||||
unban)
|
||||
local jail
|
||||
if (( $words[(I)(--all)] == 0 )) ; then
|
||||
for jail in $(_f2bc_jails) ; do
|
||||
_complete_f2bc_ips $jail
|
||||
done
|
||||
local unban_opts=(--all)
|
||||
_describe -o "unban options" unban_opts
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
;;
|
||||
(set|get))
|
||||
if (( $NORMARG + 1 == $CURRENT )) ; then
|
||||
_complete_f2bc_jails
|
||||
_complete_f2bc_settings
|
||||
else
|
||||
_complete_f2bc_jail${f2barg}
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
if (( $NORMARG + 1 == $CURRENT )) ; then
|
||||
_complete_f2bc_jails
|
||||
elif (( $NORMARG + 2 == $CURRENT )) ; then
|
||||
_values "flavor" basic cymru
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_complete_f2bc_jails() {
|
||||
local jails=($(_f2bc_jails))
|
||||
_describe -V "jails" jails
|
||||
}
|
||||
|
||||
_complete_f2bc_ips() {
|
||||
local ips=("${(@f)$(LANG=C fail2ban-client status $1 2> /dev/null | sed -n -e 's/^.*Banned IP list:\s\+//' -e 'T' -e 's/\s\+/\'$'\n/g' -e 'p')}")
|
||||
if [[ -n "${ips[@]}" ]] ; then
|
||||
_describe -t "f2b_jail_$1" -V "banned ips of jail $1" ips
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
}
|
||||
|
||||
_complete_f2bc_jailset() {
|
||||
if (( $NORMARG + 2 == $CURRENT )) ; then
|
||||
case $words[$NORMARG+1] in
|
||||
loglevel)
|
||||
local loglevel=(CRITICAL ERROR WARNING NOTICE INFO DEBUG TRACEDEBUG HEAVYDEBUG)
|
||||
_describe -V "loglevel" loglevel ;;
|
||||
logtarget)
|
||||
local logtarget=(STDOUT STDERR SYSLOG)
|
||||
_describe -V "logtarget" logtarget
|
||||
_files ;;
|
||||
syslogsocket)
|
||||
local syslogsocket=(auto)
|
||||
_describe -V "logtarget" syslogsocket
|
||||
_files ;;
|
||||
dbfile)
|
||||
_files ;;
|
||||
dbpurgeage)
|
||||
_message "sets the max age in <SECONDS> that history of bans will be kept" ;;
|
||||
*)
|
||||
# jail
|
||||
local jailsettings=(
|
||||
unbanip
|
||||
banip
|
||||
action
|
||||
addaction
|
||||
addfailregex
|
||||
addignoreip
|
||||
addignoreregex
|
||||
addjournalmatch
|
||||
addlogpath
|
||||
bantime
|
||||
datepattern
|
||||
delaction
|
||||
delfailregex
|
||||
delignoreip
|
||||
delignorerexgex
|
||||
deljournalmatch
|
||||
dellogpath
|
||||
findtime
|
||||
idle
|
||||
ignorecache
|
||||
ignorecommand
|
||||
ignoreself
|
||||
logencoding
|
||||
maxlines
|
||||
maxretry
|
||||
usedns
|
||||
)
|
||||
_describe -t "f2b_jail_setting" -V "jail setting" jailsettings ;;
|
||||
esac
|
||||
else
|
||||
local jail="$words[$NORMARG+1]"
|
||||
|
||||
if (( $NORMARG + 3 == $CURRENT )) ; then
|
||||
case $words[$NORMARG+2] in
|
||||
unbanip)
|
||||
_complete_f2bc_ips "$jail" ;;
|
||||
delfailregex)
|
||||
_complete_f2bc_regex fail "$jail" ;;
|
||||
delignorerexgex)
|
||||
_complete_f2bc_regex ignore "$jail" ;;
|
||||
dellogpath)
|
||||
local filelist=("${(@f)$(LANG=C fail2ban-client status $jail 2> /dev/null | sed -n -e 's/^.*File list:\s\+//' -e 'T' -e 's/\s\+/\'$'\n/g' -e 'p')}")
|
||||
|
||||
if [[ -n "${filelist[@]}" ]] ; then
|
||||
_describe -t "f2b_filelist" -V "filelist of jail $1" filelist
|
||||
else
|
||||
_nothing
|
||||
fi ;;
|
||||
idle)
|
||||
_values 'fail2ban idle' on off ;;
|
||||
ignoreself)
|
||||
_values 'fail2ban ignoreself' true false ;;
|
||||
delignoreip)
|
||||
local ignoreips=("${(@f)$(fail2ban-client get "$jail" ignoreip 2> /dev/null | sed -e 's/^[|`]-\s\+//p')}")
|
||||
if [[ -n "${ignoreips[@]}" ]] ; then
|
||||
_describe -t "f2b_ignoreip" -V "fail2ban ignored ips" ignoreips
|
||||
else
|
||||
_nothing
|
||||
fi ;;
|
||||
delaction|action)
|
||||
_complete_f2bc_action "$jail" ;;
|
||||
addlogpath)
|
||||
_files ;;
|
||||
*)
|
||||
_message "No completion for ${words[NORMARG+2]}" ;;
|
||||
esac
|
||||
elif (( $NORMARG + 4 == $CURRENT )) ; then
|
||||
case $words[$NORMARG+2] in
|
||||
action)
|
||||
_complete_f2bc_actionproperties "$jail" $words[$NORMARG+3] ;;
|
||||
addaction)
|
||||
_files ;;
|
||||
*)
|
||||
_nothing ;;
|
||||
esac
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_complete_f2bc_jailget() {
|
||||
if (( $NORMARG + 2 == $CURRENT )) ; then
|
||||
case $words[$NORMARG+1] in
|
||||
(loglevel|logtarget|syslogsocket|dbfile|dbpurgeage))
|
||||
_nothing ;;
|
||||
*)
|
||||
# jail
|
||||
local jailprops=(
|
||||
logpath
|
||||
logencoding
|
||||
journalmatch
|
||||
ignoreself
|
||||
ignoreip
|
||||
ignorecommand
|
||||
failregex
|
||||
ignoreregex
|
||||
findtime
|
||||
bantime
|
||||
datepattern
|
||||
usedns
|
||||
maxretry
|
||||
maxlines
|
||||
actions
|
||||
action
|
||||
actionproperties
|
||||
actionmethods
|
||||
)
|
||||
_describe -t "f2b_jail_props" -V "jail properties" jailprops ;;
|
||||
esac
|
||||
else
|
||||
local jail="$words[$NORMARG+1]"
|
||||
|
||||
if (( $NORMARG + 3 == $CURRENT )) ; then
|
||||
case $words[$NORMARG+2] in
|
||||
(action|actionproperties|actionmethods))
|
||||
_complete_f2bc_action "$jail" ;;
|
||||
*)
|
||||
_nothing ;;
|
||||
esac
|
||||
elif (( $NORMARG + 4 == $CURRENT )) ; then
|
||||
case $words[$NORMARG+2] in
|
||||
(action|actionproperties|actionmethods))
|
||||
_complete_f2bc_actionproperties "$jail" $words[$NORMARG+3] ;;
|
||||
*)
|
||||
_nothing ;;
|
||||
esac
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_complete_f2bc_action() {
|
||||
local jailactions=("${(@f)$(fail2ban-client get $1 actions 2>/dev/null | sed -e '1d' -e 's/,\s\+/\'$'\n/g')}")
|
||||
|
||||
if [[ -n "${jailactions[@]}" ]] ; then
|
||||
_describe -t "f2b_jail_actions" -V "jail actions" jailactions
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
}
|
||||
|
||||
_complete_f2bc_actionproperties() {
|
||||
local default_actionproperties=(
|
||||
actionstart
|
||||
actionstop
|
||||
actioncheck
|
||||
actionban
|
||||
actionunban
|
||||
timeout
|
||||
)
|
||||
local all_actionproperties=("${(@f)$(fail2ban-client get $1 actionproperties $2 2>/dev/null | sed -e '1d' -e 's/,\s\+/\'$'\n/g')}")
|
||||
local add_actionproperties=("${(@)all_actionproperties:|default_actionproperties}")
|
||||
|
||||
_describe -t "f2b_actions_defprops" -V "default action properties" default_actionproperties
|
||||
|
||||
if [[ -n "${add_actionproperties[@]}" ]] ; then
|
||||
_describe -t "f2b_actions_remprops" -V "additional action properties" add_actionproperties
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
}
|
||||
|
||||
_complete_f2bc_regex() {
|
||||
local regex=("${(@f)$(fail2ban-client get $2 ${1}regex 2> /dev/null | sed -n -e 's/[|`]- \[\([0-9]\+\)\]:\s\+/\1:/p')}")
|
||||
if [[ -n "${regex[@]}" ]] ; then
|
||||
_describe -t "f2b_regex" -V "jail $2 ${1}regex" regex
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
}
|
||||
|
||||
_complete_f2bc_settings() {
|
||||
local setargs=(loglevel logtarget syslogsocket dbfile dbpurgeage)
|
||||
_describe -t "f2b_settings" -V "fail2ban-client settings" setargs
|
||||
}
|
||||
|
||||
integer NORMARG
|
||||
|
||||
_arguments -A "-*" -n \
|
||||
'-c[configuration directory]:_files -/' \
|
||||
'-s[socket path]:_files' \
|
||||
'-p[pidfile path]:_files' \
|
||||
'--loglevel[logging level]:(CRITICAL ERROR WARNING, NOTICE INFO, DEBUG, TRACEDEBUG HEAVYDEBUG)' \
|
||||
'--logtarget[logging target]:(stdout stderr syslog sysout)' \
|
||||
'--syslogsocket:_files' \
|
||||
'-d[dump configuration]' \
|
||||
'(--dp --dump-pretty)'{--dp,--dump-pretty}'[dump the configuration using more human readable representation]' \
|
||||
'(-t --test)'{-t,--test}'[test configuration]' \
|
||||
'-i[interactive mode]' \
|
||||
'-v[increase verbosity]' \
|
||||
'-q[decrease verbosity]' \
|
||||
'-x[force execution of the server (remove socket file)]' \
|
||||
'-b[start server in background]' \
|
||||
'-f[start server in foreground]' \
|
||||
'--str2sec[convert time abbreviation format to seconds]:_message str2sec' \
|
||||
'(-h --help)'{-h,--help}'[display this help message]' \
|
||||
'(-V --version)'{-V,--version}'[print the version]' \
|
||||
'1:fail2ban command:_complete_f2bc_cmds' \
|
||||
'*:fail2ban command argument:_complete_f2bc_cmdargs'
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: set et sw=2 ts=2 ft=zsh:
|
|
@ -42,6 +42,7 @@ _arguments -C \
|
|||
'--nosymlinks[do not follow symlinks]' \
|
||||
'--hidden[do not ignore hidden directories]' \
|
||||
'-c[force case sensitive]' \
|
||||
'-i[force case insensitive]' \
|
||||
'--delete[delete files found]' \
|
||||
'--exec[execute the given command with the file found]:command:_command_names' \
|
||||
'--module[execute the given module with the file found]:module_name args:' \
|
||||
|
|
|
@ -36,9 +36,16 @@
|
|||
# -------
|
||||
#
|
||||
# * Mario Fernandez (https://github.com/sirech)
|
||||
# * Shohei YOSHIDA (https://github.com/syohex)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__git_wtf_branches() {
|
||||
local -a branches
|
||||
branches=(${(f)"$(git for-each-ref --format='%(refname:short)' refs/heads/)"})
|
||||
_describe 'branch' branches
|
||||
}
|
||||
|
||||
_arguments -w -C -s \
|
||||
'(--long --short)'{-l,--long}'[include author info and date for each commit]' \
|
||||
'(--long --short)'{-s,--short}'[do not show commits]' \
|
||||
|
@ -47,7 +54,7 @@ _arguments -w -C -s \
|
|||
'(--key)'{-k,--key}'[show key]' \
|
||||
'(--relations)'{-r,--relations}'[show relation to features / integration branches]' \
|
||||
'(--dump-config)--dump-config[print out current configuration and exit]' \
|
||||
'*: :__git_branch_names'
|
||||
'*: :__git_wtf_branches'
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
|
|
407
src/_golang
407
src/_golang
|
@ -1,4 +1,4 @@
|
|||
#compdef go
|
||||
#compdef go -P -value-,GO*,-default- -P -value-,CGO*,-default-
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2016 Github zsh-users - http://github.com/zsh-users
|
||||
# Copyright (c) 2013-2015 Robby Russell and contributors (see
|
||||
|
@ -30,21 +30,20 @@
|
|||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for go 1.11 (http://golang.org).
|
||||
# Completion script for go 1.14 (http://golang.org).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Mikkel Oscar Lyderik Larsen <mikkeloscar@gmail.com>
|
||||
# * Paul Seyfert <pseyfert.mathphys@gmail.com>
|
||||
# * oh-my-zsh authors:
|
||||
# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/golang/golang.plugin.zsh
|
||||
# * Go authors
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
typeset -A opt_args
|
||||
|
||||
__go_buildmodes() {
|
||||
local -a buildmodes
|
||||
buildmodes=(
|
||||
|
@ -62,6 +61,122 @@ __go_buildmodes() {
|
|||
}
|
||||
|
||||
|
||||
__go_runtimedebug() {
|
||||
local -a vars
|
||||
vars=(
|
||||
'allocfreetrace[profile allocations]:boolean:(1 0)'
|
||||
'clobberfree[clobber memory after free]:boolean:(1 0)'
|
||||
'cgocheck[check passing go pointers to non-go]: :((0\:"no checks" 1\:"check checks" 2\:"expensive checks"))'
|
||||
'efence[allocate on unique pages]:boolean:(1 0)'
|
||||
"gccheckmark[verify garbage collector's concurrent mark phase]:boolean:(1 0)"
|
||||
'gcpacertrace[print state of the concurrent pacer from garbage collector]:boolean:(1 0)'
|
||||
'gcshrinkstackoff[disable moving goroutines to smaller stacks]:boolean:(1 0)'
|
||||
'gcstoptheworld[disable concurrent garbage collection]: :((0\:default 1\:"disable concurrent garbage collection" 2\:"disable concurrent gc and sweeping"))'
|
||||
'gctrace[emit memory collection and pause information from the garbage collector]:boolean:(1 0)'
|
||||
'madvdontneed[use MADV_DONTNEED instead of MADV_FREE]:boolean:(1 0)'
|
||||
'memprofilerate[every N-th allocation should be profiled]:int:'
|
||||
'invalidptr[crash on invalid integers in pointer-type variables]:boolean:(1 0)'
|
||||
'sbrk[replace memory allocator and garbage collector by trivial allocator]:boolean:(1 0)'
|
||||
'scavenge[enable debugging mode of heap scavenger]:boolean:(1 0)'
|
||||
'scavtrace[emit scavenger work information (memory returned and memory utilization)]:boolean:(1 0)'
|
||||
'scheddetail[emit detailed states of scheduler, processors, threads, goroutines]:boolean:(1 0)'
|
||||
'schedtrace[emmit scheduler state every N ms to stderr]:int'
|
||||
'tracebackancestors[set ancestor goroutines to be printed in goroutine creation stacks]:int'
|
||||
'asyncpreemptoff[disable signal-based asynchronous goroutine preemption.]:boolean:(1 0)'
|
||||
)
|
||||
_values -s ',' -S '=' "runtime debug behaviour" $vars[@]
|
||||
}
|
||||
|
||||
__go_gcdebugflags() {
|
||||
_values -s , -S = 'debug flag' \
|
||||
'append[print information about append compilation]' \
|
||||
'checkptr[instrument unsafe pointer conversions]:pointer conversion checks:((0\:"instrumentation disabled" 1\:"conversions involving unsafe.Pointer are instrumented" 2\:"conversions to unsafe.Pointer force heap allocation"))' \
|
||||
'closure[print information about closure compilation]' \
|
||||
'compilelater[compile functions as late as possible]' \
|
||||
'disablenil[disable nil checks]' \
|
||||
'dclstack[run internal dclstack check]' \
|
||||
'gcprog[print dump of GC programs]' \
|
||||
'libfuzzer[coverage instrumentation for libfuzzer]' \
|
||||
'nil[print information about nil checks]' \
|
||||
'panic[do not hide any compiler panic]' \
|
||||
'slice[print information about slice compilation]' \
|
||||
'typeassert[print information about type assertion inlining]' \
|
||||
'wb[print information about write barriers]' \
|
||||
'export[print export data]' \
|
||||
'pctab[print named pc-value table]:pc-value:(pctospadj pctofile pctoline pctoinline pctopcdata)' \
|
||||
'locationlists[print information about DWARF location list creation]' \
|
||||
'typecheckinl[eager typechecking of inline function bodies]' \
|
||||
'dwarfinl[print information about DWARF inlined function creation]' \
|
||||
'softfloat[force compiler to emit soft-float code]' \
|
||||
'defer[print information about defer compilation]' \
|
||||
'ssa/help[print help about SSA debugging]'
|
||||
}
|
||||
|
||||
__go_gcflags() {
|
||||
_arguments \
|
||||
'-%[debug non-static initializers]' \
|
||||
'-c=[concurrency during compilation]:int' \
|
||||
'-+[compiling runtime]' \
|
||||
'-B[disable bounds checking]' \
|
||||
'-C[disable printing of columns in error messages]' \
|
||||
'-D=[set relative path for local imports]:path: _path_files -/' \
|
||||
'-E[debug symbol export]' \
|
||||
'-I=[add directory to import search path]:directory: _path_files -/' \
|
||||
'-K[debug missing line numbers]' \
|
||||
'-L[show full file names in error messages]' \
|
||||
'-N[disable optimizations]' \
|
||||
'-S[print assembly listing]' \
|
||||
'-V[print version and exit]' \
|
||||
'-W[debug parse tree after type checking]' \
|
||||
'-asmhdr=[write assembly header to file]:file' \
|
||||
'-bench=[append benchmark times to file]:file' \
|
||||
'-blockprofile=[write block profile to file]:file' \
|
||||
'-buildid=[record id as the build id in the export metadata]:id' \
|
||||
'-complete[compiling complete package (no C or assembly)]' \
|
||||
'-cpuprofile=[write cpu profile to file]:file' \
|
||||
'-d=[print debug information about items in list; try -d help]:list: __go_gcdebugflags' \
|
||||
'-dwarf[generate DWARF symbols (default true)]' \
|
||||
'-dwarfbasentries[use base address selection entries in DWARF (default true)]' \
|
||||
'-dwarflocationlists[add location lists to DWARF in optimized mode (default true)]' \
|
||||
'-dynlink[support references to Go symbols defined in other shared libraries]' \
|
||||
'-e[no limit on number of errors reported]' \
|
||||
'-gendwarfinl=[generate DWARF inline info records (default 2)]:int' \
|
||||
'-goversion=[required version of the runtime]:string' \
|
||||
'-h[halt on error]' \
|
||||
'-importcfg=[read import configuration from file]:file' \
|
||||
'-importmap=[add definition of the form source=actual to import map]:definition' \
|
||||
'-installsuffix=[set pkg directory suffix]:suffix' \
|
||||
'-j[debug runtime-initialized variables]' \
|
||||
'-json=[version,destination for JSON compiler/optimizer logging]:string' \
|
||||
'-l[disable inlining]' \
|
||||
'-lang=[release to compile for]:string' \
|
||||
'-linkobj=[write linker-specific object to file]:file' \
|
||||
'-linkshared[generate code that will be linked against Go shared libraries]' \
|
||||
'-live[debug liveness analysis]' \
|
||||
'-m[print optimization decisions]' \
|
||||
'-memprofile=[write memory profile to file]:file' \
|
||||
'-memprofilerate=[set runtime.MemProfileRate to rate]:rate' \
|
||||
'-msan[build code compatible with C/C++ memory sanitizer]' \
|
||||
'-mutexprofile=[write mutex profile to file]:file' \
|
||||
'-newobj[use new object file format]' \
|
||||
'-nolocalimports[reject local (relative) imports]' \
|
||||
'-o=[write output to file]:file' \
|
||||
'-p=[set expected package import path]:path: _path_files -/' \
|
||||
'-pack[write to file.a instead of file.o]' \
|
||||
'-r[debug generated wrappers]' \
|
||||
'-race[enable race detector]' \
|
||||
'-shared[generate code that can be linked into a shared library]' \
|
||||
'-smallframes[reduce the size limit for stack allocated objects]' \
|
||||
'-std[compiling standard library]' \
|
||||
'-symabis=[read symbol ABIs from file]:file' \
|
||||
'-traceprofile=[write an execution trace to file]:file' \
|
||||
'-trimpath=[remove prefix from recorded source file paths]:prefix' \
|
||||
'-v[increase debug verbosity]' \
|
||||
'-w[debug type checking]' \
|
||||
'-wb[enable write barrier (default true)]' \
|
||||
}
|
||||
|
||||
|
||||
local -a commands build_flags
|
||||
commands=(
|
||||
'bug:start a bug report'
|
||||
|
@ -84,6 +199,128 @@ commands=(
|
|||
'help:get more information about a command'
|
||||
)
|
||||
|
||||
__go_envvarvals() {
|
||||
# if __go_envvarvals is called for -value-, I use the function argument to
|
||||
# decide which variable to go to. if $1 is not set, then __go_envvarvals is
|
||||
# called from the `go env` completion and the current word (with all after
|
||||
# the first '=' removed) is the current variable.
|
||||
local variable
|
||||
variable=${1-${words[$CURRENT]%%=*}}
|
||||
case $variable in
|
||||
# commands
|
||||
AR)
|
||||
;&
|
||||
CC)
|
||||
;&
|
||||
CXX)
|
||||
;&
|
||||
FC)
|
||||
;&
|
||||
GCCGO)
|
||||
_command_names -e
|
||||
;;
|
||||
# directories (using fallthrough)
|
||||
GOBIN)
|
||||
;&
|
||||
GOCACHE)
|
||||
;&
|
||||
GOTMPDIR)
|
||||
;&
|
||||
GOTOOLDIR)
|
||||
;&
|
||||
GOROOT)
|
||||
;&
|
||||
GOROOT_FINAL)
|
||||
;&
|
||||
GCCGOTOOLDIR)
|
||||
;&
|
||||
GOPATH)
|
||||
_files -/
|
||||
;;
|
||||
# regular files (using fallthrough)
|
||||
GOMOD)
|
||||
;&
|
||||
PKG_CONFIG)
|
||||
;&
|
||||
GOENV)
|
||||
_files
|
||||
;;
|
||||
# special
|
||||
GOHOSTOS)
|
||||
;&
|
||||
GOOS)
|
||||
# from https://golang.org/doc/install/source#environment
|
||||
_values 'operating system' aix android darwin dragonfly freebsd illumos js linux netbsd openbsd plan9 solaris windows
|
||||
;;
|
||||
GOHOSTARCH)
|
||||
;&
|
||||
GOARCH)
|
||||
_values 'architecture' amd64 386 arm ppc64
|
||||
;;
|
||||
CGO_ENABLED)
|
||||
_values 'enable/disable cgo' 0 1
|
||||
;;
|
||||
GO_EXTLINK_ENABLED)
|
||||
_values 'enable/disable external linkage' 0 1
|
||||
;;
|
||||
GOARM)
|
||||
_values 'target arm architecture' 5 6 7
|
||||
;;
|
||||
GO386)
|
||||
_values 'x86 floating point instruction set' 387 sse2
|
||||
;;
|
||||
GOMIPS*)
|
||||
_values 'mips floating point instructions' hardfloat softfloat
|
||||
;;
|
||||
GOWASM)
|
||||
_values 'web assembly features' -s ',' satconv signext
|
||||
;;
|
||||
GOPROXY)
|
||||
_urls
|
||||
;;
|
||||
GOEXE)
|
||||
_message "suffix for executables"
|
||||
;;
|
||||
CGO_*FLAGS_*ALLOW)
|
||||
_message "regexp"
|
||||
;;
|
||||
CGO_*FLAGS)
|
||||
_dispatch $service -value-,${variable#CGO_},-default-
|
||||
;;
|
||||
GODEBUG)
|
||||
__go_runtimedebug
|
||||
;;
|
||||
GOFLAGS)
|
||||
# not implemented, sorry
|
||||
;;
|
||||
GOINSECURE)
|
||||
;&
|
||||
GOPRIVATE)
|
||||
;&
|
||||
GONOPROXY)
|
||||
;&
|
||||
GONOSUMDB)
|
||||
# comma separated glob patterns (in the syntax of Go's path.Match)
|
||||
_message "comma separated glob pattern"
|
||||
;;
|
||||
GOSUMDB)
|
||||
_message "e.g. sum.golang.org+<publickey> https://sum.golang.org"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if [[ "$service" = -value-* ]]; then
|
||||
variable=${${service%,-default-}#-value-,}
|
||||
# some special variables are not read from the environment
|
||||
local -a blacklist
|
||||
blacklist=('GOEXE' 'GOGCCFLAGS' 'GOHOSTARCH' 'GOHOSTOS' 'GOMOD' 'GOTOOLDIR')
|
||||
if (($blacklist[(I)$variable])); then
|
||||
return
|
||||
fi
|
||||
__go_envvarvals $variable
|
||||
return
|
||||
fi
|
||||
|
||||
_arguments \
|
||||
"1: :{_describe 'command' commands}" \
|
||||
'*:: :->args'
|
||||
|
@ -95,6 +332,7 @@ case $state in
|
|||
'-n[print the commands but do not run them]'
|
||||
'-p[number of builds that can be run in parallel]:number'
|
||||
'-race[enable data race detection]'
|
||||
'-msan[enable interoperation with memory sanitizer]'
|
||||
'-v[print the names of packages as they are compiled]'
|
||||
'-work[print temporary work directory and keep it]'
|
||||
'-x[print the commands]'
|
||||
|
@ -102,7 +340,7 @@ case $state in
|
|||
'-buildmode[build mode to use]:mode:__go_buildmodes'
|
||||
'-compiler[name of compiler to use]:name'
|
||||
'-gccgoflags[arguments for gccgo]:args'
|
||||
'-gcflags[arguments for each go tool compile invocation]:args'
|
||||
'*-gcflags=[arguments for each go tool compile invocation]:args:__go_gcflags'
|
||||
'-installsuffix[suffix to add to package directory]:suffix'
|
||||
'-ldflags[arguments to pass on each go tool link invocation.]:flags'
|
||||
'-linkshared[link against shared libraries]'
|
||||
|
@ -111,6 +349,11 @@ case $state in
|
|||
'-trimpath[remove all file system paths from the resulting executable]'
|
||||
'-toolexec[program to use to invoke toolchain programs]:args'
|
||||
)
|
||||
mod_flags=(
|
||||
'-mod=[module download mode to use]:download mode:(readonly vendor mod)'
|
||||
'-modcacherw[leave newly-created directories in the module cache read-write]'
|
||||
'-modfile=[read an alternate go.mod file]:modfile: _files -g "*.mod"'
|
||||
)
|
||||
|
||||
__go_packages() {
|
||||
local gopaths
|
||||
|
@ -138,6 +381,7 @@ case $state in
|
|||
'-o[force build to write to named output file or directory]:file or directory:_files' \
|
||||
'-i[installs the packages that are dependencies of the target]' \
|
||||
${build_flags[@]} \
|
||||
${mod_flags[@]} \
|
||||
'*:importpaths:__go_packages'
|
||||
;;
|
||||
|
||||
|
@ -146,6 +390,7 @@ case $state in
|
|||
'-i[remove corresponding installed archive or binary]' \
|
||||
'-r[apply clean recursively on all dependencies]' \
|
||||
${build_flags[@]} \
|
||||
${mod_flags[@]} \
|
||||
'*:importpaths:__go_packages'
|
||||
;;
|
||||
|
||||
|
@ -158,59 +403,77 @@ case $state in
|
|||
|
||||
env)
|
||||
local -a goenvvars
|
||||
goenvvars=("AR="
|
||||
"CC="
|
||||
"CGO_CFLAGS="
|
||||
"CGO_CPPFLAGS="
|
||||
"CGO_CXXFLAGS="
|
||||
"CGO_ENABLED="
|
||||
"CGO_FFLAGS="
|
||||
"CGO_LDFLAGS="
|
||||
"CXX="
|
||||
"GCCGO="
|
||||
"GO111MODULE="
|
||||
"GOARCH="
|
||||
"GOBIN="
|
||||
"GOCACHE="
|
||||
"GOENV="
|
||||
"GOEXE="
|
||||
"GOFLAGS="
|
||||
"GOGCCFLAGS="
|
||||
"GOHOSTARCH="
|
||||
"GOHOSTOS="
|
||||
"GOMOD="
|
||||
"GONOPROXY="
|
||||
"GONOSUMDB="
|
||||
"GOOS="
|
||||
"GOPATH="
|
||||
"GOPRIVATE="
|
||||
"GOPROXY="
|
||||
"GOROOT="
|
||||
"GOSUMDB="
|
||||
"GOTMPDIR="
|
||||
"GOTOOLDIR="
|
||||
"PKG_CONFIG="
|
||||
goenvvars=(
|
||||
"GOARCH[architecture, or processor, for which to compile code.]:architecture"
|
||||
"GCCGO[gccgo command to run.]:gccgo command"
|
||||
"GOBIN[directory where 'go install' installs to]:go install target dir"
|
||||
"GOCACHE[directory to store cached information]:go build cache dir"
|
||||
"GODEBUG[enable runtime debug facilities]:runtime debug settings"
|
||||
"GOENV[location of the go environment configuration file]:configuration file"
|
||||
"GOFLAGS[default go command line flags]:space sparated default command line flags"
|
||||
"GOINSECURE[module prefixes that are feched insecurely]:comma separated module prefixes"
|
||||
"GOOS[target operating system]:operating system"
|
||||
"GOPATH[path to resolve import statements]:import path"
|
||||
"GOPROXY[URL of go module proxy]:proxy url"
|
||||
"GOROOT[root of the go tree]:go root directory"
|
||||
"GOTMPDIR[directory for temporary sources, packages, and binaries]:tmp directory"
|
||||
"GOPRIVATE[modules that should always be fetched directly]:comma separated glob patterns"
|
||||
"GONOPROXY[modules that should always be fetched directly]:comma separated glob patterns"
|
||||
"GONOSUMDB[modules that should not be compared against the checksum db]:comma separated glob patterns"
|
||||
"GOSUMDB[checksum database]:name(+publickey( url))"
|
||||
"AR[command for manipulating library archives (for gccgo)]:archive manipulation program"
|
||||
"CC[command to compile C code]:C compiler"
|
||||
"CGO_ENABLED[enable/disable cgo]:boolean"
|
||||
"CGO_CFLAGS[flags passed to the compiler for C code]:C compilation flags"
|
||||
"CGO_CFLAGS_ALLOW[additional flags to allow to appear in #cgo CFLAGS]:regular expression"
|
||||
"CGO_CFLAGS_DISALLOW[flags that must be disallowed from appearing in #cgo CFLAGS]"
|
||||
"CGO_CPPFLAGS[flags passed to the C preprocessor]:C preprocessor flags"
|
||||
"CGO_CPPFLAGS_ALLOW[additional flags to allow to appear in #cgo CPPFLAGS]:regular expression"
|
||||
"CGO_CPPFLAGS_DISALLOW[flags that must be disallowed from appearing in #cgo CPPFLAGS]"
|
||||
"CGO_CXXFLAGS[flags passed to the compiler for C++ code]:C++ compilation flags"
|
||||
"CGO_CXXFLAGS_ALLOW[additional flags to allow to appear in #cgo CXXFLAGS]:regular expression"
|
||||
"CGO_CXXFLAGS_DISALLOW[flags that must be disallowed from appearing in #cgo CXXFLAGS]"
|
||||
"CGO_FFLAGS[flags passed to the compiler for Fortran code]:Fortran compilation flags"
|
||||
"CGO_FFLAGS_ALLOW[additional flags to allow to appear in #cgo FFLAGS]:regular expression"
|
||||
"CGO_FFLAGS_DISALLOW[flags that must be disallowed from appearing in #cgo FFLAGS]"
|
||||
"CGO_LDFLAGS[flags passed to the compiler for linker]:linker flags"
|
||||
"CGO_LDFLAGS_ALLOW[additional flags to allow to appear in #cgo LDFLAGS]:regular expression"
|
||||
"CGO_LDFLAGS_DISALLOW[flags that must be disallowed from appearing in #cgo LDFLAGS]"
|
||||
"CXX[command to compile C++]:C++ compiler"
|
||||
"FC[command to compile Fortran]:Fortran compiler"
|
||||
"PKG_CONFIG[Path to pkg-config tool.]:path to pkg-config"
|
||||
"GOARM[arm architecture]:arm architecture"
|
||||
"GO386[x86 instruction set]:x86 instruction set"
|
||||
"GOMIPS[mips instruction set]:mips instruction set"
|
||||
"GOMIPS64[mips64 instruction set]:mips64 instruction set"
|
||||
"GOWASM[web assembly features]:comma separated web assembly features"
|
||||
"GCCGOTOOLDIR[directory of gccgo tools]:gccgo tool director"
|
||||
"GOROOT_FINAL[root of the go tree]:go root"
|
||||
"GO_EXTLINK_ENABLED[enable external linking mode]:boolean"
|
||||
"GIT_ALLOW_PROTOCOL[schemes allowed to fetch]:colon separated git schemes"
|
||||
"GOEXE[suffix for executables]:executable suffix"
|
||||
"GOGCCFLAGS[arguments supplied to CC]:space separated arguments to CC"
|
||||
"GOHOSTARCH[architecture of the toolchain binaries]:host os architecture"
|
||||
"GOHOSTOS[operating system of the toolchain binaries]:host os"
|
||||
"GOMOD[absolute path the the main go.mod]:abs path to main go.mod"
|
||||
"GOTOOLDIR[installation directory of go tools]:tool installation directory"
|
||||
)
|
||||
local -a exclude_from_w
|
||||
exclude_from_w=(GOENV)
|
||||
|
||||
if (( $CURRENT == 2 )); then
|
||||
_arguments \
|
||||
__list_env_vars() {
|
||||
# the parameter expansion strops off everything after the first [
|
||||
_values -s ' ' -w 'environment variable' ${goenvvars[@]%%\[*}
|
||||
}
|
||||
|
||||
# the ^ parameter expansion appends ": __go_envvarvals" to every element of goenvvars
|
||||
# the :# parameter expansion removes all elements matching GOENV*
|
||||
[[ $words[2] != '-w' ]] && _arguments \
|
||||
'-json[print the environment in JSON format]' \
|
||||
'-u[unset environment variables]' \
|
||||
'-w[change the default setting of environment variables]' \
|
||||
'*:[show environment variable]:_values ${goenvvars%=}'
|
||||
else
|
||||
case $words[2] in
|
||||
-w)
|
||||
if compset -P '*='; then
|
||||
else
|
||||
_values -S "=" 'environment variable' $goenvvars
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
_values -s ' ' -w 'environment variable' ${goenvvars%=}
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
'*:[show environment variable]: __list_env_vars' || _values \
|
||||
-s ' ' -S "=" -w 'environment variable' ${^goenvvars:#GOENV*}": __go_envvarvals"
|
||||
;;
|
||||
|
||||
fix)
|
||||
|
@ -234,6 +497,7 @@ case $state in
|
|||
;;
|
||||
|
||||
get)
|
||||
# no mod_flags for get
|
||||
_arguments \
|
||||
'-d[instructs get to stop after downloading the packages]' \
|
||||
'-f[force get -u not to verify that each package has been checked from vcs]' \
|
||||
|
@ -251,15 +515,26 @@ case $state in
|
|||
;;
|
||||
|
||||
list)
|
||||
_arguments \
|
||||
'-e[changes the handling of erroneous packages]' \
|
||||
'-f[specifies an alternate format for the list]:format' \
|
||||
'-json[causes package data to be printed in JSON format]' \
|
||||
'-compiled[set CompiledGoFiles to the Go source files presented to the compiler]' \
|
||||
'-deps[iterate over named packages and their dependencies]' \
|
||||
'-m[list modules instead of packages]' \
|
||||
${build_flags[@]} \
|
||||
local -a list_args
|
||||
list_args=(
|
||||
'-e[changes the handling of erroneous packages]'
|
||||
'-f[specifies an alternate format for the list]:format'
|
||||
'-json[causes package data to be printed in JSON format]'
|
||||
'-compiled[set CompiledGoFiles to the Go source files presented to the compiler]'
|
||||
'-deps[iterate over named packages and their dependencies]'
|
||||
'-m[list modules instead of packages]'
|
||||
${build_flags[@]}
|
||||
${mod_flags[@]}
|
||||
'*:importpaths:__go_packages'
|
||||
)
|
||||
# -u and -versions are only available if -m is present on the commandline
|
||||
if (($words[(I)-m])); then
|
||||
list_args+=(
|
||||
'-u[adds information about available upgrades]'
|
||||
'-versions[list all known versions of modules]'
|
||||
)
|
||||
fi
|
||||
_arguments ${list_args[@]}
|
||||
;;
|
||||
|
||||
mod)
|
||||
|
@ -730,6 +1005,8 @@ case $state in
|
|||
'importpath:import path syntax'
|
||||
'modules:modules, module versions, and more'
|
||||
'module-get:module-aware go get'
|
||||
'module-auth:module authentication using go.sum'
|
||||
'module-private:module configuration for non-public modules'
|
||||
'packages:package lists and patterns'
|
||||
'testflag:testing flags'
|
||||
'testfunc:testing functions'
|
||||
|
@ -740,3 +1017,11 @@ case $state in
|
|||
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
|
||||
|
|
28
src/_httpie
28
src/_httpie
|
@ -37,11 +37,9 @@
|
|||
# * Akira Maeda <https://github.com/glidenote>
|
||||
# * Valodim <https://github.com/Valodim>
|
||||
# * Claus Klingberg <https://github.com/cjk>
|
||||
# * Shohei YOSHIDA <https://github.com/syohex>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_httpie_params () {
|
||||
|
||||
|
@ -153,12 +151,15 @@ integer NORMARG
|
|||
_arguments -n -C -s \
|
||||
'(-j --json -f)'{-j,--json}'[Data items from the command line are serialized as a JSON object.]' \
|
||||
'(-f --form -j)'{-f,--form}'[Data items from the command line are serialized as form fields.]' \
|
||||
'(-x --compress)'{-x,--compress}'[Content compressed with Deflate algorithm]' \
|
||||
'--pretty=[Controls output processing.]:output format:(all colors format none)' \
|
||||
'(-s --style)'{-s,--style}'=[Output coloring style]:STYLE:(autumn borland bw colorful default emacs friendly fruity manni monokai murphy native pastie perldoc ttr solarized tango trac vim vs)' \
|
||||
'(-p --print)'{-p,--print}'=[String specifying what the output should contain]:print flags:_httpie_printflags' \
|
||||
'(-v --verbose)'{-v,--verbose}'[Print the whole request as well as the response.]' \
|
||||
'(-p -h --headers)'{-h,--headers}'[Print only the response headers.]' \
|
||||
'(-p -b --body)'{-b,--body}'[Print only the response body.]' \
|
||||
'--all[By default, only the final request/response is shown]' \
|
||||
'(--P --history-print)'{-P,--history-print}'=[The same as --print but applies only to intermediary requests/response]:print flags:_httpie_printflags' \
|
||||
'(-S --stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f`.]' \
|
||||
'(-o --output)'{-o,--output}'=[Save output to FILE.]:output file:_files' \
|
||||
'(-d --download)'{-d,--download}'=[Do not print the response body to stdout.]' \
|
||||
|
@ -167,15 +168,32 @@ _arguments -n -C -s \
|
|||
'(--session)--session-read-only=[Create or read a session without updating it form the request/response exchange.]:session name (or path)' \
|
||||
'(-a --auth)'{-a,--auth}'=[If only the username is provided (-a username)]:USER\:PASS' \
|
||||
'--auth-type=[The authentication mechanism to be used. Defaults to "basic".]:AUTH-TYPE:(basic digest)' \
|
||||
'--ignore-netrc[Ignore credentials from .netrc]' \
|
||||
'--offline[Build the request and print it but do not actually send it]' \
|
||||
'--proxy=[String mapping protocol to the URL of the proxy.]:PROXY' \
|
||||
'--follow[Allow full redirects.]' \
|
||||
'(-F --follow)'{-F,--follow}'[Allow full redirects.]' \
|
||||
'--max-redirects=[A limit of redirects]:number:' \
|
||||
'--max-headers=[The maximum number of response headers to be read]:number:' \
|
||||
"--verify=[Enable or disable verification of ssl certificates.]:verify certificate:(yes no)" \
|
||||
'--ssl=[The desired protocol version to use]:ssl version:(ssl2.3 tls1 tls1.1 tls1.2)' \
|
||||
'--cert=[Specify a local cert to use as client side SSL certificate]:cert:_files' \
|
||||
'--cert-key=[Specify the private to key to use with SSL]:cert key:_files' \
|
||||
'--allow-redirects[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new ``Location``)]' \
|
||||
'--timeout=[Float describes the timeout of the request (Use socket.setdefaulttimeout() as fallback).]:timeout (seconds)' \
|
||||
'--check-status[This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \
|
||||
'--ignore-stdin[Do not attempt to read stdin.]' \
|
||||
'--path-as-is[Bypass dot segment URL squashing]' \
|
||||
'(-I --ignore-stdin)'{-I,--ignore-stdin}'[Do not attempt to read stdin.]' \
|
||||
'(- *)--help[show help message.]' \
|
||||
"(- *)--version[show program's version number and exit.]" \
|
||||
'--traceback[Prints exception traceback should one occur.]' \
|
||||
'--default-scheme=[The default scheme to use if not specified in the URL]:scheme:' \
|
||||
'--debug[Prints exception traceback should one occur and other information useful for debugging HTTPie itself.]' \
|
||||
'*:args:_httpie_params' && return 0
|
||||
|
||||
# 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
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
#compdef mc
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2019 Sebastian Gniazdowski
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Sebastian Gniazdowski (https://github.com/psprint)
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
setopt localoptions warncreateglobal typesetsilent
|
||||
|
||||
local -a opts
|
||||
opts=(
|
||||
{-h,--help}'[show help on options]'
|
||||
--help-all'[show help on all options]'
|
||||
--help-terminal'[terminal options help]'
|
||||
--help-color'[color options help]'
|
||||
{-a,--stickchars}'[use stickchars to draw]'
|
||||
'(-c --color -b --nocolor)'{-b,--nocolor}'[requests to run in black and white]'
|
||||
'(-b --nocolor -c --color)'{-c,--color}'[request to run in color mode]'
|
||||
{-C,--colors=}'[specifies a color configuration]:arg:'
|
||||
--configure-options'[print configure options]'
|
||||
{-d,--nomouse}'[disable mouse support in text version]'
|
||||
{-d,--debuglevel=}'[save the debug level for SMB VFS]:debug level:(0 1 2 3 4 5 6 7 8 9 10)'
|
||||
{-e,--edit=}'[edit files]:file:_files'
|
||||
{-f,--datadir}'[print data directory]'
|
||||
{-F,--datadir-info}'[print extended info about used data directories]'
|
||||
{-g,--oldmouse}'[tries to use an old highlight mouse tracking]'
|
||||
{-k,--resetsoft}'[resets soft keys on HP terminals]'
|
||||
{-K,--keymap=}'[load definitions of key bindings from specified file]:file:_files'
|
||||
{-l,--ftplog=}'[log ftp dialog to specified file]:file:_files'
|
||||
--nokeymap'[dont load definitions of key bindings from file, use defaults]'
|
||||
{-P,--printwd=}'[print last working directory to specified file]:file:_files'
|
||||
{-s,--slow}'[to run on slow terminals]'
|
||||
{-S,--skin=}'[show mc with specified skin]:skin:'
|
||||
{-t,--termcap}'[tries to use termcap instead of terminfo]'
|
||||
'(-U --subshell -u --nosubshell)'{-u,--nosubshell}'[disables subshell support]'
|
||||
'(-u --nosubshell -U --subshell)'{-U,--subshell}'[enables subshell support (default)]'
|
||||
{-v,--view=}'[launches the file viewer on a file]:file:_files'
|
||||
{-V,--version}'[displays the current version]'
|
||||
{-x,--xterm}'[forces xterm features]'
|
||||
{-X,--no-x11}'[disable X11 support]'
|
||||
'*:pane directory:_directories'
|
||||
)
|
||||
|
||||
_arguments -s $opts
|
||||
|
||||
# Return value passes through
|
||||
|
||||
# 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
|
|
@ -31,6 +31,7 @@ _arguments -s -C \
|
|||
{-c,--constantshow}'[Constantly show cursor position]'\
|
||||
{-d,--rebinddelete}'[Fix Backspace/Delete confusion problem]'\
|
||||
{-e,--emptyline}'[Keep the line below the title bar empty]'\
|
||||
{-f,--rcfile=}'[Use only this file for configuring nano]:file:_files'\
|
||||
{-g,--showcursor}'[Show cursor in file browser & help text]'\
|
||||
'(- *)'{-h,--help}'[Show help text and exit]'\
|
||||
{-i,--autoindent}'[Automatically indent new lines]'\
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
#compdef nanoc
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2020 OKURA Masafumi, MIT License
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for nanoc (https://nanoc.ws/)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * OKURA Masafumi (https://okuramasafumi.com)
|
||||
#
|
||||
# This works is heavily inspired by the middleman completion by
|
||||
# Jozef Izso (https://github.com/jozefizso)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
local ret=1 state
|
||||
|
||||
local -a common_ops
|
||||
common_ops=(
|
||||
{-C,--no-color}"[disable color]"
|
||||
{-V,--verbose}"[make output more detailed]"
|
||||
{-d,--debug}"[enable debugging]"
|
||||
{-e,--env=}"[set environment]"
|
||||
{-h,--help}"[show the help message and quit]"
|
||||
{-l,--color}"[enable color]"
|
||||
{-v,--version}"[show version information and quit]"
|
||||
{-w,--warn}"[enable warnings]"
|
||||
)
|
||||
|
||||
typeset -A opt_args
|
||||
_arguments \
|
||||
':subcommand:->subcommand' \
|
||||
$common_ops \
|
||||
'*::options:->options' && ret=0
|
||||
|
||||
case $state in
|
||||
subcommand)
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
"check:run issue checks"
|
||||
"compile:compile items of this site"
|
||||
"create-site:create a site"
|
||||
"deploy:deploy the compiled site"
|
||||
"help:show help"
|
||||
"prune:remove files not managed by Nanoc from the output directory"
|
||||
"shell:open a shell on the Nanoc environment"
|
||||
"show-data:show data in this site"
|
||||
"show-plugins:show all available plugins"
|
||||
"show-rules:describe the rules for each item"
|
||||
"view:start the web server that serves static files"
|
||||
)
|
||||
|
||||
_describe -t subcommands 'nanoc subcommand' subcommands && ret=0
|
||||
;;
|
||||
|
||||
options)
|
||||
local -a args
|
||||
args=(
|
||||
$common_ops
|
||||
)
|
||||
|
||||
local -a help
|
||||
help=(
|
||||
"--help[Display help information]"
|
||||
)
|
||||
|
||||
case $words[1] in
|
||||
check)
|
||||
args=(
|
||||
{-L,--list}"[list all checks]"
|
||||
{-a,--all}"[run all checks]"
|
||||
)
|
||||
;;
|
||||
|
||||
compile)
|
||||
args=(
|
||||
"--diff[generate diff]"
|
||||
)
|
||||
;;
|
||||
|
||||
create-site)
|
||||
args=(
|
||||
"--force[force creation of new site]"
|
||||
)
|
||||
;;
|
||||
|
||||
deploy)
|
||||
args=(
|
||||
{-C,--no-check}"[do not run the issue checks marked for deployment]"
|
||||
{-D,--list-deployers}"[list available deployers]"
|
||||
{-L,--list}"[list available locations to deploy to]"
|
||||
{-n,--dry-run}"[show what would be deployed]"
|
||||
{-t,--target=}"[specify the location to deploy to (default:\`default\`)]"
|
||||
)
|
||||
;;
|
||||
|
||||
prune)
|
||||
args=(
|
||||
{-n,--dry-run}"[print files to be deleted instead of actually deleting them]"
|
||||
{-y,--yes}"[confirm deletion]"
|
||||
)
|
||||
;;
|
||||
|
||||
shell)
|
||||
args=(
|
||||
{-p,--preprocess}"[run preprocessor]"
|
||||
)
|
||||
;;
|
||||
|
||||
show-data)
|
||||
args=(
|
||||
)
|
||||
;;
|
||||
|
||||
show-plugins)
|
||||
args=(
|
||||
)
|
||||
;;
|
||||
|
||||
show-rules)
|
||||
args=(
|
||||
)
|
||||
;;
|
||||
|
||||
view)
|
||||
args=(
|
||||
{-H,--handler=}"[specify the handler to use(webrick/mongrel/...)]"
|
||||
{-L,--live-reload}"[reload on changes]"
|
||||
{-o,--host=}"[specify the host to listen on(default: 127.0.0.1)]"
|
||||
{-p,--port=}"[specify the port to listen on(default: 3000)]"
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
||||
_arguments $args && ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
27
src/_node
27
src/_node
|
@ -52,6 +52,15 @@ _node_files() {
|
|||
_files -g "*.(js|mjs)"
|
||||
}
|
||||
|
||||
_node_args() {
|
||||
if (( CURRENT == 2 )); then
|
||||
_alternative "_node_files" "_values 'command' 'inspect[enable inspector for debugging]'"
|
||||
return
|
||||
fi
|
||||
|
||||
_node_files
|
||||
}
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
typeset -A opt_args
|
||||
|
||||
|
@ -64,8 +73,11 @@ _arguments -C \
|
|||
'--cpu-prof-dir=[directory where the V8 profiles generated by --cpu-prof]: :_files -/' \
|
||||
'--cpu-prof-name=[file name of the V8 profile generated with --cpu-prof]: :_files' \
|
||||
'--cpu-prof-interval=[sampling interval in microseconds for the V8 CPU profiler]:number' \
|
||||
'--disable-proto=[disable Object.prototype.__proto__]:mode:(delete throw)' \
|
||||
'--disallow-code-generation-from-strings[disallow eval and friends]' \
|
||||
'--enable-source-maps[source map support]' \
|
||||
'--experimental-import-meta-resolve[experimental ES Module import.meta.resolve() support]' \
|
||||
'(--loader --experimental-loader)'{--loader,--experimental-loader}'=[Specify the module of a custom ECMAScript Module loader]: :_files' \
|
||||
'--experimental-modules[experimental ES Module support and caching modules]' \
|
||||
'--experimental-policy=[security policy file]: :_files' \
|
||||
'--experimental-repl-await[experimental await keyword support in REPL]' \
|
||||
|
@ -83,13 +95,16 @@ _arguments -C \
|
|||
'--heapsnapshot-signal=[Generate heap snapshot on specified signal]:signals:_signals -s' \
|
||||
'--http-parser=[HTTP parser]:HTTP parser:(legacy llhttp)' \
|
||||
'--http-server-default-timeout=[default http server socket timeout in ms]::number' \
|
||||
'--huge-max-old-generation-size[increase default maximum heap size with 16GB or more]' \
|
||||
'--icu-data-dir=[set ICU data load path to dir (overrides NODE_ICU_DATA) note: linked-in ICU data is present]: :_directories' \
|
||||
'--input-type=[set module type for string input]:module type :(commonjs module)' \
|
||||
'--insecure-http-parser[Use an insecure HTTP parser that accepts invalid HTTP headers]' \
|
||||
'--inspect-brk=-[activate inspector on host:port and break at start of user script]:[host\:]port' \
|
||||
'--inspect-port=[set host:port for inspector]:[host\:]port' \
|
||||
'(--debug-port --inspect-port)'{--debug-port,--inspect-port}'=[set host:port for inspector]:[host\:]port' \
|
||||
'--inspect=-[activate inspector on host:port (default: 127.0.0.1:9229)]:[host\:]port' \
|
||||
'--inspect-publish-uid=[comma separated list of destinations for inspector uid]' \
|
||||
'--interpreted-frames-native-stack[helm system profilers to translate JavaScript interpreted frames]' \
|
||||
'--jitless[Disable runtime allocation of executable memory]' \
|
||||
'--max-http-header-size=[set the maximum size of HTTP headers]::number' \
|
||||
'--napi-modules[load N-API modules (no-op - option kept for compatibility)]' \
|
||||
'--no-deprecation[silence deprecation warnings]' \
|
||||
|
@ -97,11 +112,13 @@ _arguments -C \
|
|||
'--no-warnings[silence all process warnings]' \
|
||||
'--openssl-config=[load OpenSSL configuration from the specified file (overrides OPENSSL_CONF)]:file:_files' \
|
||||
'--pending-deprecation[emit pending deprecation warnings]' \
|
||||
'--policy-integrity=[ensure the security policy contents match the specified integrity]' \
|
||||
'--preserve-symlinks[preserve symbolic links when resolving]' \
|
||||
'--preserve-symlinks-main[preserve symbolic links when resolving the main module]' \
|
||||
'--prof[generate V8 profiler output]' \
|
||||
'--prof-process[process V8 profiler output generated using --prof]' \
|
||||
'--redirect-warnings=[write warnings to file instead of stderr]: :_files' \
|
||||
'--report-compact[output compact single-line JSON]' \
|
||||
'--report-directory=[custom report path]: :_files -/' \
|
||||
'--report-filename=[custom report file name]: :_files' \
|
||||
'--report-on-fatalerror[generate diagnostic report on fatal (internal) errors]' \
|
||||
|
@ -123,11 +140,14 @@ _arguments -C \
|
|||
'--trace-event-file-pattern[Template string specifying the filepath for the trace-events data, it supports ${rotation} and ${pid} log-rotation id. %2$u is the pid.]:template string' \
|
||||
'--trace-events-enabled[track trace events]' \
|
||||
'--trace-exit[show stack trace when an environment exits]' \
|
||||
'--trace-sigint[prints a stack trace on SIGINT]' \
|
||||
'--trace-sync-io[show stack trace when use of sync IO is detected after the first tick]' \
|
||||
'--trace-tls[prints TLS packet trace information to stderr]' \
|
||||
'--trace-warnings[show stack traces on process warnings]' \
|
||||
'--track-heap-objects[track heap object allocations for heap snapshots]' \
|
||||
'--unhandled-rejections=[define unhandled rejections behavior]:rejection behavior:(strict warn none)' \
|
||||
'--use-bundled-ca[use bundled CA store (default)]' \
|
||||
'--use-largepages=[re-map the Node.js static code to large memory pages at startup]:mode:(off on silent)' \
|
||||
"--use-openssl-ca[use OpenSSL's default CA store]" \
|
||||
'(- 1 *)--v8-options[print v8 command line options]' \
|
||||
"--v8-pool-size=[set v8's thread pool size]:number" \
|
||||
|
@ -139,10 +159,7 @@ _arguments -C \
|
|||
'(- 1 *)'{-p,--print}'[evaluate script and print result]:inline JavaScript' \
|
||||
'*'{-r,--require}'[module to preload (option can be repeated)]: :_node_files' \
|
||||
'(- 1 *)'{-v,--version}'[print Node.js version]' \
|
||||
'*: :_node_files' && ret=0
|
||||
|
||||
_values 'commands' \
|
||||
'inspect[enable inspector for debugging]' && ret=0
|
||||
'*: :_node_args' && ret=0
|
||||
|
||||
return ret
|
||||
|
||||
|
|
814
src/_perf
814
src/_perf
|
@ -10,9 +10,140 @@
|
|||
# -------
|
||||
#
|
||||
# * Julien Nicoulaud <julien.nicoulaud@gmail.com>
|
||||
# * Shohei YOSHIDA <syohex@gmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_perf_events() {
|
||||
local -a events=(${(@f)$(perf list | sed -n -e 's/^ \([^ =]*\).*$/\1/p')})
|
||||
_values -s ',' 'events' $events
|
||||
}
|
||||
|
||||
_perf_top_fields() {
|
||||
local fields=(overhead overhead_sys overhead_us overhead_children sample period)
|
||||
_values -s ',' 'fields' $fields
|
||||
}
|
||||
|
||||
_perf_pids() {
|
||||
local -a pids=(/proc/[1-9]*(:t))
|
||||
_values -s ',' 'pids' $pids
|
||||
}
|
||||
|
||||
_perf_stat_command() {
|
||||
_alternative "_command_names -e" "subcommand:command:(record report)"
|
||||
}
|
||||
|
||||
_perf_c2c_coalesce() {
|
||||
local columns=(tid pid iaddr dso)
|
||||
_values -s ',' 'columns' $columns
|
||||
}
|
||||
|
||||
_perf_mem_type() {
|
||||
local types=(load store)
|
||||
_values -s ',' 'type' $types
|
||||
}
|
||||
|
||||
_perf_test_list() {
|
||||
# TODO show test detail
|
||||
local -a test_list=(${(@f)$(perf test list 2>&1 | sed -n -e 's/^ *\([^ ]*\): \(.*\)$/\1/p')})
|
||||
_values -s ',' 'test' $test_list
|
||||
}
|
||||
|
||||
_perf_report_sort_keys() {
|
||||
local -a sort_keys=(
|
||||
"comm" "pid" "dso" "dso_size" "symbol" "symbol_size" "parent" "cpu"
|
||||
"socket" "srcline" "srcfile" "weight" "local_weight" "cgroup_id"
|
||||
"transaction" "overhead" "overhead_sys" "overhead_us" "overhead_guest_sys"
|
||||
"overhead_guest_us" "sample" "period" "time" "dso_from" "dso_to" "symbol_from"
|
||||
"symbol_to" "srcline_from" "srcline_to" "mispredict" "in_tx" "abort" "cycles"
|
||||
"symbol_daddr" "dso_daddr" "locked" "tlb" "mem" "snoop" "dcacheline"
|
||||
"phys_daddr" "trace" "trace_fields"
|
||||
)
|
||||
|
||||
_values -s ',' 'keys' $sort_keys
|
||||
}
|
||||
|
||||
_perf_branch_filter() {
|
||||
local -a filters=(
|
||||
'any:any type of branches'
|
||||
'any_call:any function call or system call'
|
||||
'any_ret:any function return or system call return'
|
||||
'ind_call:any indirect branch'
|
||||
'call:direct calls, including far (to/from kernel) calls'
|
||||
'u:only when the branch target is at the user level'
|
||||
'k:only when the branch target is in the kernel'
|
||||
'hv:only when the target is at the hypervisor level'
|
||||
'in_tx:only when the target is in a hardware transaction'
|
||||
'no_tx:only when the target is not in a hardware transaction'
|
||||
'abort_tx:only when the target is a hardware transaction abort'
|
||||
'cond:conditional branches'
|
||||
'save_type:save branch type during sampling in case binary is not available later'
|
||||
)
|
||||
_describe -t filters 'branch filter' filters
|
||||
}
|
||||
|
||||
_perf_clock_id() {
|
||||
local clocks=(CLOCK_MONOTONIC CLOCK_MONOTONIC_RAW CLOCK_BOOTTIME CLOCK_REALTIME CLOCK_TAI)
|
||||
_values 'clocks' $clocks
|
||||
}
|
||||
|
||||
_perf_lock_subcommand() {
|
||||
local -a subcmds=(
|
||||
'record:records lock events'
|
||||
'report:reports statistical data'
|
||||
'script:shows raw lock events'
|
||||
'info:shows metadata like threads or addresses of lock instances'
|
||||
)
|
||||
_describe -t subcmds 'lock subcommand ' subcmds
|
||||
}
|
||||
|
||||
_perf_trace_subcommand() {
|
||||
_alternative "_command_names -e" "subcommand:command:(record)"
|
||||
}
|
||||
|
||||
_perf_kmem_sort_keys() {
|
||||
local -a keys=(ptr callsite bytes hit pingpong frag page order migtype gfp)
|
||||
|
||||
for ((i = 1; i < CURRENT; i++))
|
||||
do
|
||||
if [[ $words[$i] == "--slab" ]]; then
|
||||
keys=(ptr callsite bytes hit pingpong frag)
|
||||
break
|
||||
fi
|
||||
if [[ $words[$i] == "--page" ]]; then
|
||||
keys=(page callsite hit order migtype gfp)
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
_values -s ',' 'key' $keys
|
||||
}
|
||||
|
||||
_perf_sched_subcommand() {
|
||||
local -a subcmds=(
|
||||
'record:record the scheduling events'
|
||||
'latency:report the per task scheduling latencies'
|
||||
'script:see a detailed trace'
|
||||
'replay:simulate the workload'
|
||||
'map:print a textual context-switching outline'
|
||||
'timehist:provides an analysis of scheduling events'
|
||||
)
|
||||
_describe -t subcmds 'lock subcommand ' subcmds
|
||||
}
|
||||
|
||||
_perf_script_fields() {
|
||||
local -a fields=(
|
||||
"comm" "tid" "pid" "time" "cpu" "event" "trace" "ip" "sym" "dso"
|
||||
"addr" "symoff" "srcline" "period" "iregs" "uregs" "brstack"
|
||||
"brstacksym" "flags" "bpf-output" "brstackinsn" "brstackoff"
|
||||
"callindent" "insn" "insnlen" "synth" "phys_addr" "metric"
|
||||
"misc" "srccode" "ipc"
|
||||
)
|
||||
|
||||
compset -P '(hw|sw|trace):'
|
||||
|
||||
_values -s ',' 'fields' $fields
|
||||
}
|
||||
|
||||
_perf() {
|
||||
local context curcontext="$curcontext" state line
|
||||
|
@ -63,19 +194,26 @@ _perf() {
|
|||
&& ret=0
|
||||
;;
|
||||
(bench)
|
||||
# TODO Complete subsystems
|
||||
# TODO Complete suites
|
||||
_arguments \
|
||||
'(-f --format)'{-f,--format=}'[specify format style]: :((default\:mainly\ for\ human\ reading simple\:friendly\ for\ automated\ processing\ by\ scripts))' \
|
||||
'1::subsystem' \
|
||||
'2::suite' \
|
||||
'(-r --repeat)'{-r,--repeat=}'[specify amount of times to repeat the run]' \
|
||||
'(-f --format)'{-f,--format=}'[specify format style]: :(default simple)' \
|
||||
'1:subsystem:(sched mem numa futex epoll all)' \
|
||||
'*:: :->bench_subsystem' \
|
||||
&& ret=0
|
||||
;;
|
||||
(buildid-cache)
|
||||
_arguments \
|
||||
'(-a --add)'{-a,--add=}'[add specified file to the cache]: :_files' \
|
||||
'(-f --force)'{-f,--force}'[do not complain, do it]' \
|
||||
'(-k --kcore)'{-k,--kcore=}'[add specified kcore file to core]:kcore:_files' \
|
||||
'(-r --remove)'{-r,--remove=}'[remove specified file from the cache]: :_files' \
|
||||
'(-p,--purge)'{-p,--purge=}'[purge all cached binaries including older caches which have specified path]: :_files' \
|
||||
'(-P,--purge-all)'{-P,--purge-all}'[purge all cached binaries]' \
|
||||
'(-M,--missing)'{-M,--missing=}'[list missing build ids in the cache for the specified file]: :_files' \
|
||||
'(-u,--update)'{-u,--update=}'[update specified file of the cache]: :_files' \
|
||||
'(-l,--list)'{-l,--list}'[list all valid binaries from cache]' \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'--target-ns=[obtain mount namespace information from the target pid]: :_pids' \
|
||||
&& ret=0
|
||||
;;
|
||||
(buildid-list)
|
||||
|
@ -87,6 +225,24 @@ _perf() {
|
|||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(c2c)
|
||||
_arguments \
|
||||
'1:subcmd:(record report)' \
|
||||
'*:: :->c2c_args'
|
||||
;;
|
||||
(config)
|
||||
_arguments \
|
||||
'(-l --list)'{-l,--list}'[show current config variables for all sections]' \
|
||||
'--user[read or write user config]' \
|
||||
'--system[read or write system config]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(data)
|
||||
_arguments \
|
||||
'1:command:((convert))' \
|
||||
'*:: :->data_args' \
|
||||
&& ret=0
|
||||
;;
|
||||
(diff)
|
||||
_arguments \
|
||||
'(-M --displacement)'{-M,--displacement}'[show position displacement relative to baseline]' \
|
||||
|
@ -109,21 +265,54 @@ _perf() {
|
|||
'(-i --input)'{-i,--input=}'[input file name]: :_files' \
|
||||
&& ret=0
|
||||
;;
|
||||
(ftrace)
|
||||
_arguments \
|
||||
'(-t --tracer)'{-t,--tracer=}'[tracer to use]:tracer:(function_tracer function)' \
|
||||
'(-v --verbose)'{-v,--verbose=}'[verbosity level]:level:' \
|
||||
'(-p --pid)'{-p,--pid=}'[trace on existing process ID]:pids:_perf_pids' \
|
||||
'(-a --all-cpus)'{-a,--all-cpus}'[force system-wide collection]' \
|
||||
'(-C --cpu)'{-C,--cpu=}'[only trace for the list of CPUs]:cpu_list:' \
|
||||
\*{-T,--trace-funcs=}'[only trace functions given by the argument]:func:' \
|
||||
\*{-N,--notrace-funcs=}'[do not trace functions given by the argument]:func:' \
|
||||
\*{-G,--graph-funcs=}'[set graph filter on the given function]:func:' \
|
||||
\*{-g,--nograph-funcs=}'[set graph notrace filter on the given function]:func:' \
|
||||
'(-D,--graph-depth)'{-D,--graph-depth=}'[set max depth for function graph tracer]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(inject)
|
||||
_arguments \
|
||||
'(-b --build-ids)'{-b,--build-ids=}'[inject build-ids into the output stream]:build-id list' \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'(-i --input)'{-i,--input=}'[input file name]:input:_files' \
|
||||
'(-o --output)'{-o,--output=}'[output file name]:output:_files' \
|
||||
'(-s --sched-stat)'{-s,--sched-stat}'[merge sched_stat and sched_switch for getting events]' \
|
||||
'--kallsyms=[kallsyms file]:kallsyms:_files' \
|
||||
'--itrace=[decode instruction tracing data]' \
|
||||
'--strip[use with --itrace to strip out non-synthesized events]' \
|
||||
'(-j --jit)'{-j,--jit}'[process jitdump files]' \
|
||||
'(-f --force)'{-f,--force}'[do not complain, do it]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(kallsyms)
|
||||
_arguments \
|
||||
'(-v --verbose)'{-v,--verbose=}'[increase verbosity level]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(kmem)
|
||||
# TODO Complete 'record' command
|
||||
_arguments \
|
||||
'(-i --input)'{-i,--input=}'[input file name]: :_files' \
|
||||
'(-f --force)'{-f,--force}'[dont do ownership validation]' \
|
||||
'--caller[show per-callsite statistics]' \
|
||||
'--alloc[show per-allocation statistics]' \
|
||||
'(-s --sort)'{-s,--sort=}'[sort by output]: :_values -s , key frag hit bytes' \
|
||||
'(-s --sort)'{-s,--sort=}'[sort by output]: :_perf_kmem_sort_keys' \
|
||||
'(-n --lines)'{-n,--lines}'[print n lines only]:number' \
|
||||
'--raw-ip[print raw ip instead of symbol]' \
|
||||
'--slab[analyze slab allocator events]' \
|
||||
'--page[analyze page allocator events]' \
|
||||
'--live[show live page stat]' \
|
||||
'--time=[only analyze samples within given time window]:time_window:' \
|
||||
'1:command:((record\:record\ the\ kmem\ events\ of\ an\ arbitrary\ workload stat\:report\ kernel\ memory\ statistics))' \
|
||||
'*:: :->kmem_args' \
|
||||
&& ret=0
|
||||
;;
|
||||
(kvm)
|
||||
|
@ -145,58 +334,438 @@ _perf() {
|
|||
&& ret=0
|
||||
;;
|
||||
(lock)
|
||||
# TODO Complete 'record' command
|
||||
# TODO Complete 'report' command options
|
||||
_arguments \
|
||||
'(-i --input)'{-i,--input=}'[input file name]: :_files' \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'(-D --dump-raw-trace)'{-D,--dump-raw-trace}'[dump raw trace in ASCII]' \
|
||||
'1:command:((record\:record\ lock\ events trace\:show\ raw\ lock\ events report\:report\ statistical\ data))' \
|
||||
'(-f --force)'{-f,--force}'[dont complain do it]' \
|
||||
'1:command:_perf_lock_subcommand' \
|
||||
'*:: :->lock_args' \
|
||||
&& ret=0
|
||||
;;
|
||||
(mem)
|
||||
_arguments \
|
||||
'(-i --input)'{-i,--input=}'[input file name]:file:_files' \
|
||||
'(-f --force)'{-f,--force}'[do not ownership validation]' \
|
||||
'(-t --type)'{-t,--type=}'[select the memory operation type]:type:_perf_mem_type' \
|
||||
'(-D --dump-raw-samples)'{-D,--dump-raw-trace}'[dump the raw decoded samples]' \
|
||||
'(-x --field-separator)'{-x,--field-separator=}'[specify the field separator used when raw samples]:separator:' \
|
||||
'(-C --cpu)'{-C,--cpu=}'[monitor only on the list of CPUs provided]:cpus:' \
|
||||
'(-U --hide-unresolved)'{-U,--hide-unresolved}'[only display entries resolved to a symbol]' \
|
||||
'(-p --phys-data)'{-p,--phys-data}'[record/report sample phisical addresses]' \
|
||||
'1:command:(record report)' \
|
||||
'*::arg:->mem_args' \
|
||||
&& ret=0
|
||||
;;
|
||||
(probe)
|
||||
# TODO not implemented
|
||||
_arguments \
|
||||
'(-k --vmlinux)'{-k,--vmlinux=}'[specify vmlinux path which has debuginfo]:path:_files' \
|
||||
'(-m --module)'{-m,--module=}'[specify module name]:modname_or_path:_files' \
|
||||
'(-s --source)'{-s,--source=}'[specify path to kernel source]:path:_files -/' \
|
||||
'(-v --verbose -q --quiet)'{-v,--verbose}'[be more verbose]' \
|
||||
'(-q --quiet -v --verbose)'{-q,--quiet}'[be quiet]' \
|
||||
\*{-a,--add=}'[define a probe event]:probe:' \
|
||||
\*{-d,--del=}'[delete probe events]:probe:' \
|
||||
'(-l --list)'{-l,--list=}'[list up current probe events]:event:' \
|
||||
'(-L --line)'{-L,--line=}'[show source code lines which can be probed]' \
|
||||
\*{-V,--vars=}'[show available local variables at given probe point]:probe:' \
|
||||
'--externs[show external defined variables]' \
|
||||
'--no-inlines[search only for non-inlined functions]' \
|
||||
\*{-F,--funcs=}'[show available functions in given module or kernel]:filter:' \
|
||||
\*{-D,--definition=}'[show trace-event definition]:probe:' \
|
||||
'*--filter=[set filter]:filter:' \
|
||||
'(-f --force)'{-f,--force}'[forcibly add events with existing name]' \
|
||||
'(-n --dry-run)'{-n,--dry-run}'[dry run]' \
|
||||
'--cache[cache the probes]' \
|
||||
'--max-probes=[set the maximum number of probe points for an event]:number:' \
|
||||
'--target-ns=[obtain mount namespace information from the target pid]:pid:_pids' \
|
||||
'(-x --exec)'{-x,--exec=}'[specify path to the executable of shared library]:path:_files' \
|
||||
'--demangle-kernel[demangle kernel symbols]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(record)
|
||||
# TODO not implemented
|
||||
_arguments \
|
||||
\*{-e,--events=}'[select the PMU event]:event:_perf_events' \
|
||||
'*--filter=[event filter]:filter:' \
|
||||
'--exclude-perf[do not record events issued by perf itself]' \
|
||||
'(-a --all-cpus)'{-a,--all-cpus}'[system-wide collection from all CPUs]' \
|
||||
'(-p --pid)'{-p,--pid=}'[record events on existing process ID]:pids:_perf_pids' \
|
||||
'(-t --tid)'{-t,--tid=}'[record events on existing thread ID]:tids:' \
|
||||
'(-u --uid)'{-u,--uid=}'[record events in threads owned by uid]:uid:' \
|
||||
'(-r --realtime)'{-r,--realtime=}'[collect data with this RT SCHED_FIFO priority]:priority:' \
|
||||
'--no-buffering[collect data without buffering]' \
|
||||
'(-c --count)'{-c,--count=}'[event period to sample]:period:' \
|
||||
'(-o --output)'{-o,--output=}'[output file name]:out_file:_files' \
|
||||
'(-i --no-inherit)'{-i,--no-inherit}'[child tasks do not inherit counters]' \
|
||||
'(-F --freq)'{-F,--freq=}'[profile at this frequency]:freq:(max)' \
|
||||
'--string-freq[fail if the specified frequency cannot be used]' \
|
||||
'(-m --mmap-pages)'{-m,--mmap-pages=}'[number of mmap data pages]:pages:' \
|
||||
'--group[put all events in a single event group]' \
|
||||
'-g[enables call-graph recording]' \
|
||||
'--call-graph=[setup and enable call-graph recording]:method:(fp dwarf lbr)' \
|
||||
'(-q --quiet)'{-q,--quiet}'[do not print any message]' \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'(-s --stat)'{-s,--stat}'[record per-thread event counts]' \
|
||||
'(-d --data)'{-d,--data}'[record the sample virtual addresses]' \
|
||||
'--phys-data[record the sample physical addresses]' \
|
||||
'(-T --timestamp)'{-T,--timestamp}'[record the sample timestamps]' \
|
||||
'(-P --period)'{-P,--period}'[record the sample period]' \
|
||||
'--sample-cpu[record the sample cpu]' \
|
||||
'(-n --no-samples)'{-n,--no-samples}'[do not sample]' \
|
||||
'(-C --cpu)'{-C,--cpu=}'[collect samples only on the list of CPUs provided]:cpus:' \
|
||||
'(-B --no-buildid)'{-B,--no-buildid}'[do not save the build ids of binaries in the perf.data files]' \
|
||||
'(-N --no-buildid-cache)'{-N,--no-buildid-cache}'[do not update the buildid cache]' \
|
||||
\*{-G,--cgroup=}'[monitor only in the container (cgroup) called "name"]:name:' \
|
||||
'(-b --branch-any)'{-b,--branch-any}'[enable taken branch stack sampling]' \
|
||||
'(-j --branch-filter)'{-j,--branch-filter=}'[specify stack sampling filter]:filter:_perf_branch_filter' \
|
||||
'--weight[enable weightened sampling]' \
|
||||
'--namespaces[record events of type PREF_RECORD_NAMESPACES]' \
|
||||
'--transaction[record transaction flags for transaction related events]' \
|
||||
'(-D --delay)'{-D,--delay=}'[wait msecs before measuring]' \
|
||||
'(-I,--intr-regs)'{-I,--intr-regs=}'[capture machine state (registers) at interrupt]:registers:' \
|
||||
'--user-regs=[capture user registers at sample time]:registers:' \
|
||||
'--running-time[record running and enabled time for read events]' \
|
||||
'(-k --clockid)'{-k,--clockid=}'[sets the clockid to use for time fields]:clock_id:_perf_clock_id' \
|
||||
'--proc-map-timeout=[time out(ms) limit of processing /proc/XXX/mmap]:msecs:' \
|
||||
'--switch-events[record context switch events]' \
|
||||
'--clang-path=[path to clang binary to use compiling BPF scripts]:clang_path:_files' \
|
||||
'--clang-opt=[option passed to clang when compiling BPF scripts]:clang_opt:' \
|
||||
'--vmlinux=[specify vmlinux path which has debuginfo]:vmlinux_path:_files' \
|
||||
'--buildid-all[record build-id of all DSOs]' \
|
||||
'--aio=[use "n" control blocks in asynchronous trace writing mode]:number:' \
|
||||
'--affinity=[set affinity mask by mode value]' \
|
||||
'--mmap-flush=[specify minimal number of bytes]:bytes:' \
|
||||
'(-z --compression-level)'{-z,--compression-level=}'[compressed level]:level:' \
|
||||
'--all-kernel[configure all used events to run in kernel space]' \
|
||||
'--all-user[configure all used events to run in user space]' \
|
||||
'(--user-callchains)--kernel-callchains[collect callchains only from kernel space]' \
|
||||
'(--kernel-callchains)--user-callchains[collect callchains only from user space]' \
|
||||
'--timestamp-filename[append timestamp to output file name]' \
|
||||
'--timestamp-boundary[record timestamp boundary]' \
|
||||
'--switch-output=[generate multiple perf.data files based on mode]:mode:' \
|
||||
'--switch-max-files=[when rotating perf.data only keep N files]:number:' \
|
||||
'--dry-run[parse options then exit]' \
|
||||
'--tail-synthesize[collect samples during finalization instead of beginning of recording]' \
|
||||
'--overwrite[makes all events use an overwritable ring buffer]' \
|
||||
'1:command:_command_names -e' \
|
||||
'*::args:_normal' \
|
||||
&& ret=0
|
||||
;;
|
||||
(report)
|
||||
# TODO not implemented
|
||||
_arguments \
|
||||
'(-i --input)'{-i,--input=}'[input file name]:file:_files' \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'(-q --quiet)'{-q,--quiet}'[do not show any message]' \
|
||||
'(-n --show-nr-samples)'{-n,--show-nr-samples}'[show the number of samples for each symbol]' \
|
||||
'--show-cpu-utilization[show sample percentage for different cpu modes]' \
|
||||
'(-T --threads)'{-T,--threads}'[show per-thread event counters]' \
|
||||
'(-c --comms)'{-c,--comms=}'[only consider symbols in these comms]:comms:' \
|
||||
'--pid=[only show events for given process ID]:pid:_perf_pids' \
|
||||
'--tid=[only show events for given thread ID]:tid:' \
|
||||
\*{-d,--dsos=}'[only consider symbols in these dsos]:dsos:' \
|
||||
\*{-S,--symbols=}'[only consider these symbols]:symbol:' \
|
||||
'--symbol-filter=[only show symbols that match with this filter]:filter:' \
|
||||
'(-U --hide-unresolved)'{-U,--hide-unresolved}'[only display entries resolved to a symbol]' \
|
||||
'(-s --sort)'{-s,--sort=}'[sort histogram entries by given keys]:keys:_perf_report_sort_keys' \
|
||||
'(-F --fields)'{-F,--fields=}'[specify output field]:field:(overhead overhead_sys overhead_us overhead_children sample period)' \
|
||||
'(-p --parent)'{-p,--parent=}'[a regex filter to identify parent]:regex:' \
|
||||
'(-x --exclude-other)'{-x,--exclude-other}'[only display entries with parent-match]' \
|
||||
'(-w --column-widths)'{-w,--column-widths=}'[force each column width to the provided list]' \
|
||||
'(-t --field-separator)'{-t,--field-separator=}'[use a special separator character]:sep:' \
|
||||
'(-D --dump-raw-trace)'{-D,--dump-raw-trace}'[dump raw trace in ASCII]' \
|
||||
'(-g --call-graph)'{-g,--call-graph=}'[display call chains using this argument]' \
|
||||
'--children[accumulate callchain of children to parent entry]' \
|
||||
'--max-stack=[set the stack depth limit]:number:' \
|
||||
'(-G --inverted)'{-G,--inverted}'[alias for inverted caller based call graph]' \
|
||||
'--ignore-callees=[regex for ignoring callees of the function]:regex:' \
|
||||
'--pretty=[pretty printing style]:style:(normal raw)' \
|
||||
'--stdio[use the stdio interface]' \
|
||||
'--stdio-color=[color output configuring]:type:(always never auto)' \
|
||||
'--tui[use the TUI interface]' \
|
||||
'--gtk[use the GTK2 interface]' \
|
||||
'(-k --vmlinux --ignore-vmlinux)'{-k,--vmlinux=}'[vmlinux pathname]:vmlinux:_files' \
|
||||
'(-k --vmlinux)--ignore-vmlinux[ignore vmlinux files]' \
|
||||
'--kallsyms=[kallsyms pathname]:kallsyms:_files' \
|
||||
'(-m --modules)'{-m,--modules}'[load module symbols]' \
|
||||
'(-f --force)'{-f,--force}'[do not do ownership validation]' \
|
||||
'--symfs=[look for files with symbols relative to this directory]:symfs:_files -/' \
|
||||
'(-C --cpu)'{-C,--cpu=}'[only report sample for the list of CPUs provided]' \
|
||||
'(-M --disassembler-style)'{-M,--disassembler-style=}'[set disassembler style for objdump]:style:' \
|
||||
'--source[interleave source code with assembly code]' \
|
||||
'--asm-raw[show raw instruction encoding of assembly instructions]' \
|
||||
'--show-total-period[show a column with sum of periods]' \
|
||||
'(-I --show-info)'{-I,--show-info}'[display extended information about the perf.data file]' \
|
||||
'(-b --branch-stack)'{-b,--branch-stack}'[use the addressed of sampled taken branch]' \
|
||||
'--branch-history[add the addresses of sampled taken branches to the callstack]' \
|
||||
'--objdump=[path to objdump binary]:path:_files' \
|
||||
'--group[show event group information together]' \
|
||||
'--demangle[demangle symbol names to human readable form]' \
|
||||
'--demangle-kernel[demangle kernel symbol names to human readable form]' \
|
||||
'--mem-mode[use the data addresses of samples]' \
|
||||
'--percent-limit=[do not show entries which have an overhead under this percent]:number:' \
|
||||
'--percentage=[determine how to display the overhead percentage of filtered entries]:number:' \
|
||||
'--header[show header information in the perf.data file]' \
|
||||
'--header-only[show only perf.data header]' \
|
||||
'--time=[only analyze samples within given time window]:time:' \
|
||||
'--switch-on=[only consider events after this event is found]:event:' \
|
||||
'--switch-off=[stop considering events after this event is found]:event:' \
|
||||
'--show-on-off-events[show the --switch-on/off events too]' \
|
||||
'--itrace=[options for decoding instruction tracing data]' \
|
||||
'--full-source-path[show the full path for source files]' \
|
||||
'--show-ref-call-graph[show reference callgraphs]' \
|
||||
'--socket-filter[only report the samples on the processor socket]' \
|
||||
'--samples=[save N individual samples for each histogram entry]:number:' \
|
||||
'--raw-trace[do not use print fmt or plugins]' \
|
||||
'--hierarchy[enable hierarchical output]' \
|
||||
'(--no-inline)--inline[print inline stack]' \
|
||||
'(--inline)--no-inline[do not print inline stack]' \
|
||||
'--mmaps[show --tasks output plus mmap information]' \
|
||||
'--ns[show time stamps in nanoseconds]' \
|
||||
'--stat[display overall events statistics without any further processing]' \
|
||||
'--tasks[display monitored tasks stored in perf data]' \
|
||||
'--percent-type=[set annotation percent type]:type:(global-period local-period global-hits local-hits)' \
|
||||
'--time-quantum=[configure time quantum for time sort key]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(sched)
|
||||
# TODO Complete 'record' command
|
||||
_arguments \
|
||||
'(-i --input)'{-i,--input=}'[input file name]: :_files' \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'(-D --dump-raw-trace)'{-D,--dump-raw-trace}'[dump raw trace in ASCII]' \
|
||||
'1:command:((record\:record\ scheduling\ events script\:see\ a\ detailed\ trace replay\:simulate\ the\ workload map\:print\ a\ textual\ context-switching\ outline))' \
|
||||
'(-f --force)'{-f,--force}'[do not complain, do it]' \
|
||||
'1:command:_perf_sched_subcommand' \
|
||||
'*:: :->sched_args' \
|
||||
&& ret=0
|
||||
;;
|
||||
(script)
|
||||
# TODO not implemented
|
||||
# TODO 'perf-script' completion
|
||||
_arguments \
|
||||
'(-D --dump-raw-trace)'{-d,--dump-raw-trace}'[display verbose dump of the trace data]' \
|
||||
'(-L --Latency)'{-L,--Latency=}'[show latency attributes]: :' \
|
||||
'(-l --list)'{-l,--list=}'[display a list of available trace scripts]: :' \
|
||||
'(-s --script)'{-s,--script=}'[process trace data with the given script]: :' \
|
||||
'(-g --gen-script)'{-g,--gen-script=}'[generate perf-script starter script for given language]:lang:' \
|
||||
'-a[force system-wide collection]' \
|
||||
'(-i --input)'{-i,--input=}'[input file name]:file:_files' \
|
||||
'(-d --debug-mode)'{-d,--debug-mode}'[do various checks]' \
|
||||
\*{-F,--fields=}'[comma separated list of fields to print]:fields:_perf_script_fields' \
|
||||
'(-k --vmlinux)'{-k,--vmlinux=}'[vmlinux pathname]:vmlinux:_files' \
|
||||
'--kallsyms=[kallsyms pathname]:kallsyms:_files' \
|
||||
'(-G --hide-call-graph)'{-G,--hide-call-graph}'[when printing symbols do not display call chain]' \
|
||||
'--stop-bt[stop display of callgraph at these symbols]' \
|
||||
'(-C --cpu)'{-C,--cpu=}'[only report samples for the list of CPUs provided]:cpus:' \
|
||||
'(-c --comms)'{-c,--comms=}'[only display events for these comms]:comms:' \
|
||||
'--pid=[only show events for given process ID]:pids:_perf_pids' \
|
||||
'--tid=[only show events for given thread ID]:tids:' \
|
||||
'(-I --show-info)'{-I,--show-info}'[display extended information about the perf.data file]' \
|
||||
'--show-kernel-path[try to resolve the path of kernel.kallsyms]' \
|
||||
'--show-task-events[display task related events]' \
|
||||
'--show-mmap-events[display mmap related events]' \
|
||||
'--show-namespace-events[display namespace events]' \
|
||||
'--show-switch-events[display context switch events]' \
|
||||
'--show-lost-events[display lost events]' \
|
||||
'--show-round-events[display finished round events]' \
|
||||
'--show-bpf-events[display bpf events]' \
|
||||
'--demangle[demangle symbol names to human readable form]' \
|
||||
'--demangle-kernel[demangle kernel symbol names to human readable form]' \
|
||||
'--header[show perf.data header]' \
|
||||
'--header-only[show only perf.data header]' \
|
||||
'--itrace=[options for decoding instruction tracing data]' \
|
||||
'--full-source-path[show the full path for source files for srcline output]' \
|
||||
'--max-stack=[set the stack depth limit]:number:' \
|
||||
'--ns[use 9 decimal places when displaying time]' \
|
||||
'(-f --force)'{-f,--force}'[do not ownership validation]' \
|
||||
'--time=[only analyze samples within given time window]' \
|
||||
'--max-blocks=[set the maximum number of program blocks to print]:number:' \
|
||||
'--reltime[print time stamps relative to trace start]' \
|
||||
'--per-event-dump[create per event files]' \
|
||||
'--inline[the inline stack will be printed]' \
|
||||
'--insn-trace[show instruction stream for intel_pt traces]' \
|
||||
'--xed[run xed disassembler on output]' \
|
||||
'--call-trace[show call stream for intel_pt traces]' \
|
||||
'--call-ret-trace[show call and return stream for intel_pt traces]' \
|
||||
'--graph-function=[for itrace only show specified functions and their callees for itrace]:functions:' \
|
||||
'--switch-on=[only consider events after this event is found]:event:' \
|
||||
'--switch-off=[stop considering events after this event is found]' \
|
||||
'--show-on-off-events[show the --switch-on/off events too]' \
|
||||
'1:command:(record report)' \
|
||||
&& ret=0
|
||||
;;
|
||||
(stat)
|
||||
# TODO not implemented
|
||||
_arguments \
|
||||
\*{-e,--events=}'[select the PMU event]:event:_perf_events' \
|
||||
'(-i --no-inherit)'{-i,--no-inherit}'[child tasks do not inherit counters]' \
|
||||
'(-p --pid)'{-p,--pid=}'[stat events on existing process id]:pid:_pids' \
|
||||
'(-t --tid)'{-t,--tid=}'[stat events on existing thread id]:tid:' \
|
||||
'(-a --all-cpus)'{-a,--all-cpus}'[system-wide collection from all CPUs]' \
|
||||
'--no-scale[do not scale/normalize counter values]' \
|
||||
\*{-d,--detailed}'[print more detailed statistics]' \
|
||||
'(-r --repeat)'{-r,--repeat=}'[repeat command and print average + stddev]:count:' \
|
||||
'(-B --big-num)'{-B,--big-num}'[print large numbers with thousands separators according to locale]' \
|
||||
'(-C --cpu)'{-C,--cpu=}'[count only the list of CPUs]:cpus:' \
|
||||
'(-A --no-aggr)'{-A,--no-aggr}'[do not aggregate counts across all monitored CPUs]' \
|
||||
'(-n --null)'{-n,--null}'[null run]' \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'(-x --field-separator)'{-x,--field-separator=}'[print separator]' \
|
||||
'--table[display time for each run in a table format]' \
|
||||
'(-G --cgroup)'{-G,--cgroup=}'[monitor only in the container called this name]' \
|
||||
'(-o --output)'{-o,--output=}'[print the output into this file]:file:_files' \
|
||||
'--append[append to the output file designated with -o option]' \
|
||||
'--log-fd[log output to fd, instead of stderr]' \
|
||||
'--pre[pre measurement hook]: :_command_names -e' \
|
||||
'--post[post measurement hook]: :_command_names -e' \
|
||||
'(-I --interval-print)'{-I,--interval-print=}'[print count deltas every millseconds]:msec:' \
|
||||
'--interval-count[print count delta for fixed number of times]:times:' \
|
||||
'--interval-clear[clear the screen before next interval]' \
|
||||
'--timeout[stop the perf stat session and print count after milliseconds]:msec:' \
|
||||
'--metric-only[only print compted metrics]' \
|
||||
'--per-socket[aggregate counts per processor socket for system-wide mode measurements]' \
|
||||
'--per-die[aggregate counts per processor die for sytem-wide mode measurements]' \
|
||||
'--per-core[aggregate counts per phisical processor for sytem-wide mode measurements]' \
|
||||
'--per-thread[aggregate counts per monitored threads]' \
|
||||
'(-D --delay)'{-D,--delay=}'[wait msecs before measuring]:msec:' \
|
||||
'(-T --transaction)'{-T,--transaction}'[print statistics of transactional execution]' \
|
||||
'(-)1:command:_perf_stat_command' \
|
||||
'*::arg:_normal' \
|
||||
&& ret=0
|
||||
# TODO report/record sub-subcommand completion
|
||||
;;
|
||||
(test)
|
||||
_arguments \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'(-s --skip)'{-s,--skip=}'[Tests to skip]:tests:_perf_test_list' \
|
||||
'(-F --dont-fork)'{-F,--dont-fork}'[do not fork child for each test]' \
|
||||
'1:command:((list))' \
|
||||
&& ret=0
|
||||
;;
|
||||
(timechart)
|
||||
# TODO Complete 'record' command
|
||||
_arguments \
|
||||
'(-i --input)'{-i,--input=}'[input file name]: :_files' \
|
||||
'(-o --output)'{-o,--output=}'[output file name]: :_files' \
|
||||
'(-w --width)'{-w,--width=}'[select the width of the SVG file]:width' \
|
||||
'(-P --power-only)'{-P,--power-only}'[only output the CPU power section of the diagram]' \
|
||||
'(-T --task-only)'{-T,--task-only}'[do not output processor state transitions]' \
|
||||
'(-p --process)'{-p,--process}'[select the processes to display, by name or PID]:process' \
|
||||
'(-f --force)'{-f,--force}'[do not complain, do it]' \
|
||||
'--symfs=[look for files with symbols relative to this directory]: :_files -/' \
|
||||
'(-n --proc-num)'{-n,--proc-num=}'[print task info for at least given number of tasks]:number:' \
|
||||
'(-t --topology)'{-t,--topology}'[sort CPUs according to topology]' \
|
||||
'--highlight=[highlight tasks using different color]:nsecs_or_task:' \
|
||||
'--io-skip-eagain[do not draw EAGAIN IO events]' \
|
||||
'--io-min-times=[draw small events as if they lasted min-time]:nsecs:' \
|
||||
'--io-merge-dist=[merge events that are merge-dist nanoseconds apart]:nsecs:' \
|
||||
'1:command:((record))' \
|
||||
'*:: :->timechart_args' \
|
||||
&& ret=0
|
||||
;;
|
||||
(top)
|
||||
# TODO not implemented
|
||||
_arguments \
|
||||
'(-a --all-cpus)'{-a,--all-cpus}'[system wide collection]' \
|
||||
'(-c --count)'{-c,--count=}'[event period to sample]:count:' \
|
||||
'(-C --cpu)'{-C,--cpu=}'[monitor only the list of CPUs provided]:cpu_list:' \
|
||||
'(-d --delay)'{-d,--delay=}'[number of seconds to delay between refreshes]' \
|
||||
\*{-e,--event=}'[select the PMU event]:event:_perf_events' \
|
||||
'(-E --entries)'{-E,--entries=}'[display thie many functions]' \
|
||||
'(-f --count-filter)'{-f,--count-filter=}'[only display functions with more events than this]:count:' \
|
||||
'--group[put the counters into a counter group]' \
|
||||
'(-F --freq)'{-F,--freq=}'[profile at thie frequency]:freq:(max)' \
|
||||
'(-i --inherit)'{-i,--inherit}'[child tasks do not inherit counters]' \
|
||||
'(-k --vmlinux --ignore-vmlinux)'{-k,--vmlinux=}'[path to vmlinux]:vmlinux:_files' \
|
||||
'(-k --vmlinux)--ignore-vmlinux[ignore vmlinux files]' \
|
||||
'--kallsyms=[kallsyms pathname]:sym_path:_files' \
|
||||
'(-m --mmap-pages)'{-m,--mmap-pages=}'[number of mmap data pages or size]:number:' \
|
||||
'(-p --pid)'{-p,--pid=}'[profile events on existing process ID]:pid:_pids' \
|
||||
'(-t --tid)'{-t,--tid=}'[profile events on existing thread ID]:tid:' \
|
||||
'(-u --uid)'{-u,--uid=}'[record events in threads owned by uid]:uid:' \
|
||||
'(-r --realtime)'{-r,--realtime=}'[collect data with this RT SCHED_FIFO priority]:priority:' \
|
||||
'--sym-annotate=[annotate this symbol]' \
|
||||
'(-K --hide_kernel_symbols)'{-K,--hide_kernel_symbols}'[hide kernel symbols]' \
|
||||
'(-U --hide_user_symbols)'{-K,--hide_user_symbols}'[hide user symbols]' \
|
||||
'--demangle-kernel[demangle kernel symbols]' \
|
||||
'(-D --dump-symtab)'{-D,--dump-symtab}'[dump the symbol table used for profiling]' \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'(-z --zero)'{-z,--zero}'[zero history access display updates]' \
|
||||
'(-s --sort)'{-s,--sort}'[sort by keys]' \
|
||||
'--fields=[specify output field ]:fields:_perf_top_fields' \
|
||||
'(-n --show-nr-samples)'{-n,--show-nr-samples}'[show a column with the number of samples]' \
|
||||
'--show-total-period[show a column with the sum of periods]' \
|
||||
'--dsos[only consider symbols in these dsos]' \
|
||||
'--comms[only consider symbols in these comms]' \
|
||||
'--symbols[only consider these symbols]' \
|
||||
'(-M --disassembler-style)'{-M,--disassembler-style=}'[set disassembler style]:style:' \
|
||||
'(--no-source)--source[interleave source code with assembly code]' \
|
||||
'(--source)--no-source[disable interleaving source code]' \
|
||||
'--asm-raw[show raw instruction encoding of assembly instructions]' \
|
||||
'-g[Enables call-graph recording]' \
|
||||
'--call-graph[setup and enable call-graph recording]' \
|
||||
'--children[accumulate callchain of children to parent entry]' \
|
||||
'--max-stack[set the stack depth limit]' \
|
||||
'--ignore-callees=[ignore callees of functions regex]:regex:' \
|
||||
'--percent-limit[do not show entries which have an overhead under that percent]' \
|
||||
'(-w --column-widths)'{-w,--column-widths=}'[force each column width to this list]' \
|
||||
'--proc-map-timeout[set timeout limit for processing process map]' \
|
||||
'(-b --branch-any)'{-b,--branch-any}'[enable taken branch stack sampling]' \
|
||||
'(-j --branch-filter)'{-j,--branch-filter}'[enable taken branch stack sampling]' \
|
||||
'--raw-trace[do not use print fmt or plugins]' \
|
||||
'--hierarchy[enable hierarchy output]' \
|
||||
'--overwrite[overwrite records]' \
|
||||
'--force[do not do ownership validation]' \
|
||||
'--num-thread-synthesize[threads to run when synthesizing events for existing processes]'\
|
||||
'--namespaces[record events of type PREF_RECORD_NAMESPACES]' \
|
||||
'--switch-on=[only consider events after this event is found]:event:' \
|
||||
'--switch-off=[stop considering events after this event is found]:event:' \
|
||||
'--show-on-off-events[show the --switch-on/off events too]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(trace)
|
||||
_arguments \
|
||||
'(-a --all-cpus)'{-a,--all-cpus}'[force system-wide collection from all cpus]' \
|
||||
'(-e --expr --event)'{-e,--expr=,--event=}'[list of syscalls and other perf events to show]::event:' \
|
||||
'(-D --delay)'{-d,--delay=}'[wait msecs before measuring]' \
|
||||
'(-o --output)'{-o,--output=}'[output file name]:output:_files' \
|
||||
'(-p --pid)'{-p,--pid=}'[record events on existing process ID]:pid:_perf_pids' \
|
||||
'(-t --tid)'{-u,--tid=}'[record events on existing thread ID]:tid:' \
|
||||
'(-u --uid)'{-u,--uid=}'[record events in threads owned by uid]:uid:' \
|
||||
\*{-G,--cgroup=}'[record events in threads in a cgroup]' \
|
||||
'--filter-pids=[filter out events for these pids and for trace itself]:pid:_perf_pids' \
|
||||
'(-v --verbose)'{-v,--verbose=}'[verbosity level]' \
|
||||
'--no-inherit[child tasks do not inherit counters]' \
|
||||
'(-m --mmap-pages)'{-m,--mmap-pages=}'[number of mmap data pages]:number:' \
|
||||
'(-C --cpu)'{-C,--cpu}'[collect samples only on the list of CPUs provides]:cpus:' \
|
||||
'--duration=[show only events that had a duration grater than N.M ms]' \
|
||||
'--sched[accrue thread runtime and provide a summary at the end of the session]' \
|
||||
'--failure[show only syscalls that failed]' \
|
||||
'(-i --input)'{-i,--input=}'[process events from a given perf data file]:file:_files' \
|
||||
'(-T --time)'{-T,--time}'[print full timestamp]' \
|
||||
'(--no-comm)--comm[show process COMM]' \
|
||||
'(--comm)--no-comm[do not show process COMM]' \
|
||||
'(-s --summary)'{-s,--summary}'[show only a summary of syscalls by thread]' \
|
||||
'(-S --with-summary)'{-S,--with-summary}'[show all syscalls followed by a summary by thread]' \
|
||||
'--tool_stats[show tool stats]' \
|
||||
'(-f --force)'{-f,--force}'[do not complain, do it]' \
|
||||
'(-F --pf)'{-F,--pf=}'[trace pagefaults]:type:(all min maj)' \
|
||||
'(--no-syscalls)--syscalls[trace system calls]' \
|
||||
'(--syscalls)--no-syscalls[not trace system calls]' \
|
||||
'--call-graph=[setup and enable call-graph recording]' \
|
||||
'--kernel-syscall-graph[show the kernel callchains on the syscall exit path]' \
|
||||
'--max-events=[stop after processing N events]:events:' \
|
||||
'--switch-on=[only consider events after this event is found]:event:' \
|
||||
'--switch-off=[stop considering events after this event is found]:event:' \
|
||||
'--show-on-off-events[show the --switch-on/off events too]' \
|
||||
'--max-stack=[set the stack depth max limit]:limit:' \
|
||||
'--min-stack=[set the stack depth min limit]:limit:' \
|
||||
'--print-sample[print the PERF_RECORD_SAMPLE PERF_SAMPLE_ info]' \
|
||||
'--proc-map-timeout=[time out(ms) limit of processing /proc/XXX/mmap]' \
|
||||
'--sort-events[do sorting on batches of events]' \
|
||||
'--map-dump[dump BPF maps setup by events passed via -e]' \
|
||||
'1: :_perf_trace_subcommand' \
|
||||
&& ret=0
|
||||
# TODO command completion
|
||||
;;
|
||||
(version)
|
||||
_arguments \
|
||||
'--build-options[the status of compiled-in libraries are printed]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments \
|
||||
|
@ -211,6 +780,205 @@ _perf() {
|
|||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
case $state in
|
||||
(bench_subsystem)
|
||||
case $words[1] in
|
||||
(sched)
|
||||
_arguments \
|
||||
'1:suite:(messaging pipe)' \
|
||||
'*:: :->bench_sched_suite' \
|
||||
&& ret=0
|
||||
;;
|
||||
(mem)
|
||||
_arguments \
|
||||
'1:suite:(memcpy memset)' \
|
||||
'*:: :->bench_mem_suite' \
|
||||
&& ret=0
|
||||
;;
|
||||
(numa)
|
||||
_arguments \
|
||||
'1:suite:(mem)' \
|
||||
&& ret=0
|
||||
;;
|
||||
(futex)
|
||||
_arguments \
|
||||
'1:suite:(hash wake wake-parallel requeue lock-pi)' \
|
||||
&& ret=0
|
||||
;;
|
||||
(epoll)
|
||||
_arguments \
|
||||
'1:suite:(wait ctl)' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(c2c_args)
|
||||
case $words[1] in
|
||||
(record)
|
||||
_arguments \
|
||||
\*{-e,--event=}'[select the PMU event]:events:_perf_events' \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'(-l --ldlat)'{-l,--ldlat=}'[configure mem-loads latency]:latency:' \
|
||||
'(-k --all-kernel)'{-k,--all-kernel}'[configure all used events to run in the kernel space]' \
|
||||
'(-u --all-user)'{-u,--all-user}'[configure all used events to run in user space]' \
|
||||
'1:command:_command_names -e' \
|
||||
'*::args:_normal' \
|
||||
&& ret=0
|
||||
;;
|
||||
(report)
|
||||
_arguments \
|
||||
'(-k --vmlinux)'{-k,--vmlinux=}'[vmlinux pathname]:vmlinux:_files' \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'(-i --input)'{-i,--input=}'[specify the input file to process]:proc_file:_files' \
|
||||
'(-N --node-info)'{-N,--node-info}'[show extra node info in report]' \
|
||||
'(-c --coalesce)'{-c,--coalesce=}'[specify sorting fields for single cacheline display]:field:_perf_c2c_coalesce' \
|
||||
'(-g --call-graph)'{-g,--call-graph}'[setup callchains parameters]' \
|
||||
'--stdio[force the stdio output]' \
|
||||
'--stats[display only statistic tables]' \
|
||||
'--full-symbols[display full length of symbols]' \
|
||||
'--no-source[do not display source line column]' \
|
||||
'--show-all[show all captured HITM lines]' \
|
||||
'(-f --force)'{-f,--force}'[do not do ownership validation]' \
|
||||
'(-d --display)'{-d,--display=}'[switch to HITM type]:hitm_type:(rmt lcl)' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(data_args)
|
||||
if [[ $words[1] == "convert" ]]; then
|
||||
_arguments \
|
||||
'--to-ctf=[specify the path of CTF data directory]:data_dir:_files -/' \
|
||||
'-i[specify input perf data file path]:path:_files' \
|
||||
'(-f --force)'{-f,--force}'[do not complain do it]' \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'--all[convert all events including non-sample events to output]' \
|
||||
&& ret=0
|
||||
fi
|
||||
;;
|
||||
(kmem_args)
|
||||
if [[ $words[1] == "record" ]]; then
|
||||
_arguments \
|
||||
'1:command:_command_names -e' \
|
||||
'*::args:_normal' \
|
||||
&& ret=0
|
||||
fi
|
||||
;;
|
||||
(lock_args)
|
||||
case $words[1] in
|
||||
(record)
|
||||
_arguments \
|
||||
'1:command:_command_names -e' \
|
||||
'*::args:_normal' \
|
||||
&& ret=0
|
||||
;;
|
||||
(report)
|
||||
_arguments \
|
||||
'(-k --key)'{-k,--key=}'[sorting key]:key:(default contented avg_wait wait_total wait_max wait_min)' \
|
||||
&& ret=0
|
||||
;;
|
||||
(info)
|
||||
_arguments \
|
||||
'(-t --threads)'{-t,--threads}'[dump thread list in perf.data]' \
|
||||
'(-m --map)'{-m,--map}'[dump map of lock instances]' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(mem_args)
|
||||
case $words[1] in
|
||||
(record)
|
||||
_arguments \
|
||||
\*{-e,--event=}'[event selector]:events:_perf_events' \
|
||||
'(-K --all-kernel)'{-K,--all-kernel}'[configure all used events to run in kernel space]' \
|
||||
'(-U --all-user)'{-K,--all-user}'[configure all used events to run in user space]' \
|
||||
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
|
||||
'--ldlat=[specify desired latency for loads event]:latency:' \
|
||||
'1:command:_command_names -e' \
|
||||
'*::args:_normal' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(sched_args)
|
||||
case $words[1] in
|
||||
(record)
|
||||
_arguments \
|
||||
'1:command:_command_names -e' \
|
||||
'*::args:_normal' \
|
||||
&& ret=0
|
||||
;;
|
||||
(map)
|
||||
_arguments \
|
||||
'--compact[show only CPUs with activity]' \
|
||||
'--cpus[show just entries with activities]' \
|
||||
'--color-cpus=[highlight the given cpus]:cpus:' \
|
||||
'--color-pids=[highlight the given pids]:pids:' \
|
||||
&& ret=0
|
||||
;;
|
||||
(timehist)
|
||||
_arguments \
|
||||
'(-k --vmlinux)'{-k,--vmlinux=}'[vmlinux pathname]:vmlinux:_files' \
|
||||
'--kallsyms=[kallsyms pathname]:kallsyms:_files' \
|
||||
'(-g --call-graph)'{-g,--callgraph}'[display call chains]' \
|
||||
'--max-stack=[maximum number of functions to display in backtrace]:number:' \
|
||||
'(-p --pid)'{-p,--pid=}'[only show events for given process ID]:pids:_perf_pids' \
|
||||
'(-t --tid)'{-t,--tid=}'[only show events for given thread ID]:tids:' \
|
||||
'(-s --summary)'{-s,--summary}'[show only summary scheduling]' \
|
||||
'(-S --with-summary)'{-S,--with-summary}'[show all scheduling events by a summary]' \
|
||||
'--symfs=[look for files with symbols relative to this directory]:dir:_files -/' \
|
||||
'(-V --cpu-visual)'{-V,--cpu-visual}'[show visual aid for sched switches by CPU]' \
|
||||
'(-w --wakeups)'{-w,--wakeups}'[show wakeup events]' \
|
||||
'(-M --migrations)'{-M,--migrations}'[show migration events]' \
|
||||
'(-n --next)'{-n,--next}'[show next task]' \
|
||||
'(-I --idle-hist)'{-I,--idle-hist}'[show idle-related events only]' \
|
||||
'--time=[only analyze samples within given time window]:time_window:' \
|
||||
'--state[show task state when it switched out]' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(timechart_args)
|
||||
if [[ $words[1] == "record" ]]; then
|
||||
_arguments \
|
||||
'(-P --power-only)'{-P,--power-only}'[record only power-related events]' \
|
||||
'(-T --tasks-only)'{-T,--tasks-only}'[record only tasks-related events]' \
|
||||
'(-I --io-only)'{-I,--io-only}'[record only io-related events]' \
|
||||
'(-g --callchain)'{-g,--callchain}'[do call-graph recording]' \
|
||||
'1:command:_command_names -e' \
|
||||
'*::args:_normal' \
|
||||
&& ret=0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
case $state in
|
||||
(bench_sched_suite)
|
||||
case $words[1] in
|
||||
(messaging)
|
||||
_arguments \
|
||||
'(-p --pipe)'{-p,--pipe}'[use pipe instead of socketpair]' \
|
||||
'(-t --thread)'{-t,--thread}'[be multi thread instead of multi process]' \
|
||||
'(-g --group)'{-g,--group=}'[specify number of groups]:number:' \
|
||||
'(-l --nr_loops)'{-l,--nr_loops=}['specify number of loops']\
|
||||
&& ret=0
|
||||
;;
|
||||
(pipe)
|
||||
_arguments \
|
||||
'(-l --loop)'{-l,--loop}'[specify number of loops]:number:' \
|
||||
&& ret=0
|
||||
esac
|
||||
;;
|
||||
(bench_mem_suite)
|
||||
# memcpy and memset support same options
|
||||
_arguments \
|
||||
'(-l --size)'{-l,--size=}'[specify size of memory to copy]:size:' \
|
||||
'(-f --function)'{-f,--function=}'[specify function to copy]:function:' \
|
||||
'(-l --nr_loops)'{-l,--nr_loops=}'[repeat memcpy invocation this number of times]:number:' \
|
||||
'(-c --cycles)'{-c,--cycles}'[use perf cpu-cycles event instead of gettimeofday]' \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# FIXME Parse 'perf --help' instead of hard-coding.
|
||||
|
@ -222,13 +990,19 @@ _perf_cmds() {
|
|||
'bench:general framework for benchmark suites'
|
||||
'buildid-cache:manage build-id cache'
|
||||
'buildid-list:list the buildids in a perf.data file'
|
||||
'c2c:shared data C2C/HITM analyzer'
|
||||
'config:get and set variables in a configuration file'
|
||||
'data:data file related processing'
|
||||
'diff:read two perf.data files and display the differential profile'
|
||||
'evlist:list the event names in a perf.data file'
|
||||
'ftrace:simple wrapper for kernel ftrace functionality'
|
||||
'inject:filter to augment the events stream with additional information'
|
||||
'kallsyms:searches running kernel for symbols'
|
||||
'kmem:tool to trace/measure kernel memory(slab) properties'
|
||||
'kvm:tool to trace/measure kvm guest os'
|
||||
'list:list all symbolic event types'
|
||||
'lock:analyze lock events'
|
||||
'mem:profile memory access'
|
||||
'probe:define new dynamic tracepoints'
|
||||
'record:run a command and record its profile into perf.data'
|
||||
'report:read perf.data (created by perf record) and display the profile'
|
||||
|
@ -238,6 +1012,8 @@ _perf_cmds() {
|
|||
'test:runs sanity tests'
|
||||
'timechart:tool to visualize total system behavior during a workload'
|
||||
'top:system profiling tool'
|
||||
'trace:strace inspired tool'
|
||||
'version:display the version of perf binary'
|
||||
'help:show command usage information'
|
||||
)
|
||||
_describe -t commands 'command' commands "$@"
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
#compdef protoc
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2020 Github zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for protoc -- protocol buffer description file compiler
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Shohei YOSHIDA (https://github.com/syohex)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__protoc_files() {
|
||||
if compset -P '@'; then
|
||||
_files
|
||||
else
|
||||
_files -g '*.proto'
|
||||
fi
|
||||
}
|
||||
|
||||
_protoc() {
|
||||
_arguments -C \
|
||||
'(- : *)'{-h,--help}'[Show summary of options]' \
|
||||
'(- : *)--version[Show version of program]' \
|
||||
'*'{-I,--proto_path}'=[Specify the directory which to search for imports]:import_dir:_files -/' \
|
||||
'--encode=[Read a text-format message of given type from stdin and write it in binary to stdout]' \
|
||||
'--decode=[Read a text-format message of given type from stdin and write it in binary to stdout]' \
|
||||
'--decode_raw[Read an arbitrary protocol message from stdin and write the raw tag/value pairs in text format to stdout]' \
|
||||
'--descriptor_set_in=[Specifies a delimited list of FILES each containing a FileDescriptorSet]:desc_in:_files' \
|
||||
{-o,--descriptor_set_out}'=[Writes a FileDescriptorSet to FILE]:desc_out:_files' \
|
||||
'--include_imports[When using --descriptor_set_out, also include all dependencies of the input files in the set]' \
|
||||
'--include_source_info[When using --descriptor_set_out, do not strip SourceCodeInfo from the FileDescriptorProto]' \
|
||||
'--dependency_out=[Write a dependency output file in the format expected by make]:dep_out:_files' \
|
||||
'--error_format=[Set the format in which print errors]:error_format:(gcc msvc)' \
|
||||
'--print_free_field_numbers[Print the free field numbers of the messages]'\
|
||||
'--plugin=[Specifies a plugin executable to use]:plugin:_files' \
|
||||
'--cpp_out=[Generate C++ header and source]:out_dir:_files -/' \
|
||||
'--csharp_out=[Generate C# source file]:out_dir:_files -/' \
|
||||
'--java_out=[Generate Java source file]:out_dir:_files -/' \
|
||||
'--js_out=[Generate JavaScript source]:out_dir:_files -/' \
|
||||
'--objc_out=[Generate Objective C header and source]:out_dir:_files -/' \
|
||||
'--php_out=[Generate PHP source file]:out_dir:_files -/' \
|
||||
'--python_out=[Generate Python source file]:out_dir:_files -/' \
|
||||
'--ruby_out=[Generate Ruby source file]:out_dir:_files -/' \
|
||||
'*: :__protoc_files'
|
||||
}
|
||||
|
||||
_protoc "$@"
|
||||
|
||||
# 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
|
|
@ -57,7 +57,7 @@ _rspec() {
|
|||
--dry-run'[Print the formatter output of your suite without running any examples or hooks]' \
|
||||
'(-X --drb)'{-X,--drb}'[Run examples via DRb]' \
|
||||
--drb-port'[Port to connect to the DRb server]: :_guard "[[\:digit\:]]#" "PORT"' \
|
||||
'(-f --format)'{-f,--format}'[Choose a formatter]:FORMATTER:(progress documentation html json)' \
|
||||
'(-f --format)'{-f,--format}'[Choose a formatter]:FORMATTER:(progress documentation html json failures)' \
|
||||
'(-o --out)'{-o,--out}'[Write output to a file instead of $stdout]:FILE:_files' \
|
||||
--deprecation-out'[Write deprecation warnings to a file instead of $stderr]:FILE:_files' \
|
||||
'(-b --backtrace)'{-b,--backtrace}'[Enable full backtrace]' \
|
||||
|
|
22
src/_vnstat
22
src/_vnstat
|
@ -28,7 +28,7 @@
|
|||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for vnstat 1.10
|
||||
# Completion script for vnstat 2.6
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
|
@ -44,36 +44,44 @@ typeset -A opt_args
|
|||
local period="-d --days -h --hours -m --months -w --weeks"
|
||||
|
||||
_arguments -C : \
|
||||
'--cleartop[remove all top 10 entries]' \
|
||||
'--add[create database entry for interface specified]' \
|
||||
'(-b --begin)'{-b,--begin}'[begin the list output with a specific date]:date:' \
|
||||
'--config[specify alternate configuration file]:file:_files' \
|
||||
"($period)"{-d,--days}'[show traffic for days]' \
|
||||
"($period)"{-h,--hours}'[show traffic for last 24 hours]' \
|
||||
"($period)"{-m,--months}'[show traffic for months]' \
|
||||
"($period)"{-w,--weeks}'[show traffic for 7 days]' \
|
||||
"($period)"{-y,--years}'[show traffic statistics for the last year]' \
|
||||
"($period)"{-5,--fiveminutes}'[show traffic statistic with a 5 minute resolution for the last hours]' \
|
||||
'--dbdir[specify database directory]:directory:_files -/' \
|
||||
'(-D --debug)'{-D,--debug}'[show additional debug output]' \
|
||||
'(-e --end)'{-e,--end}'[end the list output with a specific date]:date:' \
|
||||
'--delete[delete database and stop monitoring selected interface]' \
|
||||
'--dumpdb[dump database in parseable format]' \
|
||||
'(--disable)--enable[enable updates for selected interface]' \
|
||||
'(--enable)--disable[disable updates for selected interface]' \
|
||||
'(-hg --hoursgraph)'{-hg,--hoursgraph}'[show traffic statistics using a bar graph]' \
|
||||
'(-i --iface)'{-i,--iface}'[specify interface for actions]:interface:->interface' \
|
||||
'--iflist[list available interfaces]' \
|
||||
'--limit[set the maximum number of shown entries]:limit:' \
|
||||
'(-l --live)'{-l,--live}'[display current transfer rate]:mode:->live' \
|
||||
'--json[show database content in json format]' \
|
||||
'--locale[specify locale]:locale:' \
|
||||
'--nick[set nickname for alias]:nickname:' \
|
||||
'--oneline[traffic summary in one-line, parseable format]' \
|
||||
'(-q --query)'{-q,--query}'[force database query mode]' \
|
||||
'--remove[delete the database entry for the interface specified]' \
|
||||
'--rename[rename the interface specified in the database with new name]' \
|
||||
'(-r --reset)'{-r,--reset}'[reset internal counters]' \
|
||||
'--rebuildtotal[reset total traffic counters]' \
|
||||
'--setalias[set alias as an alias for the selected interface]:alias:' \
|
||||
'(-ru --rateunit)'{-ru,--rateunit}'[swap configured rate unit]' \
|
||||
'--savemerged[write result of database merge]' \
|
||||
'(-s --short)'{-s,--short}'[use short output mode]' \
|
||||
'--showconfig[show current configuration]' \
|
||||
'--style[modify content and style of output]:style:->style' \
|
||||
'--sync[synchronize internal counters]' \
|
||||
'--testkernel[test kernel boot time information]' \
|
||||
'(-t --top10)'{-t,--top10}'[show all time top 10 traffic days]' \
|
||||
'-tr[calculate amount of traffic in given time]:seconds:' \
|
||||
'(-u --update)'{-u,--update}'[update databases]' \
|
||||
'(-t --top)'{-t,--top}'[show all time top traffic days]' \
|
||||
'(-tr --traffic)'{-tr,--traffic}'[calculate amount of traffic in given time]:seconds:' \
|
||||
'--xml[show database content in XML format]' \
|
||||
'(-)'{-v,--version}'[show current version]' \
|
||||
'(-)'{-\?,--help}'[show command summary]' \
|
||||
|
|
167
src/_yarn
167
src/_yarn
|
@ -36,12 +36,17 @@
|
|||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
declare -g _yarn_run_cwd
|
||||
|
||||
_commands=(
|
||||
'access'
|
||||
'audit:Checks for known security issues with the installed packages'
|
||||
'autoclean:Clean and remove unnecessary files from package dependencies'
|
||||
'cache:List or clean every cached package'
|
||||
"check:Verify package dependencies against yarn's lock file"
|
||||
'config:Manages the yarn configuration files'
|
||||
'create:Creates new projects from any create-* starter kits'
|
||||
'exec'
|
||||
'generate-lock-entry:Generates a lock file entry'
|
||||
'global:Install packages globally on your operating system'
|
||||
'help:Show information about a command'
|
||||
|
@ -51,25 +56,30 @@ _commands=(
|
|||
'install:Install all the dependencies listed within package.json'
|
||||
'licenses:List licenses for installed packages'
|
||||
'link:Symlink a package folder during development'
|
||||
'list:List installed packages'
|
||||
'login:Store registry username and email'
|
||||
'logout:Clear registry username and email'
|
||||
'node:Runs Node with the same version that the one used by Yarn itself'
|
||||
'outdated:Check for outdated package dependencies'
|
||||
'owner:Manage package owners'
|
||||
'pack:Create a compressed gzip archive of package dependencies'
|
||||
'policies:Defines project-wide policies for your project'
|
||||
'publish:Publish a package to the npm registry'
|
||||
'run:Run a defined package script'
|
||||
'tag:Add, remove, or list tags on a package'
|
||||
'team:Maintain team memberships'
|
||||
'unlink:Unlink a previously created symlink for a package'
|
||||
'unplug:Temporarily copies a package outside of the global cache for debugging purposes'
|
||||
'version:Update the package version'
|
||||
'versions:Display version information of currently installed Yarn, Node.js, and its dependencies'
|
||||
'why:Show information about why a package is installed'
|
||||
'workspace'
|
||||
'workspaces:Show information about your workspaces'
|
||||
)
|
||||
|
||||
_global_commands=(
|
||||
'add:Installs a package and any packages that it depends on'
|
||||
'bin:Displays the location of the yarn bin folder'
|
||||
'list:List installed packages'
|
||||
'remove:Remove installed package from dependencies updating package.json'
|
||||
'upgrade:Upgrades packages to their latest version based on the specified range'
|
||||
'upgrade-interactive:Interactively upgrade packages'
|
||||
|
@ -77,7 +87,12 @@ _global_commands=(
|
|||
|
||||
_yarn_commands_scripts() {
|
||||
local -a scripts
|
||||
if [[ -n $opt_args[--cwd] ]]; then
|
||||
scripts=($(cd $opt_args[--cwd] && yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g'))
|
||||
else
|
||||
scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g'))
|
||||
fi
|
||||
|
||||
_describe 'command or script' _commands -- _global_commands -- scripts
|
||||
}
|
||||
|
||||
|
@ -86,7 +101,11 @@ _yarn_scripts() {
|
|||
local -a scriptNames scriptCommands
|
||||
local i runJSON
|
||||
|
||||
if [[ -n $_yarn_run_cwd ]]; then
|
||||
runJSON=$(cd $_yarn_run_cwd && yarn run --json 2>/dev/null)
|
||||
else
|
||||
runJSON=$(yarn run --json 2>/dev/null)
|
||||
fi
|
||||
# Some sed utilities (e.g. Mac OS / BSD) don't interpret `\n` in a replacement
|
||||
# pattern as a newline. See https://superuser.com/q/307165
|
||||
binaries=($(sed -E '/Commands available/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\'$'\n/g' <<< "$runJSON"))
|
||||
|
@ -97,7 +116,7 @@ _yarn_scripts() {
|
|||
scripts+=("${scriptNames[$i]}:${scriptCommands[$i]}")
|
||||
done
|
||||
|
||||
commands=($scripts $binaries)
|
||||
commands=('env' $scripts $binaries)
|
||||
_describe 'command' commands
|
||||
}
|
||||
|
||||
|
@ -117,6 +136,11 @@ _yarn_add_files() {
|
|||
fi
|
||||
}
|
||||
|
||||
_yarn_workspaces() {
|
||||
local -a workspaces=(${(@f)$(yarn workspaces info |sed -n -e 's/^ "\([^"]*\)": {/\1/p')})
|
||||
_describe 'workspace' workspaces
|
||||
}
|
||||
|
||||
_yarn() {
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
|
@ -125,37 +149,51 @@ _yarn() {
|
|||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
'(-V --version)'{-V,--version}'[output the version number]' \
|
||||
'--verbose[output verbose messages on internal operations]' \
|
||||
'--offline[trigger an error if any required dependencies are not available in local cache]' \
|
||||
'--prefer-offline[use network only if dependencies are not available in local cache]' \
|
||||
'--strict-semver' \
|
||||
'--json' \
|
||||
"--ignore-scripts[don't run lifecycle scripts]" \
|
||||
'--har[save HAR output of network traffic]' \
|
||||
'--ignore-platform[ignore platform checks]' \
|
||||
'--ignore-engines[ignore engines check]' \
|
||||
'--ignore-optional[ignore optional dependencies]' \
|
||||
'--force[install and build packages even if they were built before, overwrite lockfile]' \
|
||||
'--skip-integrity-check[run install without checking if node_modules is installed]' \
|
||||
'--check-files[install will verify file tree of packages for consistency]' \
|
||||
"--no-bin-links[don't generate bin links when setting up packages]" \
|
||||
'--flat[only allow one version of a package]' \
|
||||
'(--prod --production)'{--prod,--production} \
|
||||
"--no-lockfile[don't read or generate a lockfile]" \
|
||||
"--pure-lockfile[don't generate a lockfile]" \
|
||||
"--frozen-lockfile[don't generate a lockfile and fail if an update is needed]" \
|
||||
'--link-duplicates[create hardlinks to the repeated modules in node_modules]' \
|
||||
'--global-folder=[modules folder]:folder:_files -/' \
|
||||
'--modules-folder=[rather than installing modules into the node_modules folder relative to the cwd, output them here]:folder:_files -/' \
|
||||
'--cache-folder=[specify a custom folder to store the yarn cache]:folder:_files -/' \
|
||||
'--check-files[install will verify file tree of packages for consistency]' \
|
||||
'--cwd=[working directory to use]:path:_files -/' \
|
||||
"(--enable-pnp --pnp)--disable-pnp[disable the Plug'n'Play installation]" \
|
||||
'(--no-emoji)--emoji=[enable emoji in output(default: false)]:enabled:(true false)' \
|
||||
'(--emoji)--no-emoji[disable emoji in output]' \
|
||||
'(--disable-pnp)'{--enable-pnp,--pnp}"[enable the Plug'n'Play installation]" \
|
||||
'--flat[only allow one version of a package]' \
|
||||
'--focus[Focus on a single workspace by installing remote copies of its sibiling workspaces]' \
|
||||
'--force[install and build packages even if they were built before, overwrite lockfile]' \
|
||||
"--frozen-lockfile[don't generate a lockfile and fail if an update is needed]" \
|
||||
'--global-folder=[modules folder]:folder:_files -/' \
|
||||
'--har[save HAR output of network traffic]' \
|
||||
'--https-proxy=[HTTPS proxy]:host:_hosts' \
|
||||
'--ignore-engines[ignore engines check]' \
|
||||
"--ignore-scripts[don't run lifecycle scripts]" \
|
||||
'--ignore-optional[ignore optional dependencies]' \
|
||||
'--ignore-platform[ignore platform checks]' \
|
||||
'--json[format Yarn log messages as lines of JSON]' \
|
||||
'--link-duplicates[create hardlinks to the repeated modules in node_modules]' \
|
||||
'--link-folder=[specify a custom folder to store global links]' \
|
||||
'--modules-folder=[rather than installing modules into the node_modules folder relative to the cwd, output them here]:folder:_files -/' \
|
||||
'--mutex=[use a mutex to ensure only one yarn instance is executing]:type[\:specifier]' \
|
||||
'--no-emoji[disable emoji in output]' \
|
||||
'(-s --silent)'{-s,--silent}'[skip Yarn console logs, other types of logs (script output) will be printed]' \
|
||||
'--proxy=:host:_hosts' \
|
||||
'--https-proxy=:host:_hosts' \
|
||||
'--no-progress[disable progress bar]' \
|
||||
'--network-concurrency=[maximum number of concurrent network requests]:number' \
|
||||
'--network-timeout=[TCP timeout for network requests]:milliseconds' \
|
||||
"--no-bin-links[don't generate bin links when setting up packages]" \
|
||||
'--no-default-rc[prevent Yarn from automatically detecting yarnrc and npmrc files]' \
|
||||
"--no-lockfile[don't read or generate a lockfile]" \
|
||||
'--non-interactive[do not show interactive prompts]' \
|
||||
'--no-node-version-check[do not warn when using a potentially unsupported Node version]' \
|
||||
'--no-progress[disable progress bar]' \
|
||||
'--offline[trigger an error if any required dependencies are not available in local cache]' \
|
||||
'--otp=[one-time password for two factor authentication]:otpcode' \
|
||||
'--prefer-offline[use network only if dependencies are not available in local cache]' \
|
||||
'--preferred-cache-folder=[specify a custom folder to store the yarn cache if possible]:folder:_files -/' \
|
||||
'(--prod --production)'{--prod,--production}'[install only production dependencies]' \
|
||||
'--proxy=[HTTP proxy]:host:_hosts' \
|
||||
"--pure-lockfile[don't generate a lockfile]" \
|
||||
'--registry=[override configuration registry]:url:_urls' \
|
||||
'(-s --silent)'{-s,--silent}'[skip Yarn console logs, other types of logs (script output) will be printed]' \
|
||||
'--scripts-prepend-node-path=[prepend the node executable dir to the PATH in scripts]:bool:(true false)' \
|
||||
'--skip-integrity-check[run install without checking if node_modules is installed]' \
|
||||
"--strict-semver[don't compare semver loosely]" \
|
||||
'--update-checksum[update package checksums from current repository]' \
|
||||
'--use-yarnrc=[specifies a yarnrc that Yarn should use]:yarnrc:_files' \
|
||||
'1: :_yarn_commands_scripts' \
|
||||
'*:: :->command_args'
|
||||
|
||||
|
@ -180,18 +218,29 @@ _yarn() {
|
|||
'(-O --optional)'{-O,--optional}'[install packages in optionalDependencies]' \
|
||||
'(-E --exact)'{-E,--exact}'[install packages as exact versions]' \
|
||||
'(-T --tilde)'{-T,--tilde}'[install the most recent release of the packages that have the same minor version]' \
|
||||
'(--ignore-workspace-root-check -W)'{--ignore-workspace-root-check,-W}'[allows a package to be installed at the workspaces root]' \
|
||||
'--audit[checks for known security issues with the installed packages]' \
|
||||
'*:package-name:_yarn_add_files'
|
||||
;;
|
||||
|
||||
audit)
|
||||
_arguments \
|
||||
'--verbose[output verbose message]' \
|
||||
'--json[format Yarn log messages as lines of JSON]' \
|
||||
'--level=[only print advisories with severity greater than or equal to]:level:(info low moderate high critical)' \
|
||||
'--groups=[only audit dependencies from listed groups]:groups:->groups_args'
|
||||
;;
|
||||
|
||||
cache)
|
||||
_arguments \
|
||||
'1: :(ls dir clean)'
|
||||
'1: :(list dir clean)' \
|
||||
'*:: :->cache_args'
|
||||
;;
|
||||
|
||||
check)
|
||||
_arguments \
|
||||
'--integrity' \
|
||||
'--verify-tree'
|
||||
'--integrity[Verifies that versions and hashed values of the package contents in package.json]' \
|
||||
'--verify-tree[Recursively verifies that the dependencies in package.json are present in node_modules]'
|
||||
;;
|
||||
|
||||
config)
|
||||
|
@ -230,12 +279,13 @@ _yarn() {
|
|||
|
||||
list)
|
||||
_arguments \
|
||||
'--depth[Limit the depth of the shown dependencies]:depth'
|
||||
'--depth=[Limit the depth of the shown dependencies]:depth' \
|
||||
'--pattern=[filter the list of dependencies by the pattern]'
|
||||
;;
|
||||
|
||||
owner)
|
||||
_arguments \
|
||||
'1: :(ls add rm)' \
|
||||
'1: :(list add rm)' \
|
||||
'*:: :->owner_args'
|
||||
;;
|
||||
|
||||
|
@ -254,12 +304,22 @@ _yarn() {
|
|||
'1: :_files'
|
||||
;;
|
||||
|
||||
policies)
|
||||
_arguments \
|
||||
'1: :(set-version)'
|
||||
;;
|
||||
|
||||
remove|upgrade)
|
||||
_arguments \
|
||||
'*:package:'
|
||||
;;
|
||||
|
||||
run)
|
||||
if [[ -n $opt_args[--cwd] ]]; then
|
||||
_yarn_run_cwd=$opt_args[--cwd]
|
||||
else
|
||||
_yarn_run_cwd=''
|
||||
fi
|
||||
_arguments \
|
||||
'1: :_yarn_scripts' \
|
||||
'*:: :_default'
|
||||
|
@ -267,26 +327,33 @@ _yarn() {
|
|||
|
||||
tag)
|
||||
_arguments \
|
||||
'1: :(ls add rm)' \
|
||||
'1: :(lists add rm)' \
|
||||
'*:: :->tag_args'
|
||||
;;
|
||||
|
||||
team)
|
||||
_arguments \
|
||||
'1: :(create destroy add rm ls)' \
|
||||
'1: :(create destroy add rm list)' \
|
||||
'*:: :->team_args'
|
||||
;;
|
||||
|
||||
upgrade-interactive)
|
||||
_arguments \
|
||||
'--latest:use the version tagged latest in the registry:'
|
||||
'--latest[use the version tagged latest in the registry]'
|
||||
;;
|
||||
|
||||
version)
|
||||
_arguments \
|
||||
'--new-version:version:' \
|
||||
'--message:message:' \
|
||||
'--no-git-tag-version'
|
||||
'--new-version[create a new version using an interactive session to prompt you]:version:' \
|
||||
'--major[creates a new version by incrementing the major version]' \
|
||||
'--minor[creates a new version by incrementing the minor version]' \
|
||||
'--patch[creates a new version by incrementing the patch version]' \
|
||||
'--premajor[creates a new prerelease version by incrementing the major version]' \
|
||||
'--preminor[creates a new prerelease version by incrementing the minor version]' \
|
||||
'--prepatch[creates a new prerelease version by incrementing the patch version]' \
|
||||
'--prerelease[increments the prerelease version number keeping the main version]' \
|
||||
'--no-git-tag-version[creates a new version without creating a git tag]' \
|
||||
'--no-commit-hooks[bypasses running commit hooks when committing the new version]'
|
||||
;;
|
||||
|
||||
why)
|
||||
|
@ -294,6 +361,18 @@ _yarn() {
|
|||
'1:query:_files'
|
||||
;;
|
||||
|
||||
workspace)
|
||||
_arguments \
|
||||
'1:workspace:_yarn_workspaces' \
|
||||
'*:: :_yarn_global_commands'
|
||||
;;
|
||||
|
||||
workspaces)
|
||||
_arguments \
|
||||
'--json[format Yarn log messages as lines of JSON]' \
|
||||
'1:commands:(info run)'
|
||||
;;
|
||||
|
||||
*)
|
||||
_default
|
||||
;;
|
||||
|
@ -302,6 +381,12 @@ _yarn() {
|
|||
esac
|
||||
|
||||
case $state in
|
||||
cache_args)
|
||||
if [[ $words[1] == "list" ]]; then
|
||||
_arguments \
|
||||
'--pattern=[print out every cached package that matches the pattern]:pattern:'
|
||||
fi
|
||||
;;
|
||||
config_args)
|
||||
case $words[1] in
|
||||
get|delete)
|
||||
|
@ -317,6 +402,10 @@ _yarn() {
|
|||
;;
|
||||
esac
|
||||
;;
|
||||
groups_args)
|
||||
local dependency_groups=(devDependencies dependencies optionalDependencies peerDependencies bundledDependencies)
|
||||
_values -s ',' 'groups' $dependency_groups
|
||||
;;
|
||||
|
||||
owner_args)
|
||||
case $words[1] in
|
||||
|
|
|
@ -441,5 +441,5 @@ Note this only applies to utility functions that use ACTIONs in their specificat
|
|||
|
||||
* Other resources
|
||||
[[https://wikimatze.de/writing-zsh-completion-for-padrino/][Here]] is a nicely formatted short tutorial showing basic usage of the _arguments function,
|
||||
and [[http://www.linux-mag.com/id/1106/][here]] is a slightly more advanced tutorial using the _arguments function.
|
||||
and [[https://web.archive.org/web/20190411104837/http://www.linux-mag.com/id/1106/][here]] is a slightly more advanced tutorial using the _arguments function.
|
||||
[[http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-System][Here]] is the zshcompsys man page.
|
||||
|
|
Loading…
Reference in New Issue