From 70e0128c0fdf216396a67f23154dac649158b9a8 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 31 May 2011 12:38:32 +0000 Subject: users/16057: add _tree --- Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_tree | 51 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Completion/Unix/Command/_tree (limited to 'Completion/Unix/Command') diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index cc47a7a0b..91a8786c8 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -224,6 +224,7 @@ _toilet _topgit _totd _tracepath +_tree _twisted _unace _uname diff --git a/Completion/Unix/Command/_tree b/Completion/Unix/Command/_tree new file mode 100644 index 000000000..d759409b5 --- /dev/null +++ b/Completion/Unix/Command/_tree @@ -0,0 +1,51 @@ +#compdef tree + +# Completions for tree, version 1.5.3 +# Tree is available at +# http://mama.indstate.edu/users/ice/tree/ + +typeset -a opts + +opts=( +'--help[verbose usage listing]' +'--version[version of tree]' +'-a[show all files, including hidden ones]' +'-d[list directories only]' +'-f[print full path prefix for each file]' +'-i[do not print indentation lines]' +'-l[follow symlinks that point to directories]' +'-x[stay on current filesystem]' +'-P[list only files matching a pattern]:pattern:' +'-I[do not list files matching a pattern]:pattern:' +'--noreport[do not print file and directory report at end]' +'-p[print file type and permissions, like ls -l]' +'-s[print size of each file in bytes]' +'-h[print human readable file size]' +'-u[print username]' +'-g[print group name]' +'-D[print date of last modification]' +'--inodes[print inode numbers]' +'--device[print device number to which file or directory belongs]' +'-F[append descriptive character to end, like ls -F]' +'-q[print non-printable characters as question mark, not caret]' +'-N[print non-printable characters as is, not as caret]' +'-v[sort the output as version]' +'-r[sort output in reverse alphabetic order]' +'-t[sort output by last modification time instead of alphabetically]' +'--dirsfirst[list directories before files]' +'-n[turn colorization off always, over-ridden by the -C option]' +'-C[turn colorization on always]' +'-A[turn on ANSI line graphics hack when printing indentation lines]' +'-S[turn on ASCII line graphics]' +'-L[max display depth of tree]:level:' +'--filelimit[do not descend directories with more than number of entries]:number:' +'-R[recursively cross down the tree and execute tree again]' +'-H[turn on HTML output]' +'-T[title for HTML output]' +'--charset[character set for HTML and for line drawing]:charset:' +'--nolinks[turn off hyperlinks in HTML output]' +'-o[send output to file]:filename:_files' +'*:directory:_files -/' +) + +_arguments $opts -- cgit v1.2.3 From 8101886e488111cf26d94468854efd5b3daf0856 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Wed, 1 Jun 2011 21:30:11 +0000 Subject: 29412: _tmux: Disable sub-command completions if tmux is not found in `$path'. --- ChangeLog | 5 ++++- Completion/Unix/Command/_tmux | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 9c5b99de6..a58e6cea9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-06-01 Frank Terbeck + * 29412: Completion/Unix/Command/_tmux: Disable sub-command + completions if tmux is not found in `$path'. + * Valentin Haenel: 29431: Misc/vcs_info-examples: Hook example for signaling untracked files in git repositories. @@ -14917,5 +14920,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5353 $ +* $Revision: 1.5354 $ ***************************************************** diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux index e9977fbbd..5fb721960 100644 --- a/Completion/Unix/Command/_tmux +++ b/Completion/Unix/Command/_tmux @@ -1520,6 +1520,10 @@ function _tmux() { _describe -t subcommands 'tmux commands and aliases' _tmux_commands -- _tmux_aliases fi else + if (( ${+commands[tmux]} == 0 )); then + _message '`tmux'\'' not found in $path; sub-cmd completions disabled.' + return 0 + fi tmuxcommand="${words[1]}" if [[ -n ${_tmux_aliasmap[$tmuxcommand]} ]] ; then tmuxcommand="${_tmux_aliasmap[$tmuxcommand]}" -- cgit v1.2.3 From e468775400a345dbe0acc4e68891bae5127e6f98 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 3 Jun 2011 20:53:16 +0000 Subject: 29448: complete symlinks to files in _initctl too --- ChangeLog | 5 ++++- Completion/Unix/Command/_initctl | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index eae0213a2..332bcdb20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * 29438: Completion/Zsh/Context/_subscript: adjust pattern so we complete dynamic directory names in command position as well. + * 29448: Completion/Unix/Command/_initctl: complete symlinks + to files too. + 2011-06-03 Peter Stephenson * 29413: Doc/Zsh/builtins.yo, Src/builtin.c, Src/hist.c: print @@ -14936,5 +14939,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5357 $ +* $Revision: 1.5358 $ ***************************************************** diff --git a/Completion/Unix/Command/_initctl b/Completion/Unix/Command/_initctl index 11bd59b50..6505e4298 100644 --- a/Completion/Unix/Command/_initctl +++ b/Completion/Unix/Command/_initctl @@ -37,7 +37,7 @@ _initctl_fillarray_events_args () # list all upstart jobs, i.e. all files in /etc/init/ _initctl_helper_jobs() { - _path_files -W "/etc/init/" -g "*.conf(.:r)" + _path_files -W "/etc/init/" -g "*.conf(-.:r)" } # list events, generate array if necessary -- cgit v1.2.3 From 65f7cbeaed28ff4287bf49627985ae11d4f78d15 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 16 Jun 2011 06:23:32 +0000 Subject: 29483: add --servername completion to _vim --- ChangeLog | 6 +++++- Completion/Unix/Command/_vim | 23 +++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 0116bab38..bc3088535 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-06-16 Doug Kearns + + * 29483: Completion/Unix/Command/_vim: add --servername completion. + 2011-06-15 Barton E. Schaefer * 29481: Src/jobs.c, Src/signals.c: always return a matching job @@ -14997,5 +15001,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5370 $ +* $Revision: 1.5371 $ ***************************************************** diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim index af5afd347..7aec1ecf7 100644 --- a/Completion/Unix/Command/_vim +++ b/Completion/Unix/Command/_vim @@ -12,6 +12,9 @@ _vim_files () { esac } +local curcontext="$curcontext" state line expl +typeset -A opt_args + local arguments arguments=( @@ -46,7 +49,7 @@ arguments=( {-r,-L}'[list swap files and exit or recover from a swap file]::swap file:_vim_files -g \*.sw\?' '( -H -F)-A[start in Arabic mode]' '(-A -F)-H[start in Hebrew mode]' - '(-A -H )-H[start in Farsi mode]' + '(-A -H )-F[start in Farsi mode]' '-T[set terminal type]:::_terminals' '-u[use given vimrc file instead of default .vimrc]::rc file:_files' '-U[use given gvimrc file instead of default .gvimrc]::rc file:_files' @@ -54,7 +57,7 @@ arguments=( '-o-[number of windows to open (default: one for each file)]::window count: ' '-O-[number of windows to vertically split open (default is one for each file)]::window count: ' '-p-[number of tabs to open (default: one for each file)]::tab count: ' - '-q-[quickfix file]:*:file:_vim_files' + '(* -t)-q-[quickfix file]:*:file:_vim_files' '*--cmd[execute given command before loading any RC files]:command: ' '-c[execute given command after loading the first file]:command: ' '-S[source a session file after loading the first file]:session file:_files' @@ -76,14 +79,22 @@ arguments=( '--echo-wid[echo window ID on STDOUT, GUI version only]' '--literal[do not expand wildcards in arguments (this is useless with ZSH)]' '(- *)--serverlist[list available vim servers and exit]' - '--servername[name of vim server to send to or name of server to become]:server name: ' + '--servername[name of vim server to send to or name of server to become]:server name:->server' '--startuptime[write startup timing messages to given file]:log file:_files' '--socketid[run GVIM in another window]' '-i[use given viminfo file instead of default .viminfo]:viminfo file:_files' '(- *)'{-h,--help}'[print help and exit]' '(- *)--version[print version information and exit]' - '(*)-t[edit file where tag is defined]:tag:_complete_tag' - '(-t)*:file:_vim_files' + '(* -q)-t[edit file where tag is defined]:tag:_complete_tag' + '(-t -q)*:file:_vim_files' ) -_arguments -S $arguments +_arguments -C -S $arguments && return + +if [[ "$state" = server ]]; then + local -a servers + servers=( ${(f)"$(_call_program servers $words[1] --serverlist 2>/dev/null)"} ) + _wanted servers expl server compadd -M 'm:{a-z}={A-Z}' -a servers && return +fi + +return 1 -- cgit v1.2.3 From 67ef9605f12969b5eab407f83fb117867b15655f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 20 Jun 2011 02:24:56 +0000 Subject: unposted: clean up completion descriptions as per Etc/completion-style-guide --- ChangeLog | 11 +++++++- Completion/BSD/Command/_sockstat | 18 ++++++------- Completion/Debian/Command/_git-buildpackage | 2 +- Completion/Unix/Command/_at | 22 +++++++-------- Completion/Unix/Command/_lp | 42 ++++++++++++++--------------- Completion/Unix/Command/_unison | 4 +-- Completion/X/Command/_matlab | 28 +++++++++---------- Completion/X/Command/_okular | 6 ++--- Completion/Zsh/Function/_zargs | 26 +++++++++--------- 9 files changed, 84 insertions(+), 75 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 6f3533590..09d623ef7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-06-20 Doug Kearns + + * unposted: Completion/BSD/Command/_sockstat, + Completion/Debian/Command/_git-buildpackage, + Completion/Unix/Command/_at, Completion/Unix/Command/_lp, + Completion/Unix/Command/_unison, Completion/X/Command/_matlab, + Completion/X/Command/_okular, Completion/Zsh/Function/_zargs: clean up + completion descriptions as per Etc/completion-style-guide. + 2011-06-19 Peter Stephenson * Luka Perkov: 29493: Completion/Unix/Type/_pdf: handle apvlv. @@ -15024,5 +15033,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5377 $ +* $Revision: 1.5378 $ ***************************************************** diff --git a/Completion/BSD/Command/_sockstat b/Completion/BSD/Command/_sockstat index 2acbe6bec..e61854622 100644 --- a/Completion/BSD/Command/_sockstat +++ b/Completion/BSD/Command/_sockstat @@ -3,10 +3,10 @@ local tmp_proto protocols proto tmp_proto=(${${(M)${(f)"$(jobs' ;; atq) _arguments \ - '-V[Print version number]' \ - '-q[Uses specified queue]:a-z+A-Z' + '-V[print version number]' \ + '-q[uses specified queue]:a-z+A-Z' ;; at|batch) _arguments \ - new-job \ - '-V[Print version number]' \ - '-q[Uses specified queue, uppercase acts as batch]:a-z+A-Z' \ - '-f[Read job from file rather than from stdin]:file:_files' \ - '-v[Show the time the job will be executed]' \ - '-m[Send mail even if there was no output]' \ + '-V[print version number]' \ + '-q[uses specified queue, uppercase acts as batch]:a-z+A-Z' \ + '-f[read job from file rather than from stdin]:file:_files' \ + '-v[show the time the job will be executed]' \ + '-m[send mail even if there was no output]' \ ':time:' \ - atq \ - '-l[Alias for atq]' \ + '-l[alias for atq]' \ - atrm \ - '-d[Alias for atrm]' \ + '-d[alias for atrm]' \ - show-job \ - '-c[Cat specified jobs to stdout]:*:job number:->jobs' + '-c[cat specified jobs to stdout]:*:job number:->jobs' esac case $state in diff --git a/Completion/Unix/Command/_lp b/Completion/Unix/Command/_lp index 5d46a75bb..def9aed87 100644 --- a/Completion/Unix/Command/_lp +++ b/Completion/Unix/Command/_lp @@ -133,7 +133,7 @@ _lp() case $service in (lpq) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ '(-a)-P+[destination printer]:printers:_printers' \ @@ -144,7 +144,7 @@ _lp() (lprm) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ '-P+[destination printer]:printers:_printers' \ @@ -153,7 +153,7 @@ _lp() (lpoptions) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ '(-p -l -r -x)-d[set default printer]:printers:_printers' \ @@ -166,58 +166,58 @@ _lp() (lpstat) _arguments \ - '-E[Force encryption]' \ - '-R[Shows print job ranking]' \ + '-E[force encryption]' \ + '-R[shows print job ranking]' \ '-U:username (for connection to server):_users' \ '-W:which jobs:(completed not-completed)' \ - '-a[Show accepting state]:printers:_printers' \ + '-a[show accepting state]:printers:_printers' \ '-c:printer classes:' \ - '-d[Show current default destination]' \ + '-d[show current default destination]' \ '-h:hostname (alternate server):_hosts' \ '-l[long listing]' \ '-o[destinations]:printers:_printers' \ '-p:printers:_printers' \ '-r[CUPS server running status]' \ - '-s[Status summary]' \ - '-t[All status info]' \ + '-s[status summary]' \ + '-t[all status info]' \ '-u[list jobs by users]:users:_users' \ '-v[show devices]:printers:_printers' ;; (lpr) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-H:hostname (alternate server):_hosts' \ '(-C -J -T)'-{C,J,T}':job name:' \ '-P+[destination printer]:printers:_printers' \ '-U:username (for connection to server):_users' \ - '-#[Copies]:copies (1--100):' \ - '-h[Disables banner printing]' \ + '-#[copies]:copies (1--100):' \ + '-h[disables banner printing]' \ '-l[raw file]' \ - '-m[Send an email on job completion]' \ + '-m[send an email on job completion]' \ '*-o:print job options:_lp_job_options' \ '-p[format with shaded header incl. date, time etc.]' \ - '-q[Hold job for printing.]' \ + '-q[hold job for printing]' \ '-r[delete files after printing]' \ '*:PS/PDF files:_pspdf' ;; (lp) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-U[username (for connection to server)]:username:_users' \ '-c[(OBSOLETE) copy to spool dir before printing]' \ '-d[destination printer]:printers:_printers' \ '-h:hostname (alternate server):_hosts' \ '-i[job id to modify]:job id:' \ - '-m[Send an email on job completion]' \ - '-n[Copies]:copies (1--100):' \ + '-m[send an email on job completion]' \ + '-n[copies]:copies (1--100):' \ '*-o:print job options:_lp_job_options' \ - '-q[Job priority -- 1 (lowest) to 100 (highest)]:priority:' \ - '-s[Dont report resulting job IDs]' \ - '-t[Sets the job name]:job name:' \ + '-q[job priority -- 1 (lowest) to 100 (highest)]:priority:' \ + '-s[dont report resulting job IDs]' \ + '-t[sets the job name]:job name:' \ '-u[job submission username]:username:_users' \ - '-H[Time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \ + '-H[time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \ '-P:page range list:' \ '*:PS/PDF files:_pspdf' ;; diff --git a/Completion/Unix/Command/_unison b/Completion/Unix/Command/_unison index bb8edd489..5725575c5 100644 --- a/Completion/Unix/Command/_unison +++ b/Completion/Unix/Command/_unison @@ -42,7 +42,7 @@ _arguments \ '-copythreshold[use copyprog on files bigger than this]:size (kb):' \ '-debug:debug module:(all verbose)' \ '-diff[command for showing differences between files]:program:_files -g "*(-x)"' \ - '-dontchmod[When set, never use the chmod system call]' \ + '-dontchmod[when set, never use the chmod system call]' \ '-dumbtty[do not change terminal settings in text UI]' \ '-fastcheck:fast update detection:(true false default)' \ '-forcepartial[add a pattern to the forcepartial list]:pattern:' \ @@ -63,7 +63,7 @@ _arguments \ '-mountpoint[abort if this path does not exist]:mountpoint:_files -/' \ '-numericids[dont map uid/gid values by user/group names]' \ '-preferpartial[add a pattern to the preferpartial list]:pattern:' \ - '-pretendwin[Use creation times for detecting updates]' \ + '-pretendwin[use creation times for detecting updates]' \ '-repeat[synchronize repeatedly (text interface only)]:repeat:' \ '-retry[re-try failed synchronizations N times (text ui only)]:retry times:' \ '-rootalias[register alias for canonical root names]:root alias:' \ diff --git a/Completion/X/Command/_matlab b/Completion/X/Command/_matlab index 64d076f43..e912b68c1 100644 --- a/Completion/X/Command/_matlab +++ b/Completion/X/Command/_matlab @@ -1,19 +1,19 @@ #compdef matlab _arguments : \ - {-h,-help}'[Display arguments.]' \ - '(-e)-n[Display final environment variables, and exit]' \ - '(-n)-e[Display ALL the environment variables and values, and exit]' \ - '-arch[Start MATLAB assuming architecture arch]:architecture:' \ - '-c[Set location of the license file]:licensefile:_files' \ + {-h,-help}'[display arguments]' \ + '(-e)-n[display final environment variables, and exit]' \ + '(-n)-e[display ALL the environment variables and values, and exit]' \ + '-arch[start MATLAB assuming architecture arch]:architecture:' \ + '-c[set location of the license file]:licensefile:_files' \ '(-nodisplay)-display:display:_x_display' \ - '(-display)-nodisplay[Do not display any X commands.]' \ - '-nosplash[Do not display the splash screen during startup.]' \ - '-mwvisual[The default X visual to use for figure windows.]:visualid:' \ - '-debug[Provide debugging information especially for X based problems.]' \ - '(-nodesktop -nojvm)-desktop[Allow the MATLAB desktop to be started by a process without a controlling terminal.]' \ - '(-desktop -nojvm)-nodesktop[Do not start the MATLAB desktop.]' \ - '(-nodesktop -desktop)-nojvm[Shut off all Java support by not starting the Java virtual machine.]' \ - '-r[Start MATLAB and execute the MATLAB_command.]:MATLAB_command:' \ - '-logfile[Make a copy of any output to the command window in file log.]:log file:' \ + '(-display)-nodisplay[do not display any X commands]' \ + '-nosplash[do not display the splash screen during startup]' \ + '-mwvisual[the default X visual to use for figure windows]:visualid:' \ + '-debug[provide debugging information especially for X based problems]' \ + '(-nodesktop -nojvm)-desktop[allow the MATLAB desktop to be started by a process without a controlling terminal]' \ + '(-desktop -nojvm)-nodesktop[do not start the MATLAB desktop]' \ + '(-nodesktop -desktop)-nojvm[shut off all Java support by not starting the Java virtual machine]' \ + '-r[start MATLAB and execute the MATLAB_command]:MATLAB_command:' \ + '-logfile[make a copy of any output to the command window in file log]:log file:' \ '-D-:debugger:_path_commands' diff --git a/Completion/X/Command/_okular b/Completion/X/Command/_okular index 0b81e2f9d..bfdb4de4b 100644 --- a/Completion/X/Command/_okular +++ b/Completion/X/Command/_okular @@ -4,7 +4,7 @@ local extns extns="{pdf,ps,eps,dvi}(.gz|.bz2)(#c,1)|djvu|tiff|chm|cbr|cbz" _arguments \ - '(-p --page)'{-p,--page}'[Page of the document to be shown]:page: ' \ - '--presentation[Start the document in presentation mode]' \ - '--unique[Unique instance control]' \ + '(-p --page)'{-p,--page}'[page of the document to be shown]:page: ' \ + '--presentation[start the document in presentation mode]' \ + '--unique[unique instance control]' \ "*:Okular documents:_files -g '*.(#i)($extns)(-.)'" diff --git a/Completion/Zsh/Function/_zargs b/Completion/Zsh/Function/_zargs index a4cf0a89e..f1f87b447 100644 --- a/Completion/Zsh/Function/_zargs +++ b/Completion/Zsh/Function/_zargs @@ -4,19 +4,19 @@ local arguments arguments=( $arguments[@] - '(--eof -e)'{--eof=,-e+}'[Change the end-of-input-args string from "--" to eof-str]' - '(--exit, -x)'{--exit,-x}'[Exit if the size (see --max-chars) is exceeded]' - '--help[Print summary and exit]' - '(--interactive, -p)'{--interactive,-p}'[Prompt before executing each command line]' - '(--max-args, -n)'{--max-args=,-n+}'[Use at most max-args arguments per command line]' - '(--max-chars, -s)'{--max-chars=,-s+}'[Use at most max-chars characters per command line]' - '(--max-lines, -l)'{--max-lines=,-l+}'[Use at most max-lines of the input-args per command line]' - '(--max-procs, -P)'{--max-procs=,-P+}'[Run up to max-procs command lines in the background at once]' - '(--no-run-if-empty, -r)'{--no-run-if-empty,-r}'[Do nothing if there are no input arguments before the eof-str]' - '(--null, -0)'{--null,-0}'[Split each input-arg at null bytes, for xargs compatibility]' - '(--replace, -i)'{--replace=,-i}'[Substitute replace-str in the initial-args by each initial-arg]' - '(--verbose, -t)'{--verbose,-t}'[Print each command line to stderr before executing it]' - '--version[Print the version number of zargs and exit]' + '(--eof -e)'{--eof=,-e+}'[change the end-of-input-args string from "--" to eof-str]' + '(--exit, -x)'{--exit,-x}'[exit if the size (see --max-chars) is exceeded]' + '--help[print summary and exit]' + '(--interactive, -p)'{--interactive,-p}'[prompt before executing each command line]' + '(--max-args, -n)'{--max-args=,-n+}'[use at most max-args arguments per command line]' + '(--max-chars, -s)'{--max-chars=,-s+}'[use at most max-chars characters per command line]' + '(--max-lines, -l)'{--max-lines=,-l+}'[use at most max-lines of the input-args per command line]' + '(--max-procs, -P)'{--max-procs=,-P+}'[run up to max-procs command lines in the background at once]' + '(--no-run-if-empty, -r)'{--no-run-if-empty,-r}'[do nothing if there are no input arguments before the eof-str]' + '(--null, -0)'{--null,-0}'[split each input-arg at null bytes, for xargs compatibility]' + '(--replace, -i)'{--replace=,-i}'[substitute replace-str in the initial-args by each initial-arg]' + '(--verbose, -t)'{--verbose,-t}'[print each command line to stderr before executing it]' + '--version[print the version number of zargs and exit]' ) _arguments -S -s $arguments[@] -- cgit v1.2.3 From 3761265e452af7a31d9c7c10ed6900deeb5291c4 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Fri, 1 Jul 2011 07:36:48 +0000 Subject: 29518: _git: Fall back to file completion for unknown sub-commands. --- ChangeLog | 7 ++++++- Completion/Unix/Command/_git | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 17f7db40a..c589526e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-07-01 Frank Terbeck + + * 29518: Completion/Unix/Command/_git: Fall back to file + completion for unknown sub-commands. + 2011-06-30 Frank Terbeck * 29526: Functions/VCS_Info/vcs_info: Set `max-exports' early @@ -15057,5 +15062,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5383 $ +* $Revision: 1.5384 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index e062705ee..362ec7812 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6023,7 +6023,12 @@ _git() { (option-or-argument) curcontext=${curcontext%:*:*}:git-$words[1]: - _call_function ret _git-$words[1] + if (( ${+functions[_git-$words[1]]} )); then + _git-$words[1] + else + _path_files + ret=$? + fi ;; esac else -- cgit v1.2.3 From f5ba9011f04b56495b665d5a5f334bd2eacf002f Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Fri, 1 Jul 2011 07:37:44 +0000 Subject: 29527: _git: Make file-completion fallback optional. --- ChangeLog | 5 ++++- Completion/Unix/Command/_git | 14 +++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index c589526e2..e76279690 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * 29518: Completion/Unix/Command/_git: Fall back to file completion for unknown sub-commands. + * 29527: Completion/Unix/Command/_git: Make file-completion + fallback optional. + 2011-06-30 Frank Terbeck * 29526: Functions/VCS_Info/vcs_info: Set `max-exports' early @@ -15062,5 +15065,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5384 $ +* $Revision: 1.5385 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 362ec7812..e9eaa86c8 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -17,6 +17,16 @@ # # You could even create a function _git-foo() to handle specific completion # for that command. +# +# When _git does not know a given sub-command (say `bar'), it falls back to +# completing file names for all arguments to that sub command. I.e.: +# +# % git bar +# +# ...will complete file names. If you do *not* want that fallback to be used, +# use the `use-fallback' style like this: +# +# % zstyle ':completion:*:*:git*:*' use-fallback false # TODO: There is still undocumented configurability in here. @@ -6025,9 +6035,11 @@ _git() { if (( ${+functions[_git-$words[1]]} )); then _git-$words[1] - else + elif zstyle -T ":completion:${curcontext}:" use-fallback; then _path_files ret=$? + else + _message 'Unknown sub-command' fi ;; esac -- cgit v1.2.3 From 77b0e65eda6dc01b9e7dcd1c7ebc13fc84147585 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Fri, 1 Jul 2011 07:38:16 +0000 Subject: 29519: _git: Pick up addon completions from $fpath. --- ChangeLog | 5 ++++- Completion/Unix/Command/_git | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index e76279690..7184bfeb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ * 29527: Completion/Unix/Command/_git: Make file-completion fallback optional. + * 29519: Completion/Unix/Command/_git: Pick up addon completions + from $fpath. + 2011-06-30 Frank Terbeck * 29526: Functions/VCS_Info/vcs_info: Set `max-exports' early @@ -15065,5 +15068,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5385 $ +* $Revision: 1.5386 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index e9eaa86c8..322491092 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -4613,6 +4613,12 @@ _git_commands () { _describe -t plumbing-sync-commands 'plumbing sync command' plumbing_sync_commands && ret=0 _describe -t plumbing-sync-helper-commands 'plumbing sync helper command' plumbing_sync_helper_commands && ret=0 _describe -t plumbing-internal-helper-commands 'plumbing internal helper command' plumbing_internal_helper_commands && ret=0 + local -a addons + local a + for a in $_git_third_party; do + (( ${+commands[git-${a%%:*}]} )) && addons+=( $a ) + done + _describe -t third-party-addons 'third party addon' addons && ret=0 return ret } @@ -6049,4 +6055,42 @@ _git() { return ret } +# Handle add-on completions. Say you got a third party add-on `foo'. What you +# want to do is write your completion as `_git-foo' and this code will pick it +# up. That should be a regular compsys function, which starts like this: +# +# #compdef git-foo +# +# In addition to what compinit does, this also reads the second line of the +# completion. If that matches "#desc:*" the part behind "#desc:" will be used +# as the addon's description. Like this: +# +# #desc:checks git's foobar value +local addon input i desc +typeset -gUa _git_third_party +for addon in ${^fpath}/_git-*~*~(.N); do + if [[ -n ${(M)_git_third_party:#${${addon:t}#_git-}*} ]]; then + # This makes sure only the first _git-foo in $fpath gets read. + continue + fi + # Read the second line of the file. + i=1 + desc= + while read input; do + if (( i == 2 )); then + desc=$input + break + fi + (( i++ )) + done < $addon + # Setup `$desc' appropriately. + if [[ $desc != '#desc:'* ]]; then + desc= + else + desc=${desc#\#desc} + fi + # Add the addon's completion. + _git_third_party+=( ${${addon:t}#_git-}$desc ) +done + _git -- cgit v1.2.3 From eefe29722866f792096ec4e09f46b525445e8acc Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Fri, 1 Jul 2011 07:38:45 +0000 Subject: 29521: _git: Add `user-commands' support again. --- ChangeLog | 5 ++++- Completion/Unix/Command/_git | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 7184bfeb8..041a2264d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,9 @@ * 29519: Completion/Unix/Command/_git: Pick up addon completions from $fpath. + * 29521: Completion/Unix/Command/_git: Add `user-commands' support + again. + 2011-06-30 Frank Terbeck * 29526: Functions/VCS_Info/vcs_info: Set `max-exports' early @@ -15068,5 +15071,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5386 $ +* $Revision: 1.5387 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 322491092..29071d1b2 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -4619,6 +4619,9 @@ _git_commands () { (( ${+commands[git-${a%%:*}]} )) && addons+=( $a ) done _describe -t third-party-addons 'third party addon' addons && ret=0 + local -a user_commands + zstyle -a ":completion:${curcontext}:" user-commands user_commands || user_commands=() + _describe -t user-specific-commands 'user specific command' user_commands && ret=0 return ret } -- cgit v1.2.3 From d1a557d008b7fa7881327acbd6decdb50631cc9c Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 4 Jul 2011 20:14:51 +0000 Subject: Eric Moors: 29531: Android debugger completion --- ChangeLog | 7 +- Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_adb | 541 +++++++++++++++++++++++++++++++++++++ 3 files changed, 548 insertions(+), 1 deletion(-) create mode 100644 Completion/Unix/Command/_adb (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index d67af6545..e2fa793ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-07-04 Peter Stephenson + + * Eric Moors: 29531: Completion/Unix/Command/_adb: completion + for Android debugger. + 2011-07-03 Frank Terbeck * unposted: Doc/Zsh/contrib.yo: Fix typo "paramter". Caught by @@ -15092,5 +15097,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5393 $ +* $Revision: 1.5394 $ ***************************************************** diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 91a8786c8..05b4d573a 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -2,6 +2,7 @@ DISTFILES_SRC=' .distfiles _a2ps _aap +_adb _ant _antiword _apachectl diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb new file mode 100644 index 000000000..2e36046c7 --- /dev/null +++ b/Completion/Unix/Command/_adb @@ -0,0 +1,541 @@ +#compdef adb -value-,ADB_TRACE,-default- -value-,ANDROID_SERIAL,-default- -value-,ANDROID_LOG_TAGS,-default- + +local ADB_DEVICE_SPECIFICATION LOG_REDIRECT + +_adb() { + # rely on localoptions + setopt nonomatch + + ADB_DEVICE_SPECIFICATION="" + + if [[ $1 = -l ]]; then + # Run to load _adb and associated functions but do + # nothing else. + return + fi + + if [[ $service = -value-* ]]; then + #_message compstate=$compstate[parameter] + case $compstate[parameter] in + (ADB_TRACE) + _adb_trace_opts + ;; + + (ANDROID_SERIAL) + _adb_device_serial + ADB_DEVICE_SPECIFICATION="-s ${ANDROID_SERIAL}" + ;; + + (ANDROID_LOG_TAGS) + _adb_logcat_filter_specification + ;; + + esac + # We do not handle values anywhere else. + return + fi + + local -a ALL_ADB_COMMANDS + ALL_ADB_COMMANDS=( + "connect" + "disconnect" + "shell" + "wait-for-device" + "push" + "pull" + "logcat" + "jdwp" + "bugreport" + "version" + "forward" + "install" + "uninstall" + "help" + "start-server" + "kill-server" + "devices" + "get-state" + "get-serialno" + "status-window" + "remount" + "reboot" + "reboot-bootloader" + "root" + "usb" + "tcpip" + "ppp" + ) + + (( $+functions[_adb_device_specification] )) && _adb_device_specification + + adb ${=ADB_DEVICE_SPECIFICATION} shell exit 2>/dev/null || { + # early bail-out until a single valid device/emulator is specified and up-and-running + _message -r "No (started) device specified, completions do not yet work" + _arguments \ + '(-d -e )-s[serial]: :_adb_device_serial' \ + '( -e -s)-d[device]' \ + '(-d -s)-e[emulator]' \ + '*:"options":_adb_options_handler' + + return; + } + + (( $+functions[_adb_check_log_redirect] )) && _adb_check_log_redirect + + (( $+functions[_adb_dispatch_command] )) && _adb_dispatch_command +} + +(( $+functions[_adb_dispatch_command] )) || +_adb_dispatch_command () { + local curcontext="${curcontext}" + local integer last_command_pos=-1 + + (( $+functions[_adb_sanitize_context] )) && _adb_sanitize_context + if [[ ${last_command_pos} -gt 0 ]] + then + shift ${last_command_pos}-1 words + CURRENT=$(( ${CURRENT} - ${last_command_pos} + 1 )) + fi + + case ${curcontext} in + (*:adb:shell) + (( $+functions[_adb_dispatch_shell] )) && _adb_dispatch_shell + ;; + (*:adb:connect|*:adb:disconnect) + (( $+functions[_adb_dispatch_connection_handling] )) && _adb_dispatch_connection_handling + ;; + (*:adb:logcat) + (( $+functions[_adb_dispatch_logcat] )) && _adb_dispatch_logcat + ;; + (*:adb:push) + (( $+functions[_adb_dispatch_push] )) && _adb_dispatch_push + ;; + (*:adb:pull) + (( $+functions[_adb_dispatch_pull] )) && _adb_dispatch_pull + ;; + (*:adb:install) + (( $+functions[_adb_dispatch_install] )) && _adb_dispatch_install + ;; + (*:adb:uninstall) + (( $+functions[_adb_dispatch_uninstall] )) && _adb_dispatch_uninstall + ;; + (*) + _arguments \ + '(-d -e)-s["serial"]: :_adb_device_serial' \ + '(-s -e)-d["device"]' \ + '(-d -s)-e["emulator"]' \ + '*:"options":_adb_options_handler' + ;; + esac +} + +(( $+functions[_adb_sanitize_context] )) || +_adb_sanitize_context () { + local -a mywords + for adbcommand in "${ALL_ADB_COMMANDS[@]}" + do + if [[ -n "${adbcommand}" ]] && [[ ${words[(I)${adbcommand}]} -gt 0 ]] + then + last_command_pos=${words[(I)${adbcommand}]} + mywords[${last_command_pos}]=${adbcommand} + fi + done + ##expand unquoted to remove sparse elements + mywords=( ${mywords[@]} ) + curcontext="${curcontext}${mywords[-1]}" +} + +(( $+functions[_adb_device_specification] )) || +_adb_device_specification () { + local integer i=1 + foreach word ($words) + do + i=$(( ++i )) + case ${words[$i]} in + (-d|-e) + ADB_DEVICE_SPECIFICATION="${words[$i]}" + break + ;; + (-s) + ADB_DEVICE_SPECIFICATION="-s ${words[$i + 1]}" + break + ;; + (-*) + continue + ;; + (*) + break + ;; + esac + done +} + +(( $+functions[_adb_dispatch_shell] )) || +_adb_dispatch_shell () { + if [[ ${#words} -le 2 ]] + then + (( $+functions[_adb_shell_commands_handler] )) && _adb_shell_commands_handler + return + fi + + case ${words[2]} in + (am) + (( $+functions[_adb_activity_manager_handler] )) && _adb_activity_manager_handler + ;; + (pm) + (( $+functions[_adb_package_manager_handler] )) && _adb_package_manager_handler + ;; + (*) + _arguments '*:adb_remote_folder:_adb_remote_folder' + ;; + esac +} + +(( $+functions[_adb_pm_list] )) || +_adb_pm_list () { + case ${words[4]} in + (packages) + _arguments -s '-f[see their associated file]' \ + ':' + ;; + (permissions) + _arguments -s '-g[organize by group]' \ + '-f[print all information]' \ + '-d[only list dangerous pemissions]' \ + '-u[only list user visible permissions]' \ + '-s[short summary]' \ + ':' + ;; + (permission-groups) + ;; + (instrumentation) + _arguments -s '-f[see their associated file]' \ + ':' + ;; + (features) + ;; + (*) + _wanted pm_list_argument expl 'pm list argument' compadd packages permission-groups permissions instrumentation features + ;; + esac +} + +(( $+functions[_adb_intent_handler] )) || +_adb_intent_handler () { + _message -r " specifications include these flags: + [-a ] [-d ] [-t ] + [-c [-c ] ...] + [-e|--es ...] + [--esn ...] + [--ez ...] + [-e|--ei ...] + [-n ] [-f ] + [--grant-read-uri-permission] [--grant-write-uri-permission] + [--debug-log-resolution] + [--activity-brought-to-front] [--activity-clear-top] + [--activity-clear-when-task-reset] [--activity-exclude-from-recents] + [--activity-launched-from-history] [--activity-multiple-task] + [--activity-no-animation] [--activity-no-history] + [--activity-no-user-action] [--activity-previous-is-top] + [--activity-reorder-to-front] [--activity-reset-task-if-needed] + [--activity-single-top] + [--receiver-registered-only] [--receiver-replace-pending] + []" +} + +(( $+functions[_adb_activity_manager_handler] )) || +_adb_activity_manager_handler () { + if [[ ${#words} -le 3 ]] + then + _wanted am_argument expl 'am argument' compadd start startservice broadcast instrument profile + return + fi + case ${words[3]} in + (start) + _arguments -s '-D[enable debugging]' \ + '-W[wait for launch to complete]' \ + '*:intent:_adb_intent_handler' + ;; + (startservice) + _arguments -s '*:intent:_adb_intent_handler' + ;; + (broadcast) + _arguments -s '*:intent:_adb_intent_handler' + ;; + (instrument) + _arguments -s '-r[print raw results]' \ + '-e[set argument NAME to VALUE]: :' \ + '-p[write profiling data to FILE]::' \ + '-w[wait for instrumenation to finish]' \ + ':' + ;; + (profile) + _message -r " start/stop " + ;; + esac +} + +(( $+functions[_adb_package_manager_handler] )) || +_adb_package_manager_handler () { + case ${words[3]} in + (list) + (( $+functions[_adb_pm_list] )) && _adb_pm_list + ;; + (path) + (( $+functions[_adb_installed_packages] )) && _adb_installed_packages + ;; + (enable) + (( $+functions[_adb_installed_packages] )) && _adb_installed_packages + ;; + (disable) + (( $+functions[_adb_installed_packages] )) && _adb_installed_packages + ;; + (setInstallLocation) + _wanted set_installlcation expl 'install location' compadd -d "(0:auto 1:internal 2:external)" 0 1 2 + ;; + (getInstallLocation) + ;; + (*) + _wanted pm_argument expl 'pm argument' compadd list path install unistall enable disable setInstallLocation getInstallLocation + ;; + esac +} + +(( $+functions[_adb_dispatch_uninstall] )) || +_adb_dispatch_uninstall () { + argcount=${#${(M)words#-*}} + if [[ $CURRENT -gt (( argcount + 2 )) ]] + then + _message -r "Notice: you can only uninstall one package at a time" + return + fi + + _arguments \ + '-k["keep data and cache"]' \ + '*:"installed package":_adb_installed_packages' +} + +(( $+functions[_adb_dispatch_install] )) || +_adb_dispatch_install () { + argcount=${#${(M)words#-*}} + if [[ $CURRENT -gt (( argcount + 2 )) ]] + then + _message -r "Notice: you can only install one package at a time" + return + fi + + _arguments \ + '-l["forward lock"]' \ + '-r["reinstall"]' \ + '-s["install on sd"]' \ + '*:"select apk file":_path_files -g "*(/)|*.apk"' +} + +(( $+functions[_adb_dispatch_push] )) || +_adb_dispatch_push () { + if [[ ${#words} -gt 3 ]] + then + _message -r "Notice: you can only push a single item at a time" + return + fi + if [[ ${#words} -gt 2 ]] + then + _arguments '*:adb_remote_folder:_adb_remote_folder' + else + _arguments '*:"local file/folder":_files' + fi +} + +(( $+functions[_adb_dispatch_pull] )) || +_adb_dispatch_pull () { + if [[ ${#words} -gt 3 ]] + then + _message -r "Notice: you can only pull a single item at a time" + return + fi + if [[ ${#words} -gt 2 ]] + then + _arguments '*:"local file/folder":_files' + else + _arguments '*:adb_remote_folder:_adb_remote_folder' + fi +} + +(( $+functions[_adb_dispatch_connection_handling] )) || +_adb_dispatch_connection_handling () { + if compset -P '*:' + then + local expl + _wanted ports expl port compadd "$@" 5555 + else + _hosts -qS: + fi +} + +(( $+functions[adb_check_log_redirect] )) || +_adb_check_log_redirect () { + LOG_REDIRECT=${$(adb ${=ADB_DEVICE_SPECIFICATION} shell getprop log.redirect-stdio)// +/} + [[ ${LOG_REDIRECT[1,4]} == "true" ]] && _message -r "Notice: stdio log redirection enabled on the device, so some completions will not work" +} + +(( $+functions[_adb_trace_opts] )) || +_adb_trace_opts() { + _values -s , 'adb trace options' \ + '(1 adb sockets packets rwx usb sync sysdeps transport jdwp)all' \ + '(all adb sockets packets rwx usb sync sysdeps transport jdwp)1' \ + 'adb' \ + 'sockets' \ + 'packets' \ + 'rwx' \ + 'usb' \ + 'sync' \ + 'sysdeps' \ + 'transport' \ + 'jdwp' +} + +(( $+functions[_adb_device_serial] )) || +_adb_device_serial() { + local expl + _wanted dev_serial expl 'available devices' compadd $(command adb devices | sed -n 's/^\([^[:space:]]*\)\t.*$/\1/p') +} + +(( $+functions[_adb_logcat_filter_specification] )) || +_adb_logcat_filter_specification() { + zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_single_command + + local cacheid=logcat_filter_cache_${$(adb ${=ADB_DEVICE_SPECIFICATION} get-serialno)} + typeset -a logcat_filter_tags + if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" + then + logcat_filter_tags=( $(command adb ${=ADB_DEVICE_SPECIFICATION} logcat -d | sed -n 's#^[VDIWEF]/\([^[:space:](]*\).*#\1#p' |sort | uniq) ) + _store_cache "$cacheid" logcat_filter_tags + fi + local expl + if compset -P '*:' + then + _wanted filter expl filter compadd W S E I D V \* + else + _wanted filtertags expl filtertags compadd -qS: ${logcat_filter_tags[@]} \* + fi +} + +(( $+functions[_adb_dispatch_logcat] )) || +_adb_dispatch_logcat() { + _arguments \ + '(-c -g)-s[set default filter to silent]' \ + '(-c -g)-f[log output to file (defaults to stdout)]:logfile:_files' \ + '(-c -g -d)-r[rotate log every kbytes (default 16, requires -f)]:logsize:_guard "[0-9]#" "numeric value"' \ + '(-c -g -d)-n[max number of rotated logs (default 4)]:number :_guard "[0-9]#" "numeric value"' \ + '(-c -g -d)-v[log format]:format: _values "format" brief process tag thread raw time threadtime long' \ + '(-d -t -g)-c[clear log]' \ + '(-c -g)-d[dump log]' \ + '(-c -g)-t[print only recent lines (implies -d)]:linecount:_guard "[0-9]#" "numeric value"' \ + '(-c -g)-B[output log in binary]' \ + '(-c -g)*:filtering:_adb_logcat_filter_specification' +} + +(( $+functions[_adb_options_handler] )) || +_adb_options_handler() { + local expl + _wanted adb_options expl 'adb options' compadd "${ALL_ADB_COMMANDS[@]}" +} + +(( $+functions[_adb_shell_commands_handler] )) || +_adb_shell_commands_handler() { + local expl + _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 + return 1 +} + +(( $+functions[_adb_full_folder_scan] )) || +_adb_full_folder_scan() { + local -a rv; + rv=( ${$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'for i in $(ls -d /*) + do + case $i in + /proc|/sys|/acct) + ;; + *) + ls -R $i + ;; + esac + done' )//'$\r'/} ) + for line in ${rv[@]}; + do + [[ ${line[1]} == '/' ]] && folder="${line%:}" && adb_device_folders+=$folder && continue; + adb_device_folders+=$folder/$line; + done +} + +(( $+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=package_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 && \ + _wanted adb_remote_folder expl 'file/folder on device' _multi_parts $@ -i / filesystem_content +} + +(( $+functions[_adb_installed_packages] )) || +_adb_installed_packages() { + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_single_command + fi + + local cacheid=package_cache_${$(adb ${=ADB_DEVICE_SPECIFICATION} get-serialno)} + typeset -a installed_packages + if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" + then + installed_packages=(${$( adb ${=ADB_DEVICE_SPECIFICATION} shell pm list packages )//#package:/}) + _store_cache "$cacheid" installed_packages + fi + + _wanted adb_installed_packages expl 'packages that are installed' compadd ${installed_packages} +} + +(( $+functions[_adb_cache_policy_single_command] )) || +_adb_cache_policy_single_command () { + typeset -a old + + # cache is valid for 1 minute + old=( "$1"(mm+1) ) + (( $#old )) +} + +(( $+functions[_adb_cache_policy_daily] )) || +_adb_cache_policy_daily () { + typeset -a old + + # cache is valid for a day + old=( "$1"(mh+12) ) + (( $#old )) +} + + + +_adb $@ -- cgit v1.2.3 From 5f275faa955024a78771eb6991220ebb03536b47 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 18 Jul 2011 09:04:00 +0000 Subject: Matthieu Baerts: 29547: bzr: cdiff subcommand. --- ChangeLog | 7 ++++++- Completion/Unix/Command/_bzr | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 20fa306e7..84e45bb23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-07-18 Peter Stephenson + + * Matthieu Baerts: 29547: Completion/Unix/Command/_bzr: cdiff + subcommand. + 2011-07-12 Peter Stephenson * 29543: Src/hist.c: saved history lines with backslash-newline @@ -15106,5 +15111,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5395 $ +* $Revision: 1.5396 $ ***************************************************** diff --git a/Completion/Unix/Command/_bzr b/Completion/Unix/Command/_bzr index 47083ca49..83f6fd19b 100644 --- a/Completion/Unix/Command/_bzr +++ b/Completion/Unix/Command/_bzr @@ -259,7 +259,7 @@ case $cmd in ) ;; -(diff|dif|di) +(diff|dif|di|cdiff) args+=( '(-r --revision)'{--revision=,-r}'[revision]:revision:' '--diff-options=[options to pass to gdiff]:diff options:' -- cgit v1.2.3 From 6502b3827722b1acfb4610367324b56a847bf403 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Thu, 21 Jul 2011 09:05:57 +0000 Subject: 29272: Completion/Unix/Command/_git: Use return values correctly accross all completion functions. --- ChangeLog | 7 +- Completion/Unix/Command/_git | 395 +++++++++++++++++++++++++------------------ 2 files changed, 241 insertions(+), 161 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 4050d1dce..911057672 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-07-21 Nikolai Weibull + + * 29272: Completion/Unix/Command/_git: Use return values correctly + accross all completion functions. + 2011-07-19 Peter Stephenson * 29555: Src/exec.c: fix problem that shell failed to use file @@ -15120,5 +15125,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5398 $ +* $Revision: 1.5399 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 29071d1b2..8f9f6d454 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -36,7 +36,7 @@ (( $+functions[_git-add] )) || _git-add () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args local ignore_missing= @@ -75,6 +75,8 @@ _git-add () { $ignored_files_alternatives && ret=0 ;; esac + + return ret } (( $+functions[_git-am] )) || @@ -109,12 +111,12 @@ _git-am () { '--patch-format=-[specify format patches are in]:patch format:((mbox\:"mbox format" stgit-series\:"StGit patch series" stgit\:"stgit format"))' \ - '*:mbox file:_files' && ret=0 + '*:mbox file:_files' } (( $+functions[_git-archive] )) || _git-archive () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args declare -a backend_args @@ -155,6 +157,8 @@ _git-archive () { __git_tree_files ${PREFIX:-.} $line[1] && ret=0 ;; esac + + return ret } (( $+functions[_git-applymbox] )) || @@ -166,14 +170,14 @@ _git-applymbox () { '-u[encode commit information in UTF-8]' \ '(1)-c[restart command after fixing an unclean patch]:patch:_files -g ".dotest/0*"' \ ':mbox file:_files' \ - '::signoff file:__git_signoff_file' && ret=0 + '::signoff file:__git_signoff_file' } (( $+functions[_git-bisect] )) || _git-bisect () { # TODO: next subcommand is undocumented. Git-bisect.sh mentions that the # subcommand might be removed from the UI level. - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -C \ @@ -256,6 +260,8 @@ _git-bisect () { esac ;; esac + + return ret } (( $+functions[_git-branch] )) || @@ -316,12 +322,12 @@ _git-branch () { $dependent_modification_args \ "($l $c $m -D)-d[delete a fully merged branch]" \ "($l $c $m -d)-D[delete a branch]" \ - $dependent_deletion_args && ret=0 + $dependent_deletion_args } (( $+functions[_git-bundle] )) || _git-bundle () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -C \ @@ -369,6 +375,8 @@ _git-bundle () { esac ;; esac + + return ret } (( $+functions[_git-checkout] )) || @@ -381,7 +389,7 @@ _git-checkout () { new_branch_reflog_opt="(--patch)-l[create the new branch's reflog]" fi - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -w -C -s \ @@ -430,7 +438,7 @@ _git-checkout () { $tree_ish_arg \ $file_arg && ret=0 elif [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan]} ]]; then - _nothing && ret=0 + _nothing elif [[ -n $line[1] ]] && __git_is_treeish $line[1]; then __git_ignore_line __git_tree_files ${PREFIX:-.} $line[1] && ret=0 else @@ -438,6 +446,8 @@ _git-checkout () { fi ;; esac + + return ret } (( $+functions[_git-cherry-pick] )) || @@ -449,7 +459,7 @@ _git-cherry-pick () { '(-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]' \ '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \ - ': :__git_revisions' && ret=0 + ': :__git_revisions' } (( $+functions[_git-citool] )) || @@ -459,7 +469,7 @@ _git-citool () { (( $+functions[_git-clean] )) || _git-clean () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -w -C -S -s \ @@ -509,11 +519,13 @@ _git-clean () { $other_files_alt && ret=0 ;; esac + + return ret } (( $+functions[_git-clone] )) || _git-clone () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args # TODO: Argument to -o should be a remote name. @@ -548,6 +560,8 @@ _git-clone () { fi ;; esac + + return ret } (( $+functions[_git-commit] )) || @@ -599,7 +613,7 @@ _git-commit () { {-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' \ - $amend_opt && ret=0 + $amend_opt } (( $+functions[_git-describe] )) || @@ -616,12 +630,12 @@ _git-describe () { '(--abbrev)--long[always show full format, even for exact matches]' \ '--match=[only consider tags matching glob pattern]:pattern' \ '--always[show uniquely abbreviated commit object as fallback]' \ - '*: :__git_committishs' && ret=0 + '*: :__git_committishs' } (( $+functions[_git-diff] )) || _git-diff () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args local -a diff_options @@ -699,11 +713,13 @@ _git-diff () { esac ;; esac + + return ret } (( $+functions[_git-fetch] )) || _git-fetch () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args local -a fetch_options @@ -727,11 +743,13 @@ _git-fetch () { fi ;; esac + + return ret } (( $+functions[_git-format-patch] )) || _git-format-patch () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args local -a diff_options @@ -780,6 +798,8 @@ _git-format-patch () { fi ;; esac + + return ret } (( $+functions[_git-gc] )) || @@ -789,7 +809,7 @@ _git-gc () { '--auto[check whether housekeeping is required]' \ '( --no-prune)--prune=[prune loose objects older than given date]: :__git_datetimes' \ '(--prune )--no-prune[do not prune any loose objects]' \ - '--quiet[suppress all progress reports]' && ret=0 + '--quiet[suppress all progress reports]' } (( $+functions[_git-grep] )) || @@ -804,7 +824,7 @@ _git-grep () { '--not[the following pattern must not match]') fi - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args # TODO: Need to implement - as a shorthand for -C @@ -881,17 +901,19 @@ _git-grep () { fi ;; esac + + return ret } (( $+functions[_git-gui] )) || _git-gui () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -C \ '--version[display version information]' \ ': :->command' \ - '*:: :->arg' + '*:: :->arg' && ret=0 case $state in (command) @@ -910,7 +932,7 @@ _git-gui () { case $line[1] in (blame) - _git-blame + _git-blame && ret=0 ;; (browser) _arguments -C \ @@ -924,7 +946,7 @@ _git-gui () { esac ;; (citool) - _git-citool + _git-citool && ret=0 ;; (version) _nothing @@ -935,6 +957,8 @@ _git-gui () { esac ;; esac + + return ret } (( $+functions[_git-init] )) || @@ -944,12 +968,12 @@ _git-init () { '--bare[create a bare repository]' \ '--template=[directory to use as a template for the object database]: :_directories' \ '--shared=[share repository amongst several users]:: :__git_repository_permissions' \ - ':: :_directories' && ret=0 + ':: :_directories' } (( $+functions[_git-log] )) || _git-log () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args local -a log_options revision_options @@ -988,6 +1012,8 @@ _git-log () { ;; esac esac + + return ret } (( $+functions[_git-merge] )) || @@ -1000,12 +1026,12 @@ _git-merge () { '-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]' \ - '*: :__git_commits' && ret=0 + '*: :__git_commits' } (( $+functions[_git-mv] )) || _git-mv () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -w -C -S -s \ @@ -1022,11 +1048,13 @@ _git-mv () { 'directories:destination directory:_directories' && ret=0 ;; esac + + return ret } (( $+functions[_git-notes] )) || _git-notes () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -C \ @@ -1092,6 +1120,8 @@ _git-notes () { esac ;; esac + + return ret } (( $+functions[_git-pull] )) || @@ -1106,7 +1136,7 @@ _git-pull () { '(--rebase )--no-rebase[do not perform a rebase after fetching]' \ $fetch_options \ ': :__git_any_repositories' \ - '*: :__git_ref_specs' && ret=0 + '*: :__git_ref_specs' } (( $+functions[_git-push] )) || @@ -1132,7 +1162,7 @@ _git-push () { '(-q --quiet -v --verbose)'{-v,--verbose}'[output additional information]' \ '(-q --quiet)--progress[output progress information]' \ ':: :__git_any_repositories' \ - '*: :__git_ref_specs' && ret=0 + '*: :__git_ref_specs' } (( $+functions[_git-rebase] )) || @@ -1167,12 +1197,12 @@ _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' && ret=0 + '::working branch:__git_branch_names' } (( $+functions[_git-reset] )) || _git-reset () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 typeset -A opt_args _arguments -w -C -s \ @@ -1196,6 +1226,8 @@ _git-reset () { __git_tree_files ${PREFIX:-.} $commit && ret=0 ;; esac + + return ret } (( $+functions[_git-revert] )) || @@ -1206,12 +1238,12 @@ _git-revert () { '(-e --edit)--no-edit[do not edit the commit message]' \ '(-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]' \ - ': :__git_commits' && ret=0 + ': :__git_commits' } (( $+functions[_git-rm] )) || _git-rm () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -w -C -S -s \ @@ -1232,11 +1264,13 @@ _git-rm () { fi ;; esac + + return ret } (( $+functions[_git-shortlog] )) || _git-shortlog () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args local -a revision_options @@ -1268,11 +1302,13 @@ _git-shortlog () { fi ;; esac + + return ret } (( $+functions[_git-show] )) || _git-show () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 typeset -A opt_args local -a log_options revision_options @@ -1293,11 +1329,13 @@ _git-show () { 'blobs::__git_blobs' && ret=0 ;; esac + + return ret } (( $+functions[_git-stash] )) || _git-stash () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -C \ @@ -1378,6 +1416,8 @@ _git-stash () { esac ;; esac + + return ret } (( $+functions[_git-status] )) || @@ -1397,12 +1437,12 @@ _git-status () { all\:"also show untracked files in untracked directories (default)"))' \ '--ignore-submodules[ignore changes to submodules]:: :__git_ignore_submodules_whens' \ '(--porcelain)-z[use NUL termination on output]' \ - '*: :__git_ignore_line_inside_arguments _files' && ret=0 + '*: :__git_ignore_line_inside_arguments _files' } (( $+functions[_git-submodule] )) || _git-submodule () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -C -A '-*' \ @@ -1503,6 +1543,8 @@ _git-submodule () { esac ;; esac + + return ret } (( $+functions[_git-tag] )) || @@ -1534,7 +1576,7 @@ _git-tag () { '::pattern' \ - verification \ '-v[verifies gpg signutare of tags]' \ - '*:: :__git_ignore_line_inside_arguments __git_tags' && ret=0 + '*:: :__git_ignore_line_inside_arguments __git_tags' } # Ancillary Commands (Manipulators) @@ -1542,7 +1584,7 @@ _git-tag () { (( $+functions[_git-config] )) || _git-config () { local name_arg value_arg - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args if (( words[(I)--get-regexp] )); then @@ -1965,7 +2007,7 @@ _git-config () { case $state in (section) - __git_config_sections -b '(|)' '^' section-names 'section name' $* + __git_config_sections -b '(|)' '^' section-names 'section name' $* && ret=0 ;; (is-a-tty) declare -a values @@ -1973,7 +2015,7 @@ _git-config () { true false auto) - _describe -t values 'stdout is a tty' values + _describe -t values 'stdout is a tty' values && ret=0 ;; (option) local label=option @@ -2155,7 +2197,7 @@ _git-config () { ;; (gettable-option) _describe -t git-options option \ - ${${${(0)"$(_call_program gettable-options git config -z --list)"}%%$'\n'*}//:/\\:} + ${${${(0)"$(_call_program gettable-options git config -z --list)"}%%$'\n'*}//:/\\:} && ret=0 ;; (gettable-colorbool-option) __git_config_sections -b '(|)' -a '(|)' '^color\.[^.]+$' gettable-colorbool-options option && ret=0 @@ -2188,7 +2230,7 @@ _git-config () { # TODO: Should really only complete unique remotes, that is, not the same # remote more than once in the list. __git_remotes -S $suffix -q && ret=0 - return + return ret ;; esac local z=$'\0' @@ -2197,7 +2239,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 + (( $#parts > 0 )) || return ret case $parts[4] in ('->'*) case ${parts[4]#->} in @@ -2463,6 +2505,8 @@ _git-config () { esac ;; esac + + return ret } (( $+functions[_git-fast-export] )) || @@ -2484,7 +2528,7 @@ _git-fast-export () { '--fake-missing-tagger=[fake a tagger when tags lack them]' \ '--no-data[do not output blocb objects, instead referring to them via their SHA-1 hash]' \ '--full-tree[output full tree for each commit]' \ - '*: :__git_commit_ranges' && ret=0 + '*: :__git_commit_ranges' } (( $+functions[_git-fast-import] )) || @@ -2504,7 +2548,7 @@ _git-fast-import () { '*--no-relative-marks[paths for export/import are not relative to internal directory in current repository]' \ '--export-pack-edges=-[list packfiles and last commit on branches in them in given file]: :_files' \ '--quiet[disable all non-fatal output]' \ - '--stats[display statistics about object created]' && ret=0 + '--stats[display statistics about object created]' } (( $+functions[_git-filter-branch] )) || @@ -2526,7 +2570,7 @@ _git-filter-branch () { '--original[namespace where original commits will be stored]:namespace:_directories' \ '-d[temporary directory used for rewriting]: :_directories' \ '(-f --force)'{-f,--force}'[force operation]' \ - '*: :__git_commit_ranges' && ret=0 + '*: :__git_commit_ranges' } (( $+functions[_git-mergetool] )) || @@ -2536,7 +2580,7 @@ _git-mergetool () { '(-t --tool)'{-t,--tool=}'[merge resolution program to use]: :__git_mergetools' \ '(-y --no-prompt --prompt)'{-y,--no-prompt}'[do not prompt before invocation of merge resolution program]' \ '(-y --no-prompt)--prompt[prompt before invocation of merge resolution program]' \ - '*:conflicted file:_files' && ret=0 + '*:conflicted file:_files' } (( $+functions[_git-pack-refs] )) || @@ -2545,7 +2589,7 @@ _git-pack-refs () { '( --no-all)--all[pack all refs]' \ '(--all )--no-all[do not pack all refs]' \ '( --no-prune)--prune[remove loose refs after packing them]' \ - '(--prune )--no-prune[do not remove loose refs after packing them]' && ret=0 + '(--prune )--no-prune[do not remove loose refs after packing them]' } (( $+functions[_git-prune] )) || @@ -2554,7 +2598,7 @@ _git-prune () { '(-n --dry-run)'{-n,--dry-run}'[do not remove anything; just report what would be removed]' \ '(-v --verbose)'{-v,--rerbose}'[report all removed objects]' \ '--expire[only expire loose objects older than given date]: :__git_datetimes' \ - '*:: :__git_heads' && ret=0 + '*:: :__git_heads' } (( $+functions[_git-reflog] )) || @@ -2565,9 +2609,9 @@ _git-reflog () { if [[ $words[2] == --* ]]; then _arguments -S \ $revision_options \ - ':: :__git_references' && ret=0 + ':: :__git_references' else - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args # TODO: -h is undocumented. @@ -2626,6 +2670,8 @@ _git-reflog () { ;; esac esac + + return ret fi } @@ -2637,12 +2683,12 @@ _git-relink () { '--help[display help]' \ ': :_directories' \ ': :_directories' \ - '*: :_directories' && ret=0 + '*: :_directories' } (( $+functions[_git-remote] )) || _git-remote () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -C \ @@ -2735,6 +2781,8 @@ _git-remote () { esac ;; esac + + return ret } (( $+functions[_git-repack] )) || @@ -2752,7 +2800,7 @@ _git-repack () { '--window=-[number of objects to consider when doing delta compression]: :__git_guard_number "number of objects"' \ '--depth=-[maximum delta depth]: :__git_guard_number "maximum delta depth"' \ '--window-memory=-[scale window size dynamically to not use more than N bytes of memory]: :__git_guard_bytes' \ - '--max-pack-size=-[maximum size of each output packfile]:maximum pack size:__git_guard_bytes' && ret=0 + '--max-pack-size=-[maximum size of each output packfile]:maximum pack size:__git_guard_bytes' } (( $+functions[_git-replace] )) || @@ -2763,14 +2811,14 @@ _git-replace () { '(- : *)-l[list replace refs]:pattern' \ ': :__git_objects' \ ':replacement:__git_objects' \ - '*: :__git_objects' && ret=0 + '*: :__git_objects' } # Ancillary Commands (Interrogators) (( $+functions[_git-blame] )) || _git-blame () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args declare -a revision_options @@ -2814,6 +2862,8 @@ _git-blame () { fi ;; esac + + return ret } (( $+functions[_git-cherry] )) || @@ -2824,13 +2874,13 @@ _git-cherry () { '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ ':upstream commit:__git_commits' \ '::head commit:__git_commits' \ - '::limit commit:__git_commits' && ret=0 + '::limit commit:__git_commits' } (( $+functions[_git-count-objects] )) || _git-count-objects () { _arguments \ - '(-v --verbose)'{-v,--verbose}'[also report number of in-pack objects and objects that can be removed]' && ret=0 + '(-v --verbose)'{-v,--verbose}'[also report number of in-pack objects and objects that can be removed]' } (( $+functions[_git-difftool] )) || @@ -2857,7 +2907,7 @@ _git-fsck () { '--strict[do strict checking]' \ '(-v --verbose)'{-v,--verbose}'[output additional information]' \ '--lost-found[write dangling objects into .git/lost-found]' \ - '*: :__git_objects' && ret=0 + '*: :__git_objects' } (( $+functions[_git-get-tar-commit-id] )) || @@ -2872,12 +2922,12 @@ _git-help () { '(-a --all -m --man -w --web)'{-i,--info}'[show all available commands]' \ '(-a --all -i --info -w --web)'{-m,--man}'[show all available commands]' \ '(-a --all -i --info -m --man )'{-w,--web}'[show all available commands]' \ - ': :__git_aliases_and_commands' && ret=0 + ': :__git_aliases_and_commands' } (( $+functions[_git-instaweb] )) || _git-instaweb () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -w -C -S -s \ @@ -2903,6 +2953,8 @@ _git-instaweb () { _describe -t commands command commands && ret=0 ;; esac + + return ret } (( $+functions[_git-merge-tree] )) || @@ -2910,12 +2962,12 @@ _git-merge-tree () { _arguments \ ':base-tree:__git_tree_ishs' \ ':branch 1:__git_tree_ishs' \ - ':branch 2:__git_tree_ishs' && ret=0 + ':branch 2:__git_tree_ishs' } (( $+functions[_git-rerere] )) || _git-rerere () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args # TODO: --rerere-autoupdate is undocumented. @@ -2934,6 +2986,8 @@ _git-rerere () { 'gc[prune old records of conflicted merges]' && ret=0 ;; esac + + return ret } (( $+functions[_git-rev-parse] )) || @@ -2951,6 +3005,8 @@ _git-rev-parse () { quiet_opts=({-q,--quiet}'[do not output error messages]') fi + local ret=0 + if (( words[(I)--parseopt] )); then if (( words[(I)--] )); then _message 'argument' @@ -3001,11 +3057,13 @@ _git-rev-parse () { '(--until --before)'{--until=-,--before=-}'[show --min-age= parameter corresponding given date string]:datestring' \ '*: :__git_objects' && ret=0 fi + + return ret } (( $+functions[_git-show-branch] )) || _git-show-branch () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -w -C -S -s -A '-*' \ @@ -3041,6 +3099,8 @@ _git-show-branch () { fi ;; esac + + return ret } (( $+functions[_git-verify-tag] )) || @@ -3048,7 +3108,7 @@ _git-verify-tag () { # TODO: -v and --verbose are undocumented. _arguments -w -S -s \ '(-v --verbose)'{-v,--verbose}'[output additional information]' \ - '*: :__git_tags' && ret=0 + '*: :__git_tags' } (( $+functions[_git-whatchanged] )) || @@ -3059,7 +3119,7 @@ _git-whatchanged () { _arguments -S \ $revision_options \ '1:: :__git_commits' \ - '*: :__git_cached_files' && ret=0 + '*: :__git_cached_files' } # Interacting With Others @@ -3077,7 +3137,7 @@ _git-archimport () { '-D[attempt to import trees that have been merged from]: :__git_guard_number depth' \ '-a[auto-register archives at http://mirrors.sourcecontrol.net]' \ '-t[use given directory as temporary directory]: :_directories' \ - '*:archive/branch' && ret=0 + '*:archive/branch' } (( $+functions[_git-cvsexportcommit] )) || @@ -3098,7 +3158,7 @@ _git-cvsexportcommit () { '-v[verbose output]' \ '-h[display usage]' \ ':: :__git_commits' \ - ': :__git_commits' && ret=0 + ': :__git_commits' } (( $+functions[_git-cvsimport] )) || @@ -3125,7 +3185,7 @@ _git-cvsimport () { '-A[specify author-conversion file]:author-conversion file:_files' \ '-R[generate cvs-revisions file mapping CVS revision numbers to commit IDs]' \ '-h[display usage information]' \ - ':cvsmodule' && ret=0 + ':cvsmodule' } (( $+functions[_git-cvsserver] )) || @@ -3137,7 +3197,7 @@ _git-cvsserver () { '(- * -V --version)'{-V,--version}'[display version information]' \ '(- * -h --help)'{-h,-H,--help}'[display usage information]' \ '::type:(pserver server)' \ - '*: :_directories' && ret=0 + '*: :_directories' } (( $+functions[_git-imap-send] )) || @@ -3150,7 +3210,7 @@ _git-quiltimport () { _arguments -S \ '(-n --dry-run)'{-n,--dry-run}'[check patches and warn if they cannot be imported]' \ '--author[default author name and email address to use for patches]: :_email_addresses' \ - '--patches[set directory containing patches]:patch directory:_directories' && ret=0 + '--patches[set directory containing patches]:patch directory:_directories' } (( $+functions[_git-request-pull] )) || @@ -3200,12 +3260,12 @@ _git-send-email () { '( --no-validate)--validate[perform sanity checks on patches]' \ '(--validate )--validate[do not perform sanity checks on patches]' \ '--force[send emails even if safetiy checks would prevent it]' \ - '*: :_files' && ret=0 + '*: :_files' } (( $+functions[_git-svn] )) || _git-svn () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -C \ @@ -3448,6 +3508,8 @@ _git-svn () { esac ;; esac + + return ret } # LOW-LEVEL COMMANDS (PLUMBING) @@ -3478,7 +3540,7 @@ _git-apply () { '--inaccurate-eof[work around missing-new-line-at-EOF bugs]' \ '(-v --verbose)'{-v,--verbose}'[display progress on stderr]' \ '--recount[do not trust line counts in hunk headers]' \ - '*:patch:_files' && ret=0 + '*:patch:_files' } (( $+functions[_git-checkout-index] )) || @@ -3500,7 +3562,7 @@ _git-checkout-index () { '--temp[write content to temporary files]' \ '(-a --all *)--stdin[read list of paths from the standard input]' \ $z_opt \ - '*: :__git_cached_files' && ret=0 + '*: :__git_cached_files' } (( $+functions[_git-commit-tree] )) || @@ -3508,11 +3570,11 @@ _git-commit-tree () { if (( CURRENT == 2 )); then _arguments \ '-h[display usage]' \ - ': :__git_trees' && ret=0 + ': :__git_trees' elif [[ $words[CURRENT-1] == -p ]]; then local expl _description commits expl 'parent commit' - __git_objects $expl && ret=0 + __git_objects $expl else compadd - '-p' fi @@ -3530,7 +3592,7 @@ _git-hash-object () { '(: --stdin --path)--stdin-paths[read file names from standard input instead of from command line]' \ '( --no-filters)--path=[hash object as if it were located at given path]: :_files' \ '(--path )--no-filters[hash contents as is, ignoring any input filters]' \ - '(--stdin --stdin-paths):file:_files' && ret=0 + '(--stdin --stdin-paths):file:_files' } (( $+functions[_git-index-pack] )) || @@ -3551,7 +3613,7 @@ _git-index-pack () { '--stdin[read pack from stdin and instead write to specified file]' \ $stdin_opts \ '--strict[die if the pack contains broken objects or links]' \ - ':pack file:_files -g "*.pack"' && ret=0 + ':pack file:_files -g "*.pack"' } (( $+functions[_git-merge-file] )) || @@ -3580,7 +3642,7 @@ _git-merge-file () { '--diff3[undocumented]' \ ':current file:_files' \ ':base file:_files' \ - ':other file:_files' && ret=0 + ':other file:_files' } (( $+functions[_git-merge-index] )) || @@ -3588,7 +3650,7 @@ _git-merge-index () { if (( CURRENT > 2 )) && [[ $words[CURRENT-1] != -[oq] ]]; then _arguments -S \ '(:)-a[run merge against all files in index that need merging]' \ - '*: :__git_cached_files' && ret=0 + '*: :__git_cached_files' else declare -a arguments @@ -3596,7 +3658,7 @@ _git-merge-index () { (( CURRENT == 2 || CURRENT == 3 )) && arguments+='(-o)-q[do not complain about failed merges]' (( 2 <= CURRENT && CURRENT <= 4 )) && arguments+='*:merge program:_files -g "*(*)"' - _arguments -S $arguments && ret=0 + _arguments -S $arguments fi } @@ -3610,7 +3672,7 @@ _git-mktree () { _arguments -w -S -s \ '-z[read NUL-terminated ls-tree -z output]' \ '--missing[allow missing objects]' \ - '--batch[allow creation of more than one tree]' && ret=0 + '--batch[allow creation of more than one tree]' } (( $+functions[_git-pack-objects] )) || @@ -3652,14 +3714,14 @@ _git-pack-objects () { '--keep-true-parents[pack parents hidden by grafts]' \ '( --unpack-unreachable)--keep-unreachable[undocumented]' \ '(--keep-unreachable )--unpack-unreachable[undocumented]' \ - ':base-name:_files' && ret=0 + ':base-name:_files' } (( $+functions[_git-prune-packed] )) || _git-prune-packed () { _arguments -w -S -s \ '(-n --dry-run)'{-n,--dry-run}'[only list objects that would be removed]' \ - '(-q --quiet)'{-q,--quiet}'[do not display progress on standard error]' && ret=0 + '(-q --quiet)'{-q,--quiet}'[do not display progress on standard error]' } (( $+functions[_git-read-tree] )) || @@ -3698,7 +3760,7 @@ _git-read-tree () { '--no-sparse-checkout[display sparse checkout support]' \ '1:first tree-ish to be read/merged:__git_tree_ishs' \ '2::second tree-ish to be read/merged:__git_tree_ishs' \ - '3::third tree-ish to be read/merged:__git_tree_ishs' && ret=0 + '3::third tree-ish to be read/merged:__git_tree_ishs' } (( $+functions[_git-symbolic-ref] )) || @@ -3707,7 +3769,7 @@ _git-symbolic-ref () { '(-q --quiet)'{-q,--quiet}'[do not issue error if specified name is not a symbolic ref]' \ '-m[update reflog for specified name with specied reason]:reason for update' \ ':symbolic reference:__git_heads' \ - ':: :__git_references' && ret=0 + ':: :__git_references' } (( $+functions[_git-unpack-objects] )) || @@ -3716,7 +3778,7 @@ _git-unpack-objects () { '-n[only list the objects that would be unpacked]' \ '-q[run quietly]' \ '-r[try recovering objects from corrupt packs]' \ - '--strict[do not write objects with broken content or links]' && ret=0 + '--strict[do not write objects with broken content or links]' } (( $+functions[_git-update-index] )) || @@ -3754,7 +3816,7 @@ _git-update-index () { '(: -)--stdin[read list of paths from standard input]' \ '--verbose[report what is being added and removed from the index]' \ $z_opt \ - '*:: :_files' && ret=0 + '*:: :_files' } (( $+functions[_git-update-ref] )) || @@ -3765,7 +3827,7 @@ _git-update-ref () { '--no-deref[overwrite ref itself, not what it points to]' \ ':symbolic reference:__git_revisions' \ ':new reference:__git_revisions' \ - '::old reference:__git_revisions' && ret=0 + '::old reference:__git_revisions' } (( $+functions[_git-write-tree] )) || @@ -3773,7 +3835,7 @@ _git-write-tree () { # NOTE: --ignore-cache-tree is only used for debugging. _arguments -w -S -s \ '--missing-ok[ignore objects in index that are missing in object database]' \ - '--prefix=[write tree representing given sub-directory]:sub-directory:_directories -r ""' && ret=0 + '--prefix=[write tree representing given sub-directory]:sub-directory:_directories -r ""' } # Interrogation commands @@ -3789,7 +3851,7 @@ _git-cat-file () { '(- :)--batch[print SHA1, type, size, and contents of each object provided on stdin]' \ '(- :)--batch-check[print SHA1, type, and size of each object provided on stdin]' \ '(-):object type:(blob commit tag tree)' \ - ': :__git_objects' && ret=0 + ': :__git_objects' } (( $+functions[_git-diff-files] )) || @@ -3801,7 +3863,7 @@ _git-diff-files () { $revision_options \ ': :__git_changed-in-working-tree_files' \ ': :__git_changed-in-working-tree_files' \ - '*: :__git_changed-in-working-tree_files' && ret=0 + '*: :__git_changed-in-working-tree_files' } (( $+functions[_git-diff-index] )) || @@ -3818,12 +3880,12 @@ _git-diff-index () { '--cached[do not consider the work tree at all]' \ '-m[flag non-checked-out files as up-to-date]' \ ': :__git_tree_ishs' \ - '*: :__git_cached_files' && ret=0 + '*: :__git_cached_files' } (( $+functions[_git-diff-tree] )) || _git-diff-tree () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args declare -a revision_options @@ -3868,6 +3930,8 @@ _git-diff-tree () { fi ;; esac + + return ret } (( $+functions[_git-for-each-ref] )) || @@ -3883,7 +3947,7 @@ _git-for-each-ref () { '(-s --shell -p --perl --python --tcl)'{-p,--perl}'[use string literals suitable for Perl]' \ '(-s --shell -p --perl --tcl)'--python'[use string literals suitable for Python]' \ '(-s --shell -p --perl --python )'--tcl'[use string literals suitable for Tcl]' \ - ':: :_guard "([^-]?#|)" pattern' && ret=0 + ':: :_guard "([^-]?#|)" pattern' } (( $+functions[_git-ls-files] )) || @@ -3918,7 +3982,7 @@ _git-ls-files () { '-v[identify each files status (hmrck?)]' \ '--full-name[force paths to be output relative to the project top directory]' \ '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ - '*:: :_files' && ret=0 + '*:: :_files' } (( $+functions[_git-ls-remote] )) || @@ -3929,12 +3993,12 @@ _git-ls-remote () { '(-t --tags)'{-t,--tags}'[show only refs under refs/tags]' \ '(-u --upload-pack)'{-u,--upload-pack=-}'[specify path to git-upload-pack on remote side]:remote path' \ ': :__git_any_repositories' \ - '*: :__git_references' && ret=0 + '*: :__git_references' } (( $+functions[_git-ls-tree] )) || _git-ls-tree () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -w -C -S -s \ @@ -3955,6 +4019,8 @@ _git-ls-tree () { __git_ignore_line __git_tree_files ${PREFIX:-.} $line[1] && ret=0 ;; esac + + return ret } (( $+functions[_git-merge-base] )) || @@ -3964,7 +4030,7 @@ _git-merge-base () { '--octopus[compute best common ancestors of all supplied commits]' \ '(-)--independent[display minimal subset of supplied commits with same ancestors]' \ ': :__git_commits' \ - '*: :__git_commits' && ret=0 + '*: :__git_commits' } (( $+functions[_git-name-rev] )) || @@ -3977,7 +4043,7 @@ _git-name-rev () { '--name-only[display only name of commits]' \ '--no-undefined[die with non-zero return when a reference is undefined]' \ '--always[show uniquely abbreviated commit object as fallback]' \ - '(--stdin --all)*: :__git_commits' && ret=0 + '(--stdin --all)*: :__git_commits' } (( $+functions[_git-pack-redundant] )) || @@ -3986,12 +4052,12 @@ _git-pack-redundant () { '(:)--all[process all packs]' \ '--alt-odb[do not require objects to be present in local packs]' \ '--verbose[output some statistics to standard error]' \ - '(--all)*::packs:_files -g "*.pack"' && ret=0 + '(--all)*::packs:_files -g "*.pack"' } (( $+functions[_git-rev-list] )) || _git-rev-list () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args declare -a revision_options @@ -4018,6 +4084,8 @@ _git-rev-list () { fi ;; esac + + return ret } (( $+functions[_git-show-index] )) || @@ -4039,14 +4107,14 @@ _git-show-ref () { '(-q --quiet)'{-q,--quiet}'[do not print any results]' \ '*: :_guard "([^-]?#|)" pattern' \ - exclude \ - '--exclude-existing=-[filter out existing refs from stdin]:: :_guard "([^-]?#|)" pattern' && ret=0 + '--exclude-existing=-[filter out existing refs from stdin]:: :_guard "([^-]?#|)" pattern' } (( $+functions[_git-unpack-file] )) || _git-unpack-file () { _arguments -A '-*' \ '(:)-h[display usage information]' \ - '(-): :__git_blobs' && ret=0 + '(-): :__git_blobs' } (( $+functions[_git-var] )) || @@ -4056,7 +4124,7 @@ _git-var () { '(-):variable:((GIT_AUTHOR_IDENT\:"name and email of author" \ GIT_COMMITTER_IDENT\:"name and email of committer" \ GIT_EDITOR\:"text editor used by git commands" \ - GIT_PAGER\:"text viewer used by git commands"))' && ret=0 + GIT_PAGER\:"text viewer used by git commands"))' } (( $+functions[_git-verify-pack] )) || @@ -4064,7 +4132,7 @@ _git-verify-pack () { _arguments -w -S -s \ '(-v --verbose)'{-v,--verbose}'[show objects contained in pack]' \ '(-s --stat-only)'{-s,--stat-only}'[do not verify pack contents; only display histogram of delta chain length]' \ - '*:index file:_files -g "*.idx"' && ret=0 + '*:index file:_files -g "*.idx"' } # Synching Repositories @@ -4098,7 +4166,7 @@ _git-daemon () { '--disable=-[disable site-wide service]: :__git_daemon_service' \ '--allow-override[allow overriding site-wide service]: :__git_daemon_service' \ '--forbid-override[forbid overriding site-wide service]: :__git_daemon_service' \ - '*:repository:_directories' && ret=0 + '*:repository:_directories' } (( $+functions[_git-fetch-pack] )) || @@ -4115,7 +4183,7 @@ _git-fetch-pack () { '--no-progress[do not display progress]' \ '-v[produce verbose output]' \ ': :__git_any_repositories' \ - '*: :__git_references' && ret=0 + '*: :__git_references' } (( $+functions[_git-http-backend] )) || @@ -4139,13 +4207,13 @@ _git-send-pack () { '--stateless-rpc[undocumented]' \ '--helper-status[undocumented]' \ ': :__git_any_repositories' \ - '*: :__git_remote_references' && ret=0 + '*: :__git_remote_references' } (( $+functions[_git-update-server-info] )) || _git-update-server-info () { _arguments -w -S -s \ - '(-f --force)'{-f,--force}'[update the info files from scratch]' && ret=0 + '(-f --force)'{-f,--force}'[update the info files from scratch]' } (( $+functions[_git-http-fetch] )) || @@ -4159,7 +4227,7 @@ _git-http-fetch () { '--recover[recover from a failed fetch]' \ '(1)--stdin[read commit ids and refs from standard input]' \ ': :__git_commits' \ - ': :_urls' && ret=0 + ': :_urls' } (( $+functions[_git-http-push] )) || @@ -4172,7 +4240,7 @@ _git-http-push () { '( -D)-d[remove refs from remote repository]' \ '(-d )-D[forcefully remove refs from remote repository]' \ ': :_urls' \ - '*: :__git_remote_references' && ret=0 + '*: :__git_remote_references' } # NOTE: git-parse-remote isn’t a user command. @@ -4184,12 +4252,12 @@ _git-receive-pack () { _arguments -A '-*' \ '--advertise-refs[undocumented]' \ '--stateless-rpc[undocumented]' \ - ':directory to sync into:_directories' && ret=0 + ':directory to sync into:_directories' } (( $+functions[_git-shell] )) || _git-shell () { - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args _arguments -C \ @@ -4227,13 +4295,15 @@ _git-shell () { esac ;; esac + + return ret } (( $+functions[_git-upload-archive] )) || _git-upload-archive () { _arguments \ - ':directory to get tar archive from:_directories' && ret=0 + ':directory to get tar archive from:_directories' } (( $+functions[_git-upload-pack] )) || @@ -4245,7 +4315,7 @@ _git-upload-pack () { '--timeout=-[interrupt transfer after given number of seconds of inactivity]: :__git_guard_number "inactivity timeout"' \ '--advertise-refs[undocumented]' \ '--stateless-rpc[undocumented]' \ - ': :_directories' && ret=0 + ': :_directories' } # Internal Helper Commands @@ -4254,7 +4324,7 @@ _git-upload-pack () { _git-check-attr () { local z_opt= - local curcontext=$curcontext state line + local curcontext=$curcontext state line ret=1 declare -A opt_args if (( words[(I)--stdin] )); then @@ -4290,6 +4360,8 @@ _git-check-attr () { fi ;; esac + + return ret } (( $+functions[_git-check-ref-format] )) || @@ -4298,7 +4370,7 @@ _git-check-ref-format () { '-h[display usage information]' \ '--print[display canonicalized name of hypothetical reference of given name]' \ '--branch[expand previous branch syntax]' \ - ': :__git_references' && ret=0 + ': :__git_references' } (( $+functions[_git-fmt-merge-msg] )) || @@ -4307,7 +4379,7 @@ _git-fmt-merge-msg () { '( --no-log)--log[display one-line descriptions from actual commits being merged]' \ '(--log )--no-log[do not display one-line descriptions from actual commits being merged]' \ '(-m --message)'{-m+,--message=}'[use given message instead of branch names for first line in log message]:message' \ - '(-F --file)'{-F,--file}'[specify list of merged objects from file]: :_files' && ret=0 + '(-F --file)'{-F,--file}'[specify list of merged objects from file]: :_files' } (( $+functions[_git-mailinfo] )) || @@ -4322,7 +4394,7 @@ _git-mailinfo () { '(--scissors )--no-scissors[do not remove everything in body before a scissors line]' \ '--no-inbody-headers[undocumented]' \ ':message file:_files' \ - ':patch file:_files' && ret=0 + ':patch file:_files' } (( $+functions[_git-mailsplit] )) || @@ -4333,7 +4405,7 @@ _git-mailsplit () { '-d-[specify number of leading zeros]: :__git_guard_number precision' \ '-f-[skip the first N numbers]: :__git_guard_number' \ '--keep-cr[do not remove CR from lines ending with CR+LF]' \ - '*::mbox file:_files' && ret=0 + '*::mbox file:_files' } (( $+functions[_git-merge-one-file] )) || @@ -4351,7 +4423,7 @@ _git-patch-id () { (( $+functions[_git-stripspace] )) || _git-stripspace () { _arguments \ - '(-s --strip-comments)'{-s,--strip-comments}'[also strip lines starting with #]' && ret=0 + '(-s --strip-comments)'{-s,--strip-comments}'[also strip lines starting with #]' } # INTERNAL GIT COMPLETION FUNCTIONS @@ -4602,6 +4674,7 @@ _git_commands () { stripspace:'filter out empty lines') integer ret=1 + # TODO: Is this the correct way of doing it? # TODO: Should we be chaining them together with || instead? _describe -t main-porcelain-commands 'main porcelain command' main_porcelain_commands && ret=0 @@ -4613,15 +4686,18 @@ _git_commands () { _describe -t plumbing-sync-commands 'plumbing sync command' plumbing_sync_commands && ret=0 _describe -t plumbing-sync-helper-commands 'plumbing sync helper command' plumbing_sync_helper_commands && ret=0 _describe -t plumbing-internal-helper-commands 'plumbing internal helper command' plumbing_internal_helper_commands && ret=0 + local -a addons local a for a in $_git_third_party; do (( ${+commands[git-${a%%:*}]} )) && addons+=( $a ) done _describe -t third-party-addons 'third party addon' addons && ret=0 + local -a user_commands zstyle -a ":completion:${curcontext}:" user-commands user_commands || user_commands=() _describe -t user-specific-commands 'user specific command' user_commands && ret=0 + return ret } @@ -4640,6 +4716,7 @@ __git_aliases_and_commands () { 'aliases::__git_aliases' \ 'commands::_git_commands' } + (( $+functions[__git_date_formats] )) || __git_date_formats () { declare -a date_formats @@ -4670,7 +4747,7 @@ __git_merge_strategies () { local -a merge_strategies merge_strategies=(${=${${(M)${(f)"$(_call_program merge-strategies "git merge -s '' 2>&1")"}:#[Aa]vailable (custom )#strategies are: *}#[Aa]vailable (custom )#strategies are: }%.}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 _wanted merge-strategies expl 'merge strategy' compadd $* - $merge_strategies } @@ -4834,7 +4911,7 @@ __git_reflog_entries () { declare -a reflog_entries reflog_entries=(${${${(f)"$(_call_program reflog-entries git reflog 2>/dev/null)"}#* }%%:*}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 if compset -P '*@'; then reflog_entries=(${${(M)reflog_entries:#$IPREFIX*}#$IPREFIX}) @@ -4895,7 +4972,7 @@ __git_stashes () { declare -a stashes stashes=(${${(f)"$(_call_program stashes git stash list 2>/dev/null)"}/: */}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 _wanted stashes expl stash compadd $* - $stashes } @@ -4934,7 +5011,7 @@ __git_branch_names () { declare -a branch_names branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 _wanted branch-names expl branch-name compadd $* - $branch_names } @@ -4945,7 +5022,7 @@ __git_remote_branch_names () { declare -a branch_names branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 _wanted remote-branch-names expl 'remote branch name' compadd $* - $branch_names } @@ -5065,7 +5142,7 @@ __git_submodules () { declare -a submodules submodules=(${${(f)"$(_call_program submodules git submodule 2>/dev/null)"}#* }) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 _wanted submodules expl submodule compadd $* - $submodules } @@ -5078,7 +5155,7 @@ __git_tags () { declare -a tags tags=(${${(f)"$(_call_program tagrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 _wanted tags expl tag compadd $* - $tags } @@ -5101,15 +5178,11 @@ __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/}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 _wanted $type-tags expl "$type tag" compadd $* - $tags } -(( $+functions[__git_tag_ids] )) || -__git_tag_ids () { -} - # Reference Argument Types (( $+functions[__git_references] )) || @@ -5126,7 +5199,7 @@ __git_references () { # TODO: deal with GIT_DIR if [[ $_git_refs_cache_pwd != $PWD ]]; then _git_refs_cache=(${${${(f)"$(_call_program references git ls-remote ./. 2>/dev/null)"}#*$'\t'}#refs/(heads|tags)/}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 _git_refs_cache_pwd=$PWD fi @@ -5139,7 +5212,7 @@ __git_local_references () { if [[ $_git_local_refs_cache_pwd != $PWD ]]; then _git_local_refs_cache=(${${${(f)"$(_call_program references git ls-remote ./. 2>/dev/null)"}#*$'\t'}#refs/}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 _git_local_refs_cache_pwd=$PWD fi @@ -5156,7 +5229,7 @@ __git_local_references () { local references expl references=(${${(M)${${(f)"$(_call_program references git ls-remote ./. 2>/dev/null)"}#*$'\t'}:#refs/notes/*}#refs/notes/}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 _wanted references expl reference compadd - $references } @@ -5166,9 +5239,9 @@ __git_notes_refs () { declare -a notes_refs notes_refs=(${${(f)"$(_call_program notes-refs git for-each-ref --format='"%(refname)"' refs/notes 2>/dev/null)"}#$type refs/notes/}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 - _wanted notes-refs expl "notes ref" compadd $* - $notes_refs + _wanted notes-refs expl 'notes ref' compadd $* - $notes_refs } # File Argument Types @@ -5178,7 +5251,7 @@ __git_files_relative () { local files file f_parts prefix p_parts tmp prefix=$(_call_program gitprefix git rev-parse --show-prefix 2>/dev/null) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 if (( $#prefix == 0 )); then print $1 @@ -5215,10 +5288,10 @@ __git_files () { tag=$1 description=$2; shift 2 gitcdup=$(_call_program gitcdup git rev-parse --show-cdup 2>/dev/null) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 gitprefix=$(_call_program gitprefix git rev-parse --show-prefix 2>/dev/null) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 # TODO: --directory should probably be added to $opts when --others is given. @@ -5274,9 +5347,9 @@ __git_changed-in-index_files () { local files expl files=$(_call_program files git diff-index -z --name-only --no-color --cached HEAD 2>/dev/null) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 files=(${(0)"$(__git_files_relative $files)"}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 _wanted changed-in-index-files expl 'changed in index file' _multi_parts $@ - / files } @@ -5286,9 +5359,9 @@ __git_changed-in-working-tree_files () { local files expl files=$(_call_program changed-in-working-tree-files git diff -z --name-only --no-color 2>/dev/null) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 files=(${(0)"$(__git_files_relative $files)"}) - __git_command_successful $pipestatus || return + __git_command_successful $pipestatus || return 1 _wanted changed-in-working-tree-files expl 'changed in working tree file' _multi_parts $@ -f - / files } @@ -5429,7 +5502,7 @@ __git_guard_branch-name () { __git_guard_diff-stat-width () { if [[ $PREFIX == *,* ]]; then compset -P '*,' - __git_guard_number "filename width" + __git_guard_number 'filename width' else compset -S ',*' __git_guard_number width @@ -5442,7 +5515,7 @@ __git_guard_number () { zparseopts -K -D -A opts M: J: V: 1 2 n F: X: - _guard "[[:digit:]]#" ${1:-number} + _guard '[[:digit:]]#' ${1:-number} } (( $+functions[__git_guard_bytes] )) || @@ -5453,17 +5526,17 @@ __git_guard_bytes () { (( $+functions[__git_datetimes] )) || __git_datetimes () { # TODO: Use this in more places. - _guard "*" 'time specification' + _guard '*' 'time specification' } (( $+functions[__git_stages] )) || __git_stages () { - __git_guard $* "[[:digit:]]#" 'stage' + __git_guard $* '[[:digit:]]#' 'stage' } (( $+functions[__git_svn_revision_numbers] )) || __git_svn_revision_numbers () { - __git_guard_number "revision number" + __git_guard_number 'revision number' } # _arguments Helpers @@ -6014,7 +6087,8 @@ _git() { unset git_aliases aliases fi - local ret=1 + integer ret=1 + if [[ $service == git ]]; then local curcontext=$curcontext state line declare -A opt_args @@ -6035,6 +6109,7 @@ _git() { '--no-replace-objects[do not use replacement refs to replace git objects]' \ '(-): :->command' \ '(-)*:: :->option-or-argument' && return + case $state in (command) __git_aliases_and_commands && ret=0 @@ -6043,18 +6118,18 @@ _git() { curcontext=${curcontext%:*:*}:git-$words[1]: if (( ${+functions[_git-$words[1]]} )); then - _git-$words[1] + _call_function ret _git-$words[1] elif zstyle -T ":completion:${curcontext}:" use-fallback; then - _path_files - ret=$? + _path_files && ret=0 else - _message 'Unknown sub-command' + _message 'unknown sub-command' fi ;; esac else _call_function ret _$service fi + return ret } -- cgit v1.2.3 From e3c1917345abff3fd27e862795e2dbd0ef82b166 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Thu, 21 Jul 2011 09:08:32 +0000 Subject: unposted: Completion/Unix/Command/_git: Move _gitk and _tig to correct location. --- ChangeLog | 5 ++++- Completion/Unix/Command/_git | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 911057672..7498e80d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * 29272: Completion/Unix/Command/_git: Use return values correctly accross all completion functions. + * unposted: Completion/Unix/Command/_git: Move _gitk and _tig to + correct location. + 2011-07-19 Peter Stephenson * 29555: Src/exec.c: fix problem that shell failed to use file @@ -15125,5 +15128,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5399 $ +* $Revision: 1.5400 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 8f9f6d454..b4fcf07d5 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1579,6 +1579,16 @@ _git-tag () { '*:: :__git_ignore_line_inside_arguments __git_tags' } +(( $+functions[_gitk] )) || +_gitk () { + _git-log +} + +(( $+functions[_tig] )) || +_tig () { + _git-log +} + # Ancillary Commands (Manipulators) (( $+functions[_git-config] )) || @@ -6052,16 +6062,6 @@ __git_color_attributes () { _describe -t attributes attribute attributes $* } -(( $+functions[_gitk] )) || -_gitk () { - _git-log -} - -(( $+functions[_tig] )) || -_tig () { - _git-log -} - # Now, for the main driver… _git() { if (( CURRENT > 2 )); then -- cgit v1.2.3 From d37eda52f30cc50aa1908ca0a7abc99719a63d50 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Thu, 21 Jul 2011 09:15:41 +0000 Subject: unposted: Completion/Unix/Command/_git: Fix bug in git-add completion that prevented -f option from being used correctly. --- ChangeLog | 5 ++++- Completion/Unix/Command/_git | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 7498e80d4..2e02bbab6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ * unposted: Completion/Unix/Command/_git: Move _gitk and _tig to correct location. + * unposted: Completion/Unix/Command/_git: Fix bug in git-add completion + that prevented -f option from being used correctly. + 2011-07-19 Peter Stephenson * 29555: Src/exec.c: fix problem that shell failed to use file @@ -15128,5 +15131,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5400 $ +* $Revision: 1.5401 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b4fcf07d5..b41cb4b19 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -63,7 +63,7 @@ _git-add () { (file) # TODO: Use __git_ignore_line_inside_arguments. declare -a ignored_files_alternatives - if [[ -n ${line[(I)-f|--force]} ]]; then + if [[ -n ${opt_args[(I)-f|--force]} ]]; then ignored_files_alternatives=( 'ignored-modified-files:ignored modified files:__git_modified_files --ignored' 'ignored-other-files:ignored other files:__git_other_files --ignored') -- cgit v1.2.3 From 3eb08466453403c6ac3f5f84405b91f1ed007bfb Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Thu, 21 Jul 2011 10:03:09 +0000 Subject: unposted: Completion/Unix/Command/_git: Update git-add completion to not complete already given file arguments and also to not list file completions if an option is being completed. --- ChangeLog | 6 +++++- Completion/Unix/Command/_git | 17 ++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 2e02bbab6..c1f1c75ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,10 @@ * unposted: Completion/Unix/Command/_git: Fix bug in git-add completion that prevented -f option from being used correctly. + * unposted: Completion/Unix/Command/_git: Update git-add completion to + not complete already given file arguments and also to not list file + completions if an option is being completed. + 2011-07-19 Peter Stephenson * 29555: Src/exec.c: fix problem that shell failed to use file @@ -15131,5 +15135,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5401 $ +* $Revision: 1.5402 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b41cb4b19..2fdc4d61c 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -57,21 +57,20 @@ _git-add () { '--refresh[do not add files, but refresh their stat() info in index]' \ '--ignore-errors[continue adding if an error occurs]' \ $ignore_missing \ - '*:: :->file' && ret=0 + '*:: :->file' && return case $state in (file) - # TODO: Use __git_ignore_line_inside_arguments. declare -a ignored_files_alternatives if [[ -n ${opt_args[(I)-f|--force]} ]]; then ignored_files_alternatives=( - 'ignored-modified-files:ignored modified files:__git_modified_files --ignored' - 'ignored-other-files:ignored other files:__git_other_files --ignored') + 'ignored-modified-files:ignored modified files:__git_ignore_line_inside_arguments __git_modified_files --ignored' + 'ignored-other-files:ignored other files:__git_ignore_line_inside_arguments __git_other_files --ignored') fi _alternative \ - 'modified-files::__git_modified_files' \ - 'other-files::__git_other_files' \ + 'modified-files::__git_ignore_line_inside_arguments __git_modified_files' \ + 'other-files::__git_ignore_line_inside_arguments __git_other_files' \ $ignored_files_alternatives && ret=0 ;; esac @@ -4524,7 +4523,11 @@ __git_ignore_line () { (( $+functions[__git_ignore_line_inside_arguments] )) || __git_ignore_line_inside_arguments () { - __git_ignore_line ${*[-1]} ${*[1,-2]} + declare -a compadd_opts + + zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F: + + __git_ignore_line $* $compadd_opts } # Common Argument Types -- cgit v1.2.3 From aad36667dec6b583986ed84b0d1ffad7ed690944 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Thu, 21 Jul 2011 11:37:45 +0000 Subject: unposted: Completion/Unix/Command/_git: Adjust some TODO items. --- ChangeLog | 4 +++- Completion/Unix/Command/_git | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index c1f1c75ca..69a22245b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,8 @@ not complete already given file arguments and also to not list file completions if an option is being completed. + * unposted: Completion/Unix/Command/_git: Adjust some TODO items. + 2011-07-19 Peter Stephenson * 29555: Src/exec.c: fix problem that shell failed to use file @@ -15135,5 +15137,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5402 $ +* $Revision: 1.5403 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 2fdc4d61c..ef85ad79c 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -83,11 +83,10 @@ _git-am () { local -a apply_options __git_setup_apply_options - # NOTE: --resolvemsg is only for internal use between git rebase and git am. + # NOTE: --rebasing and --resolvemsg are only for internal use between git + # rebase and git am. # TODO: --patch-format is undocumented. - # TODO: --ignore-date is incorrectly documented as being passed to git - # mailsplit. - # TODO: --rebasing, --rerere-autoupdate, and --no-rerere-autoupdate are + # TODO: --rerere-autoupdate and --no-rerere-autoupdate are # undocumented (and not implemented here). _arguments -S \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \ -- cgit v1.2.3 From 53998c2cf5b93b7653083f99a42e20047292ba48 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Fri, 22 Jul 2011 09:44:22 +0000 Subject: unposted: Completion/Unix/Command/_git: Use _files, not _path_files. --- ChangeLog | 6 +++++- Completion/Unix/Command/_git | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 69a22245b..7368f87ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-07-22 Nikolai Weibull + + * unposted: Completion/Unix/Command/_git: Use _files, not _path_files. + 2011-07-21 Nikolai Weibull * 29272: Completion/Unix/Command/_git: Use return values correctly @@ -15137,5 +15141,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5403 $ +* $Revision: 1.5404 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index ef85ad79c..1c9d8a8e3 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6122,7 +6122,7 @@ _git() { if (( ${+functions[_git-$words[1]]} )); then _call_function ret _git-$words[1] elif zstyle -T ":completion:${curcontext}:" use-fallback; then - _path_files && ret=0 + _files && ret=0 else _message 'unknown sub-command' fi -- cgit v1.2.3 From 6b42b83f41a882cb107f686c96c7a8e6b3061b67 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Fri, 22 Jul 2011 13:08:25 +0000 Subject: * 29582, 29589: Update handling of third-party Git commands --- ChangeLog | 10 +- Completion/Debian/Command/_git-buildpackage | 2 +- Completion/Unix/Command/_git | 147 ++++++++++++++++------------ 3 files changed, 92 insertions(+), 67 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 7368f87ab..7479f3218 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,14 @@ * unposted: Completion/Unix/Command/_git: Use _files, not _path_files. + * 29582: Completion/Unix/Command/_git: Alter the way that commands and + aliases are listed when both are requested. + + * 29589: Completion/Unix/Command/_git, + Completion/Debian/Command/_git-buildpackage: Use #description instead + of #desc: for description of third-party commands. Also, refactor the + code to match the rest of the file. + 2011-07-21 Nikolai Weibull * 29272: Completion/Unix/Command/_git: Use return values correctly @@ -15141,5 +15149,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5404 $ +* $Revision: 1.5405 $ ***************************************************** diff --git a/Completion/Debian/Command/_git-buildpackage b/Completion/Debian/Command/_git-buildpackage index 935100802..a2dc65689 100644 --- a/Completion/Debian/Command/_git-buildpackage +++ b/Completion/Debian/Command/_git-buildpackage @@ -1,5 +1,5 @@ #compdef git-buildpackage -#desc:build Debian packages from a git repository +#description build Debian packages from a git repository _arguments \ '--version[show program version number and exit]' \ diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 1c9d8a8e3..fb0450608 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2,7 +2,7 @@ # Some parts of this completion's behaviour are configurable: # -# Say, you got your own git sub-commands (git will run a program `git-foo' +# Say you got your own git sub-commands (git will run a program `git-foo' # when you run "git foo") and you want "git f" to complete that sub # commands name for you. You can make that sub-command know to the completion # via the user-command style: @@ -15,8 +15,21 @@ # # % zstyle ':completion:*:*:git:*' user-commands ${${(M)${(k)commands}:#git-*}/git-/} # -# You could even create a function _git-foo() to handle specific completion -# for that command. +# A better solution is to create a function _git-foo() to handle specific +# completion for that command. This also allows you to add command-specific +# completion as well. Place such a function inside an autoloaded #compdef file +# and you should be all set. You can add a description to such a function by +# adding a line matching +# +# #description DESCRIPTION +# +# as the second line in the file. See +# Completion/Debian/Command/_git-buildpackage in the Zsh sources for an +# example. +# +# As this solution is so much better than the user-commands zstyle method, the +# zstyle method is now DEPRECATED. It will most likely be removed in the next +# major release of Zsh (5.0). # # When _git does not know a given sub-command (say `bar'), it falls back to # completing file names for all arguments to that sub command. I.e.: @@ -2114,7 +2127,7 @@ _git-config () { __git_mergetools -S . && ret=0 ;; (pager.) - __git_aliases_and_commands && ret=0 + _git_commands && ret=0 ;; (pretty.) __git_config_sections -a '(|)' '^pretty\..+\.[^.]+$' prettys 'pretty format string' && ret=0 @@ -2930,7 +2943,7 @@ _git-help () { '(-a --all -m --man -w --web)'{-i,--info}'[show all available commands]' \ '(-a --all -i --info -w --web)'{-m,--man}'[show all available commands]' \ '(-a --all -i --info -m --man )'{-w,--web}'[show all available commands]' \ - ': :__git_aliases_and_commands' + ': :_git_commands' } (( $+functions[_git-instaweb] )) || @@ -4685,11 +4698,41 @@ _git_commands () { patch-id:'compute unique ID for a patch' stripspace:'filter out empty lines') + local -a user_commands + zstyle -a :completion:$curcontext: user-commands user_commands + + local -a third_party_commands + local command + for command in $_git_third_party_commands; do + (( $+commands[git-${command%%:*}] )) && third_party_commands+=$command + done + + local -a aliases unique_aliases + __git_extract_aliases + local alias + for alias in $aliases; do + local name=${alias%%:*} + (( main_porcelain_commands[(I)$name:*] || + user_commands[(I)$name:*] || + third_party_commands[(I)$name:*] || + ancillary_manipulator_commands[(I)$name:*] || + ancillary_interrogator_commands[(I)$name:*] || + interaction_commands[(I)$name:*] || + plumbing_manipulator_commands[(I)$name:*] || + plumbing_interrogator_commands[(I)$name:*] || + plumbing_sync_commands[(I)$name:*] || + plumbing_sync_helper_commands[(I)$name:*] || + plumbing_internal_helper_commands[(I)$name:*] )) || unique_aliases+=$alias + done + integer ret=1 - # TODO: Is this the correct way of doing it? - # TODO: Should we be chaining them together with || instead? + # TODO: Is this the correct way of doing it? Should we be using _alternative + # and separate functions for each set of commands instead? + _describe -t aliases alias unique_aliases && ret=0 _describe -t main-porcelain-commands 'main porcelain command' main_porcelain_commands && ret=0 + _describe -t user-commands 'user command' user_commands && ret=0 + _describe -t third-party-commands 'third-party command' third_party_commands && ret=0 _describe -t ancillary-manipulator-commands 'ancillary manipulator command' ancillary_manipulator_commands && ret=0 _describe -t ancillary-interrogator-commands 'ancillary interrogator command' ancillary_interrogator_commands && ret=0 _describe -t interaction-commands 'interaction command' interaction_commands && ret=0 @@ -4699,34 +4742,20 @@ _git_commands () { _describe -t plumbing-sync-helper-commands 'plumbing sync helper command' plumbing_sync_helper_commands && ret=0 _describe -t plumbing-internal-helper-commands 'plumbing internal helper command' plumbing_internal_helper_commands && ret=0 - local -a addons - local a - for a in $_git_third_party; do - (( ${+commands[git-${a%%:*}]} )) && addons+=( $a ) - done - _describe -t third-party-addons 'third party addon' addons && ret=0 - - local -a user_commands - zstyle -a ":completion:${curcontext}:" user-commands user_commands || user_commands=() - _describe -t user-specific-commands 'user specific command' user_commands && ret=0 - return ret } (( $+functions[__git_aliases] )) || __git_aliases () { - declare -a aliases - - aliases=(${^${${(0)"$(_call_program aliases "git config -z --get-regexp '^alias.'")"}#alias.}/$'\n'/:alias for \'}\') + local -a aliases + __git_extract_aliases _describe -t aliases alias aliases $* } -(( $+functions[__git_aliases_and_commands] )) || -__git_aliases_and_commands () { - _alternative \ - 'aliases::__git_aliases' \ - 'commands::_git_commands' +(( $+functions[__git_extract_aliases] )) || +__git_extract_aliases () { + aliases=(${^${${(0)"$(_call_program aliases "git config -z --get-regexp '^alias.'")"}#alias.}/$'\n'/:alias for \'}\') } (( $+functions[__git_date_formats] )) || @@ -6073,7 +6102,7 @@ _git() { aliases=(${(f)${${${(f)"$(_call_program aliases git config --get-regexp '\^alias\.')"}#alias.}/ /$'\n'}/(#e)/$'\n'}) (( $#aliases % 2 == 0 )) && git_aliases=($aliases) - if [[ -n ${git_aliases[$words[2]]} ]] ; then + if (( $+git_aliases[$words[2]] && !$+commands[git-$words[2]] )); then local -a tmpwords expalias expalias=(${(z)git_aliases[$words[2]]}) tmpwords=(${words[1]} ${expalias}) @@ -6114,14 +6143,14 @@ _git() { case $state in (command) - __git_aliases_and_commands && ret=0 + _git_commands && ret=0 ;; (option-or-argument) curcontext=${curcontext%:*:*}:git-$words[1]: - if (( ${+functions[_git-$words[1]]} )); then + if (( $+functions[_git-$words[1]] )); then _call_function ret _git-$words[1] - elif zstyle -T ":completion:${curcontext}:" use-fallback; then + elif zstyle -T :completion:$curcontext: use-fallback; then _files && ret=0 else _message 'unknown sub-command' @@ -6135,42 +6164,30 @@ _git() { return ret } -# Handle add-on completions. Say you got a third party add-on `foo'. What you -# want to do is write your completion as `_git-foo' and this code will pick it -# up. That should be a regular compsys function, which starts like this: -# -# #compdef git-foo -# -# In addition to what compinit does, this also reads the second line of the -# completion. If that matches "#desc:*" the part behind "#desc:" will be used -# as the addon's description. Like this: -# -# #desc:checks git's foobar value -local addon input i desc -typeset -gUa _git_third_party -for addon in ${^fpath}/_git-*~*~(.N); do - if [[ -n ${(M)_git_third_party:#${${addon:t}#_git-}*} ]]; then - # This makes sure only the first _git-foo in $fpath gets read. - continue - fi - # Read the second line of the file. - i=1 - desc= - while read input; do - if (( i == 2 )); then - desc=$input - break - fi - (( i++ )) - done < $addon - # Setup `$desc' appropriately. - if [[ $desc != '#desc:'* ]]; then - desc= - else - desc=${desc#\#desc} +# Load any _git-* definitions so that they may be completed as commands. +declare -gUa _git_third_party_commands +_git_third_party_commands=() + +local file +for file in ${^fpath}/_git-*~(*~|*.zwc)(.N); do + local name=${${file:t}#_git-} + if (( $+_git_third_party_commands[$name] )); then + continue + fi + + local desc= + integer i=1 + while read input; do + if (( i == 2 )); then + if [[ $input == '#description '* ]]; then + desc=:${input#\#description } + fi + break fi - # Add the addon's completion. - _git_third_party+=( ${${addon:t}#_git-}$desc ) + (( i++ )) + done < $file + + _git_third_party_commands+=$name$desc done _git -- cgit v1.2.3 From d557905eb63f5fa087675e05ba82210c86dde358 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Fri, 29 Jul 2011 13:07:52 +0000 Subject: Luka Perkov: 29624: _quilt: Improve `push' and `pop' completion. --- ChangeLog | 7 ++++++- Completion/Unix/Command/_quilt | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 10 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 57b269b31..fec3754f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-07-29 Frank Terbeck + + * Luka Perkov: 29624: Completion/Unix/Command/_quilt: Improve + `push' and `pop' completion. + 2011-07-28 Peter Stephenson * 29626: Src/parse.c, Test/C04funcdef.ztst: arguments to @@ -15179,5 +15184,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5411 $ +* $Revision: 1.5412 $ ***************************************************** diff --git a/Completion/Unix/Command/_quilt b/Completion/Unix/Command/_quilt index a2fd799a6..0c51ba5bc 100644 --- a/Completion/Unix/Command/_quilt +++ b/Completion/Unix/Command/_quilt @@ -1,5 +1,8 @@ #compdef quilt +local -a tmp +local rc + _arguments \ '--trace' \ '--quiltrc:config file:_files' \ @@ -10,21 +13,37 @@ _arguments \ '*::subcmd:->subcmd' && return 0 case "$state" in - (subcmd) + (subcmd) case "$words[1]" in (applied|delete|files|graph|header|next|previous|refresh|unapplied) - _wanted -V 'patches' expl 'patch' compadd ${(f)"$(quilt series)"} - ;; + _wanted -V 'patches' expl 'patch' compadd ${(f)"$(quilt series)"} + ;; (push) - _wanted -V 'unapplied patches' expl 'patch' compadd ${(f)"$(quilt unapplied)"} - ;; + if (( CURRENT == 2 )); then + tmp=( ${(f)"$(quilt unapplied 2>&1)"} ) + rc=$? + if (( rc == 0 )); then + _wanted -V 'unapplied patches' expl 'patch' compadd "${tmp[@]}" + else + _message "No unapplied patches" + fi + fi + ;; (pop) - _wanted -V 'applied patches' expl 'patch' compadd ${(f)"$(quilt applied)"} - ;; + if (( CURRENT == 2 )); then + tmp=( ${(f)"$(quilt applied 2>&1)"} ) + rc=$? + if (( rc == 0 )); then + _wanted -V 'applied patches' expl 'patch' compadd "${tmp[@]}" + else + _message "No applied patches" + fi + fi + ;; (*) - _files - ;; + _files + ;; esac ;; esac -- cgit v1.2.3 From 7ae79966147f97eed54f5705782685170d7c1a97 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 17 Aug 2011 10:20:00 +0000 Subject: 29683: add -O forward to _ssh. --- ChangeLog | 4 +++- Completion/Unix/Command/_ssh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 4fe7b9ced..6aefda033 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ * 29682: Completion/Zsh/Command/.distfiles, Completion/Zsh/Command/_schedtool: new _schedtool completer. + * 29683: Completion/Unix/Command/_ssh: add -O forward to _ssh. + 2011-08-16 Wayne Davison * 29650: Src/jobs.c: don't lose the the time info after a @@ -15278,5 +15280,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5433 $ +* $Revision: 1.5434 $ ***************************************************** diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index eb5947ce0..491eba6f2 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -78,7 +78,7 @@ _ssh () { '(-x -X)-Y[enable trusted X11 forwarding]' \ '-M[master mode for connection sharing]' \ '-S+:path to control socket:_files' \ - '-O:multiplex control command:(check exit)' \ + '-O:multiplex control command:(check exit forward)' \ '*-L[specify local port forwarding]:local port forwarding:->forward' \ '*-R[specify remote port forwarding]:remote port forwarding:->forward' \ ':remote host name:->userhost' \ -- cgit v1.2.3 From 2a79494070d9805a7f3ab97ba18ae2733737ec52 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 17 Aug 2011 10:24:34 +0000 Subject: 29690: new _twidge and _cryptsetup completers from Daniel Friesel. --- ChangeLog | 6 +- Completion/Linux/Command/.distfiles | 1 + Completion/Linux/Command/_cryptsetup | 103 +++++++++++++++++++++++++++++++++++ Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_twidge | 77 ++++++++++++++++++++++++++ 5 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 Completion/Linux/Command/_cryptsetup create mode 100644 Completion/Unix/Command/_twidge (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 6aefda033..eba819cb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,10 @@ * 29683: Completion/Unix/Command/_ssh: add -O forward to _ssh. + * Daniel Friesel: 29690: Completion/Linux/Command/_cryptsetup, + Completion/Unix/Command/_twidge: new _twidge and _cryptsetup + completers. + 2011-08-16 Wayne Davison * 29650: Src/jobs.c: don't lose the the time info after a @@ -15280,5 +15284,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5434 $ +* $Revision: 1.5435 $ ***************************************************** diff --git a/Completion/Linux/Command/.distfiles b/Completion/Linux/Command/.distfiles index 251204e3b..509330f6b 100644 --- a/Completion/Linux/Command/.distfiles +++ b/Completion/Linux/Command/.distfiles @@ -5,6 +5,7 @@ _acpitool _analyseplugin _brctl _chrt +_cryptsetup _ethtool _fusermount _ionice diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup new file mode 100644 index 000000000..3519336e8 --- /dev/null +++ b/Completion/Linux/Command/_cryptsetup @@ -0,0 +1,103 @@ +#compdef cryptsetup +## completion for cryptsetup 1.3.0, based on cryptsetup(1) + +function _cryptsetup_action { + typeset -a actions + actions=( + 'create:create a mapping' + 'remove:remove an existing mapping' + 'status:report mapping status' + 'resize:resize an active mapping' + 'luksFormat:Initialize a LUKS partition' + 'luksOpen:Open LUKS partition' + 'luksClose:remove an existing mapping' + 'luksSuspend:suspend active device' + 'luksResume:resume suspended device' + 'luksAddKey:add a new key' + 'luksRemoveKey:remove a key' + 'luksChangeKey:change a key' + 'luksKillSlot:wipe key from slot' + 'luksUUID:print/change device UUID' + 'isLuks:check if device is a LUKS partition' + 'luksDump:dump header information' + 'luksHeaderBackup:store binary backup of headers' + 'luksHeaderRestore:restore header backup' + ) + _describe action actions +} + +function _cryptsetup_device { + typeset expl + _wanted file expl device \ + _files +} + +function _cryptsetup_mapping { + typeset expl + _wanted file expl 'mapping name' \ + _path_files -W /dev/mapper +} + +function _cryptsetup_arguments { + + case ${words[1]} in + + create) + _arguments ':mapping:_cryptsetup_mapping' ':device:_cryptsetup_device' + ;; + + remove|status|resize|luksClose|luksSuspend|luksResume) + _arguments ': :_cryptsetup_mapping' + ;; + + luks(AddKey|RemoveKey|DelKey|UUID|Dump)|isLuks) + _arguments ': :_cryptsetup_device' + ;; + + luks(Format|AddKey|RemoveKey|ChangeKey)) + _arguments ': :_cryptsetup_device' ':key file:_files' + ;; + + luksKillSlot) + _arguments ': :_cryptsetup_device' ':key slot number' + ;; + + luksOpen) + _arguments ': :_cryptsetup_device' ': :_cryptsetup_mapping' + ;; + + esac +} + +function _cryptsetup { + _arguments \ + '(-v --verbose)'{-v,--verbose}'[enable verbose mode]' \ + '--debug[enable debug mode]' \ + '(-h --hash)'{-h,--hash}'[hash algorithm]:hash algorithm' \ + '(-c --cipher)'{-c,--cipher}'[set cipher]:cipher specification' \ + '(-y --verify-passphrase)'{-y,--verify-passphrase}'[query for password twice]' \ + '(-d --key-file)'{-d,--key-file}'[set keyfile]:key file:_files' \ + '(-l --keyfile-size)'{-l,--keyfile-size}'[set keyfile size]:bytes' \ + '--new-keyfile-size[set new keyfile size (luksAddKey)]:bytes' \ + '--master-key-file[set master key]:key file:_files' \ + '--dump-master-key[dump luks master key]' \ + '(--use-urandom)--use-random[use /dev/random to generate volume key]' \ + '(--use-random)--use-urandom[use /dev/urandom to generate volume key]' \ + '(-S --key-slot)'{-S,--key-slot}'[select key slot]:key slot' \ + '(-s --key-size)'{-s,--key-size}'[set key size]:bits' \ + '(-b --size)'{-b,--size}'[force device size]:sectors' \ + '(-o --offset)'{-o,--offset}'[set start offset]:sectors' \ + '(-p --skip)'{-p,--skip}'[data to skip at beginning]:sectors' \ + '--readonly[set up read-only mapping]' \ + '(-i --iter-time)'{-i,--iter-time}'[set password processing duration]:milliseconds' \ + '(-q --batch-mode)'{-q,--batch-mode}'[do not ask for confirmation]' \ + '(-t --timeout)'{-t,--timeout}'[set password prompt timeout]:seconds' \ + '(-T --tries)'{-T,--tries}'[set maximum number of retries]:maximum retries' \ + '--align-payload[set payload alignment]:sectors' \ + '--uuid[set device UUID]:uuid' \ + '--version[show version information]' \ + ':action:_cryptsetup_action' \ + '*::arguments:_cryptsetup_arguments' +} + +_cryptsetup "$@" diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 05b4d573a..19fa397d5 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -226,6 +226,7 @@ _topgit _totd _tracepath _tree +_twidge _twisted _unace _uname diff --git a/Completion/Unix/Command/_twidge b/Completion/Unix/Command/_twidge new file mode 100644 index 000000000..d8b3b3def --- /dev/null +++ b/Completion/Unix/Command/_twidge @@ -0,0 +1,77 @@ +#compdef twidge +## completion for twidge 1.0.8, based on twidge(1) + +function _twidge_command { + typeset -a twidge_commands + typeset -i skip=1 + + twidge lscommands | while read cmd desc; do + if [[ $cmd == ---* ]] { + skip=0 + continue + } + if (( skip )) { + continue + } + twidge_commands+="${cmd}:${desc}" + done + + _describe command twidge_commands +} + +function _twidge_args { + typeset -a args_common args_more args_other args_update + + args_common=( + '(-a --all)'{-a,--all}'[receive all content]' + '(-e --exec)'{-e,--exec}'[execute command for each retrieved item]:command' + '(-l --long)'{-l,--long}'[long output format]' + '(-m --mailto)'{-m,--mailto}'[mail retrieved items]:mail address' + ) + + args_more=( + '(-s --saveid)'{-s,--saveid}'[save ID of most recent message]' + '(-u --unseen)'{-u,--unseen}'[only show unseen messages]' + ) + + args_other=( + '(-U --username)'{-U,--username}'[show updates of different user]:username' + ) + + args_update=( + '(-i --inreplyto)'{-i,--inreplyto}'[update in reply to a message]:message id' + '(-i --inreplyto 1)-r[read RFC2822 Mail]' + ':status' + ) + + case ${words[1]} in + lsarchive) + _arguments $args_common $args_more $args_other + ;; + ls(dm(|archive)|recent|replies|rt(|archive|replies))) + _arguments $args_common $args_more + ;; + lsfollow(ers|ing)) + _arguments $args_common :username + ;; + dmsend) + _arguments :recipient :status + ;; + (un|)follow) + _message username + ;; + update) + _arguments $args_update + ;; + esac +} + +function _twidge { + _arguments \ + '(-c --config)'{-c,--config}'[config file]:file:_files' \ + '(-d --debug)'{-d,--debug}'[enable debugging output]' \ + '(-): :_twidge_command' \ + '(-)*:: :_twidge_args' +} + +_twidge "$@" -- cgit v1.2.3 From 9e8cdf31b9dc1d0d9bd599b07dff9777602b7ab4 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Wed, 17 Aug 2011 10:50:26 +0000 Subject: 29698: Completion/Unix/Command/_git: Complete diff options for git log --- ChangeLog | 7 ++++++- Completion/Unix/Command/_git | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index eba819cb7..3c3b3b538 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-08-17 Nikolai Weibull + + * 29698: Completion/Unix/Command/_git: Complete diff options for git + log. + 2011-08-17 Mikael Magnusson * 29681: Src/Zle/zle_refresh.c: consistently use [] to access @@ -15284,5 +15289,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5435 $ +* $Revision: 1.5436 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index fb0450608..6221eb6a4 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -987,13 +987,15 @@ _git-log () { local curcontext=$curcontext state line ret=1 declare -A opt_args - local -a log_options revision_options + local -a log_options revision_options diff_options __git_setup_log_options __git_setup_revision_options + __git_setup_diff_options _arguments -w -C -s \ $log_options \ $revision_options \ + $diff_options \ '(-)--[start file arguments]' \ '*:: :->commit-range-or-file' && ret=0 @@ -5340,6 +5342,7 @@ __git_files () { files=(${(0)"$(_call_program files git ls-files -z --exclude-standard $opts -- ${pref:+$pref\*} 2>/dev/null)"}) __git_command_successful $pipestatus || return +# _wanted $tag expl $description _files -g '{'${(j:,:)files}'}' $compadd_opts - _wanted $tag expl $description _multi_parts -f $compadd_opts - / files } -- cgit v1.2.3 From 5bbedb3df35aaa0cb72882674f50eb89f8d30a7b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 17 Aug 2011 18:54:30 +0000 Subject: Anthony R Fletcher: users/16260: new systemctl completion --- ChangeLog | 7 ++- Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_systemctl | 102 +++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 Completion/Unix/Command/_systemctl (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 3c3b3b538..bd9d9229b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-08-17 Peter Stephenson + + * Anthony R Fletcher: users/16260: + Completion/Unix/Command/_systemctl: new completion. + 2011-08-17 Nikolai Weibull * 29698: Completion/Unix/Command/_git: Complete diff options for git @@ -15289,5 +15294,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5436 $ +* $Revision: 1.5437 $ ***************************************************** diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 19fa397d5..696faea88 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -208,6 +208,7 @@ _subversion _sudo _surfraw _sysctl +_systemctl _tar _tardy _tcpdump diff --git a/Completion/Unix/Command/_systemctl b/Completion/Unix/Command/_systemctl new file mode 100644 index 000000000..5dd35db7a --- /dev/null +++ b/Completion/Unix/Command/_systemctl @@ -0,0 +1,102 @@ +#compdef systemctl + +# Completion for systemd's systemctl +# Version 1.0 ARF 3 August 2011 + +# list the unit completions. +_systemd_units(){ + local -a units + local expl + units=(${(f)"$( systemctl --full list-units | sed -e 's/ .*//' )"}) + _wanted keys expl 'units' compadd "$units[@]" +} + +# list the job completions. +_systemd_jobs(){ + local -a jobs + local expl + jobs=(${(f)"$( systemctl --full list-jobs | sed -e 's/ .*//' )"}) + _wanted keys expl 'jobs' compadd "$jobs[@]" +} + +# list the snapshot completions. +_systemd_snapshots(){ + local -a ss + local expl + ss=(${(f)"$( + systemctl dump | sed -n -e 's/^-> Unit \(.*\.snapshot\):/\1/p' + )"}) + _wanted keys expl 'snapshots' compadd "$ss[@]" +} + +_systemctl(){ + local -a _systemctl_cmds + + # Determine the sub commands + #$(systemctl --help | sed -n -e 's/^ \([a-z]\)/\1/p' | sed -e 's/ .*//') + _systemctl_cmds=( + list-units start stop reload restart try-restart reload-or- + restart reload-or-try-restart isolate kill is-active status show + reset-failed enable disable is-enabled load list-jobs cancel + monitor dump dot snapshot delete daemon-reload daemon-reexec show- + environment set-environment unset-environment default rescue + emergency halt poweroff reboot kexec exit + ) + + local curcontext="$curcontext" state line expl + typeset -A opt_args + + # Initial flags + _arguments -A '-*' \ + '--help[Show help]' \ + '--version[Show package version]' \ + '(-a,--all)'{-a,--all}'[Show all units/properties, including dead/empty ones]' \ + '--full[Dont ellipsize unit names on output]' \ + '--failed[Show only failed units]' \ + '--fail[When queueing a new job, fail if conflicting jobs are pending]' \ + '--ignore-dependencies[ignore dependencies]' \ + '(-p,--privileged)'{-p,--privileged}'[Acquire privileges before execution]' \ + '(-q,--quiet)'{-q,--quiet}'[Suppress output]' \ + '--no-block[Do not wait until operation finished]' \ + '--no-wall[Dont send wall message before halt/power-off/reboot]' \ + '--no-reload[dont reload daemon configuration]' \ + '--no-pager[Do use pager]' \ + '--no-ask-password[Do not ask for system passwords]' \ + '--order[When generating graph for dot, show only order]' \ + '--require[When generating graph for dot, show only requirement]' \ + '--system[Connect to system manager]' \ + '--user[Connect to user service manager]' \ + '--global[Enable/disable unit files globally]' \ + '(-f,--force)'{-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \ + '--defaults[When disabling unit files, remove default symlinks only]' \ + '*::command:->subcmd' && return 0 + + # Complete subcommands. + if (( CURRENT == 1 )); then + _describe -t commands "command" _systemctl_cmds + return + fi + + # handle arguments to the subcommands. + case $words[1] in + start|restart|reload|stop|status|try-restart|reload-or-restart|reload-or-try-restart|isolate|kill|is-active|show|reset-failed|enable|disable|is-enabled|load) + # many units can be listed + _arguments "*:key:_systemd_units" + ;; + + cancel) _arguments "*:key:_systemd_jobs" ;; + + # snapshots + snapshot) _normal ;; + delete) _arguments "*:key:_systemd_snapshots" ;; + + # no arguments + dump|dot|monitor|daemon-reload|daemon-reexec|show-environment|default|rescue|emergency|halt|poweroff|reboot|kexec|exit|list-jobs|list-units) + ;; + + *) _message "unknown systemctl command: $words[1]" ;; + esac +} + +_systemctl "$@" + -- cgit v1.2.3 From cf845a396ed6a9793711c15750b86326c440b483 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 18 Aug 2011 14:28:49 +0000 Subject: 29705: add correct number of slashes when completing //TRANSLIT. --- ChangeLog | 5 ++++- Completion/Unix/Command/_iconv | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 059d6db6a..ff7d8d384 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ Completion/Zsh/Command/_schedtool: move _schedtool completion to correct directory. + * 29705: Completion/Unix/Command/_iconv: add correct number of + slashes when completing //TRANSLIT. + 2011-08-17 Peter Stephenson * 29703: Src/exec.c, Src/subst.c, Test/D03procsubst.ztst: @@ -15315,5 +15318,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5441 $ +* $Revision: 1.5442 $ ***************************************************** diff --git a/Completion/Unix/Command/_iconv b/Completion/Unix/Command/_iconv index 2cd69b21a..75fe521ee 100644 --- a/Completion/Unix/Command/_iconv +++ b/Completion/Unix/Command/_iconv @@ -21,7 +21,7 @@ if _pick_variant gnu=GNU unix --version; then '1:input file:_files' && return 0 if [[ $state = codeset ]]; then - if compset -P '*/'; then + if compset -P '*[^/]/'; then _wanted option expl option compadd "$@" /TRANSLIT && ret=0 else _wanted codesets expl 'code set' compadd "$@" \ -- cgit v1.2.3 From cfdb417a6b91364706a8fd5ba319eac086d0d568 Mon Sep 17 00:00:00 2001 From: Nikolai Weibull Date: Sat, 20 Aug 2011 07:44:39 +0000 Subject: 29707: Completion/Unix/Command/_ln: New _ln completer --- ChangeLog | 7 +++- Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_ln | 76 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 Completion/Unix/Command/_ln (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index ff7d8d384..a7d2c0bac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-08-20 Nikolai Weibull + + * 29707: Completion/Unix/Command/.distfiles, + Completion/Unix/Command/_ln: New _ln completer. + 2011-08-18 Mikael Magnusson * unposted: Completion/Linux/Command/.distfiles, @@ -15318,5 +15323,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5442 $ +* $Revision: 1.5443 $ ***************************************************** diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 696faea88..22e0a4fbe 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -111,6 +111,7 @@ _last _ldd _less _links +_ln _loadkeys _locate _look diff --git a/Completion/Unix/Command/_ln b/Completion/Unix/Command/_ln new file mode 100644 index 000000000..89b7177ab --- /dev/null +++ b/Completion/Unix/Command/_ln @@ -0,0 +1,76 @@ +#compdef ln gln + +local curcontext="$curcontext" state line ret=1 +local -A opt_args + +local -a args +args=( + '-f[remove existing destination files]' + '-s[create symbolic links instead of hard links]') + +local -a opts + +local variant +_pick_variant -r variant gnu=gnu unix --help +if [[ $variant == gnu ]]; then + opts=(-S) + args=( + '(-b --backup)-b[create a backup of each existing destination file]' \ + '(-b --backup)--backup=[create a backup of each existing destination file]::method:(( + none\:"never create backups" + off\:"never create backups" + numbered\:"create numbered backup" + t\:"create numbered backup" + existing\:"same as numbered if numbered backups exist, otherwise same as simple" + nil\:"same as numbered if numbered backups exist, otherwise same as simple" + simple\:"always create simple backups" + never\:"always create simple backups"))' + '(-d -F --directory)'{-d,-F,--directory}'[allow the superuser to attempt to hard link directories]' + '(-f --force)'{-f,--force}'[remove existing destination files]' + '(-i --interactive)'{-i,--interactive}'[prompt before removing destination files]' + '(-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]' + '(-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' + '(-T --no-target-directory)'{-T,--no-target-directory}'[treat destination as a normal file]' + '(-v --verbose)'{-v,--verbose}'[print name of each linked file]' + '--help[display usage information and exit]' + '--version[display version information and exit]') +elif (( ${+builtins[ln]} )); then + args+=( + '-d[attempt to hard link directories]' + {-h,-n}'[do not dereference destination]' + '-i[prompt before removing destination files]') +elif [[ $OSTYPE == darwin* ]]; then + args+=( + '-F[remove existing destination directories]' + {-h,-n}'[do not dereference destination]' + '-i[prompt before removing destination files]' + '-v[print name of each linked file]') +fi + +_arguments -s $opts \ + $args \ + ':link target:_files' \ + '*:: :->files' && ret=0 + +case $state in + (files) + if [[ $variant == gnu && -n ${opt_args[(I)-t|--target-directory]} ]]; then + _wanted files expl 'link target' _files && ret=0 + else + if (( CURRENT == 2 )); then + local expl + _wanted files expl 'additional link target or link name' _files && ret=0 + else + _alternative \ + 'link-targets:additional link target:_files' \ + 'target-directories:target directory:_directories' && ret=0 + fi + fi + ;; +esac + +return ret -- cgit v1.2.3 From 76524a7f7d294a0f70ca6b3a16f0f95ae96f9f7d Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 6 Sep 2011 16:15:06 +0000 Subject: 29738: _ssh: Add PreferredAuthentications completion. --- ChangeLog | 5 ++++- Completion/Unix/Command/_ssh | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 2dd4a988e..26b0275b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * 29736: Doc/Zsh/mod_zutil.yo: mention when zstyle -t returns 1. + * 29738: Completion/Unix/Command/_ssh: Add PreferredAuthentications + completion. + 2011-09-05 Barton E. Schaefer * users/16302: Completion/Unix/Type/_path_files: pattern matching @@ -15369,5 +15372,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5454 $ +* $Revision: 1.5455 $ ***************************************************** diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 491eba6f2..7b7317a42 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -225,6 +225,9 @@ _ssh () { _description files expl 'path to control socket' _files "$expl[@]" && ret=0 ;; + *(#i)preferredauthentications*) + _values -s , 'authentication method' gssapi-with-mic \ + hostbased publickey keyboard-interactive password && ret=0 esac else _wanted values expl 'configure file option' \ -- cgit v1.2.3 From ecbdf148a2991860fda4b944fb24131307cf27dd Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 6 Sep 2011 16:17:46 +0000 Subject: 29739: _rsync: redefine _rsync(), -e takes cuddled args --- ChangeLog | 5 +- Completion/Unix/Command/_rsync | 286 +++++++++++++++++++++-------------------- 2 files changed, 149 insertions(+), 142 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 26b0275b5..c5ea6bb26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ * 29738: Completion/Unix/Command/_ssh: Add PreferredAuthentications completion. + * 29739: Completion/Unix/Command/_rsync: redefine _rsync(), make + -e accept cuddled arguments. + 2011-09-05 Barton E. Schaefer * users/16302: Completion/Unix/Type/_path_files: pattern matching @@ -15372,5 +15375,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5455 $ +* $Revision: 1.5456 $ ***************************************************** diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync index cdb40ab46..b999c1bbd 100644 --- a/Completion/Unix/Command/_rsync +++ b/Completion/Unix/Command/_rsync @@ -96,144 +96,148 @@ _rsync_files() { _alternative "files:file:_files" "remote-files:remote file:_rsync_remote_files" } -_arguments -s \ - '*'{-v,--verbose}'[increase verbosity]' \ - {--no-v,--no-verbose}'[turn off --verbose]' \ - '--bwlimit=[limit I/O bandwidth]:KBytes per second' \ - '--port=[specify alternate port number]:port:(873)' \ - '--address=[bind to the specified address]:bind address:_bind_addresses' \ - '(-T --temp-dir)'{-T,--temp-dir=}'[create temporary files in specified directory]:directory:_directories' \ - '--sockopts=[specify custom TCP options]' \ - '(-4 -6 --ipv4 --ipv6)'{-4,--ipv4}'[prefer IPv4]' \ - '(-4 -6 --ipv4 --ipv6)'{-6,--ipv6}'[prefer IPv6]' \ - - daemon \ - '(-)'{-h,--help}'[display help information]' \ - '--config=[specify alternate rsyncd.conf file]:file:_files' \ - '--daemon[run as an rsync daemon]' \ - '--detach[detach from the parent]' \ - '--no-detach[do not detach from the parent]' \ - - client \ - '(-)--help[display help information]' \ - '*: :_rsync_files' \ - '(-q --quiet)'{-q,--quiet}'[suppress non-error messages]' \ - '--no-motd[suppress the daemon message-of-the-day output]' \ - '(-c --checksum)'{-c,--checksum}'[skip based on checksums, not mod-time & size]' \ - '(-a --archive)'{-a,--archive}'[archive mode; same as -rlptgoD (no -H)]' \ - '(-r --recursive)'{-r,--recursive}'[recurse into directories]' \ - {--no-r,--no-recursive}'[turn off --recursive]' \ - {--no-inc-recursive,--no-i-r}'[disable incremental recursive mode]' \ - '(-R --relative)'{-R,--relative}'[use relative path names]' \ - {--no-R,--no-relative}'[turn off --relative]' \ - {--no-implied-dirs,--no-i-d}'[do not send implied dirs with --relative]' \ - '(-b --backup)'{-b,--backup}'[make backups into hierarchy at indicated directory]' \ - '--backup-dir=[make backups into specified directory]:backup directory:_directories' \ - '--suffix=[set backup suffix]:suffix:(\~)' \ - '(-u --update)'{-u,--update}'[skip files that are newer on the receiving side]' \ - '--inplace[update destination files in-place]' \ - '(--append-verify)--append[append data onto shorter files]' \ - '(--append)--append-verify[append data onto shorter files, verifying old data]' \ - '(-A --acls)'{-A,--acls}'[preserve access-control lists]' \ - '(-X --xattrs)'{-X,--xattrs}'[preserve extended attributes]' \ - '--fake-super[use xattrs to save all file attributes]' \ - '(-d --dirs)'{-d,--dirs}'[transfer directories without recursing]' \ - {--no-d,--no-dirs}'[turn off --dirs]' \ - '(-l --links)'{-l,--links}'[copy symlinks as symlinks]' \ - {--no-l,--no-links}'[turn off --links]' \ - '(-L --copy-links)'{-L,--copy-links}'[transform symlinks into referent file/dir]' \ - '(-k --copy-dirlinks)'{-k,--copy-dirlinks}'[transform a symlink to a dir into referent dir]' \ - '--copy-unsafe-links[only "unsafe" symlinks are transformed]' \ - '--safe-links[ignore symlinks that point outside the source tree]' \ - '(-H --hard-links)'{-H,--hard-links}'[preserve hard links]' \ - {--no-H,--no-hard-links}'[turn off --hard-links]' \ - '(-K --keep-dirlinks)'{-K,--keep-dirlinks}'[treat symlinked dir on receiver as dir]' \ - '(-p --perms -E --executability)'{-p,--perms}'[preserve permissions]' \ - {--no-p,--no-perms}'[turn off --perms]' \ - '(-E --executability)'{-E,--executability}'[preserve executability]' \ - '(-o --owner)'{-o,--owner}'[preserve owner]' \ - {--no-o,--no-owner}'[turn off --owner]' \ - '(-g --group)'{-g,--group}'[preserve group]' \ - {--no-g,--no-group}'[turn off --group]' \ - '(--devices --specials)-D[same as --devices --specials]' \ - '(-D)--devices[preserve devices]' \ - '--no-devices[turn off --devices]' \ - '(-D)--specials[preserve special files]' \ - '--no-specials[turn off --specials]' \ - '--no-D[turn off --devices and --specials]' \ - '(-t --times)'{-t,--times}'[preserve times]' \ - {--no-t,--no-times}'[turn off --times]' \ - '(-O --omit-dir-times)'{-O,--omit-dir-times}'[omit directories when preserving times]' \ - '--chmod[change destination permissions]:mods' \ - '(-S --sparse)'{-S,--sparse}'[handle sparse files efficiently]' \ - '(-n --dry-run)'{-n,--dry-run}'[show what would have been transferred]' \ - '(-W --whole-file)'{-W,--whole-file}'[copy files whole (without delta-transfer algorithm)]' \ - {--no-W,--no-whole-file}'[turn off --whole-file]' \ - '(-x --one-file-system)'{-x,--one-file-system}'[do not cross filesystem boundaries]' \ - '(-B --block-size)'{-B,--block-size=}'[force a fixed checksum block-size]:block size' \ - '(-e --rsh)'{-e,--rsh=}'[specify the remote shell to use]:remote-shell command:(rsh ssh)' \ - '--rsync-path=[specify path to rsync on the remote machine]:remote command' \ - '--ignore-existing[ignore files that already exist on receiving side]' \ - '(--existing --ignore-non-existing)'{--existing,--ignore-non-existing}'[ignore files that do not exist on receiving side]' \ - '--remove-source-files[synchronized files are removed from sending side]' \ - '(--delete-before --delete-during --delete-after --delete-delay)--del[an alias for --delete-during]' \ - '--delete[delete files that do not exist on the sending side]' \ - '(--del --delete-during --delete-after --delete-delay)--delete-before[receiver deletes before transfer]' \ - '(--del --delete-before --delete-after --delete-delay)--delete-during[receiver deletes during transfer]' \ - '(--del --delete-before --delete-during --delete-delay)--delete-after[receiver deletes after transfer]' \ - '(--del --delete-before --delete-during --delete-after)--delete-delay[receiver deletes after transfer]' \ - '--delete-excluded[also delete excluded files on the receiving side]' \ - '--ignore-errors[delete even if there are I/O errors]' \ - '--force[force deletion of directories even if not empty]' \ - '--max-delete=[do not delete more than NUM files]:number' \ - '--max-size=[do not transfer any file larger than specified size]:number' \ - '--min-size=[do not transfer any file smaller than specified size]:number' \ - '(-P)--partial[keep partially transferred files]' \ - '--no-partial[turn off --partial]' \ - '--partial-dir=[put a partially transferred file into specified directory]:directory:_directories' \ - '--super[receiver attempts super-user activities]' \ - '--no-super[receiver performs normal-user activities]' \ - '--delay-updates[put all updated files into place at end of transfer]' \ - '(-m --prune-empty-dirs)'{-m,--prune-empty-dirs}'[prune empty directory chains from file-list]' \ - '--numeric-ids[do not map uid/gid values by user/group name]' \ - '--timeout=[set I/O timeout in seconds for lulls in a transfer]:seconds' \ - '--contimeout=[set connect timeout in seconds for daemon connections]:seconds' \ - '(-I --ignore-times)'{-I,--ignore-times}'[do not skip files that match in size and mod-time]' \ - '--size-only[skip files that match in size]' \ - '--modify-window=[compare mod-times with reduced accuracy]:seconds' \ - '(-y --fuzzy)'{-y,--fuzzy}'[find similar file for basis if no destination file]' \ - '(--copy-dest --link-dest)*--compare-dest=[also compare destination files relative to specified directory]:directory:_directories' \ - '(--compare-dest --link-dest)*--copy-dest=[like --compare-dest, but also includes copies of unchanged files]:directory:_directories' \ - '(--compare-dest --copy-dest)*--link-dest=[hardlink to files in specified directory hierarchy when unchanged]:directory:_directories' \ - '(-z --compress)'{-z,--compress}'[compress file data during the transfer]' \ - '--compress-level=[explicitly set compression level]:number' \ - '--skip-compress=[skip compressing files with a listed suffix]:suffixes' \ - '(-C --cvs-exclude)'{-C,--cvs-exclude}'[auto-ignore files the same way CVS does]' \ - '*'{-f=,--filter=}'[add a file-filtering rule]:rule' \ - '*-F[same as --filter="dir-merge /.rsync-filter", repeated: --filter="- .rsync-filter"]' \ - '--exclude-from=[read exclude patterns from specified file]:file:_files' \ - '*--exclude=[exclude files matching pattern]:pattern' \ - '--include-from=[read include patterns from specified file]:file:_files' \ - '*--include=[do not exclude files matching pattern]:pattern' \ - '--files-from=[read list of source-file names from specified file]:file:_files' \ - '(-0 --from0)'{-0,--from0}'[all *-from file lists are delimited by nulls]' \ - '(-s --protect-args)'{-s,--protect-args}'[no space-splitting; only wildcard special-chars]' \ - '--version[print version number]' \ - '*'{-h,--human-readable}'[output numbers in a human-readable format]' \ - '--blocking-io[use blocking I/O for the remote shell]' \ - '--no-blocking-io[turn off --blocking-io]' \ - '--stats[give some file-transfer stats]' \ - '(-8 --8-bit-output)'{-8,--8-bit-output}'[leave high-bit chars unescaped in output]' \ - '(-P)--progress[show progress during transfer]' \ - '--no-progress[turn off --progress]' \ - '(--partial --progress)-P[same as --partial --progress]' \ - '(-i --itemize-changes)'{-i,--itemize-changes}'[output a change-summary for all updates]' \ - '--log-format=[deprecated version of --out-format]' \ - '--out-format=[output updates using specified format]:format' \ - '--log-file-format=[log updates using specified format]:format' \ - '--log-file=[log what rsync is doing to the specified file]:file:_files' \ - '--password-file=[read daemon-access password from file]:file:_files' \ - '--list-only[list the files instead of copying them]' \ - '(--only-write-batch)--write-batch=[write a batched update to the specified file]:file:_files' \ - '(--write-batch)--only-write-batch=[like --write-batch but w/o updating destination]:file:_files' \ - '--protocol=[force an older protocol version to be used]:number' \ - '--iconv=[request charset conversion of filenames]:number' \ - '--read-batch=[read a batched update from the specified file]:file:_files' +_rsync() { + _arguments -s \ + '*'{-v,--verbose}'[increase verbosity]' \ + {--no-v,--no-verbose}'[turn off --verbose]' \ + '--bwlimit=[limit I/O bandwidth]:KBytes per second' \ + '--port=[specify alternate port number]:port:(873)' \ + '--address=[bind to the specified address]:bind address:_bind_addresses' \ + '(-T --temp-dir)'{-T,--temp-dir=}'[create temporary files in specified directory]:directory:_directories' \ + '--sockopts=[specify custom TCP options]' \ + '(-4 -6 --ipv4 --ipv6)'{-4,--ipv4}'[prefer IPv4]' \ + '(-4 -6 --ipv4 --ipv6)'{-6,--ipv6}'[prefer IPv6]' \ + - daemon \ + '(-)'{-h,--help}'[display help information]' \ + '--config=[specify alternate rsyncd.conf file]:file:_files' \ + '--daemon[run as an rsync daemon]' \ + '--detach[detach from the parent]' \ + '--no-detach[do not detach from the parent]' \ + - client \ + '(-)--help[display help information]' \ + '*: :_rsync_files' \ + '(-q --quiet)'{-q,--quiet}'[suppress non-error messages]' \ + '--no-motd[suppress the daemon message-of-the-day output]' \ + '(-c --checksum)'{-c,--checksum}'[skip based on checksums, not mod-time & size]' \ + '(-a --archive)'{-a,--archive}'[archive mode; same as -rlptgoD (no -H)]' \ + '(-r --recursive)'{-r,--recursive}'[recurse into directories]' \ + {--no-r,--no-recursive}'[turn off --recursive]' \ + {--no-inc-recursive,--no-i-r}'[disable incremental recursive mode]' \ + '(-R --relative)'{-R,--relative}'[use relative path names]' \ + {--no-R,--no-relative}'[turn off --relative]' \ + {--no-implied-dirs,--no-i-d}'[do not send implied dirs with --relative]' \ + '(-b --backup)'{-b,--backup}'[make backups into hierarchy at indicated directory]' \ + '--backup-dir=[make backups into specified directory]:backup directory:_directories' \ + '--suffix=[set backup suffix]:suffix:(\~)' \ + '(-u --update)'{-u,--update}'[skip files that are newer on the receiving side]' \ + '--inplace[update destination files in-place]' \ + '(--append-verify)--append[append data onto shorter files]' \ + '(--append)--append-verify[append data onto shorter files, verifying old data]' \ + '(-A --acls)'{-A,--acls}'[preserve access-control lists]' \ + '(-X --xattrs)'{-X,--xattrs}'[preserve extended attributes]' \ + '--fake-super[use xattrs to save all file attributes]' \ + '(-d --dirs)'{-d,--dirs}'[transfer directories without recursing]' \ + {--no-d,--no-dirs}'[turn off --dirs]' \ + '(-l --links)'{-l,--links}'[copy symlinks as symlinks]' \ + {--no-l,--no-links}'[turn off --links]' \ + '(-L --copy-links)'{-L,--copy-links}'[transform symlinks into referent file/dir]' \ + '(-k --copy-dirlinks)'{-k,--copy-dirlinks}'[transform a symlink to a dir into referent dir]' \ + '--copy-unsafe-links[only "unsafe" symlinks are transformed]' \ + '--safe-links[ignore symlinks that point outside the source tree]' \ + '(-H --hard-links)'{-H,--hard-links}'[preserve hard links]' \ + {--no-H,--no-hard-links}'[turn off --hard-links]' \ + '(-K --keep-dirlinks)'{-K,--keep-dirlinks}'[treat symlinked dir on receiver as dir]' \ + '(-p --perms -E --executability)'{-p,--perms}'[preserve permissions]' \ + {--no-p,--no-perms}'[turn off --perms]' \ + '(-E --executability)'{-E,--executability}'[preserve executability]' \ + '(-o --owner)'{-o,--owner}'[preserve owner]' \ + {--no-o,--no-owner}'[turn off --owner]' \ + '(-g --group)'{-g,--group}'[preserve group]' \ + {--no-g,--no-group}'[turn off --group]' \ + '(--devices --specials)-D[same as --devices --specials]' \ + '(-D)--devices[preserve devices]' \ + '--no-devices[turn off --devices]' \ + '(-D)--specials[preserve special files]' \ + '--no-specials[turn off --specials]' \ + '--no-D[turn off --devices and --specials]' \ + '(-t --times)'{-t,--times}'[preserve times]' \ + {--no-t,--no-times}'[turn off --times]' \ + '(-O --omit-dir-times)'{-O,--omit-dir-times}'[omit directories when preserving times]' \ + '--chmod[change destination permissions]:mods' \ + '(-S --sparse)'{-S,--sparse}'[handle sparse files efficiently]' \ + '(-n --dry-run)'{-n,--dry-run}'[show what would have been transferred]' \ + '(-W --whole-file)'{-W,--whole-file}'[copy files whole (without delta-transfer algorithm)]' \ + {--no-W,--no-whole-file}'[turn off --whole-file]' \ + '(-x --one-file-system)'{-x,--one-file-system}'[do not cross filesystem boundaries]' \ + '(-B --block-size)'{-B,--block-size=}'[force a fixed checksum block-size]:block size' \ + '(-e --rsh)'{-e+,--rsh=}'[specify the remote shell to use]:remote-shell command:(rsh ssh)' \ + '--rsync-path=[specify path to rsync on the remote machine]:remote command' \ + '--ignore-existing[ignore files that already exist on receiving side]' \ + '(--existing --ignore-non-existing)'{--existing,--ignore-non-existing}'[ignore files that do not exist on receiving side]' \ + '--remove-source-files[synchronized files are removed from sending side]' \ + '(--delete-before --delete-during --delete-after --delete-delay)--del[an alias for --delete-during]' \ + '--delete[delete files that do not exist on the sending side]' \ + '(--del --delete-during --delete-after --delete-delay)--delete-before[receiver deletes before transfer]' \ + '(--del --delete-before --delete-after --delete-delay)--delete-during[receiver deletes during transfer]' \ + '(--del --delete-before --delete-during --delete-delay)--delete-after[receiver deletes after transfer]' \ + '(--del --delete-before --delete-during --delete-after)--delete-delay[receiver deletes after transfer]' \ + '--delete-excluded[also delete excluded files on the receiving side]' \ + '--ignore-errors[delete even if there are I/O errors]' \ + '--force[force deletion of directories even if not empty]' \ + '--max-delete=[do not delete more than NUM files]:number' \ + '--max-size=[do not transfer any file larger than specified size]:number' \ + '--min-size=[do not transfer any file smaller than specified size]:number' \ + '(-P)--partial[keep partially transferred files]' \ + '--no-partial[turn off --partial]' \ + '--partial-dir=[put a partially transferred file into specified directory]:directory:_directories' \ + '--super[receiver attempts super-user activities]' \ + '--no-super[receiver performs normal-user activities]' \ + '--delay-updates[put all updated files into place at end of transfer]' \ + '(-m --prune-empty-dirs)'{-m,--prune-empty-dirs}'[prune empty directory chains from file-list]' \ + '--numeric-ids[do not map uid/gid values by user/group name]' \ + '--timeout=[set I/O timeout in seconds for lulls in a transfer]:seconds' \ + '--contimeout=[set connect timeout in seconds for daemon connections]:seconds' \ + '(-I --ignore-times)'{-I,--ignore-times}'[do not skip files that match in size and mod-time]' \ + '--size-only[skip files that match in size]' \ + '--modify-window=[compare mod-times with reduced accuracy]:seconds' \ + '(-y --fuzzy)'{-y,--fuzzy}'[find similar file for basis if no destination file]' \ + '(--copy-dest --link-dest)*--compare-dest=[also compare destination files relative to specified directory]:directory:_directories' \ + '(--compare-dest --link-dest)*--copy-dest=[like --compare-dest, but also includes copies of unchanged files]:directory:_directories' \ + '(--compare-dest --copy-dest)*--link-dest=[hardlink to files in specified directory hierarchy when unchanged]:directory:_directories' \ + '(-z --compress)'{-z,--compress}'[compress file data during the transfer]' \ + '--compress-level=[explicitly set compression level]:number' \ + '--skip-compress=[skip compressing files with a listed suffix]:suffixes' \ + '(-C --cvs-exclude)'{-C,--cvs-exclude}'[auto-ignore files the same way CVS does]' \ + '*'{-f=,--filter=}'[add a file-filtering rule]:rule' \ + '*-F[same as --filter="dir-merge /.rsync-filter", repeated: --filter="- .rsync-filter"]' \ + '--exclude-from=[read exclude patterns from specified file]:file:_files' \ + '*--exclude=[exclude files matching pattern]:pattern' \ + '--include-from=[read include patterns from specified file]:file:_files' \ + '*--include=[do not exclude files matching pattern]:pattern' \ + '--files-from=[read list of source-file names from specified file]:file:_files' \ + '(-0 --from0)'{-0,--from0}'[all *-from file lists are delimited by nulls]' \ + '(-s --protect-args)'{-s,--protect-args}'[no space-splitting; only wildcard special-chars]' \ + '--version[print version number]' \ + '*'{-h,--human-readable}'[output numbers in a human-readable format]' \ + '--blocking-io[use blocking I/O for the remote shell]' \ + '--no-blocking-io[turn off --blocking-io]' \ + '--stats[give some file-transfer stats]' \ + '(-8 --8-bit-output)'{-8,--8-bit-output}'[leave high-bit chars unescaped in output]' \ + '(-P)--progress[show progress during transfer]' \ + '--no-progress[turn off --progress]' \ + '(--partial --progress)-P[same as --partial --progress]' \ + '(-i --itemize-changes)'{-i,--itemize-changes}'[output a change-summary for all updates]' \ + '--log-format=[deprecated version of --out-format]' \ + '--out-format=[output updates using specified format]:format' \ + '--log-file-format=[log updates using specified format]:format' \ + '--log-file=[log what rsync is doing to the specified file]:file:_files' \ + '--password-file=[read daemon-access password from file]:file:_files' \ + '--list-only[list the files instead of copying them]' \ + '(--only-write-batch)--write-batch=[write a batched update to the specified file]:file:_files' \ + '(--write-batch)--only-write-batch=[like --write-batch but w/o updating destination]:file:_files' \ + '--protocol=[force an older protocol version to be used]:number' \ + '--iconv=[request charset conversion of filenames]:number' \ + '--read-batch=[read a batched update from the specified file]:file:_files' +} + +_rsync "$@" -- cgit v1.2.3 From f3a6bf454d8040a88325816a7f8756ebd75aa270 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 6 Sep 2011 16:19:40 +0000 Subject: 29740: _wget: add --content-disposition. --- ChangeLog | 6 ++++-- Completion/Unix/Command/_wget | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index c5ea6bb26..c143a57bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,12 +2,14 @@ * 29736: Doc/Zsh/mod_zutil.yo: mention when zstyle -t returns 1. - * 29738: Completion/Unix/Command/_ssh: Add PreferredAuthentications + * 29738: Completion/Unix/Command/_ssh: add PreferredAuthentications completion. * 29739: Completion/Unix/Command/_rsync: redefine _rsync(), make -e accept cuddled arguments. + * 29740: Completion/Unix/Command/_wget: add --content-disposition. + 2011-09-05 Barton E. Schaefer * users/16302: Completion/Unix/Type/_path_files: pattern matching @@ -15375,5 +15377,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5456 $ +* $Revision: 1.5457 $ ***************************************************** diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget index 54c09a377..e54a08b27 100644 --- a/Completion/Unix/Command/_wget +++ b/Completion/Unix/Command/_wget @@ -21,6 +21,7 @@ _arguments -C -s \ '--retry-connrefused[retry even if connection is refused]' \ '(--output-document -O)'{--output-document=,-O+}'[specify file to write documents to]:output file:_files' \ '(--continue -c)'{--continue,-c}'[continue getting an existing file]' \ + '--content-disposition[honor the Content-Disposition header when choosing local file names]' \ '--progress=[set progress gauge type]:gauge type:->gauge' \ '(--timestamping -N)'{--timestamping,-N}'[retrieve only files newer than existing]' \ '(--server-response -S)'{--server-response,-S}'[print server response]' \ -- cgit v1.2.3 From 0e0f259540997bcd965ba08898d8c1cb77fc5878 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 7 Sep 2011 07:32:57 +0000 Subject: 29755: add -O stop to to _ssh. --- ChangeLog | 6 +++++- Completion/Unix/Command/_ssh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 2c0dd4700..994b9b524 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-09-07 Mikael Magnusson + + * 29755: Completion/Unix/Command/_ssh: add -O stop to to _ssh. + 2011-09-06 Mikael Magnusson * 29736: Doc/Zsh/mod_zutil.yo: mention when zstyle -t returns 1. @@ -15383,5 +15387,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5459 $ +* $Revision: 1.5460 $ ***************************************************** diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 7b7317a42..d0bf6ba32 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -78,7 +78,7 @@ _ssh () { '(-x -X)-Y[enable trusted X11 forwarding]' \ '-M[master mode for connection sharing]' \ '-S+:path to control socket:_files' \ - '-O:multiplex control command:(check exit forward)' \ + '-O:multiplex control command:(check exit forward stop)' \ '*-L[specify local port forwarding]:local port forwarding:->forward' \ '*-R[specify remote port forwarding]:remote port forwarding:->forward' \ ':remote host name:->userhost' \ -- cgit v1.2.3 From fdfd451861d2221b728c611558ba86480fdfe7ed Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 7 Sep 2011 15:58:54 +0000 Subject: unposted: Perforce completion for 2010.2 release --- ChangeLog | 7 +++++- Completion/Unix/Command/_perforce | 53 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 5 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 23189b3f6..d88276c17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-09-07 Peter Stephenson + + * unposted: Completion/Unix/Command/_perforce: updates for + 2010.2 release. + 2011-09-07 Simon Ruderich * 29756: Doc/Zsh/params.yo: DIRSTACKSIZE is unlimited by default. @@ -15393,5 +15398,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5462 $ +* $Revision: 1.5463 $ ***************************************************** diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce index 08c42cbce..1f39545e7 100644 --- a/Completion/Unix/Command/_perforce +++ b/Completion/Unix/Command/_perforce @@ -1686,6 +1686,7 @@ _perforce_cmd_annotate() { '-a[all, show both added and deleted lines]' \ '-c[output change numbers instead of revisions]' \ '-i[follow branches (integration records)]' \ + '-I[follow integrations to get change numbers]' \ '-q[quiet, suppress one-line file header]' \ '*::file:_perforce_files -tR' } @@ -1748,7 +1749,8 @@ _perforce_cmd_change() { '(-d -i -f)-o[output specification to standard output]' \ '(-d -o)-i[read specification from standard input]' \ '(-d -o)-u[force change of jobs or description by owner]' \ - "(-i)1::change:_perforce_changes$ctype" + "(-i)1::change:_perforce_changes$ctype" \ + '-t[specify visibility type]:visibility type:(public restricted)' } @@ -1800,6 +1802,22 @@ _perforce_cmd_clients() { } +(( $+functions[_perforce_cmd_copy] )) || +_perforce_cmd_copy() { + local range + # If -s is present, the first normal argument can't have revRange. + [[ ${words[(I)-s]} -eq 0 ]] && range=" -tR" + _arguments -s : \ + '-b[select branch]:branch:_perforce_branches' \ + '-c[select change for copy]:change:_perforce_changes -tc' \ + '-n[no action, dummy run]' \ + '-r[reverse direction of copy with branch]' \ + '-s[select source with -b]:source file:_perforce_files -tR' \ + '-v[leave newly copied files uncopied till sync]' \ + "1:file:_perforce_files$range" \ + '*::file:_perforce_files' +} + (( $+functions[_perforce_cmd_counter] )) || _perforce_cmd_counter() { _arguments -s : \ @@ -1942,7 +1960,8 @@ _perforce_cmd_export() { '(-j)-l[specify number of lines]:number of lines: ' \ '(-j)-F[specify filter]:filter pattern: ' \ '(-c)-r[raw format]' \ - '-J[specify file prefix]:file prefix: ' + '-J[specify file prefix]:file prefix: ' \ + '-T[space-separated list of tables not to export]' } @@ -2117,8 +2136,8 @@ _perforce_cmd_help() { (( $+functions[_perforce_cmd_info] )) || _perforce_cmd_info() { - # No arguments - _arguments -s : + _arguments -s : \ + '-s[don'\''t check for unknown users or clients]' } @@ -2257,6 +2276,7 @@ _perforce_cmd_labelsync() { '-d[delete files from label]' \ '-n[no effect, dummy run]' \ '-l[specify label]:label:_perforce_labels' \ + '-q[suppress informational messages]' \ '*::file:_perforce_files -tR' } @@ -2407,6 +2427,19 @@ _perforce_cmd_passwd() { } +(( $+functions[_perforce_cmd_ping] )) || +_perforce_cmd_ping() { + _arguments -s : \ + '-c[specify count of messages]:count of messages: ' \ + '-t[specify total time of test]:time in seconds: ' \ + '-i[specify iterations for test]:number of iterations: ' \ + '-f[transmit continuously without waiting for responses]' \ + '-p[specify pause between tests]:pause in seconds: ' \ + '-s[specify send size]:send size in octets: ' \ + '-r[specify receive size]:receive size in octets: ' +} + + (( $+functions[_perforce_cmd_print] )) || _perforce_cmd_print() { _arguments -s : \ @@ -2437,6 +2470,15 @@ _perforce_cmd_protects() { } +(( $+functions[_perforce_cmd_pull] )) || +_perforce_cmd_pull() { + _arguments -s : \ + '-i[repeat as specified]:seconds between repeats: ' \ + '-u[retrieve file content rather than journal]' \ + '-p[display information about pending transfers]' \ + '-J[specify prefix for journal file]:journal file prefix: ' +} + (( $+functions[_perforce_cmd_reopen] )) || _perforce_cmd_reopen() { # Assume user doesn't want to reopen to same changelist. @@ -2462,7 +2504,9 @@ _perforce_cmd_replicate() { '-J[specify file prefix]:file prefix: ' \ '-k[keep pipe open]' \ '-o[specify output file]:output file:_files' \ + '-R[reconnect on failure, needs -i]' \ '-s[specify file to track state]:state file:_files' \ + '-T[space-separate list of tables not to transfer]' \ '-x[terminate when journal rotates]' \ '*::->_command' } @@ -2580,6 +2624,7 @@ _perforce_cmd_sync() { '-f[force resynchronisation]' \ '-n[show operations but don'\''t perform them]' \ '-k[bypass client file update]' \ + '-q[suppress informational messages]' \ '*::file:_perforce_files -tR' } -- cgit v1.2.3 From 1c2ff6852911c47b1386d72e781b465f140e77eb Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 16 Sep 2011 12:18:40 +0000 Subject: 29764, 29765: fix various problems with _pgrep. --- ChangeLog | 9 ++- Completion/Unix/Command/_pgrep | 169 ++++++++++++++++++----------------------- 2 files changed, 81 insertions(+), 97 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index b52361aa6..c3b589bf7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-09-16 Mikael Magnusson + + * 29764, 29765: Completion/Unix/Command/_pgrep: use _users and + _groups rather than reimplementing them, use _wanted instead + of plain compadd to get descriptions, return 0 on success, + fix conditions on -f and -x, complete pts/* for -t too. + 2011-09-15 Peter Stephenson * 29776 (modified as noted): Src/lex.c, Test/D08cmdsubst.ztst: @@ -15417,5 +15424,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5467 $ +* $Revision: 1.5468 $ ***************************************************** diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep index f65324a81..e460202a1 100644 --- a/Completion/Unix/Command/_pgrep +++ b/Completion/Unix/Command/_pgrep @@ -1,112 +1,89 @@ #compdef pgrep pkill -local context state line +local context state line ret=1 expl typeset -A opt_args typeset -a arguments arguments=('-P[parent process id]:parent process id:->ppid' - '-g[match only in process group ids]:group:->pgid' - '-G[match only real group id]:group:->group' - '-s[match only session id]:session id:->sid' - '-t[match only controlled by terminal]:terminal device:->tty' - '-u[match only effective user id]:user:->user' - '-U[match only real user id]:user:->user' + '-g[match only in process group ids]:group:->pgid' + '-G[match only real group id]:group:_groups' + '-s[match only session id]:session id:->sid' + '-t[match only controlled by terminal]:terminal device:->tty' + '-u[match only effective user id]:user:_users' + '-U[match only real user id]:user:_users' '(-n)-o[oldest process]' - '(-o)-n[newest process]' - '-f[match against full command line]' - '-v[negate matching]' - '-x[match exactly]' - '*:process name:->pname') + '(-o)-n[newest process]' + '-f[match against full command line]' + '-v[negate matching]' + '-x[match exactly]' + '*:process name:->pname') if [[ $service == 'pkill' ]] then - arguments+=('-'${^signals}'[signal]') + arguments+=('-'${^signals}'[signal]') elif [[ $service == 'pgrep' ]] then - arguments+=('-d[output delimiter]:delimiter:compadd ${(s\:\:)IFS}' - '-l[list name in addition to id]') + arguments+=('-d[output delimiter]:delimiter:compadd ${(s\:\:)IFS}' + '-l[list name in addition to id]') fi -_arguments -s -w $arguments +_arguments -s -w $arguments && ret=0 case $state in - (tty) - compset -P '*,' - - local -a used - used=(${(s:,:)IPREFIX}) - - compadd -S ',' -q -F used /dev/tty*(:t) - ;; - - (sid) - compset -P '*,' - - local -a used sid - used=(${(s:,:)IPREFIX}) - sid=(${(uon)$(ps -A o sid=)}) - - compadd -S ',' -q -F used $sid - ;; - - (ppid) - compset -P '*,' - - local -a used ppid - used=(${(s:,:)IPREFIX}) - ppid=(${(uon)$(ps -A o ppid=)}) - - compadd -S ',' -q -F used $ppid - ;; - - (pgid) - compset -P '*,' - - local -a used pgid - used=(${(s:,:)IPREFIX}) - pgid=(${(uon)$(ps -A o pgid=)}) - - compadd -S ',' -q -F used $pgid - ;; - - (pname) - if (( ${+opt_args[-x]} )) && (( ${+opt_args[-f]} )) - then - compadd ${(u)${(f)"$(ps -A o cmd=)"}} - else - compadd ${(u)${(f)"$(ps -A co cmd=)"}} - fi - ;; - - (group) - compset -P '*,' - - local group - group=$(getent group) - - local -a groups ids - groups=(${${(f)group}%%:*}) - ids=(${${${(f)group}#*:*:}%%:*}) - - local -a used - used=(${(s:,:)IPREFIX}) - - compadd -S ',' -q -F used -d ids $groups $groups - ;; - - (user) - compset -P '*,' - - local passwd - passwd=$(getent passwd) - - local -a users ids - users=(${${(f)passwd}%%:*}) - ids=(${${${(f)passwd}#*:*:}%%:*}) - - local -a used - used=(${(s:,:)IPREFIX}) - - compadd -S ',' -q -F used -d ids $users $users - ;; -esac + (tty) + compset -P '*,' + + local -a used ttys + used=(${(s:,:)IPREFIX}) + + ttys=( /dev/tty*(N) /dev/pts/*(N) ) + _wanted tty expl 'terminal device' compadd -S ',' -q -F used ${ttys#/dev/} + ;; + + (sid) + compset -P '*,' + + local -a used sid + used=(${(s:,:)IPREFIX}) + sid=(${(uon)$(ps -A o sid=)}) + + _wanted sid expl 'session id' compadd -S ',' -q -F used $sid + ;; + + (ppid) + compset -P '*,' + + local -a used ppid + used=(${(s:,:)IPREFIX}) + ppid=(${(uon)$(ps -A o ppid=)}) + + _wanted ppid expl 'parent process id' compadd -S ',' -q -F used $ppid + ;; + + (pgid) + compset -P '*,' + + local -a used pgid + used=(${(s:,:)IPREFIX}) + pgid=(${(uon)$(ps -A o pgid=)}) + + _wanted pgid expl 'process group id' compadd -S ',' -q -F used $pgid + ;; + + (pname) + local ispat="pattern matching " + if (( ${+opt_args[-x]} )) + then + ispat="" + fi + if (( ${+opt_args[-f]} )) + then + _wanted pname expl $ispat'process command line' compadd ${(u)${(f)"$(ps -A o cmd=)"}} + else + _wanted pname expl $ispat'process name' compadd ${(u)${(f)"$(ps -A co cmd=)"}} + fi + ;; + +esac && ret=0 + +return ret -- cgit v1.2.3 From 664675dc10429a107f30829def49fa1432172a36 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 21 Sep 2011 09:31:02 +0000 Subject: Luka Perkov: 29788: improved quilt completion --- ChangeLog | 7 +- Completion/Unix/Command/_quilt | 254 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 229 insertions(+), 32 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 4e69f9654..4c34d67e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-09-21 Peter Stephenson + + * Luka Perkov: 29788: Completion/Unix/Command/_quilt: + improved quilt completion. + 2011-09-18 Peter Stephenson * users/16375: Src/Zle/complist.c: initialise number of @@ -15430,5 +15435,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5469 $ +* $Revision: 1.5470 $ ***************************************************** diff --git a/Completion/Unix/Command/_quilt b/Completion/Unix/Command/_quilt index 0c51ba5bc..130f38149 100644 --- a/Completion/Unix/Command/_quilt +++ b/Completion/Unix/Command/_quilt @@ -3,46 +3,238 @@ local -a tmp local rc +_quilt_applied () { + tmp=( ${(f)"$(quilt applied 2>&1)"} ) + rc=$? + if (( rc == 0 )); then + _wanted -V 'applied patches' expl 'patch' compadd "${tmp[@]}" + else + _message "No applied patches" + fi +} + +_quilt_series () { + _wanted -V 'patches' expl 'patch' compadd ${(f)"$(quilt series)"} +} + +_quilt_unapplied () { + tmp=( ${(f)"$(quilt unapplied 2>&1)"} ) + rc=$? + if (( rc == 0 )); then + _wanted -V 'unapplied patches' expl 'patch' compadd "${tmp[@]}" + else + _message "No unapplied patches" + fi +} + _arguments \ - '--trace' \ - '--quiltrc:config file:_files' \ - '--version' \ - ':quilt command:(add files import previous setup annotate fold mail push - snapshot applied fork new refresh top delete graph next remove unapplied - diff grep patches rename upgrade edit header pop series)' \ + '--trace[Runs the command in bash trace mode]' \ + '--quiltrc[Use the specified configuration file]:files:_files' \ + '--version[Print the version number and exit]' \ + ':quilt command:(add annotate applied delete diff edit files fold fork graph + grep header import mail new next patches pop previous push refresh rename + revert series setup shell snapshot top unapplied upgrade)' \ '*::subcmd:->subcmd' && return 0 -case "$state" in - (subcmd) - +case "$state" in (subcmd) case "$words[1]" in - (applied|delete|files|graph|header|next|previous|refresh|unapplied) - _wanted -V 'patches' expl 'patch' compadd ${(f)"$(quilt series)"} + (add) + _arguments '-h' \ + '-P[Patch to add files to]:quilt series:_quilt_series' \ + '*:files:_files' ;; - (push) - if (( CURRENT == 2 )); then - tmp=( ${(f)"$(quilt unapplied 2>&1)"} ) - rc=$? - if (( rc == 0 )); then - _wanted -V 'unapplied patches' expl 'patch' compadd "${tmp[@]}" - else - _message "No unapplied patches" - fi - fi + (annotate) + _arguments '-h' \ + '-P[Stop checking for changes at the specified rather than the topmost patch]:quilt series:_quilt_series' \ + ':files:_files' + ;; + (applied) + _arguments '-h' \ + ':quilt series:_quilt_series' + ;; + (delete) + _arguments '-h' \ + '-n[Delete the next patch after topmost]' \ + '-r[Remove the deleted patch file from the patches directory as well]' \ + '--backup[Rename the patch file to patch~ rather than deleting it]' \ + ':quilt series:_quilt_series' + ;; + (diff) + _arguments '-h' \ + '-p[Select a patch style]:quilt patch style:(0 1 ab)' \ + '-u[Create a unified diff]' \ + '-U[Create a unified diff with num lines of context]:quilt unified diff: ' \ + '-c[Create a context diff]' \ + '-C[Create a context diff with num lines of context]:quilt context diff: ' \ + '--no-timestamps[Do not include file timestamps in patch headers]' \ + '--no-index[Do not output Index: lines]' \ + '-z[Write to standard output the changes that have been made relative to the topmost or specified patch]' \ + '-R[Create a reverse diff]' \ + '-P[Create a diff for the specified patch]:quilt series:_quilt_series' \ + '--combine[Create a combined diff for all patches between this patch and the patch specified with -P]:quilt series:_quilt_series' \ + '--snapshot[Diff against snapshot]' \ + '--diff=[Use the specified utility for generating the diff]:quilt select diff utility:_command_names -e' \ + '--color=[Use syntax coloring]:quilt select color:(always auto never)' \ + '--sort[Sort files by their name]' \ + '*:files:_files' + ;; + (edit) + _arguments '-h' \ + '*:files:_files' + ;; + (files) + _arguments '-h' \ + '-a[List all files in all applied patches]' \ + '-l[Add patch name to output]' \ + '-v[Verbose, more user friendly output]' \ + '--combine[Create a listing for all patches between this patch and the topmost or specified patch]:quilt series:_quilt_series' \ + ':quilt series:_quilt_series' + ;; + (fold) + _arguments '-h' \ + '-R[Apply patch in reverse]' \ + '-q[Quiet operation]' \ + '-f[Force apply]' \ + '-p[The number of pathname components to strip]:quilt select strip-level: ' + ;; + (fork) + _arguments '-h' + ;; + (graph) + _arguments '-h' \ + '--all[Generate a graph including all applied patches and their dependencies]' \ + '--reduce[Eliminate transitive edges from the graph]' \ + '--lines[Compute dependencies by looking at the lines the patches modify]:quilt select lines: ' \ + '--edge-labels=files[Label graph edges with the file names that the adjacent patches modify]' \ + '-T ps[Directly produce a PostScript output file]' \ + ':quilt series:_quilt_series' + ;; + (header) + _arguments '-h' \ + '-a[Append the exiting patch header]' \ + '-r[Replace the exiting patch header]' \ + '-e[Edit the header in $EDITOR]' \ + '--strip-diffstat[Strip diffstat output from the header]' \ + '--strip-trailing-whitespace[Strip trailing whitespace at the end of lines of the header]' \ + '--backup[Create a backup copy of the old version of a patch as patch~]' \ + ':quilt series:_quilt_series' + ;; + (import) + _arguments '-h' \ + '-p[Number of directory levels to strip when applying]:quilt select strip-level: ' \ + '-R[Apply patch in reverse]' \ + '-P[Patch filename to use inside quilt]:quilt select patch filename: ' \ + '-f[Overwrite/update existing patches]' \ + '-d[When overwriting in existing patch, keep the old (o), all (a), or new (n) patch header]:quilt select patch:(a n o)' \ + '*:files:_files' + ;; + (mail) + _arguments '-h' \ + '-m[Text to use as the text in the introduction]:quilt select text: ' \ + '--prefix[Use an alternate prefix in the bracketed part of the subjects generated]:quilt select prefix: ' \ + '--mbox[Store all messages in the specified file in mbox format]:files:_files' \ + '--send[Send the messages directly]' \ + '--sender[The envelope sender address to use]:quilt select sender: ' \ + '--from[From header]:quilt select from: ' \ + '--subject[Subject header]:quilt select subject: ' \ + '--to[Append a recipient to the To header]:quilt select to: ' \ + '--cc[Append a recipient to the Cc header]:quilt select cc: ' \ + '--bcc[Append a recipient to the Bcc header]:quilt select bcc: ' \ + '--signature[Append the specified signature to messages]:files:_files' \ + '--reply-to[Add the appropriate headers to reply to the specified message]:quilt select reply-to: ' \ + '*:quilt series:_quilt_series' + ;; + (new) + _arguments '-h' + ;; + (next) + _arguments '-h' \ + ':quilt series:_quilt_series' + ;; + (patches) + _arguments '-h' \ + '-v[Verbose, more user friendly output]' \ + ':files:_files' ;; (pop) - if (( CURRENT == 2 )); then - tmp=( ${(f)"$(quilt applied 2>&1)"} ) - rc=$? - if (( rc == 0 )); then - _wanted -V 'applied patches' expl 'patch' compadd "${tmp[@]}" - else - _message "No applied patches" - fi - fi + _arguments '-h' \ + '-a[Remove all applied patches]' \ + '-f[Force remove]' \ + '-R[Always verify if the patch removes cleanly]' \ + '-q[Quiet operation]' \ + '-v[Verbose operation]' \ + ':quilt applied:_quilt_applied' + ;; + (previous) + _arguments '-h' \ + ':quilt series:_quilt_series' + ;; + (push) + _arguments '-h' \ + '-a[Apply all patches in the series file]' \ + '-q[Quiet operation]' \ + '-f[Force apply, even if the patch has rejects]' \ + '-v[Verbose operation]' \ + '--leave-rejects[Leave around the reject files patch produced]' \ + '--color=[Use syntax coloring]:quilt select color:(always auto never)' \ + ':quilt unapplied:_quilt_unapplied' + ;; + (refresh) + _arguments '-h' \ + '-p[Select a patch style]:quilt patch style:(0 1 ab)' \ + '-u[Create a unified diff]' \ + '-U[Create a unified diff with num lines of context]:quilt unified diff: ' \ + '-c[Create a context diff]' \ + '-C[Create a context diff with num lines of context]:quilt context diff: ' \ + '-z[Create a new patch containing the changes instead of refreshing the topmost patch]:quilt select new patch name: ' \ + '--no-timestamps[Do not include file timestamps in patch headers]' \ + '--no-index[Do not output Index: lines]' \ + '--diffstat[Add a diffstat section to the patch header, or replace the existing diffstat section]' \ + '-f[Enforce refreshing of a patch that is not on top]' \ + '--backup[Create a backup copy of the old version of a patch as patch~]' \ + '--sort[Sort files by their name instead of preserving the original order]' \ + '--strip-trailing-whitespace[Strip trailing whitespace at the end of lines]' \ + ':quilt series:_quilt_series' + ;; + (rename) + _arguments '-h' \ + '-P[Patch to rename]:quilt series:_quilt_series' + ;; + (revert) + _arguments '-h' \ + '-P[Revert changes in the named patch]:quilt series:_quilt_series' \ + '*:files:_files' + ;; + (series) + _arguments '-h' \ + '-v[Verbose, more user friendly output]' + ;; + (setup) + _arguments '-h' \ + '-d[Optional path prefix for the resulting source tree]:quilt select path-prefix: ' \ + '--sourcedir[Directory that contains the package sources]:quilt select package sources directory: ' \ + '-v[Verbose debug output]' \ + ':files:_files' + ;; + (shell) + _arguments '-h' \ + ':quilt select shell command:_command_names -e' + ;; + (snapshot) + _arguments '-h' \ + '-d[Remove current snapshot]' + ;; + (top) + _arguments '-h' + ;; + (unapplied) + _arguments '-h' \ + ':quilt series:_quilt_series' + ;; + (upgrade) + _arguments '-h' ;; (*) - _files ;; esac ;; -- cgit v1.2.3 From 4685aae8431209e365c4afb776d8ddb6c3d9f91b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 17 Oct 2011 17:00:48 +0000 Subject: small _perforce documentation update --- ChangeLog | 7 ++++++- Completion/Unix/Command/_perforce | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index bc4572ad4..6e8776d7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-10-17 Peter Stephenson + + * unposted: Completion/Unix/Command/_perforce: small + documentation update. + 2011-10-14 Peter Stephenson * 29820: Doc/Zsh/compsys.yo, @@ -15461,5 +15466,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5476 $ +* $Revision: 1.5477 $ ***************************************************** diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce index 1f39545e7..4661e18bc 100644 --- a/Completion/Unix/Command/_perforce +++ b/Completion/Unix/Command/_perforce @@ -3,7 +3,7 @@ # Maintainer: Peter Stephenson . # Increasingly loosely based on _cvs version 1.17. -# Completions currently based on Perforce release 2006.2. +# Completions currently based on Perforce release 2010.2. # Styles, tags and contexts # ========================= -- cgit v1.2.3 From 7cfd2fcccd932ad9601ae4aa5b7f4af6190cb902 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 22 Oct 2011 19:47:10 +0000 Subject: 29823: Completion/Unix/Command/_perl: Update for 5.14.1. --- ChangeLog | 6 +++- Completion/Unix/Command/_perl | 71 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 66 insertions(+), 11 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 18521a39b..23884efe1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-10-22 Simon Ruderich + + * 29823: Completion/Unix/Command/_perl: Update for 5.14.1. + 2011-10-19 Frank Terbeck * Suraj N. Kurapati: 29828: Misc/vcs_info-examples: Mention @@ -15476,5 +15480,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5479 $ +* $Revision: 1.5480 $ ***************************************************** diff --git a/Completion/Unix/Command/_perl b/Completion/Unix/Command/_perl index 20d9f2d83..b00baa6ed 100644 --- a/Completion/Unix/Command/_perl +++ b/Completion/Unix/Command/_perl @@ -3,17 +3,23 @@ # zsh completion code for the Perl interpreter # Adam Spiers # +# Completions currently based on Perl 5.14.1. _perl () { _arguments -s \ - '-0-:input record separator in octal (\0, if no argument): ' \ + '-0-[input record separator ($/)]:$/ in octal or hex (\0, if no argument)' \ '-a[autosplit mode with -n or -p (splits $_ into @F)]' \ + '-C-[control some unicode features]: :_perl_unicode_flags' \ "-c[check syntax only (runs BEGIN and END blocks)]" \ - '-d[run scripts under debugger]' \ - '-d\:-[run under control of a debugging/tracing module]:debugging/tracing module:_perl_modules --strip-prefix --perl-hierarchy=Devel' \ - '-D-:set debugging flags (argument is a bit mask or flags): ' \ - "*-e+:one line of script. Several -e's allowed. Omit [programfile]." \ - "-F-:split() pattern for autosplit (-a). The //'s are optional.: " \ + '( -dt -d: -dt:)-d[run scripts under debugger]' \ + '(-d -d: -dt:)-dt[run scripts under debugger (debugged code uses threads)]' \ + '(-d -dt -dt:)-d\:-[run under control of a debugging/tracing module]:debugging/tracing module:_perl_modules --strip-prefix --perl-hierarchy=Devel' \ + '(-d -dt -d: )-dt\:-[run under control of a debugging/tracing module (debugged coded uses threads)]:debugging/tracing module:_perl_modules --strip-prefix --perl-hierarchy=Devel' \ + '-D-[set debugging flags]: :_perl_debugging_flags' \ + '( -E)*-e+[run one line of program]:one line of program' \ + '(-e )*-E+[like -e but enable all optional features]:one line of program: ' \ + '-f[disable executing $Config{sitelib}/sitecustomize.pl at startup]' \ + '-F-[split() pattern for autosplit (-a)]:split() pattern, // is optional' \ '-h[list help summary]' \ '-i-[edit <> files in place (make backup if extension supplied)]:backup file extension: ' \ '*-I-[specify @INC/#include directory (may be used more than once)]:include path:_files -/' \ @@ -21,18 +27,21 @@ _perl () { \*{-m,-M}"-[module.. executes \`use/no module...' before executing your script]:module:_perl_m_opt" \ "-n[assume 'while (<>) { ... }' loop around your script]" \ "-p[assume loop like -n but print line also like sed]" \ - "-P[run script through C preprocessor before compilation]" \ + '-P[run script through C preprocessor before compilation (deprecated)]' \ "-s[enable some switch parsing for switches after script name]" \ "-S[look for the script using PATH environment variable]" \ - "-T[turn on tainted checks]" \ + '( -T)-t[turn on taint checks but only issue warnings]' \ + '(-t )-T[turn on taint checks]' \ "-u[dump core after parsing script]" \ "-U[allow unsafe operations]" \ "-v[print version number, patchlevel plus VERY IMPORTANT perl info]" \ "-V-[print perl configuration information]:configuration keys:_perl_config_vars" \ - '-w[turn warnings on for compilation of your script. Recommended]' \ + '( -W -X)-w[turn warnings on for compilation of your script (recommended)]' \ + "(-w -X)-W[enable all warnings (ignores 'no warnings')]" \ + "(-w -W )-X[disable all warnings (ignores 'use warnings')]" \ '-x-[strip off text before #!perl line and perhaps cd to directory]:directory to cd to:_files -/' \ '1:Perl script:_files -/ -g "*.(p[ml]|PL|t)(-.)"' \ - '*::args: _normal' + '*::args: _normal' } _perl_m_opt () { @@ -60,4 +69,46 @@ _perl_config_vars () { compadd "$expl[@]" $add_colon -S$delimiter -q -a _perl_config_vars } +_perl_unicode_flags () { + _values -s '' 'unicode bitmask or flags' \ + 'I[ 1 STDIN is assumed to be in UTF-8]' \ + 'O[ 2 STDOUT will be in UTF-8]' \ + 'E[ 4 STDERR will be in UTF-8]' \ + 'S[ 7 I + O + E]' \ + 'i[ 8 UTF-8 is the default PerlIO layer for input streams]' \ + 'o[ 16 UTF-8 is the default PerlIO layer for output streams]' \ + 'D[ 24 i + o]' \ + 'A[ 32 the @ARGV elements are expected to be strings encoded in UTF-8]' \ + 'L[ 64 make "IOEioA" conditional on the locale environment variables]' \ + 'a[256 set ${^UTF8CACHE} to -1, used for debugging]' \ +} + +_perl_debugging_flags () { + _values -s '' 'debugging bitmask or flags' \ + 'p[ 1 Tokenizing and parsing (with v, displays parse stack)]' \ + 's[ 2 Stack snapshots (with v, displays all stacks)]' \ + 'l[ 4 Context (loop) stack processing]' \ + 't[ 8 Trace execution]' \ + 'o[ 16 Method and overloading resolution]' \ + 'c[ 32 String/numeric conversions]' \ + 'P[ 64 Print profiling info, preprocessor command for -P, source file input state]' \ + 'm[ 128 Memory and SV allocation]' \ + 'f[ 256 Format processing]' \ + 'r[ 512 Regular expression parsing and execution]' \ + 'x[ 1024 Syntax tree dump]' \ + 'u[ 2048 Tainting checks]' \ + 'U[ 4096 Unofficial, User hacking (reserved for private, unreleased use)]' \ + 'H[ 8192 Hash dump -- usurps values()]' \ + 'X[ 16384 Scratchpad allocation]' \ + 'D[ 32768 Cleaning up]' \ + 'S[ 66536 Thread synchronization]' \ + 'T[ 131072 Tokenising]' \ + 'R[ 262144 Include reference counts of dumped variables (eg when using -Ds)]' \ + 'J[ 524288 Do not s,t,P-debug (Jump over) opcodes within package DB]' \ + 'v[1048576 Verbose: use in conjunction with other flags]' \ + 'C[2097152 Copy On Write]' \ + 'A[4194304 Consistency checks on internal structures]' \ + 'q[8388608 quiet - currently only suppresses the "EXECUTING" message]' \ +} + _perl "$@" -- cgit v1.2.3 From e5f1efa5a23213fdeb64907fbb5fc8db37aa5e0a Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 24 Oct 2011 11:32:41 +0000 Subject: Foudil Brétel: 29842: major update to systemctl completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 7 +- Completion/Unix/Command/_systemctl | 339 +++++++++++++++++++++++++++++-------- 2 files changed, 270 insertions(+), 76 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 47fc89954..2f20a43af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-10-24 Peter Stephenson + + * Foudil Brétel: 29842: Completion/Unix/Command/_systemctl: + major rewrite. + 2011-10-24 Phil Pennock * 29838: Src/Modules/pcre.c: metafy/unmetafy strings, to @@ -15492,5 +15497,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5482 $ +* $Revision: 1.5483 $ ***************************************************** diff --git a/Completion/Unix/Command/_systemctl b/Completion/Unix/Command/_systemctl index 5dd35db7a..801a8e060 100644 --- a/Completion/Unix/Command/_systemctl +++ b/Completion/Unix/Command/_systemctl @@ -1,102 +1,291 @@ #compdef systemctl -# Completion for systemd's systemctl -# Version 1.0 ARF 3 August 2011 +# Copyright (c) 2011 Foudil Brétel +# +# This file is released under the GPLv3. +# +# inspired from _yum and systemctl-bash-completion.sh (shipped with systemctl) +# +# TODO: enable options after commands. Ex: systemctl list-units --all --full -# list the unit completions. -_systemd_units(){ - local -a units - local expl - units=(${(f)"$( systemctl --full list-units | sed -e 's/ .*//' )"}) - _wanted keys expl 'units' compadd "$units[@]" -} - -# list the job completions. -_systemd_jobs(){ - local -a jobs - local expl - jobs=(${(f)"$( systemctl --full list-jobs | sed -e 's/ .*//' )"}) - _wanted keys expl 'jobs' compadd "$jobs[@]" -} - -# list the snapshot completions. -_systemd_snapshots(){ - local -a ss - local expl - ss=(${(f)"$( - systemctl dump | sed -n -e 's/^-> Unit \(.*\.snapshot\):/\1/p' - )"}) - _wanted keys expl 'snapshots' compadd "$ss[@]" -} - -_systemctl(){ - local -a _systemctl_cmds +# Main dispatcher +_systemctl() +{ + local curcontext="$curcontext" state lstate line - # Determine the sub commands - #$(systemctl --help | sed -n -e 's/^ \([a-z]\)/\1/p' | sed -e 's/ .*//') - _systemctl_cmds=( - list-units start stop reload restart try-restart reload-or- - restart reload-or-try-restart isolate kill is-active status show - reset-failed enable disable is-enabled load list-jobs cancel - monitor dump dot snapshot delete daemon-reload daemon-reexec show- - environment set-environment unset-environment default rescue - emergency halt poweroff reboot kexec exit - ) - - local curcontext="$curcontext" state line expl - typeset -A opt_args - - # Initial flags - _arguments -A '-*' \ - '--help[Show help]' \ + # -s for aggregated options like -aP + _arguments -s \ + {-h,--help}'[Show help]' \ '--version[Show package version]' \ - '(-a,--all)'{-a,--all}'[Show all units/properties, including dead/empty ones]' \ - '--full[Dont ellipsize unit names on output]' \ + {-t,--type=}'[List only units of a particular type]:unit type:(automount device mount path service snapshot socket swap target timer)' \ + \*{-p,--property=}'[Show only properties by specific name]:unit property:' \ + {-a,--all}'[Show all units/properties, including dead/empty ones]' \ '--failed[Show only failed units]' \ + "--full[Don't ellipsize unit names on output]" \ '--fail[When queueing a new job, fail if conflicting jobs are pending]' \ - '--ignore-dependencies[ignore dependencies]' \ - '(-p,--privileged)'{-p,--privileged}'[Acquire privileges before execution]' \ - '(-q,--quiet)'{-q,--quiet}'[Suppress output]' \ + '--ignore-dependencies[When queueing a new job, ignore all its dependencies]' \ + '--kill-mode=[How to send signal]:killmode:(control-group process)' \ + '--kill-who=[Who to send signal to]:killwho:(main control all)' \ + {-s,--signal=}'[Which signal to send]:signal:_signals' \ + {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \ + {-P,--privileged}'[Acquire privileges before execution]' \ + {-q,--quiet}'[Suppress output]' \ '--no-block[Do not wait until operation finished]' \ - '--no-wall[Dont send wall message before halt/power-off/reboot]' \ - '--no-reload[dont reload daemon configuration]' \ - '--no-pager[Do use pager]' \ + "--no-wall[Don't send wall message before halt/power-off/reboot]" \ + "--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \ + '--no-pager[Do not pipe output into a pager]' \ '--no-ask-password[Do not ask for system passwords]' \ '--order[When generating graph for dot, show only order]' \ '--require[When generating graph for dot, show only requirement]' \ '--system[Connect to system manager]' \ '--user[Connect to user service manager]' \ '--global[Enable/disable unit files globally]' \ - '(-f,--force)'{-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \ + {-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \ '--defaults[When disabling unit files, remove default symlinks only]' \ - '*::command:->subcmd' && return 0 + '*::systemctl command:_systemctl_command' +} + +_hosts_or_user_at_host() +{ + _alternative \ + 'users-hosts:: _user_at_host' \ + 'hosts:: _hosts' +} + +(( $+functions[_systemctl_command] )) || _systemctl_command() +{ + local -a _systemctl_cmds + _systemctl_cmds=( + "list-units:List units" + "start:Start (activate) one or more units" + "stop:Stop (deactivate) one or more units" + "reload:Reload one or more units" + "restart:Start or restart one or more units" + "try-restart:Restart one or more units if active" + "reload-or-restart:Reload one or more units is possible, otherwise start or restart" + "reload-or-try-restart:Reload one or more units is possible, otherwise restart if active" + "isolate:Start one unit and stop all others" + "kill:Send signal to processes of a unit" + "is-active:Check whether units are active" + "status:Show runtime status of one or more units" + "show:Show properties of one or more units/jobs or the manager" + "reset-failed:Reset failed state for all, one, or more units" + "enable:Enable one or more unit files" + "disable:Disable one or more unit files" + "is-enabled:Check whether unit files are enabled" + "load:Load one or more units" + "list-jobs:List jobs" + "cancel:Cancel all, one, or more jobs" + "monitor:Monitor unit/job changes" + "dump:Dump server status" + "dot:Dump dependency graph for dot(1)" + "snapshot:Create a snapshot" + "delete:Remove one or more snapshots" + "daemon-reload:Reload systemd manager configuration" + "daemon-reexec:Reexecute systemd manager" + "show-environment:Dump environment" + "set-environment:Set one or more environment variables" + "unset-environment:Unset one or more environment variables" + "default:Enter system default mode" + "rescue:Enter system rescue mode" + "emergency:Enter system emergency mode" + "halt:Shut down and halt the system" + "poweroff:Shut down and power-off the system" + "reboot:Shut down and reboot the system" + "kexec:Shut down and reboot the system with kexec" + "exit:Ask for user instance termination" + ) - # Complete subcommands. if (( CURRENT == 1 )); then - _describe -t commands "command" _systemctl_cmds - return + _describe -t commands 'systemctl command' _systemctl_cmds || compadd "$@" + else + local curcontext="$curcontext" + + cmd="${${_systemctl_cmds[(r)$words[1]:*]%%:*}}" + # Deal with any aliases + case $cmd in + condrestart) cmd="try-restart";; + force-reload) cmd="reload-or-try-restart";; + esac + + if (( $#cmd )); then + curcontext="${curcontext%:*:*}:systemctl-${cmd}:" + + local update_policy + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy _systemctl_caching_policy + fi + + _call_function ret _systemctl_$cmd || _message 'no more arguments' + else + _message "unknown systemctl command: $words[1]" + fi + return ret fi +} - # handle arguments to the subcommands. - case $words[1] in - start|restart|reload|stop|status|try-restart|reload-or-restart|reload-or-try-restart|isolate|kill|is-active|show|reset-failed|enable|disable|is-enabled|load) - # many units can be listed - _arguments "*:key:_systemd_units" - ;; +# Fills the unit lists +_systemctl_all_units() +{ + if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) && + ! _retrieve_cache SYS_ALL_UNITS; + then + _sys_all_units=( $(systemctl list-units --full --all | cut -d' ' -f1 \ + 2>/dev/null) ) + _store_cache SYS_ALL_UNITS _sys_all_units + fi +} - cancel) _arguments "*:key:_systemd_jobs" ;; +_systemctl_inactive_units() +{ + _sys_inactive_units=( $(systemctl list-units --full --all \ + | awk '$3 != "active" {print $1}' 2>/dev/null) ) +} - # snapshots - snapshot) _normal ;; - delete) _arguments "*:key:_systemd_snapshots" ;; +_systemctl_active_units() +{ + _sys_active_units=( $(systemctl list-units --full | cut -d' ' -f1 \ + 2>/dev/null) ) +} - # no arguments - dump|dot|monitor|daemon-reload|daemon-reexec|show-environment|default|rescue|emergency|halt|poweroff|reboot|kexec|exit|list-jobs|list-units) - ;; +_systemctl_failed_units() +{ + _sys_failed_units=( $(systemctl list-units --full --failed | cut -d' ' -f1 + 2>/dev/null) ) +} + +_filter_units_by_property () { + local property=$1 value=$2 ; shift ; shift + local -a units ; units=($*) + local -a props ; props=( $(systemctl show --property "$property" -- \ + ${units[*]} | grep -v '^$') ) + for ((i=0; $i < ${#units[*]}; i++)); do + if [[ "${props[i]}" = "$property=$value" ]]; then + echo "${units[i]}" + fi + done +} + +# Completion functions for ALL_UNITS +for fun in enable disable is-active is-enabled status show ; do + (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() + { + _systemctl_all_units + compadd "$@" -a -- _sys_all_units + } +done + +# Completion functions for STARTABLE_UNITS +(( $+functions[_systemctl_start] )) || _systemctl_start() +{ + _systemctl_inactive_units + compadd "$@" -- $( _filter_units_by_property CanStart yes \ + ${_sys_inactive_units[*]} | grep -Ev '\.(device|snapshot)$' ) +} + +# Completion functions for RESTARTABLE_UNITS +for fun in restart reload-or-restart ; do + (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() + { + _systemctl_all_units + compadd "$@" -- $( _filter_units_by_property CanStart yes \ + ${_sys_all_units[*]} | grep -Ev '\.(device|snapshot|socket|timer)$' ) + } +done + +# Completion functions for STOPPABLE_UNITS +for fun in stop kill try-restart condrestart ; do + (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() + { + _systemctl_active_units + compadd "$@" -- $( _filter_units_by_property CanStop yes \ + ${_sys_active_units[*]} ) + } +done + +# Completion functions for RELOADABLE_UNITS +for fun in reload reload-or-try-restart force-reload ; do + (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() + { + _systemctl_active_units + compadd "$@" -- $( _filter_units_by_property CanReload yes \ + ${_sys_active_units[*]} ) + } +done + +# Completion functions for ISOLATABLE_UNITS +(( $+functions[_systemctl_isolate] )) || _systemctl_isolate() +{ + _systemctl_all_units + compadd "$@" -- $( _filter_units_by_property AllowIsolate yes \ + ${_sys_all_units[*]} ) +} + +# Completion functions for FAILED_UNITS +(( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed() +{ + _systemctl_failed_units + compadd "$@" -a -- _sys_failed_units || _message "no failed-unit found" +} + +# Completion functions for JOBS +(( $+functions[_systemctl_cancel] )) || _systemctl_cancel() +{ + compadd "$@" -- $( systemctl list-jobs | cut -d' ' -f1 2>/dev/null ) || \ + _message "no job found" +} + +# Completion functions for SNAPSHOTS +(( $+functions[_systemctl_delete] )) || _systemctl_delete() +{ + compadd "$@" -- $( systemctl list-units --type snapshot --full --all \ + | cut -d' ' -f1 2>/dev/null ) || _message "no snampshot found" +} + +# Completion functions for ENVS +(( $+functions[_systemctl_set-environment] )) || _systemctl_set-environment() +{ + compadd "$@" -S '' -- $( systemctl show-environment \ + | sed 's_\([^=]\+=\).*_\1_' ) +} +(( $+functions[_systemctl_unset-environment] )) || _systemctl_unset-environment() +{ + compadd "$@" -S '' -- $( systemctl show-environment \ + | sed 's_\([^=]\+\)=.*_\1_' ) +} + +# no completion for: +# [STANDALONE]='daemon-reexec daemon-reload default dot dump emergency exit +# halt kexec list-jobs list-units monitor poweroff reboot +# rescue show-environment' +# [NAME]='snapshot load' + +_systemctl_caching_policy() +{ + local _sysunits + local -a oldcache + + # rebuild if cache is more than a day old + oldcache=( "$1"(mh+1) ) + (( $#oldcache )) && return 0 + + _sysunits=($(systemctl --full --all | cut -d' ' -f1)) + + if (( $#_sysunits )); then + for unit in $_sysunits; do + [[ "$unit" -nt "$1" ]] && return 0 + done + fi - *) _message "unknown systemctl command: $words[1]" ;; - esac + return 1 } _systemctl "$@" +# Local Variables: +# mode: sh +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: -- cgit v1.2.3 From 19550e7713c59cf3bc795fc0e0a3c6d62f88bb46 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 30 Oct 2011 19:39:43 +0000 Subject: users/16547: quote p4 arguments with colons in from _describe --- ChangeLog | 7 ++++++- Completion/Unix/Command/_perforce | 14 +++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 8739e7597..61d4e4643 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-10-30 Peter Stephenson + + * users/16547: Completion/Unix/Command/_perforce: quote + arguments with colon in from _describe. + 2011-10-28 Peter Stephenson * Src/module.c (do_load_module): 29879: (via takimoto-j): Metafy @@ -15522,5 +15527,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5489 $ +* $Revision: 1.5490 $ ***************************************************** diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce index 4661e18bc..2c1365a79 100644 --- a/Completion/Unix/Command/_perforce +++ b/Completion/Unix/Command/_perforce @@ -603,7 +603,7 @@ _perforce_global_options() { _perforce_branches() { local bline match mbegin mend local -a bl - bl=(${${${(f)"$(_perforce_call_p4 branches branches 2>/dev/null)"}##Branch }/ /:}) + bl=(${${${${(f)"$(_perforce_call_p4 branches branches 2>/dev/null)"}##Branch }//:/\\:}/ /:}) [[ $#bl -eq 1 && $bl[1] = '' ]] && bl=() (( $#bl )) && _describe -t branches 'Perforce branch' bl } @@ -685,7 +685,7 @@ awk '/^Client:/ { print $2 }')") # Limit to the 20 most recent changes by default to avoid huge # output. cl=( -${${${${(f)"$(_perforce_call_p4 changes changes $amax $xargs $cstatus \$file)"}##Change\ }//\ on\ /:}/\ by\ /\ } +${${${${${(f)"$(_perforce_call_p4 changes changes $amax $xargs $cstatus \$file)"}##Change\ }//:/\\:}//\ on\ /:}/\ by\ /\ } ) # "default" can't have shelved files in it... [[ $ctype = shelved* ]] || cl+=("default:change not yet numbered") @@ -711,7 +711,7 @@ _perforce_clients() { compset -P '//' && slash=(-S/ -q) fi - cl=(${${${(f)"$(_perforce_call_p4 clients clients)"}##Client\ }/\ /:}) + cl=(${${${${(f)"$(_perforce_call_p4 clients clients)"}##Client\ }//:/\\:}/\ /:}) [[ $#cl -eq 1 && $cl[1] = '' ]] && cl=() _describe -t clients 'Perforce client' cl $slash } @@ -722,7 +722,7 @@ _perforce_counters() { local cline match mbegin mend local -a cl - cl=(${${${(f)"$(_perforce_call_p4 counters counters)"}/\ /:}/\=/current value}) + cl=(${${${${(f)"$(_perforce_call_p4 counters counters)"}//:/\\:}/\ /:}/\=/current value}) [[ $#cl -eq 1 && $cl[1] = '' ]] && cl=() _describe -t counters 'Perforce counter' cl } @@ -796,7 +796,7 @@ _perforce_depots() { local dline match mbegin mend local -a dl - dl=(${${${(f)"$(_perforce_call_p4 depots depots)"}##Depot\ }/\ /:}) + dl=(${${${${(f)"$(_perforce_call_p4 depots depots)"}##Depot\ }//:/\\:}/\ /:}) [[ $#dl -eq 1 && $dl[1] = '' ]] && dl=() _describe -t depots 'depot name' dl } @@ -1594,7 +1594,7 @@ _perforce_submit_options() { _perforce_pids() { local -a ul - ul=(${${${(f)"$(_perforce_call_p4 monitor monitor show 2>/dev/null)"}# *}/\ /:}) + ul=(${${${${(f)"$(_perforce_call_p4 monitor monitor show 2>/dev/null)"}# *}//:/\\:}/\ /:}) [[ $#ul -eq 1 && $ul[1] = '' ]] && ul=() _describe -t id 'process ID' ul } @@ -1604,7 +1604,7 @@ _perforce_pids() { _perforce_users() { local -a ul - ul=(${${(f)"$(_perforce_call_p4 users users)"}/\ /:}) + ul=(${${${(f)"$(_perforce_call_p4 users users)"}//:/\\:}/\ /:}) [[ $#ul -eq 1 && $ul[1] = '' ]] && ul=() _describe -t users 'Perforce user' ul } -- cgit v1.2.3 From b337296b933b076ffcd9c39b7036847c92cb0a11 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 7 Nov 2011 20:57:44 +0000 Subject: 29893: Completion/Unix/Command/_ssh: Update (mostly) for 5.9. --- ChangeLog | 6 +- Completion/Unix/Command/_ssh | 260 +++++++++++++++++++++++++++++-------------- 2 files changed, 181 insertions(+), 85 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index b9ac1e6ad..66347ea1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-11-07 Simon Ruderich + + * 29893: Completion/Unix/Command/_ssh: Update (mostly) for 5.9. + 2011-11-07 Peter Stephenson * 29894: Doc/Zsh/contrib.yo, Functions/Zle/replace-string: @@ -15548,5 +15552,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5494 $ +* $Revision: 1.5495 $ ***************************************************** diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index d0bf6ba32..d0944c656 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -1,5 +1,11 @@ #compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen sftp +# Completions currently based on OpenSSH 5.9 (released on 2011-09-06). +# +# TODO: update ssh-keygen (not based on 5.9) +# TODO: sshd, ssh-keyscan, ssh-keysign + + _remote_files () { # There should be coloring based on all the different ls -F classifiers. local expl rempat remfiles remdispf remdispd args suf ret=1 @@ -38,79 +44,100 @@ _ssh () { typeset -A opt_args common=( - '-c+[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)' - '-C[compress data]' - '-F+[specify alternate config file]:config file:_files' - '-i+[select identity file]:SSH identity file:_files' - '*-o+[specify extra options]:option string:->option' '(-2)-1[forces ssh to try protocol version 1 only]' '(-1)-2[forces ssh to try protocol version 2 only]' '(-6)-4[forces ssh to use IPv4 addresses only]' '(-4)-6[forces ssh to use IPv6 addresses only]' + '-C[compress data]' + '-c+[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)' + '-F+[specify alternate config file]:config file:_files' + '-i+[select identity file]:SSH identity file:_files' + '*-o+[specify extra options]:option string:->option' + ) + common_transfer=( + '-l[limit used bandwidth]:bandwidth in KiB/s:' + '-P+[specify port on remote host]:port number on remote host' + '-p[preserve modification times, access times and modes]' + '-q[disable progress meter and warnings]' + '-r[recursively copy directories (follows symbolic links)]' + '-S+[specify ssh program]:path to ssh:_command_names -e' \ + '-v[verbose mode]' ) case "$service" in ssh) _arguments -C -s \ - '(-A)-a[disable forwarding of authentication agent connection]' \ '(-a)-A[enables forwarding of the authentication agent connection]' \ + '(-A)-a[disable forwarding of authentication agent connection]' \ '(-P)-b+[specify interface to transmit on]:bind address:_bind_addresses' \ - '-D+[specify a dynamic port forwarding]:port' \ + '-D+[specify a dynamic port forwarding]:[bind-address]\:port' \ '-e+[set escape character]:escape character (or `none'"'"'):' \ '(-n)-f[go to background]' \ '-g[allow remote hosts to connect to local forwarded ports]' \ - '-I+[specify smartcard device]:device:_files' \ - '-k[disable forwarding of kerberos tickets]' \ + '-I+[specify the PKCS#11 shared library to use]' \ + '-K[enable GSSAPI-based authentication and forwarding]' \ + '-k[disable forwarding of GSSAPI credentials]' \ + '*-L[specify local port forwarding]:local port forwarding:->forward' \ '-l+[specify login name]:login name:_ssh_users' \ + '-M[master mode for connection sharing]' \ '(-1)-m+[specify mac algorithms]:mac spec' \ + '(-1)-N[do not execute a remote command (protocol version 2 only)]' \ '-n[redirect stdin from /dev/null]' \ - '(-1)-N[do not execute a remote command. (protocol version 2 only)]' \ - '-p+[specify port on remote host]:port number on remote host' \ + '-O[control active connection multiplexing master process]:multiplex control command:(( + check\:"check that the master process is running" + forward\:"request forwardings without command execution" + cancel\:"cancel forwardings" + exit\:"request the master to exit" + stop\:"request the master to stop accepting further multiplexing requests"))' \ '-P[use non privileged port]' \ + '-p+[specify port on remote host]:port number on remote host' \ '(-v)*-q[quiet operation]' \ + '*-R[specify remote port forwarding]:remote port forwarding:->forward' \ + '-S+[specify location of control socket for connection sharing]:path to control socket:_files' \ '(-1)-s[invoke subsystem]' \ - '(-T)-t[force pseudo-tty allocation]' \ '(-1 -t)-T[disable pseudo-tty allocation (protocol version 2 only)]' \ - '(-q)*-v[verbose mode]' \ + '(-T)-t[force pseudo-tty allocation]' \ '-V[show version number]' \ - '(-X -Y)-x[disable X11 forwarding]' \ + '(-q)*-v[verbose mode]' \ + '(-N)-W[forward standard input/output over host:port (protocol version 2 only)]:host\:port' \ + '-w[request tunnel device forwarding with the specified tun devices]:local_tun[\:remote_tun]' \ '(-x -Y)-X[enable (untrusted) X11 forwarding]' \ + '(-X -Y)-x[disable X11 forwarding]' \ '(-x -X)-Y[enable trusted X11 forwarding]' \ - '-M[master mode for connection sharing]' \ - '-S+:path to control socket:_files' \ - '-O:multiplex control command:(check exit forward stop)' \ - '*-L[specify local port forwarding]:local port forwarding:->forward' \ - '*-R[specify remote port forwarding]:remote port forwarding:->forward' \ + '-y[send log information using the syslog module]' \ ':remote host name:->userhost' \ '*::args:->command' "$common[@]" && ret=0 ;; scp) _arguments -C -s \ - '-p[preserve modification times]' \ - '-r[recursively copy directories]' \ - '-v[verbose mode]' \ - '-B[batch mode]' \ - '-q[disables the progress meter]' \ - '-P+[specify port on remote host]:port number on remote host' \ - '-S+[specify ssh program]:path to ssh:_command_names -e' \ - '*:file:->file' "$common[@]" && ret=0 + '-3[copy through local host, not directly between the remote hosts]' \ + '-B[batch mode (don'"'"'t ask for passphrases)]' \ + '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0 ;; ssh-add) _arguments -s \ - '-l[list all identities]' \ - '-L[lists public key parameters of all identities in the agent]'\ - '-d[remove identity]' \ + '-c[identity is subject to confirmation via SSH_ASKPASS]' \ '-D[delete all identities]' \ - '-p[read passphrase from stdin]' \ + '-d[remove identity]' \ + '-e[remove keys provided by the PKCS#11 shared library]:library:' \ + '-k[load plain private keys only and skip certificates]' \ + '-L[lists public key parameters of all identities in the agent]'\ + '-l[list all identities]' \ + '-s[add keys provided by the PKCS#11 shared library]:library:' \ + '-t[set maximum lifetime for identity]:maximum lifetime (in seconds or time format):' \ + '-X[unlock the agent]' \ + '-x[lock the agent with a password]' \ '*:SSH identity file:_files' return ;; ssh-agent) _arguments -s \ - '(*)-k[kill agent automatically]' \ - '(-c)-s[force sh-style shell]' \ - '(-s)-c[force csh-style shell]' \ + '(-k)-a[UNIX-domain socket to bind agent to]:UNIX-domain socket:_files' \ + '(-k -s)-c[force csh-style shell]' \ '(-k)-d[debug mode]' \ + '-k[kill current agent]' \ + '(-k -c)-s[force sh-style shell]' \ + '-t[set default maximum lifetime for identities]:maximum lifetime (in seconds or time format):' \ '*::command: _normal' return ;; @@ -137,16 +164,12 @@ _ssh () { ;; sftp) _arguments -C -s \ - '-C[compress data]' \ - '-F+[specify alternate config file]:config file:_files' \ - '(-1)-s[invoke subsystem]' \ - '-S+[specify program]:program:_command_names -e' \ - '-B+[specify buffer size]:buffer size' \ + '-B+[specify buffer size]:buffer size in bytes (default\: 32768):' \ '-b+[specify batch file to read]:batch file:_files' \ - '*-v[verbose mode]' \ - '-1[forces ssh to try protocol version 1 only]' \ - '*-o+[specify extra options]:option string:->option' \ - '1:file:->rfile' '*:file:->file' && ret=0 + '-D[connect directly to a local sftp server]:sftp server path:' \ + '-R[specify number of outstanding requests]:number of requests (default\: 64):' \ + '-s[SSH2 subsystem or path to sftp server on the remote host]' \ + '1:file:->rfile' '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0 ;; esac @@ -163,22 +186,36 @@ _ssh () { ;; *(#i)ciphers*) _values -s , 'encryption cipher' \ - 'aes128-cbc' \ '3des-cbc' \ - 'blowfish-cbc' \ - 'cast128-cbc' \ - 'arcfour' \ + 'aes128-cbc' \ 'aes192-cbc' \ 'aes256-cbc' \ + 'aes128-ctr' \ + 'aes192-ctr' \ + 'aes256-ctr' \ + 'arcfour128' \ + 'arcfour256' \ + 'arcfour' \ + 'blowfish-cbc' \ + 'cast128-cbc' \ + \ 'rijndael128-cbc' \ 'rijndael192-cbc' \ 'rijndael256-cbc' \ - 'rijndael-cbc@lysator.liu.se' && ret=0 + 'rijndael-cbc@lysator.liu.se' \ + && ret=0 ;; *(#i)cipher*) - _wanted values expl 'encryption cipher' \ - compadd idea des 3des blowfish arcfour tss none && ret=0 + _wanted values expl 'encryption cipher (protocol version 1)' \ + compadd blowfish 3des des idea arcfour tss none && ret=0 ;; + *(#i)controlmaster*) + _wanted values expl 'truthish value' compadd yes no auto autoask && ret=0 + ;; + *(#i)controlpath*) + _description files expl 'path to control socket' + _files "$expl[@]" && ret=0 + ;; *(#i)globalknownhostsfile*) _description files expl 'global file with known hosts' _files "$expl[@]" && ret=0 @@ -193,6 +230,10 @@ _ssh () { *(#i)(local|remote)forward*) state=forward ;; + *(#i)preferredauthentications*) + _values -s , 'authentication method' gssapi-with-mic \ + hostbased publickey keyboard-interactive password && ret=0 + ;; *(#i)protocol*) _values -s , 'protocol version' \ '1' \ @@ -218,44 +259,95 @@ _ssh () { _description files expl 'xauth program' _files "$expl[@]" -g '*(-*)' && ret=0 ;; - *(#i)controlmaster*) - _wanted values expl 'truthish value' compadd yes no auto autoask && ret=0 - ;; - *(#i)controlpath*) - _description files expl 'path to control socket' - _files "$expl[@]" && ret=0 - ;; - *(#i)preferredauthentications*) - _values -s , 'authentication method' gssapi-with-mic \ - hostbased publickey keyboard-interactive password && ret=0 esac else + # old options are after the empty "\"-line _wanted values expl 'configure file option' \ compadd -M 'm:{a-z}={A-Z}' -qS '=' - \ - AddressFamily \ - AFSTokenPassing BatchMode BindAddress \ - ChallengeResponseAuthentication CheckHostIP \ - Cipher Ciphers ClearAllForwardings Compression \ - CompressionLevel ConnectionAttempts ConnectTimeout \ - ControlMaster ControlPath \ - DynamicForward EnableSSHKeysign \ - EscapeChar FallBackToRsh ForwardAgent ForwardX11 \ - ForwardX11Trusted \ - GatewayPorts GlobalKnownHostsFile GSSAPIAuthentication \ - GSSAPIDelegateCredentials HostbasedAuthentication \ - HostKeyAlgorithms HostKeyAlias HostName IdentityFile \ - IdentitiesOnly KbdInteractiveDevices \ - KeepAlive KerberosAuthentication KerberosTgtPassing \ - LocalForward LogLevel MACs NoHostAuthenticationForLocalhost \ - NumberOfPasswordPrompts PreferredAuthentications \ - PasswordAuthentication Port Protocol ProtocolKeepAlives \ - ProxyCommand PubkeyAuthentication RemoteForward \ - RhostsAuthentication RhostsRSAAuthentication \ - RSAAuthentication ServerAliveInterval ServerAliveCountMax \ - SetupTimeOut SmartcardDevice StrictHostKeyChecking \ - TCPKeepAlive \ - UsePrivilegedPort User UserKnownHostsFile UseRsh \ - VerifyHostKeyDNS XAuthLocation && ret=0 + AddressFamily \ + BatchMode \ + BindAddress \ + ChallengeResponseAuthentication \ + CheckHostIP \ + Cipher \ + Ciphers \ + ClearAllForwardings \ + Compression \ + CompressionLevel \ + ConnectionAttempts \ + ConnectTimeout \ + ControlMaster \ + ControlPath \ + ControlPersist \ + DynamicForward \ + EnableSSHKeysign \ + EscapeChar \ + ExitOnForwardFailure \ + ForwardAgent \ + ForwardX11 \ + ForwardX11Timeout \ + ForwardX11Trusted \ + GatewayPorts \ + GlobalKnownHostsFile \ + GSSAPIAuthentication \ + GSSAPIDelegateCredentials \ + HashKnownHosts \ + Host \ + HostbasedAuthentication \ + HostKeyAlgorithms \ + HostKeyAlias \ + HostName \ + IdentitiesOnly \ + IdentityFile \ + IPQoS \ + KbdInteractiveAuthentication \ + KbdInteractiveDevices \ + KexAlgorithms \ + LocalCommand \ + LocalForward \ + LogLevel \ + MACs \ + NoHostAuthenticationForLocalhost \ + NumberOfPasswordPrompts \ + PasswordAuthentication \ + PermitLocalCommand \ + PKCS11Provider \ + Port \ + PreferredAuthentications \ + Protocol \ + ProxyCommand \ + PubkeyAuthentication \ + RekeyLimit \ + RemoteForward \ + RequestTTY \ + RhostsRSAAuthentication \ + RSAAuthentication \ + SendEnv \ + ServerAliveCountMax \ + ServerAliveInterval \ + StrictHostKeyChecking \ + TCPKeepAlive \ + Tunnel \ + TunnelDevice \ + UsePrivilegedPort \ + User \ + UserKnownHostsFile \ + VerifyHostKeyDNS \ + VisualHostKey \ + XAuthLocation \ + \ + AFSTokenPassing \ + FallBackToRsh \ + KeepAlive \ + KerberosAuthentication \ + KerberosTgtPassing \ + PreferredAuthentications \ + ProtocolKeepAlives \ + RhostsAuthentication \ + SetupTimeOut \ + SmartcardDevice \ + UseRsh \ + && ret=0 fi ;; forward) -- cgit v1.2.3 From 970adcc4d0e9f2ab08439d9db43076e02885553b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 8 Nov 2011 09:51:31 +0000 Subject: Haakon Riiser: 29895, 29897: _ffmpeg, _nmcli --- ChangeLog | 9 +- Completion/Linux/Command/.distfiles | 1 + Completion/Linux/Command/_nmcli | 244 ++++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_ffmpeg | 13 ++ 4 files changed, 266 insertions(+), 1 deletion(-) create mode 100644 Completion/Linux/Command/_nmcli (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 66347ea1a..e712811a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-11-08 Peter Stephenson + + * Haakon Riiser: 29895, 29887: Completion/Unix/Command/_ffmpeg, + Completion/Linux/Command/_nmcli (plus + Completion/Linux/Command/.distfiles): update and new + NetworkManager client completion. + 2011-11-07 Simon Ruderich * 29893: Completion/Unix/Command/_ssh: Update (mostly) for 5.9. @@ -15552,5 +15559,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5495 $ +* $Revision: 1.5496 $ ***************************************************** diff --git a/Completion/Linux/Command/.distfiles b/Completion/Linux/Command/.distfiles index 941e2de3c..0d817fc5d 100644 --- a/Completion/Linux/Command/.distfiles +++ b/Completion/Linux/Command/.distfiles @@ -18,6 +18,7 @@ _mdadm _mii-tool _modutils _mondo +_nmcli _pkgtool _rpmbuild _schedtool diff --git a/Completion/Linux/Command/_nmcli b/Completion/Linux/Command/_nmcli new file mode 100644 index 000000000..a6b97a36c --- /dev/null +++ b/Completion/Linux/Command/_nmcli @@ -0,0 +1,244 @@ +#compdef nmcli + +local context state line expl +typeset -A opt_args + +if [[ -z $_nmcli_version ]]; then + _nmcli_version="${"$(_call_program nmcli $words[1] --version)"##*version }" +fi + +(( $+functions[_nmcli_is_running] )) || _nmcli_is_running() { + [[ $(_call_program nmcli $words[1] -f running nm) != *'not running'* ]] +} + +(( $+functions[_nmcli_con_ids] )) || _nmcli_con_ids() { + _nmcli_is_running || return + local -a con_ids + con_ids=(${(f)"$(_call_program nmcli $words[1] -f name con)"}) + con_ids=(${con_ids[2,-2]}) + con_ids=(${con_ids[@]%%\ ##}) + _describe 'select connection' con_ids +} + +(( $+functions[_nmcli_con_uuids] )) || _nmcli_con_uuids() { + _nmcli_is_running || return + local -a con_uuids + con_uuids=(${(f)"$(_call_program nmcli $words[1] -f uuid con)"}) + con_uuids=(${con_uuids[2,-2]}) + con_uuids=(${con_uuids[@]%%\ ##}) + _describe 'select connection' con_uuids +} + +(( $+functions[_nmcli_objects] )) || _nmcli_objects() { + local -a objects_array + objects_array=( + 'nm:NetworkManager status' + 'con:NetworkManager connections' + 'dev:devices managed by NetworkManager' + ) + _describe 'nmcli object' objects_array +} + +(( $+functions[_nmcli_nm] )) || _nmcli_nm() { + local -a nm_array + nm_array=( + 'status:show overall status of NetworkManager' + 'enable:get status or enable/disable networking' + 'sleep:get sleep status or put to sleep/awake NetworkManager' + 'wifi:inquire or set status of WiFi in NetworkManager' + 'wwan:inquire or set status of WWAN in NetworkManager' + ) + _describe 'inquire and change state of NetworkManager' nm_array +} + +(( $+functions[_nmcli_con] )) || _nmcli_con() { + local -a con_array + con_array=( + 'list:list configured connections' + 'status:print status of active connections' + 'up:activate a connection' + 'down:deactivate a connection' + ) + if [[ $_nmcli_version == 0.9.[1-9]* ]]; then + con_array[5]="delete:delete a connection" + fi + _describe "get information about NetworkManager's connections" con_array +} + +(( $+functions[_nmcli_con_list] )) || _nmcli_con_list() { + local -a con_list_array + con_list_array=( + 'id:get details on connection specified by id' + 'uuid:get details on connection specified by uuid' + ) + if [[ $_nmcli_version == 0.8* ]]; then + con_list_array[3]='system:only list system connections' + con_list_array[4]='user:only list user connections' + fi + _describe 'list configured connections' con_list_array +} + +(( $+functions[_nmcli_con_up] )) || _nmcli_con_up() { + local -a con_up_array + con_up_array=( + 'id:activate connection specified by id' + 'uuid:activate connection specified by uuid' + ) + _describe 'activate connection by id or uuid' con_up_array +} + +(( $+functions[_nmcli_con_down] )) || _nmcli_con_down() { + local -a con_down_array + con_down_array=( + 'id:deactivate connection specified by id' + 'uuid:deactivate connection specified by uuid' + ) + _describe 'deactivate connection by id or uuid' con_down_array +} + +(( $+functions[_nmcli_con_delete] )) || _nmcli_con_delete() { + local -a con_delete_array + con_delete_array=( + 'id:delete connection specified by id' + 'uuid:delete connection specified by uuid' + ) + _describe 'delete connection by id or uuid' con_delete_array +} + +(( $+functions[_nmcli_con_up_extraargs] )) || _nmcli_con_up_extraargs() { + local -a con_up_extraargs_array + con_up_extraargs_array=( + 'iface:require a particular interface' + 'ap:require a specific access point' + '--nowait:don''t wait for command completion' + '--timeout:specify how long to wait for operation to complete' + ) + _describe 'extra options for "con up"' con_up_extraargs_array +} + +(( $+functions[_nmcli_dev_disconnect_extraargs] )) || _nmcli_dev_disconnect_extraargs() { + local -a dev_disconnect_extraargs_array + dev_disconnect_extraargs_array=( + '--nowait:don''t wait for command completion' + '--timeout:specify how long to wait for operation to complete' + ) + _describe 'extra options for "dev disconnect"' dev_disconnect_extraargs_array +} + +(( $+functions[_nmcli_dev_wifi_list] )) || _nmcli_dev_wifi_list() { + local -a dev_wifi_list_array + dev_wifi_list_array=( + 'iface:list APs for a particular interface' + ) + if [[ $_nmcli_version == 0.8* || $_nmcli_version == 0.9.0* ]]; then + dev_wifi_list_array[2] = 'hwaddr:list a specific AP by MAC address' + elif [[ $_nmcli_version == 0.9.[1-9]* ]]; then + dev_wifi_list_array[2] = 'bssid:list a specific AP by BSSID' + fi + _describe 'options for specifying the AP to list' dev_wifi_list_array +} + +(( $+functions[_nmcli_dev] )) || _nmcli_dev() { + local -a dev_array + dev_array=( + 'status:print status of devices' + 'list:get detailed information about devices' + 'disconnect:disconnect device and prevent it from automatically activating' + 'wifi:list available WiFi access points' + ) + _describe "get information about devices" dev_array +} + +(( $+functions[_nmcli_truefalse] )) || _nmcli_truefalse() { + _wanted boolean expl 'use true/false to modify (nothing = query status)' compadd true false +} + +(( $+functions[_nmcli_onoff] )) || _nmcli_onoff() { + _wanted onoff expl 'use on/off to modify (nothing = query status)' compadd on off +} + +local w1="${words[$#words - 1]}" +local w2="${words[$#words - 2]}" +local w3="${words[$#words - 3]}" +local w4="${words[$#words - 4]}" + +if [[ $w2 == nm && $w1 == (sleep|enable) ]]; then + _nmcli_truefalse && return +elif [[ $w2 == nm && $w1 == (wifi|wwan) ]]; then + _nmcli_onoff && return +elif [[ $w1 == nm ]]; then + _nmcli_nm && return +elif [[ $w3 == con && $w2 == list && $w1 == id ]]; then + _nmcli_con_ids && return +elif [[ $w3 == con && $w2 == list && $w1 == uuid ]]; then + _nmcli_con_uuids && return +elif [[ $w2 == con && $w1 == list ]]; then + _nmcli_con_list && return +elif [[ $w3 == con && $w2 == (up|down) && $w1 == id ]]; then + _nmcli_con_ids && return +elif [[ $_nmcli_version == 0.9.[1-9]* && $w3 == con && $w2 == delete && $w1 == id ]]; then + _nmcli_con_ids && return +elif [[ $w3 == con && $w2 == (up|down) && $w1 == uuid ]]; then + _nmcli_con_uuids && return +elif [[ $_nmcli_version == 0.9.[1-9]* && $w3 == con && $w2 == delete && $w1 == uuid ]]; then + _nmcli_con_uuids && return +elif [[ ${(pj:\0:)words} == *$'\0con\0up\0'(id|uuid)$'\0'* ]]; then + if [[ $w1 == iface ]]; then + _net_interfaces && return + elif [[ $w1 == ap ]]; then + _message -e descriptions 'enter MAC address' && return + elif [[ $w1 == --timeout ]]; then + _message -e descriptions 'enter timeout' && return + else + _nmcli_con_up_extraargs && return + fi +elif [[ $w2 == con && $w1 == up ]]; then + _nmcli_con_up && return +elif [[ $w2 == con && $w1 == down ]]; then + _nmcli_con_down && return +elif [[ $_nmcli_version == 0.9.[1-9]* && $w2 == con && $w1 == delete ]]; then + _nmcli_con_delete && return +elif [[ $w1 == con ]]; then + _nmcli_con && return +elif [[ $w3 == dev && $w2 == (list|disconnect) && $w1 == iface ]]; then + _net_interfaces && return +elif [[ ${(pj:\0:)words} == *$'\0dev\0disconnect\0iface\0'* ]]; then + if [[ $w1 == --timeout ]]; then + _message -e descriptions 'enter timeout' && return + else + _nmcli_dev_disconnect_extraargs && return + fi +elif [[ $w2 == dev && $w1 == list ]]; then + compadd iface && return +elif [[ $w2 == dev && $w1 == disconnect ]]; then + compadd iface && return +elif [[ $w4 == dev && $w3 == wifi && $w2 == list && $w1 == iface ]]; then + _net_interfaces && return +elif [[ $w4 == dev && $w3 == wifi && $w2 == list && $w1 == hwaddr ]]; then + _message -e descriptions 'enter MAC address' && return +elif [[ $w3 == dev && $w2 == wifi && $w1 == list ]]; then + _nmcli_dev_wifi_list && return +elif [[ $w2 == dev && $w1 == wifi ]]; then + compadd list && return +elif [[ $w1 == dev ]]; then + _nmcli_dev && return +else + _arguments \ + {'(--terse)-t','(-t)--terse'}'[terse output]' \ + {'(--pretty)-p','(-p)--pretty'}'[pretty output]' \ + {'(--mode)-m','(-m)--mode'}'[output mode]:output mode:(tabular multiline)' \ + {'(--fields)-f','(-f)--fields'}'[specify fields to output]: :->fields' \ + {'(--escape)-e','(-e)--escape'}'[escape columns separators in values]:escape columns separators in values:(yes no)' \ + {'(--version)-v','(-v)--version'}'[show program version]' \ + {'(--help)-h','(-h)--help'}'[print this help]' \ + '*::nmcli object:_nmcli_objects' \ + && return +fi + +[[ "$state" == "fields" ]] && + _values -s , 'fields to be printed' \ + all common \ + autoconnect dbus-path device name net-enabled readonly running \ + scope state timestamp timestamp-real type uuid wifi wifi-hardware \ + wwan wwan-hardware \ + && return diff --git a/Completion/Unix/Command/_ffmpeg b/Completion/Unix/Command/_ffmpeg index 8f9b2c9cb..6a4ba234d 100644 --- a/Completion/Unix/Command/_ffmpeg +++ b/Completion/Unix/Command/_ffmpeg @@ -21,6 +21,12 @@ typeset -A opt_args _wanted ffmpeg-video-codecs expl 'force video codec (''copy'' to copy stream)' compadd -a vcodecs } +(( $+functions[_ffmpeg_scodecs] )) || _ffmpeg_scodecs() { + local scodecs + scodecs=(copy ${${(M)${(f)"$(_call_program video-codecs $words[1] -codecs 2>/dev/null)"}:#[[:space:]][D[:space:]][E[:space:]]S[S[:space:]][D[:space:]][T[:space:]][[:space:]][^[:space:]]##*}//(#b)????????([^[:space:]]##)*/$match[1]}) + _wanted ffmpeg-video-codecs expl 'force video codec (''copy'' to copy stream)' compadd -a scodecs +} + (( $+functions[_ffmpeg_formats] )) || _ffmpeg_formats() { local formats formats=(${(ou)${=${(s:,:)${${(M)${(f)"$(_call_program formats $words[1] -formats 2>/dev/null)"}:#[[:space:]][D[:space:]][E[:space:]][[:space:]][^[:space:]]##*}//(#b)????([^[:space:]]##)*/$match[1]}}}}) @@ -84,6 +90,7 @@ typeset -A _ffmpeg_flags lastopt+=":$lastopt_description:" if (( $#lastopt_values )); then if [[ $lastopt_type == flags ]]; then + lastopt="*$lastopt" flagtype=${${lastopt%%:*}#-} lastopt+="->$flagtype" _ffmpeg_flags[$flagtype]="${lastopt_values[*]}" @@ -125,6 +132,7 @@ local -a _ffmpeg_argspecs lastopt+=":$lastopt_description:_files" elif [[ $lastopt == -[asv]pre ]]; then lastopt_takesargs=0 + lastopt="*$lastopt" lastopt+=": :_ffmpeg_presets" elif [[ $lastopt == -acodec ]]; then lastopt_takesargs=0 @@ -132,11 +140,16 @@ local -a _ffmpeg_argspecs elif [[ $lastopt == -vcodec ]]; then lastopt_takesargs=0 lastopt+=": :_ffmpeg_vcodecs" + elif [[ $lastopt == -scodec ]]; then + lastopt_takesargs=0 + lastopt+=": :_ffmpeg_scodecs" elif [[ $lastopt == -f ]]; then lastopt_takesargs=0 + lastopt="*$lastopt" lastopt+=": :_ffmpeg_formats" elif [[ $lastopt == -pix_fmt ]]; then lastopt_takesargs=0 + lastopt="*$lastopt" lastopt+=": :_ffmpeg_pix_fmts" elif [[ $example == bitstream_filter ]]; then lastopt_takesargs=0 -- cgit v1.2.3 From c6722cf086b09ed63d1441986d0c7774a9280861 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 14 Nov 2011 09:51:06 +0000 Subject: g1242: printing completion improvements --- ChangeLog | 7 ++- Completion/Unix/Command/_lp | 113 ++++++++++++++++++++++++++++++++------------ 2 files changed, 88 insertions(+), 32 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 70e82baa4..0182247df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-11-14 Peter Stephenson + + * gi1242: users/16578: Completion/Unix/Command/_lp: lpadmin, + lpinfo and other changes. + 2011-11-09 Frank Terbeck * Akinori MUSHA: 29900: @@ -15565,5 +15570,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5497 $ +* $Revision: 1.5498 $ ***************************************************** diff --git a/Completion/Unix/Command/_lp b/Completion/Unix/Command/_lp index def9aed87..f05fded42 100644 --- a/Completion/Unix/Command/_lp +++ b/Completion/Unix/Command/_lp @@ -1,9 +1,9 @@ -#compdef lp lpr lpq lprm lpoptions lpstat +#compdef lp lpr lpq lprm lpoptions lpstat lpinfo lpadmin _lp_get_printer() { - # No reason to call _lp_get_printer when service == lpstat. Others matched - # below. + # No reason to call _lp_get_printer when service == lpstat or lpinfo. Others + # matched below. case $service in (lpr|lpq|lprm) [[ "$words" == (#I)*-P* ]] && printer="${${words##*(#I)-P( |)}%% *}" @@ -11,6 +11,9 @@ _lp_get_printer() (lp) [[ "$words" == (#I)*-d* ]] && printer="${${words##*(#I)-d( |)}%% *}" ;; + (lpadmin) + [[ "$words" == (#I)*-p* ]] && printer="${${words##*(#I)-p( |)}%% *}" + ;; (lpoptions) [[ "$words" == (#I)*-(d|p)* ]] && \ printer="${${words##*(#I)-(d|p)( |)}%% *}" @@ -29,6 +32,13 @@ _lp_job_options() lopts_no_args=(fitplot landscape) + if [[ $service == 'lpadmin' ]]; then + # Extra options from lpadmin man page. + lopts_with_args+=(cupsIPPSupplies cupsSNMPSupplies job-k-limit + job-page-limit job-quota-period job-sheets-default name name-default + port-monitor printer-error-policy printer-is-shared printer-op-policy) + fi + _lp_get_printer [[ -n "$printer" ]] && printer=(-p $printer) @@ -53,6 +63,12 @@ _lp_job_options() (scaling|cpi|lpi|page-(bottom|left|right|top)) return 0; # Don't complete anything ;; + (cupsIPPSupplies|cupsSNMPSupplies|printer-is-shared) + compadd "$@" true false + ;; + (printer-error-policy) + compadd "$@" abort-job retry-job retry-current-job stop-printer + ;; (*) compadd "$@" \ $(_call_program list-printer-options lpoptions $printer -l | \ @@ -133,7 +149,7 @@ _lp() case $service in (lpq) _arguments \ - '-E[force encryption]' \ + '-E[Force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ '(-a)-P+[destination printer]:printers:_printers' \ @@ -144,7 +160,7 @@ _lp() (lprm) _arguments \ - '-E[force encryption]' \ + '-E[Force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ '-P+[destination printer]:printers:_printers' \ @@ -153,74 +169,109 @@ _lp() (lpoptions) _arguments \ - '-E[force encryption]' \ + '-E[Force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ - '(-p -l -r -x)-d[set default printer]:printers:_printers' \ + '(-p -l -r -x)-d+[set default printer]:printers:_printers' \ '(-l -x)*-o:job options:_lp_job_options' \ - '(-d -x)-p[destination printer for options]:printers:_printers' \ + '(-d -x)-p+[destination printer for options]:printers:_printers' \ '(-d -o -r -x)-l[list options]' \ '(-d -l -x)*-r:remove option:_lp_job_options' \ - '(-d -l -r -o)-x[remove all options]:printers:_printers' + '(-d -l -r -o)-x+[remove all options]:printers:_printers' ;; (lpstat) _arguments \ - '-E[force encryption]' \ - '-R[shows print job ranking]' \ + '-E[Force encryption]' \ + '-R[Shows print job ranking]' \ '-U:username (for connection to server):_users' \ '-W:which jobs:(completed not-completed)' \ - '-a[show accepting state]:printers:_printers' \ + '-a+[Show accepting state]:printers:_printers' \ '-c:printer classes:' \ - '-d[show current default destination]' \ + '-d[Show current default destination]' \ '-h:hostname (alternate server):_hosts' \ '-l[long listing]' \ - '-o[destinations]:printers:_printers' \ - '-p:printers:_printers' \ + '-o+[destinations]:printers:_printers' \ + '-p+:printers:_printers' \ '-r[CUPS server running status]' \ - '-s[status summary]' \ - '-t[all status info]' \ + '-s[Status summary]' \ + '-t[All status info]' \ '-u[list jobs by users]:users:_users' \ - '-v[show devices]:printers:_printers' + '-v+[show devices]:printers:_printers' ;; (lpr) _arguments \ - '-E[force encryption]' \ + '-E[Force encryption]' \ '-H:hostname (alternate server):_hosts' \ '(-C -J -T)'-{C,J,T}':job name:' \ '-P+[destination printer]:printers:_printers' \ '-U:username (for connection to server):_users' \ - '-#[copies]:copies (1--100):' \ - '-h[disables banner printing]' \ + '-#[Copies]:copies (1--100):' \ + '-h[Disables banner printing]' \ '-l[raw file]' \ - '-m[send an email on job completion]' \ + '-m[Send an email on job completion]' \ '*-o:print job options:_lp_job_options' \ '-p[format with shaded header incl. date, time etc.]' \ - '-q[hold job for printing]' \ + '-q[Hold job for printing.]' \ '-r[delete files after printing]' \ '*:PS/PDF files:_pspdf' ;; (lp) _arguments \ - '-E[force encryption]' \ + '-E[Force encryption]' \ '-U[username (for connection to server)]:username:_users' \ '-c[(OBSOLETE) copy to spool dir before printing]' \ - '-d[destination printer]:printers:_printers' \ + '-d+[destination printer]:printers:_printers' \ '-h:hostname (alternate server):_hosts' \ '-i[job id to modify]:job id:' \ - '-m[send an email on job completion]' \ - '-n[copies]:copies (1--100):' \ + '-m[Send an email on job completion]' \ + '-n[Copies]:copies (1--100):' \ '*-o:print job options:_lp_job_options' \ - '-q[job priority -- 1 (lowest) to 100 (highest)]:priority:' \ - '-s[dont report resulting job IDs]' \ - '-t[sets the job name]:job name:' \ + '-q[Job priority -- 1 (lowest) to 100 (highest)]:priority:' \ + '-s[Dont report resulting job IDs]' \ + '-t[Sets the job name]:job name:' \ '-u[job submission username]:username:_users' \ - '-H[time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \ + '-H[Time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \ '-P:page range list:' \ '*:PS/PDF files:_pspdf' ;; + + (lpinfo) + _arguments \ + '-E[Force encryption]' \ + '-U[username (for connection to server)]:username:_users' \ + '-h:hostname (alternate server):_hosts' \ + '-l[Shows a "long" listing of devices or drivers]' \ + {--exclude-schemes,--include-schemes}'[device/PPD schemes to filter from results]:scheme-list:' \ + '(-v --timeout)--device-id[IEEE-1284 device ID to match]:device-id-string:' \ + '(-v --timeout)--language:locale:' \ + '(-v --timeout)--product[product to match]:name:' \ + '(-v --timeout)--make-and-model[make and model to match]:name:' \ + '(-v --timeout)-m[list available drivers]' \ + '(-m --device-id --language --make-and-model --product)--timeout[timeout when listing devices with -v]:timeout (seconds):' \ + '(-m --device-id --language --make-and-model --product)-v[list available devices]' + ;; + + (lpadmin) + _arguments \ + '-E[Force encryption/Enable destination]' \ + '-U[username (for connection to server)]:username:_users' \ + '-h:hostname (alternate server):_hosts' \ + '(-p -R -x -o)-d+[default printer]:printers:_printers' \ + '(-d -x)-p+[configure printer]:printers:_printers' \ + '(-p -R -d -o)-x+[delete printer]:printers:_printers' \ + '(-x -d)-R[name-default]:name-default:' \ + '-c:printer classes:' \ + '-m:model:' \ + '(-x -d)*-o:options:_lp_job_options' \ + '-r[remove from class]:class:' \ + '-u[access policy]:access policy:' \ + '-v[device-uri of printer queue]:device-uri:' \ + '-D[Text description of destination]:info:' \ + '-L[Location of the printer]:location:' \ + '-P[PPD file to use]:PPD file:_files "*.(#i)ppd(-.)"' esac } -- cgit v1.2.3 From 5d1b11027bd3827e04a87d6846278be9b80bc8e8 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 20 Nov 2011 21:47:10 +0000 Subject: gi1242: users/16587: _lp tidy up --- ChangeLog | 6 +++- Completion/Unix/Command/_lp | 70 ++++++++++++++++++++++----------------------- 2 files changed, 40 insertions(+), 36 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index b72cb695c..75f4816aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-11-20 Peter Stephenson + + * gi1242+zsh: users/16587: Completion/Unix/Command_lp: tidy up. + 2011-11-18 Peter Stephenson * 29908: Doc/Zsh/contrib.yo, Functions/MIME/.distfiles, @@ -15589,5 +15593,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5501 $ +* $Revision: 1.5502 $ ***************************************************** diff --git a/Completion/Unix/Command/_lp b/Completion/Unix/Command/_lp index f05fded42..e0654e711 100644 --- a/Completion/Unix/Command/_lp +++ b/Completion/Unix/Command/_lp @@ -152,9 +152,9 @@ _lp() '-E[Force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ - '(-a)-P+[destination printer]:printers:_printers' \ - '(-P)-a[all printers]' \ - '-l[long listing]' \ + '(-a)-P+[Destination printer]:printers:_printers' \ + '(-P)-a[All printers]' \ + '-l[Long listing]' \ '*:poll interval (+seconds):' ;; @@ -163,7 +163,7 @@ _lp() '-E[Force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ - '-P+[destination printer]:printers:_printers' \ + '-P+[Destination printer]:printers:_printers' \ '*:job ids:_lp_list_jobs' ;; @@ -172,12 +172,12 @@ _lp() '-E[Force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ - '(-p -l -r -x)-d+[set default printer]:printers:_printers' \ + '(-p -l -r -x)-d+[Set default printer]:printers:_printers' \ '(-l -x)*-o:job options:_lp_job_options' \ - '(-d -x)-p+[destination printer for options]:printers:_printers' \ - '(-d -o -r -x)-l[list options]' \ + '(-d -x)-p+[Destination printer for options]:printers:_printers' \ + '(-d -o -r -x)-l[List options]' \ '(-d -l -x)*-r:remove option:_lp_job_options' \ - '(-d -l -r -o)-x+[remove all options]:printers:_printers' + '(-d -l -r -o)-x+[Remove all options]:printers:_printers' ;; (lpstat) @@ -190,14 +190,14 @@ _lp() '-c:printer classes:' \ '-d[Show current default destination]' \ '-h:hostname (alternate server):_hosts' \ - '-l[long listing]' \ - '-o+[destinations]:printers:_printers' \ + '-l[Long listing]' \ + '-o+[Destinations]:printers:_printers' \ '-p+:printers:_printers' \ '-r[CUPS server running status]' \ '-s[Status summary]' \ '-t[All status info]' \ - '-u[list jobs by users]:users:_users' \ - '-v+[show devices]:printers:_printers' + '-u[List jobs by users]:users:_users' \ + '-v+[Show devices]:printers:_printers' ;; (lpr) @@ -205,34 +205,34 @@ _lp() '-E[Force encryption]' \ '-H:hostname (alternate server):_hosts' \ '(-C -J -T)'-{C,J,T}':job name:' \ - '-P+[destination printer]:printers:_printers' \ + '-P+[Destination printer]:printers:_printers' \ '-U:username (for connection to server):_users' \ '-#[Copies]:copies (1--100):' \ '-h[Disables banner printing]' \ - '-l[raw file]' \ + '-l[Raw file]' \ '-m[Send an email on job completion]' \ '*-o:print job options:_lp_job_options' \ - '-p[format with shaded header incl. date, time etc.]' \ + '-p[Format with shaded header incl. date, time etc.]' \ '-q[Hold job for printing.]' \ - '-r[delete files after printing]' \ + '-r[Delete files after printing]' \ '*:PS/PDF files:_pspdf' ;; (lp) _arguments \ '-E[Force encryption]' \ - '-U[username (for connection to server)]:username:_users' \ + '-U[Username (for connection to server)]:username:_users' \ '-c[(OBSOLETE) copy to spool dir before printing]' \ - '-d+[destination printer]:printers:_printers' \ + '-d+[Destination printer]:printers:_printers' \ '-h:hostname (alternate server):_hosts' \ - '-i[job id to modify]:job id:' \ + '-i[Job id to modify]:job id:' \ '-m[Send an email on job completion]' \ '-n[Copies]:copies (1--100):' \ '*-o:print job options:_lp_job_options' \ '-q[Job priority -- 1 (lowest) to 100 (highest)]:priority:' \ '-s[Dont report resulting job IDs]' \ '-t[Sets the job name]:job name:' \ - '-u[job submission username]:username:_users' \ + '-u[Job submission username]:username:_users' \ '-H[Time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \ '-P:page range list:' \ '*:PS/PDF files:_pspdf' @@ -241,34 +241,34 @@ _lp() (lpinfo) _arguments \ '-E[Force encryption]' \ - '-U[username (for connection to server)]:username:_users' \ + '-U[Username (for connection to server)]:username:_users' \ '-h:hostname (alternate server):_hosts' \ '-l[Shows a "long" listing of devices or drivers]' \ - {--exclude-schemes,--include-schemes}'[device/PPD schemes to filter from results]:scheme-list:' \ + {--exclude-schemes,--include-schemes}'[Device/PPD schemes to filter from results]:scheme-list:' \ '(-v --timeout)--device-id[IEEE-1284 device ID to match]:device-id-string:' \ '(-v --timeout)--language:locale:' \ - '(-v --timeout)--product[product to match]:name:' \ - '(-v --timeout)--make-and-model[make and model to match]:name:' \ - '(-v --timeout)-m[list available drivers]' \ - '(-m --device-id --language --make-and-model --product)--timeout[timeout when listing devices with -v]:timeout (seconds):' \ - '(-m --device-id --language --make-and-model --product)-v[list available devices]' + '(-v --timeout)--product[Product to match]:name:' \ + '(-v --timeout)--make-and-model[Make and model to match]:name:' \ + '(-v --timeout)-m[List available drivers]' \ + '(-m --device-id --language --make-and-model --product)--timeout[Timeout when listing devices with -v]:timeout (seconds):' \ + '(-m --device-id --language --make-and-model --product)-v[List available devices]' ;; (lpadmin) _arguments \ '-E[Force encryption/Enable destination]' \ - '-U[username (for connection to server)]:username:_users' \ + '-U[Username (for connection to server)]:username:_users' \ '-h:hostname (alternate server):_hosts' \ - '(-p -R -x -o)-d+[default printer]:printers:_printers' \ - '(-d -x)-p+[configure printer]:printers:_printers' \ - '(-p -R -d -o)-x+[delete printer]:printers:_printers' \ - '(-x -d)-R[name-default]:name-default:' \ + '(-p -R -x -o)-d+[Default printer]:printers:_printers' \ + '(-d -x)-p+[Configure printer]:printers:_printers' \ + '(-p -R -d -o)-x+[Delete printer]:printers:_printers' \ + '(-x -d)-R[Name-default]:name-default:' \ '-c:printer classes:' \ '-m:model:' \ '(-x -d)*-o:options:_lp_job_options' \ - '-r[remove from class]:class:' \ - '-u[access policy]:access policy:' \ - '-v[device-uri of printer queue]:device-uri:' \ + '-r[Remove from class]:class:' \ + '-u[Access policy]:access policy:' \ + '-v[Device-uri of printer queue]:device-uri:' \ '-D[Text description of destination]:info:' \ '-L[Location of the printer]:location:' \ '-P[PPD file to use]:PPD file:_files "*.(#i)ppd(-.)"' -- cgit v1.2.3 From 7d04b8f4869c008c37a56b701445a9e634165e0c Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 21 Nov 2011 11:31:24 +0000 Subject: Foudil Brétel: 29911: systemctl completion updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 8 +++- Completion/Unix/Command/_systemctl | 76 ++++++++++++++++++++++---------------- 2 files changed, 52 insertions(+), 32 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 75f4816aa..42cadaa80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-11-21 Peter Stephenson + + * Foudil Brétel: 29911: add --no-legend support (v37+); multiple + bug fixes (aliases, array range); workaround compadd bug + (compadd handles its own options) + 2011-11-20 Peter Stephenson * gi1242+zsh: users/16587: Completion/Unix/Command_lp: tidy up. @@ -15593,5 +15599,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5502 $ +* $Revision: 1.5503 $ ***************************************************** diff --git a/Completion/Unix/Command/_systemctl b/Completion/Unix/Command/_systemctl index 801a8e060..69adcf775 100644 --- a/Completion/Unix/Command/_systemctl +++ b/Completion/Unix/Command/_systemctl @@ -33,6 +33,7 @@ _systemctl() '--no-block[Do not wait until operation finished]' \ "--no-wall[Don't send wall message before halt/power-off/reboot]" \ "--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \ + '--no-legend[Do not print a legend, i.e. the column headers and the footer with hints]' \ '--no-pager[Do not pipe output into a pager]' \ '--no-ask-password[Do not ask for system passwords]' \ '--order[When generating graph for dot, show only order]' \ @@ -61,8 +62,10 @@ _hosts_or_user_at_host() "stop:Stop (deactivate) one or more units" "reload:Reload one or more units" "restart:Start or restart one or more units" + "condrestart:Restart one or more units if active" "try-restart:Restart one or more units if active" "reload-or-restart:Reload one or more units is possible, otherwise start or restart" + "force-reload:Reload one or more units is possible, otherwise restart if active" "reload-or-try-restart:Reload one or more units is possible, otherwise restart if active" "isolate:Start one unit and stop all others" "kill:Send signal to processes of a unit" @@ -125,34 +128,42 @@ _hosts_or_user_at_host() fi } +__check_option_nolegend() +{ + systemctl --no-legend --version 2>&1 | grep -q 'unrecognized option' + print -Pn '%(?..--no-legend)' +} +nolegend=$(__check_option_nolegend) + + # Fills the unit lists _systemctl_all_units() { if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) && ! _retrieve_cache SYS_ALL_UNITS; then - _sys_all_units=( $(systemctl list-units --full --all | cut -d' ' -f1 \ - 2>/dev/null) ) + _sys_all_units=( $(systemctl ${nolegend} list-units --full --all \ + | cut -d' ' -f1 2>/dev/null) ) _store_cache SYS_ALL_UNITS _sys_all_units fi } _systemctl_inactive_units() { - _sys_inactive_units=( $(systemctl list-units --full --all \ - | awk '$3 != "active" {print $1}' 2>/dev/null) ) + _sys_inactive_units=( $(systemctl ${nolegend} list-units --full --all \ + | awk '$3 != "active" {print $1}' 2>/dev/null) ) } _systemctl_active_units() { - _sys_active_units=( $(systemctl list-units --full | cut -d' ' -f1 \ - 2>/dev/null) ) + _sys_active_units=( $(systemctl ${nolegend} list-units --full \ + | cut -d' ' -f1 2>/dev/null) ) } _systemctl_failed_units() { - _sys_failed_units=( $(systemctl list-units --full --failed | cut -d' ' -f1 - 2>/dev/null) ) + _sys_failed_units=( $(systemctl ${nolegend} list-units --full --failed \ + | cut -d' ' -f1 2>/dev/null) ) } _filter_units_by_property () { @@ -160,7 +171,7 @@ _filter_units_by_property () { local -a units ; units=($*) local -a props ; props=( $(systemctl show --property "$property" -- \ ${units[*]} | grep -v '^$') ) - for ((i=0; $i < ${#units[*]}; i++)); do + for ((i=1; $i <= ${#units[*]}; i++)); do if [[ "${props[i]}" = "$property=$value" ]]; then echo "${units[i]}" fi @@ -172,7 +183,7 @@ for fun in enable disable is-active is-enabled status show ; do (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() { _systemctl_all_units - compadd "$@" -a -- _sys_all_units + compadd "$@" -a - _sys_all_units } done @@ -180,7 +191,7 @@ done (( $+functions[_systemctl_start] )) || _systemctl_start() { _systemctl_inactive_units - compadd "$@" -- $( _filter_units_by_property CanStart yes \ + compadd "$@" - $( _filter_units_by_property CanStart yes \ ${_sys_inactive_units[*]} | grep -Ev '\.(device|snapshot)$' ) } @@ -189,7 +200,7 @@ for fun in restart reload-or-restart ; do (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() { _systemctl_all_units - compadd "$@" -- $( _filter_units_by_property CanStart yes \ + compadd "$@" - $( _filter_units_by_property CanStart yes \ ${_sys_all_units[*]} | grep -Ev '\.(device|snapshot|socket|timer)$' ) } done @@ -199,7 +210,7 @@ for fun in stop kill try-restart condrestart ; do (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() { _systemctl_active_units - compadd "$@" -- $( _filter_units_by_property CanStop yes \ + compadd "$@" - $( _filter_units_by_property CanStop yes \ ${_sys_active_units[*]} ) } done @@ -209,7 +220,7 @@ for fun in reload reload-or-try-restart force-reload ; do (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() { _systemctl_active_units - compadd "$@" -- $( _filter_units_by_property CanReload yes \ + compadd "$@" - $( _filter_units_by_property CanReload yes \ ${_sys_active_units[*]} ) } done @@ -218,7 +229,7 @@ done (( $+functions[_systemctl_isolate] )) || _systemctl_isolate() { _systemctl_all_units - compadd "$@" -- $( _filter_units_by_property AllowIsolate yes \ + compadd "$@" - $( _filter_units_by_property AllowIsolate yes \ ${_sys_all_units[*]} ) } @@ -226,34 +237,37 @@ done (( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed() { _systemctl_failed_units - compadd "$@" -a -- _sys_failed_units || _message "no failed-unit found" + compadd "$@" -a - _sys_failed_units || _message "no failed-unit found" } # Completion functions for JOBS (( $+functions[_systemctl_cancel] )) || _systemctl_cancel() { - compadd "$@" -- $( systemctl list-jobs | cut -d' ' -f1 2>/dev/null ) || \ - _message "no job found" + compadd "$@" - $(systemctl ${nolegend} list-jobs \ + | cut -d' ' -f1 2>/dev/null ) || _message "no job found" } # Completion functions for SNAPSHOTS (( $+functions[_systemctl_delete] )) || _systemctl_delete() { - compadd "$@" -- $( systemctl list-units --type snapshot --full --all \ - | cut -d' ' -f1 2>/dev/null ) || _message "no snampshot found" + compadd "$@" - $(systemctl ${nolegend} list-units --type snapshot --full \ + --all | cut -d' ' -f1 2>/dev/null ) || _message "no snampshot found" } # Completion functions for ENVS -(( $+functions[_systemctl_set-environment] )) || _systemctl_set-environment() -{ - compadd "$@" -S '' -- $( systemctl show-environment \ - | sed 's_\([^=]\+=\).*_\1_' ) -} -(( $+functions[_systemctl_unset-environment] )) || _systemctl_unset-environment() -{ - compadd "$@" -S '' -- $( systemctl show-environment \ - | sed 's_\([^=]\+\)=.*_\1_' ) -} +for fun in set-environment unset-environment ; do + (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() + { + local fun=$0 ; fun=${fun##_systemctl_} + local suf + if [[ "${fun}" = "set-environment" ]]; then + suf='-S=' + fi + + compadd "$@" ${suf} - $(systemctl show-environment \ + | sed 's_\([^=]\+\)=.*_\1_' ) + } +done # no completion for: # [STANDALONE]='daemon-reexec daemon-reload default dot dump emergency exit @@ -270,7 +284,7 @@ _systemctl_caching_policy() oldcache=( "$1"(mh+1) ) (( $#oldcache )) && return 0 - _sysunits=($(systemctl --full --all | cut -d' ' -f1)) + _sysunits=($(systemctl ${nolegend} --full --all | cut -d' ' -f1)) if (( $#_sysunits )); then for unit in $_sysunits; do -- cgit v1.2.3 From b0602dc5b410c97feaba51c6ea3c90322050dc54 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 23 Nov 2011 09:50:56 +0000 Subject: Ignacy Gawędzki: 29912: add "--" to ls in ssh completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 7 ++++++- Completion/Unix/Command/_ssh | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 42cadaa80..e29cd0730 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-11-23 Peter Stephenson + + * Ignacy Gawędzki: 29912: Completion/Unix/Command/_ssh: add "--" + to end options to ls. + 2011-11-21 Peter Stephenson * Foudil Brétel: 29911: add --no-legend support (v37+); multiple @@ -15599,5 +15604,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5503 $ +* $Revision: 1.5504 $ ***************************************************** diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index d0944c656..0ec9c84a0 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -16,7 +16,7 @@ _remote_files () { then rempat="${PREFIX%%[^./][^/]#}\*" else rempat="${(q)PREFIX%%[^./][^/]#}\*" fi - remfiles=(${(M)${(f)"$(_call_program files ssh -o BatchMode=yes $args -a -x ${IPREFIX%:} ls -d1FL "$rempat" 2>/dev/null)"}%%[^/]#(|/)}) + remfiles=(${(M)${(f)"$(_call_program files ssh -o BatchMode=yes $args -a -x ${IPREFIX%:} ls -d1FL -- "$rempat" 2>/dev/null)"}%%[^/]#(|/)}) compset -P '*/' compset -S '/*' || suf='remote file' -- cgit v1.2.3 From d47847c5f5c89f2ce4cfe53857086ce0f0037c8f Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 24 Nov 2011 09:16:40 +0000 Subject: 29915: new nm completion --- ChangeLog | 7 ++++++- Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_nm | 29 +++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 Completion/Unix/Command/_nm (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index e29cd0730..3645503f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-11-24 Peter Stephenson + + * 29915: Completion/Unix/Command/.distfiles, + Completion/Unix/Command/_nm: new nm completion. + 2011-11-23 Peter Stephenson * Ignacy Gawędzki: 29912: Completion/Unix/Command/_ssh: add "--" @@ -15604,5 +15609,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5504 $ +* $Revision: 1.5505 $ ***************************************************** diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 22e0a4fbe..a89b7d923 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -141,6 +141,7 @@ _mysqldiff _ncftp _netcat _nice +_nm _nmap _notmuch _npm diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm new file mode 100644 index 000000000..276a38f19 --- /dev/null +++ b/Completion/Unix/Command/_nm @@ -0,0 +1,29 @@ +#compdef nm + +# This is a stub. It's main reason for existence is to offer +# object files with nm. Feel free to extend it. If you do, remove +# this comment. + +local state context line expl +local -A opt_args +local -a args +integer ret=1 + +if _pick_variant gnu='Free Soft' unix --version; then + args+=(-s --) +fi +args+=('*:file:->file') + +_arguments "$args[@]" && ret=0 + +case $state in + (file) + _alternative \ + "object-files:object file:_path_files -g '*.o'" \ + "executable-files:executable file:_path_files -g '*(*)'" \ + "dynamic-libraries:dynamic library:_path_files -g '*.so'" \ + "static-libraries:static library:_path_files -g '*.a'" && ret=0 + ;; +esac + +return ret -- cgit v1.2.3 From 6540e8d8cffba3e29c0adbdd28240d23eaa09390 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 24 Nov 2011 21:21:46 +0000 Subject: 29916: Completion/Unix/Command/_git: Prevent clash with _remote_files() in _ssh. --- ChangeLog | 7 ++++++- Completion/Unix/Command/_git | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 3645503f5..e21fc7731 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-11-24 Simon Ruderich + + * 29916: Completion/Unix/Command/_git: Prevent clash with + _remote_files() in _ssh. + 2011-11-24 Peter Stephenson * 29915: Completion/Unix/Command/.distfiles, @@ -15609,5 +15614,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5505 $ +* $Revision: 1.5506 $ ***************************************************** diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 6221eb6a4..4a830f281 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5445,7 +5445,7 @@ __git_tree_files () { # Repository Argument Types # _remote_files -_remote_files () { +_remote_files_git () { # FIXME: these should be imported from _ssh # TODO: this should take -/ to only get directories # There should be coloring based on all the different ls -F classifiers. @@ -5484,7 +5484,7 @@ __git_remote_repositories () { service= _ssh if compset -P '*:'; then - _remote_files + _remote_files_git else _ssh_hosts -S: fi -- cgit v1.2.3