From 295133d741985565befd68330fd728710d9db5cc Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 20 Jan 2016 07:47:28 +0000 Subject: 37703: Completion: git: Also complete sendmail commands for send-email's configuration. (after 37666) --- Completion/Unix/Command/_git | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Completion/Unix') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 5f137d009..65916f01e 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2268,7 +2268,7 @@ _git-config () { sendemail.suppressfrom:'add From\: address to the Cc\: list::->bool:false' sendemail.to:'value of To\: header::_email_addresses' sendemail.smtpdomain:'FQDN to use for HELO/EHLO commands to SMTP server:smtp domain:_domains' - sendemail.smtpserver:'SMTP server to connect to:smtp host:_hosts' + sendemail.smtpserver:'SMTP server to connect to:smtp host: __git_sendmail_smtpserver_values' sendemail.smtpserveroption:'specifies the outgoing SMTP server option to use:SMTP server option:->string' sendemail.smtpserverport:'port to connect to SMTP server on:smtp port:_ports' sendemail.smtpsslcertpath:'path to ca-certificates (directory or file):ca certificates path:_files' @@ -2293,7 +2293,7 @@ _git-config () { 'sendemail.*.suppressfrom:rules for suppressing From\:::->sendemail.suppressfrom' 'sendemail.*.to:value of To\: header::_email_addresses' 'sendemail.*.smtpdomain:FQDN to use for HELO/EHLO commands to SMTP server:smtp domain:_domains' - 'sendemail.*.smtpserver:SMTP server to connect to:smtp host:_hosts' + 'sendemail.*.smtpserver:SMTP server to connect to:smtp host: __git_sendmail_smtpserver_values' 'sendemail.*.smtpserveroption:specifies the outgoing SMTP server option to use:SMTP server option:->string' 'sendemail.*.smtpserverport:port to connect to SMTP server on:smtp port:_ports' 'sendemail.*.smtpuser:user to use for SMTP-AUTH:smtp user:_users' -- cgit v1.2.3 From 3c9185272d1af21cd976a548f932d7554a3bb533 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Thu, 21 Jan 2016 13:31:34 -0600 Subject: 37725: Completion: _init_d: add OpenBSD bits --- ChangeLog | 5 +++++ Completion/Unix/Command/_init_d | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 7c6623e09..5cb338f08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-01-23 Matthew Martin + + * 37725: Completion/Unix/Command/_init_d: Completion: _init_d: + add OpenBSD bits + 2016-01-23 Daniel Shahaf * 37703: Completion/Unix/Command/_git: Completion: git: Also diff --git a/Completion/Unix/Command/_init_d b/Completion/Unix/Command/_init_d index bbf62fc0d..2bb8d538c 100644 --- a/Completion/Unix/Command/_init_d +++ b/Completion/Unix/Command/_init_d @@ -1,6 +1,7 @@ #compdef -p */(init|rc[0-9S]#).d/* local cmds script +local -a flags _compskip=all @@ -41,6 +42,23 @@ if [[ $OSTYPE = freebsd* ]]; then return 0 } +elif [[ $OSTYPE = openbsd* ]]; then + (( $+functions[_init_d_fullpath] )) || + _init_d_fullpath() { + echo /etc/rc.d/$1 + return 0 + } + + (( $+functions[_init_d_get_cmds] )) || + _init_d_get_cmds() { + local -a cmds disabled + + cmds=(start stop reload restart check) + disabled=(${${${(M)${(f)"$(< $script)"}:#rc_(${(~j:|:)cmds})=NO}#rc_}%=NO}) + echo ${cmds:|disabled} + } + + flags=('-d[print debug information]' '-f[forcibly start the daemon]') else (( $+functions[_init_d_fullpath] )) || _init_d_fullpath() { @@ -90,4 +108,4 @@ cmds=( $(_init_d_get_cmds) ) || return (( $#cmds )) || zstyle -a ":completion:${curcontext}:commands" commands cmds || cmds=(start stop) -_sub_commands $cmds +_arguments -s -A "-*" $flags ':init.d command:_sub_commands $cmds' -- cgit v1.2.3 From a090acab63c02900e86bd268fc9194fccf459d08 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Jan 2016 09:14:49 +0000 Subject: unposted: _init_d: Report failure to caller. --- ChangeLog | 5 +++++ Completion/Unix/Command/_init_d | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 266570b41..eaf8f838c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-01-29 Daniel Shahaf + + * unposted: Completion/Unix/Command/_init_d: _init_d: Report + failure to caller. + 2016-01-28 Eric Cook * 37814: Kamil Dudka: Functions/Misc/run-help-ip: use /bin/zsh diff --git a/Completion/Unix/Command/_init_d b/Completion/Unix/Command/_init_d index 2bb8d538c..03af2dc9b 100644 --- a/Completion/Unix/Command/_init_d +++ b/Completion/Unix/Command/_init_d @@ -103,7 +103,7 @@ fi script=$words[1] [[ $script = */* ]] || script="$(_init_d_fullpath "$script")" -cmds=( $(_init_d_get_cmds) ) || return +cmds=( $(_init_d_get_cmds) ) || return 1 (( $#cmds )) || zstyle -a ":completion:${curcontext}:commands" commands cmds || cmds=(start stop) -- cgit v1.2.3 From 8a59aed6967b5283cbf0c7d32559b11d3a841a37 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 9 Feb 2016 03:23:20 +0000 Subject: 37924: Completion: _git: Complete files for 'check-ignore' Also, don't leak the parameter 'ret'; the leak was theoretical because the caller immediately wrote to that parameter. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 40349a82f..76add9f27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-02-09 Daniel Shahaf + * 37924: Completion/Unix/Command/_git: Completion: _git: + Complete files for 'check-ignore' + * 37923: Completion/Debian/Command/_bts: Completion: _bts: Fix quoting of $DEBEMAIL. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 65916f01e..b7eaf2e49 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -406,7 +406,7 @@ _git-check-ignore () { '-z[make output format machine-parseable and treat input-paths as NUL-separated with --stdin]' \ '(-n --non-matching)'{-n,--non-matching}'[show given paths which do not match any pattern]' \ '--no-index[do not look in the index when undertaking the checks]' \ - '*:: :->file' && ret=0 + '*:: :_files' } (( $+functions[_git-check-mailmap] )) || -- cgit v1.2.3 From 9cc6ebe7a2263e6697d497e95335369b06bec11b Mon Sep 17 00:00:00 2001 From: Eric Cook Date: Thu, 11 Feb 2016 22:53:16 -0500 Subject: 37913: add additional completers and _zpool improvement --- ChangeLog | 9 ++++ Completion/BSD/Command/_gstat | 11 +++++ Completion/BSD/Command/_sysrc | 77 +++++++++++++++++++++++++++++ Completion/Linux/Command/_gpasswd | 21 ++++++++ Completion/Linux/Command/_htop | 10 ++++ Completion/Linux/Command/_kpartx | 14 ++++++ Completion/Unix/Command/_top | 101 ++++++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_tput | 18 +++++++ Completion/Unix/Command/_zpool | 10 ++++ 9 files changed, 271 insertions(+) create mode 100644 Completion/BSD/Command/_gstat create mode 100644 Completion/BSD/Command/_sysrc create mode 100644 Completion/Linux/Command/_gpasswd create mode 100644 Completion/Linux/Command/_htop create mode 100644 Completion/Linux/Command/_kpartx create mode 100644 Completion/Unix/Command/_top create mode 100644 Completion/Unix/Command/_tput (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index a6e3514fa..12be11c58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2016-02-11 Eric Cook + + * 37913: Completion/BSD/Command/_gstat, + Completion/BSD/Command/_sysrc, Completion/Linux/Command/_gpasswd, + Completion/Linux/Command/_htop, Completion/Linux/Command/_kpartx, + Completion/Unix/Command/_top, Completion/Unix/Command/_tput, + Completion/Unix/Command/_zpool: new completers and improvement + for _zpool. + 2016-02-11 Peter Stephenson * 37946: Src/utils.c: make rm * warnings more informative about diff --git a/Completion/BSD/Command/_gstat b/Completion/BSD/Command/_gstat new file mode 100644 index 000000000..55b7db74d --- /dev/null +++ b/Completion/BSD/Command/_gstat @@ -0,0 +1,11 @@ +#compdef gstat + +_arguments -s -w : \ + '-a[only display providers that are at least 0.1% busy]' \ + '-b[batch mode]' \ + '-c[enable the display geom(4) consumers]' \ + '-d[enable the display delete operations]' \ + '-f[filter by regex]:regex' \ + '-o[enable the display for other operations]' \ + '-I[display refresh rate]:interval' \ + '-p[only display physical providers]' diff --git a/Completion/BSD/Command/_sysrc b/Completion/BSD/Command/_sysrc new file mode 100644 index 000000000..d8bc4ef0e --- /dev/null +++ b/Completion/BSD/Command/_sysrc @@ -0,0 +1,77 @@ +#compdef sysrc +_sysrc_caching_policy() { + local -a oldp + oldp=( "$1"(Nm+1) ) + (( $#oldp )) +} + + +_sysrc() { + _arguments -A '-*' : \ + '-c[check only, return success if vars are set]' \ + '-d[print variable(s) description]' \ + '-D[print default value(s) only]' \ + '-e[print variables as sh(1) compatible syntax]' \ + '*-f[operate on specified file(s), not \`rc_conf_files'\'']: : _files' \ + '-F[print only the last rc.conf(5) file each directive is in]' \ + '-h[print short usage message]' \ + '--help[print full usage message]' \ + '-i[ignore unknown variables]' \ + '-j[jail to operate within]:jails:_jails' \ + '-n[print only variable values]' \ + '-N[print only variable names]' \ + '-q[quiet mode]' \ + '-R[specify an alternative root]:alternative root:_files -/' \ + '-v[verbose mode]' \ + '--version[print version information]' \ + '-x[remove specified variables from specified file(s)]' \ + '*:configuration variable:->confvars' \ + - set1 \ + '-a[list all non-default configuration variables]' \ + - set2 \ + '-A[list all configuration variables]' + + if [[ $state == confvars ]]; then + local k v opt curcontext="${curcontext%:*}:values"; local -a rc_conf_vars + if [[ -prefix *=* ]]; then + # do you really want to go down this hole? + _message -e values value + else + if zstyle -T ":completion:${curcontext%:*}:values" verbose; then + opt=d + else + opt=N + fi + + if ! zstyle -m ":completion:${curcontext%:*}:values" cache-policy '*'; then + zstyle ":completion:${curcontext%:*}:values" cache-policy _sysrc_caching_policy + fi + + if _cache_invalid sysrc/rc_conf_vars || + ! _retrieve_cache sysrc/rc_conf_vars; then + + _call_program sysrc-cmd sysrc -A$opt | while read -r k v; do + [[ $k = DEBUG* ]] && continue + if [[ -z $v ]]; then + rc_conf_vars+=( ${k%:} ) + else + rc_conf_vars+=( "${k%:}[${${v//]/\\]}//:/\\:}]" ) + fi + v= + done + + _store_cache sysrc/rc_conf_vars rc_conf_vars + fi + + if (( $#rc_conf_vars )); then + if [[ $opt == N ]]; then + _values -w -C variable ${^rc_conf_vars%%\[*}'::value' + else + _values -w -C variable ${^rc_conf_vars}'::value' + fi + fi + fi + fi +} + +_sysrc "$@" diff --git a/Completion/Linux/Command/_gpasswd b/Completion/Linux/Command/_gpasswd new file mode 100644 index 000000000..9b4bedec6 --- /dev/null +++ b/Completion/Linux/Command/_gpasswd @@ -0,0 +1,21 @@ +#compdef gpasswd +local curcontext=$curcontext state state_descr line +typeset -A opt_args + +_arguments -C -w -s \ + '(-a --add -d --delete)'{-a,--add}'[add user to group]: : _users' \ + '(-d --delete -a --add)'{-d,--delete}'[remove user from group]: : _users' \ + '(-h --help)'{-h,--help}'[display help]' \ + '(-Q --root)'{-Q,--root}'[directory to chroot into]: : _files -/' \ + '(-r --remove-password)'{-r,--remove-password}'[remove the group password]' \ + '(-R --restrict)'{-R,--restrict}'[restrict access to GROUP to its members]' \ + '(-M --members -A --administrators)'{-M,--members}'[set the list of members of GROUP]: :->users' \ + '(-A --administrators -M --members)'{-A,--administrators}'[set the list of admins for GROUP]: :->users' \ + '1: : _groups' + +if [[ $state == users ]]; then + local -a ignore + compset -P '*,'; compset -S ',*' + ignore=( ${(s:,:)IPREFIX} ${(s:,:)ISUFFIX} ) + _users -F ignore -qS , +fi diff --git a/Completion/Linux/Command/_htop b/Completion/Linux/Command/_htop new file mode 100644 index 000000000..9a6133a86 --- /dev/null +++ b/Completion/Linux/Command/_htop @@ -0,0 +1,10 @@ +#compdef htop + +_arguments -S : \ + '(-d --delay)'{-d+,--delay=}'[update frequency]:duration' \ + '(-C --no-color --no-colour)'{-C,--no-colo{,u}r}'[monochrome mode]' \ + '(-h --help)'{-h,--help}'[display help]' \ + '(-p --pid)'{-p+,--pid=}'[show given pids]: : _sequence -n ${$(*}##[[:space:]]}%%[[:space:]]*} ) @@ -164,6 +168,12 @@ _zpool() { '::count:' ;; + (labelclear) + _arguments -A "-*" \ + '-f[treat exported or foreign devices as inactive]' \ + '*:virtual device:_files' + ;; + (status) _arguments -A "-*" \ '-l[Display configuration in /dev/chassis location form]' \ -- cgit v1.2.3 From 485cbbb6cc6ac9d7c13a8268b3574829026f3797 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sun, 14 Feb 2016 13:10:06 -0800 Subject: 37972: Redirect stderr to /dev/null in cases where ${~param} might generate errors --- ChangeLog | 9 +++++++++ Completion/Base/Utility/_arguments | 2 +- Completion/Base/Widget/_correct_filename | 2 +- Completion/Base/Widget/_most_recent_file | 2 +- Completion/Unix/Command/_devtodo | 2 +- Completion/Unix/Command/_make | 2 +- Completion/Unix/Command/_ssh | 2 +- Completion/Unix/Command/_tar | 2 +- Completion/Unix/Command/_zip | 2 +- Completion/Unix/Type/_canonical_paths | 2 +- 10 files changed, 18 insertions(+), 9 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index a081f0ad4..b0ba429c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-02-14 Barton E. Schaefer + * 37972: Completion/Base/Utility/_arguments, + Completion/Base/Widget/_correct_filename, + Completion/Base/Widget/_most_recent_file, + Completion/Unix/Command/_devtodo, Completion/Unix/Command/_make, + Completion/Unix/Command/_ssh, Completion/Unix/Command/_tar, + Completion/Unix/Command/_zip, + Completion/Unix/Type/_canonical_paths: Redirect stderr to + /dev/null in cases where ${~param} might generate errors + * 37971 (cf. users/21284: Eric Freese): Functions/Zle/bracketed-paste-magic: fix potential issues when interacting with user-defined widgets diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments index 87fb20e6b..687c0c4ed 100644 --- a/Completion/Base/Utility/_arguments +++ b/Completion/Base/Utility/_arguments @@ -36,7 +36,7 @@ if (( long )); then tmpargv=( "${(@)argv[1,long-1]}" ) # optspec's before --, if any - name=${~words[1]} + name=${~words[1]} 2>/dev/null [[ "$name" = [^/]*/* ]] && name="$PWD/$name" name="_args_cache_${name}" diff --git a/Completion/Base/Widget/_correct_filename b/Completion/Base/Widget/_correct_filename index 7431a4831..3150ffcdb 100644 --- a/Completion/Base/Widget/_correct_filename +++ b/Completion/Base/Widget/_correct_filename @@ -28,7 +28,7 @@ fi if [[ $file = \~*/* ]]; then tilde=${file%%/*} - etilde=${~tilde} + etilde=${~tilde} 2>/dev/null file=${file/#$tilde/$etilde} fi diff --git a/Completion/Base/Widget/_most_recent_file b/Completion/Base/Widget/_most_recent_file index 68d1c91a2..e72cf5e8d 100644 --- a/Completion/Base/Widget/_most_recent_file +++ b/Completion/Base/Widget/_most_recent_file @@ -11,7 +11,7 @@ local file tilde etilde if [[ $PREFIX = \~*/* ]]; then tilde=${PREFIX%%/*} - etilde=${~tilde} + etilde=${~tilde} 2>/dev/null # PREFIX and SUFFIX have full command line quoting in, but we want # any globbing characters which are quoted to stay quoted. eval "file=($PREFIX*$SUFFIX(om[${NUMERIC:-1}]N))" diff --git a/Completion/Unix/Command/_devtodo b/Completion/Unix/Command/_devtodo index 2800f4a31..dbc64f870 100644 --- a/Completion/Unix/Command/_devtodo +++ b/Completion/Unix/Command/_devtodo @@ -9,7 +9,7 @@ typeset expl for ((i=2; i <= $#words; i++)) { if [[ $words[$i] == '--database' ]]; then - todo_opts+=(--database ${~words[$((++i))]}) + todo_opts+=(--database ${~words[$((++i))]}) 2>/dev/null elif [[ $words[$i] == '--sort' ]]; then todo_opts+=(--sort ${words[$((++i))]}) fi diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make index 48befa749..c3f3961c9 100644 --- a/Completion/Unix/Command/_make +++ b/Completion/Unix/Command/_make @@ -129,7 +129,7 @@ _make-findBasedir () { do if [[ $@[index] == -C ]] then - file=${~@[index+1]}; + file=${~@[index+1]} 2>/dev/null if [[ -z $file ]] then # make returns with an error if an empty arg is given diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index c6ede9efe..1f8f62cac 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -622,7 +622,7 @@ _ssh_hosts () { ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return fi if (( ind = ${words[(I)-F]} )); then - config=${~words[ind+1]} + config=${~words[ind+1]} 2>/dev/null else config="$HOME/.ssh/config" fi diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar index 1e99ac013..4a2404873 100644 --- a/Completion/Unix/Command/_tar +++ b/Completion/Unix/Command/_tar @@ -79,7 +79,7 @@ else tf=${~words[tmp+1]} _tar_cmd="f$_tar_cmd" fi -fi +fi 2>/dev/null # See if we should use a path prefix. We have to use eval as the dir can # be any unevaluated thing which appears on the command line, including a diff --git a/Completion/Unix/Command/_zip b/Completion/Unix/Command/_zip index 171daf01e..1040fa977 100644 --- a/Completion/Unix/Command/_zip +++ b/Completion/Unix/Command/_zip @@ -120,7 +120,7 @@ case $state in zipfile=$testfile.ZIP else return 1 - fi + fi 2>/dev/null if [[ $zipfile != $_zip_cache_name ]]; then _zip_cache_name="$zipfile" _zip_cache_list=( ${(f)"$(zipinfo -1 $_zip_cache_name)"} ) diff --git a/Completion/Unix/Type/_canonical_paths b/Completion/Unix/Type/_canonical_paths index d23b913ef..e4a725b2b 100644 --- a/Completion/Unix/Type/_canonical_paths +++ b/Completion/Unix/Type/_canonical_paths @@ -61,7 +61,7 @@ _canonical_paths_get_canonical_path() { _canonical_paths_add_paths () { local origpref=$1 expref rltrim curpref canpref subdir [[ $2 != add ]] && matches=() - expref=${~origpref} + expref=${~origpref} 2>/dev/null [[ $origpref == (|*/). ]] && rltrim=. curpref=${${expref%$rltrim}:-./} if zstat $curpref >&/dev/null; then -- cgit v1.2.3 From e3188ff0e80bd9e4515fc50ce8c2e78b3f2f4fdc Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sun, 14 Feb 2016 13:11:20 -0800 Subject: 37898: complete gcc linker options --- ChangeLog | 2 ++ Completion/Unix/Command/_gcc | 14 ++++++++++++++ 2 files changed, 16 insertions(+) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index b0ba429c7..69733632b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2016-02-14 Barton E. Schaefer + * 37898: Completion/Unix/Command/_gcc: complete linker options + * 37972: Completion/Base/Utility/_arguments, Completion/Base/Widget/_correct_filename, Completion/Base/Widget/_most_recent_file, diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc index 2c5ffdc8a..1276054db 100644 --- a/Completion/Unix/Command/_gcc +++ b/Completion/Unix/Command/_gcc @@ -763,6 +763,20 @@ args+=( '-fpack-struct=-[Set initial maximum structure member alignment]:alignment: ' ) +# More linker options, from gcc man pages +args+=( + '-nostartfiles[Do not use the standard system startup files when linking]' + '-nodefaultlibs[Do not use the standard system libraries when linking]' + '-nostdlib[Do not use the standard system startup files or libraries when linking]' + '-rdynamic[Pass the flag -export-dynamic to the ELF linker, on targets that support it]' + '-s[Remove all symbol table and relocation information from the executable]' + '-static[On systems that support dynamic linking, this prevents linking with the shared libraries]' + '-shared-libgcc[Force shared libgcc]' + '-static-libgcc[Force static libgcc]' + '-symbolic[Bind references to global symbols when building a shared object.]' + '-T:linker script:_files' +) + # other common options, gcc --help=warnings --help=optimizers --help=common|sed 1,/language-independent/d args+=( # | grep -v :: -- cgit v1.2.3 From 40b3d2a1f65809c9e2e43fe4c426bd231b2a975a Mon Sep 17 00:00:00 2001 From: Eric Cook Date: Mon, 15 Feb 2016 22:13:35 -0500 Subject: 37975: Completion/Unix/Command/_php: remove _arguments' -A option --- ChangeLog | 5 +++++ Completion/Unix/Command/_php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 272884d12..c94faad3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-02-15 Eric Cook + + * 37975: Completion/Unix/Command/_php: allow completion after + the first non-option argument. + 2016-02-14 Barton E. Schaefer * 37898: Completion/compinstall: fix typo in completer menu diff --git a/Completion/Unix/Command/_php b/Completion/Unix/Command/_php index 4edcd1e57..0e840032f 100644 --- a/Completion/Unix/Command/_php +++ b/Completion/Unix/Command/_php @@ -43,7 +43,7 @@ args+=( '(-)*::script argument: _normal' ) -_arguments -C -s -S -A "-*" "$args[@]" && return 0 +_arguments -C -s -S "$args[@]" && return 0 case $state in directive) -- cgit v1.2.3 From 983060d5d12e44558913f4c9d7e03ddd4a69f408 Mon Sep 17 00:00:00 2001 From: Jun-ichi Takimoto Date: Tue, 8 Mar 2016 21:21:44 +0900 Subject: 38074: _git reset HEAD: complete only staged files --- Completion/Unix/Command/_git | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b7eaf2e49..7a459f1fb 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1377,7 +1377,11 @@ _git-reset () { if [[ -n $line[1] ]] && __git_is_committish $line[1]; then commit=$line[1] fi - __git_tree_files ${PREFIX:-.} $commit && ret=0 + if [[ $commit == HEAD ]]; then + __git_ignore_line __git_staged_files && ret=0 + else + __git_ignore_line __git_tree_files ${PREFIX:-.} $commit && ret=0 + fi ;; esac @@ -6131,6 +6135,29 @@ __git_tree_files () { _wanted files expl 'tree file' _multi_parts -f $compadd_opts -- / tree_files } +(( $+functions[__git_staged_files] )) || +__git_staged_files () { + local -a slist staged_files + local item expl i + + slist=(${(0)"$(_call_program staged-files git status -z -uno 2>/dev/null)"}) + __git_command_successful $pipestatus || return 1 + + for (( i = 1; i <= $#slist; ++i )) do + item=$slist[i] + if [[ $item == (DD|AA|U|?U)* ]]; then + continue #XXX skip unmerged files + elif [[ $item == R* ]]; then + staged_files+=( $item[4,-1] $slist[++i] ) + elif [[ $item == [ACDM]* ]]; then + staged_files+=( $item[4,-1] ) + fi + done + staged_files=( ${(0)"$(__git_files_relative ${(pj:\0:)staged_files})"} ) + + _wanted staged-files expl 'staged file' compadd "$@" -a - staged_files +} + # Repository Argument Types (( $+functions[__git_remote_repositories] )) || -- cgit v1.2.3 From 33bd9136d6700dcef772a48dc565fe11a7dfb85a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 9 Mar 2016 14:06:49 +0000 Subject: 38120: _git: Document the internal helper function __git_ignore_line. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 10 ++++++++++ 2 files changed, 15 insertions(+) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index be61bd073..b99eee7c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-09 Daniel Shahaf + + * 38120: Completion/Unix/Command/_git: Document the internal + helper function __git_ignore_line. + 2016-03-08 Peter Stephenson * 38114: Src/exec.c: In substitutions involving subshells, disable diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 7a459f1fb..2dd9a8028 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5038,6 +5038,16 @@ __git_describe_commit () { # Completion Wrappers +# '__git_ignore_line $callee "${callee_args[@]}" "${callee_compadd_args[@]}"' +# invokes '$callee "${callee_args[@]}" "${callee_compadd_args[@]}"' with +# callee_compadd_args modified to exclude positional parameters to the completed +# command from being completed. This causes 'git add foo ' not to offer +# 'foo' again. +# +# Note: This function can't be used to wrap bare 'compadd' calls that use a '--' +# argument terminator. It can wrap functions of the form +# f() { shift $N; compadd "$@" -a - mymatches } +# . (( $+functions[__git_ignore_line] )) || __git_ignore_line () { declare -a ignored -- cgit v1.2.3 From be41c522f2e02982f66c080f23b6a54c10c4c091 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 9 Mar 2016 22:11:22 +0000 Subject: 38123 (after 38074): _git reset $treeish: complete only staged files --- ChangeLog | 5 ++++ Completion/Unix/Command/_git | 56 ++++++++++++++++---------------------------- 2 files changed, 25 insertions(+), 36 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 105a040ae..63d8fd792 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-10 Daniel Shahaf + + * 38123 (after 38074): Completion/Unix/Command/_git: _git reset + $treeish: complete only staged files + 2016-03-09 Daniel Shahaf * 38120: Completion/Unix/Command/_git: Document the internal diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 2dd9a8028..f0ad3d95d 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1373,16 +1373,11 @@ _git-reset () { case $state in (file) - local commit=HEAD - if [[ -n $line[1] ]] && __git_is_committish $line[1]; then - commit=$line[1] + local tree=HEAD + if [[ -n $line[1] ]] && __git_is_treeish $line[1]; then + tree=$line[1] fi - if [[ $commit == HEAD ]]; then - __git_ignore_line __git_staged_files && ret=0 - else - __git_ignore_line __git_tree_files ${PREFIX:-.} $commit && ret=0 - fi - ;; + __git_ignore_line __git_treeish-to-index_files $tree && ret=0 esac return ret @@ -6077,16 +6072,28 @@ __git_killed_files () { __git_files --killed killed-files 'killed file' $* } -(( $+functions[__git_changed-in-index_files] )) || -__git_changed-in-index_files () { +(( $+functions[__git_diff-index_files] )) || +__git_diff-index_files () { + local tree=$1 description=$2 tag=$3; shift 3 local files expl - files=$(_call_program files git diff-index -z --name-only --no-color --cached HEAD 2>/dev/null) + files=$(_call_program files git diff-index -z --name-only --no-color --cached $tree 2>/dev/null) __git_command_successful $pipestatus || return 1 files=(${(0)"$(__git_files_relative $files)"}) __git_command_successful $pipestatus || return 1 - _wanted changed-in-index-files expl 'changed in index file' _multi_parts $@ - / files + _wanted $tag expl $description _multi_parts $@ - / files +} + +(( $+functions[__git_changed-in-index_files] )) || +__git_changed-in-index_files () { + __git_diff-index_files HEAD 'changed in index file' changed-in-index-files "$@" +} + +(( $+functions[__git_treeish-to-index_files] )) || +__git_treeish-to-index_files () { + local tree=$1; shift + __git_diff-index_files $tree "files different between ${(qq)tree} and the index" treeish-to-index-files "$@" } (( $+functions[__git_changed-in-working-tree_files] )) || @@ -6145,29 +6152,6 @@ __git_tree_files () { _wanted files expl 'tree file' _multi_parts -f $compadd_opts -- / tree_files } -(( $+functions[__git_staged_files] )) || -__git_staged_files () { - local -a slist staged_files - local item expl i - - slist=(${(0)"$(_call_program staged-files git status -z -uno 2>/dev/null)"}) - __git_command_successful $pipestatus || return 1 - - for (( i = 1; i <= $#slist; ++i )) do - item=$slist[i] - if [[ $item == (DD|AA|U|?U)* ]]; then - continue #XXX skip unmerged files - elif [[ $item == R* ]]; then - staged_files+=( $item[4,-1] $slist[++i] ) - elif [[ $item == [ACDM]* ]]; then - staged_files+=( $item[4,-1] ) - fi - done - staged_files=( ${(0)"$(__git_files_relative ${(pj:\0:)staged_files})"} ) - - _wanted staged-files expl 'staged file' compadd "$@" -a - staged_files -} - # Repository Argument Types (( $+functions[__git_remote_repositories] )) || -- cgit v1.2.3 From 98fcdb0861af6462d233f6199568d64b01fb7b08 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 10 Mar 2016 23:15:51 +0000 Subject: 38128: _git: Fix completion of diffs against the index when treeish isn't shell-safe This affects 'git diff --cached -- ' and 'git reset $treeish '. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 63d8fd792..34be26e2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-03-10 Daniel Shahaf + * 38128: Completion/Unix/Command/_git: Fix completion of diffs + against the index when treeish isn't shell-safe + * 38123 (after 38074): Completion/Unix/Command/_git: _git reset $treeish: complete only staged files diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index f0ad3d95d..6c88ad073 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6077,7 +6077,8 @@ __git_diff-index_files () { local tree=$1 description=$2 tag=$3; shift 3 local files expl - files=$(_call_program files git diff-index -z --name-only --no-color --cached $tree 2>/dev/null) + # $tree needs to be escaped for _call_program; matters for $tree = "HEAD^" + files=$(_call_program files git diff-index -z --name-only --no-color --cached ${(q)tree} 2>/dev/null) __git_command_successful $pipestatus || return 1 files=(${(0)"$(__git_files_relative $files)"}) __git_command_successful $pipestatus || return 1 -- cgit v1.2.3 From 527badc237cf1afd44c7215838ce69ae28dd35d8 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 10 Mar 2016 23:20:54 +0000 Subject: 38129: _git: Fix __git_ignore_line's treatment of shell and pattern metacaracters. Builds upon a patch by Jun T. Also upgrade/fix __git_pattern_escape. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 34be26e2e..0e7d1e023 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-11 Daniel Shahaf + + * 38129: Completion/Unix/Command/_git: Fix __git_ignore_line's + treatment of shell and pattern metacaracters. + 2016-03-10 Daniel Shahaf * 38128: Completion/Unix/Command/_git: Fix completion of diffs diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 6c88ad073..e3d7231d3 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -4956,7 +4956,7 @@ __git_committish_range_last () { (( $+functions[__git_pattern_escape] )) || __git_pattern_escape () { - print -r -n ${1//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH} + print -r -n - ${(b)1} } (( $+functions[__git_is_type] )) || @@ -5048,9 +5048,9 @@ __git_ignore_line () { declare -a ignored ignored=() ((CURRENT > 1)) && - ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) + ignored+=(${(bQ)line[1,CURRENT-1]}) ((CURRENT < $#line)) && - ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) + ignored+=(${(bQ)line[CURRENT+1,-1]}) $* -F ignored } -- cgit v1.2.3 From 666a7f5845ee88f4e736a4f0f3921c69314eb15c Mon Sep 17 00:00:00 2001 From: m0viefreak Date: Sun, 13 Mar 2016 23:01:57 +0100 Subject: 38148: _git: reflog: complete references next to commands 'git reflog show' is the default subcommand, so git reflog should complete subcommands and references. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 9e61f564d..e55cb1ce3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-15 m0viefreak + + * 38148: Completion/Unix/Command/_git: reflog: complete + references next to commands + 2016-03-11 Daniel Shahaf * 38135: Src/Zle/complete.c: internal: bin_compadd: Add a diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index e3d7231d3..ea2d4857a 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -3069,7 +3069,9 @@ _git-reflog () { 'delete:delete entries from reflog' 'show:show log of ref') - _describe -t commands command commands && ret=0 + _alternative \ + 'commands:: _describe -t commands command commands' \ + 'references:: __git_references' && ret=0 ;; (option-or-argument) curcontext=${curcontext%:*}-$line[1]: -- cgit v1.2.3 From a1f45b3346f2c2d10e51c2a33bd98b1161334c67 Mon Sep 17 00:00:00 2001 From: m0viefreak Date: Sun, 13 Mar 2016 23:01:58 +0100 Subject: 38151: _git: fix tag name of remote branches --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index e55cb1ce3..71d8e12a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-03-15 m0viefreak + * 38151: Completion/Unix/Command/_git: fix tag name of remote + branches + * 38148: Completion/Unix/Command/_git: reflog: complete references next to commands diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index ea2d4857a..12410582a 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -457,7 +457,7 @@ _git-checkout () { if (( CURRENT == 1 )) && [[ -z $opt_args[(I)--] ]]; then # TODO: Allow A...B local branch_arg='' \ - remote_branch_noprefix_arg='remote branches::__git_remote_branch_names_noprefix' \ + remote_branch_noprefix_arg='remote-branch-names-noprefix::__git_remote_branch_names_noprefix' \ tree_ish_arg='tree-ishs::__git_tree_ishs' \ file_arg='modified-files::__git_modified_files' -- cgit v1.2.3 From 5deb57714fc799918552b22f077cc4b1daf1f68f Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Tue, 15 Mar 2016 23:35:40 +0100 Subject: 38161: _tmux: Use a colon to terminate options to _arguments itself In users/21384 it was reported that % tmux new-session - ...does not offer -A as a candidate for completion even though the option is listed in the involved helper function _tmux-new-session(). -A is actually an option the _arguments function uses itself. The documentation states: To avoid ambiguity, all options to _arguments itself may be separated from the spec forms by a single colon. This commit changes each _arguments call to include the optional colon, so problems like this are prevented now and hopefully in the future. --- ChangeLog | 5 ++ Completion/Unix/Command/_tmux | 158 +++++++++++++++++++++--------------------- 2 files changed, 84 insertions(+), 79 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 956b145e6..787e993c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-16 Frank Terbeck + + * 38161: Completion/Unix/Command/_tmux: _tmux: Use a colon to + terminate options to _arguments itself + 2016-03-15 Daniel Shahaf * 38155: Doc/Zsh/compsys.yo: docs: compsys: Clarify documentation diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux index d218cc3f3..93b5c7faa 100644 --- a/Completion/Unix/Command/_tmux +++ b/Completion/Unix/Command/_tmux @@ -171,7 +171,7 @@ function _tmux-attach-session() { '-r[put the client into read-only mode]' '-t[choose a target session]:target session:__tmux-sessions' ) - _arguments ${args} + _arguments : ${args} } function _tmux-bind-key() { @@ -187,7 +187,7 @@ function _tmux-bind-key() { '1: :->key' '*:: :->command_and_args' ) - _arguments -C ${args} && return + _arguments -C : ${args} && return if [[ ${state} == 'key' ]]; then _message "key" @@ -206,7 +206,7 @@ function _tmux-break-pane() { '-P[print information of new window after it has been created]' '-t[choose a target pane]:panes:__tmux-panes' ) - _arguments ${args} + _arguments : ${args} } function _tmux-capture-pane() { @@ -225,7 +225,7 @@ function _tmux-capture-pane() { '-S[specify start line to capture. - means first line of scrollback]' '-t[choose source pane]:source pane:__tmux-panes' ) - _arguments ${args} + _arguments : ${args} } function _tmux-choose-buffer() { @@ -236,7 +236,7 @@ function _tmux-choose-buffer() { '-t[choose a target window]:sessions:__tmux-windows' '*:: :->tmpl' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-choose-client() { @@ -247,7 +247,7 @@ function _tmux-choose-client() { '-t[choose a target window]:sessions:__tmux-windows' '*:: :->tmpl' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-choose-session() { @@ -258,7 +258,7 @@ function _tmux-choose-session() { '-t[choose a target window]:sessions:__tmux-windows' '*:: :->tmpl' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-choose-tree() { @@ -275,7 +275,7 @@ function _tmux-choose-tree() { '-w[choose among windows]' '*:: :->tmpl' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-choose-window() { @@ -286,21 +286,21 @@ function _tmux-choose-window() { '-t[choose a target window]:sessions:__tmux-windows' '*:: :->tmpl' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-clear-history() { [[ -n ${tmux_describe} ]] && print "Remove and clear history for a pane" && return local -a args args=('-t[choose a target pane]:panes:__tmux-panes') - _arguments ${args} + _arguments : ${args} } function _tmux-clock-mode() { [[ -n ${tmux_describe} ]] && print "Enter clock mode" && return local -a args args=('-t[choose a target pane]:panes:__tmux-panes') - _arguments ${args} + _arguments : ${args} } function _tmux-command-prompt() { @@ -313,7 +313,7 @@ function _tmux-command-prompt() { '-t[choose a target client]:clients:__tmux-clients' '*:: :->tmpl' ) - _arguments -C ${args} && return + _arguments -C : ${args} && return if [[ ${state} == 'plist' ]]; then _message "comma seperated list of prompts" return @@ -333,7 +333,7 @@ function _tmux-confirm-before() { '-t[choose a target client]:clients:__tmux-clients' '*:: :->command_and_args' ) - _arguments -C ${args} && return + _arguments -C : ${args} && return if [[ ${state} == 'prompt' ]]; then _message 'prompt string' return @@ -348,14 +348,14 @@ function _tmux-copy-mode() { '-t[choose a target pane]:panes:__tmux-panes' '-u[scroll up one page]' ) - _arguments ${args} + _arguments : ${args} } function _tmux-delete-buffer() { [[ -n ${tmux_describe} ]] && print "Delete a paste buffer" && return local -a args args=('-b[choose a target buffer index]:buffers:__tmux-buffers') - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-detach-client() { @@ -367,7 +367,7 @@ function _tmux-detach-client() { '-s[choose a target session and kill its clients]:sessions:__tmux-sessions' '-t[choose a target client]:clients:__tmux-clients' ) - _arguments ${args} + _arguments : ${args} } function _tmux-display-message() { @@ -379,7 +379,7 @@ function _tmux-display-message() { '-t[choose a target client]:clients:__tmux-clients' '*:: :->msg' ) - _arguments ${args} && return + _arguments : ${args} && return __tmux-lastarg ${state} 'msg' 1 "message" } @@ -387,7 +387,7 @@ function _tmux-display-panes() { [[ -n ${tmux_describe} ]] && print "Display an indicator for each visible pane" && return local -a args args=('-t[choose a target client]:clients:__tmux-clients') - _arguments ${args} + _arguments : ${args} } function _tmux-find-window() { @@ -402,7 +402,7 @@ function _tmux-find-window() { '-t[choose a target window]:windows:__tmux-windows' '*:: :->pattern' ) - _arguments ${args} && return + _arguments : ${args} && return __tmux-lastarg ${state} 'pattern' 1 "window search pattern" } @@ -410,7 +410,7 @@ function _tmux-has-session() { [[ -n ${tmux_describe} ]] && print "Check and report if a session exists on the server" && return local -a args args=('-t[choose a target session]:sessions:__tmux-sessions') - _arguments ${args} + _arguments : ${args} } function _tmux-if-shell() { @@ -422,7 +422,7 @@ function _tmux-if-shell() { '1:shell command:' '2:tmux command:' ) - _arguments ${args} + _arguments : ${args} } function _tmux-join-pane() { @@ -438,7 +438,7 @@ function _tmux-join-pane() { '-s[choose source pane]:window:__tmux-panes' '-t[choose target pane]:window:__tmux-panes' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-kill-pane() { @@ -448,7 +448,7 @@ function _tmux-kill-pane() { '-a[kill all panes except the one specified by -t]' '-t[choose a target pane]:panes:__tmux-panes' ) - _arguments ${args} + _arguments : ${args} } function _tmux-kill-server() { @@ -463,7 +463,7 @@ function _tmux-kill-session() { '-a[kill all session except the one specified by -t]' '-t[choose a target session]:sessions:__tmux-sessions' ) - _arguments ${args} + _arguments : ${args} } function _tmux-kill-window() { @@ -473,7 +473,7 @@ function _tmux-kill-window() { '-a[kill all windows except the one specified by -t]' '-t[choose a target window]:windows:__tmux-windows' ) - _arguments ${args} + _arguments : ${args} } function _tmux-last-pane() { @@ -484,14 +484,14 @@ function _tmux-last-pane() { '-e[enable input to the pane]' '-t[choose a session]:sessions:__tmux-sessions' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-last-window() { [[ -n ${tmux_describe} ]] && print "Select the previously selected window" && return local -a args args=('-t[choose a session]:sessions:__tmux-sessions') - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-link-window() { @@ -503,14 +503,14 @@ function _tmux-link-window() { '-s[choose source window]:window:__tmux-windows' '-t[choose destination window]:window:__tmux-windows' ) - _arguments ${args} + _arguments : ${args} } function _tmux-list-buffers() { [[ -n ${tmux_describe} ]] && print "List paste buffers of a session" && return local -a args args=('-F[specify format of output]:format:__tmux-format') - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-list-clients() { @@ -520,7 +520,7 @@ function _tmux-list-clients() { '-F[specify format of output]:format:__tmux-format' '-t[choose a session]:sessions:__tmux-sessions' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-list-commands() { @@ -532,7 +532,7 @@ function _tmux-list-keys() { [[ -n ${tmux_describe} ]] && print "List all key-bindings" && return local -a args args=('-t[choose a key table]:key table:__tmux-key-tables') - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-list-panes() { @@ -545,14 +545,14 @@ function _tmux-list-panes() { # TODO: Use __tmux-windows or __tmux-sessions depending on -s. '-t[choose a window]:windows:__tmux-windows' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-list-sessions() { [[ -n ${tmux_describe} ]] && print "List sessions managed by server" && return local -a args args=('-F[specify format of output]:format:__tmux-format') - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-list-windows() { @@ -563,7 +563,7 @@ function _tmux-list-windows() { '-F[specify format of output]:format:__tmux-format' '-t[choose a session]:sessions:__tmux-sessions' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-load-buffer() { @@ -574,14 +574,14 @@ function _tmux-load-buffer() { '-b[choose a target buffer index]:panes:__tmux-buffers' '1:file name:_files -g "*(-.)"' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-lock-client() { [[ -n ${tmux_describe} ]] && print "Lock a client" && return local -a args args=('-t[choose a client]:clients:__tmux-clients') - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-lock-server() { @@ -593,7 +593,7 @@ function _tmux-lock-session() { [[ -n ${tmux_describe} ]] && print "Lock all clients attached to a session" && return local -a args args=('-t[choose a session]:sessions:__tmux-sessions') - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-move-pane() { @@ -609,7 +609,7 @@ function _tmux-move-pane() { '-s[choose source pane]:window:__tmux-panes' '-t[choose target pane]:window:__tmux-panes' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-move-window() { @@ -622,7 +622,7 @@ function _tmux-move-window() { '-r[renumber windows in session in sequential order]' '-t[choose destination window]:window:__tmux-windows' ) - _arguments ${args} + _arguments : ${args} } function _tmux-new-session() { @@ -642,7 +642,7 @@ function _tmux-new-session() { '-y[specify height]:height:_guard "[0-9]#" "numeric value"' '*:: :_cmdstring' ) - _arguments -s ${args} + _arguments -s : ${args} } function _tmux-new-window() { @@ -659,14 +659,14 @@ function _tmux-new-window() { '-t[specify target window]:windows:__tmux-windows' '*:: :_cmdstring' ) - _arguments ${args} + _arguments : ${args} } function _tmux-next-layout() { [[ -n ${tmux_describe} ]] && print "Move a window to the next layout" && return local -a args args=('-t[choose target window]:window:__tmux-windows') - _arguments ${args} + _arguments : ${args} } function _tmux-next-window() { @@ -676,7 +676,7 @@ function _tmux-next-window() { '-a[move to the next window with an alert]' '-t[choose target session]:session:__tmux-sessions' ) - _arguments ${args} + _arguments : ${args} } function _tmux-paste-buffer() { @@ -690,7 +690,7 @@ function _tmux-paste-buffer() { '-s[specify separator]:separator:' '-t[choose target window]:window:__tmux-windows' ) - _arguments ${args} + _arguments : ${args} } function _tmux-pipe-pane() { @@ -701,7 +701,7 @@ function _tmux-pipe-pane() { '-t[choose target pane]:pane:__tmux-panes' '*:: :->cmd' ) - _arguments ${args} && return + _arguments : ${args} && return __tmux-lastarg ${state} 'cmd' 1 "command string" } @@ -709,7 +709,7 @@ function _tmux-previous-layout() { [[ -n ${tmux_describe} ]] && print "Move a window to the previous layout" && return local -a args args=('-t[choose target window]:window:__tmux-windows') - _arguments ${args} + _arguments : ${args} } function _tmux-previous-window() { @@ -719,7 +719,7 @@ function _tmux-previous-window() { '-a[move to the previous window with an alert]' '-t[choose target session]:session:__tmux-sessions' ) - _arguments ${args} + _arguments : ${args} } function _tmux-refresh-client() { @@ -729,7 +729,7 @@ function _tmux-refresh-client() { '-S[Only update the client'\''s status bar]' '-t[choose target client]:client:__tmux-clients' ) - _arguments ${args} + _arguments : ${args} } function _tmux-rename-session() { @@ -739,7 +739,7 @@ function _tmux-rename-session() { '-t[choose target session]:session:__tmux-sessions' '*:: :->name' ) - _arguments ${args} && return + _arguments : ${args} && return __tmux-lastarg ${state} 'name' 1 "new session name" } @@ -750,7 +750,7 @@ function _tmux-rename-window() { '-t[choose target window]:window:__tmux-windows' '*:: :->name' ) - _arguments ${args} && return + _arguments : ${args} && return __tmux-lastarg ${state} 'name' 1 "new window name" } @@ -767,7 +767,7 @@ function _tmux-resize-pane() { '-Z[toggle zoom of pane]' '1::adjustment (defaults to one):_guard "[0-9]#" "numeric value"' ) - _arguments ${args} + _arguments : ${args} } function _tmux-respawn-pane() { @@ -778,7 +778,7 @@ function _tmux-respawn-pane() { '-t[choose target pane]:window:__tmux-pane' '*::command:_cmdstring' ) - _arguments ${args} + _arguments : ${args} } function _tmux-respawn-window() { @@ -789,7 +789,7 @@ function _tmux-respawn-window() { '-t[choose target window]:window:__tmux-windows' '*::command:_cmdstring' ) - _arguments ${args} + _arguments : ${args} } function _tmux-rotate-window() { @@ -800,7 +800,7 @@ function _tmux-rotate-window() { '-U[rotate upward]' '-t[choose target window]:window:__tmux-windows' ) - _arguments ${args} + _arguments : ${args} } function _tmux-run-shell() { @@ -811,7 +811,7 @@ function _tmux-run-shell() { '-t[choose target pane]:pane:__tmux-panes' '*::command:_cmdstring' ) - _arguments ${args} + _arguments : ${args} } function _tmux-save-buffer() { @@ -822,7 +822,7 @@ function _tmux-save-buffer() { '-a[append to rather than overwriting file]' '-b[choose a target buffer index]:buffer:__tmux-buffers' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-select-layout() { @@ -833,7 +833,7 @@ function _tmux-select-layout() { '-t[choose a target window]:target window:__tmux-windows' '*::layout name:__tmux-layouts' ) - _arguments ${args} + _arguments : ${args} } function _tmux-select-pane() { @@ -849,7 +849,7 @@ function _tmux-select-pane() { '-U[Move to the pane above this]' '-t[choose a target pane]:panes:__tmux-panes' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-select-window() { @@ -862,7 +862,7 @@ function _tmux-select-window() { '-T[if selected window is the current behave like last-window]' '-t[choose a target window]:windows:__tmux-windows' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-send-keys() { @@ -875,7 +875,7 @@ function _tmux-send-keys() { '-t[choose a target pane]:panes:__tmux-panes' '*:: :->key' ) - _arguments ${args} && return + _arguments : ${args} && return __tmux-lastarg ${state} 'key' 1 "key" } @@ -886,7 +886,7 @@ function _tmux-send-prefix() { '-2[send secondary prefix key]' '-t[choose a target pane]:panes:__tmux-panes' ) - _arguments ${args} + _arguments : ${args} } function _tmux-server-info() { @@ -904,7 +904,7 @@ function _tmux-set-buffer() { '-n[specify new buffer name]:buffer-name:' '*:: :->data' ) - _arguments ${args} && return + _arguments : ${args} && return __tmux-lastarg ${state} 'data' 1 "data" } @@ -919,7 +919,7 @@ function _tmux-set-environment() { '-t[choose a target session]:target session:__tmux-sessions' '*:: :->name_or_value' ) - _arguments -C ${args} + _arguments -C : ${args} case ${state} in name_or_value) @@ -954,7 +954,7 @@ function _tmux-set-option() { else mode=session fi - _arguments -C ${args} + _arguments -C : ${args} __tmux-options-complete ${mode} ${state} } @@ -968,7 +968,7 @@ function _tmux-set-window-option() { '-t[choose a target window]:target window:__tmux-windows' '*:: :->name_or_value' ) - _arguments -C ${args} + _arguments -C : ${args} __tmux-options-complete window ${state} } @@ -976,7 +976,7 @@ function _tmux-show-buffer() { [[ -n ${tmux_describe} ]] && print "Display the contents of a paste buffer" && return local -a args args=('-b[choose a target buffer index]:panes:->buffer') - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-show-environment() { @@ -986,7 +986,7 @@ function _tmux-show-environment() { '-g[show global environment]' '-t[choose a target session]:target session:__tmux-sessions' ) - _arguments ${args} + _arguments : ${args} } function _tmux-show-messages() { @@ -998,7 +998,7 @@ function _tmux-show-messages() { '-T[show debugging information about involved terminals]' '-t[choose target client]:client:__tmux-clients' ) - _arguments ${args} + _arguments : ${args} } function _tmux-show-options() { @@ -1008,7 +1008,7 @@ function _tmux-show-options() { '-g[show global options]' '-t[choose a target session]:target session:__tmux-sessions' ) - _arguments ${args} + _arguments : ${args} } function _tmux-show-window-options() { @@ -1018,7 +1018,7 @@ function _tmux-show-window-options() { '-g[show global options]' '-t[choose a target window]:target window:__tmux-windows' ) - _arguments ${args} + _arguments : ${args} } function _tmux-source-file() { @@ -1044,7 +1044,7 @@ function _tmux-split-window() { '-t[choose target pane]:window:__tmux-panes' '*:: :_cmdstring' ) - _arguments ${args} && return + _arguments : ${args} && return } function _tmux-start-server() { @@ -1056,7 +1056,7 @@ function _tmux-suspend-client() { [[ -n ${tmux_describe} ]] && print "Suspend a client" && return local -a args args=('-t[choose destination client]:client:__tmux-clients') - _arguments ${args} + _arguments : ${args} } function _tmux-swap-pane() { @@ -1069,7 +1069,7 @@ function _tmux-swap-pane() { '-s[choose source pane]:pane:__tmux-panes' '-t[choose destination pane]:pane:__tmux-panes' ) - _arguments ${args} + _arguments : ${args} } function _tmux-swap-window() { @@ -1080,7 +1080,7 @@ function _tmux-swap-window() { '-s[choose source window]:window:__tmux-windows' '-t[choose destination window]:window:__tmux-windows' ) - _arguments ${args} + _arguments : ${args} } function _tmux-switch-client() { @@ -1094,7 +1094,7 @@ function _tmux-switch-client() { '-r[toggle read-only flag of client]' '-t[choose a target window]:window:__tmux-windows' ) - _arguments ${args} + _arguments : ${args} } function _tmux-unbind-key() { @@ -1110,7 +1110,7 @@ function _tmux-unbind-key() { '-t[choose a key table]:key table:__tmux-key-tables' '*:: :->boundkeys' ) - _arguments ${args} && return + _arguments : ${args} && return [[ ${state} != 'boundkeys' ]] && return keytable="$(__tmux-get-optarg -t "${ow[@]}")" if [[ -n ${keytable} ]]; then @@ -1127,7 +1127,7 @@ function _tmux-unlink-window() { '-k[kill the window if it is only in one session]' '-t[choose a target window]:target window:__tmux-windows' ) - _arguments ${args} + _arguments : ${args} } function _tmux-wait-for() { @@ -1140,7 +1140,7 @@ function _tmux-wait-for() { '-U[unlock the named channel]' '*:: :->channel' ) - _arguments ${args} && return + _arguments : ${args} && return __tmux-lastarg ${state} 'channel' 1 "event channel" } @@ -1585,7 +1585,7 @@ function _tmux() { '-V[report tmux version]' '*:: :->subcommand_or_options' ) - _arguments -C -s -w ${args} && ret=0 + _arguments -C -s -w : ${args} && ret=0 if [[ ${state} == "subcommand_or_options" ]]; then if (( CURRENT == 1 )) ; then -- cgit v1.2.3 From bc0c3caf607d93f75de4c32e5dc485b5475ca8ae Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 18 Mar 2016 17:16:54 +0100 Subject: 38179: _adb: Fix completion by mostly reverting 35531 --- ChangeLog | 5 ++++ Completion/Unix/Command/_adb | 68 ++++++++++++++++++++++++++------------------ 2 files changed, 45 insertions(+), 28 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 787e993c5..ba4e49f1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-18 Mikael Magnusson + + * 38179: Completion/Unix/Command/_adb: Fix completion by mostly + reverting 35531 + 2016-03-16 Frank Terbeck * 38161: Completion/Unix/Command/_tmux: _tmux: Use a colon to diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb index 88aca2464..fa05226ce 100644 --- a/Completion/Unix/Command/_adb +++ b/Completion/Unix/Command/_adb @@ -37,34 +37,45 @@ _adb() { local -a ALL_ADB_COMMANDS ALL_ADB_COMMANDS=( + "backup" + "bugreport" "connect" + "devices" + "disable-verity" "disconnect" - "shell" - "wait-for-device" - "push" - "pull" - "logcat" - "jdwp" - "bugreport" - "version" + "emu" + "enable-verity" "forward" - "install" - "uninstall" + "get-devpath" + "get-serialno" + "get-state" "help" - "start-server" + "install" + "install-multiple" + "jdwp" + "keygen" "kill-server" - "devices" - "get-state" - "get-serialno" - "status-window" - "remount" + "logcat" + "ppp" + "pull" + "push" "reboot" "reboot-bootloader" + "remount" + "restore" + "reverse" "root" - "usb" - "tcpip" + "shell" "sideload" - "ppp" + "start-server" + "status-window" + "sync" + "tcpip" + "uninstall" + "unroot" + "usb" + "version" + "wait-for-device" ) (( $+functions[_adb_device_specification] )) && _adb_device_specification @@ -100,28 +111,29 @@ _adb_dispatch_command () { fi case ${curcontext} in - (*:adb-shell) + (*:adb:shell) (( $+functions[_adb_dispatch_shell] )) && _adb_dispatch_shell ;; - (*:adb-connect|*:adb-disconnect) + (*:adb:connect|*:adb:disconnect) (( $+functions[_adb_dispatch_connection_handling] )) && _adb_dispatch_connection_handling ;; - (*:adb-logcat) + (*:adb:logcat) (( $+functions[_adb_dispatch_logcat] )) && _adb_dispatch_logcat ;; - (*:adb-push) + (*:adb:push) (( $+functions[_adb_dispatch_push] )) && _adb_dispatch_push ;; - (*:adb-pull) + (*:adb:pull) (( $+functions[_adb_dispatch_pull] )) && _adb_dispatch_pull ;; - (*:adb-install) + (*:adb:install) (( $+functions[_adb_dispatch_install] )) && _adb_dispatch_install ;; - (*:adb-uninstall) + (*:adb:uninstall) (( $+functions[_adb_dispatch_uninstall] )) && _adb_dispatch_uninstall ;; - (*:adb-*) + (*:adb:(${(~j:|:)ALL_ADB_COMMANDS})) + # subcommand not handled _default ;; (*) @@ -147,7 +159,7 @@ _adb_sanitize_context () { done ##expand unquoted to remove sparse elements mywords=( ${mywords[@]} ) - (( $#mywords )) && curcontext="${curcontext%:*}-${mywords[-1]}:" + curcontext="${curcontext}${mywords[-1]}" } (( $+functions[_adb_device_specification] )) || -- cgit v1.2.3 From 7ad041c9e9c2099c4b9ba0fa4c1b64645c1e6f37 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sat, 19 Mar 2016 13:33:51 +0100 Subject: 38186: _adb: fix remote file completion + various fixes --- ChangeLog | 7 ++++- Completion/Unix/Command/_adb | 75 ++++++++++++++++++-------------------------- 2 files changed, 36 insertions(+), 46 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 169fcce9b..b0dd2ff7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-19 Mikael Magnusson + + * 38186: Completion/Unix/Command/_adb: fix remote file completion, + various fixes, restore 35531 again with fix from 38185 + 2016-03-18 Daniel Shahaf * unposted: Doc/Zsh/contrib.yo: Document run-help-* helper @@ -6,7 +11,7 @@ 2016-03-18 Mikael Magnusson * 38179: Completion/Unix/Command/_adb: Fix completion by mostly - reverting 35531 + reverting 35531, add missing subcommands from latest adb 2016-03-16 Frank Terbeck diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb index fa05226ce..c0a2bb27e 100644 --- a/Completion/Unix/Command/_adb +++ b/Completion/Unix/Command/_adb @@ -87,7 +87,7 @@ _adb() { '(-d -e )-s[serial]: :_adb_device_serial' \ '( -e -s)-d[device]' \ '(-d -s)-e[emulator]' \ - '1:"options":_adb_options_handler' \ + '1:options:_adb_options_handler' \ '*: : _default' return; @@ -111,37 +111,36 @@ _adb_dispatch_command () { fi case ${curcontext} in - (*:adb:shell) + (*:adb-shell:) (( $+functions[_adb_dispatch_shell] )) && _adb_dispatch_shell ;; - (*:adb:connect|*:adb:disconnect) + (*:adb-connect:|*:adb-disconnect:) (( $+functions[_adb_dispatch_connection_handling] )) && _adb_dispatch_connection_handling ;; - (*:adb:logcat) + (*:adb-logcat:) (( $+functions[_adb_dispatch_logcat] )) && _adb_dispatch_logcat ;; - (*:adb:push) + (*:adb-push:) (( $+functions[_adb_dispatch_push] )) && _adb_dispatch_push ;; - (*:adb:pull) + (*:adb-pull:) (( $+functions[_adb_dispatch_pull] )) && _adb_dispatch_pull ;; - (*:adb:install) + (*:adb-install:) (( $+functions[_adb_dispatch_install] )) && _adb_dispatch_install ;; - (*:adb:uninstall) + (*:adb-uninstall:) (( $+functions[_adb_dispatch_uninstall] )) && _adb_dispatch_uninstall ;; - (*:adb:(${(~j:|:)ALL_ADB_COMMANDS})) - # subcommand not handled + (*:adb-*) _default ;; (*) _arguments \ - '(-d -e)-s["serial"]: :_adb_device_serial' \ - '(-s -e)-d["device"]' \ - '(-d -s)-e["emulator"]' \ - '*:"options":_adb_options_handler' + '(-d -e)-s[serial]: :_adb_device_serial' \ + '(-s -e)-d[device]' \ + '(-d -s)-e[emulator]' \ + '*:options:_adb_options_handler' ;; esac } @@ -159,7 +158,7 @@ _adb_sanitize_context () { done ##expand unquoted to remove sparse elements mywords=( ${mywords[@]} ) - curcontext="${curcontext}${mywords[-1]}" + (( $#mywords )) && curcontext="${curcontext%:*}-${mywords[-1]}:" } (( $+functions[_adb_device_specification] )) || @@ -203,7 +202,7 @@ _adb_dispatch_shell () { (( $+functions[_adb_package_manager_handler] )) && _adb_package_manager_handler ;; (*) - _arguments '*:adb_remote_folder:_adb_remote_folder' + _arguments '*: :_adb_remote_folder' ;; esac } @@ -328,8 +327,8 @@ _adb_dispatch_uninstall () { fi _arguments \ - '-k["keep data and cache"]' \ - '*:"installed package":_adb_installed_packages' + '-k[keep data and cache]' \ + '*:installed package:_adb_installed_packages' } (( $+functions[_adb_dispatch_install] )) || @@ -342,10 +341,10 @@ _adb_dispatch_install () { fi _arguments \ - '-l["forward lock"]' \ - '-r["reinstall"]' \ - '-s["install on sd"]' \ - '*:"select apk file":_path_files -g "*(/)|*.apk"' + '-l[forward lock]' \ + '-r[reinstall]' \ + '-s[install on sd]' \ + '*:apk file:_path_files -g "*(/)|*.apk"' } (( $+functions[_adb_dispatch_push] )) || @@ -357,9 +356,9 @@ _adb_dispatch_push () { fi if [[ ${#words} -gt 2 ]] then - _arguments '*:adb_remote_folder:_adb_remote_folder' + _arguments '*: :_adb_remote_folder' else - _arguments '*:"local file/folder":_files' + _arguments '*:local file/folder:_files' fi } @@ -372,9 +371,9 @@ _adb_dispatch_pull () { fi if [[ ${#words} -gt 2 ]] then - _arguments '*:"local file/folder":_files' + _arguments '*:local file/folder:_files' else - _arguments '*:adb_remote_folder:_adb_remote_folder' + _arguments '*: :_adb_remote_folder' fi } @@ -465,11 +464,6 @@ _adb_shell_commands_handler() { _wanted adb_shell_commands expl 'adb shell commands' compadd ls pm am mkdir rmdir rm cat } -(( $+functions[_adb_any_device_available] )) || -_adb_any_device_available() { - _any_device_available=${#$(adb devices | sed -n 's/^\([^[:space:]]*\)\t.*$/\1/p')} -} - (( $+functions[_adb_device_available] )) || _adb_device_available() { [[ $(adb ${=ADB_DEVICE_SPECIFICATION} get-state 2>&1) == "device" ]] && return 0 @@ -478,22 +472,16 @@ _adb_device_available() { (( $+functions[_adb_full_folder_scan] )) || _adb_full_folder_scan() { - local -a rv; - rv=( ${$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'for i in $(ls -d /*) + filesystem_content=( ${${(f)"$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'cd /;for i in * do case $i in - /proc|/sys|/acct) + proc|sys|acct) ;; *) - ls -R $i + find $i 2> /dev/null ;; esac - done' )//'$\r'/} ) - for line in ${rv[@]}; - do - [[ ${line[1]} == '/' ]] && folder="${line%:}" && adb_device_folders+=$folder && continue; - adb_device_folders+=$folder/$line; - done + done' )"}%$'\r'} ) } (( $+functions[_adb_remote_folder] )) || @@ -503,14 +491,11 @@ _adb_remote_folder () { if [[ -z "$update_policy" ]]; then zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_daily fi - local cacheid=package_cache_${$(adb ${=ADB_DEVICE_SPECIFICATION} get-serialno)} + local cacheid=folder_cache_${$(adb ${=ADB_DEVICE_SPECIFICATION} get-serialno)} typeset -a filesystem_content if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" then - local -a adb_device_folders _adb_full_folder_scan - # remove any duplicates and the initial slash => should still remove bare folders from it when it has children - filesystem_content=( ${(u)adb_device_folders#/} ) _store_cache "$cacheid" filesystem_content fi _adb_device_available && \ -- cgit v1.2.3 From ee2f0dbed113742cd9f6f5574ab2e2d280a0de34 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sat, 19 Mar 2016 17:28:17 +0100 Subject: 38187: _adb: Just check current dir instead of recursively Thanks to LambdaComplex in IRC for help with troubleshooting. --- ChangeLog | 3 +++ Completion/Unix/Command/_adb | 38 ++++++++++++-------------------------- 2 files changed, 15 insertions(+), 26 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index b0dd2ff7d..0d431456d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * 38186: Completion/Unix/Command/_adb: fix remote file completion, various fixes, restore 35531 again with fix from 38185 + * 38187: Completion/Unix/Command/_adb: Just check current dir + instead of recursively + 2016-03-18 Daniel Shahaf * unposted: Doc/Zsh/contrib.yo: Document run-help-* helper diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb index c0a2bb27e..879e26045 100644 --- a/Completion/Unix/Command/_adb +++ b/Completion/Unix/Command/_adb @@ -470,40 +470,26 @@ _adb_device_available() { return 1 } -(( $+functions[_adb_full_folder_scan] )) || -_adb_full_folder_scan() { - filesystem_content=( ${${(f)"$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'cd /;for i in * - do - case $i in - proc|sys|acct) - ;; - *) - find $i 2> /dev/null - ;; - esac - done' )"}%$'\r'} ) -} - (( $+functions[_adb_remote_folder] )) || _adb_remote_folder () { - local expl - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_daily - fi - local cacheid=folder_cache_${$(adb ${=ADB_DEVICE_SPECIFICATION} get-serialno)} - typeset -a filesystem_content - if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" - then - _adb_full_folder_scan - _store_cache "$cacheid" filesystem_content + typeset -a files dirs + local pref=${PREFIX} + if [[ $pref != */* ]]; then + pref= + elif [[ $pref != */ ]]; then + pref=${pref%/*}/ fi + # yes, this ls is sickening to look at, but android doesn't have printf or find + files=(${${(f)"$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'ls -d 2> /dev/null '$pref'*/ '$pref'*')"}%$'\r'}) + dirs=(${${(M)files:#*/}%/}) + files=(${${files:|dirs}:#*\*(/|)}) _adb_device_available && \ - _wanted adb_remote_folder expl 'file/folder on device' _multi_parts $@ -i / filesystem_content + _wanted adb_remote_folder expl 'file/folder on device' _multi_parts $@ / files } (( $+functions[_adb_installed_packages] )) || _adb_installed_packages() { + local update_policy zstyle -s ":completion:${curcontext}:" cache-policy update_policy if [[ -z "$update_policy" ]]; then zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_single_command -- cgit v1.2.3 From 67136df0bf5d4b75e10c37fb19d49c28e098f052 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 18 Mar 2016 21:21:43 +0000 Subject: 38180: _git: Improve reflog completion. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, only used by «git reflog delete ». --- ChangeLog | 4 ++++ Completion/Unix/Command/_git | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 6c6e286e2..b708d3e58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-03-21 Daniel Shahaf + + * 38180: Completion/Unix/Command/_git: Improve reflog completion. + 2016-03-21 Peter Stephenson * m0viefreak: 38145: Doc/Zsh/zle.yo, Src/Zle/zle_params.c: Make diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 12410582a..9eeda5837 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5474,10 +5474,10 @@ __git_reflog_entries () { local expl declare -a reflog_entries - reflog_entries=(${${${(f)"$(_call_program reflog-entries git reflog 2>/dev/null)"}#* }%%:*}) + reflog_entries=(${(f)"$(_call_program reflog-entries "git reflog -1000 --pretty='%gD:[%h] %gs'" 2>/dev/null)"}) __git_command_successful $pipestatus || return 1 - _wanted reflog-entries expl 'reflog entry' _multi_parts @ reflog_entries + _describe -Vx -t reflog-entries 'reflog entry' reflog_entries } (( $+functions[__git_ref_sort_keys] )) || -- cgit v1.2.3 From ce4c9eafc491aad1213a1cc8e3c6e07057a01e4b Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 18 Mar 2016 21:21:44 +0000 Subject: 38181: _git reflog: Complete '@{N}' instead of 'HEAD@{N}'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The «HEAD@{...}» syntax is no longer completed, since it's not easily possible to support both syntaxes (workers/34768). --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 1 + 2 files changed, 4 insertions(+) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index b708d3e58..ab799d1eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-03-21 Daniel Shahaf + * 38181: Completion/Unix/Command/_git: _git reflog: Complete + '@{N}' instead of 'HEAD@{N}'. + * 38180: Completion/Unix/Command/_git: Improve reflog completion. 2016-03-21 Peter Stephenson diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 9eeda5837..0eb8532e2 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5475,6 +5475,7 @@ __git_reflog_entries () { declare -a reflog_entries reflog_entries=(${(f)"$(_call_program reflog-entries "git reflog -1000 --pretty='%gD:[%h] %gs'" 2>/dev/null)"}) + reflog_entries=( ${reflog_entries/HEAD@$'\x7b'/@$'\x7b'} ) __git_command_successful $pipestatus || return 1 _describe -Vx -t reflog-entries 'reflog entry' reflog_entries -- cgit v1.2.3 From 9f7040471473f5dedf0ae71a1973bc2606624aea Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 18 Mar 2016 21:21:45 +0000 Subject: 38182: _git: Invoke reflog completion from the 'complete commit objects' codepath. The reflog will only be used if the user has typed as "@" by hand. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index ab799d1eb..d8f5cb50a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-03-21 Daniel Shahaf + * 38182: Completion/Unix/Command/_git: Invoke reflog completion + from the 'complete commit objects' codepath. + * 38181: Completion/Unix/Command/_git: _git reflog: Complete '@{N}' instead of 'HEAD@{N}'. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 0eb8532e2..ee455764f 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5474,7 +5474,9 @@ __git_reflog_entries () { local expl declare -a reflog_entries - reflog_entries=(${(f)"$(_call_program reflog-entries "git reflog -1000 --pretty='%gD:[%h] %gs'" 2>/dev/null)"}) + # Repeat the %gD on the RHS due to uniquify the matches, to avoid bad + # completion list layout. (Compare workers/34768) + reflog_entries=(${(f)"$(_call_program reflog-entries "git reflog -1000 --pretty='%gD:[%h] %gs (%gD)'" 2>/dev/null)"}) reflog_entries=( ${reflog_entries/HEAD@$'\x7b'/@$'\x7b'} ) __git_command_successful $pipestatus || return 1 @@ -5671,8 +5673,13 @@ __git_commit_objects () { local gitdir expl start declare -a commits - # Abort if the argument does not match a commit hash (including empty). - [[ "$PREFIX$SUFFIX" == [[:xdigit:]](#c1,40) ]] || return 1 + if [[ -n $PREFIX[(r)@] ]] || [[ -n $SUFFIX[(r)@] ]]; then + # doesn't match a commit hash, but might be a reflog entry + __git_reflog_entries; return $? + elif ! [[ "$PREFIX$SUFFIX" == [[:xdigit:]](#c1,40) ]]; then + # Abort if the argument does not match a commit hash (including empty). + return 1 + fi # Note: the after-the-colon part must be unique across the entire array; # see workers/34768 -- cgit v1.2.3 From 4df62e32fcca80e6869b27bb7823a95337c984ca Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 6 Apr 2016 06:50:42 +0000 Subject: 38255: _git: Fix argument pastedness. Found by searching for /-\w\>.*:/. This covers short options only, from the top of file through _git-tag(). --- ChangeLog | 4 +++ Completion/Unix/Command/_git | 86 ++++++++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 43 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index b6fb070ca..bf20a5f23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-04-09 Daniel Shahaf + + * 38255: Completion/Unix/Command/_git: Fix argument pastedness. + 2016-04-07 Barton E. Schaefer * 38248: Src/Zle/zle_tricky.c: fix word position calculation diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index ee455764f..7ce5b2bed 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -100,7 +100,7 @@ _git-am () { # undocumented (and not implemented here). _arguments -S \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \ - '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ + '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ '(-k --keep)'{-k,--keep}'[pass -k to git mailinfo]' \ '--keep-non-patch[pass -b to git mailinfo]' \ @@ -327,7 +327,7 @@ _git-branch () { "($l $m $d $e -f --force)"{-f,--force}"[force the creation of a new branch]" \ "($l $m $d $e -t --track)"{-t,--track}"[set up configuration so that pull merges from the start point]" \ "($l $m $d $e)--no-track[override the branch.autosetupmerge configuration variable]" \ - "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)"{-u,--set-upstream-to=}"[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names" \ + "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}"[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names" \ "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \ "($l $m $d $e)--contains=[only list branches which contain the specified commit]: :__git_committishs" \ "($l $m $d $e)--merged=[only list branches which are fully contained by HEAD]: :__git_committishs" \ @@ -433,13 +433,13 @@ _git-checkout () { '(-f --force -m --merge --conflict --patch)'{-f,--force}'[force branch switch/ignore unmerged entries]' \ '(-q --quiet --theirs --patch)--ours[check out stage #2 for unmerged paths]' \ '(-q --quiet --ours --patch)--theirs[check out stage #3 for unmerged paths]' \ - '( -B --orphan --ours --theirs --conflict --patch --detach)-b[create a new branch based at given commit]: :__git_branch_names' \ - '(-b --orphan --ours --theirs --conflict --patch --detach)-B[create or update branch based at given commit]: :__git_branch_names' \ + '( -B --orphan --ours --theirs --conflict --patch --detach)-b+[create a new branch based at given commit]: :__git_branch_names' \ + '(-b --orphan --ours --theirs --conflict --patch --detach)-B+[create or update branch based at given commit]: :__git_branch_names' \ '(-t --track --orphan --patch --detach)'{-t,--track}'[set up configuration so pull merges from the base commit]' \ '(--patch)--no-track[override the branch.autosetupmerge configuration variable]' \ $new_branch_reflog_opt \ '(-b -B -t --track --patch --orphan)--detach[detach the HEAD at named commit]' \ - '(-b -B -t --track --patch --detach)--orphan[create a new orphan branch based at given commit]: :__git_branch_names' \ + '(-b -B -t --track --patch --detach)--orphan=[create a new orphan branch based at given commit]: :__git_branch_names' \ '--ignore-skip-worktree-bits[ignores patterns and adds back any files in ]' \ '(-q --quiet -f --force -m --merge --conflict --patch)'{-m,--merge}'[3way merge current branch, working tree and new branch]' \ '(-q --quiet -f --force -m --merge --patch)--conflict=[same as --merge, using given merge style]:style:(merge diff3)' \ @@ -503,13 +503,13 @@ _git-cherry-pick () { '--keep-redundant-commits[keep cherry-picked commits that will become empty]' \ '(-e --edit --ff)'{-e,--edit}'[edit commit before committing the revert]' \ '(--ff)-x[append information about what commit was cherry-picked]' \ - '(-m --mainline)'{-m,--mainline}'[specify mainline when cherry-picking a merge commit]:parent number' \ + '(-m --mainline)'{-m+,--mainline=}'[specify mainline when cherry-picking a merge commit]:parent number' \ '(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actually commit]' \ '(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ - '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ + '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ - '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ + '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \ ': : __git_commit_ranges -O expl:git_commit_opts' } @@ -530,7 +530,7 @@ _git-clean () { '(-i --interactive)'{-i,--interactive}'[show what would be done and clean files interactively]' \ '(-n --dry-run)'{-n,--dry-run}'[only show what would and what would not be removed]' \ '(-q --quiet)'{-q,--quiet}'[only report errors]' \ - '*'{-e,--exclude=}'[skip files matching specified pattern]:pattern' \ + '*'{-e+,--exclude=}'[skip files matching specified pattern]:pattern' \ '(-X )-x[also remove ignored files]' \ '( -x)-X[remove only ignored files]' \ '*: :->file' && ret=0 @@ -597,9 +597,9 @@ _git-clone () { '(-n --no-checkout)'{-n,--no-checkout}'[do not checkout HEAD after clone is complete]' \ '(-o --origin)--bare[make a bare GIT repository]' \ '(--bare)--mirror[clone refs into refs/* instead of refs/remotes/origin/*]' \ - '(-o --origin --bare)'{-o,--origin}'[use given remote name instead of "origin"]: :__git_guard_branch-name' \ - '(-b --branch)'{-b,--branch}'[point HEAD to the given branch]: :__git_guard_branch-name' \ - '(-u --upload-pack)'{-u,--upload-pack=}'[specify path to git-upload-pack on remote side]:remote path' \ + '(-o --origin --bare)'{-o+,--origin=}'[use given remote name instead of "origin"]: :__git_guard_branch-name' \ + '(-b --branch)'{-b+,--branch=}'[point HEAD to the given branch]: :__git_guard_branch-name' \ + '(-u --upload-pack)'{-u+,--upload-pack=}'[specify path to git-upload-pack on remote side]:remote path' \ '--template=[directory to use as a template for the object database]: :_directories' \ '*'{-c,--config}'[= set a configuration variable in the newly created repository]' \ '--depth[create a shallow clone, given number of revisions deep]: :__git_guard_number depth' \ @@ -673,7 +673,7 @@ _git-commit () { '--no-post-rewrite[bypass the post-rewrite hook]' \ '(-a --all --interactive -o --only -i --include)'{-i,--include}'[update the given files and commit the whole index]' \ '(-a --all --interactive -o --only -i --include)'{-o,--only}'[commit only the given files]' \ - '(-u --untracked-files)'{-u-,--untracked-files=}'[show files in untracked directories]::mode:((no\:"show no untracked files" + '(-u --untracked-files)'{-u-,--untracked-files=-}'[show files in untracked directories]::mode:((no\:"show no untracked files" normal\:"show untracked files and directories" all\:"show individual files in untracked directories"))' \ '(-q --quiet -v --verbose)'{-v,--verbose}'[show unified diff of all file changes]' \ @@ -687,11 +687,11 @@ _git-commit () { $amend_opt \ '*: :__git_ignore_line_inside_arguments __git_changed_files' \ - '(message)' \ - {-C,--reuse-message=}'[use existing commit object with same log message]: :__git_commits' \ - {-c,--reedit-message=}'[use existing commit object and edit log message]: :__git_commits' \ - {-F,--file=}'[read commit message from given file]: :_files' \ - {-m,--message=}'[use the given message as the commit message]:message' \ - {-t,--template=}'[use file as a template commit message]:template:_files' + {-C+,--reuse-message=}'[use existing commit object with same log message]: :__git_commits' \ + {-c+,--reedit-message=}'[use existing commit object and edit log message]: :__git_commits' \ + {-F+,--file=}'[read commit message from given file]: :_files' \ + {-m+,--message=}'[use the given message as the commit message]:message' \ + {-t+,--template=}'[use file as a template commit message]:template:_files' } (( $+functions[_git-describe] )) || @@ -853,7 +853,7 @@ _git-format-patch () { _arguments -w -C -S -s \ $diff_options \ '--[limit the number of patches to prepare]: :__git_guard_number "number of patches to prepare"' \ - '(-o --output-directory --stdout)'{-o,--output-directory}'[store resulting files in given directory]: :_directories' \ + '(-o --output-directory --stdout)'{-o+,--output-directory=}'[store resulting files in given directory]: :_directories' \ '(-n --numbered -N --no-numbered -k --keep-subject)'{-n,--numbered}'[name output in \[PATCH n/m\] format]' \ '(-n --numbered -N --no-numbered -k --keep-subject)'{-N,--no-numbered}'[name output in \[PATCH\] format]' \ '--start-number=[start numbering patches at given number]: :__git_guard_number "patch number"' \ @@ -869,7 +869,7 @@ _git-format-patch () { '(--thread )--no-thread[do not thread messages]' \ '--in-reply-to=[make the first mail a reply to the given message]:message id' \ '--ignore-if-in-upstream[do not include a patch that matches a commit in the given range]' \ - '(-v --reroll-count)'{-v,--reroll-count=}'[mark the series as the -th iteration of the topic]: :__git_guard_number iteration' \ + '(-v --reroll-count)'{-v+,--reroll-count=}'[mark the series as the -th iteration of the topic]: :__git_guard_number iteration' \ '(-k --keep-subject)--subject-prefix=[use the given prefix instead of \[PATCH\]]:prefix' \ '*--to=[add To: header to email headers]: :_email_addresses' \ '*--cc=[add Cc: header to email headers]: :_email_addresses' \ @@ -949,20 +949,20 @@ _git-grep () { '(-n --line-number)'{-n,--line-number}'[prefix the line number to matching lines]' \ '(-l --files-with-matches -L --files-without-match --name-only)'{-l,--files-with-matches,--name-only}'[show only names of matching files]' \ '(-l --files-with-matches -L --files-without-match)'{-L,--files-without-match}'[show only names of non-matching files]' \ - '(--cached -O --open-files-in-pager)'{-O,--open-files-in-pager=}'-[open matching files in pager]:pager:_cmdstring' \ + '(--cached -O --open-files-in-pager)'{-O+,--open-files-in-pager=}'-[open matching files in pager]:pager:_cmdstring' \ '(-z --null)'{-z,--null}'[output \0 after filenames]' \ '(-c --count)'{-c,--count}'[show number of matching lines in files]' \ '( --no-color)--color=-[color matches]:: :__git_color_whens' \ '(--color )--no-color[do not color matches]' \ '--break[prefix the line number to matching lines]' \ '--heading[show the filename above the matches]' \ - '(-A --after-context)'{-A,--after-context=}'[show trailing lines, and separate groups of matches]: :__git_guard_number lines' \ - '(-B --before-context)'{-B,--before-context=}'[show leading lines, and separate groups of matches]: :__git_guard_number lines' \ - '(-A --after-context -B --before-context -C --context)'{-C,--context=}'[show leading and trailing lines, and separate groups of matches]: :__git_guard_number lines' \ + '(-A --after-context)'{-A+,--after-context=}'[show trailing lines, and separate groups of matches]: :__git_guard_number lines' \ + '(-B --before-context)'{-B+,--before-context=}'[show leading lines, and separate groups of matches]: :__git_guard_number lines' \ + '(-A --after-context -B --before-context -C --context)'{-C+,--context=}'[show leading and trailing lines, and separate groups of matches]: :__git_guard_number lines' \ '(-p --show-function)'{-p,--show-function}'[show preceding line containing function name of match]' \ '(-W --function-context)'{-W,--function-context}'[show whole function where a match was found]' \ - '(1)*-f[read patterns from given file]:pattern file:_files' \ - '(1)*-e[use the given pattern for matching]:pattern' \ + '(1)*-f+[read patterns from given file]:pattern file:_files' \ + '(1)*-e+[use the given pattern for matching]:pattern' \ $pattern_operators \ '--all-match[all patterns must match]' \ ':pattern' \ @@ -1135,7 +1135,7 @@ _git-merge () { _arguments -w -S -s \ $merge_options \ - '-m[set the commit message to be used for the merge commit]:merge message' \ + '-m+[set the commit message to be used for the merge commit]:merge message' \ '( --no-rerere-autoupdate)--rerere-autoupdate[allow the rerere mechanism to update the index]' \ '(--rerere-autoupdate )--no-rerere-autoupdate[do not allow the rerere mechanism to update the index]' \ '--abort[restore the original branch and abort the merge operation]' \ @@ -1204,10 +1204,10 @@ _git-notes () { # TODO: Only complete commits that don't have notes already, unless # -f or --force has been given. _arguments -w -S -s \ - '*'{-m,--message=}'[use given note message]:message' \ - '*'{-F,--file=}'[take note message from given file]:note message file:_files' \ - '(-C --reuse-message)'{-C,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \ - '(-c --reedit-message)'{-c,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \ + '*'{-m+,--message=}'[use given note message]:message' \ + '*'{-F+,--file=}'[take note message from given file]:note message file:_files' \ + '(-C --reuse-message)'{-C+,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \ + '(-c --reedit-message)'{-c+,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \ '(-f --force)'{-f,--force}'[overwrite existing note]' \ ': :__git_commits' && ret=0 ;; @@ -1231,10 +1231,10 @@ _git-notes () { ;; (append) _arguments -w -S -s \ - '*'{-m,--message=}'[use given note message]:message' \ - '*'{-F,--file=}'[take note message from given file]:note message file:_files' \ - '(-C --reuse-message)'{-C,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \ - '(-c --reedit-message)'{-c,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \ + '*'{-m+,--message=}'[use given note message]:message' \ + '*'{-F+,--file=}'[take note message from given file]:note message file:_files' \ + '(-C --reuse-message)'{-C+,--reuse-message=}'[take note message from given blob object]: :__git_blobs' \ + '(-c --reedit-message)'{-c+,--reedit-message=}'[take note message from given blob object and edit it]: :__git_blobs' \ ': :__git_commits' && ret=0 ;; (*) @@ -1327,10 +1327,10 @@ _git-rebase () { '--keep-empty[keep empty commits in the result]' \ '(- :)--skip[skip the current patch]' \ '(-m --merge)'{-m,--merge}'[use merging strategies to rebase]' \ - '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ + '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ - '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ + '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-q,--quiet}'[suppress all output]' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-v,--verbose}'[output additional information]' \ '--no-verify[bypass the pre-rebase hook]' \ @@ -1342,7 +1342,7 @@ _git-rebase () { '(-i --interactive --ignore-whitespace --whitespace --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \ '--edit-todo[edit interactive instruction sheet in an editor]' \ '(-p --preserve-merges --interactive)'{-p,--preserve-merges}'[try to recreate merges instead of ignoring them]' \ - {-x,--exec=}'[with -i\: append "exec " after each line]:command:_command_names -e' \ + {-x+,--exec=}'[with -i\: append "exec " after each line]:command:_command_names -e' \ '(1)--root[rebase all reachable commits]' \ $autosquash_opts \ '(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \ @@ -1394,7 +1394,7 @@ _git-revert () { '(-m --mainline)'{-m+,--mainline=}'[pick which parent is mainline]:parent number' \ '(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]' \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ - '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ + '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ ': :__git_commits' } @@ -1707,7 +1707,7 @@ _git-submodule () { '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ '--cached[use commit stored in the index]' \ '--files[compare commit in index with submodule HEAD commit]' \ - '(-n --summary-limit)'{-n,--summary-limit}'[limit summary size]: :__git_guard_number "limit"' \ + '(-n --summary-limit)'{-n,--summary-limit=}'[limit summary size]: :__git_guard_number "limit"' \ '(-)--[start submodule arguments]' \ '*:: :->commit-or-submodule' && ret=0 @@ -1760,7 +1760,7 @@ _git-tag () { - creation \ '( -s -u --local-user)-a[create an unsigned, annotated tag]' \ '(-a -u --local-user)-s[create an signed and annotated tag]' \ - '(-a -s)'{-u,--local-user}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \ + '(-a -s)'{-u+,--local-user=}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \ '-f[replace existing tag]' \ '--cleanup=[cleanup message]:mode:((verbatim\:"no cleanup" whitespace\:"remove leading and trailing whitespace" strip\:"remove leading and trailing whitespace and comments"))' \ $message_opts \ -- cgit v1.2.3 From fbe2763411db0efd2e0ee36bb851842ce0f00d4a Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Thu, 14 Apr 2016 15:52:08 +0200 Subject: 37847: update du arguments up to GNU du 8.25 --- ChangeLog | 3 +++ Completion/Unix/Command/_du | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index a9b3d0afd..17a3aae11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ + * Christian Neukirchen: 37847: Completion/Unix/Command/_du: + update du arguments up to GNU du 8.25 + 2016-04-10 Barton E. Schaefer * m0viefreak: 38264: Doc/Zsh/zle.yo: improve doc for 38145 diff --git a/Completion/Unix/Command/_du b/Completion/Unix/Command/_du index 4065a20de..e812b635e 100644 --- a/Completion/Unix/Command/_du +++ b/Completion/Unix/Command/_du @@ -18,16 +18,17 @@ if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then '(-l --count-links)'{-l,--count-links}'[count sizes many times if hard linked]' \ '(-L --dereference -H -D --dereference-args -P --no-dereference)'{-L,--dereference}'[dereference all symlinks]' \ '(-S --separate-dirs)'{-S,--separate-dirs}'[do not include size of subdirectories]' \ - '(-s --summarize --max-depth -a --all)'{-s,--summarize}'[only report total for each argument]' \ + '(-s --summarize --max-depth -d -a --all)'{-s,--summarize}'[only report total for each argument]' \ '(-x --one-file-system)'{-x,--one-file-system}'[skip directories on different filesystems]' \ '(-0 --null)'{-0,--null}'[end each output line with NUL instead of newline]' \ \*{-X+,--exclude-from=}'[exclude files matching any pattern in file]:file:_files' \ '*--exclude=[exclude files matching pattern]:pattern' \ - '(-s --summarize)--max-depth=[maximum levels to recurse]:levels' \ + '(-s --summarize -d --max-depth)'{-d+,--max-depth=}'[maximum levels to recurse]:levels' \ '--files0-from=[use NUL-terminated list of files from file]:file:_files' \ '--time-style=[show times using given style, +FORMAT for strftime formatted args]:style:->timestyle' \ '--time=-[show time of last modification of any file in the directory]:property:(atime access use ctime status)' \ '(-t --threshold)'{-t+,--threshold=}'[report only entries for which size exceeds threshold]:threshold' \ + '--inodes[list inode usage information instead of block usage]' \ '(* -)--help[display help information]' \ '(* -)--version[display version information]' \ '*:file:_files' && ret=0 -- cgit v1.2.3 From 442d702bbc33adafe75ed4ca4ad8b0404eb52584 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 23 Apr 2016 20:43:17 +0000 Subject: 38316: _git-rebase: Complete any committish for the second argument --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 0710a0d82..03eba5fcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-04-23 Daniel Shahaf + + * 38316: Completion/Unix/Command/_git: _git-rebase: Complete + any committish for the second argument + 2016-04-23 m0viefreak * 38291: Doc/Zsh/zle.yo, Src/Zle/zle_params.c: Change names of diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 7ce5b2bed..3b48b4ec1 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1350,7 +1350,7 @@ _git-rebase () { '--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \ '--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \ ':upstream branch:__git_revisions' \ - '::working branch:__git_branch_names' + '::working branch:__git_revisions' } (( $+functions[_git-reset] )) || -- cgit v1.2.3 From 2979122d2d8fe6604840d209d13b8645e2ef142e Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Apr 2016 08:40:36 +0000 Subject: _git-bundle: Complete required file argument to 'git bundle' correctly. --- Completion/Unix/Command/_git | 1 + 1 file changed, 1 insertion(+) (limited to 'Completion/Unix') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 3b48b4ec1..135da9f85 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -388,6 +388,7 @@ _git-bundle () { ;; (list-heads|unbundle) _arguments \ + ':bundle:_files' \ '*: :__git_ref_specs' && ret=0 ;; esac -- cgit v1.2.3 From 3e26848ef4e1a9dfd1893dca1646086dfcad9f6d Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Apr 2016 08:53:48 +0000 Subject: _git: Offer alternatives properly. --- Completion/Unix/Command/_git | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Completion/Unix') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 135da9f85..d7b874a90 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5638,8 +5638,7 @@ __git_commits () { (( $+functions[__git_heads] )) || __git_heads () { - __git_heads_local "$@" - __git_heads_remote "$@" + _alternative 'heads-local::__git_heads_local' 'heads-remote::__git_heads_remote' } (( $+functions[__git_heads_local] )) || -- cgit v1.2.3 From c57d8dfcaa40a8bbf8c38f2a2accc1a7e8090b69 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Apr 2016 08:59:25 +0000 Subject: _git: Fix an apparent typo in __git_heads(). I couldn't reproduce different behaviour with and without this patch, although the called command's output differs. --- Completion/Unix/Command/_git | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Completion/Unix') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index d7b874a90..15829021d 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5646,7 +5646,7 @@ __git_heads_local () { local gitdir declare -a heads - heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/heads' 2>/dev/null)"}) + heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads 2>/dev/null)"}) gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) if __git_command_successful $pipestatus; then for f in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do @@ -5663,7 +5663,7 @@ __git_heads_local () { __git_heads_remote () { declare -a heads - heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/remotes' 2>/dev/null)"}) + heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/remotes 2>/dev/null)"}) __git_describe_commit heads heads-remote "remote head" "$@" } -- cgit v1.2.3 From fe21e49a6d97c0dbbb6694da00f132b8416e4b99 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Apr 2016 08:41:23 +0000 Subject: _git: Bifurcate __git_ref_specs. No functional change, except for completion of 'git bundle' and 'git config branch.*.merge'; this is a required groundwork for future patches. --- Completion/Unix/Command/_git | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'Completion/Unix') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 15829021d..37ac3e0fd 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -389,7 +389,7 @@ _git-bundle () { (list-heads|unbundle) _arguments \ ':bundle:_files' \ - '*: :__git_ref_specs' && ret=0 + '*: :__git_references' && ret=0 ;; esac ;; @@ -826,7 +826,7 @@ _git-fetch () { case $state in (repository-or-group-or-refspec) if (( CURRENT > 1 )) && [[ -z ${opt_args[(I)--multiple]} ]]; then - __git_ref_specs && ret=0 + __git_ref_specs_fetchy && ret=0 else _alternative \ 'remotes::__git_remotes' \ @@ -1262,7 +1262,7 @@ _git-pull () { '(-r --rebase )--no-rebase[do not perform a rebase after fetching]' \ $fetch_options \ ': :__git_any_repositories' \ - '*: :__git_ref_specs' + '*: :__git_ref_specs_fetchy' } (( $+functions[_git-push] )) || @@ -1296,7 +1296,7 @@ _git-push () { '--recurse-submodules=[submodule handling]:submodule handling:((check\:"refuse pushing of supermodule if submodule commit cannot be found on the remote" on-demand\:"push all changed submodules"))' \ ': :__git_any_repositories' \ - '*: :__git_ref_specs' && ret=0 + '*: :__git_ref_specs_pushy' && ret=0 case $state in (lease) @@ -1936,7 +1936,7 @@ _git-config () { branch.autosetupmerge:'set up new branches for git pull::->bool:true' branch.autosetuprebase:'rebase new branches of merge for autosetupmerge::->branch.autosetuprebase:never' 'branch.*.remote:what remote git fetch and git push should fetch form/push to::__git_remotes' - 'branch.*.merge:default refspec to be marked for merging::__git_ref_specs' + 'branch.*.merge:default refspec to be marked for merging::__git_remote_references' 'branch.*.mergeoptions:default options for merging::->branch.mergeoptions' 'branch.*.pushremote:what remote git push should push to::__git_remotes' 'branch.*.rebase:rebase on top of fetched branch::->bool:false' @@ -2236,8 +2236,8 @@ _git-config () { 'remote.*.pushurl:push URL of a remote repository::__git_any_repositories' 'remote.*.proxy:URL of proxy to use for a remote repository::_urls' 'remote.*.prune:remove any remote tracking branches that no longer exist remotely::->bool:false' - 'remote.*.fetch:default set of refspecs for git fetch::__git_ref_specs' - 'remote.*.push:default set of refspecs for git push::__git_ref_specs' + 'remote.*.fetch:default set of refspecs for git fetch::__git_ref_specs_fetchy' + 'remote.*.push:default set of refspecs for git push::__git_ref_specs_pushy' 'remote.*.mirror:push with --mirror::->bool:false' 'remote.*.skipDefaultUpdate:skip this remote by default::->bool:false' 'remote.*.skipFetchAll:skip this remote by default::->bool:false' @@ -2330,7 +2330,7 @@ _git-config () { 'svn-remote.*.rewriteUUID:remap URLs and UUIDs for mirrors manually::->bool:false' 'svn-remote.*.ignore-paths:regular expression of paths to not check out:regular expression:->string' 'svn-remote.*.url:URL to connect to::_urls' - 'svn-remote.*.fetch:fetch specification::__git_ref_specs' + 'svn-remote.*.fetch:fetch specification::__git_ref_specs_fetchy' # ### undocumented 'svn-remote.*.pushurl:URL to push to::_urls' 'svn-remote.*.branches:branch mappings:branch mapping:->string' 'svn-remote.*.tags:tag mappings:tag mapping:->string' @@ -5349,8 +5349,8 @@ __git_remotes () { _wanted remotes expl remote compadd "$@" -a - remotes } -(( $+functions[__git_ref_specs] )) || -__git_ref_specs () { +(( $+functions[__git_ref_specs_pushy] )) || +__git_ref_specs_pushy () { # TODO: This needs to deal with a lot more types of things. if compset -P '*:'; then # TODO: have the caller supply the correct remote name, restrict to refs/remotes/${that_remote}/* only @@ -5367,6 +5367,20 @@ __git_ref_specs () { fi } +(( $+functions[__git_ref_specs_fetchy] )) || +__git_ref_specs_fetchy () { + # TODO: this is wrong + __git_ref_specs_pushy "$@" +} + +(( $+functions[__git_ref_specs] )) || +__git_ref_specs () { + # Backwards compatibility: define this function to support user dotfiles that + # define custom _git-${subcommand} completions in terms of this function. + # ### We may want to warn here "use _pushy() or _fetchy()". + __git_ref_specs_pushy "$@" +} + (( $+functions[__git_color_whens] )) || __git_color_whens () { local -a whens -- cgit v1.2.3 From 276a690a2ea7f9a4cf20748c955eea4dbe2f2d02 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Apr 2016 09:10:18 +0000 Subject: _git: Complete fetchy refspecs correctly. --- Completion/Unix/Command/_git | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'Completion/Unix') diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 37ac3e0fd..d3002075f 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5369,8 +5369,19 @@ __git_ref_specs_pushy () { (( $+functions[__git_ref_specs_fetchy] )) || __git_ref_specs_fetchy () { - # TODO: this is wrong - __git_ref_specs_pushy "$@" + # TODO: This needs to deal with a lot more types of things. + if compset -P '*:'; then + __git_heads_local + else + compset -P '+' + if compset -S ':*'; then + # TODO: have the caller supply the correct remote name, restrict to refs/remotes/${that_remote}/* only + __git_remote_branch_names_noprefix + else + # TODO: have the caller supply the correct remote name, restrict to refs/remotes/${that_remote}/* only + __git_remote_branch_names_noprefix -qS : + fi + fi } (( $+functions[__git_ref_specs] )) || -- cgit v1.2.3 From 857153c507ce0fc0d0e4180aad9896a5eaefc442 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Sun, 1 May 2016 03:12:56 +0200 Subject: 38381: Add completion for picocom utility --- ChangeLog | 5 +++ Completion/Unix/Command/_picocom | 80 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 Completion/Unix/Command/_picocom (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 190646841..caebae18e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-05-01 Frank Terbeck + + * 38381: Completion/Unix/Command/_picocom: Add completion for + picocom utility + 2016-04-29 Barton E. Schaefer * unposted: Src/builtin.c: silence spurious compiler warning diff --git a/Completion/Unix/Command/_picocom b/Completion/Unix/Command/_picocom new file mode 100644 index 000000000..6653bc2a5 --- /dev/null +++ b/Completion/Unix/Command/_picocom @@ -0,0 +1,80 @@ +#compdef picocom + +# The following function uses a generated list; first find out where the B* +# macros are defined: +# +# grep -r B115200 /usr/include +# +# Then generate the actual list: +# +# sed -ne '/^[ \t]*#define[ \t]*B[0-9][0-9]*/s,^.*B\([0-9][0-9]*\).*,\1,p' \ +# < /usr/include/asm-generic/termbits.h +# +# This one was generated on a Debian Stretch system, leaving out the "0" rate, +# which is synonymous to "hang-up". +function _picocom_baudrate () { + local expl + local -a rates + rates=( 50 75 110 134 150 200 300 600 + 1200 1800 2400 4800 9600 + 19200 38400 57600 + 115200 230400 460800 500000 576000 921600 + 1000000 1152000 1500000 2000000 2500000 3000000 3500000 4000000 ) + # -1V removes dupes (which there shouldn't be) and otherwise leaves the + # order in the $rates array intact. + _wanted -1V baud-rate expl 'baud rate' compadd -a $expl -- rates +} + +function _picocom_flowcontrol () { + local expl + local -a modes + modes=( x h n ) + _wanted flow-ctrl-mode expl 'flow control mode' compadd -a $expl -- modes +} + +function _picocom_paritymode () { + local expl + local -a modes + modes=( o e n ) + _wanted parity-mode expl 'parity mode' compadd -a $expl -- modes +} + +function _picocom_databits () { + local expl + local -a widths + widths=( 5 6 7 8 ) + _wanted data-bits expl 'data bits' compadd -a $expl -- widths +} + +function _picocom_escape () { + setopt localoptions braceccl + local expl + local -a ctrlchars + ctrlchars=( {a-z} _ '?' '[' '\' ']' '@' '^' ) + _wanted escape-key expl 'escape key' compadd -a $expl -- ctrlchars +} + +function _picocom () { + local -a args + + args=( '(--baud -b)'{--baud,-b}'[define baud-rate to set the terminal to]:baud rate:_picocom_baudrate' + '(--flow -f)'{--flow,-f}'[define type of flow control to use]:flow control:_picocom_flowcontrol' + '(--parity -p)'{--parity,-p}'[define type of parity to use]:parity mode:_picocom_paritymode' + '(--databits -d)'{--databits,-d}'[define the number of databits per word]:data bits:_picocom_databits' + '(--escape -e)'{--escape,-e}'[define command mode character]:escape character:_picocom_escape' + '(--echo -c)'{--echo,-c}'[enable local echo]' + '(--noinit -i)'{--noinit,-i}'[do not initialise serial port]' + '(--noreset -r)'{--noreset,-r}'[do not reset serial port]' + '(--nolock -l)'{--nolock,-l}'[do not lock serial port]' + '(--send-cmd -s)'{--send-cmd,-s}'[define file send command]:file send command:_cmdstring' + '(--receive-cmd -v)'{--receive-cmd,-v}'[define file receive command]:file receive command:_cmdstring' + '--imap[define input character map]:input character map:' + '--omap[define output character map]:output character map:' + '--emap[define local echo character map]:local echo character map:' + '(--help -h)'{--help,-h}'[display help message]' + '*:device:_files -g "*(%c)"' ) + + _arguments -C : "${args[@]}" +} + +_picocom "$@" -- cgit v1.2.3 From 493c7e087981036ae2db67eb5b8e86db80b77917 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Sun, 1 May 2016 15:27:32 +0200 Subject: 38388: Refactor baud rate completion This adds a new helper function _baudrate and uses it in place of private solutions in various existing completions. --- ChangeLog | 7 ++++ Completion/BSD/Command/_cu | 2 +- Completion/Unix/Command/_gdb | 4 +- Completion/Unix/Command/_joe | 2 +- Completion/Unix/Command/_picocom | 27 +------------ Completion/Unix/Command/_screen | 2 +- Completion/Unix/Type/_baudrate | 84 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 96 insertions(+), 32 deletions(-) create mode 100644 Completion/Unix/Type/_baudrate (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index cdc27fabe..f0cb701ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2016-05-02 Frank Terbeck + + * 38388: Completion/BSD/Command/_cu, Completion/Unix/Command/_gdb, + Completion/Unix/Command/_joe, Completion/Unix/Command/_picocom, + Completion/Unix/Command/_screen, Completion/Unix/Type/_baudrate: + Refactor baud rate completion + 2016-05-01 Daniel Shahaf * unposted: Completion/Debian/Command/_bug: _querybts: Fix diff --git a/Completion/BSD/Command/_cu b/Completion/BSD/Command/_cu index bdd579519..4b9f25d1f 100644 --- a/Completion/BSD/Command/_cu +++ b/Completion/BSD/Command/_cu @@ -3,5 +3,5 @@ _arguments -s -A '-*' \ '-d[do not block waiting for a carrier to be detected]' \ '-l[line to use]:line:(/dev/(cuaU#<->|ttyS<->)(N%c))' \ - '-s[line speed]:line speed:(75 110 300 1200 2400 4800 9600 19200 38400 57600 115200)' \ + '-s[line speed]:line speed:_baudrate -d "line speed"' \ '(-*)1:host:' diff --git a/Completion/Unix/Command/_gdb b/Completion/Unix/Command/_gdb index e9c333925..d5eed5ae4 100644 --- a/Completion/Unix/Command/_gdb +++ b/Completion/Unix/Command/_gdb @@ -37,9 +37,7 @@ else (-[csx]) _files && return 0 ;; (-e) _description files expl executable _files "$expl[@]" -g '*(-*)' && return 0 ;; - (-b) _wanted -V values expl 'baud rate' \ - compadd 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 \ - 9600 19200 38400 57600 115200 230400 && return 0 ;; + (-b) _baudrate && return 0 ;; esac w=( "${(@)words[2,-1]}" ) diff --git a/Completion/Unix/Command/_joe b/Completion/Unix/Command/_joe index 96ad0a4f1..91c437ead 100644 --- a/Completion/Unix/Command/_joe +++ b/Completion/Unix/Command/_joe @@ -3,7 +3,7 @@ _arguments \ '-asis[characters with codes >127 will be displayed non-inverted]' \ '-backpath[backup file directory]:backup file directory:_files -/' \ - '-baud[inserts delays for baud rates below 19200]:baud rate:(57600 38400 19200 9600 4800 2400 1200 300)' \ + '-baud[inserts delays for baud rates below 19200]:baud rate:_baudrate' \ '-beep[beep on command errors or when cursor goes past extremes]' \ '-columns[sets the number of screen columns]:num of columns' \ '-csmode[continued search mode]' \ diff --git a/Completion/Unix/Command/_picocom b/Completion/Unix/Command/_picocom index 6653bc2a5..c9d3be0e0 100644 --- a/Completion/Unix/Command/_picocom +++ b/Completion/Unix/Command/_picocom @@ -1,30 +1,5 @@ #compdef picocom -# The following function uses a generated list; first find out where the B* -# macros are defined: -# -# grep -r B115200 /usr/include -# -# Then generate the actual list: -# -# sed -ne '/^[ \t]*#define[ \t]*B[0-9][0-9]*/s,^.*B\([0-9][0-9]*\).*,\1,p' \ -# < /usr/include/asm-generic/termbits.h -# -# This one was generated on a Debian Stretch system, leaving out the "0" rate, -# which is synonymous to "hang-up". -function _picocom_baudrate () { - local expl - local -a rates - rates=( 50 75 110 134 150 200 300 600 - 1200 1800 2400 4800 9600 - 19200 38400 57600 - 115200 230400 460800 500000 576000 921600 - 1000000 1152000 1500000 2000000 2500000 3000000 3500000 4000000 ) - # -1V removes dupes (which there shouldn't be) and otherwise leaves the - # order in the $rates array intact. - _wanted -1V baud-rate expl 'baud rate' compadd -a $expl -- rates -} - function _picocom_flowcontrol () { local expl local -a modes @@ -57,7 +32,7 @@ function _picocom_escape () { function _picocom () { local -a args - args=( '(--baud -b)'{--baud,-b}'[define baud-rate to set the terminal to]:baud rate:_picocom_baudrate' + args=( '(--baud -b)'{--baud,-b}'[define baud-rate to set the terminal to]:baud rate:_baudrate' '(--flow -f)'{--flow,-f}'[define type of flow control to use]:flow control:_picocom_flowcontrol' '(--parity -p)'{--parity,-p}'[define type of parity to use]:parity mode:_picocom_paritymode' '(--databits -d)'{--databits,-d}'[define the number of databits per word]:data bits:_picocom_databits' diff --git a/Completion/Unix/Command/_screen b/Completion/Unix/Command/_screen index 510fd7195..f4d2ef943 100644 --- a/Completion/Unix/Command/_screen +++ b/Completion/Unix/Command/_screen @@ -99,7 +99,7 @@ if [[ -n $state ]]; then if (( CURRENT == 1 )) && [[ $PREFIX == /dev/* ]]; then _path_files -g '*(%)' elif (( CURRENT == 2 )) && [[ ${words[1]} == /dev/* ]]; then - _message "baud rate" + _baudrate elif (( CURRENT > 2 )) && [[ ${words[1]} == /dev/* ]]; then _message "no more parameters" else diff --git a/Completion/Unix/Type/_baudrate b/Completion/Unix/Type/_baudrate new file mode 100644 index 000000000..c16928444 --- /dev/null +++ b/Completion/Unix/Type/_baudrate @@ -0,0 +1,84 @@ +#autoload + +# Offer a list of baud-rates. Usage: +# +# _baudrate [OPTION(s)...] +# +# Available options: +# +# -u LIMIT Upper limit. LIMIT is the maximum value the offered list +# will contain, if the complete list includes LIMIT exactly. +# +# -l LIMIT Lower limit. Like -u but for the lower boundary. +# +# -f FUNCTION If given FUNCION is used as a predicate to filter the +# value in the complete list to generate an arbitrary +# sub-set. +# +# -t TAG Use TAG as the tag value in _wanted call. +# +# -d DESC Use DESC as the description value in _wanted call. +# +# The default complete list of available baud rates is also configurable via +# the 'baud-rates' style: +# +# zstyle ':completion:*' baud-rates 23 42 666 +# +# It is also possible to override the arguments to -f, -u and -l via styles in +# a similar fashion: +# +# zstyle ':completion:*:*:screen:*' max-baud-rate 9600 +# zstyle ':completion:*:*:screen:*' min-baud-rate 1200 +# zstyle ':completion:*:*:screen:*' baud-rate-filter some_function_name + +local -A opts +local expl tag desc tmp +local -a rates + +zparseopts -E -A opts u: l: f: d: t: + +# The following uses a generated list; first find out where the B* macros are +# defined: +# +# grep -r B115200 /usr/include +# +# Then generate the actual list: +# +# sed -ne '/^[ \t]*#define[ \t]*B[0-9][0-9]*/s,^.*B\([0-9][0-9]*\).*,\1,p' \ +# < /usr/include/asm-generic/termbits.h +# +# This one was generated on a Debian Stretch system, leaving out the "0" rate, +# which is synonymous to "hang-up". + +zstyle -a ":completion:${curcontext}:" baud-rates rates || + rates=( 50 75 110 134 150 200 300 600 + 1200 1800 2400 4800 9600 + 19200 38400 57600 + 115200 230400 460800 500000 576000 921600 + 1000000 1152000 1500000 2000000 2500000 3000000 3500000 4000000 ) + +zstyle -s ":completion:${curcontext}:" max-baud-rate tmp && opts[-u]=$tmp +zstyle -s ":completion:${curcontext}:" min-baud-rate tmp && opts[-l]=$tmp +zstyle -s ":completion:${curcontext}:" baud-rate-filter tmp && opts[-f]=$tmp + +if (( ${+opts[-u]} )) || (( ${+opts[-l]} )); then + local -i min max + min=${opts[-l]:-0} + max=${opts[-u]:-${${(On)rates}[1]}} + rates=( ${(M)rates:#${~:-<$min-$max>}} ) +fi + +if (( ${+opts[-f]} )); then + set -- $rates + rates=( ) + for item; do + ${opts[-f]} $item && rates+=( $item ) + done +fi + +tag=${opts[-t]:-baud-rate} +desc=${opts[-d]:-baud rate} + +# -1V removes dupes (which there shouldn't be) and otherwise leaves the +# order in the $rates array intact. +_wanted -1V $tag expl $desc compadd -a $expl -- rates -- cgit v1.2.3 From 058d957ce53d98252ee7ca138b020a461d56a3f3 Mon Sep 17 00:00:00 2001 From: Russell Currey Date: Tue, 3 May 2016 16:41:24 +1000 Subject: 38393: _git: Fix typo in completion of '--minimal' Signed-off-by: Russell Currey --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index d2f0e23ca..48e10582f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-05-03 Russell Currey + + * 38393: Completion/Unix/Command/_git: Fix typo in completion of + '--minimal' + 2016-05-02 Barton E. Schaefer * 38375 (tweaked per 38384): Test/C02cond.ztst: try harder to diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index d3002075f..2fa004a5e 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6320,7 +6320,7 @@ __git_setup_diff_options () { $diff_types'--raw[generate default raw diff output]' $diff_types'--patch-with-raw[generate patch but also keep the default raw diff output]' $diff_types{-s,--no-patch}'[suppress diff output]' - '(--minimal --patience --histogram --diff-algorithm)--minimal[spend extra time to make sure the smallest possible diff is producedm]' + '(--minimal --patience --histogram --diff-algorithm)--minimal[spend extra time to make sure the smallest possible diff is produced]' '(--minimal --patience --histogram --diff-algorithm)--patience[generate diffs with patience algorithm]' '(--minimal --patience --histogram --diff-algorithm)--histogram[generate diffs with histogram algorithm]' '(--minimal --patience --histogram --diff-algorithm)--diff-algorithm=[choose a diff algorithm]:diff algorithm:((default\:"basic greedy diff algorithm" -- cgit v1.2.3 From afff99dbb5e721ac51c42610f06054389c8a3556 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Sun, 8 May 2016 00:09:11 +0200 Subject: 38422: _baudrate -> _baudrates Oliver notes that helper functions usually have plural names by convention. --- ChangeLog | 5 +++ Completion/Unix/Type/_baudrate | 84 ----------------------------------------- Completion/Unix/Type/_baudrates | 84 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 84 deletions(-) delete mode 100644 Completion/Unix/Type/_baudrate create mode 100644 Completion/Unix/Type/_baudrates (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 4355fd360..da833f6f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-05-09 Frank Terbeck + + * 38422: Completion/Unix/Type/_baudrate, + Completion/Unix/Type/_baudrates: _baudrate -> _baudrates + 2016-05-06 Daniel Shahaf * 38401: Completion/Debian/Type/_deb_packages: New completion diff --git a/Completion/Unix/Type/_baudrate b/Completion/Unix/Type/_baudrate deleted file mode 100644 index c16928444..000000000 --- a/Completion/Unix/Type/_baudrate +++ /dev/null @@ -1,84 +0,0 @@ -#autoload - -# Offer a list of baud-rates. Usage: -# -# _baudrate [OPTION(s)...] -# -# Available options: -# -# -u LIMIT Upper limit. LIMIT is the maximum value the offered list -# will contain, if the complete list includes LIMIT exactly. -# -# -l LIMIT Lower limit. Like -u but for the lower boundary. -# -# -f FUNCTION If given FUNCION is used as a predicate to filter the -# value in the complete list to generate an arbitrary -# sub-set. -# -# -t TAG Use TAG as the tag value in _wanted call. -# -# -d DESC Use DESC as the description value in _wanted call. -# -# The default complete list of available baud rates is also configurable via -# the 'baud-rates' style: -# -# zstyle ':completion:*' baud-rates 23 42 666 -# -# It is also possible to override the arguments to -f, -u and -l via styles in -# a similar fashion: -# -# zstyle ':completion:*:*:screen:*' max-baud-rate 9600 -# zstyle ':completion:*:*:screen:*' min-baud-rate 1200 -# zstyle ':completion:*:*:screen:*' baud-rate-filter some_function_name - -local -A opts -local expl tag desc tmp -local -a rates - -zparseopts -E -A opts u: l: f: d: t: - -# The following uses a generated list; first find out where the B* macros are -# defined: -# -# grep -r B115200 /usr/include -# -# Then generate the actual list: -# -# sed -ne '/^[ \t]*#define[ \t]*B[0-9][0-9]*/s,^.*B\([0-9][0-9]*\).*,\1,p' \ -# < /usr/include/asm-generic/termbits.h -# -# This one was generated on a Debian Stretch system, leaving out the "0" rate, -# which is synonymous to "hang-up". - -zstyle -a ":completion:${curcontext}:" baud-rates rates || - rates=( 50 75 110 134 150 200 300 600 - 1200 1800 2400 4800 9600 - 19200 38400 57600 - 115200 230400 460800 500000 576000 921600 - 1000000 1152000 1500000 2000000 2500000 3000000 3500000 4000000 ) - -zstyle -s ":completion:${curcontext}:" max-baud-rate tmp && opts[-u]=$tmp -zstyle -s ":completion:${curcontext}:" min-baud-rate tmp && opts[-l]=$tmp -zstyle -s ":completion:${curcontext}:" baud-rate-filter tmp && opts[-f]=$tmp - -if (( ${+opts[-u]} )) || (( ${+opts[-l]} )); then - local -i min max - min=${opts[-l]:-0} - max=${opts[-u]:-${${(On)rates}[1]}} - rates=( ${(M)rates:#${~:-<$min-$max>}} ) -fi - -if (( ${+opts[-f]} )); then - set -- $rates - rates=( ) - for item; do - ${opts[-f]} $item && rates+=( $item ) - done -fi - -tag=${opts[-t]:-baud-rate} -desc=${opts[-d]:-baud rate} - -# -1V removes dupes (which there shouldn't be) and otherwise leaves the -# order in the $rates array intact. -_wanted -1V $tag expl $desc compadd -a $expl -- rates diff --git a/Completion/Unix/Type/_baudrates b/Completion/Unix/Type/_baudrates new file mode 100644 index 000000000..9e87e7a38 --- /dev/null +++ b/Completion/Unix/Type/_baudrates @@ -0,0 +1,84 @@ +#autoload + +# Offer a list of baud-rates. Usage: +# +# _baudrates [OPTION(s)...] +# +# Available options: +# +# -u LIMIT Upper limit. LIMIT is the maximum value the offered list +# will contain, if the complete list includes LIMIT exactly. +# +# -l LIMIT Lower limit. Like -u but for the lower boundary. +# +# -f FUNCTION If given FUNCION is used as a predicate to filter the +# value in the complete list to generate an arbitrary +# sub-set. +# +# -t TAG Use TAG as the tag value in _wanted call. +# +# -d DESC Use DESC as the description value in _wanted call. +# +# The default complete list of available baud rates is also configurable via +# the 'baud-rates' style: +# +# zstyle ':completion:*' baud-rates 23 42 666 +# +# It is also possible to override the arguments to -f, -u and -l via styles in +# a similar fashion: +# +# zstyle ':completion:*:*:screen:*' max-baud-rate 9600 +# zstyle ':completion:*:*:screen:*' min-baud-rate 1200 +# zstyle ':completion:*:*:screen:*' baud-rate-filter some_function_name + +local -A opts +local expl tag desc tmp +local -a rates + +zparseopts -E -A opts u: l: f: d: t: + +# The following uses a generated list; first find out where the B* macros are +# defined: +# +# grep -r B115200 /usr/include +# +# Then generate the actual list: +# +# sed -ne '/^[ \t]*#define[ \t]*B[0-9][0-9]*/s,^.*B\([0-9][0-9]*\).*,\1,p' \ +# < /usr/include/asm-generic/termbits.h +# +# This one was generated on a Debian Stretch system, leaving out the "0" rate, +# which is synonymous to "hang-up". + +zstyle -a ":completion:${curcontext}:" baud-rates rates || + rates=( 50 75 110 134 150 200 300 600 + 1200 1800 2400 4800 9600 + 19200 38400 57600 + 115200 230400 460800 500000 576000 921600 + 1000000 1152000 1500000 2000000 2500000 3000000 3500000 4000000 ) + +zstyle -s ":completion:${curcontext}:" max-baud-rate tmp && opts[-u]=$tmp +zstyle -s ":completion:${curcontext}:" min-baud-rate tmp && opts[-l]=$tmp +zstyle -s ":completion:${curcontext}:" baud-rate-filter tmp && opts[-f]=$tmp + +if (( ${+opts[-u]} )) || (( ${+opts[-l]} )); then + local -i min max + min=${opts[-l]:-0} + max=${opts[-u]:-${${(On)rates}[1]}} + rates=( ${(M)rates:#${~:-<$min-$max>}} ) +fi + +if (( ${+opts[-f]} )); then + set -- $rates + rates=( ) + for item; do + ${opts[-f]} $item && rates+=( $item ) + done +fi + +tag=${opts[-t]:-baud-rate} +desc=${opts[-d]:-baud rate} + +# -1V removes dupes (which there shouldn't be) and otherwise leaves the +# order in the $rates array intact. +_wanted -1V $tag expl $desc compadd -a $expl -- rates -- cgit v1.2.3 From 32b5cd9445ebc8e0425a3db07de7fd3dc6381328 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Sun, 8 May 2016 00:09:12 +0200 Subject: 38426: _baudrates: Use 2 space indentation As per the completion-style-guide. --- ChangeLog | 3 +++ Completion/Unix/Type/_baudrates | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index da833f6f4..953c9aa71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * 38422: Completion/Unix/Type/_baudrate, Completion/Unix/Type/_baudrates: _baudrate -> _baudrates + * 38426: Completion/Unix/Type/_baudrates: _baudrates: Use 2 space + indentation + 2016-05-06 Daniel Shahaf * 38401: Completion/Debian/Type/_deb_packages: New completion diff --git a/Completion/Unix/Type/_baudrates b/Completion/Unix/Type/_baudrates index 9e87e7a38..35e55ad09 100644 --- a/Completion/Unix/Type/_baudrates +++ b/Completion/Unix/Type/_baudrates @@ -51,29 +51,29 @@ zparseopts -E -A opts u: l: f: d: t: # which is synonymous to "hang-up". zstyle -a ":completion:${curcontext}:" baud-rates rates || - rates=( 50 75 110 134 150 200 300 600 - 1200 1800 2400 4800 9600 - 19200 38400 57600 - 115200 230400 460800 500000 576000 921600 - 1000000 1152000 1500000 2000000 2500000 3000000 3500000 4000000 ) + rates=( 50 75 110 134 150 200 300 600 + 1200 1800 2400 4800 9600 + 19200 38400 57600 + 115200 230400 460800 500000 576000 921600 + 1000000 1152000 1500000 2000000 2500000 3000000 3500000 4000000 ) zstyle -s ":completion:${curcontext}:" max-baud-rate tmp && opts[-u]=$tmp zstyle -s ":completion:${curcontext}:" min-baud-rate tmp && opts[-l]=$tmp zstyle -s ":completion:${curcontext}:" baud-rate-filter tmp && opts[-f]=$tmp if (( ${+opts[-u]} )) || (( ${+opts[-l]} )); then - local -i min max - min=${opts[-l]:-0} - max=${opts[-u]:-${${(On)rates}[1]}} - rates=( ${(M)rates:#${~:-<$min-$max>}} ) + local -i min max + min=${opts[-l]:-0} + max=${opts[-u]:-${${(On)rates}[1]}} + rates=( ${(M)rates:#${~:-<$min-$max>}} ) fi if (( ${+opts[-f]} )); then - set -- $rates - rates=( ) - for item; do - ${opts[-f]} $item && rates+=( $item ) - done + set -- $rates + rates=( ) + for item; do + ${opts[-f]} $item && rates+=( $item ) + done fi tag=${opts[-t]:-baud-rate} -- cgit v1.2.3 From 795b285ce8b8e8baf26272f2c7c459334bca5f9d Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Sun, 8 May 2016 00:09:13 +0200 Subject: 38424: Use _baudrates helper instead of _baudrate --- ChangeLog | 5 +++++ Completion/BSD/Command/_cu | 2 +- Completion/Unix/Command/_gdb | 2 +- Completion/Unix/Command/_joe | 2 +- Completion/Unix/Command/_picocom | 2 +- Completion/Unix/Command/_screen | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 953c9aa71..e858623e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,11 @@ * 38426: Completion/Unix/Type/_baudrates: _baudrates: Use 2 space indentation + * 38424: Completion/BSD/Command/_cu, Completion/Unix/Command/_gdb, + Completion/Unix/Command/_joe, Completion/Unix/Command/_picocom, + Completion/Unix/Command/_screen: Use _baudrates helper instead of + _baudrate + 2016-05-06 Daniel Shahaf * 38401: Completion/Debian/Type/_deb_packages: New completion diff --git a/Completion/BSD/Command/_cu b/Completion/BSD/Command/_cu index 4b9f25d1f..ec7950125 100644 --- a/Completion/BSD/Command/_cu +++ b/Completion/BSD/Command/_cu @@ -3,5 +3,5 @@ _arguments -s -A '-*' \ '-d[do not block waiting for a carrier to be detected]' \ '-l[line to use]:line:(/dev/(cuaU#<->|ttyS<->)(N%c))' \ - '-s[line speed]:line speed:_baudrate -d "line speed"' \ + '-s[line speed]:line speed:_baudrates -d "line speed"' \ '(-*)1:host:' diff --git a/Completion/Unix/Command/_gdb b/Completion/Unix/Command/_gdb index d5eed5ae4..510e6f1fa 100644 --- a/Completion/Unix/Command/_gdb +++ b/Completion/Unix/Command/_gdb @@ -37,7 +37,7 @@ else (-[csx]) _files && return 0 ;; (-e) _description files expl executable _files "$expl[@]" -g '*(-*)' && return 0 ;; - (-b) _baudrate && return 0 ;; + (-b) _baudrates && return 0 ;; esac w=( "${(@)words[2,-1]}" ) diff --git a/Completion/Unix/Command/_joe b/Completion/Unix/Command/_joe index 91c437ead..592c34a10 100644 --- a/Completion/Unix/Command/_joe +++ b/Completion/Unix/Command/_joe @@ -3,7 +3,7 @@ _arguments \ '-asis[characters with codes >127 will be displayed non-inverted]' \ '-backpath[backup file directory]:backup file directory:_files -/' \ - '-baud[inserts delays for baud rates below 19200]:baud rate:_baudrate' \ + '-baud[inserts delays for baud rates below 19200]:baud rate:_baudrates' \ '-beep[beep on command errors or when cursor goes past extremes]' \ '-columns[sets the number of screen columns]:num of columns' \ '-csmode[continued search mode]' \ diff --git a/Completion/Unix/Command/_picocom b/Completion/Unix/Command/_picocom index c9d3be0e0..4b8b3ea2e 100644 --- a/Completion/Unix/Command/_picocom +++ b/Completion/Unix/Command/_picocom @@ -32,7 +32,7 @@ function _picocom_escape () { function _picocom () { local -a args - args=( '(--baud -b)'{--baud,-b}'[define baud-rate to set the terminal to]:baud rate:_baudrate' + args=( '(--baud -b)'{--baud,-b}'[define baud-rate to set the terminal to]:baud rate:_baudrates' '(--flow -f)'{--flow,-f}'[define type of flow control to use]:flow control:_picocom_flowcontrol' '(--parity -p)'{--parity,-p}'[define type of parity to use]:parity mode:_picocom_paritymode' '(--databits -d)'{--databits,-d}'[define the number of databits per word]:data bits:_picocom_databits' diff --git a/Completion/Unix/Command/_screen b/Completion/Unix/Command/_screen index f4d2ef943..ebc8ba155 100644 --- a/Completion/Unix/Command/_screen +++ b/Completion/Unix/Command/_screen @@ -99,7 +99,7 @@ if [[ -n $state ]]; then if (( CURRENT == 1 )) && [[ $PREFIX == /dev/* ]]; then _path_files -g '*(%)' elif (( CURRENT == 2 )) && [[ ${words[1]} == /dev/* ]]; then - _baudrate + _baudrates elif (( CURRENT > 2 )) && [[ ${words[1]} == /dev/* ]]; then _message "no more parameters" else -- cgit v1.2.3 From 6f3fbcc67ab8f5799b4776aebd0525cf580cbd1f Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Sun, 8 May 2016 00:09:14 +0200 Subject: 38421: _baudrates: Fit better into the general completion framework This should work better in concert with other helpers and builtins of the completion system by accepting arguments that would be handed to compadd. --- ChangeLog | 3 +++ Completion/Unix/Type/_baudrates | 16 +++++----------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index e858623e7..753a04267 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,9 @@ Completion/Unix/Command/_screen: Use _baudrates helper instead of _baudrate + * 38421: Completion/Unix/Type/_baudrates: _baudrates: Fit better + into the general completion framework + 2016-05-06 Daniel Shahaf * 38401: Completion/Debian/Type/_deb_packages: New completion diff --git a/Completion/Unix/Type/_baudrates b/Completion/Unix/Type/_baudrates index 35e55ad09..d0ba1650a 100644 --- a/Completion/Unix/Type/_baudrates +++ b/Completion/Unix/Type/_baudrates @@ -15,10 +15,6 @@ # value in the complete list to generate an arbitrary # sub-set. # -# -t TAG Use TAG as the tag value in _wanted call. -# -# -d DESC Use DESC as the description value in _wanted call. -# # The default complete list of available baud rates is also configurable via # the 'baud-rates' style: # @@ -31,11 +27,11 @@ # zstyle ':completion:*:*:screen:*' min-baud-rate 1200 # zstyle ':completion:*:*:screen:*' baud-rate-filter some_function_name +local tmp +local -a expl rates local -A opts -local expl tag desc tmp -local -a rates -zparseopts -E -A opts u: l: f: d: t: +zparseopts -E -A opts u: l: f: # The following uses a generated list; first find out where the B* macros are # defined: @@ -76,9 +72,7 @@ if (( ${+opts[-f]} )); then done fi -tag=${opts[-t]:-baud-rate} -desc=${opts[-d]:-baud rate} - # -1V removes dupes (which there shouldn't be) and otherwise leaves the # order in the $rates array intact. -_wanted -1V $tag expl $desc compadd -a $expl -- rates +_description -1V baud-rates expl 'baud rate' +compadd "${(@)argv/#-J/-V}" "$expl[@]" -- "${rates[@]}" -- cgit v1.2.3 From 05e37bd994a04874215c5e02bbfd43599c512c63 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Sun, 8 May 2016 00:09:16 +0200 Subject: 38420: _baudrates: Make style lookups fit better with the rest of compsys To quote Oliver Kiddle: > The original concept with styles was that style's could have fairly > generic names because the context allows you to select the detailed > context. So perhaps consider allowing this to work as, for example: > zstyle ':completion:*:*:screen:*:baud-rates' max-value 9600 --- ChangeLog | 3 +++ Completion/Unix/Type/_baudrates | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index d65826878..9ddab6da6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,9 @@ * 38425: Completion/BSD/Command/_cu: _cu: Remove old -d option of _baudrates + * 38420: Completion/Unix/Type/_baudrates: _baudrates: Make style + lookups fit better with the rest of compsys + 2016-05-06 Daniel Shahaf * 38401: Completion/Debian/Type/_deb_packages: New completion diff --git a/Completion/Unix/Type/_baudrates b/Completion/Unix/Type/_baudrates index d0ba1650a..add359d13 100644 --- a/Completion/Unix/Type/_baudrates +++ b/Completion/Unix/Type/_baudrates @@ -23,9 +23,9 @@ # It is also possible to override the arguments to -f, -u and -l via styles in # a similar fashion: # -# zstyle ':completion:*:*:screen:*' max-baud-rate 9600 -# zstyle ':completion:*:*:screen:*' min-baud-rate 1200 -# zstyle ':completion:*:*:screen:*' baud-rate-filter some_function_name +# zstyle ':completion:*:*:screen:*:baud-rates' max-value 9600 +# zstyle ':completion:*:*:screen:*:baud-rates' min-value 1200 +# zstyle ':completion:*:*:screen:*:baud-rates' filter some_function_name local tmp local -a expl rates @@ -53,9 +53,9 @@ zstyle -a ":completion:${curcontext}:" baud-rates rates || 115200 230400 460800 500000 576000 921600 1000000 1152000 1500000 2000000 2500000 3000000 3500000 4000000 ) -zstyle -s ":completion:${curcontext}:" max-baud-rate tmp && opts[-u]=$tmp -zstyle -s ":completion:${curcontext}:" min-baud-rate tmp && opts[-l]=$tmp -zstyle -s ":completion:${curcontext}:" baud-rate-filter tmp && opts[-f]=$tmp +zstyle -s ":completion:${curcontext}:baud-rates" max-value tmp && opts[-u]=$tmp +zstyle -s ":completion:${curcontext}:baud-rates" min-value tmp && opts[-l]=$tmp +zstyle -s ":completion:${curcontext}:baud-rates" filter tmp && opts[-f]=$tmp if (( ${+opts[-u]} )) || (( ${+opts[-l]} )); then local -i min max -- cgit v1.2.3 From 023e7e463f572a4cd294985c119d9e81ea70dee8 Mon Sep 17 00:00:00 2001 From: Marko Myllynen Date: Wed, 1 Jun 2016 23:32:12 -0400 Subject: 38567, 38440: Marko Myllynen: completion for locale(1) and iconvconfig(8) --- ChangeLog | 7 +++ Completion/Linux/Command/_iconvconfig | 13 ++++++ Completion/Unix/Command/_locale | 84 +++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 Completion/Linux/Command/_iconvconfig create mode 100644 Completion/Unix/Command/_locale (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 59a2375d1..81afaa4d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2016-06-02 Eric Cook + * 38567: Marko Myllynen: Completion/Unix/Command/_locale: + completion for locale(1) + + * 38440: Marko Myllynen: Completion/Linux/Command/_iconvconfig: + completion for linux's iconvconfig(8) + 2016-06-02 Oliver Kiddle * 38540: Src/Zle/zle_utils.c: fix undo problem by not moving diff --git a/Completion/Linux/Command/_iconvconfig b/Completion/Linux/Command/_iconvconfig new file mode 100644 index 000000000..5afb10a38 --- /dev/null +++ b/Completion/Linux/Command/_iconvconfig @@ -0,0 +1,13 @@ +#compdef iconvconfig + +local exargs="-? --help --usage -V --version" + +_arguments -S -s \ + "($exargs)--nostdlib[do not search system directory]" \ + "(-o --output= $exargs)"{-o+,--output=}'[specify output file]:output file:_files' \ + "($exargs)--prefix=[specify system dir prefix]:prefix:_files" \ + '(- *)'{-\?,--help}'[display help information]' \ + '(- *)--usage[display a short usage message]' \ + '(- *)'{-V,--version}'[print program version]' \ + '*:directory:_files -/' \ + && return 0 diff --git a/Completion/Unix/Command/_locale b/Completion/Unix/Command/_locale new file mode 100644 index 000000000..59e04a282 --- /dev/null +++ b/Completion/Unix/Command/_locale @@ -0,0 +1,84 @@ +#compdef locale + +local curcontext="$curcontext" state state_descr line expl ret=1 +typeset -A opt_args; local -a specs aopts + +if _pick_variant gnu='(GNU|EGLIBC)' unix --version; then + + local exargs="-? --help --usage -V --version" + + aopts=( -A "-*" -C -S -s ) + specs=( + '(- *)'{-\?,--help}'[display help information]' + '(- *)--usage[display a short usage message]' + '(- *)'{-V,--version}'[print program version]' + - set1 + "(-a --all-locales $exargs)"{-a,--all-locales}'[list all available locales]' + "(-v --verbose $exargs)"{-v,--verbose}'[display additional information]' + - set2 + "(-m --charmaps $exargs)"{-m,--charmaps}'[list all available charmaps]' + - set3 + "(-c --category-name $exargs)"{-c,--category-name}'[print also locale category]' + "(-k --keyword-name $exargs)"{-k,--keyword-name}'[print also keyword of each value]' + '*:name:->catkey' + ) + +elif [[ $OSTYPE == openbsd* ]]; then + + specs=( + '(-m)-a[list all available locales]' + '(-a)-m[list all available charmaps]' + ) + +else + + aopts=( -C -A "-*" ) + specs=( + - set1 + '-a[list all available locales]' + - set2 + '-m[list all available charmaps]' + - set3 + '-c[print also locale category]' + '-k[print also keyword of each value]' + '*:name:->catkey' + ) +fi + +_arguments $aopts : $specs && ret=0 + +if [[ $state == catkey ]]; then + typeset -aU cats keys + + case $OSTYPE in + *bsd*) + # keywords from comparing locale -k list on netbsd and freebsd + # the additional keywords freebsd supports will be added via + # the reassignment of keys + keys+=( + charmap decimal_point thousands_sep grouping radixchar thousep int_curr_symbol + currency_symbol mon_decimal_point mon_thousands_sep mon_grouping positive_sign + negative_sign int_frac_digits frac_digits p_cs_precedes p_sep_by_space n_cs_precedes + n_sep_by_space p_sign_posn n_sign_posn int_p_cs_precedes int_p_sep_by_space + int_n_cs_precedes int_n_sep_by_space int_p_sign_posn int_n_sign_posn d_t_fmt d_fmt + t_fmt am_str pm_str t_fmt_ampm day_1 day_2 day_3 day_4 day_5 day_6 day_7 abday_1 + abday_2 abday_3 abday_4 abday_5 abday_6 abday_7 mon_1 mon_2 mon_3 mon_4 mon_5 mon_6 + mon_7 mon_8 mon_9 mon_10 mon_11 mon_12 abmon_1 abmon_2 abmon_3 abmon_4 abmon_5 + abmon_6 abmon_7 abmon_8 abmon_9 abmon_10 abmon_11 abmon_12 era era_d_fmt era_d_t_fmt + era_t_fmt alt_digits yesexpr noexpr yesstr nostr + );| + (free|net|dragonfly)bsd*) (( words[(I)-k] )) && keys+=(list);; + *) + cats=( ${${${(f)"$(locale)"}%=*}%(LANG|LANGUAGE|LC_ALL)} ) + ;; + esac + + keys=( $keys ${${(f)"$(locale -k $cats 2>/dev/null)"}%=*} ) + if [[ $OSTYPE == freebsd* ]] && (( words[(I)list] )); then + _message -e values prefix && ret=0 + else + _wanted values expl name compadd "$@" -a - cats keys && ret=0 + fi +fi + +return ret -- cgit v1.2.3 From 713eaa055d3914a06b71fe39581486c5b2bef60a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 2 Jun 2016 13:29:09 +0000 Subject: 38576: _git: Also detect _git-${thirdparty} functions in $fpath that are symlinks. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 5d679dacc..7572a06b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-06-03 Daniel Shahaf + + * 38576: Completion/Unix/Command/_git: Also detect + _git-${thirdparty} functions in $fpath that are symlinks. + 2016-06-02 Eric Cook * 38567: Marko Myllynen: Completion/Unix/Command/_locale: diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 2fa004a5e..1dca28802 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -7022,7 +7022,7 @@ declare -gUa _git_third_party_commands _git_third_party_commands=() local file -for file in ${^fpath}/_git-*~(*~|*.zwc)(.N); do +for file in ${^fpath}/_git-*~(*~|*.zwc)(-.N); do local name=${${file:t}#_git-} if (( $+_git_third_party_commands[$name] )); then continue -- cgit v1.2.3 From f84a5da8c211ca1ee4cc2c656cfae79a598562cb Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 2 Jun 2016 13:29:15 +0000 Subject: 38577: _signals: Don't complete SIGEXIT from _kill. --- ChangeLog | 3 +++ Completion/Unix/Type/_signals | 13 ++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 7572a06b7..ed3610df2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-06-03 Daniel Shahaf + * 38577: Completion/Unix/Type/_signals: Don't complete SIGEXIT + from _kill. + * 38576: Completion/Unix/Command/_git: Also detect _git-${thirdparty} functions in $fpath that are symlinks. diff --git a/Completion/Unix/Type/_signals b/Completion/Unix/Type/_signals index 104efd4f4..df9a2f339 100644 --- a/Completion/Unix/Type/_signals +++ b/Completion/Unix/Type/_signals @@ -8,12 +8,15 @@ # # A `-' or `--' as the first argument is ignored. -local expl last minus pre sigs +local expl minus pre sigs +local first last # keep these as strings for -z/-n tests zparseopts -D -K -E 'p=minus' 'a=last' 's=pre' if [[ -z "$last" ]]; then + first=2 last=-3 else + first=1 last=-1 fi [[ -n "$minus" ]] && minus='-' @@ -26,20 +29,20 @@ if [[ -z "$minus" ]] || local disp tmp if zstyle -t ":completion:${curcontext}:signals" prefix-hidden; then - tmp=( "${(@)signals[1,last]}" ) + tmp=( "${(@)signals[first,last]}" ) disp=(-d tmp) else disp=() fi if [[ -n "$pre" && $PREFIX = ${minus}S* ]]; then - sigs=( "${minus}SIG${(@)^signals[1,last]}" ) - (( $#disp )) && tmp=( "$tmp[@]" "${(@)signals[1,last]}" ) + sigs=( "${minus}SIG${(@)^signals[first,last]}" ) + (( $#disp )) && tmp=( "$tmp[@]" "${(@)signals[first,last]}" ) else sigs=() fi _wanted signals expl signal \ compadd "$@" "$disp[@]" -M 'm:{a-z}={A-Z}' - \ - "${minus}${(@)^signals[1,last]}" "$sigs[@]" + "${minus}${(@)^signals[first,last]}" "$sigs[@]" fi -- cgit v1.2.3 From 9c7f298447bc225666f9baa957ce933f5493d437 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Fri, 3 Jun 2016 15:57:41 -0700 Subject: users/21609: do not treat tilde-expansions as quoted when inside command substitutions --- ChangeLog | 5 +++++ Completion/Unix/Type/_path_files | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 763c903c6..37a6fd9dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-06-03 Barton E. Schaefer + + * users/21609: Completion/Unix/Type/_path_files: do not treat + tilde-expansions as quoted when inside command substitutions + 2016-06-03 Marko Myllynen * 38587: Completion/Linux/Command/_iconvconfig: Fix iconvconfig diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files index c64ebf58c..14c4cc753 100644 --- a/Completion/Unix/Type/_path_files +++ b/Completion/Unix/Type/_path_files @@ -273,7 +273,7 @@ if [[ "$pre" = [^][*?#^\|\<\>\\]#(\`[^\`]#\`|\$)*/* && "$compstate[quote]" != \' orig="${orig[1,(in:i:)/][1,-2]}" donepath= prepaths=( '' ) -elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then +elif [[ "$pre[1]" = \~ && "$compstate[quote]" = (|\`) ]]; then # It begins with `~', so remember anything before the first slash to be able # to report it to the completion code. Also get an expanded version of it -- cgit v1.2.3 From 6e834587eb3ade36241f5803daa7aa0148e324fc Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 4 Jun 2016 09:19:54 +0000 Subject: 38592 (plus tweak): _git: New recent branches completion, unused. (Joint with Nils Luxton) --- ChangeLog | 5 ++++ Completion/Unix/Command/_git | 60 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index b066f208e..52e891464 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-06-07 Daniel Shahaf + + * 38592 (plus tweak): Completion/Unix/Command/_git: New recent + branches completion, unused. (Joint with Nils Luxton) + 2016-06-07 Barton E. Schaefer * 38630: Src/builtin.c: fix infinite loop of "hash =" diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 1dca28802..9e572e25d 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5640,6 +5640,66 @@ __git_commit_objects_prefer_recent () { __git_recent_commits $argument_array_names || __git_commit_objects } +# This function returns in $reply recently-checked-out refs' names, in order +# from most to least recent. +(( $+functions[__git_recent_branches__names] )) || +__git_recent_branches__names() +{ + local -a reflog + local reflog_subject + local new_head + local -A seen + reply=() + + reflog=(${(ps:\0:)"$(_call_program reflog git reflog -1000 -z --grep-reflog='\^checkout:\ moving\ from\ ' --pretty='%gs' 2>/dev/null)"}) + for reflog_subject in $reflog; do + new_head=${${=reflog_subject}[4]} + + # Skip values added in previous iterations. + if (( ${+seen[$new_head]} )); then + continue + fi + seen[$new_head]="" # value is ignored + + # Filter out hashes, to leave only ref names. + if [[ $new_head =~ '^[0-9a-f]{40}$' ]]; then + continue + fi + + # All checks passed. Add it. + reply+=( $new_head ) + done +} + +(( $+functions[__git_recent_branches] )) || +__git_recent_branches() { + local -a branches descriptions + local branch description + local -a reply + + __git_recent_branches__names \ + ; for branch in $reply + do + # ### We'd want to convert all $reply to $descriptions in one shot, + # ### with this: + # ### array=("${(ps:\0:)"$(_call_program descriptions git --no-pager log --no-walk=unsorted -z --pretty=%s ${(q)reply} --)"}") + # ### , but git croaks if any of the positional arguments is a ref name + # ### that has been deleted. (So does 'git rev-parse'.) + # ### Hence, we resort to fetching the descriptions one-by-one. + # ### This would be costly if fork() is expensive. + description="$(_call_program description git --no-pager log --no-walk=unsorted --pretty=%s ${(q)branch} --)" + + # If the ref has been deleted, $description would be empty. + if [[ -n "$description" ]]; then + branches+=$branch + descriptions+="${branch//:/\:}:${description}" + fi + done + + _describe -V -t recent-branches "recent branches" descriptions branches +} + + (( $+functions[__git_commits] )) || __git_commits () { local -a argument_array_names -- cgit v1.2.3 From 0516736eae23f5dd3839e3a5abe250d48c4d7d3c Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 7 Jun 2016 06:20:40 +0000 Subject: 38624: _git: Optimize the last commit's __git_recent_branches__names as suggested by Matthew. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 33 +++++++++------------------------ 2 files changed, 12 insertions(+), 24 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 52e891464..13f6b28f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-06-07 Daniel Shahaf + * 38624: Completion/Unix/Command/_git: Optimize the last commit's + __git_recent_branches__names as suggested by Matthew. + * 38592 (plus tweak): Completion/Unix/Command/_git: New recent branches completion, unused. (Joint with Nils Luxton) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 9e572e25d..cc38d4bcf 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5645,30 +5645,15 @@ __git_commit_objects_prefer_recent () { (( $+functions[__git_recent_branches__names] )) || __git_recent_branches__names() { - local -a reflog - local reflog_subject - local new_head - local -A seen - reply=() - - reflog=(${(ps:\0:)"$(_call_program reflog git reflog -1000 -z --grep-reflog='\^checkout:\ moving\ from\ ' --pretty='%gs' 2>/dev/null)"}) - for reflog_subject in $reflog; do - new_head=${${=reflog_subject}[4]} - - # Skip values added in previous iterations. - if (( ${+seen[$new_head]} )); then - continue - fi - seen[$new_head]="" # value is ignored - - # Filter out hashes, to leave only ref names. - if [[ $new_head =~ '^[0-9a-f]{40}$' ]]; then - continue - fi - - # All checks passed. Add it. - reply+=( $new_head ) - done + # This parameter expansion does the following: + # 1. Obtains the last 1000 'checkout' operations from the reflog + # 2. Extracts the move-source from each + # 3. Eliminates duplicates + # 4. Eliminates commit hashes (leaving only ref names) + # + # See workers/38592 for an equivalent long-hand implementation, and the rest + # of that thread for why this implementation was chosen instead. + reply=(${${(u)${${(0)"$(_call_program reflog git reflog -1000 -z --grep-reflog='\^checkout:\ moving\ from\ ' --pretty='%gs')"}#checkout: moving from }%% *}:#[[:xdigit:]](#c40)}) } (( $+functions[__git_recent_branches] )) || -- cgit v1.2.3 From cf01ad96d4758c602b41df59bf0fe1330a88b800 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 9 Jun 2016 22:51:18 +0200 Subject: 38639: fix username completion after -, update options and get user shell with getent --- ChangeLog | 5 ++ Completion/Unix/Command/_su | 127 +++++++++++++++++++++++--------------------- 2 files changed, 72 insertions(+), 60 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index e68060e1c..41ae47c54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-06-09 Oliver Kiddle + + * 38639: Completion/Unix/Command/_su: fix username completion + after -, update options and get user shell with getent + 2016-06-07 Daniel Shahaf * 38624: Completion/Unix/Command/_git: Optimize the last commit's diff --git a/Completion/Unix/Command/_su b/Completion/Unix/Command/_su index 057a41371..73b27ee90 100644 --- a/Completion/Unix/Command/_su +++ b/Completion/Unix/Command/_su @@ -2,79 +2,86 @@ local -A opt_args local -a args context state line expl -local shell=${words[(i)(-s|--shell=*)]} first='1:user name:_users' -local usr=root +local first='(-)${norm}:user name:_users' +integer norm=1 strip +local shell usr -if _pick_variant gnu="Free Software Foundation" unix --version; then - args=( - '(--command)-c[pass command to shell]:command string:->command' - '(-c)--command=-[pass command to shell]:command string:->command' - '-f[pass -f to shell (csh)]' - '(--login)-l[use a login shell]' - '(-l)--login[use a login shell]' - '(-p --preserve-environment)-m[do not reset environment]' - '(-m --preserve-environment)-p[do not reset environment]' - '(-m -p)--preserve-environment[do not reset environment]' - '(--shell)-s[run the specified shell]:shell:->shell' - '(-s)--shell=-[run the specified shell]:shell:->shell' - ) -else - args=( - '-l[use a login shell]' - '-s[run the specified shell]:shell:->shell' - ) - case $OSTYPE in - freebsd*) - args=( +(( $words[(i)-(l|-login)] < CURRENT )) || args=( '-[use a login shell]' ) +case $OSTYPE in + linux*) + args=( -S $args + '(-c --command --session-command *)'{-c,--command=}'[pass command to shell]:command string:_cmdstring' + "(-c --command *)--session-command=[pass command to shell and don't create a new session]:command string:_cmdstring" + '(--fast -f)'{-f,--fast}'[pass -f to shell]' + '(-l --login -m -p --preserve-environment)'{-l,--login}'[use a login shell]' + '(-l --login -m -p --preserve-environment)'{-m,-p,--preserve-environment}"[don't reset environment]" + '(-s --shell)'{-s,--shell=}'[run the specified shell]:shell:->shells' + '(-)--help[display help information]' + '(-)--version[display version information]' + ) + (( EUID )) || args+=( + '(-g --group)'{-g,--group=}'[specify primary group]:group:_groups' + \*{-G,--supp-group=}'[specify supplemental group]:group:_groups' + ) + first="(--help --version)${first#???}" + ;; + *bsd*|dragonfly*) + args+=( '-c[use settings from specified login class]:class' '-f[if the invoked shell is csh, prevent it from reading .cshrc]' - '-l[use a login shell]' - '-m[do not reset environment]' - '-s[set the MAC label]' + '(-m)-l[use a login shell]' + "(-l)-m[don't reset environment]" + ) + ;| + freebsd*) args+=( '-s[set the MAC label]' ) ;; + openbsd*) + args+=( + '(-K)-a[specify authentication type]:authentication type' + '(-a)-K[shorthand for -a passwd]' + '-s[run the specified shell]:shell:->shells' + '-L[loop until login succeeds]' ) ;; - *) args+=( '-c[pass command to shell]:command string:->command' ) ;; - esac -fi + netbsd*) + args+=( + '-d[use a login shell but retain current directory]' + "-K[don't use Kerberos]" + ) + ;; +esac -if [[ $#words -ge 2 && $words[2] != -* && CURRENT -ne 2 ]]; then - usr=$words[2] - first= +if (( $words[(i)-] < CURRENT )); then + args=( ${args:#*-(-login|l|)\[*} '1:-' ) + norm=2 fi -[[ $words[shell] == -s ]] && ((shell++)) +_arguments $args ${(e)first} "*:shell arguments:= ->rest" && return -if [[ CURRENT -ne shell && -n ${words[shell]} ]]; then - shell=${words[shell]#*=} +usr=${line[norm]/--/root} +if (( $#opt_args[(i)-(s|-shell)] )); then + shell=${(v)opt_args[(i)-(s|-shell)]} +elif (( ${+commands[getent]} )); then + shell="${$(_call_program shells getent passwd $usr)##*:}" else - shell="${${(M@)${(@f)$(rest" && return - case $state in - (command) - compset -q - _normal - return - ;; - (shell) - _wanted -C $context shells expl shell compadd ${(f)^"$( Date: Sun, 12 Jun 2016 14:29:55 +0000 Subject: 38665: _git: config option completion: Quote properly. --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 8952bd009..fffa8cedd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-06-13 Daniel Shahaf + + * 38665: Completion/Unix/Command/_git: config option completion: + Quote properly. + 2016-06-12 Barton E. Schaefer * 38670: Doc/Zsh/contrib.yo, Functions/Zle/add-zle-hook-widget: diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index cc38d4bcf..f868d46cf 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2567,7 +2567,7 @@ _git-config () { __git_config_sections -b '(|)' -a '(|)' '^color\.[^.]+\..*$' gettable-color-options option && ret=0 ;; (value) - local current=${${(0)"$(_call_program current "git config $opt_args[(I)--system|--global|--local] ${(kv)opt_args[(I)-f|--file]} -z --get '$line[1]'")"}#*$'\n'} + local current=${${(0)"$(_call_program current "git config $opt_args[(I)--system|--global|--local] ${(kv)opt_args[(I)-f|--file]} -z --get ${(q)line[1]}")"}#*$'\n'} case $line[1] in (alias.*) if [[ -n $current ]]; then @@ -6706,7 +6706,7 @@ __git_config_get_regexp () { [[ -n $opts[-a] ]] || opts[-a]='.[^.]##' [[ $1 == -- ]] && shift - set -A $2 ${${${(0)"$(_call_program ${3:-$2} "git config -z --get-regexp -- '$1'")"}#${~opts[-b]}}%%${~opts[-a]}$'\n'*} + set -A $2 ${${${(0)"$(_call_program ${3:-$2} "git config -z --get-regexp -- ${(q)1}")"}#${~opts[-b]}}%%${~opts[-a]}$'\n'*} } (( $+functions[__git_config_sections] )) || -- cgit v1.2.3 From aa160fc8e962c2f6df62c62d67e366644457966c Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 10 Jun 2016 17:36:48 +0000 Subject: 38651: _git: Escape parameter arguments to _call_program. Fixes 'git cat-file blob HEAD^:' and a few other cases. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index fffa8cedd..b31543b4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-06-13 Daniel Shahaf + * 38651: Completion/Unix/Command/_git: Escape parameter arguments + to _call_program. + * 38665: Completion/Unix/Command/_git: config option completion: Quote properly. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index f868d46cf..8bcdff3f9 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2567,7 +2567,7 @@ _git-config () { __git_config_sections -b '(|)' -a '(|)' '^color\.[^.]+\..*$' gettable-color-options option && ret=0 ;; (value) - local current=${${(0)"$(_call_program current "git config $opt_args[(I)--system|--global|--local] ${(kv)opt_args[(I)-f|--file]} -z --get ${(q)line[1]}")"}#*$'\n'} + local current=${${(0)"$(_call_program current "git config $opt_args[(I)--system|--global|--local]" ${(kv)opt_args[(I)-f|--file]} "-z --get ${(q)line[1]}")"}#*$'\n'} case $line[1] in (alias.*) if [[ -n $current ]]; then @@ -5777,7 +5777,7 @@ __git_recent_commits () { # Careful: most %d will expand to the empty string. Quote properly! # NOTE: we could use %D directly, but it's not available in git 1.9.1 at least. - commits=("${(f)"$(_call_program commits git --no-pager log $commit_opts -20 --format='%h%n%d%n%s\ \(%cr\)%n%p')"}") + commits=("${(f)"$(_call_program commits git --no-pager log ${(q)commit_opts} -20 --format='%h%n%d%n%s\ \(%cr\)%n%p')"}") __git_command_successful $pipestatus || return 1 for i j k parents in "$commits[@]" ; do @@ -5987,7 +5987,7 @@ __git_tags_of_type () { type=$1; shift - tags=(${${(M)${(f)"$(_call_program $type-tag-refs "git for-each-ref --format='%(*objecttype)%(objecttype) %(refname)' refs/tags 2>/dev/null")"}:#$type(tag|) *}#$type(tag|) refs/tags/}) + tags=(${${(M)${(f)"$(_call_program ${(q)type}-tag-refs "git for-each-ref --format='%(*objecttype)%(objecttype) %(refname)' refs/tags 2>/dev/null")"}:#$type(tag|) *}#$type(tag|) refs/tags/}) __git_command_successful $pipestatus || return 1 _wanted $type-tags expl "$type tag" compadd -M 'r:|/=**' "$@" -a - tags @@ -6099,12 +6099,12 @@ __git_files () { local pref=$gitcdup$gitprefix$PREFIX # First allow ls-files to pattern-match in case of remote repository - files=(${(0)"$(_call_program files git ls-files -z --exclude-standard $opts -- ${pref:+$pref\\\*} 2>/dev/null)"}) + files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\\\*}} 2>/dev/null)"}) __git_command_successful $pipestatus || return # If ls-files succeeded but returned nothing, try again with no pattern if [[ -z "$files" && -n "$pref" ]]; then - files=(${(0)"$(_call_program files git ls-files -z --exclude-standard $opts -- 2>/dev/null)"}) + files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- 2>/dev/null)"}) __git_command_successful $pipestatus || return fi @@ -6221,7 +6221,7 @@ __git_tree_files () { shift (( at_least_one_tree_added = 0 )) for tree in $*; do - tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree -r $extra_args --name-only -z $tree 2>/dev/null)"}) + tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree -r ${(q)extra_args} --name-only -z ${(q)tree} 2>/dev/null)"}) __git_command_successful $pipestatus && (( at_least_one_tree_added = 1 )) done @@ -6292,7 +6292,7 @@ __git_guard () { __git_guard_branch-name () { if [[ -n $PREFIX$SUFFIX ]]; then - _call_program check-ref-format git check-ref-format "refs/heads/$PREFIX$SUFFIX" &>/dev/null + _call_program check-ref-format git check-ref-format "refs/heads/"${(q)PREFIX}${(q)SUFFIX} &>/dev/null (( ${#pipestatus:#0} > 0 )) && return 1 fi -- cgit v1.2.3 From 2162c1a2d2d86de4c2b956fb924c4d5acbbd0de9 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 14 Jun 2016 22:00:29 +1000 Subject: unposted: remove unused parameter --- ChangeLog | 4 ++++ Completion/Unix/Command/_cvs | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index d5e7e588f..06383ca14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-06-14 Doug Kearns + + * unposted: Completion/Unix/Command/_cvs: remove unused parameter + 2016-06-13 Peter Stephenson * users/21632: Doc/Zsh/params.yo, Src/jobs.c: REPORTMEMORY diff --git a/Completion/Unix/Command/_cvs b/Completion/Unix/Command/_cvs index 31997ec09..18383c33e 100644 --- a/Completion/Unix/Command/_cvs +++ b/Completion/Unix/Command/_cvs @@ -3,10 +3,7 @@ # redefine _cvs. _cvs() { - local extra - # "+Qqrwtnlvb:T:e:d:Hfz:s:xa" - _arguments -s \ '-R[read only access]' \ '-a[authenticate]' \ -- cgit v1.2.3 From bc1acf5b0e277ac3e5d7d57b9194b06931e5e406 Mon Sep 17 00:00:00 2001 From: Eric Cook Date: Tue, 14 Jun 2016 21:26:58 -0400 Subject: 38676, 38680: Completion for pidof and localedef. --- ChangeLog | 8 ++++ Completion/Linux/Command/_pidof | 24 ++++++++++ Completion/Unix/Command/_localedef | 92 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 Completion/Linux/Command/_pidof create mode 100644 Completion/Unix/Command/_localedef (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 06383ca14..83f346520 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2016-06-14 Eric Cook + + * 38676: Marko Myllynen: Completion/Linux/Command/_pidof: + Completion for pidof(1) + + * 38680: Marko Myllynen: Completion/Unix/Command/_localedef: + Completion for localedef(1) + 2016-06-14 Doug Kearns * unposted: Completion/Unix/Command/_cvs: remove unused parameter diff --git a/Completion/Linux/Command/_pidof b/Completion/Linux/Command/_pidof new file mode 100644 index 000000000..6605e7e67 --- /dev/null +++ b/Completion/Linux/Command/_pidof @@ -0,0 +1,24 @@ +#compdef pidof + +local curcontext="$curcontext" state line expl ret=1 +typeset -A opt_args + +local exargs="-h --help -V --version" +_arguments -C -s -w \ + '(- *)'{-h,--help}'[display help information]' \ + '(- *)'{-V,--version}'[print program version]' \ + "(-s --single-shot $exargs)"{-s,--single-shot}'[return one PID only]' \ + "(-c --check-root $exargs)"{-c,--check-root}'[omit processes with different root]' \ + "(-x $exargs)"-x'[include shells running named scripts]' \ + "($exargs)"\*{-o+,--omit-pid}'[omit processes with PIDs]:pids:_sequence -s , _pids' \ + '*:process:->procnames' \ + && return 0 + +case $state in + procnames) + # Handle defunct processes and "avahi-daemon:" + _wanted process-names expl process compadd ${${${${${(@)${(f)"$(ps -N --ppid 2 -p 2 o args=)"}%% *}##*/}%:}#\[}%]} && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_localedef b/Completion/Unix/Command/_localedef new file mode 100644 index 000000000..78d231968 --- /dev/null +++ b/Completion/Unix/Command/_localedef @@ -0,0 +1,92 @@ +#compdef localedef + +local curcontext="$curcontext" state line expl ret=1 +typeset -A opt_args + +if _pick_variant gnu='(GNU|EGLIBC)' unix --version; then + + local exargs="-? --help --usage -V --version" + _arguments -A "-*" -C -S -s \ + '(- *)'{-\?,--help}'[display help information]' \ + '(- *)--usage[display a short usage message]' \ + '(- *)'{-V,--version}'[print program version]' \ + "(-A --alias-file $exargs)"{-A+,--alias-file=}'[specify locale alias file]:alias file:_files' \ + "($exargs)--prefix=[specify path prefix]:prefix:_files" \ + "(-c --force $exargs)"{-c,--force}'[force write despite of warnings]' \ + "(-v --verbose $exargs)"{-v,--verbose}'[display additional information]' \ + "($exargs)--quiet[suppress messages and warnings]" \ + - set1 \ + "(-f --charmap $exargs)"{-f+,--charmap=}'[specify locale charmap file]:charmap:->charmap' \ + "(-i --inputfile $exargs)"{-i+,--inputfile=}'[specify locale definition file]:locale file:_files' \ + "(-u --repertoire-map $exargs)"{-u+,--repertoire-map=}'[specify repertoire map file]:repertoire map file:_files' \ + '1:path:_files' \ + - set2 \ + "(--list-archive $exargs)--list-archive[list locales in archive]" \ + - set3 \ + "(--delete-from-archive $exargs)--delete-from-archive[delete locale from archive]" \ + '*:locale:->locale' \ + - set4 \ + "(--add-to-archive $exargs)--add-to-archive[add locale to archive]" \ + "(--replace $exargs)--replace[replace locale in archive]" \ + "(--no-archive $exargs)--no-archive[use subdir not archive]" \ + '*:compiled path:_files -/' \ + && return 0 + + case "$state" in + charmap) + if [[ $words[-1] == */* ]]; then + _wanted charmaps expl charmap _files && ret=0 + else + typeset -a charmaps + charmaps=( ${(f)"$(locale -m)"} ) + _wanted charmaps expl charmap compadd -a charmaps && ret=0 + fi + ;; + locale) + typeset -a locales + local pref=${opt_args[--prefix]} + local p=${pref:+--prefix} + locales=( ${(f)"$(localedef --list-archive $p $pref)"} ) + _wanted locales expl locale compadd -a locales && ret=0 + ;; + esac + + return ret + +else + + typeset -a u_opt bsd_opts + [[ $OSTYPE != darwin* ]] && u_opt=( + '-u+[specify target codeset]:codeset:_files' + ) + [[ $OSTYPE == (freebsd*|dragonfly*) ]] && bsd_opts=( + '-D[create BSD-style output]' \ + '-U[ignore undefined character symbols]' \ + '-v[verbose deguggin output]' \ + '-w+[specify width file]:width file:_files' \ + ) + + _arguments -A "-*" -C \ + '-c[force write despite of warnings]' \ + '-f+[specify locale charmap file]:charmap:->charmap' \ + '-i+[specify locale definition file]:locale file:_files' \ + $u_opt \ + $bsd_opts \ + '1:path:_files' \ + && return 0 + + case "$state" in + charmap) + if [[ $words[-1] == */* ]]; then + _wanted charmaps expl charmap _files && ret=0 + else + typeset -a charmaps + charmaps=( ${(f)"$(locale -m)"} ) + _wanted charmaps expl charmap compadd -a charmaps && ret=0 + fi + ;; + esac + + return ret + +fi -- cgit v1.2.3 From bce43df70d1b09d9480dca36e6dd2641facdb6f0 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sat, 18 Jun 2016 00:07:39 +0200 Subject: 38703: support su options on macOS --- ChangeLog | 4 ++++ Completion/Unix/Command/_su | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 2ac9ceb63..26cf8861a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-06-18 Oliver Kiddle + + * 38703: Completion/Unix/Command/_su: support su options on macOS + 2016-06-16 Peter Stephenson * 38693: Doc/Zsh/contrib.yo, Functions/Misc/zcalc, diff --git a/Completion/Unix/Command/_su b/Completion/Unix/Command/_su index 73b27ee90..900905632 100644 --- a/Completion/Unix/Command/_su +++ b/Completion/Unix/Command/_su @@ -25,7 +25,7 @@ case $OSTYPE in ) first="(--help --version)${first#???}" ;; - *bsd*|dragonfly*) + *bsd*|darwin*|dragonfly*) args+=( '-c[use settings from specified login class]:class' '-f[if the invoked shell is csh, prevent it from reading .cshrc]' -- cgit v1.2.3 From 2f67cd514fef304ac40d49e5bb9c40bcee31664a Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sat, 18 Jun 2016 00:15:11 +0200 Subject: 38707: strip suffix for glob qualifier completion --- ChangeLog | 4 ++++ Completion/Unix/Type/_files | 1 + Completion/Unix/Type/_path_files | 1 + Completion/Zsh/Type/_globquals | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 26cf8861a..9a7f1db05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2016-06-18 Oliver Kiddle + * 38707: Completion/Zsh/Type/_globquals, + Completion/Unix/Type/_files, Completion/Unix/Type/_path_files: + strip suffix for glob qualifier completion + * 38703: Completion/Unix/Command/_su: support su options on macOS 2016-06-16 Peter Stephenson diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files index fe0780a57..69878242f 100644 --- a/Completion/Unix/Type/_files +++ b/Completion/Unix/Type/_files @@ -7,6 +7,7 @@ local ret=1 # we don't want to complete them multiple times (for each file pattern). if _have_glob_qual $PREFIX; then compset -p ${#match[1]} + compset -S '[^\)\|\~]#(|\))' if [[ $_comp_caller_options[extendedglob] == on ]] && compset -P '\#'; then _globflags && ret=0 else diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files index 14c4cc753..6a1e89f05 100644 --- a/Completion/Unix/Type/_path_files +++ b/Completion/Unix/Type/_path_files @@ -17,6 +17,7 @@ local -a match mbegin mend if _have_glob_qual $PREFIX; then local ret=1 compset -p ${#match[1]} + compset -S '[^\)\|\~]#(|\))' if [[ $_comp_caller_options[extendedglob] == on ]] && compset -P '\#'; then _globflags && ret=0 else diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals index 2523eb333..ed9c008a1 100644 --- a/Completion/Zsh/Type/_globquals +++ b/Completion/Zsh/Type/_globquals @@ -125,7 +125,7 @@ while [[ -n $PREFIX ]]; do alts+=("senses:sense:compadd -E 0 -d sdisp -S '' - + '' -") fi specmap=( M months w weeks h hours m minutes s seconds '(|+|-|d)' days) - alts+=('digits:digit ('${${specmap[(K)$timespec]}:-invalid time specifier}'):_dates -f ${${timespec/[-+]/d}:-d} -S ""' ) + alts+=('digits:digit ('${${specmap[(K)${timespec:-d}]}:-invalid time specifier}'):_dates -f ${${timespec/[-+]/d}:-d} -S ""' ) _alternative $alts return fi -- cgit v1.2.3 From a22f4ea8ba963d8bf5aff5a4bebad8a7c2a9ead6 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sat, 18 Jun 2016 02:04:39 +0200 Subject: 38713: don't add calendar matches when not immediately entering menu selection --- ChangeLog | 3 +++ Completion/Unix/Type/_dates | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 9a7f1db05..4efaa1b22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-06-18 Oliver Kiddle + * 38713: Completion/Unix/Type/_dates: don't add calendar matches + when not immediately entering menu selection + * 38707: Completion/Zsh/Type/_globquals, Completion/Unix/Type/_files, Completion/Unix/Type/_path_files: strip suffix for glob qualifier completion diff --git a/Completion/Unix/Type/_dates b/Completion/Unix/Type/_dates index 83397b45a..e4fa62e48 100644 --- a/Completion/Unix/Type/_dates +++ b/Completion/Unix/Type/_dates @@ -9,7 +9,7 @@ # max-matches-length : maximum number or percentage of lines to use for # completion listing, if both are specified, the # lowest takes precedence. -# format : override date format +# date-format : override date format local -a disp cand expl local userformat format spacer=1 spacing month monstart skip match @@ -37,6 +37,7 @@ _tags dates || return 0 _comp_mesg=yes _description -2V -x dates expl date compadd "${@:/-X/-x}" "$expl[@]" - +[[ -z $MENUSELECT && $WIDGET != menu-select ]] && return [[ -n $PREFIX$SUFFIX ]] && return 0 (( rows )) || return 0 compstate[list]='packed rows' -- cgit v1.2.3 From 139a4dbe07728a22dcb120d1ca9ff3cdae98471a Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 22 Jun 2016 01:30:22 +0200 Subject: 38735: support verbose style to allow clearer but less compact descriptions for time specifiers --- ChangeLog | 4 ++++ Completion/Unix/Command/_find | 20 ++++++++++++++------ Completion/Zsh/Type/_globquals | 24 ++++++++++++++++++++---- 3 files changed, 38 insertions(+), 10 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 9cc1c3ea4..3c722b79d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2016-06-22 Oliver Kiddle + * 38735: Completion/Unix/Command/_find, + Completion/Zsh/Type/_globquals: support verbose style to allow + clearer but less compact descriptions for time specifiers + * 38733: Completion/X/Command/_rdesktop: completion for xfreerdp 2016-06-21 Peter Stephenson diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find index e736f32cb..3854d6cce 100644 --- a/Completion/Unix/Command/_find +++ b/Completion/Unix/Command/_find @@ -1,7 +1,7 @@ #compdef find gfind -local curcontext="$curcontext" state_descr variant -local -a state line args alts +local curcontext="$curcontext" state_descr variant default +local -a state line args alts disp smatch _pick_variant -r variant gnu=GNU $OSTYPE -version @@ -101,7 +101,7 @@ case $variant in '-D[print diagnostics]:debug option:(help tree search stat rates opt exec)' '-O+[enable query optimisation]:level:(1 2 3)' '*-daystart' - '-regextype:regexp syntax:(emacs posix-awk posix-basic posix-egrep posix-extended)' + '-regextype:regexp syntax:(help findutils-default awk egrep ed emacs gnu-awk grep posix-awk posix-basic posix-egrep posix-extended posix-minimal-basic sed)' '*-warn' '*-nowarn' '*-xautofs' @@ -147,13 +147,21 @@ _arguments -C $args \ '*-user:user:_users' \ '*-xdev' \ '*-a' '*-o' \ - '*:directory:_files -/' + '(-D -E -H -L -O -P -f -s -x --help --version)*:directory:_files -/' if [[ $state = times ]]; then if ! compset -P '[+-]' || [[ -prefix '[0-9]' ]]; then - disp=( 'before' 'exactly' 'since' ) compstate[list]+=' packed' - alts=( "senses:sense:compadd -V times -S '' -d disp - + '' -" ) + if zstyle -t ":completion:${curcontext}:senses" verbose; then + zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=-- + default=" [default exactly]" + disp=( "- $sep before" "+ $sep since" ) + smatch=( - + ) + else + disp=( before exactly since ) + smatch=( - '' + ) + fi + alts=( "senses:sense${default}:compadd -V times -S '' -d disp -a smatch" ) fi alts+=( "times:${state_descr}:_dates -f d" ) _alternative $alts diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals index ed9c008a1..6eef16877 100644 --- a/Completion/Zsh/Type/_globquals +++ b/Completion/Zsh/Type/_globquals @@ -1,7 +1,7 @@ #autoload -local state=qual expl char delim timespec -local -a alts tdisp sdisp +local state=qual expl char delim timespec default +local -a alts tdisp sdisp tmatch smatch local -A specmap while [[ -n $PREFIX ]]; do @@ -118,11 +118,27 @@ while [[ -n $PREFIX ]]; do timespec=$PREFIX[1] if ! compset -P '[Mwhmsd]' && [[ -z $PREFIX ]]; then tdisp=( seconds minutes hours days weeks Months ) - alts+=( "time-specifiers:time specifier:compadd -E 0 -d tdisp -S '' - s m h d w M" ) + tmatch=( s m h d w M ) + if zstyle -t ":completion:${curcontext}:time-specifiers" verbose; then + zstyle -s ":completion:${curcontext}:time-specifiers" list-separator sep || sep=-- + print -v tdisp -f "%s ${sep//(#m)[%\\]/$MATCH$MATCH} %s\0" ${tmatch:^^tdisp} + tdisp=( ${(0)tdisp} ) + fi + alts+=( "time-specifiers:time specifier:compadd -E 0 -d tdisp -S '' -a tmatch" ) fi if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then sdisp=( before exactly since ) - alts+=("senses:sense:compadd -E 0 -d sdisp -S '' - + '' -") + smatch=( - '' + ) + if zstyle -t ":completion:${curcontext}:senses" verbose; then + zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=-- + default=" [default exactly]" + sdisp=( "- $sep before" "+ $sep since" ) + smatch=( - + ) + else + sdisp=( before exactly since ) + smatch=( - '' + ) + fi + alts+=( "senses:sense${default}:compadd -E 0 -d sdisp -S '' -a smatch" ) fi specmap=( M months w weeks h hours m minutes s seconds '(|+|-|d)' days) alts+=('digits:digit ('${${specmap[(K)${timespec:-d}]}:-invalid time specifier}'):_dates -f ${${timespec/[-+]/d}:-d} -S ""' ) -- cgit v1.2.3 From 59bf331d27ea29902870daeb50a47c13788fa7a7 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 23 Jun 2016 15:55:20 +0000 Subject: unposted: _git-config: Fix syntax error in 'tag.sort' completion. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 76cb77e58..215f8b2a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-06-25 Daniel Shahaf + * unposted: Completion/Unix/Command/_git: _git-config: Fix + syntax error in 'tag.sort' completion. + * 38652: Test/ztst.zsh: test harness: Emit unified diffs instead of context diffs diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 8bcdff3f9..46e290788 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2334,7 +2334,7 @@ _git-config () { 'svn-remote.*.pushurl:URL to push to::_urls' 'svn-remote.*.branches:branch mappings:branch mapping:->string' 'svn-remote.*.tags:tag mappings:tag mapping:->string' - tag.sort:'Default sorting method:->string' + tag.sort:'default sorting method:sorting method:->string' 'tar.*.command:specify a shell command through which the tar output generated by git archive should be piped::_cmdstring' 'tar.*.remote:enable for use by remote clients via git-upload-archive::->bool' tar.umask:'umask to apply::->umask' -- cgit v1.2.3 From 3bd8abc40bf9c218e1ddd23bfd804422b0684c0a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 3 Jun 2016 11:40:54 +0000 Subject: unposted: _git-config: Document some line noise. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 3 +++ 2 files changed, 6 insertions(+) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 215f8b2a6..c2f15f6a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-06-25 Daniel Shahaf + * unposted: Completion/Unix/Command/_git: _git-config: Document + some line noise. + * unposted: Completion/Unix/Command/_git: _git-config: Fix syntax error in 'tag.sort' completion. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 46e290788..5cc144963 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2371,7 +2371,9 @@ _git-config () { if compset -P '[^.]##.*.'; then declare -a match mbegin mend + # When completing 'remote.foo.', offer 'bar' if $git_options_static contains 'remote.foo.bar'. options+=(${${${${(M)git_options_static:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}) + # When completing 'remote.foo.', offer 'bar' if $git_options_static contains 'remote.*.bar'. options+=(${${${${(M)git_options_static:#(#i)${IPREFIX%%.*}.\*.[^.:]##:*}#(#i)${IPREFIX%%.*}.\*.}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}) declare -a labels @@ -2420,6 +2422,7 @@ _git-config () { 'gitcvs.ext:ext-connection-method-specific options' 'gitcvs.pserver:pserver-connection-method-specific options' 'notes.rewrite:commands to copy notes from original for when rewriting commits') + # Set $sections to the applicable subsection names (e.g., 'decorate:...' if $IPREFIX == "color.") sections+=(${${(M)subsections:#${IPREFIX}[^.:]##(.|):*}#${IPREFIX}}) # TODO: Is it fine to use functions like this before _describe below, -- cgit v1.2.3 From 3a034838b4a76924a7fff98c269c9c3ea3136d45 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 25 Jun 2016 16:34:58 +0000 Subject: 38760: _git-config: Stop trying to execute the empty string command name upon completing values for an unknown option. For example: % git config x.y.z +_git-config:834> case x.y.z (alias.*) +_git-config:834> case x.y.z (remotes.*) +_git-config:860> local z=$'\C-@' +_git-config:861> declare -a parts +_git-config:862> parts=( '' ) +_git-config:863> (( 1 < 2 )) +_git-config:863> [[ x.y.z == [^.]##.*.[^.]## ]] +_git-config:864> parts=( '' ) +_git-config:866> (( 1 > 0 )) +_git-config:867> case (-\>*) +_git-config:867> case (*) +_git-config:1197> declare -a action +_git-config:1198> _description values expl '' +_git-config:1199> eval 'action=()' +(eval):1> action=( ) +_git-config:1200> '' -J values _git-config:1200: permission denied: +_git-config:1206> return ret --- ChangeLog | 6 ++++++ Completion/Unix/Command/_git | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index c2f15f6a5..503b905f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2016-06-27 Daniel Shahaf + + * 38760: Completion/Unix/Command/_git: _git-config: Stop trying + to execute the empty string command name upon completing values + for an unknown option. + 2016-06-25 Daniel Shahaf * unposted: Completion/Unix/Command/_git: _git-config: Document diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 5cc144963..739fff1db 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2603,7 +2603,7 @@ _git-config () { if (( $#parts < 2 )) && [[ $line[1] == [^.]##.*.[^.]## ]]; then parts=("${(S@0)${git_options_static[(r)(#i)${line[1]%%.*}.\*.${line[1]##*.}:*]}//(#b)(*[^\\]|):/$match[1]$z}") fi - (( $#parts > 0 )) || return ret + (( $#parts >= 4 )) || return ret case $parts[4] in ('->'*) case ${parts[4]#->} in -- cgit v1.2.3 From 92d516cfa7686b58ba7731b942766e706cae29ae Mon Sep 17 00:00:00 2001 From: Jordan Klassen Date: Tue, 5 Jul 2016 23:22:11 +0200 Subject: users/21551 (tweaked per users/21560): new git subtree completion --- ChangeLog | 5 +++ Completion/Unix/Command/_git | 92 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 470c13e72..7bf719390 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-07-05 Oliver Kiddle + + * Jordan Klassen: users/21551 (tweaked per users/21560): + Completion/Unix/Command/_git: new git subtree completion + 2016-07-05 Daniel Shahaf * 38728: Test/D02glob.ztst: Tests: Add tests for the ':a' and diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 739fff1db..73273ad43 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1747,6 +1747,91 @@ _git-submodule () { return ret } +(( $+functions[_git-subtree] )) || +_git-subtree () { + local curcontext="$curcontext" state state_descr line ret=1 + declare -A opt_args + + # TODO: -P should only complete paths inside the current repository. + _arguments -C \ + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ + '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '-d[show debug messages]' \ + ': :->command' \ + '*::: := ->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + + commands=( + add:'create the subtree by importing its contents' + merge:'merge recent changes up to specified commit into the subtree' + pull:'fetch from remote repository and merge recent changes into the subtree' + push:'does a split and `git push`' + split:'extract a new synthetic project history from a subtree') + + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (add) + _arguments \ + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ + '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '--squash[import only a single commit from the subproject]' \ + ': :__git_any_repositories_or_references' \ + ':: :__git_ref_specs' && ret=0 + ;; + (merge) + _arguments -S \ + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ + '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '--squash[import only a single commit from the subproject]' \ + ': :__git_references' && ret=0 + ;; + (pull) + _arguments -S \ + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ + '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '--squash[import only a single commit from the subproject]' \ + ': :__git_any_repositories' \ + ':: :__git_ref_specs' && ret=0 + ;; + (push) + _arguments -S \ + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ + '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + ': :__git_any_repositories' \ + ':: :__git_ref_specs' && ret=0 + ;; + (split) + _arguments -S \ + '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ + '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-b --branch)'{-b,--branch=}'[create a new branch]' \ + '--onto=[try connecting new tree to an existing one]: :__git_ref_specs' \ + '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '--ignore-joins[ignore prior --rejoin commits]' \ + '--onto=[try connecting new tree to an existing one]: :__git_ref_specs' \ + '--rejoin[use the given message as the commit message for the merge commit]' \ + '*: :__git_references' && ret=0 + ;; + (*) + _default && ret=0 + ;; + esac + ;; + esac + + return ret +} + (( $+functions[_git-tag] )) || _git-tag () { local -a message_opts @@ -6274,6 +6359,13 @@ __git_any_repositories () { 'remote-repositories::__git_remote_repositories' } +(( $+functions[__git_any_repositories_or_references] )) || +__git_any_repositories_or_references () { + _alternative \ + 'repositories::__git_any_repositories' \ + 'references::__git_references' +} + # Common Guards (( $+functions[__git_guard] )) || -- cgit v1.2.3 From 304aa25184f927ccc034bb98f6ac744d29006bb4 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 8 Jul 2016 23:09:18 +0200 Subject: 38812: a few new completions and update some command options --- ChangeLog | 8 +++++ Completion/BSD/Command/_chflags | 30 ++++++++++++++--- Completion/Unix/Command/_dmesg | 32 ++++++++++++++++++ Completion/Unix/Command/_env | 53 ++++++++++++++++++++++++------ Completion/Unix/Command/_ln | 1 + Completion/Unix/Command/_ls | 15 ++++++--- Completion/Unix/Command/_script | 71 ++++++++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_service | 49 +++++++++++++++------------ Completion/Unix/Command/_touch | 45 +++++++++++++++++++++++++ Completion/Unix/Command/_xmlsoft | 7 ++-- Completion/X/Command/_x_utils | 8 ++++- Completion/Zsh/Command/_vared | 2 ++ 12 files changed, 278 insertions(+), 43 deletions(-) create mode 100644 Completion/Unix/Command/_dmesg create mode 100644 Completion/Unix/Command/_script create mode 100644 Completion/Unix/Command/_touch (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 8e02253c5..cf20b5038 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2016-07-08 Oliver Kiddle + * 38812: Completion/BSD/Command/_chflags, + Completion/Unix/Command/_dmesg, Completion/Unix/Command/_env, + Completion/Unix/Command/_ln, Completion/Unix/Command/_xmlsoft, + Completion/Unix/Command/_ls, Completion/Unix/Command/_service, + Completion/Unix/Command/_touch, Completion/Unix/Command/_script, + Completion/X/Command/_x_utils, Completion/Zsh/Command/_vared: + a few new completions and update some command options + * 38810: Src/Zle/textobjects.c: fix cursor positioning and repeated invocations when widgets used from emacs mode diff --git a/Completion/BSD/Command/_chflags b/Completion/BSD/Command/_chflags index c9f26249d..bfbaa018f 100644 --- a/Completion/BSD/Command/_chflags +++ b/Completion/BSD/Command/_chflags @@ -1,6 +1,6 @@ #compdef chflags -local flags own='-g *(-u$EUID)' +local flags args own='-g *(-u$EUID)' flags=( '(noopaque)opaque[set the opaque flag]' @@ -14,7 +14,7 @@ flags=( ) if (( ! EUID )); then - flags=( $flags[@] + flags+=( '(noarch)arch[set the archived flag]' '(arch)noarch[unset the archived flag]' '(nosappnd)sappnd[set the system append-only flag]' @@ -26,19 +26,39 @@ if (( ! EUID )); then fi if [[ $OSTYPE = (freebsd|dragonfly|darwin)* ]]; then - flags=( $flags[@] + flags+=( '(nouunlnk)uunlnk[set the user undeletable flag]' '(uunlnk)nouunlnk[unset the user undeletable flag]' '(nohidden)hidden[set the hidden flag]' '(hidden)nohidden[unset the hidden flag]' ) - (( EUID )) || flags=( $flags[@] + [[ $OSTYPE = freebsd* ]] && flags+=( + '(uoffline)offline[set the offline attribute]' + '(offline)uoffline[unset the offline attribute]' + '(urdonly)rdonly[set readonly flag]' + '(rdonly)urdonly[unset readonly flag]' + '(usparse)sparse[set the sparse attribute]' + '(sparse)usparse[unset the sparse attribute]' + '(usystem)system[set system flag]' + '(system)usystem[unset system flag]' + '(ureparse)reparse[set the Windows reparse point attribute]' + '(reparse)ureparse[unset the Windows reparse point attribute]' + '(uunlnk)unlnk[set undeletable flag]' + '(unlnk)uunlnk[unset undeletable flag]' + ) + + (( EUID )) || flags+=( '(nosunlnk)sunlnk[set the system undeletable flag]' '(sunlnk)nosunlnk[unset the system undeletable flag]' ) + args=( + "-f[don't display diagnostic messages]" + '-h[act on symlinks]' + '-v[verbose output]' + ) fi -_arguments -s -A "-*" \ +_arguments -s -A "-*" $args \ '(-L -P)-H[follow symlinks on the command line (specify with -R)]' \ '(-H -P)-L[follow all symlinks (specify with -R)]' \ '(-L -H)-P[do not follow symlinks (specify with -R)]' \ diff --git a/Completion/Unix/Command/_dmesg b/Completion/Unix/Command/_dmesg new file mode 100644 index 000000000..3dd059214 --- /dev/null +++ b/Completion/Unix/Command/_dmesg @@ -0,0 +1,32 @@ +#compdef dmesg + +local args + +case $OSTYPE in + linux*) args=( -S -- ) ;; + darwin*|dragonfly*|*bsd*) + args=( + '-M[extract values from core]:core file:_files' + '-N[extract name list from kernel image]:system:_files' + ) + ;| + dragonfly*|freebsd*) + args=( + '-a[show all data, including syslog and console]' + '-c[clear the buffer after printing]' + ) + ;| + openbsd*) + args+=( + '-s[show console message buffer instead]' + ) + ;; + dragonfly*) + args+=( + '\*-f[follow buffer, displaying new data as it arrives]' + '-n[use specified kernel core]:number' + ) + ;; +esac + +_arguments -s $args diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env index 96261bba8..9b2a1e011 100644 --- a/Completion/Unix/Command/_env +++ b/Completion/Unix/Command/_env @@ -1,13 +1,46 @@ #compdef env -if _pick_variant gnu=Free\ Soft unix --version; then - _arguments \ - '(--ignore-environment -i)'{-i,--ignore-environment}'[start with empty environment]' \ - '*'{-u,--unset=}'[remove variable from the environment]:env var to remove:compadd ${(k)parameters[(R)*export*]}' \ - '--help[help]' \ - '--version[version]' \ - '(-):command: _command_names -e' \ - '*::arguments: _normal' -else - _precommand +local context state line variant args ret=1 + +_pick_variant -r variant gnu=Free\ Soft $OSTYPE --version +case $variant in + gnu) + args=( + '(-)'{-i,--ignore-environment}'[start with empty environment]' + '(--ignore-environment -i --help --version)*'{-u,--unset=}'[remove variable from the environment]:env var to remove:_parameters -g "*export*"' + '(- *)--help[display help information]' + '(- *)--version[display version information]' + ) + ;; + freebsd*) + args=( + '(-i)*-u[remove variable from the environment]:env var to remove:_parameters -g "*export*"' + '-P[specify alternate executable search PATH]:path:_dir_list' + '-S[perform word splitting]' + '*-v[verbose output]' + ) + ;& + *) + if (( $words[(i)-] < CURRENT )); then + words[(i)-]=() + (( CURRENT-- )) + else + args+=( + '(-i)'{-,-i}'[start with empty environment]' + ) + fi + ;; +esac + +_arguments $args \ + '*::arguments:->normal' && ret=0 + +if [[ -n $state ]]; then + while [[ $words[1] = *=* ]]; do + shift words + (( CURRENT-- )) + done + _normal && ret=0 fi + +return ret diff --git a/Completion/Unix/Command/_ln b/Completion/Unix/Command/_ln index c903fee02..efb982aba 100644 --- a/Completion/Unix/Command/_ln +++ b/Completion/Unix/Command/_ln @@ -38,6 +38,7 @@ if [[ $variant == gnu ]]; then '(-L --logical)'{-L,--logical}'[create hard links to symbolic link references]' '(-n --no-dereference)'{-n,--no-dereference}'[treat destination symbolic link to a directory as if it were a normal file]' '(-P --physical)'{-P,--physical}'[create hard links directly to symbolic links]' + '(-r --relative)'{-r,--relative}'[create symbolic links relative to link location]' '(-s --symbolic)'{-s,--symbolic}'[create symbolic links instead of hard links]' '(-S --suffix)'{-S,--suffix=}'[override default backup suffix]:suffix' '(-t --target-directory)'{-t,--target-directory=}'[specify directory in which to create the links]: :_directories' diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls index f2e149453..74f317ad1 100644 --- a/Completion/Unix/Command/_ls +++ b/Completion/Unix/Command/_ls @@ -1,6 +1,6 @@ #compdef ls gls -local arguments is_gnu +local arguments is_gnu datef if ! _pick_variant gnu=gnu unix --help; then arguments=( @@ -70,6 +70,7 @@ if ! _pick_variant gnu=gnu unix --help; then ) fi else + [[ $PREFIX = *+* ]] && datef='formats:format: _date_formats' arguments=( '(--all -a -A --almost-all)'{--all,-a}'[list entries starting with .]' '(--almost-all -A -a --all)'{--almost-all,-A}'[list all except . and ..]' @@ -89,6 +90,7 @@ else '(--format -l -g -o -1 -C -m -x)-l[long listing]' '(--format -l -1 -C -m -x)-g[long listing but without owner information]' + --group-directories-first '(--format -l --no-group -G -1 -C -m -x)-o[no group, long]' '(--format -l -g -o -C -m -x)-1[single column output]' '(--format -l -g -o -1 -m -x)-C[list entries in columns sorted vertically]' @@ -101,7 +103,7 @@ else '(--time -u)-c[status change time]' '(--time -c)-u[access time]' '(-c -u)--time=[specify time to show]:time:(ctime status use atime access)' - '--time-style=[show times using specified style]:time style:(full-iso long-iso iso locale)' + '--time-style=[show times using specified style]:style: _alternative "time-styles\:time style\:(full-iso long-iso iso locale)" $datef' '(-a --all -U -l --format -s --size -t --sort --full-time)-f[unsorted, all, short list]' '(--reverse)'{--reverse,-r}'[reverse sort order]' @@ -114,10 +116,10 @@ else '(-S -t -U -v -X)--sort=:sort:(size time none version extension)' '--color=-[control use of color]:color:(never always auto)' - + "--hide=[don't list entries matching pattern]:pattern" '(--classify -F --indicator-style -p --file-type)'{--classify,-F}'[append file type indicators]' '(--file-type -p --indicator-style -F --classify)'{--file-type,-p}'[append file type indicators except *]' - '(-F --classify -p --file-type)--indicator-style=:indicator style:(none file-type classify)' + '(-F --classify -p --file-type)--indicator-style=:indicator style:(none file-type classify slash)' '(-f)--full-time[list both full date and full time]' @@ -139,6 +141,11 @@ else '(- :)--version[display version information]' '*:files:_files' ) + if [[ $OSTYPE = linux* ]]; then + arguments+=( + '(-Z --context)'{-Z,--context}'[print any security context of each file]' + ) + fi fi _arguments -s $arguments diff --git a/Completion/Unix/Command/_script b/Completion/Unix/Command/_script new file mode 100644 index 000000000..7f682eaa2 --- /dev/null +++ b/Completion/Unix/Command/_script @@ -0,0 +1,71 @@ +#compdef script scriptreplay + +local args hlp="-h --help -V --version" + +if [[ $service = scriptreplay ]]; then + _arguments -S -s \ + "(1 -t --timing $hlp)"{-t+,--timing=}'[specify file containing timing output]:timing file:_files' \ + "(2 -s --typescript $hlp)"{-s+,--typescript=}'[specify file containing terminal output]:typescript file:_files' \ + "(3 -d --divisor $hlp)"{-d+,--divisor=}'[speed up replay]:factor' \ + "(-m --maxdelay $hlp)"{-m+,--maxdelay=}'[set maximum delay between updates]:delay (seconds)' \ + '(- *)'{-h,--help}'[display help information]' \ + '(- *)'{-V,--version}'[display version information]' \ + "(-t --timing $hlp):timing file:_files" \ + "(-s --typescript $hlp):typescript file:_files" \ + "(-d --divisor $hlp): :_guard '[0-9.]#' 'timing divisor'" + return +fi + +case $OSTYPE in + linux*) + args=( -S + "(-a --append $hlp)"{-a,--append}'[append output]' + "(-c --command $hlp)"{-c,--command=}'[run specified command instead of a shell]:command:_cmdstring' + "(-e --return $hlp)"{-e,--return}'[return exit status of the child process]' + "(-f --flush $hlp)"{-f,--flush}'[flush output after each write]' + "($hlp)--force[use output file even when it is a link]" + "(-q --quiet $hlp)"{-q,--quiet}'[be quiet]' + "(-t --timing $hlp)"{-t-,--timing=-}'[output timing data]::timing file:_files' + '(- 1)'{-h,--help}'[display help information]' + '(- 1)'{-V,--version}'[display version information]' + ) + ;; + darwin*|dragonfly*|netbsd*|freebsd*) + args=( + '-q[be quiet: suppress display of starting and ending lines]' + ) + ;| + netbsd*|freebsd*) + args+=( + '(-a -r -k)-d[suppress sleeps when playing back a session]' + '(-a -r -k -t)-p[play back a recorded session]' + '(-d -p)-r[record a session with input, output and timing data]' + ) + ;| + netbsd*) + args+=( + '-f[flush output after each write]' + '-c[run specified command instead of a shell]:command:_cmdstring' + ) + ;| + freebsd*) + args+=( + '-f[use filemon(4)]' + ) + ;| + darwin*|dragonfly*|freebsd*) + args+=( + '-t+[specify interval of data flushing]:interval (seconds)' + '-k[log keys sent to the program as well as output]' + '*:::arguments: _normal' + ) + ;| + *) + args+=( + '(-p -d)-a[append output]' + ) + ;; +esac + +_arguments -s $args \ + "($hlp):typescript file:_files" diff --git a/Completion/Unix/Command/_service b/Completion/Unix/Command/_service index e99ad556f..50e8607bf 100644 --- a/Completion/Unix/Command/_service +++ b/Completion/Unix/Command/_service @@ -5,27 +5,34 @@ # _sub_command happy # we are interested in init service only -local ctx="${curcontext}argument-1:" +local args ctx="${curcontext}argument-1:" zstyle -T ":completion:${ctx}" tag-order && \ zstyle ":completion:${ctx}" tag-order init - -if [[ $OSTYPE = freebsd* ]]; then - _arguments -s \ - '(-)-e[show services that are enabled]' \ - '(-)-l[list all scripts in /etc/rc.d and the local startup directory]' \ - '(-)-r[show the results of boot time rcorder]' \ - '(-)-v[verbose]' \ - ':service name:_services' \ - '*::service argument:_init_d' -else - _arguments -s \ - '(-d --debug)'{-d,--debug}'[turn debugging on]' \ - '(- :)'{-h,--help}'[print usage]' \ - '(- :)'{-v,--version}'[print version]' \ - '(-)'{-f,--full-restart}'[restart service]' \ - '(- :)'{-R,--full-restart-all}'[restart all services]' \ - '(- :)'{-s,--status-all}'[print status of all services]' \ - ':service name:_services' \ - '*::service argument: _init_d' -fi +case $OSTYPE in + freebsd*|dragonfly*) + args=( + '(-)-r[show the results of boot time rcorder]' + '(-)-R[restart all enabled local services]' + ) + ;& + netbsd*) + _arguments -s $args \ + '(-)-e[show services that are enabled]' \ + '(-)-l[list all scripts in /etc/rc.d and the local startup directory]' \ + '(-e -R)-v[verbose]' \ + ':service name:_services' \ + '*::service argument:_init_d' + ;; + *) + _arguments -s \ + '(-d --debug)'{-d,--debug}'[turn debugging on]' \ + '(- :)'{-h,--help}'[print help information]' \ + '(- :)'{-v,--version}'[print version information]' \ + '(-)'{-f,--full-restart}'[restart service]' \ + '(- :)'{-R,--full-restart-all}'[restart all services]' \ + '(- :)'{-s,--status-all}'[print status of all services]' \ + ':service name:_services' \ + '*::service argument: _init_d' + ;; +esac diff --git a/Completion/Unix/Command/_touch b/Completion/Unix/Command/_touch new file mode 100644 index 000000000..9b9144756 --- /dev/null +++ b/Completion/Unix/Command/_touch @@ -0,0 +1,45 @@ +#compdef touch gtouch + +local args variant +_pick_variant -r variant gnu=GNU $OSTYPE --version + +args=( + '-a[change access time (atime)]' + '-m[change modification time (mtime)]' + '(-r -d --date --reference 1)-t+[use specified time]:time ([[CC]YY]MMDDhhmm[.SS])' +) +case $variant in + gnu) + args+=( + '(-c --no-create)'{-c,--no-create}"[don't create file if it doesn't exist]" + '(-h --no-dereference)'{-h,--no-dereference}'[act on symbolic links themselves]' + '(-t -d --date -r --reference)'{-r+,--reference=}'[use corresponding times from specified reference file]:file:_files' + '(-t -d --date -r --reference)'{-d+,--date=}'[use specified date/time]:date/time' + '*--time=[change specified time]:time:(atime access use mtime modify)' + '(-)--help[display help information]' + '(-)--version[display version information]' + ) + ;; + darwin*|dragonfly*|freebsd*) + args+=( + '(-c 1)-A+[adjust time stamps by relative value]:time delta ([[-][hh]mm]SS)' + ) + ;| + darwin*|dragonfly*|freebsd*|netbsd*) + args+=( '-h[act on symbolic links themselves]' ) + ;| + dragonfly*|freebsd*|openbsd*|solaris*) + args+=( '(-r -t 1)-d+[use specified date/time]:date/time' ) + ;| + darwin*|dragonfly*|freebsd*|netbsd*|solaris*) + args+=( '1:: :_guard "[0-9]#" "timespec (MMDDhhmm[YY])"' ) + ;| + *) # not GNU + args=( -A "-*" $args + "(-A)-c[don't create file if it doesn't exist]" + '(-t -d 1)-r+[use corresponding times from specified reference file]:file:_files' + ) + ;; +esac + +_arguments -s -S $args '*:file:_files' diff --git a/Completion/Unix/Command/_xmlsoft b/Completion/Unix/Command/_xmlsoft index 67ba6c001..7b4b0b03d 100644 --- a/Completion/Unix/Command/_xmlsoft +++ b/Completion/Unix/Command/_xmlsoft @@ -1,7 +1,7 @@ #compdef xsltproc xmllint -value-,XML_CATALOG_FILES,-default- -# xmllint: using libxml version 20707 -# xsltproc: using libxml 20707, libxslt 10126 and libexslt 815 +# xmllint: using libxml version 20904 +# xsltproc: using libxml 20904, libxslt 10129 and libexslt 817 local -a encoding @@ -38,7 +38,9 @@ case $service in '--nodtdattr[do not default attributes from the DTD]' \ '--noout[do not dump the result]' \ '--maxdepth[increase the maximum depth]:depth' \ + '--maxvars[increase the maximum variables]:variables' \ '--maxparserdepth[increase the maximum parser depth]:depth' \ + '--seed-rand[initialise random number generator]:seed' \ '--html[input document is an HTML file]' \ '--encoding[the input document character encoding]:encoding:(${encoding[@]})' \ '*--param[pass a parameter,value pair]:name::value (xpath expression)' \ @@ -87,6 +89,7 @@ case $service in '--xmlout[use the XML serializer when using --html]' \ '--nodefdtd[do not default HTML doctype]' \ '--push[use the push mode of the parser]' \ + '--pushsmall[use the push mode of the parser using tiny increments]' \ '--memory[parse from memory]' \ '--maxmem[limit memory allocation]:bytes' \ '--nowarning[do not emit warnings from parser/validator]' \ diff --git a/Completion/X/Command/_x_utils b/Completion/X/Command/_x_utils index 05a899b68..9364235a9 100644 --- a/Completion/X/Command/_x_utils +++ b/Completion/X/Command/_x_utils @@ -1,4 +1,4 @@ -#compdef xdpyinfo xwininfo xkill xfontsel xfd xev xhost xon xsetroot xwd xwud xrdb xprop xlsatoms +#compdef xdpyinfo xwininfo xkill xfontsel xfd xev xhost xon xsetroot xwd xwud xrdb xprop xlsatoms xlsclients local curcontext="$curcontext" state line expl ret=1 @@ -37,6 +37,12 @@ xlsatoms) '*-range[atom values to list]:[num]-[num]' \ '*-name[name of single atom to print]:atom:->atoms' ;; +xlsclients) + _x_arguments -C \ + '-a[list all clients on all screens]' \ + '-l[long format adding window/icon names and class hints]' \ + '-m[maximum characters of command to include]:characters' + ;; xkill) _x_arguments \ -version \ diff --git a/Completion/Zsh/Command/_vared b/Completion/Zsh/Command/_vared index bb31cc129..2bcc87bc8 100644 --- a/Completion/Zsh/Command/_vared +++ b/Completion/Zsh/Command/_vared @@ -6,6 +6,8 @@ _arguments -s -A "-*" \ "-c[create parameter or change type]" \ '-p+[specify left prompt]:prompt' \ '-r+[specify right prompt]:right prompt' \ + '-i+[specify initialisation widget]:widget:compadd -M "r\:|-=* r\:|=*" -k widgets' \ + '-f+[specify finish widget]:widget:compadd -M "r\:|-=* r\:|=*" -k widgets' \ '-h[allow access to history]' \ '-e[exit on EOF (^D)]' \ '1:parameter spec:_vars' -- cgit v1.2.3 From ac813cfade6077c7e830a4c192c85701aed5276c Mon Sep 17 00:00:00 2001 From: Eric Cook Date: Wed, 13 Jul 2016 21:07:12 -0400 Subject: 38833: separate iostat completion from _sysstat --- ChangeLog | 5 ++ Completion/Linux/Command/_sysstat | 37 ++++------- Completion/Unix/Command/_iostat | 132 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 26 deletions(-) create mode 100644 Completion/Unix/Command/_iostat (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index cf20b5038..ebb936dc1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-07-13 Eric Cook + + * 38833: Completion/Unix/Command/_iostat + separate iostat completion from Completion/Linux/Command/_sysstat + 2016-07-08 Oliver Kiddle * 38812: Completion/BSD/Command/_chflags, diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat index 2a7128c23..e976b4705 100644 --- a/Completion/Linux/Command/_sysstat +++ b/Completion/Linux/Command/_sysstat @@ -1,4 +1,4 @@ -#compdef -P mpstat (|cifs)iostat isag sadf sar pidstat +#compdef mpstat cifsiostat isag sadf sar pidstat # -V can appear with other options, so (- *) isn't needed. #TODO: # sysstat-nfsiostat - there seems to be two nfsiostat(1)s. one from oracle and one by redhat. @@ -10,24 +10,8 @@ _mpstat() { '-P[specify processor number]:processor: _values -s "," processor ON ALL {1..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \ '-u[report CPU utilization]' \ '-V[print version number]' \ - '1:interval' \ - '2:count' -} - -_iostat() { - _arguments : \ - '-c[display CPU utilization report]' \ - '-d[display device utilization report]' \ - '-T[only display global statistics for group_name]' \ - '-g[display statistics for a group of devices]:group name' \ - '-h[human readable device utilization report]' \ - '-j[display persistent device name]' \ - '(-m)-k[display statistics in kB/s]' \ - '(-k)-m[display statistics in MB/s]' \ - '-N[display registered device mapper names]' \ - '::device:_files -W /dev -g "*(-%)"' \ - ': :_guard "[0-9]#" "interval"' \ - ':count' + '1: : _guard "^-*" interval' \ + '2: : _guard "^-*" count' } _cifsiostat() { @@ -37,8 +21,8 @@ _cifsiostat() { '(-k)-m[display statistics in MB/s]' \ '-t[print timestamp for each report]' \ '-V[print version number]' \ - '1:interval' \ - '2:count' + '1: : _guard "^-*" interval' \ + '2: : _guard "^-*" count' } _isag() { @@ -68,8 +52,8 @@ _sadf() { '(-t -T)-U[display in seconds since epoch (UTC)]' \ '-V[print version number]' \ '(-j -d -p)-x[output file in XML]' \ - '1:interval' \ - '2:count' \ + '1: : _guard "^-*" interval' \ + '2: : _guard "^-*" count' \ '3:data file:_files' && ret=0 else _arguments : '*::sar: _sar' && ret=0 @@ -107,8 +91,8 @@ _sar() { '-W[report swapping statistics]' \ '-w[report task creation and system switching activity]' \ '-y[report TTY device activity]' \ - '1:interval' \ - '2:count' + '1: : _guard "^-*" interval' \ + '2: : _guard "^-*" count' } _pidstat() { @@ -128,7 +112,8 @@ _pidstat() { '-V[print version number]' \ '-v[display values from kernel table]' \ '-w[report task switching activity]' \ - ':interval' ':count' + '1: : _guard "^-*" interval' \ + '2: : _guard "^-*" count' } _sysstat() { diff --git a/Completion/Unix/Command/_iostat b/Completion/Unix/Command/_iostat new file mode 100644 index 000000000..7dc33a1fc --- /dev/null +++ b/Completion/Unix/Command/_iostat @@ -0,0 +1,132 @@ +#compdef iostat + +local -a args + +case $OSTYPE:l in + *bsd*) + args+=( + '-c[repeat the display N times]:count' + '-C[display CPU statistics]' + '-d[display only device statistics]' + '-I[display total statistics for a given period, rather than average]' + '-M[extract values of the name list from specified file]:core:_files' + '-N[extract the name list from the specified file]:system:_files' + '-T[display TTY statistics]' + '-w[specify the duration of pauses between each display]:duration' + ) + ;| + freebsd*) + args+=( + '-h[top mode]' + '-K[display block count in kilobytes, not block size]' + '-o[display old-style iostat device statistics]' + '-t[specify which type of device to display]: :->devicetype' + '-x[show extended disk statistics]' + '-z[omit lines for devices with no activity]' + '-?[display a usage statement and exit]' + '*:drives:( ${${(M)${(f)"$(geom disk list)"}\:#Geom name\:*}#*\: } )' + ) + ;; + openbsd*) + args+=( + '-D[display alternate disk statistics]' + '*:drives:( ${${(s.,.)"$(sysctl -n hw.disknames)"}%\:*} )' + ) + ;; + netbsd*) + args+=( + '-D[display alternate disk statistics]' + '-x[show extended disk statistics]' + '*:drives:( $(sysctl -n hw.disknames) )' + ) + ;; + aix*) + args=( + '(-b -q -Q -f -F)-a[displays the adapter throughput report]' + '(-b)-A[displays the legacy asynchronous IO utilization report, and turns off the display of TTY utilization report]' + '-b[displays the block I/O device utilization statistics]' + '(-b)-d[turns off the display of TTY utilization report or CPU utilization report]' + '(-b -f -F)-D[displays the extended tape/drive utilization report]' + '(-a -b -D)-f[displays the file system utilization report]' + '(-a -b -D)-F[displays the file system utilization report, and turns off other utilization reports]' + '(-b)-l[displays the output in long listing mode]' + '(-b -t)-m[displays the path utilization report]' + '(-b)-p[displays the tape utilization report]' + '(-b)-P[displays the POSIX asynchronous IO utilization report]' + '(-b)-q[specifies AIO queues and their request counts]' + '(-b)-Q[displays a list of all the mounted file systems and the associated queue numbers with their request counts]' + '(-b)-R[specifies that the reset of min* and max* values should happen at each interval]' + '(-b)-s[specifies the system throughput report]' + '(-b)-S[displays the processor statistics that are multiplied by a value of 10]:power' + '(-b -m)-t[turns off the display of disk utilization report]' + '-T[displays the time stamp]' + '(-b)-V[displays valid nonzero statistics]' + '(-b)-z[resets the disk input/output statistics]' + '(-b)-@[reports I/O activities of a workload partition]:workload:(ALL Global)' + '*:drives:_files' # not sure how to enumerate drives on aix + ) + ;; + solaris*) + args=( + '-c[report percentage of time the system spent in user/system mode, dtrace probes and idling]' + '-C[report extended disk statistics aggregated by controller id, when used with -x]' + '-d[report the number of kilobytes tranferred per second, tranfers per second and average service time]' + '-D[report reads/writes per second and percentage disk utilization]' + '-e[display device error summary statistics]' + '-E[display all device error statistics]' + '-i[display Device ID instead of the Serial No, when used with -E]' + '-I[report counts in each interval]' + '-l[limit the number of disks included in the report]:number of disks' + '-m[report file system mount points]' + '-M[display data throughtput in MB/sec instead of KB/sec]' + '-n[display names in descriptive format]' + '-p[report per-partition statistics]' + '-P[report per-partition statistics only]' + '-r[display data in comma-separated format]' + '-s[suppress message related to state changes]' + '-t[report the number of characters read and written to terminals per second]' + '-T[display a timestamp]:format:(( "u\:internal representation of time" "d\:standard date format" ))' + '-X[report statistics for lun.controller, for disks under scsi_vhci(7D) control]' + '-x[report extended disk statistics]' + '-Y[report statistics for lun.targetport and lun.targetport.controller, for disks under scsi_vhci(7D) control]' + '-z[ignore lines where data values are all zeros]' + '::device:( ${${${(f)"$(iostat -rx 1 1)"}[3,-1]}%%,*} )' + ) + ;; + darwin*) + args=( + '-C[display CPU statistics]' + '-c[number of times to display statistics]' + '-d[display only device statistics]' + '-l[total statstics for a given time period]' + '-K[display block count in kilobytes]' + '-n[limit the number of disks included in the report]:number of disks' + '-o[display old-style iostat device statistics]' + '-T[display TTY statistics]' + '-U[display system load averages]' + '-w[specify the duration of pauses between each display]:duration' + '*::device:_files -W /dev -g "disk*"' + ) + ;; + *linux*) + args=( + '-c[display CPU utilization report]' + '-d[display device utilization report]' + '-T[only display global statistics for group_name]' + '-g[display statistics for a group of devices]:group name' + '-h[human readable device utilization report]' + '-j[display persistent device name]' + '(-m)-k[display statistics in kB/s]' + '(-k)-m[display statistics in MB/s]' + '-N[display registered device mapper names]' + '*::device:_files -W /dev -g "*(-%)"' + ) + ;; +esac + +if (( $#args )); then + _arguments -s -w -A '-*' : $args + return +fi + +_normal -- cgit v1.2.3 From ccb45b320124d17f4a2594e85c80c970bb0259ef Mon Sep 17 00:00:00 2001 From: Marko Myllynen Date: Sun, 17 Jul 2016 12:24:08 +0200 Subject: 38837 (tweaked c.f. 38826): new virsh completion --- ChangeLog | 3 +++ Completion/Unix/Command/_libvirt | 55 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 Completion/Unix/Command/_libvirt (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index be387302c..4677025f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-07-17 Oliver Kiddle + * Marko Myllynen: 38837 (tweaked c.f. 38826): + Completion/Unix/Command/_libvirt: new virsh completion + * 38845: Src/Zle/zle_main.c, Doc/Zsh/zle.yo: reset region_active before entering zle - it was on exit but before zle-line-finish Also reword documentation on region to better cover vi mode diff --git a/Completion/Unix/Command/_libvirt b/Completion/Unix/Command/_libvirt new file mode 100644 index 000000000..a9249b31e --- /dev/null +++ b/Completion/Unix/Command/_libvirt @@ -0,0 +1,55 @@ +#compdef virsh + +local curcontext="$curcontext" state line expl ret=1 + +case $service in + virsh) + if (( ! $+_cache_virsh_cmds )); then + _cache_virsh_cmds=( ${${${${(f):-"$(_call_program options virsh help)"}:#*:}/# ##}/ *} ) + fi + if (( ! $+_cache_virsh_cmdopts )); then + typeset -gA _cache_virsh_cmdopts + fi + _arguments -A "-*" -C -S -s -w \ + '(- *)'{-h,--help}'[print help information and exit]' \ + '(- *)'{-v,--version=short}'[print short version information and exit]' \ + '(- *)'{-V,--version=long}'[print long version information and exit]' \ + '(-c --connect)'{-c+,--connect}'[specify connection URI]:URI:_hosts' \ + '(-d --debug)'{-d+,--debug}'[set debug level]:level:(0 1 2 3 4)' \ + '(-e --escape)'{-e+,--escape}'[set escape sequence for console]:sequence' \ + '(-k --keepalive-interval)'{-k+,--keepalive-interval}'[set keepalive interval]:interval' \ + '(-K --keepalive-count)'{-K+,--keepalive-count}'[set keepalive count]:count' \ + '(-l --log)'{-l+,--log}'[specify log file]:file:_files' \ + '(-q --quiet)'{-q,--quiet}'[quiet mode]' \ + '(-r --readonly)'{-r,--readonly}'[connect readonly]' \ + '(-t --timing)'{-t,--timing}'[print timing information]' \ + '1:command:->virsh_cmds' \ + '*:cmdopt:->virsh_cmdopts' && return + # We accept only virsh command options after the first non-option argument + # (i.e., the virsh command itself), this makes it so with the -A "-*" above + [[ -z $state ]] && state=virsh_cmdopts + ;; +esac + +case $state in + virsh_cmds) + _wanted commands expl 'virsh command' compadd -a _cache_virsh_cmds && ret=0 + ;; + virsh_cmdopts) + local cmd + if [[ $words[-1] == /* || $words[-1] == ./* ]]; then + _default + return + fi + for (( i = 2; i <= $#words; i++ )); do + [[ -n "${_cache_virsh_cmds[(r)$words[$i]]}" ]] && cmd=$words[$i] && break + done + [[ -z $cmd ]] && return 1 + if [[ -z $_cache_virsh_cmdopts[$cmd] ]]; then + _cache_virsh_cmdopts[$cmd]=${(M)${${${${=${(f)"$(_call_program virsh virsh help $cmd 2>&1)"}}/\[}/\]}/\;}:#-[-0-9A-Za-z]*} + fi + _values -w options ${=_cache_virsh_cmdopts[$cmd]} && ret=0 + ;; +esac + +return ret -- cgit v1.2.3 From 52f46cca751cc40db978b88dd6379866cad30b15 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sun, 17 Jul 2016 12:32:02 +0200 Subject: 38867: update strace completion Also factor out completion for system calls and new functions for truss and ltrace. --- ChangeLog | 5 + Completion/Linux/Command/_ltrace | 35 +++++++ Completion/Linux/Command/_strace | 210 ++++++++++++++++++--------------------- Completion/Unix/Command/_truss | 76 ++++++++++++++ Completion/Unix/Type/_sys_calls | 20 ++++ 5 files changed, 232 insertions(+), 114 deletions(-) create mode 100644 Completion/Linux/Command/_ltrace create mode 100644 Completion/Unix/Command/_truss create mode 100644 Completion/Unix/Type/_sys_calls (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 4677025f6..ac3a3e001 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2016-07-17 Oliver Kiddle + * 38867: Completion/Linux/Command/_ltrace, + Completion/Linux/Command/_strace, Completion/Unix/Command/_truss, + Completion/Unix/Type/_sys_calls: update strace completion + factoring out system calls and new truss and ltrace completions + * Marko Myllynen: 38837 (tweaked c.f. 38826): Completion/Unix/Command/_libvirt: new virsh completion diff --git a/Completion/Linux/Command/_ltrace b/Completion/Linux/Command/_ltrace new file mode 100644 index 000000000..e48d8ec98 --- /dev/null +++ b/Completion/Linux/Command/_ltrace @@ -0,0 +1,35 @@ +#compdef ltrace + +local root hlp="-h --help -V --version" + +(( EUID )) && root='!' + +_arguments -s -S $args \ + "(-c -a --align $hlp)"{-a+,--align=}"[align return values in a secific column]:column [$((COLUMNS*5/8))]" \ + "(-c $hlp)-A+[specify maximum number of array elements to print]:elements" \ + "(-c -b --no-signals $hlp)"{-b,--no-signals}"[don't print signals]" \ + "(-a --align -A -b --no-signals -i -n --indent -r -s -t -tt -ttt -T $hlp)-c[count time and calls, and report a summary on exit]" \ + "(-C --demangle $hlp)"{-C,--demangle}'[decode low-level symbol names into user-level names]' \ + "(-D --debug $hlp)"{-D+,--debug=}'[enable debugging]:mask:(help 77)' \ + "($hlp)*-e+[modify which library calls to trace]:filter" \ + "($hlp)-f[trace child processes]" \ + "($hlp)*"{-F+,--config=}'[load alternate configuration file]:file:_files' \ + '(- 1 *)'{-h,--help}'[display help information]' \ + "(-c $hlp)-i[print instruction pointer at time of call]" \ + "(-l --library $hlp)"{-l+,--library=}'[only trace symbols implemented by specified library]:library:_files' \ + "($hlp)-L[don't display library calls]" \ + "(-c -n --indent $hlp)"{-n+,--indent=}'[specify indent for each level of call nesting]:spaces' \ + "(-o --output $hlp)"{-o+,--output=}'[write the trace output to specified file]:file:_files' \ + "(: $hlp)-p+[attach to the process with specified process ID and begin tracing]:process ID:_pids" \ + "(-c $hlp)-r[print relative timestamps]" \ + "(-c $hlp)-s+[specify the maximum string size to print]:maximum string size [32]" \ + "($hlp)-S[trace system calls as well as library calls]" \ + "(-c -ttt $hlp)-t[prefix each line of the trace with the time of day]" \ + "(-c -ttt -tt $hlp)-tt[prefix each line of the trace with the time of day including the microseconds]" \ + "(-c -tt -t $hlp)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]" \ + "(-c $hlp)-T[show the time spent in each call]" \ + "${root}-u+[run as specified user]:user:_users" \ + '(- 1 *)'{-V,--version}'[display version information]' \ + "($hlp)*-x+[modify which static functions to trace]:filter" \ + '(-):command name: _command_names -e' \ + '*::arguments:_normal' diff --git a/Completion/Linux/Command/_strace b/Completion/Linux/Command/_strace index d6dabfd24..cbf95d6c4 100644 --- a/Completion/Linux/Command/_strace +++ b/Completion/Linux/Command/_strace @@ -1,119 +1,101 @@ -#compdef strace +#compdef strace strace64 -# TODO: -# - make _sys_calls system-dependent -# - allow negated calls (e.g. -e!write) -_sys_calls () { - local expl - local -a sys_calls +local curcontext="$curcontext" state line root expl ret=1 +typeset -A opt_args - sys_calls=(_llseek _newselect _sysctl accept access acct - adjtimex afs_syscall alarm bdflush bind break brk cacheflush - capget capset chdir chmod chown chown32 chroot clone close connect - creat create_module delete_module dup dup2 execve exit fchdir - fchmod fchown fchown32 fcntl fcntl64 fdatasync flock fork fstat - fstat64 fstatfs fsync ftime ftruncate ftruncate64 get_kernel_syms - getcwd getdents getdents64 getegid getegid32 geteuid geteuid32 - getgid getgid32 getgroups getgroups32 getitimer getpagesize getpeername - getpmsg getpgid getpgrp getpid getppid getpriority getresgid getresgid32 - getresuid getresuid32 getrlimit getrusage getsid getsockname getsockopt - gettid gettimeofday getuid getuid32 gtty idle init_module ioctl ioperm - iopl ipc kill lchown lchown32 link listen lock lseek lstat lstat64 - madvise mincore mkdir mknod mlock mlockall mmap modify_ldt mount mprotect - mpx mremap msync munlock munlockall munmap nanosleep nfsservctl nice - oldfstat oldlstat oldolduname oldstat oldumount olduname open pause - personality phys pipe pivot_root poll prctl pread prof profil ptrace - putpmsg pwrite query_module quotactl read readahead readdir readlink - readv reboot recv recvfrom recvmsg rename rmdir rt_sigaction - rt_sigpending rt_sigprocmask rt_sigqueueinfo rt_sigreturn rt_sigsuspend - rt_sigtimedwait sched_get_priority_max sched_get_priority_min - sched_getparam sched_getscheduler sched_rr_get_interval sched_setparam - sched_setscheduler sched_yield security select sendfile send sendmsg sendto - setdomainname setfsgid setfsgid32 setfsuid setfsuid32 setgid setgid32 - setgroups setgroups32 sethostname setitimer setpgid setpriority setregid - setregid32 setresgid setresgid32 setresuid setresuid32 setreuid setreuid32 - setrlimit setsid setsockopt settimeofday setuid setuid32 setup sgetmask - shutdown sigaction sigaltstack signal sigpending sigprocmask sigreturn - sigsuspend socket socketcall socketpair ssetmask stat stat64 statfs stime - stty swapoff swapon symlink sync sysfs sysinfo syslog time times truncate - truncate64 ulimit umask umount uname unlink uselib ustat utime vfork vhangup - vm86 vm86old wait4 waitpid write writev) +(( EUID )) && root='!' - for t in ${(s:,:)${PREFIX}}; do - sys_calls=( ${sys_calls:#$t} ) - done - compset -P '*,' - _wanted sys_calls expl 'System calls' compadd -qS , -a sys_calls -} +_arguments -C -s \ + '-a+[align return values in a specific column]:column number [40]' \ + '(-c)-i[print instruction pointer at time of syscall]' \ + '-o+[write the trace output to the file]:output file:->file-pipe' \ + '-q[suppress messages about attaching, detaching etc.]' \ + '(-q)-qq[suppress messages about process exit status]' \ + '(-c)-r[print a relative timestamp upon entry to each system call]' \ + '-s+[specify the maximum string size to print]:maximum string size [32]' \ + '(-c -ttt)-t[prefix each line of the trace with the time of day]' \ + '(-c -ttt -tt)-tt[prefix each line of the trace with the time of day including the microseconds]' \ + '(-c -tt -t)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]' \ + '(-c)-T[show the time spent in system calls]' \ + '(-xx)-x[print all non-ASCII strings in hexadecimal string format]' \ + '(-x)-xx[print all strings in hexadecimal string format]' \ + '(-c -yy)-y[print paths associated with file descriptor arguments]' \ + '(-c -y)-yy[print protocol specific information associated with socket file descriptors]' \ + '(-C -i -k -r -ff -t -tt -ttt -T -y -yy)-c[count time, calls, and errors for each system call and report a summary]' \ + '(-c)-C[count time, calls, and errors for each system call and report a summary in addition to regular output]' \ + '-O+[overhead for tracing system calls]:overhead (microseconds)' \ + '-S+[sort the output of the histogram (-c option) by the specified criterion]:sort criterion:(time calls name nothing)' \ + '-w[summarise syscall latency]' \ + '*-e+[select events to trace or how to trace]:system call:->expressions' \ + '*-P+[trace only system calls accessing given path]:path:_files' \ + '-b+[detach from process on specified syscall]:syscall:(execve)' \ + '-f[trace child processes as they are created by currently traced processes]' \ + '(-c -C)-ff[write each process trace to . (when using -o ]' \ + '-D[run tracer as detached grandchild, keeping traced process as direct child of calling process]' \ + '-I+[when strace can be interrupted by signals]:interruptible:((1\:"no signals are blocked" 2\:"fatal signals are blocked while decoding syscall (default)" 3\:"fatal signals are always blocked (default with -o)" 4\:"fatal signals and SIGTSTP are always blocked"))' \ + '*-E+[set or remove exported environment variable]:variable:->envars' \ + "${root}-u+[run as specified user]:user:_users" \ + '(:)*-p+[attach to the process with specified process ID and begin tracing]:process ID:_pids' \ + '-d[show debug output of strace itself on standard error]' \ + '-v[print unabbreviated versions of environment, stat, termios, etc. calls]' \ + '(- 1 *)-h[display help information]' \ + '(- 1 *)-V[display version information]' \ + '(-c)-k[obtain stack trace between each syscall]' \ + '(-):command name: _command_names -e' \ + '*::arguments:_normal' && ret=0 -_sets () { - _alternative \ - 'special:special values:(all none)' \ - 'calls::_sys_calls' -} +case $state in + expressions) + _values -C -S = 'qualifying expression' \ + 'trace[trace specified set of system calls only]:system calls:->syscalls' \ + 'abbrev[abbreviate the output from printing each member of large structures]:system call:_sequence _sys_calls -a -n' \ + 'verbose[dereference structures for the specified set of system calls]:system call:_sequence _sys_calls -a -n' \ + 'raw[print raw, undecoded arguments for the specified set of system calls]:system call:_sequence _sys_calls -a -n' \ + 'signal[trace only the specified subset of signals]:signal:_sequence _signals -s -M "B\:!="' \ + 'read[perform a full hex and ASCII dump of all the data read from listed file descriptors]:file descriptor:_sequence _file_descriptors' \ + 'write[perform a full hex and ASCII dump of all the data written to listed file descriptors]:file descriptor:_sequence _file_descriptors' && ret=0 + if [[ $words[CURRENT] != *=* || $state = syscalls ]]; then + local dedup sets suf="-qS," + compset -P '!' + dedup=( ${(Ms.,.)PREFIX##*,} ${(Ms.,.)SUFFIX%%,*} ) + compset -S ',*' || suf="" + compset -P '*,' + sets=( + 'file:trace all system calls which take a file name as an argument' + 'process:trace all system calls which involve process management' + 'network:trace all the network related system calls' + 'signal:trace all signal related system calls' + 'ipc:trace all IPC related system calls' + 'desc:trace all file descriptor related system calls' + 'memory:trace all memory mapping related system calls' + ) + _alternative \ + "related system call:sets: _describe -t traces 'related system call' sets -F dedup $suf" \ + "system call:syscalls:_sys_calls -a -n $suf -F dedup" && ret=0 + fi + ;; + file-pipe) + compset -P '\\' + if (( ! $+opt_args[-ff] )) && compset -P '(!|\|)'; then + compset -q + if (( CURRENT == 1 )); then + _command_names -e && ret=0 + else + _normal && ret=0 + fi + else + _files && ret=0 + fi + ;; + envars) + if [[ -prefix *=* ]]; then + compstate[parameter]="${PREFIX%%\=*}" + compset -P 1 '*=' + _value && ret=0 + else + _parameters -qS= -g "*export*" && ret=0 + fi + ;; +esac -_traces () { - local expl - traces=('file:trace all system calls which take a file name as an argument' - 'process:trace all system calls which involve process management' - 'network:trace all the network related system calls' - 'signal:trace all signal related system calls' - 'ipc:trace all IPC related system calls' - 'desc:trace all file descriptor related system calls') - compset -P '*,' - _describe -t traces 'Related system calls' traces -qS , -} - -_traces_sets () { - _alternative \ - 'traces::_traces' \ - 'sets::_sets' -} - -_expression () { - _values -S = "Qualifying expression" \ - 'trace[trace specified set of system calls only]:system calls:_traces_sets' \ - 'abbrev[abbreviate the output from printing each member of large structures]:system calls:_sets' \ - 'verbose[dereference structures for the specified set of system calls]:system calls:_sets' \ - 'raw[print raw, undecoded arguments for the specified set of system calls]:system calls:_sets' \ - 'signal[trace only the specified subset of signals]:signal:{compset -P "*,"; _signals -s -qS ,}' \ - 'read[perform a full hex and ASCII dump of all the data read from listed file descriptors]:file descriptors:{compset -P "*,"; _file_descriptors -qS ,}' \ - 'write[perform a full hex and ASCII dump of all the data written to listed file descriptors]:file descriptors:{compset -P "*,"; _file_descriptors -qS ,}' - if [[ -z "$words[CURRENT]" || -n "${words[CURRENT]:#*=*}" ]]; then - _traces_sets - fi -} - -_arguments \ - '()-c[count time, calls, and errors for each system call and report a summary]' \ - '()-C[count time, calls, and errors for each system call and report a summary in addition to regular output]' \ - '-d[show some debugging output of strace itself on the standard error]' \ - '-D[run tracer as detached grandchild, keeping traced process as direct child of calling process]' \ - '-f[trace child processes as they are created by currently traced processes]' \ - '-ff[write each process trace to . (when using -o ]' \ - '(-c -d -f -ff -i -q -r -t -tt -ttt -T -v -V -x -xx -a -e -o -O -p -s -S -u -E)-h[print help]' \ - '-i[print the instruction pointer at the time of the system call]' \ - '-q[suppress messages about attaching, detaching etc.]' \ - '-r[print a relative timestamp upon entry to each system call]' \ - '(-ttt)-t[prefix each line of the trace with the time of day]' \ - '(-ttt -tt)-tt[prefix each line of the trace with the time of day including the microseconds]' \ - '(-tt -t)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]' \ - '-T[show the time spent in system calls]' \ - '-y[print paths associated with file descriptor arguments]' \ - '-v[print unabbreviated versions of environment, stat, termios, etc. calls]' \ - '(-c -d -f -ff -h -i -q -r -t -tt -ttt -T -v -x -xx -a -e -o -O -p -s -S -u -E)-V[print the version number of strace]' \ - '(-xx)-x[print all non-ASCII strings in hexadecimal string format]' \ - '(-x)-xx[print all strings in hexadecimal string format]' \ - '-I+[when strace can be interrupted by signals]:interruptible:((1\:"no signals are blocked" 2\:"fatal signals are blocked while decoding syscall (default)" 3\:"fatal signals are always blocked (default if '\''-o FILE PROG'\''" 4\:"fatal signals and SIGTSTP are always blocked"))' \ - '*-P+[trace only system calls accessing given path]:path:_files' \ - '-a+[align return values in a specific column (default 40)]:column number' \ - '*-e+[select events to trace or how to trace]:system call:_expression' \ - '-o+[write the trace output to the file]:output file:_files' \ - '-O+[overhead for tracing system calls]:overhead microseconds' \ - '(:)-p+[attach to the process with specified process ID and begin tracing]:process ID:_pids' \ - '-s+[specify the maximum string size to print (default 32)]:maximum string size' \ - '-S+[sort the output of the histogram (-c option) by the specified criterion]:sort by:(time calls name nothing)' \ - '-u+[run as specified user]:user:_users' \ - '*-E+[remove variable from the inherited list of environment or define a value]:variable:_printenv' \ - '(-):command name: _command_names -e' \ - '*::arguments:_normal' +return ret diff --git a/Completion/Unix/Command/_truss b/Completion/Unix/Command/_truss new file mode 100644 index 000000000..656c94244 --- /dev/null +++ b/Completion/Unix/Command/_truss @@ -0,0 +1,76 @@ +#compdef truss + +local curcontext="$curcontext" state line expl ret=1 +typeset -A opt_args +local args faults + +args=( + '(-c)-a[show argument strings with exec system call]' + '(-a -d -D -e -E -l -r -v -w -x)-c[count traced system calls, signals etc]' + '(-c)-d[include timestamps in output]' + '(-c)-D[include delta timestamps in output]' + '(-c)-e[show environment strings with exec system call]' + '-f[follow child processes created after a fork]' + '-o+[specify trace output file]:output file:_files' +) + +case $OSTYPE in + aix*|solaris*) + args+=( + '(-c)-E[include delta timestamps of time spent within the system call]' + "-i[don't display interruptible sleeping system calls]" + '(-c)-l[include LWP id in each line of output]' + '-m+[specify machine faults to trace]: :->faults' + '(-c)-r+[show full contents of the I/O buffer for each read()]:file descriptor' + '-s+[specify signals to trace]:signal:_sequence _signals -M "B\:!="' + '-S+[specify signals at which process should be stopped and abandoned]:signal:_sequence _signals -M "B\:!="' + '-t+[specify system calls to trace or exclude]:system call:_sequence _sys_calls -a -M "B\:!="' + '-T+[specify system calls at which process should be stopped and abandoned]:system call:_sequence _sys_calls -a -M "B\:!="' + '*-u+[user-level function call tracing]: :->userfuncs' + '-U+[specify user-level functions at which process should be stopped and abandoned]: :->userfuncs' + '(-c)-v+[enable verbose output of structures for specified system calls]:system call:_sequence _sys_calls -a -M "B\:!="' + '(-c)-w+[show full contents of the I/O buffer for each write()]:file descriptor' + '(-c)-x+[enable raw output of structures for specified system calls]:system call:_sequence _sys_calls -a' + '-p[trace specified existing processes]' + ) + ;; + dragonfly*|freebsd*) + args+=( + '-s+[specify the maximum string size to print]:maximum string size [32]' + "(-c)-S[don't report signals received by the process]" + '(*)-p[trace specified existing processes]:pid:_pids' + ) + ;; +esac + +_arguments -C -s : $args \ + '*::arguments:->args' && ret=0 + +case $state in + faults) + faults=( all ${${${(M)${(f)"$(/dev/null + _sequence _wanted faults expl fault compadd - -M 'B:!=' -M 'B:[Ff][Ll][Tt]=' -M 'm:{a-z}={A-Z}' -a faults && ret=0 + ;; + args) + if [[ $OSTYPE = solaris* ]] && (( $+opt_args[-p] )); then + _pids && ret=0 + elif (( CURRENT == 1 )); then + _command_names -e && ret=0 + else + _normal && ret=0 + fi + ;; + userfuncs) + if [[ -prefix *: ]]; then + _message -e functions function + else + compset -P '*,' + compset -S '[,:]*' + _description -x libs expl lib + compadd "$expl[@]" -S '' lib && ret=0 + compadd "$expl[@]" -qS, a.out && ret=0 + fi + ;; +esac + +return ret diff --git a/Completion/Unix/Type/_sys_calls b/Completion/Unix/Type/_sys_calls new file mode 100644 index 000000000..bd9b34f70 --- /dev/null +++ b/Completion/Unix/Type/_sys_calls @@ -0,0 +1,20 @@ +#autoload + +# Options: +# +# -a add "all" as an additional match +# -n add "none" as an additional match + +local expl all none +local ifile=/usr/include/sys/syscall.h +local -au syscalls + +zparseopts -D -K -E a=all n=none + +[[ $OSTYPE = linux* ]] && ifile=/usr/include/bits/syscall.h +syscalls=( ${${${(M)${(f)"$(<$ifile)"}:#?define[[:blank:]]##SYS_*}#*[[:blank:]]SYS_}%%[[:blank:]]*} ) 2>/dev/null +[[ -n $all ]] && syscalls+=( all ) +[[ -n $none ]] && syscalls+=( none ) + +_description syscalls expl 'system call' +compadd "$@" "$expl[@]" -a syscalls -- cgit v1.2.3 From 9991707b6bbdfe8940b2098128d85f61a966d758 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sun, 17 Jul 2016 12:37:29 +0200 Subject: 38868: update completions for new options on FreeBSD --- ChangeLog | 10 +++++ Completion/BSD/Command/_bsdconfig | 12 +++++- Completion/BSD/Command/_fetch | 69 ++++++++++++++++++++-------------- Completion/BSD/Command/_freebsd-update | 11 ++++-- Completion/BSD/Command/_fstat | 11 ++---- Completion/BSD/Command/_gstat | 6 +-- Completion/BSD/Command/_jexec | 3 +- Completion/BSD/Command/_kld | 11 ++++-- Completion/BSD/Command/_procstat | 37 ++++++++++-------- Completion/BSD/Command/_sysrc | 53 ++++++++++++++++---------- Completion/BSD/Command/_systat | 3 +- Completion/Unix/Command/_cat | 3 ++ Completion/Unix/Command/_sysctl | 22 ++++++++++- Completion/Unix/Command/_vmstat | 26 ++++++------- Completion/Unix/Command/_zfs | 34 +++++------------ Completion/Unix/Type/_zfs_dataset | 6 +-- 16 files changed, 189 insertions(+), 128 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index ac3a3e001..4945c1a02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2016-07-17 Oliver Kiddle + * 38868: Completion/BSD/Command/_freebsd-update, + Completion/BSD/Command/_bsdconfig, Completion/BSD/Command/_fetch, + Completion/BSD/Command/_fstat, Completion/BSD/Command/_gstat, + Completion/BSD/Command/_jexec, Completion/BSD/Command/_kld, + Completion/BSD/Command/_procstat, Completion/BSD/Command/_sysrc, + Completion/BSD/Command/_systat, Completion/Unix/Command/_cat, + Completion/Unix/Command/_sysctl, Completion/Unix/Command/_vmstat, + Completion/Unix/Command/_zfs, Completion/Unix/Type/_zfs_dataset: + update completions for new options on FreeBSD + * 38867: Completion/Linux/Command/_ltrace, Completion/Linux/Command/_strace, Completion/Unix/Command/_truss, Completion/Unix/Type/_sys_calls: update strace completion diff --git a/Completion/BSD/Command/_bsdconfig b/Completion/BSD/Command/_bsdconfig index 8c7597e0f..f88255575 100644 --- a/Completion/BSD/Command/_bsdconfig +++ b/Completion/BSD/Command/_bsdconfig @@ -2,6 +2,7 @@ local -a shortcuts shortcuts=( + api 'console:utilities to customize the behavior of the system console' 'defaultrouter:default router/gateway' 'diskmgmt:manage disk partitions and/or labels using sade(8)' @@ -12,6 +13,7 @@ shortcuts=( 'groupedit:edit/view groups' 'groupmgmt:utilities to add/change/view/delete group accounts' 'hostname:set hostname/domainname' + includes 'kern_securelevel:set kern.securelevel variable' 'mouse:utilities for configuring, exploring, and enabling console mouse support' 'mouse_disable:disable mouse support' @@ -43,13 +45,19 @@ shortcuts=( 'userdel:delete users' 'useredit:edit/view users' 'usermgmt:utilities to add/edit/view/delete user accounts' + vt_font + vt_keymap + vt_repeat + vt_saver + vt_screenmap + vt_ttys ) _arguments -s -w -A '-*' : \ '-d[debug mode]' \ '-D[send debug info to file]: :{ compset -P 1 +; _files }' \ '-f[load file as script then exit]: : _files' \ - '-h[print usage then exit]' \ + '-h[display help information]' \ '-S[secure X11 mode]' \ '-X[use Xdialog(1)]' \ - '1:bsdconfig(8) menus:(( $shortcuts ))' + '1:bsdconfig(8) menu:(( $shortcuts ))' diff --git a/Completion/BSD/Command/_fetch b/Completion/BSD/Command/_fetch index 3136763a0..ac1264bf8 100644 --- a/Completion/BSD/Command/_fetch +++ b/Completion/BSD/Command/_fetch @@ -1,30 +1,43 @@ #compdef fetch -# Deprecated arguments are removed from the completion -_arguments -s \ - '-1[stop and return exit code 0 at the first successfully retrieved file]' \ - '-4[forces fetch to use IPv4 addresses only]' \ - '-6[forces fetch to use IPv6 addresses only]' \ - '-A[do not automatically follow "temporary" (302) redirects]' \ - '-a[automatically retry the transfer upon soft failures]' \ - '-B[specify the read buffer size in bytes]:bytes:' \ - '-d[use a direct connection even if a proxy is configured]' \ - '-F[in combination with the -r flag, forces a restart]' \ - '-l[if the target is a file-scheme URL, make a symbolic link to the target]' \ - '-M' \ - '-m[mirror mode]' \ - '-N[use file instead of ~/.netrc to look up login names and pass- words for FTP sites]' \ - '-n[do not preserve the modification time]' \ - '-o[set the output file name]:file:_files' \ - '-P' \ - '-p[use passive FTP]' \ - '-q[quiet mode]' \ - '-R[do not delete the output file in any circumstances]' \ - '-r[restart a previously interrupted transfer]' \ - '-S[require the file size reported by the server to match the specified value]' \ - '-s[print the size in bytes, without fetching it]' \ - '-T[set timeout value]:seconds:' \ - '-U[when using passive FTP, allocate the port for the data connection from the low port range]' \ - '-v[increase verbosity level]' \ - '-w[wait successive retries]:seconds:' \ - '*:URL to fetch:_urls' +# Deprecated arguments are prefixed with ! so they aren't listed but their arguments are completed +_arguments -s -S \ + '(-1 --one-file)'{-1,--one-file}'[stop and return exit code 0 at the first successfully retrieved file]' \ + '(-4 --ipv4-only)'{-4,--ipv4-only}'[forces fetch to use IPv4 addresses only]' \ + '(-6 --ipv6-only)'{-6,--ipv6-only}'[forces fetch to use IPv6 addresses only]' \ + '(-A --no-redirect)'{-A,--no-redirect}"[don't automatically follow "temporary" (302) redirects]" \ + '(-a --retry)'{-a,--retry}'[automatically retry the transfer upon soft failures]' \ + '(-B --buffer-size)'{-B+,--buffer-size=}'[specify the read buffer size in bytes]:buffer size (bytes)' \ + '--bind-address=[specify address to which outgoing connections will be bound]:host:_hosts' \ + '--ca-cert=[specify certificate bundle containing trusted CA certificates]:file:_files' \ + '--ca-path=[specify directory containing trusted CA hashes]:path:_directories' \ + '--cert=[specify PEM encoded client key for authentication]:file:_files -g "*.pem(-.)"' \ + '--crl=[specify certificate revocation list file]:file:_files' \ + '(-d --direct)'{-d,--direct}'[use a direct connection even if a proxy is configured]' \ + '(-F --force-restart)'{-F,--force-restart}'[in combination with the -r flag, forces a restart]' \ + '(-i --if-modified-since)'{-i+,--if-modified-since=}'[only retrieve if remote file newer than specified local file]:file:_files' \ + '--key=[specify PEM encoded client key]:key file:_files -g "*.pem(-.)"' \ + '(-l --symlink)'{-l,--symlink}'[if the target is a file-scheme URL, make a symbolic link to the target]' \ + '-M' \ + '(-m --mirror -r --restart)'{-m,--mirror}'[mirror mode]' \ + '(-N --netrc)'{-N+,--netrc=}'[use file instead of ~/.netrc to look up login names and pass- words for FTP sites]' \ + '(-n --no-mtime)'{-n,--no-mtime}"[don't preserve the modification time]" \ + '--no-passive[force FTP code to use active mode]' \ + '--no-proxy=[hosts on which to disable proxoes]:host:_sequence _hosts' \ + '--no-sslv3' '--no-tlsv1' --no-verify-hostname --no-verify-peer \ + '(-o --output)'{-o+,--output=}'[set the output file name]:file:_files' \ + '-P' \ + '(-p --passive)'{-p,--passive}'[use passive FTP]' \ + '--referer=:URL:_urls' \ + '(-q --quiet)'{-q,--quiet}'[quiet mode]' \ + '(-R --keep-output)'{-R,--keep-output}"[don't delete the output file in any circumstances]" \ + '(-r --restart -m --mirror)'{-r,--restart}'[restart a previously interrupted transfer]' \ + '(-S --require-size)'{-S+,--require-size=}'[require the file size reported by the server to match the specified value]' \ + '(-s --print-size)'{-s,--print-size}'[print the size in bytes, without fetching it]' \ + '(-T --timeout)'{-T+,--timeout=}'[set timeout value]:seconds:' \ + '(-U --passive-portrange-default)'{-U,--passive-portrange-default}'[when using passive FTP, allocate the port for the data connection from the low port range]' \ + '--user-agent=:user agent' \ + '(-v --verbose)'{-v,--verbose}'[increase verbosity level]' \ + '(-w --retry-delay)'{-w+,--retry-delay=}'[wait successive retries]:delay (seconds)' \ + '!(*)-h+:host:_hosts' '!(*)-f+:file:_files' '!(*)-c+:remote directory:_directories' \ + '*:URL to fetch:_urls' diff --git a/Completion/BSD/Command/_freebsd-update b/Completion/BSD/Command/_freebsd-update index 11235bad0..36b4a015c 100644 --- a/Completion/BSD/Command/_freebsd-update +++ b/Completion/BSD/Command/_freebsd-update @@ -7,14 +7,17 @@ flags=( '(install rollback)upgrade[fetch files necessary for upgrading to a new release]' '(upgrade rollback)install[install the most recently fetched updates or upgrade]' '(upgrade install)rollback[uninstall the most recently installed updates]' + 'IDS[compare the system against an index of "known good" files]' ) -_arguments -s \ +_arguments \ '-b[operate on a system mounted at basedir]:basedir:_files -/' \ '-d[store working files in workdir]:workdir:_files -/' \ '-f[read configuration options from conffile]:conf file:_files' \ - '-k[trust an RSA key with SHA256 of KEY]:RSA key:' \ - '-r[specify the new release]:new release:' \ + '-F[force freebsd-update fetch to proceed where it normally would not]' \ + '-k[trust an RSA key with SHA256 of KEY]:RSA key' \ + '-r[specify the new release]:new release' \ '-s[fetch files from the specified server or server pool]:server:_hosts' \ - '-f[mail output of cron command, if any, to address]:address:' \ + '-t[mail output of cron command, if any, to address]:address' \ + '--currently-running[assume specified release as current]:release' \ ':command:_values -S " " -w "commands" $flags[@]' diff --git a/Completion/BSD/Command/_fstat b/Completion/BSD/Command/_fstat index 3e8d61733..5487e6c0f 100644 --- a/Completion/BSD/Command/_fstat +++ b/Completion/BSD/Command/_fstat @@ -1,15 +1,12 @@ #compdef fstat -local pids -pids=(${${${(f)"$(/usr/bin/procstat -ah)"}/[[:space:]]#/}/[[:space:]]*[[:space:]](ELF[[:digit:]]#[[:space:]]|-[[:space:]]#)/:}) - _arguments -s \ '-f[restrict examination to files open in the same file systems as the named file arguments]' \ -'-M[extract values associated with the name list from the specified core]:core:_files' \ -'-N[extract the name list from the specified system]:system:' \ +'-M+[extract values associated with the name list from the specified core]:core:_files' \ +'-N+[extract the name list from the specified system]:system' \ '-m[include memory-mapped files in the listing]' \ '-n[numerical format]' \ -'-p[report all files open by the specified process]:process id:(($pids))' \ -'-u[report all files open by the specified user]:user:_users' \ +'-p+[report all files open by the specified process]:process id:_pids' \ +'-u+[report all files open by the specified user]:user:_users' \ '-v[verbose mode]' \ '*:files:_files' diff --git a/Completion/BSD/Command/_gstat b/Completion/BSD/Command/_gstat index 55b7db74d..7baaf0d62 100644 --- a/Completion/BSD/Command/_gstat +++ b/Completion/BSD/Command/_gstat @@ -1,11 +1,11 @@ #compdef gstat -_arguments -s -w : \ +_arguments -s : \ '-a[only display providers that are at least 0.1% busy]' \ '-b[batch mode]' \ '-c[enable the display geom(4) consumers]' \ '-d[enable the display delete operations]' \ - '-f[filter by regex]:regex' \ + '-f+[filter by regex]:regex' \ '-o[enable the display for other operations]' \ - '-I[display refresh rate]:interval' \ + '-I+[display refresh rate]:interval (ms)' \ '-p[only display physical providers]' diff --git a/Completion/BSD/Command/_jexec b/Completion/BSD/Command/_jexec index f065ea1e0..279812bbc 100644 --- a/Completion/BSD/Command/_jexec +++ b/Completion/BSD/Command/_jexec @@ -9,7 +9,8 @@ _jexec_normal() { } _jexec() { - _arguments -s -w -A "-*" : \ + _arguments -s -S -A "-*" : \ + '-l[execute in a clean environment]' \ '(-U)-u[host environment user whom command runs as]:host user:_users' \ '(-u)-U[jail environment user whom command runs as]:jail user:_users' \ '1:jail:_jails' \ diff --git a/Completion/BSD/Command/_kld b/Completion/BSD/Command/_kld index 34f26f1e9..94528955c 100644 --- a/Completion/BSD/Command/_kld +++ b/Completion/BSD/Command/_kld @@ -24,14 +24,17 @@ _kld() { unset _cache_sysctlvars case "$service" in - kldload) - _arguments -s \ + kldload) + _arguments -s -S -A "-*" \ + "-n[don't try to load module if already loaded]" '-v[be verbose]' \ + '-q[silence any extraneous warnings]' \ '*:module to load:_kld_module' ;; - kldunload) - _arguments -s \ + kldunload) + _arguments -s -S -A "-*" \ + '-f[force the unload]' \ '-v[be verbose]' \ '(-n)-i:module id to unload:_kld_unload_id' \ '(-i)-n:module to unload:_kld_unload' \ diff --git a/Completion/BSD/Command/_procstat b/Completion/BSD/Command/_procstat index f8bc54290..e16057635 100644 --- a/Completion/BSD/Command/_procstat +++ b/Completion/BSD/Command/_procstat @@ -1,17 +1,24 @@ #compdef procstat -local pids -#get list of pids and associated process name as comment -pids=(${${${(f)"$(/usr/bin/procstat -ah)"}/[[:space:]]#/}/[[:space:]]*[[:space:]](ELF[[:digit:]]#[[:space:]]|-[[:space:]]#)/:}) - -_arguments -s \ -'-b[display binary information for the process]' \ -'-c[display command line arguments for the process]' \ -'-f[display file descriptor information for the process]' \ -'-k[display the stacks of kernel threads in the process]' \ -'-s[display security credential information for the process]' \ -'-t[display thread information for the process]' \ -'-v[display virtual memory mappings for the process]' \ -'-h[suppress table headers]' \ -'-a[all processes]' \ -':process id:(($pids))' +_arguments -s -A "-*" -S \ + '-b[show binary information]' \ + '-c[show command line arguments]' \ + '-e[show environment variables]' \ + '-f[show file descriptor information]' \ + '-i[show signal pending and disposition]' \ + '-k[show stacks of kernel threads]' \ + '-l[show resource limits]' \ + '-r[show resource usage]' \ + '-s[show security credential information]' \ + '-S[show cpuset information]' \ + '-t[show thread information]' \ + '-v[show virtual memory mappings]' \ + '-x[show ELF auxiliary vector]' \ + '-h[suppress table headers]' \ + '(1)-a[all processes]' \ + '-w+[repeat information after specified interval]:delay (seconds)' \ + '-C[print additional capability information for file descriptors]' \ + '-H[statistics per-thread rather than per-process]' \ + '-n[numeric form for signals]' \ + '1::core file:_path_files -g "*core*(-.)"' \ + '*:process id:_pids' diff --git a/Completion/BSD/Command/_sysrc b/Completion/BSD/Command/_sysrc index d8bc4ef0e..651c18b89 100644 --- a/Completion/BSD/Command/_sysrc +++ b/Completion/BSD/Command/_sysrc @@ -1,39 +1,50 @@ #compdef sysrc + _sysrc_caching_policy() { local -a oldp oldp=( "$1"(Nm+1) ) (( $#oldp )) } - _sysrc() { - _arguments -A '-*' : \ + local curcontext="$curcontext" state line ret=1 + typeset -A opt_args + local -a rc_conf_vars + + _arguments -C -s -A '-*' : \ + '(-l)-e[print variables as sh(1) compatible syntax]' \ + '-E[list only existing files]' \ + '(-l)-q[quiet mode]' \ + '(-L)-s+[process additional rc.conf.d entries for specified service name]:service name:_services' \ + '(-L)*-f+[operate on specified file(s), not \`rc_conf_files'\'']: : _files' \ + '(-l)-v[verbose mode]' \ + '*:configuration variable:->confvars' \ + - set \ + '(-A)-a[list all non-default configuration variables]' \ + '(-a)-A[list all configuration variables]' \ '-c[check only, return success if vars are set]' \ '-d[print variable(s) description]' \ '-D[print default value(s) only]' \ - '-e[print variables as sh(1) compatible syntax]' \ - '*-f[operate on specified file(s), not \`rc_conf_files'\'']: : _files' \ '-F[print only the last rc.conf(5) file each directive is in]' \ - '-h[print short usage message]' \ - '--help[print full usage message]' \ + '(- *)-h[print short usage message]' \ + '(- *)--help[print full usage message]' \ '-i[ignore unknown variables]' \ - '-j[jail to operate within]:jails:_jails' \ + '-j+[jail to operate within]:jails:_jails' \ '-n[print only variable values]' \ '-N[print only variable names]' \ - '-q[quiet mode]' \ - '-R[specify an alternative root]:alternative root:_files -/' \ - '-v[verbose mode]' \ - '--version[print version information]' \ + '-R+[specify an alternative root]:alternative root:_files -/' \ + '(- *)--version[print version information]' \ '-x[remove specified variables from specified file(s)]' \ - '*:configuration variable:->confvars' \ - - set1 \ - '-a[list all non-default configuration variables]' \ - - set2 \ - '-A[list all configuration variables]' + - lists \ + '(-e -q -v)-l[list config files used at startup]' \ + - lista \ + '(-s -f)-L[list all configuration files including rc.conf.d entries]' && ret=0 if [[ $state == confvars ]]; then - local k v opt curcontext="${curcontext%:*}:values"; local -a rc_conf_vars - if [[ -prefix *=* ]]; then + local k v opt + if (( $+opt_args[lista--L] )); then + _services && ret=0 + elif [[ -prefix *=* ]]; then # do you really want to go down this hole? _message -e values value else @@ -65,13 +76,15 @@ _sysrc() { if (( $#rc_conf_vars )); then if [[ $opt == N ]]; then - _values -w -C variable ${^rc_conf_vars%%\[*}'::value' + _values -w -C variable ${^rc_conf_vars%%\[*}'::value' && ret=0 else - _values -w -C variable ${^rc_conf_vars}'::value' + _values -w -C variable ${^rc_conf_vars}'::value' && ret=0 fi fi fi fi + + return ret } _sysrc "$@" diff --git a/Completion/BSD/Command/_systat b/Completion/BSD/Command/_systat index c8348c7f7..35b842188 100644 --- a/Completion/BSD/Command/_systat +++ b/Completion/BSD/Command/_systat @@ -1,12 +1,13 @@ #compdef systat -local -a screens args opts +local -a screens opts local pre case $OSTYPE in freebsd*) pre=- screens=( 'pigs:processes consuming the most CPU time' + 'sctp:SCTP statistics' icmp{6,}':ICMP statistics' ip{6,}':IP and UDP statistics' 'tcp:TCP statistics' diff --git a/Completion/Unix/Command/_cat b/Completion/Unix/Command/_cat index e223d90d9..57b197038 100644 --- a/Completion/Unix/Command/_cat +++ b/Completion/Unix/Command/_cat @@ -30,6 +30,9 @@ elif [[ "$OSTYPE" == (freebsd|dragonfly|darwin)* ]]; then '-v[display non-printing chars as ^X or M-a]' '(-)*:files:_files' ) + [[ $OSTYPE = freebsd* ]] && args+=( + '-l[set a lock on the stdout file descriptor]' + ) else # POSIX reqires '-u', and most OSes may support '-n' diff --git a/Completion/Unix/Command/_sysctl b/Completion/Unix/Command/_sysctl index 9d9e8b968..cf88c3dc1 100644 --- a/Completion/Unix/Command/_sysctl +++ b/Completion/Unix/Command/_sysctl @@ -1,21 +1,39 @@ #compdef sysctl +local -a args + case $OSTYPE in + freebsd<10->.*) + args+=( + '-f+[specify file of name/value pairs to process first]:file:_files' + '-T[display only variables that are setable via loader]' + '-W[display only writable variables that are not statistical]' + ) + ;| + dragonfly*|freebsd<8->.*) + args+=( "-i[silently exit if variable doesn't exist]" ) + ;| *freebsd<5->.*|freebsd4.[4-9]*) local -a sysctlvars sysctlvars=( $(_call_program sysctl-variables sysctl -aN) ) - _arguments -s -A "-*" \ + _arguments -s -S -A "-*" $args \ + '(-a -o *)-A[equivalent to -o -a (for compatibility)]' \ '(*)-a[list all]' \ '-b[binary output]' \ + '-d[print the description of the variable instead of its value]' \ + '(-N -n)-e[separate name and value with =]' \ + '-h[format output for human readability]' \ '(-n)-N[show only variable names]' \ '(-N)-n[show only variable values]' \ '(-x)-o[show opaques as well (values suppressed)]' \ + '-q[suppress some warnings]' \ + '(* -o)-X[equivalent to -x -a (for compatibility)]' \ '(-o)-x[show opaques as well (entire values)]' \ '(-a)*:sysctl variable:_multi_parts -i . sysctlvars' ;; freebsd[0-4].*|darwin*|dragonfly*) : ${(A)_cache_sysctlvars:=${${$(sysctl -A 2>/dev/null):#[^a-z]*}%%:*}} - _arguments -s -A "-*" \ + _arguments -s -A "-*" $args \ '(-w -X *)-a[list all]' \ '(-w -X *)-A[show all opaques (values suppressed)]' \ '(-w)-b[binary output]' \ diff --git a/Completion/Unix/Command/_vmstat b/Completion/Unix/Command/_vmstat index 02fa6be64..7082cbbd5 100644 --- a/Completion/Unix/Command/_vmstat +++ b/Completion/Unix/Command/_vmstat @@ -18,40 +18,38 @@ case $OSTYPE in '1:delay' '2:count' ) ;; - freebsd*) + freebsd*|openbsd*) specs=( - '-a[include statistics about all interrupts]' '-c[number of times to refresh the display]:count' '-f[report on the number fork syscalls since boot and pages of virtual memory for each]' - '-h[human readable memory columns output]' - '-H[scriptable memory columns output]' '-i[report the number of interrupts taken by devices since boot]' '-M[source file to extract values associated with the name list from]:core:_files' '-N[source file to extract the name list from]:system:_files' + '-w[specify delay between each display]:delay (seconds)' + '*:disk:_files' + ) + ;| + freebsd*) + specs+=( + '-a[include statistics about all interrupts]' + '-h[human readable memory columns output]' + '-H[scriptable memory columns output]' '-m[report on the usage of kernel dynamic memory allocated using malloc(9) by type]' '-n[change the maximum number of disks to display]:number of disks to display' + '-o[list virtual memory objects]' '-P[report per-cpu system/user/idle cpu statistics]' '-p[specify which types of devices to display]: :->devices' '-s[display the contents of the SUM structure]:sum' - '-w[delay N seconds between each display]:delay' '-z[report on memory used by the kernel zone allocator, uma(9), by zone]' - '*:disks:_files' ) ;; openbsd*) - specs=( - '-c[number of times to refresh the display]:count' - '-f[report on the number fork syscalls since boot and pages of virtual memory for each]' - '-i[report the number of interrupts taken by devices since boot]' - '-M[source file to extract values associated with the name list from]:core:_files' + specs+=( '-m[report usage of kernel dynamic memory listed first by size of allocation then type of usage]' - '-N[source file to extract the name list from]:system:_files' '-s[display the contents of the UVMEXP structure]:uvmexp' '-t[report on the number of page in and page reclaims since boot]' '-v[print more verbose information]' - '-w[delay N seconds between each display]:delay' '-z[include statistics about all interrupts]' - '*:disks:_files' ) ;; esac diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs index f3869da43..553996da0 100644 --- a/Completion/Unix/Command/_zfs +++ b/Completion/Unix/Command/_zfs @@ -149,7 +149,7 @@ _zfs() { "atime:value:(on off)" "canmount:value:(on off noauto)" "checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)" - "compression:value:(on off lzjb gzip gzip-{1..9} zle)" + "compression:value:(on off lzjb lz4 gzip gzip-{1..9} zle)" "copies:value:(1 2 3)" "dedup:value:(on off verify sha256 sha256,verify)" "devices:value:(on off)" @@ -247,7 +247,7 @@ _zfs() { ':filesystem/volume/snapshot:_zfs_dataset -t fs -t vol' ;; - ("snapshot") + (snap(|shot)) _arguments -A "-*" \ '-r[Recursively snapshot all descendant datasets]' \ '*-o[Set property]:property:_values -s , "property" $create_properties' \ @@ -418,30 +418,16 @@ _zfs() { ("allow") _arguments -A "-*" \ - - set1 \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' \ - - set2 \ - '(-g)-u[User]:user:_users' \ - '(-u)-g[Group]:group:_groups' \ - '-l[Allow for named dataset]' \ - '-d[Allow for descendent datasets]' \ + '(1 -g -e -c -s)-u[delegate to user]:user:_users' \ + '(1 -u -e -c -s)-g[delegate to group]:group:_groups' \ + '(1 -g -u -c -s)-e[delegate to everyone]' \ + '(1 -u -g -e -l -d -s)-c[set permissions for newly-created descendant filesystems]' \ + '(1 -u -g -e -l -d -c)-s[define or modify permission sets]:permission set' \ + '(1 -c -s)-l[allow for named dataset]' \ + '(1 -c -s)-d[allow for descendent datasets]' \ + '1::filesystem/volume:_zfs_dataset -t fs -t vol' \ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ ':filesystem/volume:_zfs_dataset -t fs -t vol' \ - - set3 \ - '-e[Everyone]' \ - '-l[Allow for named dataset]' \ - '-d[Allow for descendent datasets]' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' \ - - set4 \ - '-c[Create-time permissions]' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' \ - - set5 \ - '-s[Define or modify permission sets]' \ - ':setname:' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' ;; ("unallow") diff --git a/Completion/Unix/Type/_zfs_dataset b/Completion/Unix/Type/_zfs_dataset index 5fa3e9e50..6c625e9ec 100644 --- a/Completion/Unix/Type/_zfs_dataset +++ b/Completion/Unix/Type/_zfs_dataset @@ -58,14 +58,14 @@ if [[ ${#rdst} -gt 0 ]]; then fi if [[ -n $type[(r)clone] ]]; then - datasetlist=( ${="$(zfs list -H -o name,origin -t filesystem | awk "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} ) + datasetlist=( ${="$(zfs list -H -o name,origin -t filesystem 2>/dev/null | awk "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} ) else - datasetlist=( ${="$(zfs list -H -o name $typearg)":#no datasets available} ) + datasetlist=( ${="$(zfs list -H -o name $typearg 2>/dev/null)":#no datasets available} ) fi expl_type=${typearg[2,-1]//,/\/} if [[ -n $type[(r)mtpt] ]]; then - mlist=( ${="$(zfs list -H -o mountpoint $typearg)":#no mountpoints available} ) + mlist=( ${="$(zfs list -H -o mountpoint $typearg 2>/dev/null)":#no mountpoints available} ) datasetlist=( $datasetlist $mlist ) expl_type="$expl_type/mountpoint" fi -- cgit v1.2.3 From d09cb7e979bc5186a8d322ef8977884371bbc462 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 13 Jul 2016 04:54:00 +0000 Subject: users/21750 (after users/21551): _git-subtree: Tweak -m,-P completions --- ChangeLog | 5 +++++ Completion/Unix/Command/_git | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 4945c1a02..ebfe5b774 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-07-17 Daniel Shahaf + + * users/21750 (after users/21551): Completion/Unix/Command/_git: + _git-subtree: Tweak -m,-P completions + 2016-07-17 Oliver Kiddle * 38868: Completion/BSD/Command/_freebsd-update, diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 73273ad43..98f06a3e2 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1755,7 +1755,7 @@ _git-subtree () { # TODO: -P should only complete paths inside the current repository. _arguments -C \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ '-d[show debug messages]' \ ': :->command' \ '*::: := ->option-or-argument' && ret=0 @@ -1779,8 +1779,8 @@ _git-subtree () { (add) _arguments \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ - '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ '--squash[import only a single commit from the subproject]' \ ': :__git_any_repositories_or_references' \ ':: :__git_ref_specs' && ret=0 @@ -1788,16 +1788,16 @@ _git-subtree () { (merge) _arguments -S \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ - '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ '--squash[import only a single commit from the subproject]' \ ': :__git_references' && ret=0 ;; (pull) _arguments -S \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ - '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ '--squash[import only a single commit from the subproject]' \ ': :__git_any_repositories' \ ':: :__git_ref_specs' && ret=0 @@ -1805,18 +1805,18 @@ _git-subtree () { (push) _arguments -S \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ - '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ ': :__git_any_repositories' \ ':: :__git_ref_specs' && ret=0 ;; (split) _arguments -S \ '(-q --quiet)'{-q,--quiet}'[suppress progress output]' \ - '(-P --prefix)'{-P,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ + '(-P --prefix)'{-P+,--prefix=}'[the path to the subtree in the repository to manipulate]: :_directories' \ '(-b --branch)'{-b,--branch=}'[create a new branch]' \ '--onto=[try connecting new tree to an existing one]: :__git_ref_specs' \ - '(-m --message)'{-m,--message}'[use the given message as the commit message for the merge commit]' \ + '(-m --message)'{-m+,--message=}'[use the given message as the commit message for the merge commit]:message' \ '--ignore-joins[ignore prior --rejoin commits]' \ '--onto=[try connecting new tree to an existing one]: :__git_ref_specs' \ '--rejoin[use the given message as the commit message for the merge commit]' \ -- cgit v1.2.3 From db9f0d3b3e5f0211b50cdf422b99cffce8655d09 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 14 Jul 2016 12:33:21 +0000 Subject: unposted (cf. users/21737):: _git-subtree: Record technical debt in comment. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index ebfe5b774..d8441b6b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-07-17 Daniel Shahaf + * unposted (cf. users/21737):: Completion/Unix/Command/_git: + _git-subtree: Record technical debt in comment. + * users/21750 (after users/21551): Completion/Unix/Command/_git: _git-subtree: Tweak -m,-P completions diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 98f06a3e2..5954c55e5 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1784,6 +1784,10 @@ _git-subtree () { '--squash[import only a single commit from the subproject]' \ ': :__git_any_repositories_or_references' \ ':: :__git_ref_specs' && ret=0 + # TODO: the use of __git_ref_specs isn't quite right: it will + # complete "foo:bar" values which git-subtree(1) doesn't take. What + # we should complete here is what's on *one* side of the colon in + # __git_ref_specs. ;; (merge) _arguments -S \ -- cgit v1.2.3 From f117edfabebda4c21622ff38ea9e55bf01b2f8ab Mon Sep 17 00:00:00 2001 From: Marko Myllynen Date: Thu, 21 Jul 2016 17:38:48 +0200 Subject: 38894: completion for virt-admin and libvirt client/server IDs/names --- ChangeLog | 5 ++ Completion/Unix/Command/_libvirt | 103 ++++++++++++++++++++++++++++++++++----- 2 files changed, 95 insertions(+), 13 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index dea9e2d84..3af6b342b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-07-21 Oliver Kiddle + + * 38894: Marko Myllynen: Completion/Unix/Command/_libvirt: + completion for virt-admin and libvirt client/server IDs/names + 2016-07-21 Felipe Sateler * 38901: Completion/Debian/Command/_schroot: Add -r/--run-session diff --git a/Completion/Unix/Command/_libvirt b/Completion/Unix/Command/_libvirt index a9249b31e..c855ac980 100644 --- a/Completion/Unix/Command/_libvirt +++ b/Completion/Unix/Command/_libvirt @@ -1,34 +1,84 @@ -#compdef virsh +#compdef virsh virt-admin virt-host-validate virt-pki-validate virt-xml-validate local curcontext="$curcontext" state line expl ret=1 +local exargs="-h --help -V -v --version=short --version=long" +local -a common_opts interact_cmds +common_opts=( + '(- *)'{-h,--help}'[print help information and exit]' + '(- *)'{-v,--version=short}'[print short version information and exit]' + '(- *)'{-V,--version=long}'[print long version information and exit]' + "(-c --connect $exargs)"{-c+,--connect=}'[specify connection URI]:URI:_hosts' + "(-d --debug -q --quiet $exargs)"{-d+,--debug=}'[set debug level]:level:(0 1 2 3 4)' + "(-l --log $exargs)"{-l+,--log=}'[specify log file]:file:_files' + "(-q --quiet -d --debug $exargs)"{-q,--quiet}'[quiet mode]' +) +interact_cmds=(cd echo exit quit connect) + case $service in virsh) if (( ! $+_cache_virsh_cmds )); then _cache_virsh_cmds=( ${${${${(f):-"$(_call_program options virsh help)"}:#*:}/# ##}/ *} ) + local icmd + for icmd in $interact_cmds; do + _cache_virsh_cmds[$_cache_virsh_cmds[(i)$icmd]]=() + done fi if (( ! $+_cache_virsh_cmdopts )); then typeset -gA _cache_virsh_cmdopts fi _arguments -A "-*" -C -S -s -w \ - '(- *)'{-h,--help}'[print help information and exit]' \ - '(- *)'{-v,--version=short}'[print short version information and exit]' \ - '(- *)'{-V,--version=long}'[print long version information and exit]' \ - '(-c --connect)'{-c+,--connect}'[specify connection URI]:URI:_hosts' \ - '(-d --debug)'{-d+,--debug}'[set debug level]:level:(0 1 2 3 4)' \ - '(-e --escape)'{-e+,--escape}'[set escape sequence for console]:sequence' \ - '(-k --keepalive-interval)'{-k+,--keepalive-interval}'[set keepalive interval]:interval' \ - '(-K --keepalive-count)'{-K+,--keepalive-count}'[set keepalive count]:count' \ - '(-l --log)'{-l+,--log}'[specify log file]:file:_files' \ - '(-q --quiet)'{-q,--quiet}'[quiet mode]' \ - '(-r --readonly)'{-r,--readonly}'[connect readonly]' \ - '(-t --timing)'{-t,--timing}'[print timing information]' \ + "$common_opts[@]" \ + "(-e --escape $exargs)"{-e+,--escape=}'[set escape sequence for console]:sequence' \ + "(-k --keepalive-interval $exargs)"{-k+,--keepalive-interval=}'[set keepalive interval]:interval' \ + "(-K --keepalive-count $exargs)"{-K+,--keepalive-count=}'[set keepalive count]:count' \ + "(-r --readonly $exargs)"{-r,--readonly}'[connect readonly]' \ + "(-t --timing $exargs)"{-t,--timing}'[print timing information]' \ '1:command:->virsh_cmds' \ '*:cmdopt:->virsh_cmdopts' && return # We accept only virsh command options after the first non-option argument # (i.e., the virsh command itself), this makes it so with the -A "-*" above [[ -z $state ]] && state=virsh_cmdopts ;; + virt-admin) + if (( ! $+_cache_virt_admin_cmds )); then + _cache_virt_admin_cmds=( ${${${${(f):-"$(_call_program options virt-admin help)"}:#*:}/# ##}/ *} ) + local icmd + for icmd in $interact_cmds; do + _cache_virt_admin_cmds[$_cache_virt_admin_cmds[(i)$icmd]]=() + done + fi + if (( ! $+_cache_virt_admin_cmdopts )); then + typeset -gA _cache_virt_admin_cmdopts + fi + _arguments -A "-*" -C -S -s -w \ + "$common_opts[@]" \ + '1:command:->virt_admin_cmds' \ + '*:cmdopt:->virt_admin_cmdopts' && return + # Same as with virsh above + [[ -z $state ]] && state=virt_admin_cmdopts + ;; + virt-host-validate) + _arguments -A "-*" -S \ + '(- *)'{-h,--help}'[print help information and exit]' \ + '(- *)'{-v,--version}'[print version information and exit]' \ + '(- *)'{-q,--quiet}'[quiet mode]' \ + '1:hv-type:(qemu lxc)' && return + ;; + virt-pki-validate) + _arguments -A "-*" -S \ + '(- *)'{-h,--help}'[print help information and exit]' \ + '(- *)'{-V,--version}'[print version information and exit]' \ + && return + ;; + virt-xml-validate) + _arguments -A "-*" -S \ + '(- *)'{-h,--help}'[print help information and exit]' \ + '(- *)'{-V,--version}'[print version information and exit]' \ + '1:file:_files -g "*.xml(-.)"' \ + '2:schema:(domainsnapshot domain network storagepool storagevol nodedev capability nwfilter secret interface)' \ + && return + ;; esac case $state in @@ -50,6 +100,33 @@ case $state in fi _values -w options ${=_cache_virsh_cmdopts[$cmd]} && ret=0 ;; + virt_admin_cmds) + _wanted commands expl 'virt-admin command' compadd -a _cache_virt_admin_cmds && ret=0 + ;; + virt_admin_cmdopts) + local cmd + for (( i = 2; i <= $#words; i++ )); do + [[ -n "${_cache_virt_admin_cmds[(r)$words[$i]]}" ]] && cmd=$words[$i] && break + done + [[ -z $cmd ]] && return 1 + if [[ $words[-2] == --server ]]; then + _values servers ${=${(S)${${(f)$(sudo virt-admin srv-list)}##*--- }//[0-9]* }} && return 0 + fi + if [[ $words[-2] == --client ]]; then + local srv + for (( i = 2; i <= $#words; i++ )); do + [[ $words[$i] == --server ]] && srv=$words[$i+1] && break + done + [[ -z $srv ]] && return 1 + _values servers ${=${${(f):-"$(sudo virt-admin srv-clients-list --server $srv)"}/ [a-z]*}//[^0-9]} && return 0 + fi + if [[ -z $_cache_virt_admin_cmdopts[$cmd] ]]; then + _cache_virt_admin_cmdopts[$cmd]=${(M)${${${${=${(f)"$(_call_program virt-admin virt-admin help $cmd 2>&1)"}}/\[}/\]}/\;}:#-[-0-9A-Za-z]*} + fi + [[ -n $_cache_virt_admin_cmdopts[$cmd] ]] && \ + _values -w options ${=_cache_virt_admin_cmdopts[$cmd]} && ret=0 + ;; + esac return ret -- cgit v1.2.3 From 82119d8d1723667ddc77d760d2be448beef7c972 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 21 Jul 2016 17:48:21 +0200 Subject: 38904: fix return status in _normal and functions erroneously using it for default completion --- ChangeLog | 5 +++++ Completion/Base/Core/_normal | 4 ++-- Completion/Unix/Command/_iostat | 2 +- Completion/Unix/Command/_top | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 3af6b342b..e37cb392f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2016-07-21 Oliver Kiddle + * 38904: Completion/Base/Core/_normal, + Completion/Unix/Command/_iostat, Completion/Unix/Command/_top: + fix return status in _normal and functions erroneously using + it for default completion + * 38894: Marko Myllynen: Completion/Unix/Command/_libvirt: completion for virt-admin and libvirt client/server IDs/names diff --git a/Completion/Base/Core/_normal b/Completion/Base/Core/_normal index 539b3781f..dd607d2b2 100644 --- a/Completion/Base/Core/_normal +++ b/Completion/Base/Core/_normal @@ -30,9 +30,9 @@ if [[ CURRENT -eq 1 ]]; then curcontext="${curcontext%:*:*}:-command-:" comp="$_comps[-command-]" - [[ -n "$comp" ]] && eval "$comp" && ret=0 + [[ -n "$comp" ]] && eval "$comp" && return - return ret + return 1 fi _set_command diff --git a/Completion/Unix/Command/_iostat b/Completion/Unix/Command/_iostat index 7dc33a1fc..6653a5da4 100644 --- a/Completion/Unix/Command/_iostat +++ b/Completion/Unix/Command/_iostat @@ -129,4 +129,4 @@ if (( $#args )); then return fi -_normal +_default diff --git a/Completion/Unix/Command/_top b/Completion/Unix/Command/_top index 10c0e3481..0259c236a 100644 --- a/Completion/Unix/Command/_top +++ b/Completion/Unix/Command/_top @@ -98,4 +98,4 @@ if (( $#specs )); then return fi -_normal +_default -- cgit v1.2.3 From 8e69dd54b763643791f9e767f708e190afc72e6a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 22 Jul 2016 07:20:32 +0000 Subject: 38913: _pkg-config: Complete variables for --variable. --- ChangeLog | 3 +++ Completion/Unix/Command/_pkg-config | 24 ++++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 1d67af1a9..ef03c4db2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-07-23 Daniel Shahaf + * 38913: Completion/Unix/Command/_pkg-config: Complete variables + for --variable. + * 38911: Doc/Zsh/compsys.yo: _arguments: Clarify documentation of '-s -w' switch diff --git a/Completion/Unix/Command/_pkg-config b/Completion/Unix/Command/_pkg-config index e44b36897..54955ebb1 100644 --- a/Completion/Unix/Command/_pkg-config +++ b/Completion/Unix/Command/_pkg-config @@ -20,7 +20,7 @@ arguments=( "--libs-only-l[print the -l part of \"--libs\"]" "--libs-only-other[output other libs]" "--list-all[list all known packages]" - "--variable=[return the value of the specified variable]:variable" + "--variable=[return the value of the specified variable]:variable:->variable" "--define-variable=[set the global value for a variable]:name value pair" "--uninstalled[return success if any \"-uninstalled\" packages are being used]" "--exists[test whether the package exists or not]" @@ -33,11 +33,23 @@ arguments=( "*: :->packages" ) -_arguments -C $arguments && ret=0 +_arguments -C -S : $arguments && ret=0 -if [[ -n $state ]] ; then - packages=( ${${(f)"$(_call_program packages pkg-config --list-all)"}%% *} ) - _wanted packages expl 'package' compadd -a - packages && ret=0 -fi +case $state in + (packages) + packages=( ${${(f)"$(_call_program packages pkg-config --list-all)"}%% *} ) + _wanted packages expl 'package' compadd -a - packages && ret=0 + ;; + + (variable) + if [[ $line[1] != '-' ]]; then + local -a variables=( ${${(f)"$(_call_program variables "pkg-config --print-variables -- ${(q)line[1]}")"}} ) + _wanted variables expl 'variable' compadd -a - variables && ret=0 + else + _message "variable" + fi + ;; + +esac return ret -- cgit v1.2.3 From 3afaebd913d08e778546fd208aff6a4df1b96337 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 23 Jul 2016 14:01:20 +0000 Subject: unposted: _git-grep: Stop leaking the parameter $i. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 7aa5ae6e5..cb6ab4379 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-07-23 Daniel Shahaf + * unposted: Completion/Unix/Command/_git: _git-grep: Stop + leaking the parameter $i. + * unposted: Completion/Debian/Type/_deb_packages: Minor optimization. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 5954c55e5..b6da32962 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -973,7 +973,7 @@ _git-grep () { # don't complete treeishs. case $state in (tree-or-file) - integer first_tree last_tree start end + integer first_tree last_tree start end i (( start = words[(I)(-f|-e)] > 0 ? 1 : 2 )) (( end = $#line - 1 )) -- cgit v1.2.3 From dfd8b1da4ff3f14868fc3f9639560d1f244d9452 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Sun, 24 Jul 2016 22:14:27 +0200 Subject: 38935: update tcpdump completion for Free and Open BSD --- ChangeLog | 5 ++ Completion/Unix/Command/_tcpdump | 185 ++++++++++++++++++++++++++------------- 2 files changed, 129 insertions(+), 61 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index cb6ab4379..20c401b04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-07-24 Oliver Kiddle + + * 38935: Matthew Martin: Completion/Unix/Command/_tcpdump: + update for Free and Open BSD + 2016-07-23 Daniel Shahaf * unposted: Completion/Unix/Command/_git: _git-grep: Stop diff --git a/Completion/Unix/Command/_tcpdump b/Completion/Unix/Command/_tcpdump index edc6c7306..d73956154 100644 --- a/Completion/Unix/Command/_tcpdump +++ b/Completion/Unix/Command/_tcpdump @@ -9,26 +9,56 @@ _interfaces () { } _esp_secrets () { - _values -S : 'ESP algorithm' \ - 'des-cbc:secret' \ - '3des-cbc:secret' \ - 'blowfish-cbc:secret' \ - 'rc3-cbc:secret' \ - 'cast128-cbc:secret' \ - none + if [[ $OSTYPE = openbsd* ]]; then + _values -S : 'ESP algorithm' \ + aes128:secret \ + aes128-hmac96:secret \ + blowfish:secret \ + blowfish-hmac96:secret \ + cast:secret \ + cast-hmac96:secret \ + des3:secret \ + des3-hmac96:secret \ + des:secret \ + des-hmac96:secret + else + _values -S : 'ESP algorithm' \ + 'des-cbc:secret' \ + '3des-cbc:secret' \ + 'blowfish-cbc:secret' \ + 'rc3-cbc:secret' \ + 'cast128-cbc:secret' \ + none + fi } _packet_types () { - _values 'Packets type' \ - 'aodv[Ad-hoc On-demand Distance Vector protocol]' \ - 'cnfp[Cisco NetFlow protocol]' \ - 'rpc[Remote Procedure Call]' \ - 'rtp[Real-Time Applications protocol]' \ - 'rtcp[Real-Time Applications control protocol]' \ - 'snmp[Simple Network Management Protocol]' \ - 'tftp[Trivial File Transfer Protocol]' \ - 'vat[Visual Audio Tool]' \ - 'wb[distributed White Board]' + types=( + 'cnfp[Cisco NetFlow protocol]' + 'rpc[Remote Procedure Call]' + 'rtp[Real-Time Applications protocol]' + 'rtcp[Real-Time Applications control protocol]' + 'vat[Visual Audio Tool]' + 'wb[distributed White Board]' + ) + if [[ $OSTYPE = openbsd* ]]; then + types+=( + 'sack[RFC 2018 TCP Selective Acknowledgements Options]' + 'vrrp[Virtual Router Redundancy Protocol]' + 'tcp[Transmission Control Protocol]' + ) + else + types+=( + 'aodv[Ad-hoc On-demand Distance Vector protocol]' + 'carp[Common Address Redundancy Protocol]' + 'radius[RADIUS]' + 'snmp[Simple Network Management Protocol]' + 'tftp[Trivial File Transfer Protocol]' + 'vxlan[Virtual eXtensible Local Area Network]' + 'zmtpl[ZeroMQ Message Transport Protocol]' + ) + fi + _values 'Packets type' $types } _data_link_types () { @@ -45,48 +75,81 @@ _data_link_types () { _bpf_filter () { } -_arguments \ - '()-A[print each packet in ASCII]' \ - -c'[exit after receiving specified number of packets]:number of packets' \ - -C'[specify output file size in MB (10e6 bytes)]:output file size' \ - '(-ddd)-d[dump the compiled packet-matching code in a human readable form]' \ - '(-ddd)-dd[dump packet-matching code as a C program fragment]' \ - '(-d -dd)-ddd[dump packet-matching code as decimal numbers (preceded with a count)]' \ - '(-A -c -C -d -dd -ddd -e -E -f -F -i -l -L -m -M -n -N -O -p -q -R -r -S -s -T -t -tt -ttt -tttt -u -U -v -vv -vvv -w -W -x -xx -X -XX -y -Z *)'-D'[print the list of the network interfaces available on the system]' \ - -e'[print the link-level header on each dump line]' \ - -E"[decrypting IPsec ESP packets]:spi@ipaddr::algo\:secret:_esp_secrets" \ - -f"[print 'foreign' IPv4 addresses numerically]" \ - -F'[input file for the filter expression]:filter expression file:_files' \ - -i'[interface]:interface:_interfaces' \ - -l'[make stdout line buffered]' \ - '(-A -c -C -d -dd -ddd -e -E -f -F -l -D -m -M -n -N -O -p -q -R -r -S -s -T -t -tt -ttt -tttt -u -U -v -vv -vvv -w -W -x -xx -X -XX -y -Z *)'-L'[list the known data link types for the interface]' \ - '*-m[load SMI MIB module definitions]:SMI MIB module definitions:_files' \ - -M'[shared secret for validating the digests in TCP segments with the TCP-MD5 option]:secret' \ - -n"[don't convert addresses to names]" \ - -N"[don't print domain name qualification of host names]" \ - -O"[don't run the packet-matching code optimizer]" \ - -p"[don't put the interface into promiscuous mode]" \ - -q'[quick (quiet?) output]' \ - -R'[assume ESP/AH packets to be based on old specification (RFC1825 to RFC1829)]' \ - -r'[read packets from file]:input file:_files' \ - -S'[print absolute TCP sequence numbers]' \ - -s'[specify number of bytes of data to snarf from each packet]:number of bytes to snap' \ - -T'[interpret captured packets as specified type]:packet type:_packet_types' \ - "(-tttt)-t[don't print a timestamp on each dump line]" \ - '(-ttt -tttt)-tt[print an unformatted timestamp on each dump line]' \ - '(-tt -tttt)-ttt[print a delta (in micro-seconds) between current and previous line on each dump line]' \ - '(-t -tt -ttt)-tttt[print a timestamp in default format proceeded by date on each dump line]' \ - -u'[print undecoded NFS handles]' \ - -U'[make output packet-buffered when saving to file (-w)]' \ - '(-vvv)-v[slightly more verbose output]' \ - '(-vvv)-vv[more verbose output]' \ - '(-v -vv)-vvv[most verbose output]' \ - -w'[write the raw packets to file]:output file:_files' \ - -W'[limit the number of created files (-C)]:number of files' \ - -x'[print each packet (minus its link level header) in hex]' \ - '(-x)-xx[print each packet, including its link level header, in hex]' \ - -X'[print each packet (minus its link level header) in hex and ASCII]' \ - '(-X)-XX[print each packet, including its link level header, in hex and ASCII]' \ - -y'[set the data link type to use while capturing packets]:data link type:_data_link_types' \ - -Z'[drops privileges (if root) and changes user ID (along with primary group)]:user:_users' \ +args=( + '-A[print each packet in ASCII]' + '-c[exit after receiving specified number of packets]:number of packets' + '(-ddd)-d[dump the compiled packet-matching code in a human readable form]' + '(-ddd)-dd[dump packet-matching code as a C program fragment]' + '(-d -dd)-ddd[dump packet-matching code as decimal numbers (preceded with a count)]' + "-E[decrypting IPsec ESP packets]:spi@ipaddr::algo\:secret:_esp_secrets" + '-e[print the link-level header on each dump line]' + '-F[input file for the filter expression]:filter expression file:_files' + "-f[print 'foreign' IPv4 addresses numerically]" + '-l[make stdout line buffered]' + "-N[don't print domain name qualification of host names]" + "-n[don't convert addresses to names]" + "-O[don't run the packet-matching code optimizer]" + "-p[don't put the interface into promiscuous mode]" + '-q[quick (quiet?) output]' + '-r[read packets from file]:input file:_files' + '-S[print absolute TCP sequence numbers]' + '-s[specify number of bytes of data to snarf from each packet]:number of bytes to snap' + '-T[interpret captured packets as specified type]:packet type:_packet_types' + "(-tt -ttt -tttt -ttttt)-t[don't print a timestamp on each dump line]" + '(-t -ttt -tttt -ttttt)-tt[print an unformatted timestamp on each dump line]' + '(-vv -vvv)-v[slightly more verbose output]' + '(-v -vvv)-vv[more verbose output]' + '-w[write the raw packets to file]:output file:_files' + '-X[print each packet (minus its link level header) in hex and ASCII]' + '-x[print each packet (minus its link level header) in hex]' + '-y[set the data link type to use while capturing packets]:data link type:_data_link_types' '*:BPF filter:_bpf_filter' +) + +if [[ $OSTYPE = openbsd* ]]; then + args+=( + '(-n)-a[attempt to convert network and broadcast addresses to names]' + '-D[select packet flowing in specified direction]:direction:(in out)' + '-I[print the interface on each dump line]' + '-o[print a guess of the possible operating system(s)]' + '(-t -tt -tttt -ttttt)-ttt[print day and month in timestamp]' + '(-t -tt -ttt -ttttt)-tttt[print timestamp difference between packets]' + '(-t -tt -ttt -tttt)-ttttt[print timestamp difference since the first packet]' + ) +else + args+=( + '-B[specify the capture buffer size in KiB]:capture buffer size' + '-b[print the AS number in BGP packets in ASDOT notation]' + '-C[specify output file size in MB (10e6 bytes)]:output file size' + '(-* *)'-D'[print the list of the network interfaces available on the system]' + '-G[specify the interval to rotate the dump file in seconds]:dump file rotate seconds' + '-H[attempt to detect 802.11s draft mesh headers]' + '(-* *)-h[print version strings and a usage message]' + '-I[put the interface in monitor mode]' + '(-* *)-J[list the supported timestamp types]' + '-j[set the timestamp type]:timestamp type' + "-K[don't attempt to verify checksums]" + '*-m[load SMI MIB module definitions]:SMI MIB module definitions:_files' + '-M[shared secret for validating the digests in TCP segments with the TCP-MD5 option]:secret' + '-R[assume ESP/AH packets to be based on old specification (RFC1825 to RFC1829)]' + '(-t -tt -tttt)-ttt[print a delta (in micro-seconds) between current and previous line on each dump line]' + '(-t -tt -ttt)-tttt[print a timestamp in default format proceeded by date on each dump line]' + '(-t -tt -ttt -tttt)-ttttt[print a delta (micro-second resolution) since the first line on each dump line]' + '-U[make output packet-buffered when saving to file (-w)]' + '-u[print undecoded NFS handles]' + '-V[Read a list of filenames from file]:file:_files' + '(-v -vv)-vvv[most verbose output]' + '-W[limit the number of created files (-C)]:number of files' + '(-X)-XX[print each packet, including its link level header, in hex and ASCII]' + '(-x)-xx[print each packet, including its link level header, in hex]' + '-Z[drops privileges (if root) and changes user ID (along with primary group)]:user:_users' + '-z[command to run after file rotation]:command:_command_names' + ) +fi + +_arguments : \ + '-i[interface]:interface:_interfaces' \ + - optL \ + '-L[list the known data link types for the interface]' \ + - default \ + $args -- cgit v1.2.3 From 4f5cc54560dd95c4db6487a26d40c4b133ff1229 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 25 Jul 2016 00:06:57 +0200 Subject: 38939: add missing git options In particular those for GPG signing a push --- ChangeLog | 3 ++ Completion/Unix/Command/_git | 67 ++++++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 24 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 4fb827c71..0813e74cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-07-24 Oliver Kiddle + * 38939: Completion/Unix/Command/_git: add missing options, + in particular those for GPG signing a push + * 38936: Functions/Zle/vi-pipe: fix for option compatibility * 38929: Doc/Zsh/contrib.yo, Functions/Zle/select-word-match: diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b6da32962..b54b208fb 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -510,7 +510,7 @@ _git-cherry-pick () { '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \ ': : __git_commit_ranges -O expl:git_commit_opts' } @@ -1149,6 +1149,7 @@ _git-mv () { declare -A opt_args _arguments -w -C -S -s \ + '(-v --verbose)'{-v,--verbose}'[output additional information]' \ '(-f --force)'{-f,--force}'[rename/move even if targets exist]' \ '-k[skip rename/move that would lead to errors]' \ '(-n --dry-run)'{-n,--dry-run}'[only show what would happen]' \ @@ -1278,7 +1279,7 @@ _git-push () { '--mirror[push all refs under refs/heads/ and refs/tags/ and delete non-existing refs]' \ '(-n --dry-run)'{-n,--dry-run}'[do everything except actually send the updates]' \ '--porcelain[produce machine-readable output]' \ - '--delete[delete all listed refs from the remote repository]' \ + '(-d --delete)'{-d,--delete}'[delete all listed refs from the remote repository]' \ '--tags[all tags under refs/tags are pushed]' \ '--follow-tags[also push missing annotated tags reachable from the pushed refs]' \ '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[path to git-receive-pack on remote]:remote git-receive-pack:_files' \ @@ -1295,6 +1296,12 @@ _git-push () { '(--verify)--no-verify[bybass the pre-push hook]' \ '--recurse-submodules=[submodule handling]:submodule handling:((check\:"refuse pushing of supermodule if submodule commit cannot be found on the remote" on-demand\:"push all changed submodules"))' \ + '(--no-signed --signed)--sign=[GPG sign the push]:signing enabled:(yes no if-asked)' \ + '(--no-signed --sign)--signed[GPG sign the push]' \ + "(--sign --sign)--no-signed[don't GPG sign the push]" \ + '--atomic[request atomic transaction on remote side]' \ + '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \ + '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \ ': :__git_any_repositories' \ '*: :__git_ref_specs_pushy' && ret=0 @@ -1323,17 +1330,21 @@ _git-rebase () { fi _arguments -A '-*' \ - '(- :)--continue[continue after resolving merge conflict]' \ - '(- :)--abort[abort current rebase]' \ - '--keep-empty[keep empty commits in the result]' \ - '(- :)--skip[skip the current patch]' \ + - actions \ + '(-)--continue[continue after resolving merge conflict]' \ + '(-)--abort[abort current rebase]' \ + '(-)--edit-todo[edit interactive instruction sheet in an editor]' \ + '(-)--skip[skip the current patch]' \ + - options \ + "--keep-empty[keep empty commits in the result]" \ '(-m --merge)'{-m,--merge}'[use merging strategies to rebase]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-q,--quiet}'[suppress all output]' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-v,--verbose}'[output additional information]' \ + '--rerere-autoupdate[allow rerere to update index with resolved conflicts' \ '--no-verify[bypass the pre-rebase hook]' \ '-C-[ensure that given lines of surrounding context match]: :__git_guard_number "lines of context"' \ '(-f --force-rebase)'{-f,--force-rebase}'[force rebase even if current branch descends from commit rebasing onto]' \ @@ -1341,13 +1352,13 @@ _git-rebase () { '(-i --interactive)--whitespace=-[detect a new or modified line that has whitespace errors]: :__git_apply_whitespace_strategies' \ '(-i --interactive)--committer-date-is-author-date[use author date as committer date]' \ '(-i --interactive --ignore-whitespace --whitespace --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \ - '--edit-todo[edit interactive instruction sheet in an editor]' \ '(-p --preserve-merges --interactive)'{-p,--preserve-merges}'[try to recreate merges instead of ignoring them]' \ {-x+,--exec=}'[with -i\: append "exec " after each line]:command:_command_names -e' \ '(1)--root[rebase all reachable commits]' \ $autosquash_opts \ '(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \ '(--autostash --no-autostash)--no-autostash[do not stash uncommitted changes before rebasing and apply them afterwards]' \ + '--ignore-date[use current timestamp for author date]' \ '--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \ '--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \ ':upstream branch:__git_revisions' \ @@ -1395,6 +1406,8 @@ _git-revert () { '(-m --mainline)'{-m+,--mainline=}'[pick which parent is mainline]:parent number' \ '(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]' \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ + '--strategy=[use given merge strategy]:merge strategy:__git_merge_strategies' \ + '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ ': :__git_commits' @@ -1842,15 +1855,16 @@ _git-tag () { if (( words[(I)-[asu]] )); then message_opts=( - '( -F)-m+[specify tag message]:message' - '(-m )-F+[read tag message from given file]:message file:_files') + '(-m --message -F --file)'{-m+,--message=}'[specify tag message]:message' + '(-m --message -F --file)'{-F+,--file=}'[read tag message from given file]:message file:_files' + ) fi _arguments -A '-*' \ - creation \ - '( -s -u --local-user)-a[create an unsigned, annotated tag]' \ - '(-a -u --local-user)-s[create an signed and annotated tag]' \ - '(-a -s)'{-u+,--local-user=}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \ + '(-a --annotate -s --sign -u --local-user)'{-a,--annotate}'[create an unsigned, annotated tag]' \ + '(-a --annotate -s --sign -u --local-user)'{-s,--sign}'[create an signed and annotated tag]' \ + '(-a --annotate -s --sign)'{-u+,--local-user=}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \ '-f[replace existing tag]' \ '--cleanup=[cleanup message]:mode:((verbatim\:"no cleanup" whitespace\:"remove leading and trailing whitespace" strip\:"remove leading and trailing whitespace and comments"))' \ $message_opts \ @@ -3129,6 +3143,7 @@ _git-prune () { _arguments -S \ '(-n --dry-run)'{-n,--dry-run}'[do not remove anything; just report what would be removed]' \ '(-v --verbose)'{-v,--verbose}'[report all removed objects]' \ + '--progress[show progress]' \ '--expire[only expire loose objects older than given date]: :__git_datetimes' \ '*:: :__git_heads' } @@ -3258,7 +3273,7 @@ _git-remote () { '(--tags )--no-tags[tell git fetch to not import every tag from remote repository]' \ '*'{-t,--track=}'[track given branch instead of default glob refspec]: :__git_branch_names' \ '(-m --master)'{-m,--master=}'[set HEAD of remote to point to given master branch]: :__git_branch_names' \ - '--mirror[do not use separate remotes]' \ + '--mirror[do not use separate remotes]::mirror type:(fetch pull)' \ ':name:__git_remotes' \ ':repository:->repository' && ret=0 case $state in @@ -4786,19 +4801,23 @@ _git-http-backend () { (( $+functions[_git-send-pack] )) || _git-send-pack () { - # TODO: --mirror is undocumented. - # TODO: --stateless-rpc is undocumented. - # TODO: --helper-status is undocumented. _arguments -A '-*' \ + '(-v --verbose)'{-v,--verbose}'[produce verbose output]' \ + '(-q --quiet)'{-q,--quiet}'[be more quiet]' \ '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[specify path to git-receive-pack on remote side]:remote path' \ + '--remote[specify remote name]:remote' \ '--all[update all refs that exist locally]' \ - '--dry-run[do everything except actually sending the updates]' \ - '--force[update remote orphaned refs]' \ - '-v[produce verbose output]' \ + '(-n --dry-run)'{-n,--dry-run}'[do everything except actually sending the updates]' \ + '--mirror[mirror all refs]' \ + '(-f --force)'{-f,--force}'[update remote orphaned refs]' \ + '(--no-signed --signed)--sign=[GPG sign the push]:signing enabled:(yes no if-asked)' \ + '(--no-signed --sign)--signed[GPG sign the push]' \ + "(--sign --sign)--no-signed[don't GPG sign the push]" \ '--thin[send a thin pack]' \ - '--mirror[undocumented]' \ - '--stateless-rpc[undocumented]' \ - '--helper-status[undocumented]' \ + '--atomic[request atomic transaction on remote side]' \ + '--stateless-rpc[use stateless RPC protocol]' \ + '--helper-status[print status from remote helper]' \ + '--force-with-lease=[require old value of ref to be at specified value]:refname\:expect' \ ': :__git_any_repositories' \ '*: :__git_remote_references' } @@ -6746,7 +6765,7 @@ __git_setup_merge_options () { '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \ '(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[do not GPG-sign the commit]' \ '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' - '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' + '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' '(--verify-signatures)--verify-signatures[verify the commits being merged or abort]' '(--no-verify-signatures)--no-verify-signatures[do not verify the commits being merged]' '(-q --quiet -v --verbose)'{-q,--quiet}'[suppress all output]' -- cgit v1.2.3 From fd144877f502b79aa781b7fdddd0f7285783e123 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 25 Jul 2016 00:12:43 +0200 Subject: 38943: update texinfo options and improve completion of Info files, nodes and menu items --- ChangeLog | 3 + Completion/Unix/Command/_texinfo | 243 +++++++++++++++++++++++++++++---------- 2 files changed, 185 insertions(+), 61 deletions(-) (limited to 'Completion/Unix') diff --git a/ChangeLog b/ChangeLog index 0813e74cd..f9dc8594a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-07-24 Oliver Kiddle + * 38943: Completion/Unix/Command/_texinfo: update options + and improve completion of Info files, nodes and menu items + * 38939: Completion/Unix/Command/_git: add missing options, in particular those for GPG signing a push diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo index 12d964e3f..7b66d6304 100644 --- a/Completion/Unix/Command/_texinfo +++ b/Completion/Unix/Command/_texinfo @@ -1,29 +1,65 @@ -#compdef info tkinfo install-info makeinfo texi2dvi texindex +#compdef info tkinfo install-info makeinfo texi2any texi2dvi pdftexi2dvi texi2pdf texindex -local curcontext="$curcontext" state line ret=1 -local -A opt_args -local -a info +_info_nodes_caching_policy() { + local dir oldp + for dir in $^infopath/usr/share/info}/dir(.N); do + # rebuild if any dir file is newer than cache + [[ $dir -nt $1 ]] && return + done + # and if we didn't find a dir file, rebuild if cache older than a month + if [[ -z $dir ]]; then + oldp=( "$1"(mM+1) ) + (( $#oldp )) && return + fi + return 1 +} + +_info_retrieve_nodes() { + # expects $cmd, $hash and $infopath to be set + local update_policy + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy \ + _info_nodes_caching_policy + fi + + if _cache_invalid info-nodes-$hash || ! _retrieve_cache info-nodes-$hash; then + set -A _cache_info_nodes_$hash \ + ${${${${(f)"$(INFOPATH="${(j.:.)infopath}" _call_program info-nodes $cmd -k '')"}%%\" --*}#??}/\)/:} + _store_cache info-nodes-$hash _cache_info_nodes_$hash + fi +} + +local curcontext="$curcontext" state line cmd ret=1 +local -A opt_args infodirs case $service in info) - info=( _call_program info ${words[1]} ) + cmd=${words[1]} _arguments -C -s \ - '(: -)--apropos=[look up string in indices]:search string: ' \ - '(-f --file)'{\*-d,\*--directory=}'[add directory to infopath]:info dir:_files -/' \ + '(-a --all)'{-a,--all}'[use all matching manuals]' \ + '(: -)'{-k+,--apropos=}'[look up string in indices]:search string: ' \ + \*{-d+,--directory=}'[add directory to infopath]:info dir:_files -/' \ '--dribble=[record keystrokes]:file with keystrokes:_files' \ - '(-f --file -d --directory)'{-f,--file=}'[info file to show]:info file:_files -g "*.info(|.gz|.bz2)(-.)"' \ + '(-f --file 1)'{-f+,--file=}'[specify Info manual to visit]:info manual:->infofiles' \ '(: - -h --help)'{-h,--help}'[display usage]' \ '(-o --output -O)--index-search=[go directly to node if found]:search string: ' \ - '(--index-search -o --output -O)'{-o,--output=}'[dump selected nodes to filename]:filename:_files -g "*(-.)"' \ - '(-R --raw-escapes)'{-R,--raw-escapes}'[do not remove ANSI escapes from man pages]' \ + '(--index-search -o --output -O)'{-o+,--output=}'[dump selected nodes to filename]:filename:_files -g "*(-.)"' \ + '(-n --node)'{-n+,--node=}'[specify nodes in first visited Info file]:node:->nodes' \ + '--no-raw-escapes[output escapes as literal text]' \ '--restore=[read keystrokes from file]:filename:_files -g "*(-.)"' \ '(--index-search -o --output -O --show-options --usage)'{-O,--show-options,--usage}'[go to command-line options node]' \ + '--strict-node-location[(for debugging) use Info file pointers as-is]' \ '--subnodes[recursively output menu items]' \ + \*{-v,--variable}'[assign to Info variable]:variable' \ '--vi-keys[use Vi-like key bindings]' \ '(: -)--version[display version information]' \ - '(--apropos -h --help -O --output --version)*::menu item:->item' && ret=0 + '(-w --where --location)'{-w,--where,--location}'[print physical location of Info file]' \ + '(-x --debug)'{-x+,--debug=}'[set debugging level]:number' \ + '1:menu item:->infomanuals' \ + '2:node:->nodes' && ret=0 - info=( $info {(kv)opt_args[(I)(-d|--directory|-f|--file)]} ) + infodirs=( "${(@Qkv)opt_args[(I)(-d|--directory)]}" ) ;; install-info) if _pick_variant debian=Debian gnu --version; then @@ -41,131 +77,216 @@ case $service in '--description=[specify description for menu entry]:description' \ '--menuentry=[specify the menu entry for dir file]:menu entry' \ '--keep-old=[inhibit replacement of existing entries/removal of empty sections]' \ - '--test[do not update dir file]' \ + "--test[don't update dir file]" \ '--debug[enable debugging]' \ '*:info file:_files -g "*.info(-.)"' return else _arguments \ + '--add-once[add only to first matching section]' \ + '--align=[specify minimum indentation for description]:indentation' \ + '--calign=[specify minimum indentation for continuation lines of description]:indentation' \ + '--debug[report what is being done]' \ '(--delete --remove)'{--delete,--remove}'[delete existing entries]' \ + '--description=[specify description for menu entry]:description' \ '(2)--dir-file=[specify dir file]:dir file:_files -g "dir(-.)"' \ + '(--test --dry-run)'{--dry-run,--test}"[don't update dir file]" \ \*{--entry,--info}'[specify directory entry to add]:text' \ + '--defsection=[like --section, but only use text if no sections present in info file]:text' \ + {--maxwidth,--max-width}'=[specify maximum width of dir file]:width' \ '(- 1 2)--help[display help information]' \ '(1)--info-file=[specify info file to install in the directory]:info file:_files -g "*.info(-.)"' \ '(2)--info-dir=[specify directory containing dir file]:info directory:_files -/' \ + '--keep-old=[inhibit replacement of existing entries/removal of empty sections]' \ + '(--name --menuentry)'{--name,--menuentry}'=[specify the menu entry for dir file]:menu entry' \ + "--no-indent[don't format new entries in the DIR file]" '--quiet[suppress warnings]' \ - '(--delete --remove)--section=[put new entries in specified section]' \ + '--regex=[specify sections for file entries using a regex]:regex' \ + '(--delete --remove)--section=[put new entries in specified section]:section' \ + '--silent[no output except errors]' \ '(- 1 2)--version[display version information]' \ '1:info file:_files -g "*.info(-.)"' \ '2:dir file:_files -g "dir(-.)"' return fi ;; - makeinfo) + makeinfo|texi2any) _arguments -s \ - '--error-limit=[specify number of errors to quit after]:number' \ + '--error-limit=[specify number of errors to quit after]:number [100]' \ + '--document-language=[specify locale to use in translating Texinfo keywords]:locale [C]:_locales' \ '--force[preserve output even if errors]' \ '(* -)--help[display help]' \ '--no-validate[suppress node cross-reference validation]' \ '--no-warn[suppress warnings]' \ - '--reference-limit=[warn about at most specified number of references]:number' \ + '--conf-dir=[specify additional directory for configuration files]:directory:_directories' \ + '--init-file=[specify initialisation file]:file:_files' \ + \*{-c+,--set-customization-variable=}'[set customization variable]:variable' \ '(-v --verbose)'{-v,--verbose}'[explain what is being done]' \ '(* -)--version[display version info]' \ - '(--html --xml)--docbook[output in DocBook format]' \ - '(--docbook --xml)--html[output in HTML format]' \ + '(--html --xml --plaintext)--docbook[output in DocBook XML format]' \ + '(--docbook --xml --plaintext)--html[output in HTML format]' \ '--no-headers[suppress node separators and menus]' \ - '(--docbook --html)--xml[output in XML (TexinfoML) format]' \ + '(--docbook --html --plaintext)--xml[output in XML (TexinfoML) format]' \ + '(--docbook --html --xml)--plaintext[output in plain text format]' \ + '--dvi[output in dvi format]' \ + '--dvipdf[output in pdf format]' \ + '--ps[output in ps format]' \ + '--pdf[output in pdf format]' \ '(-E --macro-expand)'{-E,--macro-expand}'[output macro-expanded source to specified file]:file:_files' \ '(--docbook --xml)--no-split[suppress splitting of output]' \ - '--number-sections[output chapter and section numbers]' \ + '--no-number-sections[output chapter and section numbers]' \ '(-o --output=)'{-o,--output}'[specify output file]:output file:_files' \ - '(--docbook --html --xml)--enable-encoding[output special characters]' \ + '(--docbook --html --xml)--disable-encoding[output special characters]' \ '(--docbook --html --xml)--fill-column=[specify width to break lines at]:width' \ '(--docbook --html --xml)--footnote-style=[specify style for output of footnotes]:((separate\:in\ own\ node end\:at\ end\ of\ node))' \ '(--docbook --html --xml)--paragraph-indent=[specify spaces to indent paragraphs by]' \ - '(--docbook --html --xml)--split-size=[split Info files at specified size]:size' \ - '--commands-in-node-names[allow @ commands in node names]' \ + '(--docbook --html --xml)--split-size=[split Info files at specified size]:size [300000]' \ + '(--docbook --xml --plaintext)--css-include=[specify file in include in HTML