Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: assorted completion function updates
- X-seq: zsh-workers 32998
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: assorted completion function updates
- Date: Thu, 14 Aug 2014 00:30:15 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1407969016; bh=xowngdEBNmOjikX3NoTo2mjUr/5v3heFDGWwt+kgFO0=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Subject:MIME-Version:Content-Type:Content-ID:Date:Message-ID; b=g/7lFTHxtIubg5TluJuRgtCcpoJLCQiExJnGcqrycFNQ1Y4Qwz4FaF9u4iefpRg5SjXsrb98P8pcqVXtNzBkbxtW2WHd27rvSlbZCcr0TzN47320S0BK1Nm2WjxwFsfxKUi+ftG8XmA6ZsqvZGHdP3+X+MG1NVluZ090GmqoKec=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This adds a new function for dsh. The mosh and nm functions are not
really patches to the existing functions: I've had them in unfinished
form for some time. nm handles options for GNU and Solaris variants
(FreeBSD uses GNU nm). _rsync and _wget is just updates to the list of
options.
Oliver
diff --git a/Completion/Unix/Command/_dsh b/Completion/Unix/Command/_dsh
new file mode 100644
index 0000000..688e024
--- /dev/null
+++ b/Completion/Unix/Command/_dsh
@@ -0,0 +1,33 @@
+#compdef dsh
+
+local curcontext="$curcontext" state line expl
+typeset -A opt_args
+
+_arguments -s -C -S \
+ '(-v --verbose -q --quiet)'{-v,--verbose}'[verbose output]' \
+ '(-q --quiet -v --verbose)'{-q,--quiet}'[quieter output]' \
+ '(-M --show-machine-names)'{-M,--show-machine-names}'[prepend the host name on output]' \
+ '(-i --duplicate-input)'{-i,--duplicate-input}'[duplicate input given to dsh]' \
+ '(-b --bufsize)'{-b,--bufsize}'[change buffer size used in input duplication]:buffer size for -i (bytes)' \
+ '(-m --machine)'{-m,--machine}'[execute on machine]:machine:{_hosts || _user_at_host}' \
+ '(-n --num-topology)'{-n,--num-topology}'[how to divide the machines]:number' \
+ '(-a --all)'{-a,--all}'[execute on all machines]' \
+ '(-g --group)'{-g,--group}'[execute on group member]:groupname:->groups' \
+ '(-f --file)'{-f,--file}'[use the file as list of machines]:file:_files' \
+ '(-r --remoteshell)'{-r,--remoteshell}'[execute using shell]:remote shell:(rsh ssh)' \
+ '(-o --remoteshellopt)'{-o,--remoteshellopt}'[option to give to remote shell ]:option' \
+ '(-)'{-h,--help}'[display help information]' \
+ '(-w --wait-shell -c --concurrent-shell)'{-w,--wait-shell}'[sequentially execute shell]' \
+ '(-c --concurrent-shell -w --wait-shell)'{-c,--concurrent-shell}'[execute shell concurrently]' \
+ '(-F --forklimit)'{-F,--forklimit}'[concurrent with limit on number]:fork limit' \
+ '(-)'{-V,--version}'[display version information]' \
+ '*::args: _normal' && return
+
+if [[ $state = groups ]]; then
+ if ! zstyle -s ":completion:$curcontext:dsh-groups" dsh-groups grp; then
+ [[ -e ~/.dsh/group ]] && grp="~/.dsh/group" || return 1
+ fi
+ _path_files -W ~/.dsh/group && return
+fi
+
+return 1
diff --git a/Completion/Unix/Command/_mosh b/Completion/Unix/Command/_mosh
index c940f90..dacbd10 100644
--- a/Completion/Unix/Command/_mosh
+++ b/Completion/Unix/Command/_mosh
@@ -1,12 +1,26 @@
#compdef mosh
+local curcontext="$curcontext" state line
+local -a suf
+
_arguments \
- '--client=:client helper:_command_names -e' \
- '--server=:server helper:_files' \
- '--ssh=:ssh command to run:_files' \
- '(-a -n)--predict=:when:(adaptive always never)' \
- '(--predict -n)-a[predict always]' \
- '(--predict -a)-n[predict never]' \
- {-p,--port=}':port:_ports' \
- ':remote:_hosts' \
- ':remote command:_command_names -e'
+ '(-)--help[display help information]' \
+ '(-)--version[display version information]' \
+ "--no-init[don't set terminal init string]" \
+ '--ssh=[specify ssh command to setup session]:ssh command:_normal' \
+ '--port=[specify server-side port range]:port:_sequence -n 2 -s \: _ports' \
+ '(-a -n)--predict=[control speculative local echo]:mode:(adaptive always never)' \
+ '(--predict -n)-a[synonym for --predict=always]' \
+ '(--predict -a)-n[synonym for --predict=never]' \
+ '--server[specify command to run server helper]:remote file:_files' \
+ '--client[specify command to run client helper]:_command_names -e' \
+ '1:remote host name:->userhost' \
+ '*:::args:_normal' && return
+
+case $state in
+ userhost)
+ _hosts || _user_at_host && return
+ ;;
+esac
+
+return 1
diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm
index 3ceb8c9..6c95a0d 100644
--- a/Completion/Unix/Command/_nm
+++ b/Completion/Unix/Command/_nm
@@ -1,30 +1,62 @@
#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 args files
-local state context line expl
-local -A opt_args
-local -a args
-integer ret=1
+_nm_object_file() {
+ [[ -x $REPLY || $REPLY = *.([ao]|so) ]]
+}
-if _pick_variant gnu='Free Soft' unix --version; then
- args+=(-s --)
-fi
-args+=('*:file:->file')
-
-_arguments "$args[@]" && ret=0
+files="*:object file:_path_files -g '*(-.e:_nm_object_file:)'"
+args=(
+ '(-A -o --print-file-name)'{-A,-o,--print-file-name}'[print name of input file on each line]'
+ '(--demangle)-C[decode symbol names]'
+ '(-D --dynamic)'{-D,--dynamic}'[display dynamic symbols instead of normal ones]'
+ '(-g --extern-only)'{-g,--extern-only}'[display only global symbols]'
+ '(-t --radix -o -x)'{-t,--radix}'[specify radix for numeric values]:radix:((d\:decimal o\:octal x\:hexadecimal))'
+)
-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'" \
- "directories:directory:_path_files -g '*(/)'" && ret=0
- ;;
-esac
+if _pick_variant gnu=GNU unix -V; then
+ compset -P '@' && files='*:options file:_files'
+ args+=(
+ '(- *)--help[display help information]'
+ '(- *)--version[display version information]'
+ '(-f --format -P --portability)-B[same as --format=bsd]'
+ '(-C --no-demangle)--demangle=-[decode symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat)'
+ "(-C --demangle)--no-demangle[don't decode symbol names]"
+ '(-u --undefined-only)--defined-only[display only defined symbols]'
+ '(-f --format -P)'{-f+,--format=}'[specify output format]:format:(bsd sysv posix)'
+ '(-l --line-numbers)'{-l,--line-numbers}'[display source file and line numbers from debug information]'
+ '(-n --numeric-sort -p --no-sort --size-sort)'{-n,--numeric-sort}'[sort symbols numerically by address]'
+ '(-p --no-sort -n --numeric-sort -r -P --reverse-sort --size-sort)'{-p,--no-sort}'[do not sort symbols]'
+ '(-P --portability -B -f --format)'{-P,--portability}'[same as --format=posix]'
+ '(-r --reverse-sort -p --no-sort --size-sort)'{-r,--reverse-sort}'[reverse sort order]'
+ '--plugin[load specified plugin]:plugin'
+ '(-u --undefined-only --defined-only)'{-u,--undefined-only}'[display only undefined symbols]'
+ "--target=[target object format]:targets:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })"
+ '(-a --debug-syms)'{-a,--debug-syms}'[display debugger-only symbols]'
+ '(-S --print-size)'{-S,--print-size}'[print size of defined symbols]'
+ '(-s --print-armap)'{-s,--print-armap}'[include index for symbols from archive members]'
+ '(-p --no-sort -n --numeric-sort -r)--size-sort[sort symbols by size]'
+ '--special-syms[include special symbols in the output]'
+ '--synthetic[display synthetic symbols as well]'
+ )
+else
+ # following flags are accurate for Solaris
+ args=( ${args:#(|*\)(\*|))-[o-]*}
+ "-h[don't display column headers]"
+ '-l[distinguish WEAK symbols with * character]'
+ '(-t -x)-o[print values in octal]'
+ '(-v)-n[sort symbols by name]'
+ '(-P)-p[produce parsable output]'
+ '(-p)-P[portable output format]'
+ '(-r)-R[print archive name, object file and symbol name]'
+ '-r[prepend name of input file to each symbol name]'
+ '-s[print section name instead of index]'
+ '-u[print undefined symbols only]'
+ '(-n)-v[sort external symbols by value]'
+ '-V[display version of the nm command]'
+ '(-o -t)-x[print values in hexadecimal]'
+ )
+fi
-return ret
+_arguments -s "$args[@]" $files
diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync
index a531d7d..7bad03a 100644
--- a/Completion/Unix/Command/_rsync
+++ b/Completion/Unix/Command/_rsync
@@ -74,7 +74,8 @@ _rsync() {
_arguments -s \
'*'{-v,--verbose}'[increase verbosity]' \
{--no-v,--no-verbose}'[turn off --verbose]' \
- '--bwlimit=[limit I/O bandwidth]:KBytes (etc.) per second' \
+ '--bwlimit=[limit I/O bandwidth]:limit (KiB per second)' \
+ '--outbuf=[set output buffering]:buffering:(none line block)' \
'--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' \
@@ -213,6 +214,7 @@ _rsync() {
'--protocol=[force an older protocol version to be used]:number' \
'--info=[fine-grained informational verbosity]:comma-separated list' \
'--debug=[fine-grained debug verbosity]:comma-separated list' \
+ '--msgs2stderr[special output handling for debugging]' \
'--munge-links[munge symlinks to make them safer, but unusable]' \
'--ignore-missing-args[ignore missing source args without error]' \
'--delete-missing-args[delete missing source args from destination]' \
@@ -222,6 +224,7 @@ _rsync() {
'*'{-M=,--remote-option=}'[send option to the remote side only]:option string' \
'--preallocate[preallocate the full length of new files]' \
'--iconv=[request charset conversion of filenames]:number' \
+ '--checksum-seed=:number' \
'--read-batch=[read a batched update from the specified file]:file:_files'
}
diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget
index f709a08..b8ca2fd 100644
--- a/Completion/Unix/Command/_wget
+++ b/Completion/Unix/Command/_wget
@@ -14,6 +14,7 @@ _arguments -C -s \
'(--quiet -q --verbose -v --no-verbose -nv)'{--quiet,-q}'[turn off output]' \
'(--quiet -q --verbose -v --no-verbose -nv)'{--verbose,-v}'[turn on verbose output]' \
'*-n+[turn off flags]:flags:->noflags' \
+ '--report-speed=:type:(bits)' \
'(--input-file -i)'{--input-file=,-i+}'[specify input file]:file containing URLs:_files' \
'(--force-html -F)'{--force-html,-F}'[treat input file as html]' \
'(--base -B)'{--base=,-B+}'[prepend URL to relative links]:base URL:_urls' \
@@ -47,6 +48,7 @@ _arguments -C -s \
'--prefer-family[connect first to addresses of specified family]:address family:(IPv6 IPv4 none)' \
'(--http-user --ftp-user)--user[set both ftp and http user]:user' \
'(--http-password --ftp-password)--password[set both ftp and http password]:password' \
+ '(--password --http-password --ftp-password)--ask-password:[prompt for passwords]' \
'--no-iri[turn off IRI support]' \
'--local-encoding=[specify local encoding for IRIs]:encoding' \
'--remote-encoding=[specify default remote encoding]:encoding' \
@@ -56,12 +58,13 @@ _arguments -C -s \
'(--directory-prefix -P)'{--directory-prefix=,-P+}'[specify prefix to save files to]:prefix:_files -/' \
'--cut-dirs=:number:' \
'(--user)--http-user=:user' \
- '(--password)--http-password=:password' \
+ '(--password --ask-password)--http-password=:password' \
'--no-cache[disallow server-cached data]' \
'--default-page=[specify default page name, normally index.html]' \
'(--adjust-extension -E)'{--adjust-extension,-E}'[save all HTML/CSS documents with proper extensions]' \
"--ignore-length[ignore \`Content-Length' header field]" \
'*--header=:string' \
+ '--max-redirect=:number' \
'--proxy-user=:user' \
'--proxy-password=:password' \
'--referer=:URL:_urls' \
@@ -74,9 +77,14 @@ _arguments -C -s \
'--keep-session-cookies[load and save session cookies]' \
'--post-data=[use the POST method with specified data]:data to send' \
'--post-file=[use the POST method; sending contents of a file]:file:_files' \
+ '--method=[use specified HTTP method]:method:(GET POST HEAD DELETE)' \
+ '(--body-file)--body-data=[send string as data]:string' \
+ '(--body-data)--body-file=[send contents of file]:file:_files' \
'--content-disposition[honor the Content-Disposition header when choosing local file names]' \
+ '--content-on-error[output received content on server errors]' \
"--auth-no-challenge[send basic HTTP authentication without first waiting for server's challenge]" \
'--secure-protocol=[choose secure protocol]:protocol:(SSLv2 SSLv3 TLSv1)' \
+ --https-only \
"--no-check-certificate=[don't check the server certificate]" \
'--certificate=[specify client certificate]:client certificate file:_files' \
'--certificate-type=[specify client certificate type]:certificate type:(PEM DER)' \
@@ -87,22 +95,27 @@ _arguments -C -s \
'--random-file[specify file with random data for seeding generator]:file:_files' \
'--egd-file=[specify filename of EGD socket]:file:_files' \
'(--user)--ftp-user=:user' \
- '(--password)--ftp-password=:password' \
+ '(--password --ask-password)--ftp-password=:password' \
"--no-remove-listing[don't remove \`.listing' files]" \
'--no-glob[turn off FTP file name globbing]' \
'--no-passive-ftp' \
- '--retr-symlinks' \
'--preserve-permissions[preserve remote file permissions with ftp]' \
+ '--retr-symlinks' \
+ '--warc-file=:file:_files' --warc-header=:string --warc-max-size=:number \
+ --warc-cdx --warc-dedup=:file:_files --no-warc-compression --no-warc-digests \
+ --no-warc-keep-log --warc-tempdir=:directory:_directories \
'(--recursive -r)'{--recursive,-r}'[recurse subdirectories]' \
'(--level -l)'{--level=,-l+}'[specify maximum recursion depth]:level' \
'--delete-after' \
'(--convert-links -k)'{--convert-links,-k}'[convert links to be relative]' \
+ '--backups=:max backups' \
'(--backup-converted -K)'{--backup-converted,-K}'[backup files before conversion]' \
'(--mirror -m -r -N -l)'{--mirror,-m}'[mirror (-r -N -l inf --no-remove-listing)]' \
'(--page-requisites -p)'{--page-requisites,-p}'[get all images needed to display page]' \
'--strict-comments[turn on strict (SGML) handling of HTML comments]' \
'(--accept -A)'{--accept=,-A+}'[specify accepted extensions]:extensions' \
'(--reject -R)'{--reject=,-R+}'[specify rejected extensions]:extensions' \
+ --{accept,reject}-regex=:regex '--regex-type=:regex type:(posix pcre)' \
'(--domains -D)'{--domains=,-D+}'[specify accepted domains]:domains:_domains' \
'--exclude-domains=:rejected domains:_domains' \
'--follow-ftp' \
Messages sorted by:
Reverse Date,
Date,
Thread,
Author