summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1047
-rw-r--r--Completion/BSD/Command/_bsd_pkg250
-rw-r--r--Completion/BSD/Command/_chflags66
-rw-r--r--Completion/BSD/Command/_jail53
-rw-r--r--Completion/BSD/Command/_jexec2
-rw-r--r--Completion/BSD/Command/_pfctl135
-rw-r--r--Completion/BSD/Command/_portsnap2
-rw-r--r--Completion/BSD/Command/_sysrc10
-rw-r--r--Completion/BSD/Type/_fbsd_architectures6
-rw-r--r--Completion/BSD/Type/_file_flags70
-rw-r--r--Completion/BSD/Type/_nbsd_architectures11
-rw-r--r--Completion/BSD/Type/_obsd_architectures6
-rw-r--r--Completion/Base/Completer/_expand3
-rw-r--r--Completion/Base/Utility/_arguments12
-rw-r--r--Completion/Base/Utility/_call_program11
-rw-r--r--Completion/Darwin/Command/_caffeinate12
-rw-r--r--Completion/Darwin/Command/_mdfind29
-rw-r--r--Completion/Darwin/Command/_mdls9
-rw-r--r--Completion/Darwin/Command/_mdutil19
-rw-r--r--Completion/Darwin/Command/_nvram30
-rw-r--r--Completion/Darwin/Command/_osascript34
-rw-r--r--Completion/Darwin/Command/_otool47
-rw-r--r--Completion/Darwin/Command/_pbcopy30
-rw-r--r--Completion/Darwin/Command/_plutil53
-rw-r--r--Completion/Darwin/Command/_say85
-rw-r--r--Completion/Darwin/Command/_scselect39
-rw-r--r--Completion/Darwin/Command/_scutil56
-rw-r--r--Completion/Darwin/Command/_sw_vers6
-rw-r--r--Completion/Debian/Command/_apt29
-rw-r--r--Completion/Debian/Command/_aptitude2
-rw-r--r--Completion/Debian/Command/_deborphan42
-rw-r--r--Completion/Linux/Command/_chattr42
-rw-r--r--Completion/Linux/Command/_chrt99
-rw-r--r--Completion/Linux/Command/_cryptsetup107
-rw-r--r--Completion/Linux/Command/_ethtool446
-rw-r--r--Completion/Linux/Command/_ionice35
-rw-r--r--Completion/Linux/Command/_ipset2
-rw-r--r--Completion/Linux/Command/_losetup65
-rw-r--r--Completion/Linux/Command/_lsattr11
-rw-r--r--Completion/Linux/Command/_lsblk1
-rw-r--r--Completion/Linux/Command/_mii-tool7
-rw-r--r--Completion/Linux/Command/_modutils1
-rw-r--r--Completion/Linux/Command/_networkmanager373
-rw-r--r--Completion/Linux/Command/_nmcli244
-rw-r--r--Completion/Linux/Command/_ss7
-rw-r--r--Completion/Linux/Command/_sshfs5
-rw-r--r--Completion/Linux/Command/_sysstat70
-rw-r--r--Completion/Linux/Command/_tracepath9
-rw-r--r--Completion/Linux/Command/_tune2fs46
-rw-r--r--Completion/Linux/Command/_valgrind4
-rw-r--r--Completion/Linux/Command/_wipefs25
-rw-r--r--Completion/Redhat/Command/_dnf4
-rw-r--r--Completion/Redhat/Command/_rpm2
-rw-r--r--Completion/Redhat/Command/_scl2
-rw-r--r--Completion/Redhat/Command/_yum54
-rw-r--r--Completion/Solaris/Command/_prstat1
-rw-r--r--Completion/Unix/Command/_a2ps2
-rw-r--r--Completion/Unix/Command/_adb94
-rw-r--r--Completion/Unix/Command/_ansible281
-rw-r--r--Completion/Unix/Command/_arp2
-rw-r--r--Completion/Unix/Command/_arping5
-rw-r--r--Completion/Unix/Command/_attr21
-rw-r--r--Completion/Unix/Command/_awk1
-rw-r--r--Completion/Unix/Command/_cat2
-rw-r--r--Completion/Unix/Command/_chmod25
-rw-r--r--Completion/Unix/Command/_chown2
-rw-r--r--Completion/Unix/Command/_cowsay39
-rw-r--r--Completion/Unix/Command/_cp2
-rw-r--r--Completion/Unix/Command/_cut2
-rw-r--r--Completion/Unix/Command/_cvs2
-rw-r--r--Completion/Unix/Command/_dconf71
-rw-r--r--Completion/Unix/Command/_dd2
-rw-r--r--Completion/Unix/Command/_devtodo2
-rw-r--r--Completion/Unix/Command/_df7
-rw-r--r--Completion/Unix/Command/_dhclient4
-rw-r--r--Completion/Unix/Command/_dig11
-rw-r--r--Completion/Unix/Command/_drill46
-rw-r--r--Completion/Unix/Command/_enscript181
-rw-r--r--Completion/Unix/Command/_entr18
-rw-r--r--Completion/Unix/Command/_env5
-rw-r--r--Completion/Unix/Command/_ffmpeg2
-rw-r--r--Completion/Unix/Command/_find2
-rw-r--r--Completion/Unix/Command/_flac120
-rw-r--r--Completion/Unix/Command/_fmt2
-rw-r--r--Completion/Unix/Command/_fold24
-rw-r--r--Completion/Unix/Command/_gcc2
-rw-r--r--Completion/Unix/Command/_gem303
-rw-r--r--Completion/Unix/Command/_getfacl22
-rw-r--r--Completion/Unix/Command/_getopt28
-rw-r--r--Completion/Unix/Command/_git378
-rw-r--r--Completion/Unix/Command/_gnutls310
-rw-r--r--Completion/Unix/Command/_gpg56
-rw-r--r--Completion/Unix/Command/_gsettings5
-rw-r--r--Completion/Unix/Command/_gzip7
-rw-r--r--Completion/Unix/Command/_head2
-rw-r--r--Completion/Unix/Command/_hexdump35
-rw-r--r--Completion/Unix/Command/_id9
-rw-r--r--Completion/Unix/Command/_install111
-rw-r--r--Completion/Unix/Command/_iostat22
-rw-r--r--Completion/Unix/Command/_jq34
-rw-r--r--Completion/Unix/Command/_last42
-rw-r--r--Completion/Unix/Command/_ldconfig81
-rw-r--r--Completion/Unix/Command/_less2
-rw-r--r--Completion/Unix/Command/_ln54
-rw-r--r--Completion/Unix/Command/_ls3
-rw-r--r--Completion/Unix/Command/_lsof50
-rw-r--r--Completion/Unix/Command/_make30
-rw-r--r--Completion/Unix/Command/_metaflac54
-rw-r--r--Completion/Unix/Command/_mkdir41
-rw-r--r--Completion/Unix/Command/_mktemp43
-rw-r--r--Completion/Unix/Command/_mosh23
-rw-r--r--Completion/Unix/Command/_mpc1
-rw-r--r--Completion/Unix/Command/_mtr78
-rw-r--r--Completion/Unix/Command/_mv42
-rw-r--r--Completion/Unix/Command/_netcat9
-rw-r--r--Completion/Unix/Command/_notmuch8
-rw-r--r--Completion/Unix/Command/_numfmt24
-rw-r--r--Completion/Unix/Command/_objdump176
-rw-r--r--Completion/Unix/Command/_od2
-rw-r--r--Completion/Unix/Command/_paste2
-rw-r--r--Completion/Unix/Command/_ping271
-rw-r--r--Completion/Unix/Command/_printenv2
-rw-r--r--Completion/Unix/Command/_prove1
-rw-r--r--Completion/Unix/Command/_ps100
-rw-r--r--Completion/Unix/Command/_pwgen19
-rw-r--r--Completion/Unix/Command/_readelf4
-rw-r--r--Completion/Unix/Command/_rm10
-rw-r--r--Completion/Unix/Command/_rsync9
-rw-r--r--Completion/Unix/Command/_ruby5
-rw-r--r--Completion/Unix/Command/_screen14
-rw-r--r--Completion/Unix/Command/_seq28
-rw-r--r--Completion/Unix/Command/_setfacl4
-rw-r--r--Completion/Unix/Command/_shutdown61
-rw-r--r--Completion/Unix/Command/_smartmontools61
-rw-r--r--Completion/Unix/Command/_sort2
-rw-r--r--Completion/Unix/Command/_split64
-rw-r--r--Completion/Unix/Command/_sqlite5
-rw-r--r--Completion/Unix/Command/_ssh249
-rw-r--r--Completion/Unix/Command/_stdbuf30
-rw-r--r--Completion/Unix/Command/_strings73
-rw-r--r--Completion/Unix/Command/_strip9
-rw-r--r--Completion/Unix/Command/_stty2
-rw-r--r--Completion/Unix/Command/_subversion58
-rw-r--r--Completion/Unix/Command/_sudo3
-rw-r--r--Completion/Unix/Command/_tail4
-rw-r--r--Completion/Unix/Command/_tar10
-rw-r--r--Completion/Unix/Command/_texinfo35
-rw-r--r--Completion/Unix/Command/_tidy138
-rw-r--r--Completion/Unix/Command/_timeout20
-rw-r--r--Completion/Unix/Command/_tmux282
-rw-r--r--Completion/Unix/Command/_todo.sh12
-rw-r--r--Completion/Unix/Command/_tr6
-rw-r--r--Completion/Unix/Command/_tracepath5
-rw-r--r--Completion/Unix/Command/_truss6
-rw-r--r--Completion/Unix/Command/_uname2
-rw-r--r--Completion/Unix/Command/_unexpand43
-rw-r--r--Completion/Unix/Command/_vim7
-rw-r--r--Completion/Unix/Command/_vorbis2
-rw-r--r--Completion/Unix/Command/_wget33
-rw-r--r--Completion/Unix/Command/_whois1
-rw-r--r--Completion/Unix/Command/_xmlstarlet177
-rw-r--r--Completion/Unix/Command/_yp30
-rw-r--r--Completion/Unix/Command/_zfs2
-rw-r--r--Completion/Unix/Type/_bpf_filters2
-rw-r--r--Completion/Unix/Type/_directories2
-rw-r--r--Completion/Unix/Type/_dns_types8
-rw-r--r--Completion/Unix/Type/_file_modes37
-rw-r--r--Completion/Unix/Type/_object_files3
-rw-r--r--Completion/Unix/Type/_ssh_hosts41
-rw-r--r--Completion/Unix/Type/_tilde_files2
-rw-r--r--Completion/X/Command/_evince4
-rw-r--r--Completion/X/Command/_kdeconnect33
-rw-r--r--Completion/X/Command/_sublimetext13
-rw-r--r--Completion/X/Command/_xrandr7
-rw-r--r--Completion/X/Command/_xset2
-rw-r--r--Completion/Zsh/Command/_cd2
-rw-r--r--Completion/Zsh/Command/_stat41
-rw-r--r--Completion/Zsh/Command/_typeset5
-rw-r--r--Completion/Zsh/Command/_zmodload2
-rw-r--r--Completion/Zsh/Command/_zstyle3
-rw-r--r--Completion/Zsh/Context/_brace_parameter10
-rw-r--r--Completion/Zsh/Context/_value2
-rw-r--r--Completion/Zsh/Type/_globquals5
-rw-r--r--Completion/bashcompinit2
-rw-r--r--Completion/compinit4
-rw-r--r--Config/version.mk4
-rw-r--r--Doc/Zsh/builtins.yo24
-rw-r--r--Doc/Zsh/compsys.yo28
-rw-r--r--Doc/Zsh/cond.yo4
-rw-r--r--Doc/Zsh/expn.yo17
-rw-r--r--Doc/Zsh/grammar.yo48
-rw-r--r--Doc/Zsh/invoke.yo14
-rw-r--r--Doc/Zsh/mod_stat.yo2
-rw-r--r--Doc/Zsh/options.yo22
-rw-r--r--Doc/Zsh/params.yo95
-rw-r--r--Etc/FAQ.yo48
-rw-r--r--Functions/Misc/allopt2
-rw-r--r--Functions/Misc/zed3
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_hg4
-rw-r--r--Functions/VCS_Info/VCS_INFO_formats7
-rw-r--r--Functions/VCS_Info/VCS_INFO_set2
-rw-r--r--Functions/Zle/edit-command-line10
-rw-r--r--INSTALL2
-rw-r--r--NEWS19
-rw-r--r--README60
-rw-r--r--Src/Modules/db_gdbm.c2
-rw-r--r--Src/Modules/mapfile.c2
-rw-r--r--Src/Modules/pcre.c35
-rw-r--r--Src/Modules/system.c14
-rw-r--r--Src/Modules/zpty.c7
-rw-r--r--Src/Zle/compctl.c70
-rw-r--r--Src/Zle/complete.c54
-rw-r--r--Src/Zle/complist.c6
-rw-r--r--Src/Zle/computil.c44
-rw-r--r--Src/Zle/textobjects.c7
-rw-r--r--Src/Zle/zle.h2
-rw-r--r--Src/Zle/zle_thingy.c5
-rw-r--r--Src/Zle/zle_tricky.c11
-rw-r--r--Src/Zle/zle_word.c119
-rw-r--r--Src/builtin.c118
-rw-r--r--Src/cond.c20
-rw-r--r--Src/exec.c341
-rw-r--r--Src/glob.c2
-rw-r--r--Src/hashtable.c2
-rw-r--r--Src/hashtable.h1
-rw-r--r--Src/hist.c62
-rw-r--r--Src/init.c132
-rw-r--r--Src/jobs.c47
-rw-r--r--Src/lex.c24
-rw-r--r--Src/loop.c9
-rw-r--r--Src/math.c10
-rw-r--r--Src/mem.c14
-rw-r--r--Src/options.c1
-rw-r--r--Src/params.c264
-rw-r--r--Src/parse.c22
-rw-r--r--Src/prompt.c4
-rw-r--r--Src/subst.c140
-rw-r--r--Src/utils.c108
-rw-r--r--Src/zsh.h63
-rw-r--r--Test/A01grammar.ztst10
-rw-r--r--Test/A02alias.ztst11
-rw-r--r--Test/A04redirect.ztst62
-rw-r--r--Test/B02typeset.ztst98
-rw-r--r--Test/B07emulate.ztst25
-rw-r--r--Test/B10getopts.ztst81
-rw-r--r--Test/C01arith.ztst13
-rw-r--r--Test/C02cond.ztst20
-rw-r--r--Test/C03traps.ztst69
-rw-r--r--Test/C04funcdef.ztst17
-rw-r--r--Test/D04parameter.ztst222
-rw-r--r--Test/E01options.ztst22
-rw-r--r--Test/V10private.ztst2
-rw-r--r--Test/W02jobs.ztst186
-rw-r--r--Test/X02zlevi.ztst29
-rw-r--r--Test/X03zlebindkey.ztst17
-rw-r--r--Test/Y01completion.ztst15
-rw-r--r--Test/Y03arguments.ztst43
-rw-r--r--configure.ac6
258 files changed, 9573 insertions, 2615 deletions
diff --git a/ChangeLog b/ChangeLog
index 906666871..5c34e293e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,1030 @@
+2018-04-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: 5.4.2-test-2.
+
+ * 42581(?): Src/hist.c, Src/lex.c, Test/X03zlebindkey.ztst: history
+ expansion within ZLE needs history to be read to conclusion on
+ error.
+
+2018-03-31 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 42572: Completion/Linux/Command/_ethtool,
+ Completion/Linux/Command/_ss, Completion/Unix/Command/_arping,
+ Completion/Unix/Command/_mosh, Completion/Unix/Command/_notmuch,
+ Completion/Unix/Command/_mpc, Completion/Unix/Command/_objdump,
+ Completion/Unix/Command/_prove, Completion/Unix/Command/_rsync,
+ Completion/Unix/Command/_readelf, Completion/Unix/Command/_ruby,
+ Completion/Unix/Command/_strip, Completion/Unix/Command/_vim,
+ Completion/X/Command/_evince: various completion option updates
+
+ * 42571: Completion/BSD/Command/_jail,
+ Completion/BSD/Command/_jexec: new completion for FreeBSD jail
+
+2018-03-30 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 42568: Completion/Unix/Command/_shutdown: new completion
+
+ * 42569: Completion/Unix/Command/_lsof: improve completion after
+ -i and -s options
+
+ * 42567: Completion/Unix/Command/_xmlstarlet: new completion
+ for xmlstarlet
+
+ * 42570: Completion/Unix/Command/_drill,
+ Completion/Unix/Command/_dig, Completion/Unix/Type/_dns_types:
+ new completion for drill and factor out DNS type completion
+
+ * 42560: Src/utils.c: silence sign-compare compiler warnings
+
+ * 42566: Completion/Unix/Command/_strings: new strings completion
+
+2018-03-29 Mikael Magnusson <mikachu@gmail.com>
+
+ * 42564: Completion/Unix/Command/_adb: Various improvements
+
+2018-03-28 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 42548: Completion/Unix/Command/_pwgen: new pwgen completion
+
+ * 42549: Completion/Redhat/Command/_yum: also handle the yumdb
+ command in yum completion
+
+ * 42550: Completion/Unix/Command/_gem: completion for ruby's gem
+
+ * 42539: Src/utils.c: prevent overflow of PATH_MAX-sized
+ buffer in spelling correction
+
+2018-03-27 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Martijn: 42538: Src/utils.c, Test/A04redirect.ztst:
+ temporarily set umask (with signals queued) while reading
+ here document.
+
+2018-03-25 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 42480: Src/utils.c: optimize $#var for single-byte character sets
+
+2018-03-25 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 42505: README. Etc/FAQ.yo: prepare for 5.5 release.
+
+2018-03-24 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 42520: Completion/Unix/Command/_netcat: don't use an empty
+ but existing option cache in netcat completion
+
+ * 42521 based on 42049 (SATOH Fumiyasu):
+ Completion/Unix/Command/_make: make always includes relative
+ to the current directory rather than relative to the Makefile
+
+ * 42519, CVE-2018-1083: Src/Zle/compctl.c: check bounds on
+ PATH_MAX-sized buffer used for file completion candidates
+
+ * 42518, CVE-2018-1071: Src/exec.c, Src/utils.c:
+ check bounds when copying path in hashcmd()
+
+2018-03-24 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 42501: Src/Zle/complete.c, Src/Zle/computil.c,
+ Src/Zle/zle_thingy.c: avoid out of bound pointer (as 42487).
+
+ * unposted: Src/Modules/db_gdbm.c: add 'static' to a file-local
+ variable.
+
+2018-03-23 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 42491 based on 42000 (Andrei Shevchuk):
+ Completion/Unix/Command/_mosh, Completion/Unix/Command/_git,
+ Completion/Unix/Command/_ssh, Completion/Unix/Type/_ssh_hosts:
+ factor ssh host completion for use for mosh and git
+
+ * 42497 (tweaked c.f. 42498): Completion/Debian/Command/_apt:
+ make completion after apt install work on local .deb files
+
+2018-03-22 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 42191: Completion/Darwin/Command/_otool: new completion
+
+2018-03-21 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 42487: Src/Zle/compctl.c: remove gcc 7.3.0 warnings and
+ potentially incorrect pointer usage.
+
+2018-03-18 Barton E. Schaefer <schaefer@brasslantern.com>
+
+ * Stephane: 42469: Src/exec.c, Src/Modules/mapfile.c: fix 42465
+
+2018-03-15 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Stephane: 42465: Src/exec.c, Src/Modules/mapfile.c: pass error
+ status from readoutput, causing more consistent reporting
+ from $(...) constructs.
+
+2018-03-12 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 42453: Src/jobs.c: fix race looking up status of just
+ exited background job.
+
+2018-03-07 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * github #22: Ferenc-: Completion/Unix/Command/_gcc:
+ Add newer C++ standard options to gcc completion
+
+ * github #23: Matthijs Tijink: Completion/X/Command/_kdeconnect:
+ new kdeconnect-cli completion
+
+2018-03-05 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Martijn: 42365: Src/parse.c: use .zwc file if timestamp
+ identical to source file.
+
+2018-03-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Taylor West: 42411: Src/mem.c: assume any current C compiler
+ will handle NULL argument to free.
+
+2018-02-26 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 23180: Src/Zle/zle_tricky.c: Square brackets in dynamic
+ directory expansion shouldn't force expansion in
+ expand-or-complete.
+
+ * Joey Pabalinas: 42401: Src/mem.c: replace malloc with use of
+ realloc to work around crash with gcc using -foptimize-strlen.
+
+ * users/23169: Completion/Base/Completer/_expand: treat ~[...]
+ the same way is other forms of tilde expansion: only expand
+ if accept-exact is set.
+
+ * 42399: Doc/Zsh/builtins.yo: better description of interaction
+ between echo and dashes.
+
+2018-02-22 Daniel Hahler <zsh@thequod.de>
+
+ * 42364: Completion/Unix/Command/_git: _git: fix __git_ignore_line to
+ ignore the current word.
+
+2018-02-17 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 42362: Src/jobs.c: protet REPORTTIME logic from bad status.
+
+2018-02-13 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Eitan Adler: Doc/Zsh/params.yo: REPORTMEMORY is in kilobytes,
+ not megabytes.
+
+2018-02-12 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Martijn: 42355: Src/exec.c, Test/A04redirect.ztst:
+ Interpreation of backslash on here doc input was inconsistent
+ and confusing.
+
+2018-02-12 Daniel Hahler <zsh@thequod.de>
+
+ * 42324: Completion/Unix/Command/_git: _git: handle mutually exclusive
+ options.
+
+2018-02-11 Daniel Hahler <zsh@thequod.de>
+
+ * 42327: Completion/Unix/Command/_make: _make: complete _files.
+
+2018-02-08 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Completion/Unix/Command/_subversion: Support
+ subcommands with hyphens in their names, such as 'shelf-list
+ (shelves)' from upstream 1.10 development versions.
+
+2018-02-07 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * Christian Hesse: 42333: Completion/Unix/Command/_git: Starting
+ with version 2.16.0 git no longer accepts an empty string as a
+ pathspec element. Thus we have to replace empty strings with a dot.
+
+ * Matthew Martin: 42330: Completion/Unix/Command/_ln:
+ -L and -P are POSIX, but not supported by Darwin or NetBSD
+
+ * wgh@torlan.ru: 42336: Completion/Unix/Command/_adb: force
+ single column output when getting filenames with adb ls command
+
+ * 42343: Completion/Unix/Command/_subversion: complete
+ --config-option more than once
+
+2018-01-31 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 42332: Src/builtin.c, Src/utils.c: special case printf for
+ unsigned integers by looking for constansts, avoiding conversion
+ to signed.
+
+2018-01-24 Daniel Hahler <zsh@thequod.de>
+
+ * 42323: Completion/Unix/Command/_git: _git: move "local" statement
+ out of loop.
+
+2018-01-24 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 42322 (tweaked): Src/hist.c, Src/zsh.h: don't discard a
+ history line with just an interactive comment simply because
+ there were no words, since the comment now doesn't produce
+ words.
+
+2018-01-23 Barton E. Schaefer <schaefer@zsh.org>
+
+ * Joey Pabalinas: 42313: Src/subst.c: avoid null-pointer deref
+ when using ${(PA)...} on an empty array result
+
+2018-01-23 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 42317: Completion/Linux/Command/_cryptsetup,
+ Completion/Linux/Command/_ethtool, Completion/Unix/Command/_wget,
+ Completion/Linux/Command/_tune2fs, Completion/Unix/Command/_cowsay,
+ Completion/Unix/Command/_git, Completion/Unix/Command/_gsettings,
+ Completion/Unix/Command/_gzip, Completion/Unix/Command/_ssh,
+ Completion/Unix/Command/_sudo, Completion/Unix/Command/_tidy,
+ Completion/Unix/Command/_tmux, Completion/Unix/Command/_truss:
+ option updates for commands that have had recent updates
+
+ * 42299: Completion/Zsh/Command/_typeset: correct optional argument
+
+ * Matthew Martin: 42309: Completion/Unix/Command/_dhclient,
+ Completion/Unix/Command/_id, Completion/Unix/Command/_install:
+ A few small updates for OpenBSD
+
+2018-01-22 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Daniel Tamelin: 42305: INSTALL: CVS should be git.
+
+2018-01-20 Mikael Magnusson <mikachu@gmail.com>
+
+ * 42243: Src/Modules/pcre.c: Free stuff properly in zsh/pcre
+ module
+
+2018-01-19 Barton E. Schaefer <schaefer@zsh.org>
+
+ * dana: 41924: Doc/Zsh/params.yo: (wi) subscript flag interaction
+
+ * Sebastian Gniazdowski: 41839: Functions/Misc/allopt: force IFS
+ to default for "read"
+
+2018-01-18 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 42294: Completion/compinit: disable REPORTTIME in completion.
+
+2018-01-16 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Warepire: Src/prompt.c: off by one fix in multiline prompts.
+
+2018-01-14 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 42136: Src/prompt.c: empty string check in %~ / %C expansions
+
+ * 42043: Src/exec.c: ZSH_DEBUG_CMD should not WARN_CREATE_GLOBAL
+
+2018-01-13 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 42264: Doc/Zsh/expn.yo: Follow-up to previous: Clarify that
+ ${histchars[1]} may be backslash-escaped even when it isn't '!'.
+
+2018-01-13 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 42261: Doc/Zsh/expn.yo, Doc/Zsh/grammar.yo: docs: Expand
+ documentation of $histchars[1]. Joint with Matthew Martin.
+
+2018-01-10 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * Matthew Martin: 42242: Completion/Unix/Command/_ldconfig:
+ add [DFNO]BSD to the mix
+
+2018-01-08 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 42245: Src/hist.c, Src/lex.c, Src/zsh.h: Abort last word on
+ interactive comment to avoid it becoming a useless word.
+
+2018-01-05 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * dana: 42231: Completion/Darwin/Command/_caffeinate,
+ Completion/Darwin/Command/_mdfind,
+ Completion/Darwin/Command/_mdls,
+ Completion/Darwin/Command/_mdutil,
+ Completion/Darwin/Command/_nvram,
+ Completion/Darwin/Command/_osascript,
+ Completion/Darwin/Command/_pbcopy,
+ Completion/Darwin/Command/_plutil,
+ Completion/Darwin/Command/_say,
+ Completion/Darwin/Command/_scselect,
+ Completion/Darwin/Command/_scutil,
+ Completion/Darwin/Command/_sw_vers,
+ Completion/Linux/Command/_chattr,
+ Completion/Linux/Command/_ldconfig,
+ Completion/Linux/Command/_lsattr,
+ Completion/Unix/Command/_attr: new completion functions for simple
+ utilities belonging to the 'Darwin' and 'Linux' groups.
+
+ * 42230: Completion/Unix/Command/_screen: update to 4.06.01
+
+ * 42229: Completion/Unix/Command/_awk, Completion/Unix/Command/_df,
+ Completion/Unix/Command/_ls, Completion/Unix/Command/_od,
+ Completion/Unix/Command/_tail, Completion/Unix/Command/_timeout:
+ update completion of GNU programs for coreutils 8.29 / gawk 4.2.0
+
+ * dana: 42223 (tweaked): Completion/X/Command/_sublimetext,
+ Completion/Unix/Command/_getopt, Completion/Unix/Command/_install
+ Completion/Unix/Command/_mktemp, Completion/Unix/Command/_fold:
+ new completions
+
+ * 42221: Completion/Unix/Command/_enscript:
+ update enscript completion for GNU enscript 1.6.6
+
+2018-01-05 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * dana: 42222: Completion/Unix/Type/_object_files: recognize
+ .dylib extension (macOS).
+
+2018-01-04 Peter Stephenson <p.stephenson@samsung.com>
+
+ * dana: 42164: Src/Zle/complist.c, Test/Y01completion.ztst:
+ numeric values didn't work in format escapes in completion lists.
+
+ * Stephane: 42159: Src/params.c: avoid crash copying empty hash table.
+
+ * Sebastian: 42188: Src/Modules/system.c: It is necessary to
+ close the lock descriptor in some failure cases.
+
+2018-01-04 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * dana: 42214: Completion/BSD/Type/_file_flags,
+ Completion/Unix/Type/_file_modes, Completion/Unix/Command/_find,
+ Completion/Unix/Command/_mkdir, Completion/BSD/Command/_chflags,
+ Completion/Unix/Command/_chmod: use less general names on new
+ functions for completing file flags and modes
+
+ * github #21: Maciek Makowski:
+ Completion/Linux/Command/_networkmanager: update nmcli
+ completions to be compatible with recent version 1.8.4
+
+2018-01-03 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * dana: 42210: Completion/BSD/Command/_chflags,
+ Completion/BSD/Type/_flags, Completion/Unix/Command/_chmod,
+ Completion/Unix/Command/_find, Completion/Unix/Command/_mkdir,
+ Completion/Unix/Type/_modes: factor out completion of file
+ modes and flags and handle _comp_priv_prefix for chflags
+
+ * dana: 42209: Completion/Unix/Command/_unexpand: take account
+ of numeric options such as -4 instead of -t4
+
+ * dana: 42209: Completion/Unix/Command/_tr: fix option
+ descriptions for non-GNU variants
+
+ * 42208: Completion/Unix/Command/_yp: fix use of cache variables
+
+ * dana: 42207: Completion/Unix/Command/_chown,
+ Completion/Unix/Command/_cat, Completion/Unix/Command/_cut,
+ Completion/Unix/Command/_dd, Completion/Unix/Command/_df,
+ Completion/Unix/Command/_env, Completion/Unix/Command/_fmt,
+ Completion/Unix/Command/_head, Completion/Unix/Command/_paste,
+ Completion/Unix/Command/_printenv, Completion/Unix/Command/_stty,
+ Completion/Unix/Command/_stdbuf, Completion/Unix/Command/_tail,
+ Completion/Unix/Command/_tr, Completion/Unix/Command/_uname,
+ Completion/Unix/Type/_directories: add g prefixes for GNU variants
+
+ * Matthew Martin: 42117: Completion/BSD/Command/_chflags:
+ use anonymous function rather than define one in user namespace
+
+2018-01-02 Eric Cook <llua@gmx.com>
+
+ * 42171: Completion/BSD/Command/_portsnap,
+ Completion/Linux/Command/_ipset,
+ Completion/Linux/Command/_valgrind,
+ Completion/Redhat/Command/_rpm,
+ Completion/Solaris/Command/_prstat,
+ Completion/Unix/Command/_arp,
+ Completion/Unix/Command/_cvs,
+ Completion/Unix/Command/_devtodo,
+ Completion/Unix/Command/_ffmpeg,
+ Completion/Unix/Command/_git,
+ Completion/Unix/Command/_gpg,
+ Completion/Unix/Command/_ruby,
+ Completion/Unix/Command/_tr,
+ Completion/Unix/Command/_whois,
+ Completion/Unix/Command/_yp,
+ Completion/Unix/Command/_zfs,
+ Completion/X/Command/_xset,
+ Completion/Zsh/Command/_cd: prevent various parameters
+ from becoming global.
+
+2017-12-31 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 42183: Completion/Unix/Command/_objdump: support LLVM variant
+
+2017-12-30 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 42186: Completion/Debian/Command/_apt: Fix completion of
+ target_release names, e.g., 'apt install zsh/<TAB>'.
+
+ * unposted: Functions/VCS_Info/VCS_INFO_formats,
+ Functions/VCS_Info/VCS_INFO_set: vcs_info: Add docstrings to
+ the internal functions VCS_INFO_formats and VCS_INFO_set.
+
+2017-12-28 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 42175 + 42177 (+ 24178 by Daniel):
+ Completion/Base/Utility/_arguments,
+ Completion/Base/Utility/_call_program,
+ Completion/Debian/Command/_aptitude, Completion/Unix/Command/_a2ps,
+ Completion/Unix/Command/_subversion, Completion/Unix/Command/_tar,
+ Doc/Zsh/compsys.yo: avoid localized output from external commands
+ for easier analysys by the completion system.
+
+2017-12-27 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 42176: Completion/Unix/Command/_tar: update long options
+
+2017-12-22 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * dana: 42156 with tweak as per 42158: Doc/Zsh/options.yo,
+ Src/builtin.c, Src/options.c, Src/utils.c, Src/zsh.h,
+ Test/W02jobs.ztst: add CHECK_RUNNING_JOBS opion and job tests;
+ remove debug error when rows or columns are zero as this is
+ normal without a physical terminal.
+
+ * dana: 42156: Doc/Zsh/options.yo, Src/builtin.c,
+ Src/options.c, Src/zsh.h, Test/W02jobs.ztst: new
+ CHECK_RUNNING_JOBS option demanded by bash groupies.
+
+ * danda: 42155: Completion/Unix/Command/_ssh: various
+ improvements for OpenSSH.
+
+ * 42152: Src/exec.c, Src/zsh.h: improved line numbering for
+ functions (in particular anonymous functions) defined inside
+ others, also flag for anonymous functions.
+
+2017-12-20 Peter Stephenson <p.stephenson@samsung.com>
+
+ * dana: 42145: Src/Zle/computil.c, Test/Y03arguments.ztst: fix
+ for completion option arguments.
+
+2017-12-20 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 42146: Src/hashtable.c, Test/A02alias.ztst: type -w +=
+ global aliases
+
+ * 42138: Completion/Unix/Command/_git: _git-revert: Complete
+ recent commits first.
+
+ * Stephane (rebased by Mikael): users/13148, workers/42060:
+ Src/exec.c: Abort the command line when replying "[n] No" to
+ the RM_STAR_SILENT prompt.
+
+2017-12-20 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 42143: Completion/Unix/Type/_object_files: fix a pattern for
+ matching object files
+
+2017-12-18 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 42412: Src/Zle/zle_word.c: fix a bug in 42116. Also fix a few
+ widgets which were calling wrong function when negative numeric
+ argument was given.
+
+2017-12-18 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 42116: Src/Zle/zle_word.c, Src/Zle/textobjects.c, Src/Zle/zle.h,
+ Test/X02zlevi.ztst: multibyte support for Zle vi-mode word motion
+
+2017-12-15 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 42123 (tweaked further): Src/exec.c: need to take account of
+ Dash when comparing functions names for autoloading.
+
+2017-12-14 Peter Stephenson <p.stephenson@samsung.com>
+
+ * dana: 42119: Doc/zsh/params.yo, Src/jobs.c,
+ Test/A01grammar.ztst: add millisecond and microsecond options to
+ TIMEFMT variable.
+
+2017-12-13 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Matthew Martin: 42114: Completion/BSD/Command/_bsd_pkg,
+ Completion/BSD/Type/_fbsd_architectures,
+ Completion/BSD/Type/_nbsd_architectures,
+ Completion/BSD/Type/_obsd_architectures: Remove FreeBSD use of
+ pkg_* tools and add BSD architecture utilities.
+
+2017-12-12 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 42110: Src/parse.c, Test/A04redirect.ztst: fix redirection in
+ between variable assignments at start of line.
+
+2017-12-01 Peter Stephenson <p.stephenson@samsung.com>
+
+ * dana: 42065: Test/B10getopts.ztst: new getopts tests.
+
+ * dana: 42063: Src/builtin.c: getopts errors now report "+" if
+ appropriate for option.
+
+2017-11-24 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 42031 + 42048: Doc/Zsh/cond.yo, Doc/Zsh/options.yo, README,
+ Src/cond.c, Test/C02cond.ztst: Make [[ -o invalidoption ]]
+ a normal(ish) false value, rather than a syntax error.
+
+2017-11-20 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Dima Kogan: 42040: Src/glob.c: buffer for glob qualifiers
+ loses stat information in corner case.
+
+ * Evan Underscore / pws: 42037: Completion/bashcompinit: recent
+ change caused wrong word to be used for COMP_POINT.
+
+2017-11-13 Oliver Kiddle <opk@zsh.org>
+
+ * 42019: Completion/Unix/Command/_git: update options to 2.15
+ and improve format completion for git tag and for-each-ref
+
+ * gitlab #1: Completion/Unix/Command/_sqlite: update options
+ for sqlite 3.21.0
+
+ * github #18: Malcolm Ramsay: Completion/Redhat/Command/_dnf:
+ Explicitly use system python so the dnf module can be found
+
+ * github #19: Chris Bracken: Doc/Zsh/options.yo: Fix minor typo
+ in INC_APPEND_HISTORY documentation
+
+2017-11-11 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Martijn: 42004: Doc/Zsh/builtins.yo: fix parentheses.
+
+2017-11-04 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Completion/Linux/Command/_sshfs: Make the -o option
+ repeatable, accept "--".
+
+2017-11-04 Oliver Kiddle <opk@zsh.org>
+
+ * 41983: Src/Zle/computil.c, Test/Y03arguments.ztst:
+ fix exclusion of long options with (-) on a normal argument
+
+2017-11-03 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 41969: Completion/Unix/Command/_sort: Clarify option
+ description.
+
+2017-11-02 Oliver Kiddle <opk@zsh.org>
+
+ * 41971: Completion/Linux/Command/_modutils,
+ Completion/Unix/Command/_make, Completion/Zsh/Command/_zmodload:
+ correctly break out of certain tag loops when there are matches
+
+2017-11-02 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Martijn: 41866: Src/builtin.c, Src/hashtable.c: no error for
+ unsetting nonexistent function if POSIXBUILTINS.
+
+2017-10-31 Oliver Kiddle <opk@zsh.org>
+
+ * 41965: Completion/Zsh/Command/_typeset: complete functions -W
+
+ * 41965: Completion/Zsh/Command/_zmodload: complete zmodload -s
+
+ * 41963: Completion/Unix/Command/_gnutls: update for gnutls 3.6.1
+
+2017-10-30 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 41939: Doc/Zsh/grammar.yo: docs: Move aliases corner case to
+ the dangerous bends section. (after 41482)
+
+2017-10-29 Oliver Kiddle <opk@zsh.org>
+
+ * Sebastian: 41960: Completion/Zsh/Command/_zstyle,
+ Completion/Zsh/Type/_globquals: declare MATCH, MBEGIN, MEND local
+
+ * 41961: Completion/Unix/Command/_ansible: new ansible completion
+
+ * 41958: Completion/Linux/Command/_losetup,
+ Completion/Linux/Command/_lsblk, Completion/Linux/Command/_wipefs,
+ Completion/Unix/Command/_hexdump, Completion/Unix/Command/_last:
+ update util-linux completions to 2.31; new hexdump completion
+
+2017-10-28 Oliver Kiddle <opk@zsh.org>
+
+ * 41957: Completion/Unix/Command/_git: update for git 2.14.3
+
+ * 41927: Completion/Zsh/Command/_typeset: complete
+ "typeset -p"'s optional argument for multi-line output
+
+2017-10-25 Alexey Sokolov <sokolov@google.com>
+
+ * 41952: Functions/VCS_Info/Backends/VCS_INFO_get_data_hg: Use
+ HGPLAIN instead of HGRCPATH in VCS_INFO_get_data_hg
+
+2017-10-20 Christian Brabandt <cb@256bit.org>
+
+ * 41943: Completion/Unix/Command/_vim: Completion: add --clean for
+ vim
+
+2017-10-17 Barton E. Schaefer <schaefer@zsh.org>
+
+ * unposted: Test/D04parameter.ztst: tests for 41902
+
+ * 41902: Src/lex.c: ${(z)...} continues parsing on unmatched
+ quote when CSH_JUNKIE_QUOTES is set.
+
+ * unposted (cf. Sebastian: 41891): Test/D04parameter.ztst:
+ regression test for 41873
+
+2017-10-17 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Doc/Zsh/builtins.yo: Document "typeset -p"'s optional
+ argument in the inline synopsis.
+
+2017-10-16 Peter Stephenson <p.stephenson@samsung.com>
+
+ * gi1242+ZSH: 41907: Completion/Debian/Command/_deborphan:
+ further update.
+
+ * gi1242+zsh: 41904: Completion/Debian/Command/_deborphan,
+ Completion/X/Command/_xrandr: new and updated completions.
+
+2017-10-15 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 41898: Functions/Zle/edit-command-line: handle multi-word values
+ of $VISUAL et al., and line counting of buffer for emacs startup
+
+2017-10-13 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 41873: Src/lex.c: temporarily disable effects of ${(Z:n:)...}
+ for parsing $(...) expressions within the parameter value
+
+2017-10-13 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 41833 + 41838: Completion/Unix/Command/_jq: New completion.
+
+2017-10-13 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 41877: Src/subst.c, Test/E01options.ztst: Separate out
+ SH_FILE_EXPANSION loop from parameter substitution as the latter
+ can add nodes: SH_FILE_EXPANSION should see following nodes
+ only, but on the next loop parameter substitution needs to see
+ added nodes for further expansion.
+
+2017-10-11 Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
+
+ * 41825/0002: Completion/Zsh/Command/_stat: Complete -x options
+ to zsh/stat's 'zstat'.
+
+ * 41825/0001: Completion/Zsh/Command/_stat: Only complete 'stat'
+ if it's provided by the zsh/stat builtin.
+
+2017-10-10 Oliver Kiddle <opk@zsh.org>
+
+ * 41855: Completion/Unix/Command/_dhclient,
+ Completion/BSD/Command/_pfctl, Completion/Unix/Command/_id,
+ Completion/Unix/Command/_rm: completion option updates for
+ OpenBSD 6.2 and handle macOS in rm completion
+
+ * 41854: Completion/Unix/Command/_ping: also complete options
+ for ping on Solaris, macOS, NetBSD and OpenBSD and for ping6
+
+ * 41853: Completion/Unix/Command/_texinfo: update options for
+ texinfo 6.5 and complete also for the pinfo info reader
+
+ * 41849: Completion/Unix/Command/_unexpand: handle both unexpand
+ and expand in a single function: they have some commonalities
+ and it dodges around the clash with the _expand completer
+
+ * 41831: Completion/Unix/Type/_tilde_files,
+ Completion/Unix/Command/_less, Completion/Unix/Command/_vorbis,
+ Completion/Zsh/Type/_globquals: fix compset usage in ogg123
+ completion and tweak where compset -p is a better choice than -P
+
+ * 41835: Src/Zle/complete.c: handle multibyte characters with
+ compset -p and -s
+
+2017-10-10 Peter Stephenson <p.stephenson@samsung.com>
+
+ * uposted, c.f. 41846: Completion/Unix/Command/_expand ->
+ _expand_cmd: rename to avoid clash with completer.
+
+ * 41842: Doc/Zsh/grammar.yo: split alias documentation, adding
+ more on problems.
+
+2017-10-08 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 41830: Test/E01options.ztst: test for 41828.
+
+ * 41828: Src/subst.c: skip SHFILEEXPANSION for new nodes added
+ by stringsubst() in prefork().
+
+2017-10-07 Oliver Kiddle <opk@zsh.org>
+
+ * 41827: Completion/Zsh/Context/_brace_parameter: correct
+ sense of description for ${...:?...} expansion
+
+ * dana: 41826: Completion/Zsh/Context/_brace_parameter: fix
+ inaccuracies in completion description wording
+
+ * 41824: Src/Zle/computil.c, Test/Y03arguments.ztst: fix to
+ not complete rest args from an _arguments set alongside
+ the argument to and option in a separate set
+
+ * 41823: Completion/Unix/Command/_expand,
+ Completion/Unix/Command/_mv, Completion/Unix/Command/_numfmt,
+ Completion/Unix/Command/_seq, Completion/Unix/Command/_split,
+ Completion/Unix/Command/_stdbuf, Completion/Unix/Command/_cp,
+ Completion/Unix/Command/_timeout,
+ Completion/Unix/Command/_unexpand: new completions for some
+ GNU coreutils utilities
+
+2017-10-07 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Doc/Zsh/mod_stat.yo: zsh/stat docs: Rephrase to
+ avoid ambiguity due to the ambiguous relative precedence of the
+ 'other than' and 'and' operators.
+
+2017-10-04 Noah Pendleton <noah.pendleton@gmail.com>
+
+ * 41808: Completion/Unix/Command/_git: _git-cherry-pick:
+ Typo fixes
+
+2017-10-04 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 41802 (minor tweaks): Src/exec.c, Src/parse.c: use heap
+ instead of stack for temporary storage over shell function call,
+ also fix debug message when FUNCNEST increased.
+
+2017-10-02 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 41787 (minor corrections): configure.ac, README,
+ Doc/Zsh/params.yo, Src/exec.c, Src/parms.c,
+ Test/C04funcdef.ztst: reduce default nested function depth to
+ 500 and expose as $FUNCNEST.
+
+2017-10-01 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 41797 (tweaked): Doc/Zsh/builtins.yo, Src/builtin.c,
+ Src/params.c, Src/subst.c, Src/zsh.h, Test/B02typeset.ztst:
+ typeset -p1 outputs arrays and associative arrays with newlines
+ and indented elements.
+
+2017-09-29 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 41789: Src/exec.c: Don't try to mark an FD as saved if it
+ couldn't be moved.
+
+2017-09-28 Oliver Kiddle <opk@zsh.org>
+
+ * 41772: Src/Zle/computil.c, Test/Y03arguments.ztst: fix bug
+ in handling of long options with _arguments' -A option
+
+ * 41762: Completion/Zsh/Context/_value: fix for completion
+ in assignment to associative array element
+
+2017-09-27 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 41767: Src/exec.c: preserve nonzero exit status on interrupt
+
+2017-09-27 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 41773: Test/D04parameter.ztst: Array index assignment tests
+ for KSH_ARRAYS.
+
+ * 41764 (test tweaked): Doc/Zsh/params.yo, Src/params.c,
+ Src/subst.c, Src/zsh.h, Test/D04parameter.ztst: allow
+ [key]+=value when modifying array or associative array.
+
+2017-09-26 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 41761: Src/exec.c: Ensure status from interrupt is propagated
+ from builtin.
+
+2017-09-25 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 41747: Sr/hist.c, Src/params.c, Src/subst.c. Src/zsh.h: add
+ flag so as not to create hash table when checking existence.
+
+2017-09-24 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 41755: Doc/Zsh/params.yo: Followup to last: minor clarification
+ to docs.
+
+2017-09-24 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 41754: Doc/Zsh/params.yo, NEWS, README,
+ Src/Zle/zle_tricky.c, Src/exec.c, Src/params.c, Src/subst.c,
+ Src/zsh.h, Test/B02typeset.ztst, Test/D04parameter.ztst:
+ allow mix of [ind]=val and traditional assignment for normal
+ (but not associative) arrays, add tests.
+
+2017-09-22 Oliver Kiddle <opk@zsh.org>
+
+ * 41742: Completion/Unix/Command/_mtr: update for mtr 0.92
+
+ * 41743: Completion/Linux/Command/_tune2fs: update options in
+ completion through e2fsprogs 1.43.6
+
+ * 41732: Completion/Unix/Command/_tmux: bring completion in
+ line with tmux 2.5 - removing completion of mode tables
+
+2017-09-21 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted (cf. 41672): Src/utils.c: checkrmall: Record the
+ 41672 bug in a TODO.
+
+ * unposted (cf. 41707): Src/utils.c: internal: Document the
+ count==0 case of checkrmall().
+
+2017-09-20 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 41736: NEWS, Src/exec.c: NO_INTERACTIVE_COMMENTS in $(...)
+
+ * 41731: Doc/Zsh/params.yo: reformat and expand doc for 41698.
+
+2017-09-18 Oliver Kiddle <opk@zsh.org>
+
+ * 41729: Completion/Unix/Command/_gnutls: update options for
+ gnutls plus cleanup and rearrange the function
+
+ * 41728: Completion/Unix/Command/_flac (was _metaflac): new
+ completion for flac and update options in metaflac completion
+
+ * 41727: Completion/Unix/Command/_tidy: run tidy -xml-config
+ to get HTML options for completion
+
+2017-09-18 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 41723: Src/loop.c: one more case of 41627 in "while" loops.
+
+2017-09-18 Oliver Kiddle <opk@zsh.org>
+
+ * 41726: Completion/Linux/Command/_cryptsetup: add + and = to
+ option specs taking arguments and update options to 1.7.5
+
+ * 41720: Completion/Linux/Command/_chrt,
+ Completion/Linux/Command/_ionice,
+ Completion/Linux/Command/_losetup,
+ Completion/Linux/Command/_wipefs: update completion of options
+ for util-linux 2.30.1
+
+ * 41725: Completion/BSD/Command/_sysrc,
+ Completion/Linux/Command/_mii-tool,
+ Completion/Redhat/Command/_scl, Completion/Unix/Command/_env,
+ Completion/Unix/Command/_dhclient,
+ Completion/Unix/Command/_getfacl, Completion/Unix/Command/_gpg,
+ Completion/Unix/Command/_ls, Completion/Unix/Command/_screen,
+ Completion/Unix/Command/_setfacl,
+ Completion/Unix/Command/_strip, Completion/Unix/Command/_truss,
+ Completion/Unix/Command/_vim, Completion/Unix/Command/_wget:
+ assorted minor updates to completion functions
+
+ * 41724: Completion/Linux/Command/_ethtool: update
+ completion for new options
+
+2017-09-15 Oliver Kiddle <opk@zsh.org>
+
+ * 41711: Completion/Unix/Command/_dconf: new dconf completion
+
+ * 41710: Completion/Unix/Command/_smartmontools:
+ new smartctl completion
+
+ * 41709: Completion/Linux/Command/_sysstat,
+ Completion/Unix/Command/_iostat: update options in completion
+
+2017-09-15 Peter Stephenson <p.stephenson@samsung.com>
+
+ * unposted: Doc/Zsh/params.yo: nodref -> noderef.
+
+2017-09-14 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 41705: Doc/Zsh/expn.yo, Doc/ZSh/params.yo, Src/params.c,
+ Test/B02typeset.ztst, Test/V10private.ztst: typeset -p output
+ for associative arrays and some rephrasings.
+
+2017-09-13 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: typo in proceeding Doc noticed by Oliver.
+
+ * 41698: Doc/Zsh/params.yo, Src/builtin.c, Src/exec.c,
+ Src/params.c, Src/zsh.h, Test/B02typeset.ztst,
+ Test/D04parameter.ztst: add ([key]=val) assignment syntax.
+ Still to do: allow to mix with other syntax, improve typeset -p,
+ implement [key]+=value.
+
+2017-09-13 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 41688: Src/jobs.c: "wait" for all active jobs should ignore
+ those marked STAT_NOPRINT.
+
+ * 41679: Doc/Zsh/builtins.yo: slight clarifcation on exec of
+ builtins.
+
+2017-09-11 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Src/utils.c: internal: Document zreaddir().
+
+2017-09-11 Peter Stephenson <p.stephenson@samsung.com>
+
+ * unposted: Doc/Zsh/invoke.yo: YODL compatibility fix for
+ --emulate.
+
+ * Thierry Ghelew: 41666: Src/Modules/zpty.c: zpty compatibility
+ for OpenBSD.
+
+ * 41668: Doc/Zsh/invoke.yo, Src/builtin.c, Src/init.c,
+ Src/zsh.h, Test/B07emulate.ztst: Add option --emulate at
+ invocation to start in correct emulation, as the ARGV0 trick
+ doesn't work from other shells.
+
+2017-09-10 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 41622: Src/exec., Test/A01grammar.ztst: exec -a arguments
+ weren't sanitised.
+
+ * 41661: Src/subst.c, Test/D04parameter.ztst: need to remove
+ tokens before passing to bufferwords() for (z).
+
+2017-09-09 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 41628 (plus 41645 by Oliver): Completion/Unix/Command/_ps:
+ update options; do not reset compstate
+
+2017-09-05 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 41641: Src/math.c: more arithmetic operations need to be
+ marked as rvalues, in particular increment and decrement.
+
+2017-09-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 41633: Src/parse.c: make sure function definitions including
+ anonymous functions put into the background are run in the
+ background.
+
+2017-09-04 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 41621: Completion/Unix/Command/_mkdir: Honour the 'command'
+ and 'builtin' precommand modifiers.
+
+ * 41620 (tweaked per 41622): Completion/Unix/Command/_mkdir:
+ Don't offer a linux-specific option in the 'zsh' variant.
+
+2017-09-04 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 41637: Marc Aldorasi: Completion/Unix/Command/_objdump:
+ explicit completion instead of generating from _object_files.
+
+2017-09-02 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 41623: Etc/FAQ.yo: update to align with Yodl 3.
+
+2017-08-31 Peter Stephenson <p.stephenson@samsung.com>
+
+ * unposted: Functions/Misc/zed: zstyle -m can set match,
+ mbegin, mend, so declare locally.
+
+ * 41627: Src/loop.c, Test/C03traps.ztst: fix problem with
+ ERR_RETURN in initialisation scripts and also on nested
+ function involving ERR_RETURN suppression in the caller.
+
+2017-08-30 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 41567: Completion/Unix/Command/_tmux: Complete detached
+ sessions first for attach-session.
+
+ * 41566: Completion/Unix/Command/_tmux: Complete only attached
+ sessions for detach-session.
+
+ * 41564: Completion/Unix/Command/_tmux: Complete environment
+ variables and their values for set-environment and
+ show-environment.
+
+ * 41557: Completion/Unix/Command/_tmux: show-environment,
+ set-environment: Make -g,-t mutually exclusive.
+
+ * 41558: Completion/Unix/Command/_tmux: Complete option names
+ for show-options and show-window-options.
+
+2017-08-27 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 41608 (plus tests): Src/exec.c, Test/C03traps.ztst: ERR_EXIT
+ behaviour restored when executing a function in body of else.
+
+2017-08-29 Андрей Стоцкий (_RuRo_) <ruro.ruro@ya.ru>
+
+ * 41618: Completion/Unix/Command/_todo.sh: Added some arguments
+ autocompletion to _todo.sh.
+
+2017-08-29 Oliver Kiddle <opk@zsh.org>
+
+ * 41617: Completion/Linux/Command/_tracepath: complete new options
+
+ * 41616: Completion/Unix/Command/_entr: update options to 3.8
+
+ * unposted: Completion/Unix/Type/_bpf_filters:
+ add missing #autoload directive
+
+2017-08-28 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Config/version.mk: Post-release version bump.
+
2017-08-27 Peter Stephenson <p.w.stephenson@ntlworld.com>
* unposted: Config/version.mk: 5.4.2.
@@ -2095,7 +3122,7 @@
2016-10-24 Barton E. Schaefer <schaefer@zsh.org>
* unposted: NEWS, README: update for 39704.
-
+
* 39704: Src/params.c, Test/B02typeset.ztst, Test/B03print.ztst,
Test/V10private.ztst: the output of "typeset -p" uses "export"
commands or the "-g" option for parameters that are not local to
@@ -3153,7 +4180,7 @@
2016-07-17 Barton E. Schaefer <schaefer@zsh.org>
* unposted: Functions/Misc/add-zle-hook-widget: Move from Zle/.
-
+
* 38866: Doc/Zsh/contrib.yo: update add-zle-hook-widget for 38850.
* 38866 (+ tweak 38872): Functions/Zle/add-zle-hook-widget: fix
@@ -3912,7 +4939,7 @@
* 37971 (cf. users/21284: Eric Freese):
Functions/Zle/bracketed-paste-magic: fix potential issues when
interacting with user-defined widgets
-
+
* 37961: Src/Zle/complist.c: in interactive menuselection, use of
"compadd -x" (e.g. the "warnings" zstyle) may have replaced the
completion list, so skip highlighting of the current selection
@@ -5053,7 +6080,7 @@
2015-09-30 Barton E. Schaefer <schaefer@zsh.org>
* users/20672: Src/text.c: missing "do" in gettext2() for "select"
-
+
* 36707: Src/exec.c, Src/loop.c: distinguish ERR_RETURN value
of retflag so that execif() can ignore it in the test sublist
@@ -5137,7 +6164,7 @@
2015-09-28 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
* 36631: Completion/Unix/Command/_sh,
- Completion/Unix/Command/_zsh: separate _zsh from _sh
+ Completion/Unix/Command/_zsh: separate _zsh from _sh
2015-09-26 Barton E. Schaefer <schaefer@zsh.org>
@@ -6139,7 +7166,7 @@
2015-07-22 Barton E. Schaefer <schaefer@zsh.org>
* unposted: Test/B02typeset.ztst: fix another test for 35581
-
+
* 35582: Test/A06assign.ztst, Test/B02typeset.ztst: test for 35581
* 35581: Src/params.c: output array assignments with spaces inside
@@ -6498,7 +7525,7 @@
occur anywhere in a coredump filename
* 35476: Src/params.c: Allow setting $0 when POSIX_ARGZERO is
- not set
+ not set
2015-06-16 Barton E. Schaefer <schaefer@zsh.org>
@@ -7742,7 +8769,7 @@
tty_poll().
* 34369: Daniel Shahaf: document error / warning codes.
-
+
* 34383: Src/utils.c: new ztrdup() shoud be dupstring().
2015-01-25 Oliver Kiddle <opk@zsh.org>
@@ -7798,7 +8825,7 @@
2015-01-22 Barton E. Schaefer <schaefer@zsh.org>
* 34344: Test/V07pcre.ztst: fix 34338, builtins need loading too
-
+
* 34338: Test/V07pcre.ztst: check feature availability
2015-01-22 Marc Finet <m.dreadlock@gmail.com>
@@ -8138,7 +9165,7 @@
2014-12-17 Barton E. Schaefer <schaefer@zsh.org>
* 34002: Src/Zle/zle_keymap.c: zshcalloc() in init_keymaps()
-
+
* 33992: Src/jobs.c: do not attempt attachtty() for process group
zero (which is possible in a linux pid namespace)
diff --git a/Completion/BSD/Command/_bsd_pkg b/Completion/BSD/Command/_bsd_pkg
index 9f4b0f11a..d8928afaf 100644
--- a/Completion/BSD/Command/_bsd_pkg
+++ b/Completion/BSD/Command/_bsd_pkg
@@ -7,14 +7,20 @@ _bsd_pkg_pkgfiles() {
case $OSTYPE in
netbsd*)
portsdir=/usr/pkgsrc
+ pkgsdir=${PACKAGES:-$portsdir/packages}/All
+ ;;
+ openbsd*)
+ portsdir=${${(M)${(f)"$(</etc/mk.conf)"}:#PORTSDIR*}#*=[[:blank:]]#}
+ portsdir=${${portsdir:-$PORTSDIR}:-/usr/ports}
+ pkgsdir=${${(M)${(f)"$(</etc/mk.conf)"}:#PACKAGE_REPOSITORY*}#*=[[:blank:]]#}
+ pkgsdir=${${pkgsdir:-$PACKAGE_REPOSITORY}:-$portsdir/packages/}/$(make -V MACHINE_ARCH)/All
;;
*)
portsdir=${PORTSDIR:-/usr/ports}
+ pkgsdir=${PACKAGES:-$portsdir/packages}/All
;;
esac
- pkgsdir=${PACKAGES:-$portsdir/packages}/All
-
paths=( "${(@)${(@s.:.)PKG_PATH}:#}" )
_files "$@" -g '*.t[bg]z(-.)' && ret=0
(( $#path )) && _files "$@" -W paths -g '*.t[bg]z(-.)' && ret=0
@@ -47,171 +53,197 @@ _bsd_pkg() {
case "$service" in
pkg_add)
flags=(
- '-f[force installation]'
- '-I[don'\''t execute installation scripts]'
- '-M[run in master mode]'
- '-n[don'\''t really install packages]'
- '-p[specify prefix]:prefix directory:_files -/'
- '-R[don'\''t record]'
- '-S[run in slave mode]'
- '-t[specify mktemp template]:mktemp template:_files -/'
+ "-n[don't really install packages]"
'-v[be verbose]'
)
case "$OSTYPE" in
- freebsd*)
- flags=(
- $flags[@]
- '-r[fetch from remote site]'
- )
- ;;
netbsd*)
- flags=(
- $flags[@]
- '-u[update]'
- '-V[show version and exit]'
+ flags+=(
+ '-A[do not record packages as installed manually]'
+ '-C[specify configuration file]:config file:_files'
+ '-D[force updating even if dependencies are not satisfied]'
+ '-f[force installation]'
+ "-I[don't execute installation scripts]"
+ '-K[override PKG_DBDIR]:pkg_dbdir:_files -/'
+ '-m[specify machine architecture]:architecture:_netbsd_architectures'
+ '-P[specify destdir prefix]:destdir directory:_files -/'
+ '-p[specify prefix]:prefix directory:_files -/'
+ "-R[don't record]"
+ '-U[replace an already installed version]'
+ '-u[update]'
+ '-V[show version and exit]'
+ '*:package to install:_bsd_pkg_pkgfiles'
)
;;
+ openbsd*)
+ flags+=(
+ '-A[arch to assume for any package tests]:architecture:_obsd_architectures'
+ '-a[do not record packages as installed manually]'
+ '-aa[force already installed packages to be tagged as installed automatically]'
+ '-B[specify destdir prefix]:destdir directory:_files -/'
+ '-c[while replacing packages, delete extra configuration file in the old package]'
+ '-D[specify failsafe to waive]:failsafe:((
+ allversions\:"do not trim older p* variants of packages for updates"
+ arch\:"architecture recorded in package may not match"
+ checksum\:"verify checksums before deleting or tying old files"
+ dontmerge\:"do not merge updates together if dependencies are too strict"
+ donttie\:"do not try to find new files in old packages by comparing the stored sha256"
+ downgrade\:"do not filter out package versions older than what is currently installed"
+ installed\:"in update mode, reinstall an existing package with the same update signature"
+ libdepends\:"library specifications may not be fulfilled"
+ nonroot\:"install even if not running as root"
+ paranoid\:"do not run any @exec/@unexec"
+ repair\:"attempt to repair installed packages with missing registration data"
+ scripts\:"external scripts may fail"
+ SIGNER\:"list of trusted signers, separated by commas"
+ snap\:"force %c and %m to expand to snapshots"
+ unsigned\:"allow the installation of unsigned packages without warnings/errors"
+ updatedepends\:"force update even if forward dependencies no longer match"
+ ))'
+ '-I[force non-interactive mode]'
+ '-i[force interactive mode]'
+ '-L[specify a localbase]:localbase:_files -/'
+ '-l[specify pkg_info output file to install]:pkg_info file:_files'
+ '-m[always display progress meter]'
+ '-P[check distribution permissions]:permission type:(cdrom ftp)'
+ "-qq[don't check checksums]"
+ '-r[replace existing packages]'
+ "-s[don't install; just report disk size changes]"
+ '-U[update dependencies before installing]'
+ '-u[update the specified package or all if none given]'
+ '-V[turn on statistics output]'
+ '-x[disable progress meter]'
+ '-z[fuzzy package matching]'
+ )
esac
- _arguments -s \
- $flags[@] \
- '*:package to install:_bsd_pkg_pkgfiles'
+ _arguments -s $flags[@]
;;
pkg_create)
case "$OSTYPE" in
- freebsd*)
- flags=(
- '-f[specify plist file]:plist file:_files'
- '(-b)-c[specify comment file]:comment file:_files'
- '(-b)-d[specify descr file]:descr file:_files'
- '-Y[assume YES for any questions asked]'
- '-N[assume NO for any questions asked]'
- '(-b)-O[packing list only mode]'
- '-v[be verbose]'
- '-h[force tar to follow symlinks]'
- '(-b)-i[specify pre-install script]:pre-install script:_files'
- '(-b)-I[specify post-install script]:post-install script:_files'
- '(-b)-P[specify initial dependencies]:dependencies:_bsd_pkg_pkgs'
- '(-b)-p[specify prefix]:prefix directory:_files -/'
- '(-b)-k[specify deinstall script]:deinstall script:_files'
- '(-b)-K[specify post-deinstall script]:post-deinstall script:_files'
- '(-b)-r[specify req script]:req script:_files'
- '(-b)-s[specify source directory]:source directory:_files -/'
- '(-b)-t[specify mktemp template]:mktemp template:_files'
- '(-b)-X[specify exclude file]:exclude file for tar:_files'
- '(-b)-D[specify message file]:message file:_files'
- '(-b)-m[specify mtree file]:mtree file:_files'
- '(-b)-o[specify origin]:origin:_files -W ${PORTSDIR\:-/usr/ports} -/'
- '-j[use bzip2]'
- '-z[use gzip]'
- '(-c -d -O -i -I -P -p -k -K -r -s -t -X -D -m -o)-b[specify pkgname]:pkgname:_bsd_pkg_pkgs'
- '*:package file name:_files'
- )
- ;;
netbsd*)
# NetBSD users, improve me!
flags=(
- '*:package name:_bsd_pkg_pkgs'
+ '*:package name:_bsd_pkg_pkgs'
)
;;
esac
- _arguments -s \
- $flags[@]
- ;;
+ _arguments -s $flags[@]
+ ;;
pkg_delete)
flags=(
- '-D[don'\''t execute deinstallation scripts]'
- '-d[remove empty directories]'
- '-f[force deinstallation]'
- '-n[don'\''t really deinstall packages]'
- '-p[specify prefix]:prefix directory:_files -/'
+ "-n[don't really deinstall packages]"
'-v[be verbose]'
)
case "$OSTYPE" in
- freebsd*)
- flags=(
- $flags[@]
- '(:)-a[delete all installed packages]'
- '-G[do not expand glob patterns]'
- '-i[be interactive]'
- '-r[delete recursively]'
- '-x[use regular expression]'
- )
- ;;
netbsd*)
- flags=(
- $flags[@]
- '(:)-a[delete all installed packages]'
- '-F[specify each package by an installed file]'
- '-i[be interactive]'
- '-O[only delete the package'\''s entries]'
+ flags+=(
+ '(:)-a[delete all installed packages]'
+ "-D[don't execute deinstallation scripts]"
+ '-F[specify each package by an installed file]'
+ '-f[force deinstallation]'
+ '-K[override PKG_DBDIR]:pkg_dbdir:_files -/'
+ "-O[only delete the package's entries]"
+ '-P[specify destdir prefix]:destdir directory:_files -/'
+ '-p[specify prefix]:prefix directory:_files -/'
'-R[delete upward recursively]'
'-r[delete recursively]'
- '-V[show version and exit]'
+ '-V[show version and exit]'
+ '(-a)*:package name:_bsd_pkg_pkgs_and_files'
+ )
+ ;;
+ openbsd*)
+ flags+=(
+ '-a[delete unused dependencies]'
+ '-B[specify destdir prefix]:destdir directory:_files -/'
+ '-D[specify failsafe to waive]:failsafe:((
+ baddepend\:"force deletion of packages even if they reference nonexistent dependencies"
+ checksum\:"verify checksums before deleting or tying old files"
+ dependencies\:"delete the set of packages that depend upon the requested packages"
+ nonroot\:"install even if not running as root"
+ scripts\:"external scripts may fail"
+ ))'
+ '-I[force non-interactive mode]'
+ '-i[force interactive mode]'
+ '-m[always display progress meter]'
+ "-qq[don't check checksums]"
+ "-s[don't install; just report disk size changes]"
+ '-V[turn on statistics output]'
+ '-X[delete everything, except the specified packages]'
+ '-x[disable progress meter]'
+ '*:package name:_bsd_pkg_pkgs_and_files'
)
;;
esac
- _arguments -s \
- $flags[@] \
- '(-a)*:package name:_bsd_pkg_pkgs_and_files'
+ _arguments -s $flags[@]
;;
pkg_info)
flags=(
'(:)-a[show all installed packages]'
'-c[show comment fields]'
- '-D[show install-message files]'
'-d[show long descriptions]'
'-e[test if package is installed]:package name:_bsd_pkg_pkgs'
'-f[show packing list instructions]'
'-I[show index lines]'
- '-i[show install scripts]'
- '-k[show deinstall scripts]'
'-L[show full pathnames of files]'
'-l[specify prefix string]:prefix string:'
- '-m[show mtree files]'
- '-p[show installation prefixes]'
'-q[be quiet]'
'-R[show list of installed requiring packages]'
- '-r[show requirements scripts]'
+ '-s[show total size occupied by each package]'
'-v[be verbose]'
+ '(-a -A)*:package name:_bsd_pkg_pkgs_and_files'
)
case "$OSTYPE" in
- freebsd*)
- flags=(
- $flags[@]
- '-G[do not expand glob patterns]'
- '-g[show files that'\''s modified]'
- '-o[show origin]'
- '-s[show total size occupied by each package]'
- '-t[specify mktemp template]:mktemp template:_files -/'
- '*-W[show which package the file belongs to]:file:_files'
- '-x[use regular expression]'
+ netbsd*)
+ flags+=(
+ '-B[show build information]'
+ '-b[show RCS Id strings]'
+ '-D[show install-message files]'
+ '-F[specify each package by an installed file]'
+ '-i[show install scripts]'
+ '-K[override PKG_DBDIR]:pkg_dbdir:_files -/'
+ '-k[show deinstall scripts]'
+ '-m[show mtree files]'
+ '-N[show which packages each package was built with]'
+ '-n[show which packages each package needs]'
+ '-p[show installation prefixes]'
+ '-Q[show the definition of the speficied variable from the build information]:variable:'
+ '-r[show list of installed requiring packages recursively]'
+ '-S[show total size occupied by each package and its dependents]'
+ '-u[show information for all user-installed packages]'
+ '-V[show version and exit]'
+ '-X[print summary information]'
)
;;
- netbsd*)
- flags=(
- $flags[@]
- '-B[show build information]'
- '-b[show RCS Id strings]'
- '-F[specify each package by an installed file]'
- '-S[show total size occupied by each package and its dependents]'
- '-s[show total size occupied by each package]'
- '-V[show version and exit]'
+ openbsd*)
+ flags+=(
+ '(:)-A[show all installed packages, including internal packages]'
+ '-C[show certificate information]'
+ '-E[show the package that contains the speficied file]:file:_files'
+ # XXX only with -L
+ '-K[prefix filenames with category keywords]'
+ '-M[show the install-message file]'
+ '-m[only show manual installations]'
+ '-P[show the pkgpath]'
+ '-Q[show packages matching the specified query]:query:'
+ '-r[check the list of packages for a specified pkgspec]:pkgspec:'
+ '-S[show the update signature]'
+ '-t[show packages not required by any other]'
+ '-U[show the deinstall-message file]'
+ '-z[fuzzy package matching]'
)
;;
esac
- _arguments -s \
- $flags[@] \
- '(-a)*:package name:_bsd_pkg_pkgs_and_files'
+ _arguments -s $flags[@]
;;
esac
}
diff --git a/Completion/BSD/Command/_chflags b/Completion/BSD/Command/_chflags
index 075782cd9..924b09acd 100644
--- a/Completion/BSD/Command/_chflags
+++ b/Completion/BSD/Command/_chflags
@@ -1,64 +1,8 @@
#compdef chflags
-local flags args own='-g *(-u$EUID)'
+local args own='-g *(-u$EUID)'
-addflags() {
- for 1 2; do
- if [[ $1 = no* ]]; then
- flags+=("(${1#no})$1[set the $2 flag]"
- "($1)${1#no}[unset the $2 flag]")
- else
- flags+=("(no$1)$1[set the $2 flag]"
- "($1)no$1[unset the $2 flag]")
- fi
- done
-}
-
-addflags \
- uappnd 'user append-only' \
- uchg 'user immutable'
-
-if (( ! EUID )); then
- addflags \
- arch archived \
- nodump nodump \
- sappnd 'system append-only' \
- schg 'system immutable'
- unset own
-fi
-
-if [[ $OSTYPE = (darwin|dragonfly|freebsd|netbsd)* ]]; then
- addflags opaque opaque
-
- if [[ $OSTYPE = darwin* ]]; then
- addflags hidden hidden
- fi
-
- if [[ $OSTYPE = (dragonfly|freebsd)* ]]; then
- addflags uunlnk 'user undeletable'
- (( EUID )) || addflags sunlnk 'system undeletable'
- fi
-
- [[ $OSTYPE = dragonflybsd* ]] && {
- addflags \
- cache XXX \
- nouhistory 'user nohistory'
-
- (( EUID )) || addflags \
- noscache XXX \
- noshistory 'system nohistory'
- }
-
- [[ $OSTYPE = freebsd* ]] && addflags \
- uarch archive \
- uhidden hidden \
- uoffline offline \
- urdonly 'DOS, Windows and CIFS readonly' \
- ureparse 'Windows reparse point' \
- usparse 'sparse file' \
- usystem 'DOS, Windows and CIFS system'
-
-fi
+(( ! EUID || $+_comp_priv_prefix )) && own=
if [[ $OSTYPE = (darwin|dragonfly|freebsd)* ]]; then
args=(
@@ -68,12 +12,12 @@ if [[ $OSTYPE = (darwin|dragonfly|freebsd)* ]]; then
fi
_arguments -s -A "-*" : $args \
+ ': :_file_flags' \
+ '*:file:_files "$own"' \
- opth \
'-h[act on symlinks]' \
- optR \
'-R[recurse directories]' \
'(-L -P)-H[follow symlinks on the command line (specify with -R)]' \
'(-H -P)-L[follow all symlinks (specify with -R)]' \
- '(-L -H)-P[do not follow symlinks (specify with -R)]' \
- ':file flag:_values -s , "file flags" $flags[@]' \
- '*:file:_files "$own"'
+ '(-L -H)-P[do not follow symlinks (specify with -R)]'
diff --git a/Completion/BSD/Command/_jail b/Completion/BSD/Command/_jail
new file mode 100644
index 000000000..26d0a6a87
--- /dev/null
+++ b/Completion/BSD/Command/_jail
@@ -0,0 +1,53 @@
+#compdef jail
+
+local curcontext="$curcontext" ret=1
+local -a state state_descr line jails running alts suf
+local -A opt_args
+
+_arguments -C -s \
+ '-c[create a new jail]' \
+ '-m[modify an existing jail]' \
+ '-r[remove specified jail]' \
+ '-d[allow changes to a dying jail]' \
+ '-f+[specify configuration file]:config file [/etc/jail.conf]:_files' \
+ '-h[resolve host.hostname and use IP addresses for the jail]' \
+ '(-q)-i[output jail ID of new jails]' \
+ '-J+[write a file containing parameters used to start the jail]:file:_files' \
+ '-p+[limit the number of commands from exec.* that can run simultaneously]:limit' \
+ '(-i -v)-q[suppress the message printed when a jail is created, modified or removed]' \
+ '-R[remove jail without using the configuration file]' \
+ '(-q)-v[print a message on every operation]' \
+ '!-n+:name' '!-l' '!-s+:secure level' \!-{u,U}'+:user:_users' \
+ '*:: :->args' && ret=0
+
+if [[ -n $state ]]; then
+ if compset -P 1 '(^name)='; then
+ case ${IPREFIX%=} in
+ command|exec.*st(art|op)*) _cmdstring && ret=0 ;;
+ depend) _jails && ret=0 ;;
+ path) _directories && ret=0 ;;
+ host|vnet) alts=( 'values:value:(inherit new)' ) ;;
+ ip[46]) alts=( 'values:value:(inherit new disable)' ) ;;
+ *_user) _users && ret=0 ;;
+ *) _message -e values 'value' ;;
+ esac
+ elif compset -P name= || [[ $#line = 1 ]]; then
+ if (( $+opt_args[-r] || $+opt_args[-m] )); then
+ alts=( 'jails:jail:_jails' )
+ elif (( $+opt_args[-c] )); then
+ running=( ${${(f)"$(_call_program jails jls name)"}/ /:} )
+ jails=( ${${(M)${(f)"$(<${opt_args[-f]:-/etc/jail.conf})"}:#[a-z]# #\{#(#e)}%% *} )
+ alts=( "jails:jail:compadd - ${jails:|running}" )
+ fi
+ fi
+ if [[ -z $IPREFIX ]]; then
+ compset -S '=*' || suf=( -qS = )
+ alts+=(
+ 'parameters:parameter:compadd -r "\n\t\- =" - persist allow.{set_hostname,sysvipc,raw_sockets,chflags,mount{,.devfs,.fdescfs,.nullfs,.procfs,.linprocfs,.linsysfs,.tmpfs,.zfs},quotas,socket_af} mount.{devfs,fdescfs,procfs}'
+ 'parameters:parameter:compadd $suf - jid name path ip{4,6}{,.addr{,sel}} vnet host.hostname host securelevel devfs_ruleset children.{max,cur} enforce_statfs cpuset.id osrelease osreldate command exec.{{,pre,post}{start,stop},clean,jail_user,system{,_jail}_user,timeout,consolelog,fib} stop.timeout {vnet.,}interface ip_hostname mount{,.fstab} depend'
+ )
+ fi
+ (( $#alts )) && _alternative $alts && ret=0
+fi
+
+return ret
diff --git a/Completion/BSD/Command/_jexec b/Completion/BSD/Command/_jexec
index 85829d10e..6a2d05a81 100644
--- a/Completion/BSD/Command/_jexec
+++ b/Completion/BSD/Command/_jexec
@@ -4,7 +4,7 @@ _jexec_normal() {
local PATH=$PATH
local -a _comp_priv_prefix
# relative paths are relative to the jail's root
- path=( "$(command jls -j $words[1] path)"/$^path )
+ path=( "$(_call_program paths jls -j $words[1] path)"/$^path )
shift 1 words; (( CURRENT-- ))
_normal
}
diff --git a/Completion/BSD/Command/_pfctl b/Completion/BSD/Command/_pfctl
index 1a2345b66..23898882f 100644
--- a/Completion/BSD/Command/_pfctl
+++ b/Completion/BSD/Command/_pfctl
@@ -1,25 +1,23 @@
#compdef pfctl
local pfctl_flush_modifiers pfctl_optimizer_level pfctl_show_modifiers pfctl_tables_command pfctl_debug_level
+local -a args
pfctl_flush_modifiers=(
- 'all:flush all'
- 'info:flush the filter information'
- 'nat:flush the NAT rules'
- 'osfp:flush the passive operating system fingerprints'
- 'queue:flush the queue rules'
- 'rules:flush the filter rules'
- 'state:flush the stable table'
- 'Sources:flush the source tracking table'
- 'Tables:flush the tables'
+ 'rules:flush the filter rules'
+ 'states:flush the stable table'
+ 'Sources:flush the source tracking table'
+ 'info:flush the filter information'
+ 'Tables:flush the tables'
+ 'osfp:flush the passive operating system fingerprints'
+ 'all:flush all'
)
pfctl_show_modifiers=(
- 'nat:show the currently loaded NAT rules'
'queue:show the currently loaded queue rules'
'rules:show the currently loaded filter rules'
'Anchors:show the currently loaded anchors directly attached to the main ruleset'
- 'state:show the contents of the state table'
+ 'states:show the contents of the state table'
'Sources:show the contents of the source tracking table'
'info:show filter information'
'labels:show per-rule statistics of filter rules with labels'
@@ -36,6 +34,7 @@ pfctl_optimizer_level=(
'basic:enable basic ruleset optimizations'
'profile:enable basic ruleset optimizations with profiling'
)
+
pfctl_tables_command=(
'kill:kill a table'
'flush:flush all addresses of a table'
@@ -48,49 +47,75 @@ pfctl_tables_command=(
'zero:clear all the statistics of a table'
'load:load only the table definitions from pf.conf(5)'
)
-pfctl_debug_level=(
- "none:don\'t generate debug messages"
- 'urgent:generate debug messages only for serious errors'
- 'misc:generate debug messages for various errors'
- 'loud:generate debug messages for common conditions'
-)
-_iface() {
- local pfctl_iface
- pfctl_iface=($(pfctl -s Interfaces))
- compadd $pfctl_iface
+
+_pf_ifaces() {
+ compadd "$@" - $(_call_program tables pfctl -s Interfaces)
}
-_tables() {
- local pfctl_tables
- pfctl_tables=($(pfctl -s Tables))
- compadd $pfctl_tables
+
+_pf_tables() {
+ compadd "$@" - $(_call_program tables pfctl -s Tables)
}
-# TODO:
-# Missing -a
-#
-_arguments -s \
- '-F[flush the filter parameters specified by modifier]:modifier:(($pfctl_flush_modifiers))' \
- '-A[load only the queue rules present in the rule file]' \
- '-D[define macro to be set to value]:macro:' \
- '-d[disable the packet filter]' \
- '-e[enable the packet filter]' \
- '-f[load the rules contained in a file]:configuration file:_files' \
- '-g[include output helpful for debugging]' \
- '-h[help]' \
- '-i[restrict the operation to the given interface]:interface:_iface' \
- '-K[kill all of the source tracking entries originating from the specified host or network]:host or network:_hosts' \
- '-k[kill all of the state entries originating from the specified host or network]:host or network:_hosts' \
- '-m[merge in explicitly given options]' \
- '-N[load only the NAT rules present in the rule file]' \
- '-n[do not actually load rules, just parse them]' \
- '-O[load only the options present in the rule file]' \
- '-o[control the ruleset optimizer]:level:(($pfctl_optimizer_level))' \
- '-p[use the device file device instead of the default /dev/pf]:device:_files' \
- '-q[only print errors and warnings]' \
- '-R[load only the filter rules present in the rule file]' \
- '-r[perform reverse DNS lookups on states when displaying them]' \
- '-s[show the filter parameters specified by modifier]:modifier:(($pfctl_show_modifiers ))' \
- '-T[specify the command to apply to the table]:command:(($pfctl_tables_command))' \
- '-t[specify the name of the table]:table:_tables' \
- '-v[produce more verbose output]' \
- '-x[set the debug level]:debug level:(($pfctl_debug_level))' \
- '-z[clear per-rule statistics]'
+
+case $OSTYPE in
+ openbsd*)
+ pfctl_debug_level=(
+ emerg alert crit err warning notice info debug
+ )
+ args=(
+ '-L+[load pf states from specified state file]:file:_files'
+ "-N[don't perform domain name resolution]"
+ '-P[display ports using service names]'
+ '-S+[store pf state table in the specified file]:file:_files'
+ '-V+[select routing domain to be used to kill states]:routing domain'
+ )
+ ;;
+ (free|net)bsd*)
+ pfctl_debug_level=(
+ "none:don\'t generate debug messages"
+ 'urgent:generate debug messages only for serious errors'
+ 'misc:generate debug messages for various errors'
+ 'loud:generate debug messages for common conditions'
+ )
+ pfctl_flush_modifiers+=(
+ 'nat:flush the NAT rules'
+ 'queue:flush the queue rules'
+ )
+ pfctl_show_modifiers+=(
+ 'nat:show the currently loaded NAT rules'
+ )
+ args=(
+ '-A[load only the queue rules present in the rule file]'
+ '-N[load only the NAT rules present in the rule file]'
+ '-O[load only the options present in the rule file]'
+ '-R[load only the filter rules present in the rule file]'
+ )
+ ;|
+ freebsd*)
+ args+=( '-P[display ports numerically]' )
+ ;;
+esac
+
+_arguments -s $args \
+ '-a[apply flags -f, -F, and -s only to the rules in the specified anchor]:anchor' \
+ '-F+[flush the filter parameters specified by modifier]:modifier:(($pfctl_flush_modifiers))' \
+ '-D+[define macro to be set to value]:macro' \
+ '(-e)-d[disable the packet filter]' \
+ '(-D)-e[enable the packet filter]' \
+ '-f+[load the rules contained in a file]:configuration file:_files' \
+ '-g[include output helpful for debugging]' \
+ '(-)-h[display help information]' \
+ '-i[restrict the operation to the given interface]:interface:_pf_ifaces' \
+ '*-K[kill all of the source tracking entries originating from the specified host or network]:host or network:_hosts' \
+ '*-k[kill all of the state entries originating from the specified host or network]:host or network:_hosts' \
+ '-m[merge in explicitly given options without disturbing others]' \
+ "-n[don't actually load rules, just parse them]" \
+ '-o+[control the ruleset optimizer]:level:(($pfctl_optimizer_level))' \
+ '-p+[use the device file device instead of the default /dev/pf]:device:_files' \
+ '-q[only print errors and warnings]' \
+ '-r[perform reverse DNS lookups on states when displaying them]' \
+ '-s+[show the filter parameters specified by modifier]:modifier:(($pfctl_show_modifiers))' \
+ '-T+[specify the command to apply to the table]:command:(($pfctl_tables_command))' \
+ '-t[specify the name of the table]:table:_pf_tables' \
+ '-v[produce more verbose output]' \
+ '-x+[set the debug level]:debug level:(($pfctl_debug_level))' \
+ '-z[clear per-rule statistics]'
diff --git a/Completion/BSD/Command/_portsnap b/Completion/BSD/Command/_portsnap
index 0803a842e..b8e1c2555 100644
--- a/Completion/BSD/Command/_portsnap
+++ b/Completion/BSD/Command/_portsnap
@@ -1,6 +1,6 @@
#compdef portsnap
-local curcontext="$curcontext" state line
+local curcontext="$curcontext" state line flags
typeset -A opt_args
flags=(
diff --git a/Completion/BSD/Command/_sysrc b/Completion/BSD/Command/_sysrc
index 246d73bd3..f0c12a2be 100644
--- a/Completion/BSD/Command/_sysrc
+++ b/Completion/BSD/Command/_sysrc
@@ -44,9 +44,13 @@ _sysrc() {
local k v opt
if (( $+opt_args[lista--L] )); then
_services && ret=0
- elif [[ -prefix *=* ]]; then
- # do you really want to go down this hole?
- _message -e values value
+ elif compset -P 1 '*='; then
+ case $IPREFIX in
+ *_enable=) _wanted values expl value compadd YES NO && ret=0 ;;
+ *_program=) _files -g "*(-*)" && ret=0 ;;
+ *_interface(|s)=) _net_interfaces && ret=0 ;;
+ *) _message -e values value ;;
+ esac
else
if zstyle -T ":completion:${curcontext%:*}:values" verbose; then
opt=d
diff --git a/Completion/BSD/Type/_fbsd_architectures b/Completion/BSD/Type/_fbsd_architectures
new file mode 100644
index 000000000..24bdf4620
--- /dev/null
+++ b/Completion/BSD/Type/_fbsd_architectures
@@ -0,0 +1,6 @@
+#autoload
+
+local expl
+
+_description architectures expl 'architecture'
+compadd "$@" "$expl[@]" amd64 arm arm64 i386 mips ppc sparc xbox
diff --git a/Completion/BSD/Type/_file_flags b/Completion/BSD/Type/_file_flags
new file mode 100644
index 000000000..95044121c
--- /dev/null
+++ b/Completion/BSD/Type/_file_flags
@@ -0,0 +1,70 @@
+#autoload
+
+# Provides completion for file flags (formerly part of _chflags)
+
+local curcontext=$curcontext su=$(( ! EUID || $+_comp_priv_prefix ))
+local -a context line state state_descr copts=( "${@}" ) flags flag_descs
+local -A val_args
+
+flag_descs+=(
+ uappnd 'user append-only'
+ uchg 'user immutable'
+)
+
+if (( su )); then
+ flag_descs+=(
+ arch archived
+ nodump nodump
+ sappnd 'system append-only'
+ schg 'system immutable'
+ )
+fi
+
+if [[ $OSTYPE = (darwin|dragonfly|freebsd|netbsd)* ]]; then
+ flag_descs+=(opaque opaque)
+
+ if [[ $OSTYPE = darwin* ]]; then
+ flag_descs+=(hidden hidden)
+ fi
+
+ if [[ $OSTYPE = (dragonfly|freebsd)* ]]; then
+ flag_descs+=(uunlnk 'user undeletable')
+
+ (( su )) &&
+ flag_descs+=(sunlnk 'system undeletable')
+ fi
+
+ if [[ $OSTYPE = dragonfly* ]]; then
+ flag_descs+=(
+ cache XXX
+ nouhistory 'user nohistory'
+ )
+
+ (( su )) && flag_descs+=(
+ noscache XXX
+ noshistory 'system nohistory'
+ )
+ fi
+
+ [[ $OSTYPE = freebsd* ]] && flag_descs+=(
+ uarch archive
+ uhidden hidden
+ uoffline offline
+ urdonly 'DOS, Windows and CIFS readonly'
+ ureparse 'Windows reparse point'
+ usparse 'sparse file'
+ usystem 'DOS, Windows and CIFS system'
+ )
+fi
+
+for 1 2 in $flag_descs; do
+ if [[ $1 = no* ]]; then
+ flags+=("(${1#no})$1[set the $2 flag]"
+ "($1)${1#no}[unset the $2 flag]")
+ else
+ flags+=("(no$1)$1[set the $2 flag]"
+ "($1)no$1[unset the $2 flag]")
+ fi
+done
+
+_values -O copts -s , 'file flags' $flags
diff --git a/Completion/BSD/Type/_nbsd_architectures b/Completion/BSD/Type/_nbsd_architectures
new file mode 100644
index 000000000..441b874da
--- /dev/null
+++ b/Completion/BSD/Type/_nbsd_architectures
@@ -0,0 +1,11 @@
+#autoload
+
+local expl
+
+_description architectures expl 'architecture'
+compadd "$@" "$expl[@]" amd64 evbarm evbmips evbppc hpcarm i386 sparc64 xen \
+ acorn32 algor alpha amiga amigappc arc atari bebox cats cesfic cobalt dreamcast \
+ emips epoc32 evbsh3 ews4800mips hp300 hppa hpcmips hpcsh ia64 ibmnws iyonix \
+ landisk luna68k mac68k macppc mipsco mmeye mvme68k mvmeppc netwinder news68k \
+ newsmips next68k ofppc pmax prep rs6000 sandpoint sbmips sgimips shark sparc \
+ sun2 sun3 vax x68k zaurus
diff --git a/Completion/BSD/Type/_obsd_architectures b/Completion/BSD/Type/_obsd_architectures
new file mode 100644
index 000000000..ca3e0e12f
--- /dev/null
+++ b/Completion/BSD/Type/_obsd_architectures
@@ -0,0 +1,6 @@
+#autoload
+
+local expl
+
+_description architectures expl 'architecture'
+compadd "$@" "$expl[@]" alpha amd64 arm64 armv7 hppa i386 landisk longson luna88k macppc octeon sgi sparc64
diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand
index a6e30e891..ee3681bad 100644
--- a/Completion/Base/Completer/_expand
+++ b/Completion/Base/Completer/_expand
@@ -43,7 +43,8 @@ zstyle -s ":completion:${curcontext}:" accept-exact tmp ||
if [[ "$tmp" != (yes|true|on|1) ]]; then
{ [[ "$word" = \~(|[-+]) ||
- ( "$word" = \~[-+][1-9]## && $word[3,-1] -le $#dirstack ) ]] && return 1 }
+ ( "$word" = \~[-+][1-9]## && $word[3,-1] -le $#dirstack ) ||
+ $word = \~\[*\]/* ]] && return 1 }
{ [[ ( "$word" = \~* && ${#userdirs[(I)${word[2,-1]}*]}+${#nameddirs[(I)${word[2,-1]}*]} -gt 1 ) ||
( "$word" = *\$[a-zA-Z0-9_]## &&
${#parameters[(I)${word##*\$}*]} -ne 1 ) ]] && continue=1 }
diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments
index d2c0d33de..136dd5826 100644
--- a/Completion/Base/Utility/_arguments
+++ b/Completion/Base/Utility/_arguments
@@ -43,7 +43,7 @@ if (( long )); then
name="${name//[^a-zA-Z0-9_]/_}"
if (( ! ${(P)+name} )); then
- local iopts sopts pattern tmpo dir cur cache
+ local iopts sopts lflag pattern tmpo dir cur cache
typeset -Ua lopts
cache=()
@@ -55,7 +55,12 @@ if (( long )); then
iopts=()
sopts=()
- while [[ "$1" = -[is]* ]]; do
+ while [[ "$1" = -[lis]* ]]; do
+ if [[ "$1" = -l ]]; then
+ lflag='-l'
+ shift
+ continue
+ fi
if [[ "$1" = -??* ]]; then
tmp="${1[3,-1]}"
cur=1
@@ -88,7 +93,8 @@ if (( long )); then
# option up to the end.
tmp=()
- _call_program options ${~words[1]} --help 2>&1 | while IFS= read -r opt; do
+ _call_program $lflag options ${~words[1]} --help 2>&1 |
+ while IFS= read -r opt; do
if (( ${#tmp} )); then
# Previous line had no comment. Is the current one suitable?
# It's hard to be sure, but if it there was nothing on the
diff --git a/Completion/Base/Utility/_call_program b/Completion/Base/Utility/_call_program
index 9a44f2d8e..73f3ef6d2 100644
--- a/Completion/Base/Utility/_call_program
+++ b/Completion/Base/Utility/_call_program
@@ -1,6 +1,6 @@
#autoload +X
-local curcontext="${curcontext}" tmp err_fd=-1
+local curcontext="${curcontext}" tmp err_fd=-1 clocale='_comp_locale;'
local -a prefix
if [[ "$1" = -p ]]; then
@@ -10,6 +10,9 @@ if [[ "$1" = -p ]]; then
zstyle -t ":completion:${curcontext}:${1}" gain-privileges &&
prefix=( $_comp_priv_prefix )
fi
+elif [[ "$1" = -l ]]; then
+ shift
+ clocale=''
fi
if (( ${debug_fd:--1} > 2 )) || [[ ! -t 2 ]]
@@ -21,12 +24,12 @@ fi
if zstyle -s ":completion:${curcontext}:${1}" command tmp; then
if [[ "$tmp" = -* ]]; then
- eval "$tmp[2,-1]" "$argv[2,-1]"
+ eval $clocale "$tmp[2,-1]" "$argv[2,-1]"
else
- eval $prefix "$tmp"
+ eval $clocale $prefix "$tmp"
fi
else
- eval $prefix "$argv[2,-1]"
+ eval $clocale $prefix "$argv[2,-1]"
fi 2>&$err_fd
} always {
diff --git a/Completion/Darwin/Command/_caffeinate b/Completion/Darwin/Command/_caffeinate
new file mode 100644
index 000000000..9e361a5bd
--- /dev/null
+++ b/Completion/Darwin/Command/_caffeinate
@@ -0,0 +1,12 @@
+#compdef caffeinate
+
+_arguments -s -S : \
+ '-d[prevent display sleep]' \
+ '-i[prevent system idle sleep]' \
+ '-m[prevent disk idle sleep]' \
+ '-s[prevent system sleep (AC power only)]' \
+ '-u[declare that user is active]' \
+ '(:)-t[specify assertion timeout value]:timeout (seconds)' \
+ '(:)-w[wait for specified PID]: :_pids' \
+ '(-)1: : _command_names -e' \
+ '(-)*::command argument'
diff --git a/Completion/Darwin/Command/_mdfind b/Completion/Darwin/Command/_mdfind
new file mode 100644
index 000000000..b38b0ee91
--- /dev/null
+++ b/Completion/Darwin/Command/_mdfind
@@ -0,0 +1,29 @@
+#compdef mdfind
+
+local ret=1
+local -a context line state state_descr tmp
+local -A opt_args val_args
+
+_arguments -s -S : \
+ '(-count)-0[separate result paths by NUL]' \
+ '(-0)-count[display count of results instead of paths]' \
+ '(-literal)-interpret[interpret query as if entered in Spotlight search field]' \
+ '(-interpret)-literal[interpret query as literal query string]' \
+ '-live[provide live updates to query results]' \
+ '-onlyin[limit search to specified directory]: :_directories' \
+ '(: -s)*-name[search for files with names matching specified string]:file name string' \
+ '-reprint[reprint -live results on update]' \
+ '(: -name)-s[show contents of specified smart folder]: :->smart-folders' \
+ '(-s -name)1: :_guard "^-*" "query"' \
+&& ret=0
+
+[[ $state == smart-folders ]] && {
+ tmp=( "$HOME/Library/Saved Searches/"*.savedSearch(-.N:r:t) )
+ if (( $#tmp )); then
+ _values 'smart folder' $tmp && ret=0
+ else
+ _message 'smart folder' && ret=0
+ fi
+}
+
+return ret
diff --git a/Completion/Darwin/Command/_mdls b/Completion/Darwin/Command/_mdls
new file mode 100644
index 000000000..853cafd08
--- /dev/null
+++ b/Completion/Darwin/Command/_mdls
@@ -0,0 +1,9 @@
+#compdef mdls
+
+# Note: The inconsistent use of the -o+ option variant here is deliberate
+_arguments -s -S : \
+ '*'{-n+,-name}'[restrict output to specified attribute]:attribute' \
+ '(-p -plist)-nullMarker[specify string used for null values]:string' \
+ '(-p -r -nullMarker -plist -raw)'{-p,-plist}'[output in XML plist format to specified file]:output file:_files' \
+ '(-p -r -plist -raw)'{-r,-raw}'[print raw (NUL-delimited) attribute data]' \
+ '*: :_files'
diff --git a/Completion/Darwin/Command/_mdutil b/Completion/Darwin/Command/_mdutil
new file mode 100644
index 000000000..abac690ac
--- /dev/null
+++ b/Completion/Darwin/Command/_mdutil
@@ -0,0 +1,19 @@
+#compdef mdutil
+
+# @todo This isn't fully comprehensive, but it's unclear from the documentation
+# how some of these options are meant to work together or what kind of arguments
+# they expect
+
+local -a volumes=( / /Volumes/*(N) )
+
+_arguments -s -S : \
+ '(-V)-a[apply to all volumes]' \
+ '-d[disable Spotlight activity]' \
+ '-E[erase and rebuild index]' \
+ '-i[toggle indexing status]:indexing status:(on off)' \
+ '-p[publish metadata]' \
+ '-s[print indexing status]' \
+ '(: -)-t[resolve files from specified file ID]:file ID, volume path, or device ID: :file ID' \
+ "(-a)-V[apply to stores on specified volume]:volume:(${(j< >)${(@q-)volumes}})" \
+ '-v[output verbosely]' \
+ "*:volume:(${(j< >)${(@q-)volumes}})"
diff --git a/Completion/Darwin/Command/_nvram b/Completion/Darwin/Command/_nvram
new file mode 100644
index 000000000..8158eb9d2
--- /dev/null
+++ b/Completion/Darwin/Command/_nvram
@@ -0,0 +1,30 @@
+#compdef nvram
+
+local ret=1
+local -a context line state state_descr tmp
+local -A opt_args val_args
+
+# Note: -x can only be used with -f/-p, but must be used first to have effect
+_arguments -s : \
+ '(: -)-c[delete all NVRAM variables]' \
+ '(: -)-d[delete specified NVRAM variable]: :->variables-ro' \
+ '(: -)-f[set NVRAM variables from file]: :_files' \
+ '(: -)-p[print all NVRAM variables]' \
+ '(-c -d)-x[use XML format for input and output]' \
+ '(-)*: :->variables-rw' \
+&& ret=0
+
+[[ $state == variables-* ]] && {
+ tmp=( ${${(f)"$( command $service -p )"}%%[[:space:]]*} )
+
+ [[ $state == variables-rw ]] &&
+ tmp=( ${^tmp}'::NVRAM variable value' )
+
+ if (( $#tmp )); then
+ _values -w 'NVRAM variable' $tmp && ret=0
+ else
+ _message 'NVRAM variable' && ret=0
+ fi
+}
+
+return ret
diff --git a/Completion/Darwin/Command/_osascript b/Completion/Darwin/Command/_osascript
new file mode 100644
index 000000000..5e4a5f70c
--- /dev/null
+++ b/Completion/Darwin/Command/_osascript
@@ -0,0 +1,34 @@
+#compdef osascript
+
+local ret=1
+local -a context line state state_descr tmp
+local -A opt_args val_args
+
+_arguments -s -S : \
+ '-l+[specify script language]: :->languages' \
+ '(:)*-e+[execute specified line of script]:script' \
+ '-i[run interactively]' \
+ '*-s+[specify output style]: :->modifiers' \
+ '(-e)1:script file:_files' \
+&& ret=0
+
+case $state in
+ languages)
+ # So far, the three languages specified here are the only ones supported,
+ # but adding the output of osalang makes this future-proof
+ _values 'script language' \
+ AppleScript JavaScript 'Generic Scripting System' \
+ ${(f)"$( command osalang 2> /dev/null )"} \
+ && ret=0
+ ;;
+ modifiers)
+ _values -S '' 'output modifier flag' \
+ 'h[print values in human-readable form]' \
+ 's[print values in recompilable source form]' \
+ 'e[print script errors to stderr]' \
+ 'o[print script errors to stdout]' \
+ && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/Darwin/Command/_otool b/Completion/Darwin/Command/_otool
new file mode 100644
index 000000000..8c6c00867
--- /dev/null
+++ b/Completion/Darwin/Command/_otool
@@ -0,0 +1,47 @@
+#compdef otool llvm-otool
+#
+local opts args files variant curcontext=$context state state_descr line
+typeset -A opt_args
+
+_arguments \
+ '-a[display the archive header]' \
+ '-S[display the contents of the __.SYMDEF file]' \
+ '-f[display the universal headers]' \
+ '-h[display the Mach header]' \
+ '-l[display the load commands]' \
+ '-L[display names and versions of shared libs that the object file uses]' \
+ '-D[display just the internal name of shared lib]' \
+ '-s[display the contents of the specified section]:segment name: :section name: ' \
+ '-t[display the contents of (__TEXT,__text) section]' \
+ '-d[display the contents of (__DATA,__data) section]' \
+ '-o[display the contents of __OBJC segment]' \
+ '-r[display the relocation entries]' \
+ '-c[display the argument strings from a core file]' \
+ '-I[display the indirect symbol table]' \
+ '-T[display the table of contents for a dynamic shared library]' \
+ '-R[display the reference table of a dynamic shared library]' \
+ '-M[display the module table of dymamic shared library]' \
+ '-H[display the two-level namespace hints table]' \
+ '-G[display the data in code table]' \
+ '-C[display the linker optimization hints]' \
+ '-P[print the info_plist section as strings]' \
+ '-p[with -t and -v/V: start disassembly from the specified symbol]:symbol name: ' \
+ '-v[display verbosely (symbolically) when possible]' \
+ '-V[display disassembled operands symbolically]' \
+ "-X[don't print leading addresses/headers with disassembly]" \
+ '-q[use the llvm disassembler (default)]' \
+ '-mcpu=[use the specified cpu for the llvm disassembler]:target:->targets' \
+ '-function_offsets[with disassembly, print decimal offset from the last label]' \
+ '-j[with disassembly, print opcode bytes]' \
+ "-Q[use otool's disassembler]" \
+ '-arch[select the specified architecture from a universal file]:arch:(i386 x86_64)' \
+ '-m[object file names are not assuemd to be in archive(member) syntax]' \
+ '(- *)--version[print version of otool]' \
+ '*:file:_object_files' && return 0
+
+case $state in
+ targets)
+ _values "target architecture" "${(z)${(@)${(f)$(_call_program targets
+ ${~words[1]} --version 2>/dev/null)##*Registered Targets:}/ -*}}"
+ ;;
+esac
diff --git a/Completion/Darwin/Command/_pbcopy b/Completion/Darwin/Command/_pbcopy
new file mode 100644
index 000000000..fd60f00cc
--- /dev/null
+++ b/Completion/Darwin/Command/_pbcopy
@@ -0,0 +1,30 @@
+#compdef pbcopy pbpaste
+
+local ret=1
+local -a context line state state_descr args
+local -A opt_args val_args
+
+args=(
+ '(-)-help[display help information]'
+ '-pboard[specify pasteboard to copy to or paste from]: :->pboards'
+)
+[[ $service == pbpaste ]] & args+=(
+ '-Prefer[specify type of data to prefer when pasting]: :->dtypes'
+)
+
+_arguments : $args && ret=0
+
+case $state in
+ dtypes)
+ _values 'data type' \
+ 'txt[plain text]' \
+ 'rtf[rich text]' \
+ 'ps[encapsulated PostScript]' \
+ && ret=0
+ ;;
+ pboards)
+ _values pasteboard general ruler find font && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/Darwin/Command/_plutil b/Completion/Darwin/Command/_plutil
new file mode 100644
index 000000000..8138a5c5e
--- /dev/null
+++ b/Completion/Darwin/Command/_plutil
@@ -0,0 +1,53 @@
+#compdef plutil
+
+local ret=1 k v
+local -a context line state state_descr tmp fmts=( xml1 binary1 json )
+local -A opt_args val_args types=(
+ -bool 'boolean'
+ -data 'base64-encoded data'
+ -date 'date (XML property-list format)'
+ -float '64-bit float'
+ -integer '64-bit integer'
+ -json 'JSON fragment'
+ -xml 'XML property list'
+)
+
+_arguments -s -S : \
+ '(: -)-help[display help information]' \
+ '(-p -r)-s[suppress normal output]' \
+ '*:input file:_files' \
+ - set1 \
+ '-lint[check input for syntax errors]' \
+ - set2 \
+ "(-extract -insert -replace -remove)-convert[convert to specified format]:output format:(${(j< >)fmts})" \
+ "(-convert -insert -replace -remove)-extract[extract value at specified key path from property list]: :->k:output format:(${(j< >)fmts})" \
+ '(-convert -extract -replace -remove)-insert[insert value at specified key path into property list]: :->k: :->t: :->v' \
+ '(-convert -extract -insert -remove)-replace[replace value at specified key path in property list]: :->k: :->t: :->v' \
+ '(-convert -extract -insert -replace)-remove[remove value at specified key path from property list]: :->k' \
+ '(-o -extract -insert -replace -remove)-e[specify output file extension]:output file extension' \
+ '(-e -extract -insert -replace -remove)-o[specify output file]:output file:_files' \
+ '(-r -s)-p[pretty-print property list]' \
+ '(-p -s)-r[pretty-print JSON]' \
+&& ret=0
+
+case $state in
+ k) _message 'key path' && ret=0 ;;
+ t)
+ tmp=()
+ for k v in ${(kv)types}; do
+ tmp+=( "${k}[${v}]" )
+ done
+ _values 'value type' $tmp && ret=0
+ ;;
+ v)
+ if [[ $words[(CURRENT - 1)] == -bool ]]; then
+ _values $types[-bool] YES NO true false && ret=0
+ elif (( $+types[$words[(CURRENT - 1)]] )); then
+ _message $types[$words[(CURRENT - 1)]] && ret=0
+ else
+ _message value && ret=0
+ fi
+ ;;
+esac
+
+return ret
diff --git a/Completion/Darwin/Command/_say b/Completion/Darwin/Command/_say
new file mode 100644
index 000000000..d687cfa11
--- /dev/null
+++ b/Completion/Darwin/Command/_say
@@ -0,0 +1,85 @@
+#compdef say
+
+local ret=1
+local -a context line state state_descr tmp
+local -A opt_args val_args
+
+_arguments -s -S : \
+ '(-a --audio-device)'{-a+,--audio-device=}'[specify audio device]: :->devices' \
+ '--bit-rate=[specify bit rate]: :->bit-rates' \
+ '--channels=[specify number of channels]:number of channels' \
+ '--data-format=[specify output data format]: :->data-formats' \
+ '(: -f --input-file)'{-f+,--input-file=}'[specify input file]:input file:_files' \
+ '--file-format=[specify output file format]: :->file-formats' \
+ '(-i --interactive)-i[display/highlight text as it is spoken]' \
+ '(-i --interactive)--interactive=[display/highlight text as it is spoken]:: :->markups' \
+ '(-o --output-file)'{-o+,--output-file=}'[specify output file]:output file:_files' \
+ '(-n --network-send)'{-n+,--network-send=}'[specify network service/port]:network service/port' \
+ '--progress[display progress meter]' \
+ '--quality=[specify converter quality level]:quality level (0-127)' \
+ '(-r --rate)'{-r+,--rate=}'[specify speech rate]:speech rate (words per minute)' \
+ '(-v --voice)'{-v+,--voice=}'[specify voice]: :->voices' \
+ '(-f)*: :_guard "^-*" "text to speak"' \
+&& ret=0
+
+case $state in
+ bit-rates)
+ # A file format must have already been provided in order to complete these;
+ # also, not every file format supports bit-rate values
+ (( $+opt_args[--file-format] )) && {
+ tmp=( ${(f)"$(
+ command $service \
+ --file-format=${opt_args[--file-format]##*:} \
+ --bit-rate='?' 2> /dev/null
+ )"} )
+ tmp=( ${tmp//[[:space:]]##/} )
+ }
+ if (( $#tmp )); then
+ _values 'bit rate' $tmp && ret=0
+ else
+ _message 'bit rate' && ret=0
+ fi
+ ;;
+ data-formats)
+ # A file format must have already been provided in order to complete these
+ if (( ! $+opt_args[--file-format] )); then
+ _message 'data format' && ret=0
+ else
+ tmp=( ${(f)"$(
+ command $service \
+ --file-format=${opt_args[--file-format]##*:} \
+ --data-format='?' 2> /dev/null
+ )"} )
+ tmp=( ${tmp//:/\\:} )
+ tmp=( ${^tmp/[[:space:]]##/[}\] )
+ _values 'data format' $tmp && ret=0
+ fi
+ ;;
+ devices)
+ tmp=( ${(f)"$( command $service -a '?' 2> /dev/null )"} )
+ tmp=( ${tmp##[[:space:]]#[0-9]##[[:space:]]##} )
+ tmp=( ${tmp//:/\\:} )
+ _values 'audio device name or ID' $tmp && ret=0
+ ;;
+ file-formats)
+ tmp=( ${(f)"$( command $service --file-format='?' 2> /dev/null )"} )
+ tmp=( ${tmp%%[[:space:]]##\(.*} )
+ tmp=( ${tmp//:/\\:} )
+ tmp=( ${^tmp/[[:space:]]##/[}\] )
+ _values 'file format' $tmp && ret=0
+ ;;
+ markups)
+ tmp=( bold smso smul ${(k)terminfo} )
+ _alternative \
+ 'colors:color:(black red green yellow blue magenta cyan white)' \
+ "capabilities:terminfo capability:( ${(j< >)tmp} )" \
+ && ret=0
+ ;;
+ voices)
+ tmp=( ${(f)"$( command $service -v '?' 2> /dev/null )"} )
+ tmp=( ${tmp%%[[:space:]](#c2,)*} )
+ _values voice $tmp && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/Darwin/Command/_scselect b/Completion/Darwin/Command/_scselect
new file mode 100644
index 000000000..79df2f981
--- /dev/null
+++ b/Completion/Darwin/Command/_scselect
@@ -0,0 +1,39 @@
+#compdef scselect
+
+local ret=1 u l
+local -a context line state state_descr tmp loc1 loc2
+local -A opt_args
+
+_arguments -s -S : \
+ '-n[delay changing until next boot]' \
+ '1: :->locations' \
+&& ret=0
+
+[[ $state == locations ]] && {
+ # For some reason scselect expects location names to be encoded in Mac OS
+ # Roman; in order to prevent completed arguments from breaking the tool, we'll
+ # insert the UUID instead if the name would contain incompatible characters
+ tmp=( ${(f)"$( command $service 2> /dev/null )"} )
+ tmp=( ${tmp[2,-1]} )
+ tmp=( ${tmp##[*[:space:]]##} )
+ tmp=( ${tmp//:/\\:} )
+ tmp=( ${tmp/[[:space:]]##\(/$'\0'} )
+ tmp=( ${tmp%\)} )
+
+ for u l in "${(@0)tmp}"; do
+ loc1+=( "${l}:${u}" )
+ if [[ $l == [[:ascii:]]## ]]; then
+ loc2+=( $l )
+ else
+ loc2+=( $u )
+ fi
+ done
+
+ if (( $#loc1 )); then
+ _describe location loc1 loc2 && ret=0
+ else
+ _message location && ret=0
+ fi
+}
+
+return ret
diff --git a/Completion/Darwin/Command/_scutil b/Completion/Darwin/Command/_scutil
new file mode 100644
index 000000000..6c0a84d64
--- /dev/null
+++ b/Completion/Darwin/Command/_scutil
@@ -0,0 +1,56 @@
+#compdef scutil
+
+local ret=1
+local -a context line state state_descr
+local -A opt_args val_args
+
+# Don't complete host names unless we have -r (this is weird, but the obvious
+# alternative (exclusion sets) currently doesn't work properly with option
+# stacking)
+(( ! $words[(I)-*] || ($words[(I)-W] && ! $words[(I)-r]) )) &&
+: ${PREFIX:=-}
+
+# @todo We could complete nc-cmd arguments better if we wanted to
+_arguments -s -S -A '-*' : \
+ + '(g1)' \
+ '(: -)--dns[display current DNS configuration]' \
+ '(: -)--get[display specified preference]: :->prefs' \
+ '(: -)--nc[interact with VPN connections]: :->nc-cmd:*:argument' \
+ '(: -)--prefs[interface with raw preference data]:preference file:_files' \
+ '(: -)--proxy[display current proxy configuration]' \
+ '(: -)--set[set specified preference]: :->prefs:value' \
+ + g2 \
+ '(g1 g3)-r[check network reachability]' \
+ '(g1 g3)-W[monitor (watch) network reachability]' \
+ '(g1 g3)1:host:_hosts' \
+ '(g1 g3)2::host:_hosts' \
+ + g3 \
+ '(g1 g2)-w[wait for key to exist in dynamic store]' \
+ '(g1 g2)-t+[specify timeout]:timeout (seconds)' \
+&& ret=0
+
+case $state in
+ nc-cmd)
+ _values command \
+ 'disablevpn[disable specified service or VPN application type]' \
+ 'enablevpn[enable specified service or VPN application type]' \
+ 'help[display command help]' \
+ 'list[list services]' \
+ 'ondemand[display VPN on-demand information]' \
+ 'resume[resume specified service]' \
+ 'select[make specified service active]' \
+ 'show[display configuration information for specified service]' \
+ 'start[start specified service]' \
+ 'statistics[display statistics for specified service]' \
+ 'status[display status for specified service]' \
+ 'stop[stop specified service]' \
+ 'suspend[suspend specified service]' \
+ 'trigger[trigger VPN on-demand with specified host]' \
+ && ret=0
+ ;;
+ prefs)
+ _values preference ComputerName HostName LocalHostName && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/Darwin/Command/_sw_vers b/Completion/Darwin/Command/_sw_vers
new file mode 100644
index 000000000..11814e0b0
--- /dev/null
+++ b/Completion/Darwin/Command/_sw_vers
@@ -0,0 +1,6 @@
+#compdef sw_vers
+
+_arguments : \
+ '(-)-buildVersion[display build version only]' \
+ '(-)-productName[display product name only]' \
+ '(-)-productVersion[display product version only]'
diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt
index 074fb0164..645b02279 100644
--- a/Completion/Debian/Command/_apt
+++ b/Completion/Debian/Command/_apt
@@ -408,12 +408,13 @@ _apt-cmd () {
/$'policy\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
/$'update\0'/ \| \
\( \
- /$'install\0'\|$'download\0'\|$'source\0'\|$'build-dep\0'/ \
- /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \
- \( \
- /$'[^\0/]#/'/ /$'[^\0/]#\0'/ ':release name::_apt_releases' \| \
- /$'[^\0=]#='/ /$'[^\0=]#\0'/ ':package version::_apt_versions_of_binary_package' \
- \) \
+ /$'(install|download|source|build-dep)\0'/ -'subcmd=${match%?}' \
+ /$'[^\0]#\0'/ ':packages::_deb_packages -qr "\n\t\- /=" "$expl_packages[@]" avail' \# \
+ \( \
+ // '%(.|)/%' -'[[ $subcmd = install ]]' /'[]'/ ':files:package file:_files -g "*.deb(-.)"' \| \
+ /$'[^\0/=]#\/'/ /'[]'/ ':apt-releases:release name:_apt_releases' \| \
+ /$'[^\0/=]#='/ /'[]'/ ':apt-package-versions:package version:_apt_versions_of_binary_package' \| \
+ \) \
\) \| \
/$'remove\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
/$'purge\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
@@ -427,7 +428,7 @@ _apt-cmd () {
/"[]"/ ':argument-1::compadd "$expl_action[@]" list search showsrc show depends rdepends policy update install download source build-dep remove upgrade full-upgrade dist-upgrade edit-sources autoclean changelog autoremove purge'
_apt-cmd () {
- local expl_action expl_packages
+ local expl_action expl_packages subcmd
_description actions expl_action 'action'
_description packages expl_packages 'package'
@@ -475,11 +476,11 @@ _apt-get () {
/$'upgrade\0'/ \| \
\( \
/$'install\0'\|$'download\0'\|$'source\0'\|$'build-dep\0'/ \
- /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \
- \( \
- /$'[^\0/]#/'/ /$'[^\0/]#\0'/ ':release name::_apt_releases' \| \
- /$'[^\0=]#='/ /$'[^\0=]#\0'/ ':package version::_apt_versions_of_binary_package' \
- \) \
+ /$'[^\0]#\0'/ ':packages::_deb_packages -qr "\n\t\- /=" "$expl_packages[@]" avail' \# \
+ \( \
+ /$'[^\0/=]#/'/ /'[]'/ ':apt-releases:release name:_apt_releases' \| \
+ /$'[^\0/=]#='/ /'[]'/ ':apt-package-versions:package version:_apt_versions_of_binary_package' \
+ \) \
\) \| \
/$'remove\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
/$'purge\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
@@ -609,7 +610,7 @@ _apt_releases_update () {
then
local -a tmp=("${(f)$(apt-cache policy)}")
_apt_releases=(
-${${${${(M)tmp:#*release*}#*a=}%%,*}:#now}
+${${${${(M)tmp:#*release*a=*}#*a=}%%,*}:#now}
${${${${(M)tmp:#*release*n=*}#*n=}%%,*}:#now}
)
typeset -U _apt_releases
@@ -662,7 +663,7 @@ _apt_versions_of_binary_package() {
done
done
- _describe -t apt-package-versions "package versions" kv "$@"
+ _describe -t apt-package-versions 'package version' kv "$@"
}
_apt_caching_policy () {
diff --git a/Completion/Debian/Command/_aptitude b/Completion/Debian/Command/_aptitude
index b2b54599f..f79a100a8 100644
--- a/Completion/Debian/Command/_aptitude
+++ b/Completion/Debian/Command/_aptitude
@@ -80,7 +80,7 @@ _arguments -C \
case $state in
cmds)
- cmds=( ${${(M)${(f)"$(LC_ALL=C _call_program commands aptitude -h 2>/dev/null)"}:# [^- ][^ ]## *}/(#b) ([^ ]##) ##(- )#([^- ]*)/$match[1]:$match[3]:l})
+ cmds=( ${${(M)${(f)"$(_call_program commands aptitude -h 2>/dev/null)"}:# [^- ][^ ]## *}/(#b) ([^ ]##) ##(- )#([^- ]*)/$match[1]:$match[3]:l})
_describe -t commands 'aptitude command' cmds && ret=0
;;
diff --git a/Completion/Debian/Command/_deborphan b/Completion/Debian/Command/_deborphan
new file mode 100644
index 000000000..9f6df6f65
--- /dev/null
+++ b/Completion/Debian/Command/_deborphan
@@ -0,0 +1,42 @@
+#compdef deborphan
+
+local keep=(/var/lib/deborphan/keep(N) /dev/null)
+_arguments : \
+ {--help,-h}'[help]' \
+ {--status-file,-f}'[specify status file]:file:_files' \
+ {--version,-v}'[version]' \
+ {--show-deps,-d}'[show dependencies for packages that have them]' \
+ {--show-priority,-P}'[show priority of packages found]' \
+ {--show-section,-s}'[show the sections the packages are in]' \
+ --no-show-section'[do not show sections]' \
+ {--show-size,-z}'[show installed size of packages found]' \
+ {--all-packages,-a}'[compare all packages, not just libs]' \
+ {--exclude,-e}'[work as if specified packages were not installed]:packages:_sequence _deb_packages - avail' \
+ {--force-hold,-H}'[ignore hold flags]' \
+ {--nice-mode,-n}'[disable checks for "recommends" and "suggests"]' \
+ --ignore-recommends'[disable checks for recommends]' \
+ --ignore-suggests'[disable checks for "suggests"]' \
+ {--priority,-p}'[select only packages with at least specified priority]:priority:' \
+ --find-config'[find "orphaned" configuration files]' \
+ --libdevel'[search in libdevel in addition to libs and oldlibs]' \
+ {--add-keep,-A}'[packages to never report]:*:package:_deb_packages installed' \
+ {--keep-file,-k}'[file to get/store info about kept packages]:file:_files' \
+ {--list-keep,-L}'[list the packages that are never reported]' \
+ {--del-keep,-R}"[packages to remove from the 'keep' file]:*:package:compadd -X 'kept package' $(< $keep[1])" \
+ {--zero-keep,-Z}'[remove all packages from the "keep" file]' \
+ --guess-common'[try to report common packages]' \
+ --guess-data'[try to report data packages]' \
+ --guess-debug'[try to report debugging libraries]' \
+ --guess-dev'[try to report development packages]' \
+ --guess-doc'[try to report documentation packages]' \
+ --guess-dummy'[try to report dummy packages]' \
+ --guess-kernel'[try to report kernel modules]' \
+ --guess-interpreters'[try to report interpreter libraries]' \
+ --guess-mono'[try to report mono libraries]' \
+ --guess-perl'[try to report perl libraries]' \
+ --guess-pike'[try to report pike libraries]' \
+ --guess-python'[try to report python libraries]' \
+ --guess-ruby'[try to report ruby libraries]' \
+ --guess-section'[try to report libraries in wrong sections]' \
+ --guess-all'[try all of the above]' \
+ --guess-only'[use --guess options only]'
diff --git a/Completion/Linux/Command/_chattr b/Completion/Linux/Command/_chattr
new file mode 100644
index 000000000..bf46d8b89
--- /dev/null
+++ b/Completion/Linux/Command/_chattr
@@ -0,0 +1,42 @@
+#compdef chattr
+
+local ret=1
+local -a context line state state_descr
+local -A opt_args val_args
+
+_arguments -s -S : \
+ '-f[suppress most error messages]' \
+ "-p+[set file's project number]:project number" \
+ '-R[act recursively]' \
+ '-V[output verbosely]' \
+ "-v+[set file's version/generation number]:version/generation number" \
+ '1: :->attrs' \
+ '*: :_files' \
+&& ret=0
+
+[[ $state == attrs ]] &&
+if compset -P '*[=+-]'; then
+ # These modes can't be changed with chattr: [EhINXZ]
+ _values -S '' attribute \
+ 'A[no atime updates]' \
+ 'a[append only]' \
+ 'C[no copy on write]' \
+ 'c[compressed]' \
+ 'D[no synchronous directory updates]' \
+ 'd[no dump]' \
+ 'e[extent format]' \
+ 'i[immutable]' \
+ 'j[data journalling]' \
+ 'P[project hierarchy]' \
+ 'S[synchronous updates]' \
+ 's[secure deletion]' \
+ 'T[top of directory hierarchy]' \
+ 't[no tail-merging]' \
+ 'u[undeletable]' \
+ && ret=0
+else
+ compset -P '*'
+ _values -S '' operator = + - && ret=0
+fi
+
+return ret
diff --git a/Completion/Linux/Command/_chrt b/Completion/Linux/Command/_chrt
index f82ec8b81..6789b66cf 100644
--- a/Completion/Linux/Command/_chrt
+++ b/Completion/Linux/Command/_chrt
@@ -1,61 +1,68 @@
#compdef chrt
-local context state line
+local curcontext="$curcontext" cmd="$words[1]" ret=1
+local -a state line expl
typeset -A opt_args
-_arguments \
+_arguments -C -s -S -A "-*" \
+ '(H -a --all-tasks)'{-a,--all-tasks}'[operate on all tasks (threads) for a given pid]' \
+ '(H)'{-v,--verbose}'[display status information]' \
+ '(H)'{-p,--pid}'[interpret args as process ID]' \
+ '(H -R --reset-on-fork -b --batch -d --deadline -i --idle -o --other)'{-R,--reset-on-fork}'[set SCHED_RESET_ON_FORK for FIFO or RR]' \
+ '(H)*::command or priority:->cmd_or_prio' \
+ + 'H' \
+ '(* -)'{-m,--max}'[show minimum and maximum valid priorities, then exit]' \
'(* -)'{-h,--help}'[display usage information]' \
'(* -)'{-V,--version}'[output version information]' \
- {-v,--verbose}'[display status information]' \
- {-p,--pid}'[interpret args as process ID]' \
- '(-b --batch -f --fifo -o --other -r --rr)'{-b,--batch}'[set scheduling policy to SCHED_BATCH]' \
- '(-b --batch -f --fifo -o --other -r --rr)'{-f,--fifo}'[set scheduling policy to SCHED_FIFO]' \
- '(-b --batch -f --fifo -o --other -r --rr)'{-o,--other}'[set policy scheduling policy to SCHED_OTHER]' \
- '(-b --batch -f --fifo -o --other -r --rr)'{-r,--rr}'[set scheduling policy to SCHED_RR]' \
- '(* -)'{-m,--max}'[show minimum and maximum valid priorities, then exit]' \
- '*::command or priority:->cmd_or_prio' \
- && return 0
+ + 'dline' \
+ '(H -T --sched-runtime -b --batch -f --fifo -i --idle -o --other -r --rr)'{-T,--sched-runtime}'[runtime parameter for DEADLINE]' \
+ '(H -P --sched-period -b --batch -f --fifo -i --idle -o --other -r --rr)'{-P,--sched-period}'[period parameter for DEADLINE]' \
+ '(H -D --sched-deadline -b --batch -f --fifo -i --idle -o --other -r --rr)'{-D,--sched-deadline}'[deadline parameter for DEADLINE]' \
+ + '(policy)' \
+ '(H dline -R --reset-on-fork)'{-b,--batch}'[set scheduling policy to SCHED_BATCH]' \
+ '(H -R --reset-on-fork)'{-d,--deadline}'[set scheduling policy to SCHED_DEADLINE]' \
+ '(H dline)'{-f,--fifo}'[set scheduling policy to SCHED_FIFO]' \
+ '(H dline -R --reset-on-fork)'{-i,--idle}'[set scheduling policy to SCHED_IDLE]' \
+ '(H dline -R --reset-on-fork)'{-o,--other}'[set scheduling policy to SCHED_OTHER]' \
+ '(H dline)'{-r,--rr}'[set scheduling policy to SCHED_RR (default)]' && ret=0
_chrt_priority()
{
- local ty
- if (( $+opt_args[-b] || $+opt_args[--batch] ))
- then
- ty=BATCH
- elif (( $+opt_args[-f] || $+opt_args[--fifo] ))
- then
- ty=FIFO
- elif (( $+opt_args[-o] || $+opt_args[--other] ))
- then
- ty=OTHER
- else
- ty=RR
- fi
- local range
- range=${${"$(_call_program priorities chrt --max)"#*SCHED_$ty*: }%$'\n'*}
- if [[ $range = 0/0 ]]
- then
- compadd 0
- else
- _message -e priority "priority in the range $range"
- fi
+ local ty
+ [[ -prefix - ]] && return 1
+ if (( $+opt_args[policy--b] || $+opt_args[policy---batch] )); then
+ ty=BATCH
+ elif (( $+opt_args[policy--f] || $+opt_args[policy---fifo] )); then
+ ty=FIFO
+ elif (( $+opt_args[policy--o] || $+opt_args[policy---other] )); then
+ ty=OTHER
+ else
+ ty=RR
+ fi
+ local range
+ range=${${(M)${(f)"$(_call_program priorities $cmd --max)"}:#*_${ty}*}#*: }
+ if [[ $range = 0/0 ]]; then
+ _wanted priorites expl 'priority' compadd 0
+ else
+ _message -e priorities "priority (range $range)"
+ fi
}
if (( $+opt_args[-p] || $+opt_args[--pid] ))
then
- if [[ $CURRENT -eq 1 ]]
- then
- _alternative \
- 'priority:priority:_chrt_priority' \
- 'processes:process IDs:_pids'
- else
- _pids
- fi
-elif [[ $CURRENT -eq 1 ]]
-then
- _chrt_priority
+ if (( CURRENT == 1 )); then
+ _alternative \
+ 'priority:priority:_chrt_priority' \
+ 'processes:process IDs:_pids' && ret=0
+ else
+ _pids && ret=0
+ fi
+elif (( CURRENT == 1 )); then
+ _chrt_priority && ret=0
else
- shift words
- (( CURRENT-- ))
- _normal
+ shift words
+ (( CURRENT-- ))
+ _normal && ret=0
fi
+
+return ret
diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup
index 0e7a5d37e..ea7152ea1 100644
--- a/Completion/Linux/Command/_cryptsetup
+++ b/Completion/Linux/Command/_cryptsetup
@@ -3,47 +3,86 @@
local curcontext="$curcontext" ret=1
local -a actions state line expl
-_arguments \
+_arguments -s \
'(-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' \
+ '(-c --cipher)'{-c+,--cipher=}'[set cipher]:cipher specification' \
+ '(-h --hash)'{-h+,--hash=}'[hash algorithm]:hash algorithm' \
'(-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]:size (bytes)' \
- '--new-keyfile-size[set new keyfile size (luksAddKey)]:size (bytes)' \
- '--master-key-file[set master key]:key file:_files' \
+ '(-d --key-file)'{-d+,--key-file=}'[set keyfile]:key file:_files' \
+ '--master-key-file=[set master key]:key file:_files' \
'--dump-master-key[dump luks master key]' \
+ '(-s --key-size)'{-s+,--key-size=}'[set key size]:size (bits)' \
+ '(-l --keyfile-size)'{-l+,--keyfile-size=}'[set keyfile size]:size (bytes)' \
+ '--keyfile-offset=[specify number of bytes to skip in keyfile]:offset (bytes)' \
+ '--new-keyfile-size=[set new keyfile size (luksAddKey)]:size (bytes)' \
+ '--new-keyfile-offset=[specify number of bytes to skip in newly added keyfile]:offset (bytes)' \
+ '(-S --key-slot)'{-S+,--key-slot=}'[select key slot]:key slot' \
+ '(-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' \
+ '(-r --readonly)'{-r,--readonly}'[create a read-only mapping]' \
+ '(-i --iter-time)'{-i+,--iter-time=}'[set password processing duration]:duration (milliseconds)' \
+ '(-q --batch-mode)'{-q,--batch-mode}"[don't ask for confirmation]" \
+ '(-t --timeout)'{-t+,--timeout=}'[set password prompt timeout]:timeout (seconds)' \
+ '--progress-frequency=[specify progress line update interval]:interval (seconds)' \
+ '(-T --tries)'{-T+,--tries=}'[set maximum number of retries]:number of retries' \
+ '--align-payload=[set payload alignment]:sectors' \
+ '--header-backup-file=[specify file with LUKS header and keyslots backup]:file:_files' \
'(--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]: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]:duration (milliseconds)' \
- '(-q --batch-mode)'{-q,--batch-mode}'[do not ask for confirmation]' \
- '(-t --timeout)'{-t,--timeout}'[set password prompt timeout]:timeout (seconds)' \
- '(-T --tries)'{-T,--tries}'[set maximum number of retries]:number of retries' \
- '--align-payload[set payload alignment]:sectors' \
- '--uuid[set device UUID]:uuid' \
+ '--shared[share device with another non-overlapping crypt segment]' \
+ '--uuid=[set device UUID]:uuid' \
+ '--allow-discards[allow discards (aka TRIM) requests for device]' \
+ '--header=[device or file with separated LUKS header]:file:_files' \
+ '--test-passphrase[do not activate device, just check passphrase]' \
+ '--tcrypt-hidden[use hidden header (hidden TCRYPT device)]' \
+ '--tcrypt-system[device is system TCRYPT drive (with bootloader)]' \
+ '--tcrypt-backup[use backup (secondary) TCRYPT header]' \
+ '--veracrypt[scan also for VeraCrypt compatible device]' \
+ '--veracrypt-pim=[specify personal iteration multiplier for VeraCrypt compatible device]:multiplier' \
+ '--veracrypt-query-pim[query personal iteration multiplier for VeraCrypt compatible device]' \
+ '(-M --type)'{-M+,--type=}'[specify type of device metadata]:type:(luks plain loopaes tcrypt)' \
+ '--force-password[disable password quality check (if enabled)]' \
+ '--perf-same_cpu_crypt[use dm-crypt same_cpu_crypt performance compatibility option]' \
+ '--perf-submit_from_crypt_cpus[use dm-crypt submit_from_crypt_cpus performance compatibility option]' \
+ '--deferred[device removal is deferred until the last user closes it]' \
+ '--pbkdf=[specify PBKDF algorithm for LUKS2]:algorithm:(argon2i argon2id pbkdf2)' \
+ '--pbkdf-memory=[specify PBKDF memory cost limit]:limit (kilobytes)' \
+ '--pbkdf-parallel=[specify PBKDF parallel cost]:threads' \
+ '--pbkdf-force-iterations=[specify PBKDF iterations cost]:cost' \
+ '--priority=[specify keyslot priority]:priority:(ignore normal prefer)' \
+ '--disable-locks[disable locking of on-disk metadata]' \
+ '--disable-keyring[disable loading volume keys via kernel keyring]' \
+ '(-I --integrity)'{-I+,--integrity=}'[specify data integrity algorithm (LUKS2 only)]:algorithm' \
+ '--integrity-no-journal[disable journal for integrity device]' \
+ "--integrity-no-wipe[don't wipe device after format]" \
+ "--token-only[don't ask for passphrase if activation by token fails]" \
+ '--token-id=[specify token number]:number [any]' \
+ '--key-description=[specify key description]:description' \
+ '--sector-size=[specify encryption sector size]:size [512 bytes]' \
+ '--persistent[set activation flags persistent for device]' \
+ '--label=[set label for the LUKS2 device]:label' \
+ '--subsystem=[set subsystem label for the LUKS2 device]:subsystem' \
'(- : *)--version[show version information]' \
+ '(- : *)'{-\?,--help}'[display help information]' \
+ '(- : *)--usage[display brief usage]' \
':action:->actions' \
'*::arguments:->action-arguments' && ret=0
case $state in
actions)
actions=(
- 'create:create a mapping'
- 'remove:remove an existing mapping'
+ 'open:open device with named mapping'
+ 'close:close device (remove mapping)'
'status:report mapping status'
'resize:resize an active mapping'
+ 'benchmark:benchmark cipher'
+ 'repair:try to repair on-disk metadata'
+ 'erase:erase all keyslots'
+ 'convert:convert LUKS from/to LUKS2 format'
+ 'config:set permanent configuration options for LUKS2'
'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'
@@ -51,6 +90,9 @@ case $state in
'luksUUID:print/change device UUID'
'isLuks:check if device is a LUKS partition'
'luksDump:dump header information'
+ 'tcryptDump:dump TCRYPT device information'
+ 'luksSuspend:suspend LUKS device and wipe key'
+ 'luksResume:resume suspended LUKS device'
'luksHeaderBackup:store binary backup of headers'
'luksHeaderRestore:restore header backup'
)
@@ -61,18 +103,21 @@ case $state in
local mapping=':mapping:_path_files -W /dev/mapper'
local device=':device:_files'
case ${words[1]} in
- create) args=( $mapping $device );;
+ create) args=( $mapping $device '--type=:type' );;
+ open) args=( $device $mapping '--type=:type' );;
+ (plain|luks|loopaes|tcrypt)Open) args=( $device $mapping '--type=:type' );;
+ benchmark) args=( '--cipher=:cipher' );;
luksKillSlot) args=( $device ':key slot number' );;
- luksOpen) args=( $device $mapping );;
- remove|status|resize|luksClose|luksSuspend|luksResume) args=( $mapping );;
- luks(AddKey|RemoveKey|DelKey|UUID|Dump)|isLuks) args=( $device );;
+ remove|status|resize|*lose|luksSuspend|luksResume) args=( $mapping );;
+ erase|convert|config|repair|(luks(AddKey|Erase|RemoveKey|DelKey|UUID|Dump)|isLuks))
+ args=( $device )
+ ;;
luks(Format|AddKey|RemoveKey|ChangeKey))
args=( $device ':key file:_files' )
;;
luksHeader*) args=( $device '--header-backup-file:file:_files' );;
*)
- _default
- return
+ _default && ret=0
;;
esac
_arguments $args && ret=0
diff --git a/Completion/Linux/Command/_ethtool b/Completion/Linux/Command/_ethtool
index 71f5ed3bf..52b8f0451 100644
--- a/Completion/Linux/Command/_ethtool
+++ b/Completion/Linux/Command/_ethtool
@@ -1,164 +1,290 @@
#compdef ethtool
-local -a expl cmds
+local curcontext="$curcontext"
+local -a state line expl cmds
+local -A opt_args
-if [[ $CURRENT -ge 4 ]]; then
- case $words[CURRENT-1] in
- rx|tx)
- [[ $words[2] = '-G' ]] && _message -e n 'number of ring entries' || _wanted -x onoff expl 'enabled' compadd off on
- ;;
- autoneg|adaptive-rx|adaptive-tx|raw|hex|sg|tso|ufo|gso)
- _wanted -x onoff expl 'enabled' compadd off on
- ;;
- rx-usecs|rx-frames|rx-usecs-irq|rx-frames-irq|tx-usecs|tx-frames|tx-usecs-irq|tx-frames-irq|stats-block-usecs|pkt-rate-low|rx-usecs-low|rx-frames-low|tx-usecs-low|tx-frames-low|pkt-rate-high|rx-usecs-high|rx-frames-high|tx-usecs-high|tx-frames-high|sample-interval|rx-mini|rx-jumbo|offset|length|magic|value|phyad|msglvl)
- _message -e n 'number'
- ;;
- speed)
- _wanted -x speed expl 'speed' compadd 10 100 1000
- ;;
- duplex)
- _wanted -x duplex expl 'duplex mode' compadd half full
- ;;
- port)
- _wanted -x port expl 'device port' compadd tp aui bnc mii
- ;;
- advertise)
- _values 'hexidecimal value (or a combination of the following)' \
- '0x001[10 half]' \
- '0x002[10 full]' \
- '0x004[100 half]' \
- '0x008[100 full]' \
- '0x010[1000 half(not supported by IEEE standards)]' \
- '0x020[1000 full]' \
- '0x8000[2500 full(not supported by IEEE standards)]' \
- '0x800[10000 full]' \
- '0x03F[auto]'
- ;;
- xcvr)
- _wanted -x xcvr expl 'transceiver type' compadd internal external
- ;;
- wol)
- _values -s '' 'Wake-on-LAN options' \
- '(d)p[wake on phy activity]' \
- '(d)u[wake on unicast messages]' \
- '(d)m[wake on multicast messages]' \
- '(d)b[wake on broadcast messages]' \
- '(d)a[wake on ARP]' \
- '(d)g[wake on MagicPacket(tm)]' \
- '(d)s[enable SecureOn(tm) password for MagicPacket(tm)]' \
- '(p u m b a g s)d[disable (wake on nothing)]'
- ;;
- sopass)
- _message -e secureon 'password - 6 bytes in ethernet MAC hex format (xx:yy:zz:aa:bb:cc)'
- ;;
- file)
- _wanted files expl 'raw register dump files' _files
- ;;
- *)
- case $words[2] in
- -A|--pause)
- _values -S ' ' -w 'pause options' \
- 'autoneg[specify if pause autonegotiation is enabled]' \
- 'rx[specify if RX pause is enabled]' \
- 'tx[specify if TX pause is enabled]'
- ;;
- -C|--coalesce)
- _values -S ' ' -w 'coalescing settings' \
- 'adaptive-rx' 'adaptive-tx' \
- 'rx-usecs' 'rx-frames' 'rx-usecs-irq' 'rx-frames-irq' \
- 'tx-usecs' 'tx-frames' 'tx-usecs-irq' 'tx-frames-irq' \
- 'stats-block-usecs' \
- 'pkt-rate-low' \
- 'rx-usecs-low' 'rx-frames-low' \
- 'tx-usecs-low' 'tx-frames-low' \
- 'pkt-rate-high' \
- 'rx-usecs-high' 'rx-frames-high' \
- 'tx-usecs-high' 'tx-frames-high' \
- 'sample-interval'
- ;;
- -G|--set-ring)
- _values -S ' ' -w 'ring parameters' \
- 'rx[change number of ring entries for the RX ring]' \
- 'rx-mini[change number of ring entries for the RX Mini ring]' \
- 'rx-jumbo[change number of ring entries for the RX Jumbo ring]' \
- 'tx[change number of ring entries for the TX ring]'
- ;;
- -d|--register-dump)
- _values -S ' ' -w 'register dump options' \
- 'hex[dump hex register data]' \
- 'raw[dump raw register data]' \
- 'file[use contents from file rather than device]'
- ;;
- -e|--eeprom-dump)
- _values -S ' ' -w 'EEPROM dump options' \
- 'raw[dump raw EEPROM data]' \
- 'offset[dump certain portions of the EEPROM]' \
- 'length[dump certain portions of the EEPROM]'
- ;;
- -E|--change-eeprom)
- _values -S ' ' -w 'EEPROM values' \
- 'magic[device-specific key]' \
- 'offset[select byte]' \
- 'value[new value]'
- ;;
- -K|--offload)
- _values -S ' ' -w 'offload options' \
- 'rx[specify if RX checksumming is enabled]' \
- 'tx[specify if TX checksumming is enabled]' \
- 'sg[specify if scatter-gather is enabled]' \
- 'tso[specify if TCP segmentation offload is enabled]' \
- 'ufo[specify if UDP segmentation offload is enabled]' \
- 'gso[specify if generic segmentation offload is enabled]'
- ;;
- -p|--identify)
- [[ $CURRENT -eq 4 ]] && _message -e length 'seconds'
- ;;
- -t|--test)
- _values -S ' ' -w 'selftest option' \
- '(online)offline:perform full set of tests possibly causing normal operation interruption (default)]' \
- '(offline)online:perform limited set of tests do not interrupting normal adapter operation]'
- ;;
- -s|--change)
- _values -S ' ' -w 'change setting' \
- 'speed[set speed in Mb/s]' \
- 'duplex[set full or half duplex mode]' \
- 'port[select device port]' \
- 'autoneg[specify if autonegotiation is enabled]' \
- 'advertise[set the speed and duplex advertised by autonegotiation]' \
- 'phyad[PHY address]' \
- 'xcvr[select transceiver type]' \
- 'wol[set Wake-on-LAN options]' \
- 'sopass[set the SecureOn(tm) password]' \
- 'msglvl[set the driver message level]'
- ;;
- esac
- ;;
- esac
-fi
-
-cmds=(-h -a -A -c -C -g -G -i -d -e -E -k -K -p -r -S -t -s
- --help --show-pause --pause --show-coalesce --coalesce --show-ring
- --set-ring --driver --register-dump --eeprom-dump --change-eeprom
- --show-offload --offload --identify --negotiate --statistics --test --change)
+_arguments -C \
+ "1:interface:_net_interfaces" \
+ '*: :->args' \
+ + '(cmds)' \
+ '(1)'{-h,--help}'[display help information]' \
+ '(1)--version[display version information]' \
+ {-s,--change}'[allow changing some or all settings of the specified ethernet device]' \
+ {-a,--show-pause}'[query the specified ethernet device for pause parameter information]' \
+ {-A,--pause}'[change the pause parameters of the specified ethernet device]' \
+ {-c,--show-coalesce}'[query the specified ethernet device for coalescing information]' \
+ {-C,--coalesce}'[change the coalescing settings of the specified ethernet device]' \
+ {-g,--show-ring}'[query the specified ethernet device for RX/TX ring parameter information]' \
+ {-G,--set-ring}'[change the RX/TX ring parameters of the specified ethernet device]' \
+ {-k,--show-features,--show-offload}'[query the specified ethernet device for offload information]' \
+ {-K,--features,--offload}'[change the offload parameters of the specified ethernet device]' \
+ {-i,--driver}'[query the specified ethernet device for associated driver information]' \
+ {-d,--register-dump}'[retrieve and prints a register dump for the specified ethernet device]' \
+ {-e,--eeprom-dump}'[retrieve and prints an EEPROM dump for the specified ethernet device]' \
+ {-E,--change-eeprom}'[change EEPROM byte for the specified ethernet device]' \
+ {-r,--negotiate}'[restart auto-negotiation on the specified ethernet device]' \
+ {-p,--identify}'[initiate adapter-specific action intended to identify the adapter by sight]' \
+ {-t,--test}'[execute adapter selftest on the specified ethernet device]' \
+ {-S,--statistics}'[query specified ethernet device for NIC- and driver-specific statistics]' \
+ '--phy-statistics[show phy statistics]' \
+ {-n,--show-nfc,-u,--show-ntuple}'[retrieve receive network flow classification options or rules]' \
+ {-N,--config-nfc,-U,--config-ntuple}'[configure receive network flow classification options or rules]' \
+ {-T,--show-time-stamping}"[show device's time stamping capabilities]" \
+ {-x,--show-rxfh-indir,--show-rxfh}'[show Rx flow hash indirection table and/or RSS hash key]' \
+ {-X,--set-rxfh-indir,--rxfh}'[set Rx flow hash indirection table and/or RSS hash key]' \
+ {-f,--flash}'[flash firmware image from the specified file]' \
+ {-P,--show-permaddr}'[show permanent hardware address]' \
+ {-w,--get-dump}'[get dump flag, data]' \
+ {-W,--set-dump}'[set device dump flag]' \
+ {-l,--show-channels}'[query channels]' \
+ {-L,--set-channels}'[set channels]' \
+ '--show-priv-flags[query private flags]' \
+ '--set-priv-flags[set private flags]' \
+ {-m,--dump-module-eeprom,--module-info}'[show module EEPROM information]' \
+ '--show-eee[show EEE settings]' \
+ '--set-eee[set EEE settings]' \
+ '--set-phy-tunable[set PHY tunable]' \
+ '--get-phy-tunable[get PHY tunable]' \
+ '--reset[reset hardware components]' \
+ '--show-fec[query device for forward error correction support]' \
+ '--set-fec[configure forward error correction for device]' && return
-_arguments \
- "($cmds)1:interface:_net_interfaces" \
- "($cmds 1)"{-h,--help}'[shows a short help message]' \
- "($cmds)"{-a,--show-pause}'[queries the specified ethernet device for pause parameter information]' \
- "($cmds)"{-A,--pause}'[change the pause parameters of the specified ethernet device]' \
- "($cmds)"{-c,--show-coalesce}'[queries the specified ethernet device for coalescing information]' \
- "($cmds)"{-C,--coalesce}'[change the coalescing settings of the specified ethernet device]' \
- "($cmds)"{-g,--show-ring}'[queries the specified ethernet device for RX/TX ring parameter information]' \
- "($cmds)"{-G,--set-ring}'[change the RX/TX ring parameters of the specified ethernet device]' \
- "($cmds)"{-i,--driver}'[queries the specified ethernet device for associated driver information]' \
- "($cmds)"{-d,--register-dump}'[retrieves and prints a register dump for the specified ethernet device]' \
- "($cmds)"{-e,--eeprom-dump}'[retrieves and prints an EEPROM dump for the specified ethernet device]' \
- "($cmds)"{-E,--change-eeprom}'[changes EEPROM byte for the specified ethernet device]' \
- "($cmds)"{-k,--show-offload}'[queries the specified ethernet device for offload information]' \
- "($cmds)"{-K,--offload}'[change the offload parameters of the specified ethernet device]' \
- "($cmds)"{-p,--identify}'[initiates adapter-specific action intended to identify the adapter by sight]' \
- "($cmds)"{-r,--negotiate}'[restarts auto-negotiation on the specified ethernet device]' \
- "($cmds)"{-S,--statistics}'[queries the specified ethernet device for NIC- and driver-specific statistics]' \
- "($cmds)"{-t,--test}'[executes adapter selftest on the specified ethernet device]' \
- "($cmds)"{-s,--change}'[allows changing some or all settings of the specified ethernet device]' \
- '*:' && ret=0
+if [[ -n $state ]]; then
+ case $words[CURRENT-1] in
+ rx|tx)
+ if (( $+opt_args[cmds--G] + $+opt_args[cmds---set-ring] )); then
+ _message -e numbers 'number of ring entries'
+ elif (( $+opt_args[cmds--L] + $+opt_args[cmds---set-channels] )); then
+ _message -e numbers 'number of channels'
+ else
+ _wanted onoff expl 'enabled' compadd off on
+ fi
+ ;;
+ autoneg|adaptive-[rt]x|raw|hex|sg|tso|ufo|gso|lro|eee|tx-lpi|downshift)
+ _wanted onoff expl 'enabled' compadd off on
+ ;;
+ rx-usecs|rx-frames|rx-usecs-irq|rx-frames-irq|tx-usecs|tx-frames) ;&
+ tx-usecs-irq|tx-frames-irq|stats-block-usecs|pkt-rate-low|rx-usecs-low) ;&
+ rx-frames-low|tx-usecs-low|tx-frames-low|pkt-rate-high|rx-usecs-high) ;&
+ rx-frames-high|tx-usecs-high|tx-frames-high|sample-interval|dmac|rx-mini) ;&
+ rx-jumbo|offset|length|magic|value|phyad|proto|tos|tclass|l4proto|src-port) ;&
+ dst-port|spi|l4data|vlan-etype|vlan|user-def|action|vf|queue|loc|delete) ;&
+ other|combined|tx-timer|count)
+ _message -e numbers 'number'
+ ;;
+ speed)
+ _wanted -x speed expl 'speed' compadd 10 100 1000
+ ;;
+ duplex)
+ _wanted duplex expl 'duplex mode' compadd half full
+ ;;
+ port)
+ _wanted port expl 'device port' compadd tp aui bnc mii fibre
+ ;;
+ advertise)
+ _values 'hexadecimal value (or a combination of the following)' \
+ '0x001[10 half]' \
+ '0x002[10 full]' \
+ '0x004[100 half]' \
+ '0x008[100 full]' \
+ '0x010[1000 half(not supported by IEEE standards)]' \
+ '0x020[1000 full]' \
+ '0x8000[2500 full(not supported by IEEE standards)]' \
+ '0x800[10000 full]' \
+ '0x03F[auto]'
+ ;;
+ xcvr)
+ _wanted xcvr expl 'transceiver type' compadd internal external
+ ;;
+ wol)
+ _values -s '' 'Wake-on-LAN option' \
+ '(d)p[wake on phy activity]' \
+ '(d)u[wake on unicast messages]' \
+ '(d)m[wake on multicast messages]' \
+ '(d)b[wake on broadcast messages]' \
+ '(d)a[wake on ARP]' \
+ '(d)g[wake on MagicPacket(tm)]' \
+ '(d)s[enable SecureOn(tm) password for MagicPacket(tm)]' \
+ '(p u m b a g s)d[disable (wake on nothing)]'
+ ;;
+ sopass)
+ _message -e secureon 'password - 6 bytes in ethernet MAC hex format (xx:yy:zz:aa:bb:cc)'
+ ;;
+ data|file)
+ _wanted files expl 'file' _files
+ ;;
+ rx-flow-hash)
+ _wanted flow-types expl 'flow type' compadd {tcp,udp,ah,esp,sctp}{4,6}
+ ;;
+ rule)
+ _message -e ids 'rule id'
+ ;;
+ flow-type)
+ _wanted flow-types expl 'flow type' compadd ether {tcp,udp,ah,esp,sctp}{4,6}
+ ;;
+ src|src-ip|dst|dst-ip|dst-mac)
+ _message -e addresses address
+ ;;
+ m)
+ _message -e masks mask
+ ;;
+ hkey)
+ _message -e keys expl 'hash key'
+ ;;
+ hfunc)
+ _message -e functions expl 'hash function'
+ ;;
+ flags)
+ _message -e masks expl mask
+ ;;
+ encoding)
+ _wanted encodings expl encoding compadd auto off rs baser
+ ;;
+ *)
+ case $words[2] in
+ -A|--pause)
+ _values -S ' ' -w 'pause parameter' \
+ 'autoneg[specify if pause autonegotiation is enabled]' \
+ 'rx[specify if RX pause is enabled]' \
+ 'tx[specify if TX pause is enabled]'
+ ;;
+ -C|--coalesce)
+ _wanted settings expl 'coalescing setting' compadd -F line -M 'r:|-=* r:|=*' - \
+ adaptive-{r,t}x {r,t}x-{usecs,frames}{,-irq,-high,-low} \
+ stats-block-usecs pkt-rate-{low,high} sample-interval
+ ;;
+ -G|--set-ring)
+ _values -S ' ' -w 'ring parameter' \
+ 'rx[change number of ring entries for the RX ring]' \
+ 'rx-mini[change number of ring entries for the RX Mini ring]' \
+ 'rx-jumbo[change number of ring entries for the RX Jumbo ring]' \
+ 'tx[change number of ring entries for the TX ring]'
+ ;;
+ -d|--register-dump)
+ _values -S ' ' -w 'option' \
+ 'hex[dump hex register data]' \
+ 'raw[dump raw register data]' \
+ 'file[use contents from file rather than device]'
+ ;;
+ -e|--eeprom-dump)
+ _values -S ' ' -w 'option' \
+ 'raw[dump raw EEPROM data]' \
+ 'offset' 'length'
+ ;;
+ -E|--change-eeprom)
+ _values -S ' ' -w 'option' \
+ 'magic[device-specific key]' \
+ 'offset' 'length'
+ 'value[new value]'
+ ;;
+ -K|--features|--offload)
+ if (( CURRENT % 2 )); then
+ _wanted values expl enable compadd on off
+ else
+ _wanted features expl feature compadd -F line - \
+ ${${${${(f)"$(_call_program features $words[1] -k $line[1])"}%%:*}#$'\t'}[2,-1]} \
+ rx tx sg tso ufo gso gro rxvlan txvlan ntuple rxhash
+ fi
+ ;;
+ -p|--identify)
+ (( CURRENT = 4 )) && _message -e length 'duration (seconds)'
+ ;;
+ -t|--test)
+ _values -S ' ' -w 'test mode' \
+ '(online)offline:perform full set of tests possibly causing normal operation interruption (default)]' \
+ '(offline)online:perform limited set of tests without interrupting normal adapter operation]' \
+ 'external_lb[perform full set of tests plus external-loopback test]'
+ ;;
+ -s|--change)
+ if (( ! $words[(I)msglvl] )); then
+ _values -S ' ' -w 'generic option' \
+ 'speed[set speed in Mb/s]' \
+ 'duplex[set full or half duplex mode]' \
+ 'port[select device port]' \
+ 'autoneg[specify if autonegotiation is enabled]' \
+ 'advertise[set the speed and duplex advertised by autonegotiation]' \
+ 'phyad[PHY address]' \
+ 'xcvr[select transceiver type]' \
+ 'wol[set Wake-on-LAN options]' \
+ 'sopass[set the SecureOn(tm) password]' \
+ 'msglvl[set the driver message level]'
+ elif (( (CURRENT - $words[(I)msglvl]) % 2 )); then
+ [[ -prefix [^0-9]## ]] || _message -e numbers number
+ _wanted flags expl 'message type flag' compadd drv probe link timer \
+ if{down,up} rx_{err,status} tx_{err,queued,done} intr pktdata hw wol
+ else
+ _wanted onoff expl 'enabled' compadd off on
+ fi
+ ;;
+ -n|-u|--show-nfc|--show-ntuple)
+ _wanted options expl option compadd -F line - rx-flow-hash rule
+ ;;
+ -N|-U|--config-nfc|--config-ntuple)
+ if [[ $words[CURRENT-2] = rx-flow-hash ]]; then
+ _values -S ' ' 'rx packet hash' \
+ 'm[layer 2 destination address]' \
+ 'v[VLAN tag]' \
+ 't[layer 3 protocol field]' \
+ 's[IP source address]' \
+ 'd[IP destination address]' \
+ 'f[bytes 0 and 1 of the Layer 4 header]' \
+ 'n[bytes 2 and 3 of the Layer 4 header]' \
+ 'r[discard all packets of this flow type]'
+ else
+ _wanted options expl option compadd -F line - rx-flow-hash flow-type \
+ delete src dst proto src-ip dst-ip tos m tclass l4proto src-port \
+ dst-port spi l4data vlan-etype vlan user-def dst-mac action vf \
+ queue loc
+ fi
+ ;;
+ -X|--set-rxfh-indir|--rxfh)
+ _values -S ' ' -w 'option' \
+ '(weight default)equal' \
+ '(equal default)weight' \
+ '(equal weight)default' \
+ hkey hfunc
+ ;;
+ -f|--flash)
+ if (( CURRENT = 4 )); then
+ _files
+ else
+ _message -e regions region
+ fi
+ ;;
+ -w|--get-dump)
+ _wanted options expl option compadd data
+ ;;
+ -L|--set-channels)
+ _wanted options expl option compadd -F line - rx tx other combined
+ ;;
+ --set-priv-flags)
+ if (( CURRENT % 2 )); then
+ _wanted values expl enable compadd on off
+ else
+ _message -e flags 'private flag'
+ fi
+ ;;
+ -m|--dump-module-eeprom|--module-info)
+ _wanted options expl option compadd -F line - raw hex offset length
+ ;;
+ --set-eee)
+ _wanted behaviours expl behaviour compadd -F line - eee advertise tx-lpi tx-timer
+ ;;
+ --set-phy-tunable)
+ _wanted options expl tunable compadd -F line - downshift count
+ ;;
+ --get-phy-tunable)
+ _wanted options expl tunable compadd downshift
+ ;;
+ --reset)
+ _wanted components expl component compadd flags dedicated all \
+ {mgmt,irq,dma,filter,offload,mac,phy,ram,ap}{,-shared}
+ ;;
+ --set-fec)
+ _wanted options expl tunable compadd -F line - encoding
+ ;;
+ esac
+ ;;
+ esac
+fi
diff --git a/Completion/Linux/Command/_ionice b/Completion/Linux/Command/_ionice
index a3d49ec99..d64f1c496 100644
--- a/Completion/Linux/Command/_ionice
+++ b/Completion/Linux/Command/_ionice
@@ -1,12 +1,35 @@
#compdef ionice
-_arguments \
- '(* -)-h[display usage information]' \
- '(*)-p[interpret args as process ID]:pid:_pids' \
- '-c+[scheduling class]:class:(( 1\:realtime 2\:best-effort 3\:idle ))' \
- '-n+[scheduling class priority]:class-priority:((
+local curcontext="$curcontext" state line expl ret=1
+local -A opt_args
+
+_arguments -C -s -S \
+ '(H -c --class)'{-c+,--class=}'[scheduling class]:class:((0\:none 1\:realtime 2\:best-effort 3\:idle))' \
+ '(H -m --classdata)'{-n+,--classdata=}'[scheduling class priority]:class-priority:((
0\:high\ priority
{6..1}\:
7\:low\ priority
))' \
- '*::command:_normal'
+ '(H -t --ignore)'{-t,--ignore}'[ignore failures]' \
+ '(H)*:: :->args' \
+ + 'H' \
+ '(- *)'{-V,--version}'[display version information]' \
+ '(- *)'{-h,--help}'[display help information]' \
+ + '(args)' \
+ '(H)'{-p-,--pid=-}'[interpret args as process ID]::process id:_pids' \
+ '(H)'{-P-,--pgid=-}'[specify process group IDs]::process group' \
+ '(H)'{-u-,--uid=-}'[act on running process owned by specified users]::user id' && ret=0
+
+if [[ -n $state ]]; then
+ if (( $+opt_args[args--p] || $+opt_args[args---pid] )); then
+ _pids && ret=0
+ elif (( $+opt_args[args--P] || $+opt_args[args---pgid] )); then
+ _message -e pgids 'process group'
+ elif (( $+opt_args[args--u] || $+opt_args[args---uid] )); then
+ _message -e uids 'user id'
+ else
+ _normal && ret=0
+ fi
+fi
+
+return ret
diff --git a/Completion/Linux/Command/_ipset b/Completion/Linux/Command/_ipset
index 0d6afc08e..d05f13caf 100644
--- a/Completion/Linux/Command/_ipset
+++ b/Completion/Linux/Command/_ipset
@@ -1,7 +1,7 @@
#compdef ipset
local offset=0
-local -a args from_to hash cmds listopts
+local -a args from_to hash cmds listopts addopts
_set_types () {
_values -S \ "Set type" \
diff --git a/Completion/Linux/Command/_losetup b/Completion/Linux/Command/_losetup
index 359a9e0ea..9cfaaf5bf 100644
--- a/Completion/Linux/Command/_losetup
+++ b/Completion/Linux/Command/_losetup
@@ -1,28 +1,45 @@
-#compdef losetup
-# based on util-linux 2.26.2
+#lcompdef losetup -value-,LOOPDEV_DEBUG,-default-
-_arguments -S -A '-*' \
+if [[ $service = *LOOPDEV_DEBUG* ]]; then
+ local expl
+ _wanted values expl value compadd all
+ return
+fi
+
+local device offset
+
+device='1:device:_files -g "/dev/loop<->"'
+offset=( {-o,--offset}'+[specify data start is offset]:offset (bytes)' )
+
+_arguments -s -S \
+ - '(H)'\
+ {-V,--version}'[display version information]' \
+ {-h,--help}'[display help]' \
+ - 'info' \
+ '(-v --verbose)'{-v,--verbose}'[verbose mode]' \
+ '(-o --offset -a --all)'{-a,--all}'[show the status of all loop devices]' \
+ '(-O --output)'{-O+,--output=}'[specify columns to be printed with --list]:column:_sequence -s , compadd - name autoclear back-file back-ino back-maj\:min maj\:min offset partscan ro sizelimit dio log-sec' \
+ '(-J --json --raw -O --output -n --noheadings)'{-J,--json}'[use JSON --list output format]' \
'(-l --list)'{-l,--list}'[list currently used loop devices]' \
- '(-n --noheadings)'{-n,--noheadings}'[do not print heading for --list output]' \
- '(-d --delete --detach -o --offset -a --all)'{-o,--offset}'+[specify data start is offset]:offset (bytes)' \
- '(-O --output)'{-O,--output}'[specify columns to be printed with --list]:column: _values -s , column name sizelimit offset autoclear ro back-file' \
+ '(-J --json)--raw[raw output format]' \
+ '(-n --noheadings -J --json)'{-n,--noheadings}"[don't print headings in --list output]" \
+ - '(resize)' \
+ {-c,--set-capacity}'[reread the size of the file associated with the loop device]' \
+ - 'detach' \
+ '(-)'{--delete,--detach,-d}'[detach from specified loop device]' \
+ "$device" \
+ - '(detach-all)' \
+ {-D,--detach-all}'[detach all associated loop devices]' \
+ - 'create' \
+ '--direct-io[open backing file with O_DIRECT]::enable:(on off)' \
+ '(-f --find 2)'{-f,--find}'[find the first unused loop device]' \
+ '(-L --nooverlap)'{-L,--nooverlap}'[avoid possible conflict between devices]' \
'(-P --partscan)'{-P,--partscan}'[scan the partition table of newly created loop devices]' \
- '--raw[raw output format]' \
+ '--sizelimit[limit device to specified size]:size (bytes)' \
+ '(-b --sector-size)'{-b+,--sector-size=}'[set logical sector size of loop device]:size (bytes)' \
+ '--show[print device name after setup]' \
'(-r --read-only)'{-r,--read-only}'[set up a read-only loop device]' \
- '(-v --verbose)'{-v,--verbose}'[verbose mode]' \
- '(-V --version)'{-V,--version}'[display version information]' \
- '(-h --help)'{-h,--help}'[display help]' \
- '1:device:_files -g "/dev/loop<->"' \
- '(-d --delete --detach)2:file:_files' \
- - '(set1)' \
- '(-o --offset)'{-a,--all}'[show the status of all loop devices]' \
- - '(set2)' \
- {-c,--set-capacity}'[reread the size of the file associated with the loop device]' \
- - '(set3)' \
- '(- 2)'{--delete,--detach,-d}'[detach from specified loop device]' \
- - '(set4)' \
- '(-D --detach-all)'{-D,--detach-all}'[detach all associated loop devices]' \
- - '(set5)' \
- {-f,--find}'[find the first unused loop device]' \
- - '(set6)' \
- {-j,--associated}'[show the status of all loop devices associated with an file]: : _files'
+ '1:file:_files' \
+ - 'assoc' \
+ '(-j --associated)'{-j,--associated}'[show the status of all loop devices associated with an file]:associated file:_files' \
+ "(-f)$device"
diff --git a/Completion/Linux/Command/_lsattr b/Completion/Linux/Command/_lsattr
new file mode 100644
index 000000000..def0bd3d9
--- /dev/null
+++ b/Completion/Linux/Command/_lsattr
@@ -0,0 +1,11 @@
+#compdef lsattr
+
+_arguments -s -S : \
+ '-a[show all files, including hidden ones]' \
+ '-d[list directory entries instead of contents]' \
+ '-l[use long option names]' \
+ "-p[show file's project number]" \
+ '-R[act recursively]' \
+ '-V[display version information]' \
+ "-v[show file's version/generation number]" \
+ '*: :_files'
diff --git a/Completion/Linux/Command/_lsblk b/Completion/Linux/Command/_lsblk
index c8fbb27c7..f37305445 100644
--- a/Completion/Linux/Command/_lsblk
+++ b/Completion/Linux/Command/_lsblk
@@ -29,6 +29,7 @@ _arguments -C -s -S \
'(H)'{-i,--ascii}'[output ascii characters only]' \
'(H)'{-J,--json}'[use JSON output format]' \
'(H)'{-l,--list}'[use list format output]' \
+ '(H)'{-t,--tree}'[use tree format output]' \
'(H)'{-P,--pairs}'[use key="value" output format]' \
'(H)'{-r,--raw}'[use raw output format]' \
+ 'H' \
diff --git a/Completion/Linux/Command/_mii-tool b/Completion/Linux/Command/_mii-tool
index 8da6da69d..72c47a479 100644
--- a/Completion/Linux/Command/_mii-tool
+++ b/Completion/Linux/Command/_mii-tool
@@ -1,12 +1,13 @@
#compdef mii-tool
-_arguments -s \
- '(-V --version)'{-V,--version}'[display version information]' \
+_arguments -s -S \
+ '(- *)'{-V,--version}'[display version information]' \
'(-v --verbose)'{-v,--verbose}'[verbose output]' \
'(-R --reset)'{-R,--reset}'[reset MII to poweron state]' \
'(-r --restart)'{-r,--restart}'[restart autonegotiation]' \
'(-w --watch)'{-w,--watch}'[monitor for link status changes]' \
'(-l --log)'{-l,--log}'[write events to syslog]' \
- '(-A --advertise)'{-A,--advertise=}'[advertise only specified media]:medium:_values -s , medium 100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 100baseTx 10baseT' \
+ '(-A --advertise)'{-A,--advertise=}'[advertise only specified media]:medium:_values -s , medium 1000baseTx-HD 1000baseTx-FD 100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 1000baseTx 100baseTx 10baseT' \
'(-F --force)'{-F,--force=}'[force specified medium]:medium:(100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 100baseTx 10baseT)' \
+ '(-p --phy)'{-p,--phy=}'[set PHY (MII address) to report]:MII address' \
'*:interface:_net_interfaces'
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index 5aa4c9cc7..9a37fcae1 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -119,6 +119,7 @@ _modutils() {
while _tags; do
_requested files expl "module file" _files -g '*.ko(-.)' && ret=0
_requested modules expl module compadd -a modules && ret=0
+ (( ret )) || break
done
;;
diff --git a/Completion/Linux/Command/_networkmanager b/Completion/Linux/Command/_networkmanager
new file mode 100644
index 000000000..881445abb
--- /dev/null
+++ b/Completion/Linux/Command/_networkmanager
@@ -0,0 +1,373 @@
+#compdef nmcli
+
+# compatible with NetworkManager 1.8.4
+
+_networkmanager() {
+ local curcontext="$curcontext" state line
+
+ _arguments -C \
+ '(-p -pretty -t -terse)-t'{,erse}'[terse output]' \
+ '(-p -pretty -t -terse)-p'{,retty}'[pretty output]' \
+ '(-m -mode)-m'{,ode}'[output mode]:mode:(tabular multiline)' \
+ '(-c -colors)-c'{,olors}'[whether to use colors in output]:value:(auto yes no)' \
+ '(-f -fields)-f'{,ields}'[specify fields to output]:field:_nm_fields' \
+ '(-f -fields -g -get-values -m -mode -p -pretty -t -terse)-g'{,et-values}'[shortcut for -m tabular -t -f]:field:_nm_fields' \
+ '(-e -escape)-e'{,scape}'[escape column separators in values]:value:(yes no)' \
+ '(-a -ask)-a'{,sk}'[ask for missing parameters]' \
+ '(-s -show-secrets)-s'{,how-secrets}'[allow passwords to be displayed]' \
+ '(-w -wait)-w'{,ait}'[set time limit on wait for operations to finish]:timeout (seconds)' \
+ '(- *)-v'{,ersion}'[show program version]' \
+ '(- *)-h'{,elp}'[print help]' \
+ '1:command:(general networking radio connection device agent monitor help)' \
+ '*::arg:->args'
+
+ case $line[1] in
+ g*) _nm_general ;;
+ n*) _nm_networking ;;
+ r*) _nm_radio ;;
+ c*) _nm_connection ;;
+ d*) _nm_device ;;
+ a*) _nm_agent ;;
+ esac
+}
+
+_nm_fields() {
+ _values -s , 'field to output' \
+ all common \
+ RUNNING VERSION STATE STARTUP CONNECTIVITY NETWORKING WIFI-HW WIFI WWAN-HW WWAN \
+ NAME UUID TYPE TIMESTAMP TIMESTAMP-REAL AUTOCONNECT AUTOCONNECT-PRIORITY READONLY DBUS-PATH ACTIVE DEVICE STATE ACTIVE-PATH SLAVE \
+ DEVICE CONNECTION CON-UUID CON-PATH BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY
+}
+
+_nm_general() {
+ _arguments "1:command:(status hostname permissions logging help)"
+ # TODO: provide completions for logging
+}
+
+_nm_networking() {
+ local curcontext="$curcontext" state line
+
+ _arguments -C \
+ "1:command:(on off connectivity help)" \
+ "*::arg:->args"
+
+ case $line[1] in
+ c*) _nm_networking_connectivity ;;
+ esac
+}
+
+_nm_networking_connectivity() {
+ _arguments "1:flag:(check)"
+}
+
+_nm_radio() {
+ _arguments \
+ "1:type:(all wifi wwan help)" \
+ "2:switch:(on off)"
+}
+
+_nm_connection() {
+ local curcontext="$curcontext" state line
+
+ _arguments -C \
+ "1:command:(show up down add modify clone edit delete monitor reload load import export help)" \
+ "*::arg:->args"
+
+ case $line[1] in
+ s*) _nm_connection_show ;;
+ u*) _nm_connection_up ;;
+ d*) _nm_connection_down ;;
+ # TODO: a*) _nm_connection_add ;;
+ m*) _nm_connection_modify ;;
+ c*) _nm_connection_clone ;;
+ e*) _nm_connection_edit ;;
+ de*) _nm_connection_delete ;;
+ mon*) _nm_connection_monitor ;;
+ l*) _nm_connection_load ;;
+ i*) _nm_connection_import ;;
+ ex*) _nm_connection_export ;;
+ esac
+}
+
+_nm_connection_show() {
+ # TODO: add support for --order
+ _arguments \
+ "--active" \
+ "1:connection:_nm_connection_specs"
+}
+
+_nm_connection_up() {
+ # TODO: add support for ifname, ap and passwd-file parameters
+ _arguments "1:connection:_nm_connection_specs"
+}
+
+_nm_connection_down() {
+ _arguments "1:connection:_nm_connection_specs"
+}
+
+_nm_connection_modify() {
+ # TODO: add support for options and properties
+ _arguments \
+ "--temporary" \
+ "1:connection:_nm_connection_specs"
+}
+
+_nm_connection_clone() {
+ _arguments \
+ "--temporary" \
+ "1:connection:_nm_connection_specs" \
+ "2:new name"
+}
+
+_nm_connection_edit() {
+ # TODO: add support for adding new connections (type and con-name parameters)
+ _arguments "1:connection:_nm_connection_specs"
+}
+
+_nm_connection_delete() {
+ _arguments "*:connection:_nm_connection_specs"
+}
+
+_nm_connection_monitor() {
+ _arguments "*:connection:_nm_connection_specs"
+}
+
+_nm_connection_load() {
+ _files
+}
+
+_nm_connection_import() {
+ _arguments \
+ "--temporary" \
+ "1: :(type)" \
+ "2:type:(vpnc openvpn pptp openconnect openswan libreswan ssh l2tp iodine)" \
+ "3: :(file)" \
+ "4:file:_files"
+}
+
+_nm_connection_export() {
+ _arguments \
+ "1:connection:_nm_connection_specs" \
+ "2:file:_files"
+}
+
+_nm_connection_specs() {
+ # TODO: add support for uuids and D-Bus paths
+ _nm_connection_ids
+}
+
+_nm_connection_ids() {
+ local -a con_ids
+ con_ids=(${(f)"$(_call_program nmcli nmcli -t -f name connection)"})
+ _describe 'select connection' con_ids
+}
+
+_nm_device() {
+ local curcontext="$curcontext" state line
+
+ _arguments -C \
+ "1:command:(status show set connect reapply modify disconnect delete monitor wifi lldp help)" \
+ "*::arg:->args"
+
+ case $line[1] in
+ sh*) _nm_device_show ;;
+ se*) _nm_device_set ;;
+ c*) _nm_device_connect ;;
+ r*) _nm_device_reapply ;;
+ mod*) _nm_device_modify ;;
+ d*) _nm_device_disconnect ;;
+ de*) _nm_device_delete ;;
+ m*) _nm_device_monitor ;;
+ w*) _nm_device_wifi ;;
+ l*) _nm_device_lldp ;;
+ esac
+}
+
+_nm_device_show() {
+ _arguments "1:interface:_nm_device_ifnames"
+}
+
+_nm_device_set() {
+ # TODO: allow specifying both options, and in any order
+ _arguments \
+ "1:interface:_nm_device_ifnames" \
+ "2:property:(autoconnect managed)" \
+ "3:switch:(yes no)"
+}
+
+_nm_device_connect() {
+ _arguments "1:interface:_nm_device_ifnames"
+}
+
+_nm_device_reapply() {
+ _arguments "1:interface:_nm_device_ifnames"
+}
+
+_nm_device_modify() {
+ # TODO: add support for settings
+ _arguments "1:interface:_nm_device_ifnames"
+}
+
+_nm_device_disconnect() {
+ _arguments "*:interface:_nm_device_ifnames"
+}
+
+_nm_device_delete() {
+ _arguments "*:interface:_nm_device_ifnames"
+}
+
+_nm_device_monitor() {
+ _arguments "*:interface:_nm_device_ifnames"
+}
+
+_nm_device_wifi() {
+ local curcontext="$curcontext" state line
+
+ _arguments -C \
+ "1:command:(list connect hotspot rescan)" \
+ "*::arg:->args"
+
+ case $line[1] in
+ l*) _nm_device_wifi_list ;;
+ c*) _nm_device_wifi_connect ;;
+ ho*) _nm_device_wifi_hotspot ;;
+ r*) _nm_device_wifi_rescan ;;
+ esac
+}
+
+_nm_device_wifi_list() {
+ # TODO: support bssid on its own
+ _arguments \
+ "1: :(ifname)" \
+ "2:interface:_nm_device_ifnames" \
+ "3: :(bssid)" \
+ "4:bssid:_nm_device_wifi_bssids"
+}
+
+_nm_device_wifi_connect() {
+ local curcontext="$curcontext" state line
+
+ _arguments -C \
+ "1:ssid:_nm_device_wifi_ssids" \
+ "*::arg:->args"
+
+ if [[ -n $line[1] ]]; then
+ _nm_device_wifi_connect_opts
+ fi
+}
+
+_nm_device_wifi_connect_opts() {
+ # TODO: there must be a cleaner way to implement this
+ local curcontext="$curcontext" state line
+
+ _arguments -C \
+ "1:property:(password wep-key-type ifname bssid name private hidden)" \
+ "*::arg:->args"
+
+ local min_line_len=2
+ case $line[-2] in
+ password)
+ _arguments -C "1:password" "*::arg:->args"
+ ;;
+ wep-key-type)
+ _arguments -C "1:wep key type:(key phrase)" "*::arg:->args"
+ ;;
+ ifname)
+ _arguments -C "1:device:_nm_device_ifnames" "*::arg:->args"
+ ;;
+ bssid)
+ _arguments -C "1:bssid:_nm_device_wifi_bssids" "*::arg:->args"
+ ;;
+ name)
+ _arguments -C "1:name" "*::arg:->args"
+ ;;
+ private)
+ _arguments -C "1:private:(yes no)" "*::arg:->args"
+ ;;
+ hidden)
+ _arguments -C "1:hidden:(yes no)" "*::arg:->args"
+ ;;
+ *)
+ min_line_len=1
+ ;;
+ esac
+ if [[ $#line > $min_line_len ]]; then
+ _nm_device_wifi_connect_opts
+ fi
+}
+
+_nm_device_wifi_hotspot() {
+ local curcontext="$curcontext" state line
+
+ _arguments -C \
+ "1:property:(ifname con-name ssid band channel password)" \
+ "*::arg:->args"
+
+ local min_line_len=2
+ case $line[-2] in
+ ifname)
+ _arguments -C "1:device:_nm_device_ifnames" "*::arg:->args"
+ ;;
+ con-name)
+ _arguments -C "1:connection name" "*::arg:->args"
+ ;;
+ ssid)
+ _arguments -C "1:ssid" "*::arg:->args"
+ ;;
+ band)
+ _arguments -C "1:band:(a bg)" "*::arg:->args"
+ ;;
+ channel)
+ _arguments -C "1:channel" "*::arg:->args"
+ ;;
+ password)
+ _arguments -C "1:password" "*::arg:->args"
+ ;;
+ *)
+ min_line_len=1
+ ;;
+ esac
+ if [[ $#line > $min_line_len ]]; then
+ _nm_device_wifi_hotspot
+ fi
+}
+
+_nm_device_wifi_rescan() {
+ # TODO: support ssid on its own and multiple ssids
+ _arguments \
+ "1: :(ifname)" \
+ "2:interface:_nm_device_ifnames" \
+ "3: :(ssid)" \
+ "4:ssid:_nm_device_wifi_ssids"
+}
+
+_nm_device_wifi_bssids() {
+ local -a bssids
+ bssids=(${(f)"$(_call_program nmcli nmcli -t -f bssid device wifi list)"})
+ _describe 'select network' bssids
+}
+
+_nm_device_wifi_ssids() {
+ local -a ssids
+ ssids=(${(f)"$(_call_program nmcli nmcli -t -f ssid device wifi list)"})
+ _describe 'select network' ssids
+}
+
+_nm_device_lldp() {
+ _arguments \
+ "1: :(list)" \
+ "2: :(ifname)" \
+ "3:interface:_nm_device_ifnames"
+}
+
+_nm_device_ifnames() {
+ local -a ifnames
+ ifnames=(${(f)"$(_call_program nmcli nmcli -t -f device device)"})
+ _describe 'select device' ifnames
+}
+
+_nm_agent() {
+ _arguments "1:type:(secret polkit all help)"
+}
+
+_networkmanager "$@"
diff --git a/Completion/Linux/Command/_nmcli b/Completion/Linux/Command/_nmcli
deleted file mode 100644
index a6b97a36c..000000000
--- a/Completion/Linux/Command/_nmcli
+++ /dev/null
@@ -1,244 +0,0 @@
-#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/Linux/Command/_ss b/Completion/Linux/Command/_ss
index e5289b0a7..afe00b6a3 100644
--- a/Completion/Linux/Command/_ss
+++ b/Completion/Linux/Command/_ss
@@ -33,10 +33,11 @@ _arguments -C -s \
"($info -d --dccp)"{-d,--dccp}'[display DCCP sockets]' \
"($info -w --raw)"{-w,--raw}'[display RAW sockets]' \
"($info -x --unix)"{-x,--unix}'[display Unix domain sockets]' \
- "($info -f --family)"{-f,--family}'[display sockets of specified type]:family:(unix inet inet6 link netlink unix)' \
+ "($info)--vsock[display only vsock sockets]' \
+ "($info -f --family)"{-f,--family}'[display sockets of specified type]:family:(unix inet inet6 link netlink unix vsock)' \
"($info -K --kill)"{-K,--kill}'[forcibly close sockets, display what was closed]' \
"($info -H --no-header)"{-H,--no-header}'[suppress header line]' \
- "($info -A --query --socket)"{-A,--query,--socket}'[specify socket tables to show]: :_values -s , socket\ table all inet tcp udp raw unix packet netlink unix_dgram unix_stream unix_seqpacket packet_raw packet_dgram' \
+ "($info -A --query --socket)"{-A,--query,--socket}'[specify socket tables to show]: :_values -s , socket\ table all inet tcp udp raw unix packet netlink unix_dgram unix_stream unix_seqpacket packet_raw packet_dgram vsock_stream vsock_dgram' \
"($info -D)"{-D,--diag=}'[dump raw info to file]:file:_files' \
"($info -F)"{-F,--filter=}'[read filter information from a file]:file:_files' \
"($info)*: :->filter" && ret=0
@@ -78,7 +79,7 @@ if [[ -n $state ]]; then
state|exclude)
_wanted states expl state compadd -M 'm:{a-zA-Z_}={A-Za-z-}' \
ESTABLISHED SYN-SENT SYN-RECV FIN-WAIT-1 FIN-WAIT-2 TIME-WAIT \
- CLOSED CLOSE-WAIT LAST-ACK LISTEN CLOSING \
+ CLOSED CLOSE-WAIT LAST-ACK LISTENING CLOSING \
all connected synchronized bucket big && ret=0
;;
*)
diff --git a/Completion/Linux/Command/_sshfs b/Completion/Linux/Command/_sshfs
index fe976288d..6e889cf49 100644
--- a/Completion/Linux/Command/_sshfs
+++ b/Completion/Linux/Command/_sshfs
@@ -4,13 +4,14 @@ local curcontext="$curcontext" state state_descr line
typeset -A opt_args
integer ret=1
-_arguments -C \
+# TODO: in the "user@host" argument, the "user@" part should be optional
+_arguments -C -S : \
'(-)'{-h,--help}'[display help information]' \
'(-)'{-V,--version}'[display version information]' \
'-p[specify TCP port]:tcp port:_ports' \
'-C[enable compression]' \
'-F[specify ssh config file]:file:_files' \
- '-o[specify mount options]:options:->options' \
+ '*-o[specify mount options]:options:->options' \
'(-f)-d[enable debug output]' \
'-f[foreground]' \
'-s[disable multithreaded operation]' \
diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat
index e976b4705..855bf0a70 100644
--- a/Completion/Linux/Command/_sysstat
+++ b/Completion/Linux/Command/_sysstat
@@ -1,15 +1,17 @@
#compdef mpstat cifsiostat isag sadf sar pidstat
-# -V can appear with other options, so (- *) isn't needed.
#TODO:
# sysstat-nfsiostat - there seems to be two nfsiostat(1)s. one from oracle and one by redhat.
_mpstat() {
- _arguments : \
- '-A[equivalent to -u -I ALL -P ALL]' \
- '-I[report interrupt statistics]:interrupt:(SUM CPU SCPU ALL)' \
- '-P[specify processor number]:processor: _values -s "," processor ON ALL {1..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \
+ _arguments -S : \
+ '(-n -u -I -N -P)-A[equivalent to -n -u -I ALL -N ALL -P ALL]' \
+ '(-A)-I[report interrupt statistics]:interrupt:(SUM CPU SCPU ALL)' \
+ '(-A)-N[specify NUMA nodes]:NUMA node' \
+ '(-A)-n[report summary CPU statistics based on NUMA node placement]' \
+ '-o[display statistics in JSON]:format:(JSON)' \
+ '(-A)-P[specify processor number]:processor: _values -s "," processor ON ALL {0..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \
'-u[report CPU utilization]' \
- '-V[print version number]' \
+ '(- 1 2)-V[display version information]' \
'1: : _guard "^-*" interval' \
'2: : _guard "^-*" count'
}
@@ -20,7 +22,8 @@ _cifsiostat() {
'(-m)-k[display statistics in kB/s]' \
'(-k)-m[display statistics in MB/s]' \
'-t[print timestamp for each report]' \
- '-V[print version number]' \
+ '(- 1 2)-V[print version number]' \
+ '--human[print sizes in human readable format]' \
'1: : _guard "^-*" interval' \
'2: : _guard "^-*" count'
}
@@ -34,50 +37,62 @@ _isag() {
}
_sadf() {
- local ret=1
+ local i ret=1
# any options after `--' are for sar(1)
- if ! (( CURRENT > $words[(i)--] )); then
+ if (( CURRENT <= $words[(i)--] )); then
_arguments : \
'-C[display comments in file]' \
- '(-j -p -x)-d[output file in SQL format]' \
+ '-c[convert an old datafile to the new format]' \
'-e[set ending time of report]:ending time (HH\:MM\:SS)' \
'-H[display only the header of the report]' \
- '(-j -p -x)-h[print on a single line when used with -d]' \
- '(-d -p -x)-j[output file in JSON]' \
+ '(-g -j -p -r -x)-h[print on a single line when used with -d]' \
+ '-O[specify output options]: : _values -s , option
+ autoscale height\:value oneday packed showidle showinfo skipempty showhints' \
'-P[restrict processor dependant statistics]:processor number(zero indexed) or ALL:(ALL)' \
- '(-j -x -d)-p[print in format parsable by tools like awk]' \
'-s[set starting time of report]:starting time (HH\:MM\:SS)"' \
'(-t -U)-T[display timestamp in local time]' \
'(-T -U)-t[display timestamp in file\''s original localtime]' \
'(-t -T)-U[display in seconds since epoch (UTC)]' \
- '-V[print version number]' \
- '(-j -d -p)-x[output file in XML]' \
+ '(- 1 2 3)-V[print version number]' \
'1: : _guard "^-*" interval' \
'2: : _guard "^-*" count' \
- '3:data file:_files' && ret=0
+ '3:data file:_files' \
+ + '(format)' \
+ '-d[output file in SQL format]' \
+ '-g[print data in SVG format]' \
+ '-j[output file in JSON]' \
+ '-p[print in format parsable by tools like awk]' \
+ '-r[print raw contents of data file]' \
+ '-x[output file in XML]' \
+ && ret=0
else
- _arguments : '*::sar: _sar' && ret=0
+ (( i = words[(i)--] - 1, CURRENT -= i ))
+ shift i words
+ _sar && ret=0
fi
return ret
}
_sar() {
- _arguments : \
- '-A[equivalent to -bBdFHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -u ALL -P ALL]' \
+ _arguments -s : \
+ '-A[equivalent to -bBdFHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -r ALL -u ALL -P ALL]' \
'-B[report paging statistics]' \
'-b[report I/O and transfer rate statistics]' \
'-C[display comments from sadc]' \
+ '-D[use saYYYYMMDD instead of saDD as the standard system activity daily data file name]' \
'-d[report activity for each block device]' \
'-e[set ending time of report]:ending time (HH\:MM\:SS)' \
'-F[display statistics for mounted filesystems]' \
'-f[extract records from file]:record:_files' \
'-H[report hugepages utilization]' \
'-h[display help]' \
+ '--human[print sizes in human readable format]' \
'*-I[report statistics for interrupts]:interrupts: _values -s "," interrupts 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SUM ALL XALL' \
'-i[select records as close as possible to interval]:interval' \
'-j[display persistent device names]:type:(ID LABEL PATH UUID)' \
'-m[report power management statistics]:keywords: _values -s "," keywords CPU FAN FREQ IN TEMP USB ALL' \
'-n[report network statistics]:keywords: _values -s "," keywords DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 ALL' \
+ '-o[save readings to file in binary form]:file:_files' \
'-P[report per-processor statistics]:processor: _values -s "," processors ALL' \
'-p[pretty-print device names]' \
'-q[report queue length and load averages]' \
@@ -85,8 +100,10 @@ _sar() {
'-r[report memory utilization statistics]' \
'-S[report swap space utilization]' \
'-s[set starting time of report]:start time (HH\:MM\:SS)' \
+ '--sadc[print name of data collector]' \
+ '-t[display timestamps in original local time of file creator]' \
'-u[report CPU utilization]: :(ALL)' \
- '-V[print version number]' \
+ '(- 1 2)-V[display version information]' \
'-v[report status of kernel tables]' \
'-W[report swapping statistics]' \
'-w[report task creation and system switching activity]' \
@@ -96,22 +113,27 @@ _sar() {
}
_pidstat() {
- _arguments : \
+ _arguments -s : \
'-C[filter tasks by string]:task filter' \
'-d[report I/O statistics]' \
- '-h[display on horizontally]' \
+ '-e[execute specified program and monitor it with pidstat]:*::command: _normal' \
+ '-H[display timestamp in seconds since the epoch]' \
+ '-h[display horizontally]' \
'-I[divide CPU usage by number of processors]' \
'-l[display process name along with arguments]' \
- '-p[select pid]:pid: _sequence _pids' \
+ '*-p[select pid]:pid: _sequence _pids' \
+ '-R[report realtime priority and scheduling policy information]' \
'-r[report page faults and memory]' \
'-s[report stack utilization]' \
'-T[specifies what to monitor]:type:(TASK CHILD ALL)' \
'-t[display statistics for threads]' \
'-U[display real username of tasks]::username:_users' \
'-u[report cpu utilization]' \
- '-V[print version number]' \
+ '(- 1 2)-V[display version information]' \
'-v[display values from kernel table]' \
'-w[report task switching activity]' \
+ '-G[include only processes with specified name]:process name' \
+ '--human[print sizes in human readable format]' \
'1: : _guard "^-*" interval' \
'2: : _guard "^-*" count'
}
diff --git a/Completion/Linux/Command/_tracepath b/Completion/Linux/Command/_tracepath
new file mode 100644
index 000000000..f0f777d96
--- /dev/null
+++ b/Completion/Linux/Command/_tracepath
@@ -0,0 +1,9 @@
+#compdef tracepath tracepath6
+
+_arguments -s -S \
+ '-n[print IP addresses numerically]' \
+ '-b[print both host names and IP addresses]' \
+ '-l+[set the initial packet length]:length (bytes)' \
+ '-m+[set maximum hops]:maximum [30]' \
+ '-p+[set initial destination port to use]:port:_ports' \
+ ':destination:_hosts'
diff --git a/Completion/Linux/Command/_tune2fs b/Completion/Linux/Command/_tune2fs
index 73ce2dd12..af120e279 100644
--- a/Completion/Linux/Command/_tune2fs
+++ b/Completion/Linux/Command/_tune2fs
@@ -1,23 +1,35 @@
#compdef tune2fs
-_arguments \
- '-c[set max mounts between checks]:number of mounts' \
- '-C[set mount count]:number of mounts' \
- '-e[set error behavior]:error behavior:(continue remount-ro panic)' \
+_arguments -s -S \
+ '-c+[set max mounts between checks]:number of mounts' \
+ '-C+[set mount count]:number of mounts' \
+ '-e+[set error behavior]:error behavior:(continue remount-ro panic)' \
+ '-E+[set extended options]: :_values -s , "extended option"
+ clearmmp
+ "mmp_update_interval\:interval (seconds)"
+ "stride\:stride size (blocks)"
+ "stripe_width\:stipe width (blocks)"
+ "hash_alg\:hash algorithm\:(legacy half_md4 tea)"
+ "mount_opts\:mount option"
+ "(^test_fs)test_fs"
+ "(test_fs)^test_fs"' \
'-f[force tune2fs to complete even in the face of errors]' \
- '-g[set the group which can use reserved filesystem blocks]:group:_groups' \
- '-i[interval between checks]:duration' \
+ '-g+[set the group which can use reserved filesystem blocks]:group:_groups' \
+ '-i+[interval between checks]:duration' \
+ '-I+[set inode size]:inode size' \
'-j[add an ext3 journal to the filesystem]' \
- '-J[journal options]: :_values -s , option "size[specify journal size]\:size" "device[use external journal]\:block device\:_files"' \
+ '-J+[journal options]: :_values -s , option "size[specify journal size]\:size" "location\:location" "device[use external journal]\:block device\:_files"' \
'-l[list the contents of the filesystem superblock]' \
- '-L[set the volume label of the filesystem]:label' \
- '-m[set the percentage of reserved filesystem blocks]:percentage' \
- '-M[set the last-mounted directory for the filesystem]:directory:_files -/' \
- '-o[mount options]:options:_values -s , debug bsdgroups user_xattr acl uid16 journal_data journal_data_ordered journal_data_writeback' \
- '-O[set or clear filesystem features]: :_values -s , feature dir_index filetype has_journal sparse_super' \
- '-r[set the number of reserved filesystem blocks]:number' \
- '-s[set sparse super feature]:state:((0\:off 1\:on))' \
- '-T[set time last checked]:time specifier' \
- '-u[set user who can use reserved filesystem blocks]:user:_users' \
- '-U[set filesystem UUID]:UUID or special:(clear random time)' \
+ '-L+[set the volume label of the filesystem]:label' \
+ '-m+[set the percentage of reserved filesystem blocks]:percentage' \
+ '-M+[set the last-mounted directory for the filesystem]:directory:_files -/' \
+ '-o+[mount options]:options:_values -s , debug bsdgroups user_xattr acl uid16 journal_data journal_data_ordered journal_data_writeback nobarrier block_validity discard nodelalloc' \
+ '-O+[set or clear filesystem features]: :_values -s , feature dir_index dir_nlink encrypt extentextent extra_isize filetype flex_bg has_journalhuge_file large_file metadata_csum mmp project quota read-only resize_inode sparse_super uninit_bg' \
+ '-r+[set the number of reserved filesystem blocks]:number' \
+ '-Q+[set quota feature on the superblock]: :_values -s , "quota option" usrquota grpquota prjquota' \
+ '-s+[set sparse super feature]:state:((0\:off 1\:on))' \
+ '-T+[set time last checked]:time specifier (YYYYMMDD[HH[MM[SS]]])' \
+ '-u+[set user who can use reserved filesystem blocks]:user:_users' \
+ '-U+[set filesystem UUID]:UUID or special:(clear random time)' \
+ '-z+[save old contents of file system block to undo file]:undo file:_files' \
':device:_files'
diff --git a/Completion/Linux/Command/_valgrind b/Completion/Linux/Command/_valgrind
index 0284ff880..1ae228c94 100644
--- a/Completion/Linux/Command/_valgrind
+++ b/Completion/Linux/Command/_valgrind
@@ -1,8 +1,8 @@
#compdef valgrind -value-,VALGRIND_OPTS,-default-
local curcontext="$curcontext" state line
-local -a cmd common common_mem_null \
- args args_{addrcheck,memcheck,cachegrind,helgrind,lackey,massif,none}
+local -a cmd common common_{mem_null,read_varinfo}
+local -a args args_{addrcheck,memcheck,cachegrind,helgrind,lackey,massif,none}
cmd=(
'1:command name:_command_names -e'
diff --git a/Completion/Linux/Command/_wipefs b/Completion/Linux/Command/_wipefs
new file mode 100644
index 000000000..5142def8a
--- /dev/null
+++ b/Completion/Linux/Command/_wipefs
@@ -0,0 +1,25 @@
+#compdef wipefs
+
+_arguments -s -S \
+ '(H -a --all)'{-a,--all}'[wipe all magic strings]' \
+ '(H -b --backup)'{-b,--backup}'[create a signature backup in $HOME]' \
+ '(H -f --force)'{-f,--force}'[force erasure]' \
+ '(H -i --no-headings -J --json -p --parsable)'{-i,--no-headings}"[don't print headings]" \
+ '(H -J --json -i --no-headings -p --parsable)'{-J,--json}'[use JSON output format]' \
+ '(H -n --no-act)'{-n,--no-act}'[do everything except the actual write() call]' \
+ '(H -o --offset)'{-o+,--offset=}'[specify offset to erase]:offset (bytes)' \
+ '(H -O --output)'{-O+,--output=}'[specify columns to display]: : _values -s, "column"
+ "uuid[partition/filesystem UUID]"
+ "label[filesystem label]"
+ "length[magic string length]"
+ "type[superblock type]"
+ "offset[magic string offset]"
+ "usage[type description]"
+ "device[block device name]"' \
+ '(H -p --parsable -i --no-headings -J --json)'{-p,--parsable}'[print out in parsable instead of printable format]' \
+ '(H -q --quiet)'{-q,--quiet}'[suppress output messages]' \
+ '(H -t --types)'{-t+,--types=}'[limit the set of filesystem, RAIDs or partition tables]:type:_file_systems' \
+ '(H)*:disk device:_files -g "*(-%)" -P / -W /' \
+ + '(H)' \
+ '(- *)'{-h,--help}'[display help information]' \
+ '(- *)'{-V,--version}'[display version information]'
diff --git a/Completion/Redhat/Command/_dnf b/Completion/Redhat/Command/_dnf
index 35b5aa27b..82b9b188f 100644
--- a/Completion/Redhat/Command/_dnf
+++ b/Completion/Redhat/Command/_dnf
@@ -38,9 +38,9 @@ _dnf_local_packages() {
_dnf() {
if [[ "$(readlink /usr/bin/dnf)" == "dnf-2" ]]; then
- local python_exec="python2"
+ local python_exec="/usr/bin/python2"
else
- local python_exec="python3"
+ local python_exec="/usr/bin/python3"
fi
local helper=$(${python_exec} -c "import dnf.cli; print('{}/completion_helper.py'.format(dnf.cli.__path__[0]))")
local cache_file="/var/cache/dnf/packages.db"
diff --git a/Completion/Redhat/Command/_rpm b/Completion/Redhat/Command/_rpm
index b24213e3c..a9306aa6c 100644
--- a/Completion/Redhat/Command/_rpm
+++ b/Completion/Redhat/Command/_rpm
@@ -45,7 +45,7 @@ _rpm () {
local curcontext="$curcontext" state lstate line nm="$compstate[nmatches]"
typeset -A opt_args
local ret=1
- local -a tmp expl commonopts selectopts
+ local -a tmp expl commonopts selectopts pathopts
commonopts=(
'(-v --verbose)--quiet[print as little as possible]'
diff --git a/Completion/Redhat/Command/_scl b/Completion/Redhat/Command/_scl
index b7bba2b13..b9eaff11a 100644
--- a/Completion/Redhat/Command/_scl
+++ b/Completion/Redhat/Command/_scl
@@ -8,7 +8,7 @@ local -a state line force alts cmd
_arguments -C $force \
'(- 1)'{-l,--list}'[list installed software collections or packages within a collection]' \
- '(-l --list)1:action:(enable run load unload list-collections list-packages man register deregister)' \
+ '(-l --list)1:action:(enable run load unload list-collections list-enabled list-packages man register deregister)' \
'(- *)--help' \
'(-)*:collections:->collections' && ret=0
diff --git a/Completion/Redhat/Command/_yum b/Completion/Redhat/Command/_yum
index 4698a3159..34a337109 100644
--- a/Completion/Redhat/Command/_yum
+++ b/Completion/Redhat/Command/_yum
@@ -1,9 +1,14 @@
-#compdef yum
+#compdef yum yumdb
# Main dispatcher
_yum() {
local curcontext="$curcontext" state lstate line
+ if [[ $service = yumdb ]]; then
+ _yumdb
+ return
+ fi
+
_arguments -s \
'(- *)'{-h,--help}'[show the help message]' \
'(-t --tolerant)'{-t,--tolerant}'[be tolerant of errors]' \
@@ -46,6 +51,53 @@ _yum() {
'*::yum command:_yum_command'
}
+_yumdb() {
+ local curcontext="$curcontext" desc ret=1
+ local -a state line
+
+ _arguments -C \
+ '(- 1)--version[display version information]' \
+ '(- 1)'{-h,--help}'[display help information]' \
+ '--noplugins[disable yum plugin support]' \
+ '(-c --config)'{-c,--config=}'[specify config file location]:Yum conf file:_files' \
+ '1:command:((
+ get\:get\ value\ of\ given\ key
+ set\:set\ value\ of\ given\ key
+ del\:delete\ given\ key
+ rename\:rename\ given\ key
+ rename-force\:rename\ given\ key,\ potentially\ removing\ new-key
+ copy\:copy\ given\ key
+ copy-force\:copy\ given\ key,\ potentially\ removing\ new-key
+ search\:search\ packages\ for\ given\ key
+ exist\:list\ packages\ that\ have\ given\ key
+ unset\:list\ packages\ that\ lack\ given\ key
+ info\:display\ data\ in\ the\ yumdb
+ sync\:add\ package\ data\ from\ repositories
+ sync-force\:replace\ package\ data\ from\ repositories
+ undeleted shell
+ ))' \
+ '*:: :->args' && ret=0
+
+ if [[ -n $state ]]; then
+ case $CURRENT:$words[1] in
+ 3:set|<3->:search)
+ case $words[2] in
+ reason) _wanted reasons expl reason compadd user dep ;;
+ *) _message -e values value ;;
+ esac
+ ;;
+ 3:(copy|rename)*) desc='new key';&
+ 2:(^(info|sync)))
+ _wanted -x keys expl "${desc:-key}" compadd \
+ checksum_data checksum_type command_line from_repo from_repo_revision \
+ from_repo_timestamp reason releasever installonly origin_url changed_by && ret=0
+ ;;
+ *) _yum_act_on_installed_pkgs && ret=0 ;;
+ esac
+ fi
+ return ret
+}
+
(( $+functions[_yum_command] )) || _yum_command()
{
local -a _yum_cmds
diff --git a/Completion/Solaris/Command/_prstat b/Completion/Solaris/Command/_prstat
index 963fad649..1eb38845c 100644
--- a/Completion/Solaris/Command/_prstat
+++ b/Completion/Solaris/Command/_prstat
@@ -2,6 +2,7 @@
_prstat()
{
+ local d_opt sort_key
d_opt=(
"u"\:"seconds past the epoch"
"d"\:"standard date format"
diff --git a/Completion/Unix/Command/_a2ps b/Completion/Unix/Command/_a2ps
index c700c205d..aa2f4c3ba 100644
--- a/Completion/Unix/Command/_a2ps
+++ b/Completion/Unix/Command/_a2ps
@@ -7,7 +7,7 @@ if [[ "$words[1]" != "$_cache_a2ps_cmd" ]]; then
_cache_a2ps_cmd="$words[1]"
- descr=( "${(@)${(f@)$(_call_program features LC_ALL=C $words[1] --list=features)//
+ descr=( "${(@)${(f@)$(_call_program features $words[1] --list=features)//
/ }:#}" )
_cache_a2ps_values=(
diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb
index 6b56d1748..776a03cbc 100644
--- a/Completion/Unix/Command/_adb
+++ b/Completion/Unix/Command/_adb
@@ -1,12 +1,11 @@
#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=""
+ local -a ADB_DEVICE_SPECIFICATION
+ local LOG_REDIRECT
if [[ $1 = -l ]]; then
# Run to load _adb and associated functions but do
@@ -23,7 +22,6 @@ _adb() {
(ANDROID_SERIAL)
_adb_device_serial
- ADB_DEVICE_SPECIFICATION="-s ${ANDROID_SERIAL}"
;;
(ANDROID_LOG_TAGS)
@@ -80,18 +78,18 @@ _adb() {
(( $+functions[_adb_device_specification] )) && _adb_device_specification
- adb ${=ADB_DEVICE_SPECIFICATION} shell exit 2>/dev/null || {
+ if ! adb ${ADB_DEVICE_SPECIFICATION} shell exit 2>/dev/null; then
# 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"
+ [[ $words[CURRENT-1] = -s ]] || _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]' \
+ '-s[serial]: :_adb_device_serial' \
+ '( -e)-d[device]' \
+ '(-d )-e[emulator]' \
'1:options:_adb_options_handler' \
'*: : _default'
- return;
- }
+ return
+ fi
(( $+functions[_adb_check_log_redirect] )) && _adb_check_log_redirect
@@ -163,27 +161,13 @@ _adb_sanitize_context () {
(( $+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
+ local -a word
+ word=($words[(R)-[des]])
+ if [[ $words[(R)-s] == -s ]]; then
+ local i=$words[(I)-s]
+ word=($words[i,i+1])
+ fi
+ ADB_DEVICE_SPECIFICATION=($word)
}
(( $+functions[_adb_dispatch_shell] )) ||
@@ -230,8 +214,10 @@ _adb_pm_list () {
;;
(features)
;;
+ (users)
+ ;;
(*)
- _wanted pm_list_argument expl 'pm list argument' compadd packages permission-groups permissions instrumentation features
+ _wanted pm_list_argument expl 'pm list argument' compadd packages permission-groups permissions instrumentation features users
;;
esac
}
@@ -319,16 +305,10 @@ _adb_package_manager_handler () {
(( $+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'
+ '--user[uninstall for user id]:user id:_adb_users' \
+ '1:installed package:_adb_installed_packages'
}
(( $+functions[_adb_dispatch_install] )) ||
@@ -390,7 +370,7 @@ _adb_dispatch_connection_handling () {
(( $+functions[_adb_check_log_redirect] )) ||
_adb_check_log_redirect () {
- LOG_REDIRECT=${$(adb ${=ADB_DEVICE_SPECIFICATION} shell getprop log.redirect-stdio 2>/dev/null)//
+ LOG_REDIRECT=${$(adb ${ADB_DEVICE_SPECIFICATION} shell getprop log.redirect-stdio 2>/dev/null)//
/}
[[ ${LOG_REDIRECT[1,4]} == "true" ]] && _message -r "Notice: stdio log redirection enabled on the device, so some completions will not work"
}
@@ -414,18 +394,27 @@ _adb_trace_opts() {
(( $+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')
+ local -a devices device_desc
+ local device
+ devices=( $(adb devices -l | sed -n 's/^\([^[:space:]]*\)[[:space:]]*.*product:\([^[:space:]]*\).*$/\1:\2/p') )
+ zstyle -a :completion:${curcontext} device-names device_desc
+ for device in $device_desc; do
+ if [[ -n $devices[(r)${device%:*}:*] ]]; then
+ devices[(i)${device%:*}:*]=$device
+ fi
+ done
+ _describe -t dev_serial 'available devices' devices
}
(( $+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)}
+ 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) )
+ logcat_filter_tags=( $(command adb ${ADB_DEVICE_SPECIFICATION} logcat -d -v brief | sed -n 's#^[VDIWEF]/\([^[:space:](]*\).*#\1#p' |sort | uniq) )
_store_cache "$cacheid" logcat_filter_tags
fi
local expl
@@ -466,7 +455,7 @@ _adb_shell_commands_handler() {
(( $+functions[_adb_device_available] )) ||
_adb_device_available() {
- [[ $(adb ${=ADB_DEVICE_SPECIFICATION} get-state 2>&1) == "device" ]] && return 0
+ [[ $(adb ${ADB_DEVICE_SPECIFICATION} get-state 2>&1) == "device" ]] && return 0
return 1
}
@@ -480,7 +469,7 @@ _adb_remote_folder () {
pref=${pref%/*}/
fi
# yes, this ls is sickening to look at, but android doesn't have printf or find
- files=(${${(f)"$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'ls -d 2> /dev/null '$pref'*/ '$pref'*')"}%$'\r'})
+ files=(${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} shell 'ls -1d 2> /dev/null '$pref'*/ '$pref'*')"}%$'\r'})
dirs=(${${(M)files:#*/}%/})
files=(${${files:|dirs}:#*\*(/|)})
_adb_device_available && \
@@ -495,17 +484,24 @@ _adb_installed_packages() {
zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_single_command
fi
- local cacheid=package_cache_${$(adb ${=ADB_DEVICE_SPECIFICATION} get-serialno)}
+ 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:/})
+ 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_users] )) ||
+_adb_users() {
+ local -a users
+ users=( ${${${(M)${(f)"$(adb shell pm list users)"}:#*UserInfo*}#*UserInfo\{}%:*} )
+ _describe -t users 'users' users
+}
+
(( $+functions[_adb_cache_policy_single_command] )) ||
_adb_cache_policy_single_command () {
typeset -a old
diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible
new file mode 100644
index 000000000..f05dac8a6
--- /dev/null
+++ b/Completion/Unix/Command/_ansible
@@ -0,0 +1,281 @@
+#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault
+
+local curcontext="$curcontext" plug plugvar ret=1
+local -a args state line
+local -A opt_args
+
+case $service in
+ ansible|ansible-console|ansible-doc|ansible-playbook)
+ args=(
+ \*{-M+,--module-path=}'[specify path to modules]:module path:_dir_list'
+ )
+ ;|
+ ansible|ansible-console|ansible-playbook|ansible-pull)
+ args+=(
+ '(-K --ask-become-pass)'{-K,--ask-become-pass}'[ask for privilege escalation password]'
+ '(-k --ask-pass)'{-k,--ask-pass}'[ask for connection password]'
+ '(-T --timeout)'{-T+,--timeout=}'[override the connection timeout]:timeout (seconds) [10]'
+ '(-c --connection)'{-c+,--connection=}'[specify connection type]:connection type [smart]:->connect-types'
+ '(-u --user)'{-u+,--user=}'[specify remote user for connection]:remote user:_users'
+ '--private-key=[specify file to use to authenticate the connection]:private key file:_files'
+ '--ssh-common-args=[specify common arguments to pass to sftp/scp/ssh]:ssh option'
+ '--sftp-extra-args=[specify extra arguments to pass to sftp]:sftp option'
+ '--scp-extra-args=[specify extra arguments to pass to scp]:scp option'
+ '--ssh-extra-args=[specify extra arguments to pass to ssh]:ssh option'
+ )
+ ;|
+ ansible|ansible-console|ansible-playbook)
+ args+=(
+ '(-C --check)'{-C,--check}"[don't make any changes]"
+ '(-D --diff)'{-D,--diff}'[show differences when changing small files and templates]'
+ '(-b --become)'{-b,--become}'[escalate privileges on remote system]'
+ '(-f --forks)'{-f+,--forks=}'[specify number of parallel processes to use]:processes [5]'
+ '--become-method=[specify privilege escalation method to use]:method [sudo]:(sudo su pbrun pfexec doas dzdo ksu runas pmrun)'
+ '--become-user=[specify remote user for running operations]:user:_users'
+ "--syntax-check[perform a syntax check on the playbook, but don't execute it]"
+ '!(-R --su-user -U --sudo-user)'{-R,-U,--su-user,--sudo-user}':user [root]:_users'
+ )
+ ;|
+ ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull|ansible-vault)
+ args+=(
+ '--ask-vault-pass[ask for vault password]'
+ '--new-vault-id=[specify new vault identity to use for rekey]:vault id'
+ '--new-vault-password-file=[specify new vault password file to use for rekey]:file:_files'
+ '--vault-id=[specify vault identity to use]:vault identity'
+ '--vault-password-file=[specify vault password file]:vault password file:_files'
+ )
+ ;|
+ ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull)
+ args+=(
+ '--list-hosts[output list of matching hosts]'
+ '(-i --inventory)'{-i+,--inventory=}'[specify inventory host file]:inventory file:_files'
+ '!(-i --inventory)--inventory-file=:inventory file:_files'
+ '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts'
+ )
+ ;|
+ ansible|ansible-playbook|ansible-pull)
+ args+=(
+ '(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON'
+ )
+ ;|
+ ansible-playbook|ansible-pull)
+ args+=(
+ '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]'
+ "--skip-tags[only run plays and tasks whose tags don't match]"
+ )
+ ;|
+ ansible|ansible-pull)
+ args+=(
+ '(-m --module-name)'{-m+,--module-name=}'[specify module]:module:->plugins'
+ )
+ ;|
+ ansible)
+ args+=(
+ '(-a --args)'{-a+,--args=}'[specify command or module arguments]:arguments:->args'
+ '(-B --background)'{-B+,--background=}'[run asynchronously, failing after specified time]:fail timeout (seconds)'
+ '(-o --one-line)'{-o,--one-line}'[condense output]'
+ '(-P --poll)'{-P+,--poll=}'[specify the poll interval if using -B]:interval (seconds) [15]'
+ '(-t --tree)'{-t+,--tree=}'[specify directory for log output]:directory:_directories'
+ '--output[output file name for encrypt or decrypt; use - for stdout]:output file:_files'
+ ':host:->hosts'
+ )
+ ;;
+ ansible-config)
+ args+=(
+ '(-c --config)'{-c+,--config=}'[specify configuration file]:config file:_files'
+ '1:action:((
+ list\:list\ all\ configuration
+ dump\:show\ the\ current\ settings,\ merge\ specified\ configuration
+ view\:display\ the\ current\ config\ file
+ ))'
+ )
+ [[ -n $words[(r)dump] ]] && args+=( '--only-changed[only show configuration that is changed from the default]' )
+ ;;
+ ansible-console)
+ args+=(
+ '--step[one-step-at-a-time: confirm each task before running]'
+ )
+ ;;
+ ansible-doc)
+ args+=(
+ '(-l --list)'{-l,--list}'[list available plugins]'
+ '(-s --snippet)'{-s,--snippet}'[show playbook snippet for specified plugins]'
+ '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(cache callback connection inventory lookup module strategy vars)'
+ '*:plugin:->plugins'
+ )
+ ;;
+ ansible-inventory)
+ args+=(
+ '(-y --yaml)--graph[output inventory graph]'
+ '--host[output specific host information]'
+ '--list[output all hosts information]'
+ '(-y --yaml)--vars[add variables to the graph display]'
+ '(-y --yaml --vars --graph)'{-y,--yaml}'[use YAML format instead of JSON]'
+ )
+ ;;
+ ansible-galaxy)
+ args+=( -A "-*" $args
+ '--list[list integrations]'
+ '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]'
+ '(-s --server)'{-s+,--server=}'[specify API server destination]:server destination'
+ '--remove=[remove integration]:integration id'
+ '1:action:(delete import info init install list login remove search setup)'
+ '*::args:->galaxy'
+ )
+ ;;
+ ansible-playbook)
+ args+=(
+ '--flush-cache[clear the fact cache]'
+ '--force-handlers[run handlers even if a task fails]'
+ '--list-tags[list all available tags]'
+ '--list-tasks[list all tasks that would be executed]'
+ '--start-at-task=[start the playbook at specified task]:task'
+ '--key-file=[specify file to use to authenticate the connection]:private key file:_files'
+ '*:playbook:_files -g "(#i)*.y(|a)ml"'
+ )
+ ;;
+ ansible-pull)
+ args+=(
+ "--check[don't make any changes]"
+ '(-d --directory)'{-d+,--directory=}'[specify directory to checkout repository to]:directory:_directories'
+ '--full[do a full instead of a shallow clone]'
+ '--accept-host-key[adds the hostkey for the repo url if not already added]'
+ '--purge[purge checkout after playbook run]'
+ '(-f --force)'{-f,--force}'[run the playbook even if the repository could not be updated]'
+ '(-C --checkout)'{-C,--checkout}'[specify branch/tag/commit to checkout]:branch/tag/commit'
+ '--track-subs[submodules will track the latest changes]'
+ '(-o --only-if-changed)'{-o,--only-if-changed}'[only run the playbook if the repository has been updated]'
+ '(-s --sleep)'{-s+,--sleep=}'[delay for random duration before starting]:max delay (seconds)'
+ '(-U --url)'{-U+,--url=}'[specify URL of the playbook repository]:url:_urls'
+ '--verify-commit[verify GPG signature of checked out commit]'
+ '*:playbook:_files -g "(#i)*.y(|a)ml"'
+ )
+ ;;
+ ansible-vault)
+ args=( -A "-*" $args
+ '*::args:->vault'
+ )
+ ;;
+esac
+
+_arguments -s -S -C $args \
+ '(- :)--version[display version information]' \
+ '(- :)'{-h,--help}'[display usage information]' \
+ \*{-v,--verbose}"[verbose mode (repeat to increase)]" && ret=0
+
+plug=${(v)opt_args[(i)-(t|-type)]:-module}
+case $state in
+ args)
+ case ${(v)opt_args[(I)-(m|module)]} in
+ *) # shell, command or no module specified
+ _cmdstring && ret=0
+ ;;
+ esac
+ ;;
+ hosts)
+ local alts
+ [[ -prefix - ]] && return ret
+ compset -P '*[,:](|[&!~])'
+ compset -S '[:,]*'
+ if compset -P '@'; then
+ _files && ret=0
+ else
+ local -a inventory
+ typeset -ga _ansible_hosts _ansible_groups
+ if (( !$#_ansible_hosts || !$#_ansible_groups )); then
+ inventory=( ${(f)"$(_call_program groups ansible-inventory --graph)"} )
+ _ansible_hosts=( ${${(M)inventory%--[^:]#}#--} )
+ _ansible_groups=( ${${${(M)inventory%@*:}%:}#@} )
+ fi
+ [[ $IPREFIX = *[:,] ]] &&
+ alts=( 'operators:operator:_values -S "" operator "![exclude hosts]" "&[intersection of hosts]" "~[regular expression pattern]"' )
+ _alternative $alts \
+ 'groups:group:compadd -qS: -a _ansible_groups' \
+ 'hosts:host:compadd -qS: -a _ansible_hosts' && ret=0
+ fi
+ ;;
+ connect-types)
+ plug=connection
+ ;&
+ plugins)
+ plugvar=_ansible_${plug}_plugins
+ typeset -ga ${plug}
+ (( ${(P)#plugvar} )) || set -A ${plugvar} \
+ ${${(f)"$(_call_program plugins ansible-doc -t $plug -l)"}/ ##/:}
+ _describe -t plugins "${plug} plugin" $plugvar && ret=0
+ ;;
+ galaxy)
+ curcontext="${curcontext%:*}-${line[1]}:"
+ args=()
+ case $line[1] in
+ info|search|list|remove|install)
+ args=( '(-p --roles-path)'{-p,--roles-path}'[specify location of roles]:path:_directories' )
+ ;|
+ info|init)
+ args+=( "--offline[don't query the galaxy API]" )
+ ;|
+ init|install)
+ args+=( '(-f --force)'{-f,--force}'[force overwriting an existing role]' )
+ ;|
+ search)
+ args+=(
+ '--author=[specify GitHub username]:username'
+ '--galaxy-tags=[specify list of galaxy tags to filter by]:galaxy tags'
+ '--platforms=[specify list of OS platforms to filter by]:platforms'
+ '*: :_guard "^-*" "search term"'
+ )
+ ;;
+ setup)
+ args=(
+ '--list[list integrations]'
+ '--remove=[remove integration]:integration id'
+ )
+ ;;
+ init)
+ args+=(
+ '--container-enabled[initialize the skeleton role with default contents for a Container Enabled role]'
+ '--init-path=[specify path in which the skeleton role will be created]:path:_directories'
+ '--role-skeleton=[specify path to a role skeleton that the new role should be based upon]'
+ )
+ ;;
+ install)
+ args+=(
+ '(-n --no-deps)'{-n,--no-deps}"[don’t download roles listed as dependencies]"
+ '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors and continue with the next specified role]'
+ '(-r --role-file)'{-r+,--role-file=}'[specify file containing a list of roles to be imported]:file:_files'
+ )
+ ;;
+ import)
+ args+=(
+ '--status[check the status of the most recent import request for given github_user/github_repo]'
+ "--no-wait[don’t wait for import results]"
+ '--branch=[specify branch to import]:branch'
+ '--role-name=[specify name the role should have]:role'
+ )
+ ;;
+ login)
+ args+=(
+ '--github-token=[identify with github token rather than username and password]'
+ )
+ ;;
+ esac
+ _arguments -s -S $args && ret=0
+ ;;
+ vault)
+ curcontext="${curcontext%:*}-${line[1]}:"
+ args=()
+ case $line[1] in
+ (de|en)crypt*) args=( '--output=[specify output file name]:file:_files' ) ;|
+ encrypt_string)
+ args+=(
+ '(-p --prompt)'{-p,--prompt}'[prompt for the string to encrypt]'
+ '(-n --name)'{-n+,--name=}'[specify the variable name]:variable'
+ '--stdin-name=[specify the variable name for stdin]:variable'
+ )
+ ;;
+ esac
+ _arguments -s -S $args && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_arp b/Completion/Unix/Command/_arp
index 80e829022..5b047b2b8 100644
--- a/Completion/Unix/Command/_arp
+++ b/Completion/Unix/Command/_arp
@@ -2,7 +2,7 @@
local state line expl curcontext="$curcontext" ret=1
typeset -A opt_args
-local -a cmds args
+local -a cmds args vopt flags
flags=( temp pub )
cmds=(
diff --git a/Completion/Unix/Command/_arping b/Completion/Unix/Command/_arping
index bd9bc8ccc..66ce7bc18 100644
--- a/Completion/Unix/Command/_arping
+++ b/Completion/Unix/Command/_arping
@@ -29,6 +29,7 @@ _arguments -s -S -A "-*" \
'-D[display answers as exclamation marks and missing packets as dots]' \
'-e[like -a but beep when there is no reply]' \
"-F[don't try to be smart about the interface name]" \
+ '-g+[specify group to setgid() to]:group [nobody]:_groups' \
'-m+[specify type of timestamp for incoming packets]:timestamp type' \
'(:)-B[255.255.255.255]' \
'-0[source 0.0.0.0]' \
@@ -36,6 +37,7 @@ _arguments -s -S -A "-*" \
'-S+[set source IP]:source IP address:_hosts' \
'-T+[target IP]:target IP address:_hosts' \
'-p[turn on promiscuous mode]' \
+ '-Q+[specify 802.1p priority to set]:priority [0]' \
'-s[set source MAC address]:source MAC address' \
'-t[set target MAC address]:target MAC address' \
'-c[send this many requests]:count' \
@@ -45,7 +47,8 @@ _arguments -s -S -A "-*" \
'-P[send ARP replies instead of requests]' \
'-u[show index=received/sent instead of just index=received when pinging MACs]' \
'-U[send unsolicited ARP]' \
- '-w+[specify time to wait between pings (ms)]:time (ms)' \
+ '-V+[specify VLAN tag to set]:vlan' \
+ '-w+[specify time to wait between pings (microseconds)]:time (microseconds)' \
'-W+[specify time to wait between pings (seconds)]:time (seconds)' \
'(-B):address:_hosts'
diff --git a/Completion/Unix/Command/_attr b/Completion/Unix/Command/_attr
index df1fb7da4..2030064dc 100644
--- a/Completion/Unix/Command/_attr
+++ b/Completion/Unix/Command/_attr
@@ -1,4 +1,4 @@
-#compdef attr getfattr setfattr
+#compdef attr getfattr setfattr xattr
case $service in
attr)
@@ -45,4 +45,23 @@ case $service in
'*:file:_files'
return
;;
+ # The Python xattr module ships with a utility called xattr which might appear
+ # on some systems; it is not entirely compatible with the Darwin variant, but
+ # does seem inspired by it, to the degree that this is probably close enough
+ xattr)
+ _arguments -s -S -A '-*' : \
+ '(: -)'{-h,--help}'[display help information]' \
+ '(-c -d -w)-l[display in long format]' \
+ '-r[act recursively]' \
+ '-s[act on symbolic links]' \
+ '(-w)-v[always display file name]' \
+ '(-c -d)-x[use hexademical format for value input and output]' \
+ '*: :_files' \
+ + '(op)' \
+ '(-l -x)-c[remove all attributes]' \
+ '(-l -x)-d[remove specified attribute]:attribute name' \
+ '-p[display value of specified attribute]:attribute name' \
+ '(-l -v)-w[set value of specified attribute]:attribute name: :attribute value'
+ return
+ ;;
esac
diff --git a/Completion/Unix/Command/_awk b/Completion/Unix/Command/_awk
index 9050c2f7d..4063743e5 100644
--- a/Completion/Unix/Command/_awk
+++ b/Completion/Unix/Command/_awk
@@ -53,6 +53,7 @@ case $variant in
'*'{-l+,--load}'[load dynamic extension]:extension:->extension'
{-M,--bignum}'[select arbitrary-precision arithmetic on numbers]'
{-o-,--pretty-print=-}'[pretty-print awk program]::output file:_files'
+ '(-s --no-optimize)'{-s,--no-optimize}'[disable default optimizations upon the internal program representation]'
{-S,--sandbox}'[disable system(), redirections and dynamic extensions]'
)
;;
diff --git a/Completion/Unix/Command/_cat b/Completion/Unix/Command/_cat
index 46180f2c8..e383f8c6b 100644
--- a/Completion/Unix/Command/_cat
+++ b/Completion/Unix/Command/_cat
@@ -1,4 +1,4 @@
-#compdef cat
+#compdef cat gcat
local -a args
diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod
index 85e6df1ae..af64b9eb9 100644
--- a/Completion/Unix/Command/_chmod
+++ b/Completion/Unix/Command/_chmod
@@ -3,7 +3,7 @@
local curcontext="$curcontext" state line expl ret=1
local -a args privs
-args=( '*:file:->files' '1:mode:->mode' )
+args=( '*: :->files' '1: :_file_modes' )
if _pick_variant gnu=Free\ Soft unix --version; then
args+=(
@@ -45,35 +45,12 @@ else
'(1)-I[removes all inherited entries from named files ACLs]'
)
;;
- solaris*) privs=( 'l[mandatory locking]' ) ;;
esac
fi
_arguments -C -s "$args[@]" && ret=0
case "$state" in
- mode)
- compset -P \*,
- compset -S ,\*
- if [[ -prefix [0-7] ]]; then
- _message -e number 'numeric mode'
- elif compset -P '[a-z]#[+-=]'; then
- _values -S '' privilege \
- 'r[read]' 'w[write]' 'x[execute]' \
- 's[set uid/gid]' 't[sticky]' \
- 'X[execute only if directory or executable to another]' \
- "u[owner's current permissions]" \
- "g[group's current permissions]" \
- "o[other's current permissions]" \
- "$privs[@]" && ret=0
- else
- suf=( -S '' )
- compset -P '*'
- _alternative -O suf \
- 'who:who:((u\:user g\:group a\:all o\:others))' \
- 'operators:operator:(+ - =)' && ret=0
- fi
- ;;
files)
if [[ -n $opt_args[--reference] ]]; then
zmodload -F zsh/stat b:zstat 2>/dev/null
diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown
index 5750c65ab..c3abb5858 100644
--- a/Completion/Unix/Command/_chown
+++ b/Completion/Unix/Command/_chown
@@ -1,4 +1,4 @@
-#compdef chown chgrp zf_chown=chown zf_chgrp=chgrp
+#compdef chown chgrp gchown=chown gchgrp=chgrp zf_chown=chown zf_chgrp=chgrp
local curcontext="$curcontext" state line expl ret=1
local suf usr grp req deref pattern arg args
diff --git a/Completion/Unix/Command/_cowsay b/Completion/Unix/Command/_cowsay
index 19e73811c..8a1b4c4c9 100644
--- a/Completion/Unix/Command/_cowsay
+++ b/Completion/Unix/Command/_cowsay
@@ -3,26 +3,29 @@
local context state line
typeset -A opt_args
-_arguments \
- '-e:eye string:' \
- '-f:cowfile:->cowfile' \
- '-T:tongue string:' \
- '-W:wrap column:' \
- '-b[borg mode]' \
- '-d[dead mode]' \
- '-g[greedy mode]' \
- '-h[help]' \
- '-l[list]' \
- '-n[no wordwrap]' \
- '-p[paranoia mode]' \
- '-s[stoned mode]' \
- '-t[tired mode]' \
- '-w[wired mode]' \
- '-y[youthful mode]' \
- ':message:' && return 0
+_arguments -s -S -A "-*" \
+ "(H mode)-e+[specify cow's eyes]:eye string [oo]" \
+ '(H)-f+[specify cowfile]:cowfile:->cowfile' \
+ "(H mode)-T+[specify cow's tongue]:tongue string" \
+ '(H)-W+[specify width for message word wrap]:wrap column [40]' \
+ '(H)-n[no wordwrap]' \
+ '*:message' \
+ + 'H' \
+ '(- *)-h[display usage information]' \
+ '(- *)-l[list all cowfiles]' \
+ + '(mode)' \
+ '(H -e -T)-b[borg mode]' \
+ '(H -e -T)-d[dead mode]' \
+ '(H -e -T)-g[greedy mode]' \
+ '(H -e -T)-p[paranoia mode]' \
+ '(H -e -T)-s[stoned mode]' \
+ '(H -e -T)-t[tired mode]' \
+ '(H -e -T)-w[wired mode]' \
+ '(H -e -T)-y[youthful mode]' && return
case "$state" in
(cowfile)
- compadd ${=${(f)"$($service -l 2>/dev/null)"}:#*\:} || _files
+ _wanted -C option-f-1 cowfiles expl 'cow file' compadd \
+ ${=${(f)"$(_call_program cowfiles $words[1] -l)"}:#*\:} || _files -g "*.cow(-.)"
;;
esac
diff --git a/Completion/Unix/Command/_cp b/Completion/Unix/Command/_cp
index 5c3f37983..88750b330 100644
--- a/Completion/Unix/Command/_cp
+++ b/Completion/Unix/Command/_cp
@@ -55,7 +55,7 @@ else
'netbsd*' "-N[don't copy file flags]" \
'(darwin|dragonfly|freebsd|netbsd)*' '-a[archive mode, same as -RpP]' \
'(dragonfly|freebsd)*' '-l[link files instead of copying]' \
- '(darwin|dragonfly|freebsd|netbsd)*' '-v[show file names as they are copied]' \
+ '(darwin|dragonfly|*bsd)*' '-v[show file names as they are copied]' \
'darwin*' "-X[don't copy extended attributes or resource forks]" \
'(dragonfly|freebsd)*' "-x[don't traverse file systems]" \
'freebsd<10->.*' '-s[make symbolic links instead of copies of non-directories]'
diff --git a/Completion/Unix/Command/_cut b/Completion/Unix/Command/_cut
index caf8f32b7..d3b1e2b10 100644
--- a/Completion/Unix/Command/_cut
+++ b/Completion/Unix/Command/_cut
@@ -1,4 +1,4 @@
-#compdef cut
+#compdef cut gcut
typeset -A _cut_args
diff --git a/Completion/Unix/Command/_cvs b/Completion/Unix/Command/_cvs
index 0552d2175..cba3eb773 100644
--- a/Completion/Unix/Command/_cvs
+++ b/Completion/Unix/Command/_cvs
@@ -882,7 +882,7 @@ _cvs_modified_entries() {
}
(( $+_cvs_ignore_default )) ||
-_cvs_ignore_default=(
+local _cvs_ignore_default=(
RCS SCCS CVS CVS.adm RCSLOG 'cvslog.*' tags TAGS .make.state .nse_depinfo
'*\~' '\#*' '.\#*' ',*' '_$*' '*$' '*.old' '*.bak' '*.BAK' '*.orig' '*.rej'
'.del-*' '*.a' '*.olb' '*.o' '*.obj' '*.so' '*.exe' '*.Z' '*.elc' '*.ln'
diff --git a/Completion/Unix/Command/_dconf b/Completion/Unix/Command/_dconf
new file mode 100644
index 000000000..bfb314c72
--- /dev/null
+++ b/Completion/Unix/Command/_dconf
@@ -0,0 +1,71 @@
+#compdef dconf
+
+local curcontext="$curcontext" state line cmds ret=1
+local cmd=$words[1]
+
+cmds=(
+ 'help:display help information'
+ 'read:read the value of a key'
+ 'list:list the contents of a directory'
+ 'write:change the value of a key'
+ 'reset:reset the value of a key or directory'
+ 'compile:compile a binary database from keyfiles'
+ 'update:update the system databases'
+ 'watch:watch a path for changes'
+ 'dump:dump an entire subpath to stdout'
+ 'load:populate a subpath from stdin'
+)
+
+if (( CURRENT == 2 )); then
+ _describe -t commands command cmds
+ return
+fi
+
+curcontext="${curcontext%:*}-$words[2]:"
+shift words
+(( CURRENT-- ))
+
+case $words[1] in
+ dump|list|load) state=dirs ;;
+ watch) state=keys ;;
+ read)
+ _arguments -A "-*" '-d[read default values]' '1:key:->keys' && ret=0
+ ;;
+ write)
+ _arguments '1:key:->keys' '2:value' && ret=0
+ ;;
+ reset)
+ _arguments -A "-*" '-f[reset entire directory]' '1:key:->keys' && ret=0
+ [[ $+opt_args[-f] = 1 && state = keys ]] && state=dirs
+ ;;
+ compile)
+ _arguments '1:file:_files' '2:path:_directories' && ret=0
+ ;;
+ help)
+ _describe -t commands command cmds && ret=0
+ ;;
+ *) _default && ret=0 ;;
+esac
+
+case $state in
+ keys)
+ compset -P '*/'
+ dirs=( ${${${(f)"$(_call_program keys dconf _complete \'\' "${IPREFIX:-/}")"}#$IPREFIX}%% #} )
+ _tags keys
+ while _tags; do
+ if _requested keys; then
+ _description keys expl keu
+ compadd "$expl[@]" -qS ' ' ${dirs:#*/} && ret=0
+ compadd "$expl[@]" -S '' ${(M)dirs:#*/} && ret=0
+ fi
+ (( ret )) || break
+ done
+ ;;
+ dirs)
+ compset -P '*/'
+ _wanted keys expl directory compadd -S '' - \
+ ${${(f)"$(_call_program keys dconf _complete / "${IPREFIX:-/}")"}#$IPREFIX} && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_dd b/Completion/Unix/Command/_dd
index 1a2ae871a..e51337f21 100644
--- a/Completion/Unix/Command/_dd
+++ b/Completion/Unix/Command/_dd
@@ -1,4 +1,4 @@
-#compdef dd
+#compdef dd gdd
_values -w 'option' \
'if[specify input file]:input file:_tilde_files' \
diff --git a/Completion/Unix/Command/_devtodo b/Completion/Unix/Command/_devtodo
index 2380399b9..8363495cd 100644
--- a/Completion/Unix/Command/_devtodo
+++ b/Completion/Unix/Command/_devtodo
@@ -5,7 +5,7 @@ typeset -a arg_generic arg_add todo_opts \
priorities
typeset -A arg_pair arg_desc
typeset -i i
-typeset expl
+typeset expl arg
for ((i=2; i <= $#words; i++)) {
if [[ $words[$i] == '--database' ]]; then
diff --git a/Completion/Unix/Command/_df b/Completion/Unix/Command/_df
index d20ddea7e..2586f4358 100644
--- a/Completion/Unix/Command/_df
+++ b/Completion/Unix/Command/_df
@@ -1,4 +1,4 @@
-#compdef df
+#compdef df gdf
local curcontext="$curcontext" state state_descr line args spec ret=1
local -A opt_args
@@ -8,12 +8,15 @@ if _pick_variant gnu=GNU unix --version; then
'--total[produce a grand total]'
'(-T --print-type)'{-T,--print-type}'[print file system type]'
'(-a --all)'{-a,--all}'[include dummy file systems]'
+ '--direct[show statistics for a file instead of mount point]'
'(-l --local)'{-l,--local}'[limit listing to local file systems]'
'*'{-t+,--type=}'[limit listing to file systems of specified type]:file system type:_file_systems'
'*'{-x+,--exclude-type=}'[exclude file systems of specified type]:file system type:_file_systems'
'(--no-sync)--sync[invoke sync before getting usage info]'
'(--sync)--no-sync[do not invoke sync before getting usage info (default)]'
- '-v[(ignored)]'
+ '--output=-[output all or specified fields]::field:_values -s , "field"
+ source fstype itotal iused iavail ipcent size used avail pcent file target'
+ '!-v'
'(- : *)--help[display help and exit]'
'(- : *)--version[output version information and exit]'
'*:files:_umountable'
diff --git a/Completion/Unix/Command/_dhclient b/Completion/Unix/Command/_dhclient
index 10cb551e0..b5889df21 100644
--- a/Completion/Unix/Command/_dhclient
+++ b/Completion/Unix/Command/_dhclient
@@ -7,19 +7,20 @@ case $OSTYPE in
args+=(
'-c+[specify configuration file]:file:_files'
'-l+[specify leases file]:file:_files'
- '-u[reject leases with unknown options]'
)
;|
freebsd*)
args+=(
'(-d)-b[immediately move to the background]'
'-p+[specify PID file]:file:_files'
+ '-u[reject leases with unknown options]'
)
;;
openbsd*)
args+=(
'-i+[ignore values provided by leases for specified options]:options'
'-L+[specify file to write option data too]:file:_files'
+ "-n[don't configure any interfaces]"
)
;;
*) # ISC implementation, used on Linux and NetBSD
@@ -60,6 +61,7 @@ case $OSTYPE in
'-V[specify vendor-class-identifier option]:option'
'--request-options[specify list of options the client is to request from the server]:options'
'--timeout[specify time after which dhclient will decide that no DHCP servers can be contacted]:timeout'
+ '--dad-wait-time[specify maximum time to wait for duplicate address detection]:time (seconds)'
)
;;
esac
diff --git a/Completion/Unix/Command/_dig b/Completion/Unix/Command/_dig
index a4e175808..5feb71fef 100644
--- a/Completion/Unix/Command/_dig
+++ b/Completion/Unix/Command/_dig
@@ -1,14 +1,5 @@
#compdef dig
-_dns_types() {
- local expl
- _description dns-types expl 'DNS type'
- compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z}' \
- ANY A AAAA AFSDB APL AXFR CAA CDNSKEY CDS CERT CNAME DHCID DLV DNAME \
- DNSKEY DS HIP HINFO IPSECKEY IXFR KEY KX LOC MX NAPTR NS NSEC NSEC3 \
- NSEC3PARAM OPT PTR RRSIG RP SIG SOA SPF SRV SSHFP TA TKEY TLSA TSIG TXT
-}
-
local curcontext="$curcontext" state line expl
local -a alts args
[[ -prefix + ]] && args=(
@@ -66,7 +57,7 @@ local -a alts args
'*+'{no,}'besteffort[try to parse even malformed messages]'
'*+'{no,}'dnssec[request DNSSEC records]'
'*+'{no,}'sigchase[chase DNSSEC signature chains]'
- '*+trusted-key=[specify file conrtaing trusted kets]:file:_files'
+ '*+trusted-key=[specify file containing trusted keys]:file:_files'
'*+'{no,}'topdown[do DNSSEC validation in top down mode]'
'*+'{no,}'nsid[include EDNS name server ID request in query]'
'*+'{no,}'ttlid[display the TTL whening printing the record]'
diff --git a/Completion/Unix/Command/_drill b/Completion/Unix/Command/_drill
new file mode 100644
index 000000000..68fa7917b
--- /dev/null
+++ b/Completion/Unix/Command/_drill
@@ -0,0 +1,46 @@
+#compdef drill
+
+local curcontext="$curcontext" ret=1
+local -a state line expl
+
+_arguments -s -S -C \
+ '-D[enable DNSSEC (DO bit)]' \
+ '-T[trace from the root down]' \
+ '-S[chase signature(s) to a known key]' \
+ '-I[specify source address to query from]:source address' \
+ '(-Q)-V+[specify verbosity]:number (0-5)' \
+ '(-V)-Q[quiet mode (overrules -V)]' \
+ '-f+[read packet from file and send it]:file:_files' \
+ '-i+[read packet from file and print it]:file:_files' \
+ '-w+[write answer packet to file]:file:_files' \
+ '-q+[write query packet to file]:file:_files' \
+ '(- *)-h[display usage information]' \
+ '(- *)-v[display version information]' \
+ '(-6)-4[stay on ipv4]' \
+ '(-4)-6[stay on ipv6]' \
+ '-a[fallback to EDNS0 and TCP if the answer is truncated]' \
+ '-b+[specify buffer size (defaults to 512 b)]:size (bytes) [512]' \
+ '-c+[use specified file for rescursive nameserver configuration]:file [/etc/resolv.conf]:_files' \
+ '-k+[specify a file that contains a trusted DNSSEC key]:file:_files' \
+ '*-o+[set/unset header bits]:mnemonic (uppercase sets, lower unsets):_sequence compadd - QR qr AA aa TC tc RD rd CD cd RA ra AD ad' \
+ '-p+[use specified remote port number]:port:_ports' \
+ '-s[show the DS RR for each key in a packet]' \
+ '-x[do a reverse lookup]' \
+ '-r+[use specified file as root servers hint file]:file:_files' \
+ '-t[send the query with tcp]' '!(-t)-u' \
+ '-d+[use specified domain as the start point for the trace]:domain' \
+ '-y+[specify named base64 tsig key, and optional algorithm]:name\:key\:algorithm [hmac-md5.sig-alg.reg.int]' \
+ "-z[don't randomize the nameservers before use]" \
+ '*:args:->args' && ret=0
+
+if [[ -n $state ]]; then
+ if compset -P @; then
+ _wanted hosts expl 'DNS server' _hosts && ret=0;
+ else
+ _alternative 'hosts:host:_hosts' \
+ 'types:query type:_dns_types' \
+ 'classes:query class:compadd -M "m:{a-z}={A-Z}" - IN CS CH HS' && ret=0
+ fi
+fi
+
+return ret
diff --git a/Completion/Unix/Command/_enscript b/Completion/Unix/Command/_enscript
index d10acb25f..3e09da5a4 100644
--- a/Completion/Unix/Command/_enscript
+++ b/Completion/Unix/Command/_enscript
@@ -1,9 +1,10 @@
#compdef enscript
-local state context line curcontext="$curcontext" match
+local curcontext="$curcontext" state line match
typeset -A opt_args
+local -a libpath
-_arguments -C -s \
+_arguments -C -s -S \
'( -2 --columns)-1' \
'(-1 --columns)-2' \
'(-1 -2 )--columns=:columns:' \
@@ -11,14 +12,11 @@ _arguments -C -s \
'(-a)--pages=:pages:(even odd)' \
'(--file-align)-A+:align:' \
'(-A)--file-align=:align:' \
- '(--header)-b+:page header:' \
- '(-b)--header=:page header:' \
- '(--no-header)-B' \
- '(-B)--no-header' \
+ '(--header -b -B --no-header --lineprinter -l)'{-b+,--header=}':page header:->formats' \
+ '(--header -b -B --no-header --lineprinter -l)'{-B,--no-header} \
'(--truncate-lines)-c' \
'(-c)--truncate-lines' \
- '(--line-numbers)-C-:start line:' \
- '(-C)--line-numbers=-:start line:' \
+ '(--line-numbers -C)'{-C-,--line-numbers=-}'::start line [1]' \
'(--printer -d )-P+:printer name: _printers' \
'(--printer -P)-d+:printer name: _printers' \
'( -d -P)--printer=:printer name: _printers' \
@@ -26,34 +24,24 @@ _arguments -C -s \
'*--setpagedevice=:key\:value:' \
'(--escapes)-e-:escape character:' \
'(-e)--escapes=-:escape character:' \
- '(--pretty-print)-E-:input language:->inputlang' \
- '(-E)--pretty-print=-:input language:->inputlang' \
- '(--font)-f+:fontname:' \
- '(-f)--font=:fontname:' \
- '(--header-font)-F+:fontname:' \
- '(-F)--header-font=:fontname:' \
+ '(-E --highlight)'{-E-,--highlight=-}':input language:->inputlang' \
+ '(--font -f)'{-f+,--font=}':fontname:->fonts' \
+ '(--header-font -F)'{-F+,--header-font=}':fontname:->fonts' \
'(--print-anyway)-g' \
'(-g)--print-anyway' \
'(--fancy-header)-G' \
- '(-G)--fancy-header=-:name:' \
+ '(-G)--fancy-header=:header:->headers' \
'(--no-job-header)-h' \
'(-h)--no-job-header' \
- '(--highlight-bars)-H-:lines:' \
- '(-H)--highlight-bars=-:lines:' \
- '(--indent)-i+:indent length:' \
- '(-i)--indent=:indent length:' \
- '(--filter)-I+:input filter:->commandline' \
- '(-I)--filter=:input filter:->commandline' \
+ '(--highlight-bars -H)'{-H-,--highlight-bars=-}'::height (lines) [2]' \
+ '(--indent -i)'{-i+,--indent=}':indent width' \
+ '(--filter -I)'{-I+,--filter=}':input filter:_cmdstring' \
'(--borders)-j' \
'(-j)--borders' \
- '(--page-prefeed)-k' \
- '(-k)--page-prefeed' \
- '(--no-page-prefeed)-K' \
- '(-K)--no-page-prefeed' \
- '(--lineprinter)-l' \
- '(-l)--lineprinter' \
- '(--lines-per-page)-L+:lines per page:' \
- '(-L)--lines-per-page=:lines per page:' \
+ '(-k --page-prefeed -K --no-page-prefeed)'{-k,--page-prefeed} \
+ '!(-k --page-prefeed -K --no-page-prefeed)'{-K,--no-page-prefeed} \
+ '(--lineprinter -l --lines-per-page -L --header -b -B --no-header)'{-l,--lineprinter} \
+ '(--lines-per-page -L --lineprinter -l)'{-L+,--lines-per-page=}':lines per page' \
'(--mail)-m' \
'(-m)--mail' \
'(--media)-M+:media name:(A4)' \
@@ -63,37 +51,30 @@ _arguments -C -s \
'( -n -#)--copies=:number of copies:' \
'(--newline)-N+:newline type:((n\:unix r\:mac))' \
'(-N)--newline=:newline type:((n\:unix r\:mac))' \
- '(--output -p )-o+:output file:' \
- '(--output -o)-p+:output file:_files' \
- '( -p -o)--output=:output file:_files' \
+ '(-o -p --output -p)'{-o+,-p+,--output=}':output file:_files' \
'(--missing-characters)-O' \
'(-O)--missing-characters' \
'(--quiet --silent)-q' \
'(-q --silent)--quiet' \
'(-q --quiet)--silent' \
- '(--landscape)-r' \
- '(-r)--landscape' \
- '(--portrait)-R' \
- '(-R)--portrait' \
- '(--baselineskip)-s+:baseline skip:' \
- '(-s)--baselineskip=:baseline skip:' \
+ '(-r --landscape -R --portrait)'{-r,--landscape} \
+ '(-r --landscape -R --portrait)'{-R,--portrait} \
+ '(--baselineskip -s)'{-s+,--baselineskip=}':baseline skip (PostScript points) [1]' \
'*-S+:key\:value:' \
'*--statusdict=:key\:value:' \
'(--title -t )-J+:banner title:' \
'(--title -J)-t+:banner title:' \
'( -t -J)--title=:banner title:' \
- '(--tabsize)-T+:tabsize:(8)' \
- '(-T)--tabsize=:tabsize:(8)' \
+ '(--tabsize -T)'{-T+,--tabsize=}':tabsize [8]' \
'(--underlay)-u-:underlay text:' \
'(-u)--underlay=-:underlay text:' \
'(--nup)-U+:pages:(4)' \
'(-U)--nup=:pages:(4)' \
'(--verbose)-v' \
'(-v)--verbose=-:level:' \
- '(--version)-V' \
- '(-V)--version' \
- '(--language)-W+:output language:(PostScript html overstrike rtf)' \
- '(-W)--language=:output language:(PostScript html overstrike rtf)' \
+ '(- *)'{-V,--version} \
+ '(-w --language)'{-w-,--language=}':output language:(PostScript html overstrike rtf)' \
+ '(-W --option)'{-W-,--option=}':helper option' \
'(--encoding)-X+:character encoding:(88591 latin1 88592 latin2 88593 latin3 88594 latin4 88595 cyrillic 88597 greek 88599 latin5 885910 latin6 ascii asciifise asciifi asciise asciidkno asciidk asciino ibmpc pc dos mac vms hp8 koi8 ps PS pslatin1 ISOLatin1Encoding)' \
'(-X)--encoding=:character encoding:(88591 latin1 88592 latin2 88593 latin3 88594 latin4 88595 cyrillic 88597 greek 88599 latin5 885910 latin6 ascii asciifise asciifi asciise asciidkno asciidk asciino ibmpc pc dos mac vms hp8 koi8 ps PS pslatin1 ISOLatin1Encoding)' \
'(--no-formfeed)-z' \
@@ -101,47 +82,111 @@ _arguments -C -s \
'(--pass-through)-Z' \
'(-Z)--pass-through' \
'--color=-:use color:(false true)' \
+ '--continuous-page-numbers' \
'--download-font=:fontname:' \
+ '--extended-return-values' \
'--filter-stdin=:stdin name:(-)' \
+ '--footer=:page footer:->formats' \
'--h-column-height=:horizontal column height:' \
- '--help' \
- '--help-pretty-print' \
- '--highlight-bar-gray=:gray level:' \
+ '(- *)--help' \
+ '(- *)--help-highlight' \
+ '--highlight-bar-gray=:gray level (0-1):' \
'--list-media' \
- '--list-options' \
'--margins=:left\:right\:top\:bottom:' \
- '--mark-wrapped-lines=-:wrapped line style:(none plus box arrow)' \
- '--non-printable-format=:format to visualze non printable characters:(caret octal questionmark space)' \
- '--nup-xpad=:x-padding:(10)' \
- '--nup-ypad=:y-padding:(10)' \
+ '--mark-wrapped-lines=-:wrapped line style [none]:(none plus box arrow)' \
+ '--non-printable-format=:rendering of non-printable characters:(caret octal questionmark space)' \
+ '--nup-columnwise' \
+ '--nup-xpad=:x-padding [10]' \
+ '--nup-ypad=:y-padding [10]' \
'--page-label-format=:page label format:(short long)' \
'--ps-level=:PostScript language level:(1 2)' \
'--printer-options=:extra options:' \
'--rotate-even-pages' \
- '--slice=:virtical slice number:' \
- '--style=:highlighting style:' \
+ '--slice=:vertical slice number' \
+ '--style=:highlighting style:(a2ps emacs emacs_verbose ifh msvc)' \
+ '--swap-even-page-margins' \
'--toc' \
'--word-wrap' \
- '--ul-angle=:underlay text'\''s angle:(45)' \
- '--ul-font=:underlay text'\''s fontname:(Times-Roman200)' \
- '--ul-gray=:underlay text'\''s gray level:(.8)' \
- '--ul-position=:underlay text'\''s position:(+0+0 -0-0)' \
- '--ul-style=:underlay text'\''s style:(outline filled)' \
+ '--ul-angle=:angle' \
+ '--ul-font=:fontname [Times-Roman200]:->fonts' \
+ '--ul-gray=:gray level (0..1) [.8]' \
+ '--ul-position=:position [+0+0 -0-0]' \
+ '--ul-style=:style [outline]:(outline filled)' \
'*:filename:_files' && return 0
case "$state" in
-commandline)
- compset -q
- _normal
+ fonts)
+ if compset -P 1 '*@'; then
+ _message -e size 'pointsize, optionally width/height'
+ else
+ libpath=( {${commands[enscript]:h:h},/usr}/share/enscript/afm/font.map(N) )
+ _wanted fonts expl font compadd -qS @ - ${${(f)"$(<$libpath[1])"}%% *}
+ fi
;;
-
-inputlang)
- if (( ! $+_enscript_input_languages )); then
- _enscript_input_languages=(${${(f)${(F)${(M)${(f)"$(enscript --help-pretty-print)"}:#(Name|Description):*}}//(#b)Name: ([^
+ formats)
+ local -a specs
+ local suf='{'
+ compquote suf
+ if [[ ${PREFIX} = *[%$]D${suf}[^}]# ]]; then
+ _strftime
+ elif [[ ${(Q)PREFIX} = *\$\([^\)]# ]]; then
+ compset -P '*\('
+ _parameters -g '*export*' -S '\)'
+ elif [[ ${(Q)PREFIX} = *\$ ]]; then
+ specs=(
+ '$:a dollar symbol'
+ '%:current page number'
+ '=:number of pages in the current file'
+ 'p:number of pages processed so far'
+ {C,\*}':file modification time (hh:mm:ss)'
+ 'n:basename of the input file name'
+ 'N:full input file name'
+ 'E:file modification date (yy/mm/dd)'
+ 'F:file modification date (dd.mm.yyyy)'
+ 't:file modification time (12-hour)'
+ 'T:file modification time (24-hour)'
+ 'v:sequence number of current input file'
+ 'V:sequence number of current input file in table of contents format'
+ 'W:file modification date (mm/dd/yy)'
+ '\(:environment variable'
+ )
+ compset -P "*"
+ _describe -t format-specifiers 'format specifier' specs -S '' -- '( D:modification\ date )' -qS $suf
+ elif [[ ${(Q)PREFIX} = *% ]]; then
+ specs=(
+ 'c:trailing component of the current working directory'
+ {C,\*}':current time (hh:mm:ss)'
+ 'E:current date (yy/mm/dd)'
+ 'F:current date (dd.mm.yyyy)'
+ 'H:document title'
+ 'L:lines in the input file'
+ 'm:hostname in short form'
+ 'M:hostname in fully qualified form'
+ 'n:user login name'
+ 'N:user gecos field first component'
+ 't:current time (12-hour)'
+ 'T:current time (24-hour)'
+ 'W:current date (mm/dd/yy)'
+ )
+ compset -P "*"
+ _describe -t format-specifiers 'format specifier' specs -S '' -- '( D:current\ time )' -qS $suf
+ else
+ compset -P "*"
+ _wanted format-specifiers expl 'format specifier' compadd -S '' % \$
+ fi
+ ;;
+ headers)
+ libpath=( {${commands[enscript]:h:h},/usr}/share/enscript(N/) ~/.enscript(N/) )
+ _wanted headers expl header compadd $^libpath/*.hdr(N:r:t)
+ ;;
+ inputlang)
+ if (( ! $+_cache_enscript_languages )); then
+ typeset -ga _cache_enscript_languages
+ _cache_enscript_languages=(${${(f)${(F)${(M)${(f)"$(_call_program languages enscript --help-pretty-print)"}:#(Name|Description):*}}//(#b)Name: ([^
]##)(
Description: ([^
]##)|)/$match[1]:$match[3]}%:})
- fi
- _describe 'input language' _enscript_input_languages --
+ fi
+ _describe -t languages 'input language' _cache_enscript_languages
;;
esac
diff --git a/Completion/Unix/Command/_entr b/Completion/Unix/Command/_entr
index 8a830ae71..a8d43fc5e 100644
--- a/Completion/Unix/Command/_entr
+++ b/Completion/Unix/Command/_entr
@@ -1,9 +1,23 @@
#compdef entr
+local curcontext="$curcontext" state state_descr line ret=1
+typeset -A opt_args
+
_arguments -s -S \
'-c[execute clear before invoking utility]' \
'-d[track directories and exit if a new file is added]' \
'-p[postpone first execution of the utility]' \
'-r[reload a persistent child process]' \
- '(-):command name:_command_names -e' \
- '*::arguments:_normal'
+ '(*)-s[evaluate the first argument using interpreter specified by $SHELL]' \
+ '(-): :->command' \
+ '*::arguments:_normal' && ret=0
+
+if [[ -n $state ]]; then
+ if (( $+opt_args[-s] )); then
+ _cmdstring && ret=0
+ else
+ _command_names -e && ret=0
+ fi
+fi
+
+return ret
diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env
index 9b2a1e011..96e96bd7b 100644
--- a/Completion/Unix/Command/_env
+++ b/Completion/Unix/Command/_env
@@ -1,4 +1,4 @@
-#compdef env
+#compdef env genv
local context state line variant args ret=1
@@ -7,7 +7,8 @@ case $variant in
gnu)
args=(
'(-)'{-i,--ignore-environment}'[start with empty environment]'
- '(--ignore-environment -i --help --version)*'{-u,--unset=}'[remove variable from the environment]:env var to remove:_parameters -g "*export*"'
+ '(--ignore-environment -i --help --version)*'{-u+,--unset=}'[remove variable from the environment]:env var to remove:_parameters -g "*export*"'
+ '(-C --chdir)'{-C+,--chdir=}'[change working directory]:directory:_directories'
'(- *)--help[display help information]'
'(- *)--version[display version information]'
)
diff --git a/Completion/Unix/Command/_ffmpeg b/Completion/Unix/Command/_ffmpeg
index d68a094d4..c0b229f35 100644
--- a/Completion/Unix/Command/_ffmpeg
+++ b/Completion/Unix/Command/_ffmpeg
@@ -100,7 +100,7 @@ typeset -A _ffmpeg_flags
local -a _ffmpeg_argspecs
{
- local lastopt
+ local lastopt REPLY
local lastopt_description
local lastopt_takesargs
local lastopt_type
diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find
index 3854d6cce..edd46ac1c 100644
--- a/Completion/Unix/Command/_find
+++ b/Completion/Unix/Command/_find
@@ -139,7 +139,7 @@ _arguments -C $args \
'*-nogroup' \
'*-nouser' \
'*-ok:program: _command_names -e:*\;::program arguments: _normal' \
- '*-perm:file permission bits' \
+ '*-perm: :_file_modes' \
'*-print' \
'*-prune' \
'*-size:file size (blocks)' \
diff --git a/Completion/Unix/Command/_flac b/Completion/Unix/Command/_flac
new file mode 100644
index 000000000..82b6f0160
--- /dev/null
+++ b/Completion/Unix/Command/_flac
@@ -0,0 +1,120 @@
+#compdef flac metaflac
+
+local shortops common shared blocktypes level
+
+shortops=(
+ --show-md5sum
+ --show-min-blocksize
+ --show-max-blocksize
+ --show-min-framesize
+ --show-max-framesize
+ --show-sample-rate
+ --show-channels
+ --show-bps
+ --show-total-samples
+ --show-vendor-tag
+ '--show-tag=:FLAC tag'
+ '--remove-tag=:FLAC tag'
+ '--remove-first-tag=:FLAC tag'
+ --remove-all-tags
+ '*--set-tag=:FLAC tag and value: '
+ '*--set-tag-from-file=:tag'
+ '--import-tags-from=:flat file:_files'
+ '--export-tags-to=:new file: '
+ '--import-cuesheet-from=:file:_files'
+ '--export-cuesheet-to=:new file:_files'
+ '--import-picture-from=:file or specification:_files'
+ '--export-picture-to=:file:_files'
+ --scan-replay-gain
+ --remove-replay-gain
+ --add-replay-gain
+ '*--add-seekpoint=:seek point'
+ '--add-padding=:length (bytes)'
+)
+
+blocktypes=( STREAMINFO PADDING APPLICATION SEEKTABLE VORBIS_COMMENT PICTURE )
+common=(
+ '--block-number=:block number'
+ '(--except-block-type)--block-type=:block type:_sequence compadd - $blocktypes'
+ '(--block-type)--except-block-type=:block type:_sequence compadd - $blocktypes'
+)
+shared=(
+ '--no-utf8-convert'
+ '--preserve-modtime'
+)
+level=( -{,-compression-level-}{0,1,2,3,4,5,6,7,8} --best --fast )
+
+case $service in
+ flac)
+ _arguments -s -S $shared \
+ '(H -c --stdout)'{-c,--stdout}'[write output to stdout]' \
+ '(H -s --silent --totally-silent)'{-s,--silent}"[don't output runtime statistics]" \
+ '(H)--totally-silent' \
+ '(H -w --warnings-as-errors)'{-w,--warnings-as-errors}'[treat all warnings as errors]' \
+ '(H -f --force)'{-f,--force}'[overwrite output files]' \
+ '(H -o --output-name -c --stdout)'{-o,--output-name=}'[specify output file name]' \
+ '(H)--output-prefix=[prepend specified string to output file names]' \
+ '(H)--delete-input-file' \
+ '(H)--keep-foreign-metadata' \
+ '(H)--skip=[skip initial samples from each input]:skip (mm:ss.ss)' \
+ '(H)--until=[stop at specified sample for each input]:stop (+-mm:ss.ss)' \
+ '(H)--ogg[use ogg as a transport layer]' \
+ '(H)--serial-number=[serial number to use for the FLAC stream]:serial number' \
+ '(H --force-aiff-format --force-rf64-format --force-wave64-format)--format-raw-format' \
+ '*:file:_files -F line -g "(#i)*.(${${opt_args[(i)decode-*]:+flac|oga}:-wav|aif|aiff|raw|rf64|w64})(-.)"' \
+ - 'H' \
+ '(-)'{-v,--version}'[display version information]' \
+ '(-)'{-h,--help}'[display help information]' \
+ '(-)'{-H,--explain}'[display detailed explanation of usage and options]' \
+ - encode \
+ '(-V --verify)'{-V,--verify}'[verify a correct encoding]' \
+ --lax --ignore-chunk-sizes '!--sector-align' --replay-gain \
+ '--cuesheet=:file:_files' \
+ '--picture=:specification:' \
+ \*{-T,--tag}'[add a FLAC tag]:field=value' \
+ '--tag-from-file=:field=file' \
+ \*{-S,--seekpoint=}':seek point' \
+ '(-P --padding)'{-P,--padding=}'[add space for metadata]:length (bytes)' \
+ "($level[*])"$^level \
+ '(-b --blocksize)'{-b,--blocksize=}'[specify block size in samples]:size:(192 576 1152 2304 4608 256 512 1024 2048 4096 8192 16384)' \
+ '(-m --mid-side -M --adaptive-mid-side)'{-m,--mid-side}'[try mid-side coding for each frame]' \
+ '(-m --mid-side -M --adaptive-mid-side)'{-M,--adaptive-mid-side}'[adaptive mid-side coding for all frames]' \
+ '(-e --exhaustive-model-search)'{-e,--exhaustive-model-search}'[do exhaustive model search]' \
+ \*{-A,--apodization=}'[window audio data with given the function]:function:(bartlett bartlett_hann blackman blackman_harris_4term_92dbconnes flattop gauss hamming hann kaiser_bessel nuttall rectangle triangle tukey welch)' \
+ '(-l --max-lpc-order)'{-l,--max-lpc-order=}'[specify max LPC order]:order' \
+ '(-p --qlp-coeff-precision-search -q --qlp-coeff-precision)'{-p,--qlp-coeff-precision-search}'[exhaustively search LP coeff quantization]' \
+ '(-p --qlp-coeff-precision-search -q --qlp-coeff-precision)'{-q,--qlp-coeff-precision=}'[specify precision]:precision (bits)' \
+ '(-r --rice-partition-order)'{-r,--rice-partition-order=}'[set min/max residual partition order]:order' \
+ '--endian=:byte order:(big little)' \
+ '--channels=:channels' \
+ '--bps=:bits per sample' \
+ '--sample-rate=:sample rate (Hz)' \
+ '--sign=:sign of samples [signed]:(signed unsigned)' \
+ '--input-size=:size (bytes)' \
+ - decode \
+ '(-d --decode -t --test -a --analyze)'{-d,--decode}'[decode a FLAC encoded file]' \
+ '(-d --decode -t --test -a --analyze --delete-input-file)'{-t,--test}'[test a FLAC encoded file]' \
+ '(-d --decode -t --test -a --analyze --delete-input-file)'{-a,--analyze}'[analyze a FLAC encoded file]' \
+ '(-d --decode -t --test)'{--residual-text,--residual-gnuplot} \
+ '(-F --decode-through-errors)'{-F,--decode-through-errors}'[continue decoding through stream errors]' \
+ '--apply-replaygain-which-is-not-lossless=:specification' \
+ '--cue=[set the beginning and ending cuepoints to decode]:cue point' \
+ '(--force-raw-format --force-rf64-format --force-wave64-format)--force-aiff-format' \
+ '(--force-raw-format --force-aiff-format --force-wave64-format)--force-rf64-format' \
+ '(--force-raw-format --force-aiff-format --force-rf64-format)--force-wave64-format' \
+ ;;
+ metaflac)
+ _arguments -S $shared \
+ '(--no-filename)--with-filename[prefix output with filename]' \
+ '(--with-filename)--no-filename' \
+ '--dont-use-padding[always rewrite the file]' \
+ "*:FLAC file:_files -g \*.flac\(-.\)" \
+ - 'short' $shortops \
+ - 'list' $common --list \
+ '--application-data-format=:format:(text hexdump)' \
+ - 'remove' $common --remove \
+ - '(ops)' \
+ '(-)--help' '(-)--version' \
+ --remove-all --merge-padding --sort-padding
+ ;;
+esac
diff --git a/Completion/Unix/Command/_fmt b/Completion/Unix/Command/_fmt
index 759396637..87c7005b9 100644
--- a/Completion/Unix/Command/_fmt
+++ b/Completion/Unix/Command/_fmt
@@ -1,4 +1,4 @@
-#compdef fmt
+#compdef fmt gfmt
local variant
local -a args
diff --git a/Completion/Unix/Command/_fold b/Completion/Unix/Command/_fold
new file mode 100644
index 000000000..1a3ef8b55
--- /dev/null
+++ b/Completion/Unix/Command/_fold
@@ -0,0 +1,24 @@
+#compdef fold gfold
+
+local variant
+local -a args
+
+_pick_variant -r variant busybox=BusyBox gnu='Free Soft' unix --version
+
+args=(
+ '(-b --bytes)'{-b,--bytes}'[count bytes rather than columns]'
+ '(: -)--help[display help information]'
+ '(-s --spaces)'{-s,--spaces}'[fold on whitespace]'
+ '(-w --width)'{-w+,--width=}'[specify line width]:line width (columns or bytes)'
+ '(: -)--version[display version information]'
+ '*: :_files'
+)
+
+# Non-GNU variants don't support long options (except BusyBox's --help)
+if [[ $variant == *busybox* ]]; then # See also: _busybox
+ args=( ${args:#((#s)|*\))(\*|)--^help*} )
+elif [[ $variant != gnu ]]; then
+ args=( ${args:#((#s)|*\))(\*|)--*} )
+fi
+
+_arguments -s -S : $args
diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
index 28a2ccbda..415909d24 100644
--- a/Completion/Unix/Command/_gcc
+++ b/Completion/Unix/Command/_gcc
@@ -353,7 +353,7 @@ args+=(
'-print-file-name=-[Display the full path to library <library>]:library:->library'
'-print-prog-name=-[Display the full path to compiler component <program>]:program:'
'*-specs=-[Override built-in specs with the contents of <file>]:file:_files'
- '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 c99 c11 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z)'
+ '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 c99 c11 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 gnu++17 c++2a gnu++2a)'
'*-include:include file:_files -g \*.h\(-.\)'
'*-imacros:macro input file:_files -g \*.h\(-.\)'
'*-idirafter:second include path directory:_files -/'
diff --git a/Completion/Unix/Command/_gem b/Completion/Unix/Command/_gem
new file mode 100644
index 000000000..5b048f86d
--- /dev/null
+++ b/Completion/Unix/Command/_gem
@@ -0,0 +1,303 @@
+#compdef gem -P gem[0-9.]#
+
+local curcontext="$curcontext" state line expl ret=1
+local -A opt_args def
+local -a args cmds helptopics proxy lropts filter
+local cmd="unknown"
+
+proxy=(
+ '(-p --http-proxy)'{-p,--http-proxy=}'[use HTTP proxy for remote operations]:proxy url:_urls'
+)
+lropts=( $proxy
+ '${def[local]}(-l --local -r --remote -b --both)'{-l,--local}'[restrict operations to the LOCAL domain]'
+ '${def[remote]}(-l --local -r --remote -b --both)'{-r,--remote}'[restrict operations to the REMOTE domain]'
+ '${def[both]}(-l --local -r --remote -b --both)'{-b,--both}'[allow LOCAL and REMOTE operations]'
+ '(-B --bulk-threshold)'{-B,--bulk-threshold=}'[specify threshold for switching to bulk synchronization]:threshold [1000]'
+ '--clear-sources[clear the gem sources]'
+ \*{-s,--source=}'[append specified URL to list of gem sources]:url:_urls'
+)
+
+_arguments -C -s \
+ '(* -)'{-h,--help}'[display usage information]' \
+ '(* -)'{-v,--version}'[display version information]' \
+ '*::command:->command' && ret=0
+
+if [[ $state = command ]]; then
+ if (( CURRENT == 1 )); then
+ cmd=subcommands
+ else
+ cmds=(
+ build cert check cleanup contents dependency environment fetch
+ generate_index help install list lock mirror open outdated owner
+ pristine push query rdoc search server signin signout sources
+ specification stale uninstall unpack update which yank
+ )
+ cmds=( ${(M)cmds:#${words[1]}*} )
+ if (( ${#cmds} == 1 )); then
+ cmd="$cmds[1]"
+ curcontext="${curcontext%:*:*}:gem-${cmd}:"
+ fi
+ fi
+ case $cmd in
+ help)
+ helptopics=(
+ 'commands:list all gem commands'
+ 'examples:show some examples of usage'
+ 'gem_dependencies:gem dependencies file guide'
+ 'platforms:show information about platforms'
+ )
+ _describe -t topics 'help topics' helptopics -- && ret=0
+ ;&
+ subcommands)
+ cmds=( ${${${(M)${(f)"$(_call_program commands gem help commands)"}:# [^ ]*}## #}/ ##/:} )
+ _describe -t commands 'gem command' cmds -- && ret=0
+ return ret
+ ;;
+ check|cleanup|contents|dependency|list|open|pristine|rdoc|uninstall|unpack|update)
+ args+=( '(--all --skip)*:installed gem:->gems-local' )
+ ;|
+ fetch|install|lock|owner|push|search|yank)
+ args+=( '*:gem:->gems-remote' )
+ ;|
+ cleanup|uninstall)
+ args+=( '(-D --check-development)'{-D,--check-development}'[check development dependencies while uninstalling]' )
+ ;|
+ contents|pristine|rdoc)
+ args+=( '(*)--all[apply to all installed gems]' )
+ ;|
+ list|query) def[local]='!' ;|
+ search) def[remote]='!' ;|
+ list|query|search)
+ args+=( ${(e)lropts}
+ '(-a --all)'{-a,--all}'[display all gem versions]'
+ '(-e --exact)'{-e,--exact}'[use exact string matching instead of regex]'
+ '(-I --no-installed -i --installed)'{-i,--installed}'[check if gem is installed]'
+ '(-I --no-installed -i --installed)'{-I,--no-installed}'[check if gem is not installed]'
+ '--no-versions[display only gem names]'
+ '(-d --details)'{-d,--details}'[display detailed gem information]'
+ '!(-d --details)--no-details'
+ )
+ ;|
+ check|contents|dependency|fetch|install|list|open|pristine|query|rdoc|search|specification|uninstall|unpack|yank)
+ args+=( '(-v --version)'{-v,--version=}'[specify version of gem]:version' )
+ ;|
+ dependency|fetch|install|outdated|specification|uninstall|update|yank)
+ args+=( '--platform=[specify the platform of gem]:platform' )
+ ;|
+ dependency|fetch|install|list|query|search|specification|update)
+ args+=( '--prerelease[include prerelease versions of a gem]' '!(--prerelease)--no-prerelease' )
+ ;|
+ install|unpack|update)
+ args+=( '(-P --trust-policy)'{-P,--trust-policy=}'[specify gem trust policy]:policy' )
+ ;|
+ install|update)
+ def[both]='!'
+ args+=( ${(e)lropts}
+ '(-N --no-document)--document=[generate documentation for installed gems]::documentation type:_sequence compadd - rdoc ri'
+ '(-N --no-document --document)'{-N,--no-document}'[disable documentation generation]'
+ '--build-root=[specify temporary installation root]:directory:_directories'
+ '--vendor[install gem into the vendor directory]'
+ '(-f --force)'{-f,--force}'[force gem to install, bypassing dependency checks]'
+ "(-w --wrappers)--no-wrappers[don't install bin wrappers]"
+ '--format-executable[add matching version suffix on executables to ruby]'
+ "--user-install[install in user's home directory]"
+ '--development[install additional development dependencies]'
+ '--development-all[install development dependencies for all gems]'
+ "--conservative[don't attempt to upgrade gems already meeting version requirement]"
+ "--minimal-deps[don't upgrade any dependencies that already meet version requirements]"
+ '--post-install-message[print post install message]'
+ '(-g --file)'{-g,--file=}'[read from a gem dependencies API file and install the listed gems]:file:_files'
+ '--without=[omit the named groups when installing gem dependencies]:group'
+ "--default[add the gem's full specification to specifications/default and extract only its bin]"
+ '--explain[rather than install the gems, indicate which would be installed]'
+ "--no-lock[don't create a lock file]"
+ '--suggestions[suggest alternates when gems are not found]'
+ )
+ ;|
+ (un|)install|update)
+ args+=(
+ '--ignore-dependencies[ignore dependency requirements]'
+ '(-i --install-dir)'{-i,--install-dir=}'[specify gem repository directory to get installed gems]:directory:_directories'
+ '(-n --bindir)'{-n,--bindir=}'[specify directory where binary files are located]:directory:_directories'
+ )
+ ;|
+ owner|push)
+ args+=( $proxy )
+ ;|
+ owner|push|yank)
+ args+=( '(-k --key)'{-k,--key=}'[use specified API key from ~/.gem/credentials]:key name' )
+ ;|
+ owner|push|signin|yank)
+ args+=( '--host=[use another gemcutter-compatible host]:host:_urls' )
+ ;|
+ install|pristine|update)
+ args+=( '(-E --env-shebang)'{-E,--env-shebang}'[rewrite executables with a shebang of /usr/bin/env]' )
+ ;|
+
+ build)
+ args+=(
+ '--force[skip validation of the spec]'
+ '1:gemspec file:_files -g "*.gemspec(-.)"'
+ )
+ ;;
+ cert)
+ args+=(
+ '(-a --add)'{-a,--add=}'[add a trusted certificate.]:certificate' \
+ '(-l --list)'{-l,--list=}'[list trusted certificates where the subject contains specified filter]:filter'
+ '(-r --remove)'{-r,--remove=}'[remove trusted certificates where the subject contains specified filter]:filter'
+ '(-b --build)'{-b,--build=}'[build private key and self-signed certificate for specified email address]:email address:_email_addresses -c'
+ '(-C --certificate)'{-C,--certificate=}'[specify signing certificate for --sign]:certificate'
+ '(-K --private-key)'{-K,--private-key=}'[specify key for --sign or --build]:key'
+ '(-s --sign)'{-s,--sign=}'[sign specified certificate with the key from -K and the certificate from -C]:certificate'
+ '(-d --days)'{-d,--days=}'[specify days before certificate expires]:days'
+ )
+ ;;
+ check)
+ args+=(
+ "--no-alien[don't report \"unmanaged\" or rogue files in the gem repository]"
+ '--doctor[clean up uninstalled gems and broken specifications]'
+ "--dry-run[don't remove files, only report what would be removed]"
+ "--no-gems[don't check installed gems for problems]"
+ )
+ ;;
+ cleanup)
+ args+=( '(-n -d --dryrun)'{-n,-d,--dryrun}"[don't uninstall gems]" )
+ ;;
+ contents)
+ args+=(
+ '(-s --spec-dir)'{-s,--spec-dir=}'[search for gems in specific paths]:path:_sequence _directories'
+ '(-l --lib-only)'{-l,--lib-only}"[only return files in the Gem's lib_dirs]"
+ '--no-prefix[include installed path prefix]'
+ '--show-install-dir[show only the gem install dir]'
+ )
+ ;;
+ dependency)
+ def[local]='!'
+ args+=( ${(e)lropts}
+ '(-R --reverse-dependencies)'{-R,--reverse-dependencies}'[include reverse dependencies in the output]'
+ '--pipe[pipe format]'
+ )
+ ;;
+ environment)
+ args+=( '1:information:(packageversion gemdir gempath version remotesources platform)' )
+ ;;
+ fetch)
+ def=( both \! local \! remote \! )
+ args+=( ${(e)lropts} )
+ ;;
+ generate_index)
+ args+=(
+ '(-d --directory)'{-d,--directory=}'[specify repository base dir containing gems]:directory:_directories'
+ '--update[update modern indexes with gems added since the last update]'
+ )
+ ;;
+ lock)
+ args+=( '(-s --strict)'{-s,--strict}'[fail if unable to satisfy a dependency]' )
+ ;;
+ open)
+ args+=( '(-e --editor)'{-e,--editor=}'[open gem sources in specified editor]:editor:_command_names -e' )
+ ;;
+ outdated)
+ args+=( ${(e)lropts} )
+ ;;
+ owner)
+ args+=(
+ '(-a --add)'{-a,--add=}'[add an owner]:email:_email_addresses -c'
+ '(-r --remove)'{-r,--remove=}'[remove an owner]:email:_email_addresses -c'
+ )
+ ;;
+ pristine)
+ args+=(
+ '(*)*--skip=[with --all, skip specified gem]:installed gem:->gems-local'
+ "--no-extensions[don't restore gems with extensions in addition to regular gems]"
+ '--only-executables[only restore executables]'
+ )
+ ;;
+ push)
+ args+=( '*:gem:_files -g "*.gem(-.)"' )
+ ;;
+ query)
+ args+=(
+ '(-n --name-matches)'{-n,--name-matches=}'[specify regex to match against gem names]:gem name (regex):->gems-local'
+ )
+ ;;
+ rdoc)
+ args+=(
+ '--rdoc[generate RDoc HTML]'
+ '--no-ri[generate RI data]'
+ '--overwrite[overwrite installed documents]'
+ )
+ ;;
+ server)
+ args+=(
+ '(-p --port)'{-p,--port=}'[specify port to listen on]:port [8808]:_ports'
+ '(-d --dir)'{-d,--dir=}'[specify directories from which to serve gems]:directory:_directories'
+ '--daemon[run as a daemon]'
+ '(-b --bind)'{-b,--bind=}'[specify addresses to bind]:host:_sequence _hosts'
+ '(-l --launch)'{-l,--launch=}'[launch a browser window]:command:_command_names -e'
+ )
+ ;;
+ sources)
+ args+=( $proxy
+ '(-a --add)'{-a,--add=}'[add source]:source URI:_urls'
+ '(-l --list)'{-l,--list}'[list sources]'
+ '(-r --remove)'{-r,--remove=}'[remove source]:source URI:_urls'
+ '(-c --clear-all)'{-c,--clear-all}'[remove all sources (clear the cache)]'
+ '(-u --update)'{-u,--update}'[update source cache]'
+ )
+ ;;
+ specification)
+ def[local]='!'
+ args+=( ${(e)lropts}
+ '--all[output specifications for all versions of the gem]'
+ '!(--ruby --marshal)--yaml' '(--ruby --json)--marshal' '(--marshal --json 2)--ruby'
+ '1:gem:->gems-local'
+ '2:gemspec field:(name description version platform authors autorequire bindir cert_chain date dependencies email executable executables extensions extra_rdoc_files files homepage licenses metadata post_install_message rdoc_options require_paths required_ruby_version requirements rubyforge_project rubygems_version signing_key specification_version summary test_files)'
+ )
+ ;;
+ uninstall)
+ args+=(
+ '(-a --all)'{-a,--all}'[uninstall all matching versions]'
+ '(-x --executables)'{-x,--executables}'[uninstall applicable executables without confirmation]'
+ "--no-user-install[uninstall from user's home directory]"
+ "--format-executable[assume executable names match Ruby's prefix and suffix]"
+ '--force[uninstall all versions of the named gems ignoring dependencies]'
+ '--abort-on-dependent[prevent uninstalling gems that are depended on by other gems]'
+ '--vendor[uninstall gem from the vendor directory]'
+ )
+ ;;
+ unpack)
+ args+=(
+ '--spec[unpack the gem specification]'
+ '--target=[specify target directory for unpacking]:directory:_directories'
+ )
+ ;;
+ update)
+ args+=( '--system[update the RubyGems system software]::version' )
+ ;;
+ which)
+ args+=(
+ '(-a --all)'{-a,--all}'[show all matching files]'
+ '(-g --gems-first)'{-g,--gems-first}'[search gems before non-gems]'
+ '*:file:_files'
+ )
+ ;;
+ esac
+ _arguments -C ${args:-'*: :_default'} \
+ '(-)'{-h,--help}'[display usage information]' \
+ '(-V --verbose --no-verbose)'{-V,--verbose,--no-verbose}'[set verbose level of output]' \
+ '(-q --quiet -V --verbose --no-verbose)'{-q,--quiet}'[silence commands progress meter]' \
+ '--silent[silence rubygems output]' \
+ '--config-file=[use specified config file]:file:_files' \
+ '--backtrace[show stack backtrace on errors]' \
+ '--debug[turn on ruby debugging]' \
+ '--norc[avoid loading any .gemrc file]' && ret=0
+
+ if [[ $state == gems* ]]; then
+ filter=( ${${opt_args[(I)-([lbr]|-local|-remote|-both)]}:-${${(M)state:#*-*}/gems-/--}} )
+ _description gems expl gem
+ compadd "$expl[@]" ${${(f)"$(_call_program gems gem list $filter -q --no-versions)"}%% *} && ret=0
+ fi
+fi
+
+return ret
diff --git a/Completion/Unix/Command/_getfacl b/Completion/Unix/Command/_getfacl
index b6f1d0932..15be06a1c 100644
--- a/Completion/Unix/Command/_getfacl
+++ b/Completion/Unix/Command/_getfacl
@@ -11,19 +11,19 @@ _arguments -s -S \
'*: :_files'
else
_arguments -s -S \
- '--access[display the file access control list only]' \
+ '(-a --access)'{-a,--access}'[display the file access control list only]' \
'(-d --default)'{-d,--default}'[display the default access control list only]' \
- '--omit-header[do not display the comment header]' \
- '--all-effective[print all effective rights]' \
- '--no-effective[print no effective rights]' \
- '--skip-base[skip files that only have the base entries]' \
+ '(-c --omit-header)'{-c,--omit-header}"[don't display the comment header]" \
+ '(-e --all-effective)'{-e,--all-effective}'[print all effective rights]' \
+ '(-E --no-effective)'{-E,--no-effective}'[print no effective rights]' \
+ '(-s --skip-base)'{-s,--skip-base}'[skip files that only have the base entries]' \
'(-R --recursive)'{-R,--recursive}'[recurse into subdirectories]' \
'(-L --logical)'{-L,--logical}'[logical walk, follow symbolic links]' \
- '(-P --physical)'{-P,--physical}'[physical walk, do not follow symbolic links]' \
- '--tabular[use tabular output format]' \
- '--numeric[print numeric user/group identifiers]' \
- '--absolute-names[don'"'"'t strip leading '"'"'/'"'"' in pathnames]' \
- '--version[print version and exit]' \
- '--help[this help text]' \
+ '(-P --physical)'{-P,--physical}"[physical walk, don't follow symbolic links]" \
+ '(-t --tabular)'{-t,--tabular}'[use tabular output format]' \
+ '(-n --numeric)'{-n,--numeric}'[print numeric user/group identifiers]' \
+ '(-p --absolute-names)'{-p,--absolute-names}"[don't strip leading '/' in pathnames]" \
+ '(- *)'{-v,--version}'[display version information]' \
+ '(- *)'{-h,--help}'[display help information]' \
'*: :_files'
fi
diff --git a/Completion/Unix/Command/_getopt b/Completion/Unix/Command/_getopt
new file mode 100644
index 000000000..3359818b5
--- /dev/null
+++ b/Completion/Unix/Command/_getopt
@@ -0,0 +1,28 @@
+#compdef getopt ggetopt
+
+local -a args aopts
+
+# Note: BusyBox getopt is borrowed straight from util-linux, so they're
+# basically identical
+if _pick_variant busybox=BusyBox util-linux='getopt*enhanced' unix --version; then
+ args=(
+ '(-a --alternative)'{-a,--alternative}'[allow long options with single -]'
+ '(: -)'{-h,--help}'[display help information]'
+ '*'{-l+,--longoptions=}'[specify long options]:long options'
+ '(-n --name)'{-n+,--name=}'[specify program name]:program name'
+ '(1 -o --options)'{-o+,--options=}'[specify short options]:short options'
+ '(-q --quiet)'{-q,--quiet}'[suppress getopt(3) error messages]'
+ '(-Q --quiet-output)'{-Q,--quiet-output}'[suppress normal output]'
+ '(-s --shell)'{-s+,--shell=}'[specify shell quoting conventions]:shell:(bash csh tcsh sh)'
+ '(: -)'{-T,--test}'[test for enhanced getopt]'
+ '(-u --unquoted)'{-u,--unquoted}'[do not quote output]'
+ '(: -)'{-V,--version}'[display version information]'
+ '(-o --options)1: :_guard "^-*" "short options"'
+ '*:argument'
+ )
+ [[ -n $POSIXLY_CORRECT ]] && aopts+=( -A '-*' )
+else
+ args=( '1:short options' '*:argument' )
+fi
+
+_arguments -s -S $aopts : $args
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 26554de05..0eb16987d 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -60,9 +60,10 @@ _git-add () {
'(-i --interactive : -)'{-i,--interactive}'[add contents interactively to index]' \
'(-p --patch)'{-p,--patch}'[like -i but go directly into patch mode for specified files]' \
'(-e --edit)'{-e,--edit}'[open diff against index in editor]' \
- '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)'{-A,--all,--no-ignore-removal}'[add, modify, and remove index entries to match the working tree]' \
- '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)'{--no-all,--ignore-removal}'[like "--all" but ignore removals]' \
+ '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal --renormalize)'{-A,--all,--no-ignore-removal}'[add, modify, and remove index entries to match the working tree]' \
+ '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal --renormalize)'{--no-all,--ignore-removal}'[like "--all" but ignore removals]' \
'(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)'{-u,--update}'[update the index just where it already has an entry matching <pathspec>]' \
+ '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)--renormalize[renormalize EOL of tracked files (implies -u)]' \
'(-N --intent-to-add)'{-N,--intent-to-add}'[record only that path will be added later]' \
'--refresh[do not add files, but refresh their stat() info in index]' \
'--ignore-errors[continue adding if an error occurs]' \
@@ -293,9 +294,8 @@ _git-branch () {
l='--color --no-color -r --remotes -a -v --verbose --abbrev --no-abbrev --list --points-at --sort'
c='-l --create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --no-contains --merged --no-merged'
- m='-m --move -M'
+ m='-c --copy -C -m --move -M --edit-description'
d='-d --delete -D'
- e='--edit-description'
declare -a dependent_creation_args
if (( words[(I)(-r|--remotes)] == 0 )); then
@@ -325,37 +325,39 @@ _git-branch () {
fi
_arguments -S -s \
- "($c $m $d $e --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \
- "($c $m $d $e : --color)--no-color[turn off branch coloring]" \
- "($c $m $d $e --no-column)"'--column=[display tag listing in columns]:column.branch option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \
- "($c $m $d $e --column)"'--no-column[do not display in columns]' \
- "($c $m $d $e )*--list[list only branches matching glob]:pattern" \
- "($c $m $e -a)"{-r,--remotes}'[list or delete only remote-tracking branches]' \
- "($c $m $d $e: -r --remotes)-a[list both remote-tracking branches and local branches]" \
- "($c $m $d $e : -v -vv --verbose)"{-v,-vv,--verbose}'[show SHA1 and commit subject line for each head]' \
- "($c $m $d $e :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \
- "($c $m $d $e :)--no-abbrev[do not abbreviate sha1s]" \
- "($l $m $d $e)"{-l,--create-reflog}"[create the branch's reflog]" \
- "($l $m $d $e -f --force)"{-f,--force}"[force the creation of a new branch]" \
- "($l $m $d $e -t --track)"{-t,--track}"[set up configuration so that pull merges from the start point]" \
- "($l $m $d $e)--no-track[override the branch.autosetupmerge configuration variable]" \
- "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}"[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names" \
- "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \
- "($l $m $d $e)*--contains=[only list branches that contain the specified commit]: :__git_committishs" \
- "($l $m $d $e)*--no-contains=[only list branches that don't contain the specified commit]: :__git_committishs" \
- "($l $m $d $e)--merged=[only list branches that are fully contained by HEAD]: :__git_committishs" \
- "($l $m $d $e)--no-merged=[don't list branches that are fully contained by HEAD]: :__git_committishs" \
+ "($c $m $d --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \
+ "($c $m $d : --color)--no-color[turn off branch coloring]" \
+ "($c $m $d --no-column)"'--column=[display tag listing in columns]:column.branch option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \
+ "($c $m $d --column)--no-column[don't display in columns]" \
+ "($c $m $d )*--list[list only branches matching glob]:pattern" \
+ "($c $m -a)"{-r,--remotes}'[list or delete only remote-tracking branches]' \
+ "($c $m $d : -r --remotes)-a[list both remote-tracking branches and local branches]" \
+ "($c $m $d : -v -vv --verbose)"{-v,-vv,--verbose}'[show SHA1 and commit subject line for each head]' \
+ "($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \
+ "($c $m $d :)--no-abbrev[don't abbreviate sha1s]" \
+ "($l $m $d)"{-l,--create-reflog}"[create the branch's reflog]" \
+ "($l $m $d -f --force)"{-f,--force}'[force the creation of a new branch]' \
+ "($l $m $d -t --track)"{-t,--track}'[setup configuration so that pull merges from the start point]' \
+ "($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \
+ "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names' \
+ "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \
+ "($l $m $d)*--contains=[only list branches that contain the specified commit]: :__git_committishs" \
+ "($l $m $d)*--no-contains=[only list branches that don't contain the specified commit]: :__git_committishs" \
+ "($l $m $d)--merged=[only list branches that are fully contained by HEAD]: :__git_committishs" \
+ "($l $m $d)--no-merged=[don't list branches that are fully contained by HEAD]: :__git_committishs" \
"($c $l $m $d)--edit-description[edit branch description]" \
$dependent_creation_args \
- "($l $c $d $m $e)"{-m,--move}"[rename a branch and the corresponding reflog]" \
- "($l $c $d $m $e)-M[rename a branch even if the new branch-name already exists]" \
+ "($l $c $d $m)"{-m,--move}"[rename a branch and the corresponding reflog]" \
+ "($l $c $d $m)-M[rename a branch even if the new branch-name already exists]" \
+ "($l $c $d $m)"{-c,--copy}"[copy a branch and the corresponding reflog]" \
+ "($l $c $d $m)-C[copy a branch even if the new branch-name already exists]" \
$dependent_modification_args \
- "($l $c $m $d $e)"{-d,--delete}"[delete a fully merged branch]" \
- "($l $c $m $d $e)-D[delete a branch]" \
+ "($l $c $m $d)"{-d,--delete}"[delete a fully merged branch]" \
+ "($l $c $m $d)-D[delete a branch]" \
{-q,--quiet}"[be more quiet]" \
'*--sort=[specify field to sort on]: :__git_ref_sort_keys' \
'--points-at=[only list tags of the given object]: :__git_commits' \
- "($c $m $d $e -i --ignore-case)"{-i,--ignore-case}'[sorting and filtering are case-insensitive]' \
+ "($c $m $d -i --ignore-case)"{-i,--ignore-case}'[sorting and filtering are case-insensitive]' \
$dependent_deletion_args
}
@@ -519,11 +521,11 @@ _git-cherry-pick () {
'--allow-empty[preserve initially empty commits]' \
'--allow-empty-message[allow replaying a commit with an empty message]' \
'--keep-redundant-commits[keep cherry-picked commits that will become empty]' \
- '(-e --edit --ff)'{-e,--edit}'[edit commit before committing the revert]' \
+ '(-e --edit --ff)'{-e,--edit}'[edit commit before committing the cherry-pick]' \
'(--ff)-x[append information about what commit was cherry-picked]' \
'(-m --mainline)'{-m+,--mainline=}'[specify mainline when cherry-picking a merge commit]:parent number' \
'--rerere-autoupdate[update index with reused conflict resolution if possible]' \
- '(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actually commit]' \
+ '(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actual commit]' \
'(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
"(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
@@ -929,6 +931,7 @@ _git-format-patch () {
'--no-binary[do not output contents of changes in binary files, only note that they differ]' \
'--root[treat the revision argument as a range]' \
'--zero-commit[output all-zero hash in From header]' \
+ '--progress[show progress while generating patches]' \
': :->commit-or-commit-range' && ret=0
case $state in
@@ -1126,6 +1129,22 @@ _git-init () {
':: :_directories'
}
+(( $+functions[_git-interpret-trailers] )) ||
+_git-interpret-trailers() {
+ _arguments \
+ '--in-place[edit files in place]' \
+ '--trim-empty[trim empty trailers]' \
+ '--where[specify where to place the new trailer]' \
+ '--if-exists[specify action if trailer already exists]' \
+ '--if-missing[specify action if trailer is missing]' \
+ '--only-trailers[output only the trailers]' \
+ "--only-input[don't apply config rules]" \
+ '--unfold[join whitespace-continued values]' \
+ '--parse[set parsing options]' \
+ '--trailer[specify trailer(s) to add]' \
+ '*:file:_files'
+}
+
(( $+functions[_git-log] )) ||
_git-log () {
local curcontext=$curcontext state line ret=1
@@ -1189,6 +1208,7 @@ _git-merge () {
'--abort[restore the original branch and abort the merge operation]' \
'--continue[continue the current in-progress merge]' \
'--progress[force progress reporting]' \
+ '--verify[verify commit-msg hook]' \
'*: : __git_commits -O expl:git_commit_opts'
}
@@ -1495,7 +1515,7 @@ _git-revert () {
'*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
"(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
- ': :__git_commits'
+ ': :__git_recent_commits'
}
(( $+functions[_git-rm] )) ||
@@ -1535,7 +1555,7 @@ _git-shortlog () {
'(: -)'{-h,--help}'[print a short usage message and exit]' \
'(-n --numbered)'{-n,--numbered}'[sort according to number of commits]' \
'(-s --summary)'{-s,--summary}'[suppress commit description]' \
- '(-e --email)'{-e,--email}'[show email addres of each author]' \
+ '(-e --email)'{-e,--email}'[show email address of each author]' \
'-w-[linewrap the output]:: :->wrap' \
$revision_options \
'(-)--[start file arguments]' \
@@ -1545,7 +1565,7 @@ _git-shortlog () {
(wrap)
if [[ -prefix [[:digit:]]#,[[:digit:]]#,[[:digit:]]# ]]; then
compset -P '[[:digit:]]#,[[:digit:]]#,'
- __git_guard_number 'indent of second and subsquent wrapped lines'
+ __git_guard_number 'indent of second and subsequent wrapped lines'
elif [[ -prefix [[:digit:]]#,[[:digit:]]# ]]; then
compset -P '[[:digit:]]#,'
compset -S ',[[:digit:]]#'
@@ -1731,7 +1751,7 @@ _git-status () {
normal\:"show untracked files and directories" \
all\:"also show untracked files in untracked directories (default)"))' \
'--ignore-submodules[ignore changes to submodules]:: :__git_ignore_submodules_whens' \
- '--ignored[show ignored files as well]' \
+ '--ignored=-[show ignored files as well]:mode [traditional]:(traditional matching no)' \
'(-z --null --column --no-column)'{-z,--null}'[use NUL termination on output]' \
'(--no-column -z --null)--column=-[display in columns]::column.status option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \
'(--column)--no-column[do not display in columns]' \
@@ -1988,10 +2008,10 @@ _git-tag () {
"*--no-contains=[only list tags that don't contain the specified commit]: :__git_commits" \
'--merged=-[print only tags that are merged]:: :__git_commits' \
'--no-merged=-[print only tags that are not merged]:: :__git_commits' \
- '--sort=[specify how the tags should be sorted]:mode:((refname\:"lexicographic order"
- version\\\:refname\:"tag names are treated as version numbers"))' \
+ '--sort=[specify how the tags should be sorted]:field:__git_ref_sort_keys' \
'--points-at=[only list tags of the given object]: :__git_commits' \
- '--format=[specify format to use for the output]:format' \
+ '--format=[specify format to use for the output]:format:__git_format_ref' \
+ '--color=-[respect any colors specified in the format]::when:(always never auto)' \
'(-i --ignore-case)'{-i,--ignore-case}'[sorting and filtering are case-insensitive]' \
':: :_guard "^-*" pattern' \
- verification \
@@ -2106,10 +2126,11 @@ _git-config () {
'(--global --system -f --file --blob)--local[use local config file]' \
'(--global --system --local --blob)'{-f+,--file=}'[use given config file]:config file:_files' \
'(--global --system --local -f --file)--blob=[read config from given blob object]:blob:__git_blobs' \
- '( --int --bool-or-int --path)--bool[setting is a boolean]' \
- '(--bool --bool-or-int --path)--int[setting is an integer]' \
- '(--bool --int --path)--bool-or-int[setting is an integer]' \
- '(--bool --int --bool-or-int )--path[setting is a path]' \
+ '( --int --bool-or-int --path --expiry-date)--bool[setting is a boolean]' \
+ '(--bool --bool-or-int --path --expiry-date)--int[setting is an integer]' \
+ '(--bool --int --path --expiry-date)--bool-or-int[setting is an integer]' \
+ '(--bool --int --bool-or-int --expiry-date)--path[setting is a path]' \
+ '(--bool --int --bool-or-int --path )--expiry-date[setting is an expiry date]' \
'(-z --null)'{-z,--null}'[end values with NUL and newline between key and value]' \
'(--get --get-all --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--name-only[show variable names only]' \
'(--includes)'--no-includes"[don't respect \"include.*\" directives]" \
@@ -2186,6 +2207,7 @@ __git_config_option-or-value () {
advice.implicitIdentity:'show advice when identity is guessed from system settings::->bool:true'
advice.detachedHead:'show advice when entering detached-HEAD state::->bool:true'
advice.amWorkDir:'show the location of the patch file when git-am fails to apply it::->bool:true'
+ advice.rmHints:'show directions in case of failure in the output of git-rm(1)::->bool:true'
blame.blankboundary:'show blank SHA-1 for boundary commits::->bool:false'
blame.showroot:'show root commits as normal commits::->bool:false'
blame.date:'date format to use in output::__git_date_formats:iso'
@@ -3045,7 +3067,7 @@ __git_config_option-or-value () {
never:'never show in columns' \
auto:'show in columns if the output is to the terminal' \
column:'fill columns before rows (implies "always")' \
- row:'fill rows before columns (implies "akways")' \
+ row:'fill rows before columns (implies "always")' \
plain:'show in one column (implies "always")' && ret=0
;;
(commit.cleanup)
@@ -3388,6 +3410,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]' \
+ '--state-branch[load mapping from old to new objects from specified branch]:branch:__git_branch_names' \
'*: :__git_commit_ranges'
}
@@ -3504,16 +3527,6 @@ _git-reflog () {
fi
}
-(( $+functions[_git-relink] )) ||
-_git-relink () {
- _arguments \
- '--safe[stop if two objects with the same hash exist but have different sizes]' \
- '(-)'{-h,--help}'[display usage information]' \
- ': :_directories' \
- ': :_directories' \
- '*: :_directories'
-}
-
(( $+functions[_git-remote] )) ||
_git-remote () {
local curcontext=$curcontext state line ret=1
@@ -3990,7 +4003,7 @@ _git-verify-tag () {
_arguments -S -s \
'(-v --verbose)'{-v,--verbose}'[print contents of the tag object before validating it]' \
'--raw[print raw gpg status output]' \
- '--format=[specify format to use for the output]:format' \
+ '--format=[specify format to use for the output]:format:__git_format_ref' \
'*: :__git_tags'
}
@@ -4657,6 +4670,8 @@ _git-pack-objects () {
'--keep-true-parents[pack parents hidden by grafts]' \
'--use-bitmap-index[use a bitmap index if available to speed up counting objects]' \
'--write-bitmap-index[write a bitmap index together with the pack index]' \
+ '--filter=[omit certain objects from pack file]:filter:_git_rev-list_filters' \
+ '--missing=[specify how missing objects are handled]:action:(error allow-any print)' \
':base-name:_files'
}
@@ -4769,6 +4784,10 @@ _git-update-index () {
'--untracked-cache[enable/disable untracked cache]' \
'--test-untracked-cache[test if the filesystem supports untracked cache]' \
'--force-untracked-cache[enable untracked cache without testing the filesystem]' \
+ '--force-write-index[write out the index even if is not flagged as changed]' \
+ '--fsmonitor[enable or disable file system monitor]' \
+ '--fsmonitor-valid[mark files as fsmonitor valid]' \
+ '--no-fsmonitor-valid[clear fsmonitor valid bit]' \
$z_opt \
'*:: :_files'
}
@@ -4915,7 +4934,8 @@ _git-for-each-ref () {
_arguments -S -s \
'--count=[maximum number of refs to iterate over]: :__git_guard_number "maximum number of refs"' \
'*--sort=[key to sort refs by]: :__git_ref_sort_keys' \
- '--format=-[output format of ref information]:format' \
+ '--format=-[output format of ref information]:format:__git_format_ref' \
+ '--color=-[respect any colors specified in the format]::when:(always never auto)' \
'*--points-at=[print only refs which point at the given object]:object:__git_commits' \
'*--merged=[print only refs that are merged]:object:__git_commits' \
'*--no-merged=[print only refs that are not merged]:object:__git_commits' \
@@ -4959,7 +4979,8 @@ _git-ls-files () {
'--exclude-standard[skip files in standard Git exclusion lists]' \
'--error-unmatch[if any file does not appear in index, treat this as an error]' \
'(-s --stage -u --unmerged)--with-tree=[treat paths removed since given tree-ish as still present]: :__git_tree_ishs' \
- '-v[identify each files status (hmrck?)]' \
+ '(-f)-v[indicate status of each file using lowercase for assume changed files]' \
+ '(-v)-f[indicate status of each file using lowercase for fsmonitor clean files]' \
'--full-name[force paths to be output relative to the project top directory]' \
'--recurse-submodules[recurse through submodules]' \
'--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \
@@ -5056,7 +5077,14 @@ _git-rev-list () {
_arguments -C -S \
$revision_options \
- '(--pretty)--header[display contents of commit in raw-format]' \
+ '--no-filter[turn off any previous --filter argument]' \
+ '--filter-print-omitted[print a list of objects omitted by --filter]' \
+ '--filter=[omit certain objects from pack file]:filter:_git_rev-list_filters' \
+ '--missing=[specify how missing objects are handled]:action:(error allow-any print)' \
+ '(--count --pretty --header --left-right --abbrev-commit --abbrev --parent --children)--quiet[print nothing; exit status indicates if objects are fully connected]' \
+ '--use-bitmap-index[try to speed traversal using pack bitmap index if available]' \
+ '--progress=-[show progress reports as objects are considered]:header' \
+ '(--pretty --quiet)--header[display contents of commit in raw-format]' \
'--timestamp[print raw commit timestamp]' \
'( --bisect-vars --bisect-all)--bisect[show only middlemost commit object]' \
'(--bisect)--bisect-vars[same as --bisect, displaying shell-evalable code]' \
@@ -5079,6 +5107,15 @@ _git-rev-list () {
return ret
}
+(( $+functions[_git_rev-list_filters] )) ||
+_git_rev-list_filters() {
+ _values 'filter' \
+ 'blob\:none[omit all blobs]' \
+ 'blob\:limit[omit blobs larger than specified size]:size' \
+ 'sparse\:oid[uses a sparse-checkout specification contained in the blob]:blob-ish' \
+ 'sparse\:path[uses a sparse-checkout specification contained in path]:path:_directories'
+}
+
(( $+functions[_git-show-index] )) ||
_git-show-index () {
_message 'no arguments allowed; accepts index file on standard input'
@@ -5559,12 +5596,7 @@ __git_describe_commit () {
# .
(( $+functions[__git_ignore_line] )) ||
__git_ignore_line () {
- declare -a ignored
- ignored=()
- ((CURRENT > 1)) &&
- ignored+=(${(bQ)line[1,CURRENT-1]})
- ((CURRENT < $#line)) &&
- ignored+=(${(bQ)line[CURRENT+1,-1]})
+ local -a ignored=(${line:#${words[CURRENT]}})
$* -F ignored
}
@@ -5640,7 +5672,6 @@ _git_commands () {
pack-refs:'pack heads and tags for efficient repository access'
prune:'prune all unreachable objects from the object database'
reflog:'manage reflog information'
- relink:'hardlink common objects in local repositories'
remote:'manage set of tracked repositories'
repack:'pack unpacked objects in a repository'
replace:'create, list, delete refs to replace objects')
@@ -5654,6 +5685,7 @@ _git_commands () {
get-tar-commit-id:'extract commit ID from an archive created using git archive'
help:'display help information about git'
instaweb:'instantly browse your working repository in gitweb'
+ interpret-trailers:'add or parse structured information in commit messages'
merge-tree:'show three-way merge without touching index'
rerere:'reuse recorded resolution of conflicted merges'
rev-parse:'pick out and massage parameters for other git commands'
@@ -5799,16 +5831,24 @@ __git_extract_aliases () {
__git_date_formats () {
declare -a date_formats
+ if compset -P 'format:'; then
+ _strftime
+ return
+ fi
+
date_formats=(
relative:'show dates relative to the current time'
local:'show timestamps in local timezone'
- iso:'show timestamps in ISO 8601 format'
- rfc:'show timestamps in RFC 2822 format'
+ iso{,8601}:'show timestamps in ISO 8601 format'
+ iso-strict:'show timestamps in strict ISO 8601 format'
+ rfc{,2822}:'show timestamps in RFC 2822 format'
short:'show only date but not time'
raw:'show date in internal raw git format (%s %z)'
- default:'show timestamp in the original timezone')
+ unix:'show date as a Unix epoch timestamp'
+ default:'show timestamp in the original timezone'
+ )
- _describe -t date-formats 'date format' date_formats $*
+ _describe -t date-formats 'date format' date_formats -- '( format\:custom\ format )' -S :
}
(( $+functions[__git_gpg_secret_keys] )) ||
@@ -6026,17 +6066,80 @@ __git_reflog_entries () {
__git_ref_sort_keys () {
compset -P '-'
- local -a sort_keys
+ __git_ref_fields "$@"
+}
+
+(( $+functions[__git_ref_fields] )) ||
+__git_ref_fields () {
+ # pass -a to complete all fields, otherwise only fields relevant to sorting
+ local match mbegin mend
+ local -a cfields fields append opts all
+
+ zparseopts -D -E -a opts x: X: J: V: a=all
+
+ if compset -P 1 '(#b)(*):'; then
+ case $match[1] in
+ push|upstream)
+ append=(
+ 'trackshort[show terse version: > (ahead) < (behind) = (in sync)]'
+ 'track[print gone whenever unknown upstream ref is encountered]'
+ 'track,nobracket[tracking information without brackets]'
+ )
+ ;&
+ refname|upstream|symref)
+ append+=(
+ {strip,lstrip}'[strip elements from the left]:elements to strip / -remain'
+ 'rstrip[strip elements from the right]:elements to strip / -remain'
+ 'short[strip to non-ambiguous short name]'
+ )
+ ;;
+ objectname)
+ append=(
+ 'short[strip to non-ambiguous short name]:length'
+ )
+ ;;
+ color)
+ _alternative \
+ 'colors::__git_colors' \
+ 'attributes::__git_color_attributes'
+ return
+ ;;
+ align)
+ append=(
+ 'width[specify width]:width'
+ 'position[specify alignment]:alignment:(left right middle)'
+ )
+ ;;
+ if) append=( {,not}'equals:string' ) ;;
+ contents) append=( subject body signature lines:lines ) ;;
+ tailers) append=( only unfold ) ;;
+ v|version)
+ append=(
+ 'refname[sort by versions]'
+ )
+ ;;
+ esac
+ (( $#append )) || return 1
+ _values 'interpolation modifier' $append
+ return
+ fi
- # TODO: numparent is undocumented.
- sort_keys=(
- 'refname:the name of the ref'
+ cfields=(
+ 'refname:name of the ref'
+ 'objectname:object name (SHA-1)'
+ 'upstream:name of a local ref which can be considered “upstream” from the displayed ref'
+ 'push:name of a local ref which represents the @{push} location for the displayed ref'
+ 'symref:the ref which the given symbolic ref refers to'
+ 'contents:complete message'
+ 'trailers:structured information in commit messages'
+ )
+ fields=(
'objecttype:the type of the object'
'objectsize:the size of the object'
- 'objectname:the object name (SHA-1)'
+ 'HEAD:* if HEAD matches ref or space otherwise'
'tree:the tree header-field'
'parent:the parent header-field'
- 'numparent:undocumented'
+ 'numparent:number of parent objects'
'object:the object header-field'
'type:the type header-field'
'tag:the tag header-field'
@@ -6044,19 +6147,45 @@ __git_ref_sort_keys () {
'authorname:the name component of the author header-field'
'authoremail:the email component of the author header-field'
'authordate:the date component of the author header-field'
+ 'committer:the committer header-field'
'committername:the name component of the committer header-field'
'committeremail:the email component of the committer header-field'
'committerdate:the date component of the committer header-field'
+ 'tagger:the tagger header-field'
'taggername:the name component of the tagger header-field'
'taggeremail:the email component of the tagger header-field'
'taggerdate:the date component of the tagger header-field'
- 'creatorname:the name component of the creator header-field'
+ 'creator:the creator header-field'
'creatordate:the date component of the creator header-field'
'subject:the subject of the message'
'body:the body of the message'
- 'body:the contents of the message (subject and body)')
+ 'version\:refname:sort by versions'
+ )
+ if (( $#all )); then
+ cfields+=(
+ 'color:change output color'
+ 'align:set alignment'
+ 'if:conditional'
+ )
+ fields+=(
+ 'then:true branch'
+ 'else:false branch'
+ 'end:end if or align block'
+ )
+ fi
+
+ _describe -t fields 'field' cfields -S : -r ':\\) \t\n\-' -- fields "$@"
+}
- _describe -t sort-keys 'sort key' sort_keys $*
+(( $+functions[__git_format_ref] )) ||
+__git_format_ref() {
+ local expl
+ compset -P '(%\\\([^)]#\\\)|[^%]|%%|%[[:xdigit:]][[:xdigit:]])#'
+ if compset -P '%\\\((\*|)'; then
+ __git_ref_fields -S '\)' -a
+ else
+ _wanted -x formats expl format compadd -S '' '%('
+ fi
}
(( $+functions[__git_signoff_file] )) ||
@@ -6337,7 +6466,7 @@ __git_recent_commits () {
else
label="[HEAD~$distance_from_head]"
fi
- ## Disabled because _describe renders the output unhelpfuly when this function
+ ## Disabled because _describe renders the output unhelpfully when this function
## is called twice during a single completion operation, and list-grouped is
## in its default setting (enabled).
#descr+=("@~${distance_from_head}":"${label} $k") # CROSSREF: use the same label as below
@@ -6625,7 +6754,7 @@ __git_files () {
local pref=$gitcdup$gitprefix$PREFIX
# First allow ls-files to pattern-match in case of remote repository
- files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\\\*}} 2>/dev/null)"})
+ files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\\\*}:-.} 2>/dev/null)"})
__git_command_successful $pipestatus || return
# If ls-files succeeded but returned nothing, try again with no pattern
@@ -6763,10 +6892,6 @@ __git_tree_files () {
(( $+functions[__git_remote_repositories] )) ||
__git_remote_repositories () {
- local service
-
- service= _ssh
-
if compset -P '*:'; then
_remote_files -/ -- ssh
else
@@ -6881,6 +7006,8 @@ __git_setup_log_options () {
# TODO: Need to implement -<n> for limiting the number of commits to show.
log_options=(
'(- *)-h[display help]'
+ '--decorate-refs=[only decorate refs that match pattern]:pattern'
+ "--decorate-refs-exclude=[don't decorate refs that match pattern]:pattern"
'( --no-decorate)--decorate=-[print out ref names of any commits that are shown]: :__git_log_decorate_formats'
'(--decorate )--no-decorate[do not print out ref names of any commits that are shown]'
'( --no-follow)--follow[follow renames]'
@@ -6892,14 +7019,15 @@ __git_setup_log_options () {
(( $+functions[__git_setup_diff_options] )) ||
__git_setup_diff_options () {
- local diff_types='(-p -u --patch -U --unified --raw --patch-with-raw --stat --numstat --shortstat --dirstat --dirstat-by-file --summary --patch-with-stat --name-only --name-status --cumulative -s --no-patch)'
+ # According to Git: "fatal: --name-only, --name-status, --check and -s are mutually exclusive"
+ local exclusive_diff_options='(--name-only --name-status --check -s --no-patch)'
diff_options=(
- $diff_types{-p,-u,--patch}'[generate diff in patch format]'
- $diff_types{-U,--unified=}'[generate diff with given lines of context]: :__git_guard_number lines'
- $diff_types'--raw[generate default raw diff output]'
- $diff_types'--patch-with-raw[generate patch but also keep the default raw diff output]'
- $diff_types{-s,--no-patch}'[suppress diff output]'
+ {-p,-u,--patch}'[generate diff in patch format]'
+ {-U,--unified=}'[generate diff with given lines of context]: :__git_guard_number lines'
+ '--raw[generate default raw diff output]'
+ '--patch-with-raw[generate patch but also keep the default raw diff output]'
+ $exclusive_diff_options{-s,--no-patch}'[suppress diff output]'
'(--minimal --patience --histogram --diff-algorithm)--minimal[spend extra time to make sure the smallest possible diff is produced]'
'(--minimal --patience --histogram --diff-algorithm)--patience[generate diffs with patience algorithm]'
'(--minimal --patience --histogram --diff-algorithm)--histogram[generate diffs with histogram algorithm]'
@@ -6908,16 +7036,16 @@ __git_setup_diff_options () {
minimal\:"spend extra time to make sure the smallest possible diff is produced"
patience\:"generate diffs with patience algorithm"
histogram\:"generate diffs with histogram algorithm"))'
- $diff_types'--stat=-[generate diffstat instead of patch]:: :__git_guard_diff-stat-width'
- $diff_types'--numstat[generate more machine-friendly diffstat]'
- $diff_types'--shortstat[generate summary diffstat]'
- $diff_types'--dirstat=-[generate dirstat by amount of changes]:: :__git_guard_number limit'
- $diff_types'--dirstat-by-file=-[generate dirstat by number of files]:: :__git_guard_number limit'
- $diff_types'--summary[generate condensed summary of extended header information]'
- $diff_types'--patch-with-stat[generate patch and prepend its diffstat]'
+ '--stat=-[generate diffstat instead of patch]:: :__git_guard_diff-stat-width'
+ '--numstat[generate more machine-friendly diffstat]'
+ '--shortstat[generate summary diffstat]'
+ '--dirstat=-[generate dirstat by amount of changes]:: :__git_guard_number limit'
+ '--dirstat-by-file=-[generate dirstat by number of files]:: :__git_guard_number limit'
+ '--summary[generate condensed summary of extended header information]'
+ '--patch-with-stat[generate patch and prepend its diffstat]'
'-z[use NUL termination on output]'
- $diff_types'--name-only[show only names of changed files]'
- $diff_types'--name-status[show only names and status of changed files]'
+ $exclusive_diff_options'--name-only[show only names of changed files]'
+ $exclusive_diff_options'--name-status[show only names and status of changed files]'
'--submodule=-[select output format for submodule differences]::format:((short\:"show pairs of commit names"
log\:"list commits like git submodule does"
diff\:"show differences"))'
@@ -6930,7 +7058,7 @@ __git_setup_diff_options () {
'--word-diff-regex=-[specify what constitutes a word]:word regex'
'(--color --no-color )--color-words=-[show colored-word diff]::word regex'
'--no-renames[turn off rename detection]'
- '--check[warn if changes introduce trailing whitespace or space/tab indents]'
+ $exclusive_diff_options'--check[warn if changes introduce trailing whitespace or space/tab indents]'
'--full-index[show full object name of pre- and post-image blob]'
'(--full-index)--binary[in addition to --full-index, output binary diffs for git-apply]'
'--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length'
@@ -6984,7 +7112,14 @@ __git_setup_diff_stage_options () {
__git_format_placeholders() {
local sep
local -a disp names placeholders expl
- if compset -P 'format:'; then
+ _describe -t formats format '( oneline:"commit-ids and subject of messages"
+ short:"few headers and only subject of messages"
+ medium:"most parts of messages"
+ full:"all parts of commit messages"
+ fuller:"like full and includes dates"
+ email:"use email headers like From and Subject"
+ raw:"the raw commits" )' -- '( format:"specify own format" )' -S ':' && return
+ compset -P 'format:'
compset -P '(%[^acgCG]|%?[^%]|[^%])#'
if compset -P '%C'; then
_wanted colors expl color compadd reset red green blue
@@ -7003,6 +7138,8 @@ __git_format_placeholders() {
gD:'reflog selector'
gd:'short reflog selector'
gn:'reflog identity'
+ ge:'reflog identity email'
+ gE:'reflog identity email (use .mailmap)'
gs:'reflog subject'
)
disp=( -l )
@@ -7026,8 +7163,8 @@ __git_format_placeholders() {
h:'abbreviated commit hash'
T:'tree hash'
t:'abbreviated tree hash'
- P:'parent hash'
- p:'abbreviated parent hash'
+ P:'parent hashes'
+ p:'abbreviated parent hashes'
a:'author details'
c:'committer details'
d:'ref name in brackets'
@@ -7058,15 +7195,6 @@ __git_format_placeholders() {
fi
_wanted placeholders expl placeholder \
compadd -p % -S '' "$disp[@]" "$@" - "$names[@]"
- else
- _describe -t formats format '( oneline:"commit-ids and subject of messages"
- short:"few headers and only subject of messages"
- medium:"most parts of messages"
- full:"all parts of commit messages"
- fuller:"like full and includes dates"
- email:"use email headers like From and Subject"
- raw:"the raw commits" )' -- '( format:"specify own format" )' -S ':'
- fi
}
(( $+functions[__git_setup_revision_options] )) ||
@@ -7102,16 +7230,19 @@ __git_setup_revision_options () {
'*--author=[limit commits to those by given author]:author'
'*--committer=[limit commits to those by given committer]:committer'
'*--grep=[limit commits to those with log messages matching the given pattern]:pattern'
- '--all-match[limit commits to ones matching all --grep, --author, and --committer]'
+ '--all-match[limit commits to those matching all --grep, --author, and --committer]'
+ '--invert-grep[limit commits to those not matching --grep, --author and --committer]'
'(-i --regexp-ignore-case)'{-i,--regexp-ignore-case}'[match regexps ignoring case]'
- '(-E --extended-regexp)'{-E,--extended-regexp}'[use POSIX extended regexps]'
- '(-F --fixed-strings)'{-F,--fixed-strings}'[do not interpret patterns as regexps]'
+ '!(-E --extended-regexp -F --fixed-strings -P --perl-regexp)--basic-regexp'
+ '(-E --extended-regexp -F --fixed-strings -P --perl-regexp)'{-E,--extended-regexp}'[use POSIX extended regexps]'
+ '(-E --extended-regexp -F --fixed-strings -P --perl-regexp)'{-F,--fixed-strings}"[don't interpret patterns as regexps]"
+ '(-E --extended-regexp -F --fixed-strings -P --perl-regexp)'{-P,--perl-regexp}'[use perl regular expression]'
'--remove-empty[stop when given path disappears from tree]'
- '--merges[display only merge commits]'
- '--no-merges[do not display commits with more than one parent]'
- '(--min-parents --no-min-parents)--min-parents=-[show only commits having at least <n> commits]: :__git_guard_number "minimum number of parents"'
- '(--min-parents --no-min-parents)--no-min-parents[reset limit]'
- '(--max-parents --no-max-parents)--max-parents=-[show only commits having at most <n> commits]: :__git_guard_number "maximum number of parents"'
+ '(--no-merges --min-parents)--merges[display only merge commits]'
+ "(--merges --max-parents)--no-merges[don't display commits with more than one parent]"
+ '(--min-parents --no-min-parents --merges)--min-parents=-[show only commits with at least specified number of commits]: :__git_guard_number "number of parents"'
+ '(--min-parents --no-min-parents --merges)--no-min-parents[reset limit]'
+ '(--max-parents --no-max-parents --no-merges)--max-parents=-[show only commits with at most specified number of commits]: :__git_guard_number "number of parents"'
'(--max-parents --no-max-parents)--no-max-parents[reset limit]'
'--first-parent[follow only first parent from merge commits]'
'*--not[reverses meaning of ^ prefix for revisions that follow]'
@@ -7140,18 +7271,20 @@ __git_setup_revision_options () {
'(-g --walk-reflogs)--reverse[display commits in reverse order]'
'( --objects-edge)--objects[display object ids of objects referenced by listed commits]'
'(--objects )--objects-edge[display object ids of objects referenced by listed and excluded commits]'
- '( --do-walk)--no-walk[only display given revs, do not traverse their ancestors]'
+ "( --do-walk)--no-walk=-[only display given revs, don't traverse their ancestors]::order:(sorted unsorted)"
'(--no-walk )--do-walk[only display given revs, traversing their ancestors]'
'( --cherry-pick)--cherry-mark[like --cherry-pick but mark equivalent commits instead of omitting them]'
'(--cherry-pick )--cherry-pick[omit any commit that introduces the same change as another commit on "the other side" of a symmetric range]'
'( --right-only)--left-only[list only commits on the left side of a symmetric range]'
'(--left-only )--right-only[list only commits on the right side of a symmetric range]'
- '(--left-only --right-only --cherry-pick --cherry-mark)--cherry[synonym for --right-only --cherry-mark --no-merges]'
+ '(--left-only --right-only --cherry-pick --cherry-mark --no-merges --merges --max-parents)--cherry[synonym for --right-only --cherry-mark --no-merges]'
'(-c --cc )--full-diff[show full commit diffs when using log -p, not only those affecting the given path]'
'--log-size[print log message size in bytes before the message]'
'--use-mailmap[use mailmap file to map author and committer names and email]'
'--reflog[show all commits from reflogs]'
+ '--single-worktree[examine the current working tree only]'
+ '--stdin[additionally read commits from standard input]'
'--default[use argument as default revision]:default revision:__git_revisions'
# TODO: --early-output is undocumented.
'--early-output=-[undocumented]::undocumented'
@@ -7176,6 +7309,7 @@ __git_setup_merge_options () {
'(-n --no-stat)--stat[show a diffstat at the end of the merge]'
'(--stat -n --no-stat)'{-n,--no-stat}'[do not show diffstat at the end of the merge]'
'( --no-squash)--squash[merge, but do not commit]'
+ '--signoff[add Signed-off-by:]'
'(--squash )--no-squash[merge and commit]'
'--ff-only[refuse to merge unless HEAD is up to date or merge can be resolved as a fast-forward]'
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id'
@@ -7618,7 +7752,7 @@ _git() {
declare -gUa _git_third_party_commands
_git_third_party_commands=()
-local file
+local file input
for file in ${^fpath}/_git-*~(*~|*.zwc)(-.N); do
local name=${${file:t}#_git-}
if (( $+_git_third_party_commands[$name] )); then
diff --git a/Completion/Unix/Command/_gnutls b/Completion/Unix/Command/_gnutls
index 169e38b38..2cd559843 100644
--- a/Completion/Unix/Command/_gnutls
+++ b/Completion/Unix/Command/_gnutls
@@ -1,126 +1,206 @@
-#compdef gnutls-cli gnutls-cli-debug certtool srptool
+#compdef gnutls-cli gnutls-cli-debug gnutls-serv certtool srptool
-local _gnutls_supported _gnutls_supported_certtypes
-local _gnutls_supported_protocols _gnutls_supported_macs
-local _gnutls_supported_kx _gnutls_supported_comp
-local _gnutls_cli_common_args
+local -a args
-_gnutls_cli_common_args=(
- '(-d --debug)'{-d,--debug}':debug level'
- '(-p --port)'{-p,--port}':port'
- '(-h --help)'{-h,--help}'[help]'
+args=(
+ '(- :)'{-h,--help}'[display help information]'
+ '(- :)--version=[display version information]:information:((v\:simple c\:copyright n\:full))'
+ '(- :)-v[display version information]'
+ '(- :)'{-\!,--more-help}'[display help information through a pager]'
+ '(-d --debug)'{-d,--debug}'[enable debugging]:debug level'
+ \*{-V,--verbose}'[more verbose output]'
)
case "$service" in
- (gnutls-cli)
-
-_gnutls_supported="$(gnutls-cli --list)"
-_gnutls_supported_certtypes=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Certificate types:*}#Certificate types: }})
-_gnutls_supported_protocols=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Protocols:*}#Protocols: }})
-_gnutls_supported_ciphers=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Ciphers:*}#Ciphers: }})
-_gnutls_supported_macs=(${(s:, :)${${(M)${(f)_gnutls_supported}:#MACs:*}#MACs: }})
-_gnutls_supported_kx=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Key exchange algorithms:*}#Key exchange algorithms: }})
-_gnutls_supported_comp=(${(s:, :)${${(M)${(f)_gnutls_supported}:#Compression methods:*}#Compression methods: }})
-
-_arguments \
- "$_gnutls_cli_common_args[@]" \
- '(-r --resume)'{-r,--resume}'[resume session]' \
- '(-s --starttls)'{-s,--starttls}'[start TLS on EOF or SIGALRM]' \
- '--crlf[send CR LF instead of LF]' \
- '--x509fmtder[use DER format for certificates to read from]' \
- '(-f --fingerprint)'{-f,--fingerprint}'[send the openpgp fingerprint instead of the key]' \
- '--disable-extensions[disable all the TLS extensions]' \
- '--xml[print the certificate information in XML format]' \
- '--print-cert[print the certificate in PEM format]' \
- '--recordsize:maximum record size to advertise:' \
- '(-V --verbose)'{-V,--verbose}'[more verbose output]' \
- '--ciphers:ciphers to enable:('"$_gnutls_supported_ciphers"')' \
- '--protocols:protocols to enable:('"$_gnutls_supported_protocols"')' \
- '--comp:compression methods to enable:('"$_gnutls_supported_comp"')' \
- '--macs:MACs to enable:('"$_gnutls_supported_macs"')' \
- '--kx:key exchange methods to enable:('"$_gnutls_supported_kx"')' \
- '--ctypes:certificate types to enable:('"$_gnutls_supported_certtypes"')' \
- '--x509cafile:certificate file to use:_files' \
- '--x509crlfile:CRL file to use:_files' \
- '--pgpkeyfile:PGP key file to use:_files' \
- '--pgpkeyring:PGP key ring file to use:_files' \
- '--pgptrustdb:PGP trustdb file to use:_files' \
- '--pgpcertfile:PGP public key (certificate) file to use:_files' \
- '--x509keyfile:X.509 key file to use:_files' \
- '--x509certfile:X.509 certificate file to use:_files' \
- '--srpusername:SRP username to use' \
- '--srppasswd:SRP password to use' \
- '--insecure[do not require server cert validation]' \
- '(-l --list)'{-l,--list}'[print list of the supported algorithms/modes]' \
- '(-v --version)'{-v,--version}'[print version number]' \
- '--copyright[print license]' \
+ gnutls-*)
+ args+=(
+ '(-p --port)'{-p,--port}'[specify port or service to connect to]:port:_ports'
+ )
+ ;|
+ gnutls-cli*)
+ args+=(
+ '(--app-proto --starttls-proto)'{--app-proto,--starttls-proto}"=[specify application protocol to use to obtain the server's certificate]:protocol:(https ftp smtp imap ldap xmpp lmtp pop3 nntp sieve postgres)"
':hostname:_hosts'
+ )
+ ;|
+ gnutls-cli|gnutls-serv)
+ args+=(
+ "--sni-hostname=[specify server's hostname for server name indication extension]:hostname"
+ "--noticket[don't accept session tickets]"
+ '(-u --udp)'{-u,--udp}'[use DTLS (datagram TLS) over UDP]'
+ '--mtu=[set MTU for datagram TLS]:mtu'
+ '--srtp-profiles=[offer SRTP profiles]:string'
+ '(-b --heartbeat)'{-b,--heartbeat}'[activate heartbeat support]'
+ '--x509fmtder[use DER format for certificates to read from]'
+ '--priority=[specify TLS algorithms and protocols to enable]:(NORMAL PFS SECURE128 SECURE192 SUITEB128 SUITEB192 LEGACY PERFORMANCE NONE)'
+ '--x509cafile=[specify certificate file to use]:file:_files'
+ '--x509crlfile=[specify CRL file to use]:file:_files'
+ '*--x509keyfile=[specify X.509 key file to use]:file:_files'
+ '*--x509certfile=[specify X.509 certificate file to use]:file:_files'
+ '(-l --list -p --port)'{-l,--list}'[print list of the supported algorithms/modes]'
+ )
+ ;|
+ gnutls-cli|gnutls-serv|certtool)
+ args+=(
+ '--provider=[specify PKCS #11 provider library]:provider:_files'
+ )
+ ;|
+ gnutls-cli|certtool)
+ args+=(
+ '--verify-allow-broken[allow broken algorithms, such as MD5 for certificate verification]'
+ )
+ ;|
- ;;
- (gnutls-cli-debug)
-
-_arguments \
- "$_gnutls_cli_common_args[@]" \
- '(-v --verbose)'{-v,--verbose}'[more verbose output]' \
- ':hostname:_hosts'
+ gnutls-cli)
+ args+=(
+ '--tofu[enable trust on first use authentication]' '!--no-tofu'
+ '--strict-tofu[fail to connect if a known certificate has changed]' '!--no-strict-tofu'
+ '--dane[enable DANE certificate verification (DNSSEC)]' '!--no-dane'
+ '--local-dns[use the local DNS server for DNSSEC resolving]' '!--no-local-dna'
+ '--no-ca-verification[disable CA certificate verification]' '!--ca-verification'
+ '--ocsp[enable OCSP certificate verification]' '!--no-oscp'
+ '(-r --resume)'{-r,--resume}'[establish a session and resume]'
+ '(-e --rehandshake)'{-e,--rehandshake}'[connect, establish a session and rehandshake immediately]'
+ '(-s --starttls)'{-s,--starttls}'[start TLS on EOF or SIGALRM]'
+ '--crlf[send CR LF instead of LF]'
+ '--fastopen[enable TCP Fast Open]'
+ "--print-cert[print peer's certificate in PEM format]"
+ "--save-cert=[save peer's certificate chain in the specified file in PEM format]:file:_files"
+ "--save-ocsp=[save peer's OCSP status response in the provided file]:file:_files"
+ '--save-server-trace=[save the server-side TLS message trace in the provided file]:file:_files'
+ '--save-client-trace=[save the client-side TLS message trace in the provided file]:file:_files'
+ '--dh-bits=[specify minimum number of bits allowed for DH]:bits'
+ '--srpusername[specify SRP username to use]:username'
+ '--srppasswd[specify SRP password to use]:password'
+ '--pskusername[specify PSK username to use]:username'
+ '--pskkey[specify PSK key to use]:key'
+ "--insecure[don't require server cert validation]"
+ '--ranges[use length-hiding padding to prevent traffic analysis]'
+ '--benchmark-ciphers[benchmark individual ciphers]'
+ '--benchmark-soft-ciphers[benchmark individual software ciphers]'
+ '--benchmark-tls-kx[benchmark TLS key exchange methods]'
+ '--benchmark-tls-ciphers[benchmark TLS ciphers]'
+ '--priority-list[print list of the supported priority strings]'
+ '*--alpn=[enable application layer protocol]:string'
+ '--recordsize=[specify maximum record size to advertize]:record size'
+ "--disable-sni[don't send a Server Name]"
+ '--disable-extensions[disable all the TLS extensions]'
+ '--inline-commands[inline commands of the form ^<cmd>^]'
+ '--inline-commands-prefix=[change delimiter used for inline commands]:delimiter [^]'
+ '--fips140-mode[report status of FIPS140-2 mode in gnutls library]'
+ )
+ ;;
- ;;
+ gnutls-serv)
+ args+=(
+ '--sni-hostname-fatal[send fatal alert on sni-hostname mismatch]'
+ '*--alpn=[specify ALPN protocol to be enabled by the server]:protocol'
+ '--alpn-fatal[send fatal alert on non-matching ALPN name]'
+ '(-g --generate)'{-g,--generate}'[generate Diffie-Hellman parameters]'
+ '(-q --quiet)'{-q,--quiet}'[suppress some messages]'
+ "--nodb[don't use a resumption database]"
+ '--http[act as an HTTP server]'
+ '--echo[act as an Echo server]'
+ '(-a --disable-client-cert)'{-a,--disable-client-cert}"[don't request a client certificate]"
+ '(-r --require-client-cert)'{-r,--require-client-cert}'[require a client certificate]'
+ '--verify-client-cert[if a client certificate is sent then verify it]'
+ '--dhparams=[specify DH params file to use]:file:_files'
+ '--srppasswd=[specify SRP password file to use]:file:_files'
+ '--srppasswdconf=[specify SRP password configuration file to use]:file:_files'
+ '--pskpasswd=[specify PSK password file to use]:file:_files'
+ '--pskhint=[specify PSK identity hint to use]:string'
+ '--ocsp-response=[specify OCSP response to send to client]:file:_files'
+ )
+ ;;
- (certtool)
-_arguments \
- '(-s --generate-self-signed)'{-s,--generate-self-signed}'[generate a self-signed certificate]' \
- '(-c --generate-certificate)'{-c,--generate-certificate}'[generate a signed certificate]' \
- '--generate-crl[generate a CRL]' \
- '(-u --update-certificate)'{-u,--update-certificate}'[update a signed certificate]' \
- '(-p --generate-privkey)'{-p,--generate-privkey}'[generate a private key]' \
- '(-q --generate-request)'{-q,--generate-request}'[generate a PKCS #10 certificate request]' \
- '(-e --verify-chain)'{-e,--verify-chain}'[verify a PEM encoded certificate chain]' \
- '--verify-crl[verify a CRL]' \
- '--generate-dh-params[generate PKCS #3 encoded Diffie Hellman parameters]' \
- '--get-dh-params[get the included PKCS #3 encoded Diffie Hellman parameters]' \
- '--load-privkey:private key file:_files' \
- '--load-request:certificate request file:_files' \
- '--load-certificate:certificate file:_files' \
- '--load-ca-privkey:certificate authority private key file:_files' \
- '--load-ca-certificate:certificate authority certificate file:_files' \
- '--password:password' \
- '(-i --certificate-info)'{-i,--certificate-info}'[print information on a certificate]' \
- '(-l --crl-info)'{-l,--crl-info}'[print information on a CRL]' \
- '--p12-info[print information on a PKCS #12 structure]' \
- '--p7-info[print information on a PKCS #7 structure]' \
- '--smime-to-p7[convert S/MIME to PKCS #7 structure]' \
- '(-k --key-info)'{-k,--key-info}'[print information on a private key]' \
- '--fix-key[regenerate the parameters in a private key]' \
- '--to-p12[generate a PKCS #12 structure]' \
- '(-8 --pkcs8)'{-8,--pkcs8}'[use PKCS #8 format for private keys]' \
- '--dsa[use DSA keys]' \
- '--hash:hash algorithm for signing:(MD5 SHA1 RMD160)' \
- '--export-ciphers[use weak encryption algorithms]' \
- '--inder[use DER format for input certificates and private keys]' \
- '--xml[use XML format for output certificates]' \
- '--outder[use DER format for output certificates and private keys]' \
- '--bits:number of bits for key generation' \
- '--outfile:output file:_files ' \
- '--infile:input file:_files ' \
- '--template:template file to use for non-interactive operation:_files' \
- '(-d --debug)'{-d,--debug}':debug level' \
- '(-h --help)'{-h,--help}'[show help]' \
- '(-v --version)'{-v,--version}'[show version]' \
- '--copyright[shows license]'
+ certtool)
+ args+=(
+ '(-q --generate-request)--infile:input file:_files '
+ '--outfile:output file:_files '
+ '(-s --generate-self-signed)'{-s,--generate-self-signed}'[generate a self-signed certificate]'
+ '(-c --generate-certificate)'{-c,--generate-certificate}'[generate a signed certificate]'
+ '--generate-proxy[generate a proxy certificate]'
+ '--generate-crl[generate a CRL]'
+ '(-u --update-certificate)'{-u,--update-certificate}'[update a signed certificate]'
+ '--fingerprint[print the fingerprint of the given certificate]'
+ '--key-id[print the key ID of the given certificate]'
+ '--v1[generate an X.509 version 1 certificate (with no extensions)]'
+ '--sign-params=[sign a certificate with a specific signature algorithm]:algorithm:(RSA-PSS)'
+ '(-p --generate-privkey)'{-p,--generate-privkey}'[generate a private key]'
+ '(-q --generate-request --infile)'{-q,--generate-request}'[generate a PKCS #10 certificate request]'
+ '(-e --verify-chain)'{-e,--verify-chain}'[verify a PEM encoded certificate chain]'
+ '--verify[verify a PEM encoded certificate chain using a trusted list]'
+ '--verify-crl[verify a CRL]'
+ '(--verify-email)--verify-hostname=[specify hostname to be used for certificate chain verification]:hostname:_hosts'
+ '(--verify-hostname)--verify-email=[specify email to be used for certificate chain verification]:email:_email_addresses'
+ '--verify-purpose=[specify a purpose OID to be used for certificate chain verification]'
+ '--p7-sign[sign using a PKCS #7 structure]'
+ '--p7-detached-sign[sign using a detached PKCS #7 structure]'
+ "--no-p7-include-cert[don't include signer's certificate will in the cert list]"
+ '--p7-time[include a timestamp in the PKCS #7 structure]'
+ '--p7-show-data[show embedded data in the PKCS #7 structure]'
+ '--p7-verify[verify the provided PKCS #7 structure]'
+ '--generate-dh-params[generate PKCS #3 encoded Diffie Hellman parameters]'
+ '--get-dh-params[get the included PKCS #3 encoded Diffie Hellman parameters]'
+ '--dh-info[print information PKCS #3 encoded Diffie-Hellman parameters]'
+ '--load-privkey:private key file:_files'
+ '--load-pubkey:public key file:_files'
+ '--load-request:certificate request file:_files'
+ '--load-certificate:certificate file:_files'
+ '--load-ca-privkey:certificate authority private key file:_files'
+ '--load-ca-certificate:certificate authority certificate file:_files'
+ '--load-crl=[load the provided CRL]:CRL'
+ '--load-data=[load auxiliary data]:data'
+ '--password=[specify password to use]:password'
+ '--hex-numbers[big number in an easier format to parse]'
+ '--cprint[prints certain information is C-friendly format]'
+ '--null-password[enforce a NULL password]'
+ '--empty-password[enforce an empty password]'
+ '--key-type=[specify the key type to use on key generation]:key type'
+ '(-i --certificate-info)'{-i,--certificate-info}'[print information on a certificate]'
+ '--certificate-pubkey[print certificate public key]'
+ '(-l --crl-info)'{-l,--crl-info}'[print information on a CRL]'
+ '--crq-info[print information on a certificate request]'
+ "--no-crq-extensions[don't use extensions in certificate requests]"
+ '--p12-info[print information on a PKCS #12 structure]'
+ '--p12-name=[specify PKCS #12 friendly name to use]:name'
+ '--p7-info[print information on a PKCS #7 structure]'
+ '--smime-to-p7[convert S/MIME to PKCS #7 structure]'
+ '(-k --key-info)'{-k,--key-info}'[print information on a private key]'
+ '--p8-info[print information on a PKCS #8 structure]'
+ '--to-rsa[convert an RSA-PSS key to raw RSA format]'
+ '--bits=[specify number of bits for key generation]:bits'
+ '--curve=[specify the curve used for EC key generation]:curve'
+ '--sec-param=[specify the security level]:security level:(low legacy medium high ultra)'
+ '--to-p8[convert a given key to a PKCS #8 structure]'
+ '--provable[generate a private key or parameters from a seed using a provable method]'
+ '--verify-provable-privkey[verify a private key generated from a seed using a provable method]'
+ '--seed=[when generating a private key use the given seed]:seed (hex-encoded)'
+ '--pubkey-info[print information on a public key]'
+ '--to-p12[generate a PKCS #12 structure]'
+ '(-8 --pkcs8)'{-8,--pkcs8}'[use PKCS #8 format for private keys]'
+ '--hash=[specify hash algorithm for signing]:algorithm:(MD5 SHA1 RMD160)'
+ '--salt-size=[specify the RSA-PSS key default salt size]:size'
+ {--inder,--inraw}'[use DER format for input certificates and private keys]'
+ {--outder,--outraw}'[use DER format for output certificates and private keys]'
+ '--template=[specify template file to use for non-interactive operation]:file:_files'
+ '--stdout-info[print information to stdout instead of stderr]'
+ '--ask-pass[enable interaction for entering password when in batch mode]'
+ '--pkcs-cipher=[specify cipher to use for pkcs operations]:cipher:(3des 3des-pkcs12 aes-128 aes-192 aes-256 rc2-40 arcfour)'
+ )
+ ;;
- ;;
- (srptool)
-
-_arguments \
- '(-u --username)'{-u,--username}':username:_users' \
- '(-p --passwd)'{-p,--passwd}':password file:_files' \
- '(-i --index)'{-i,--index}':index of params in tpasswd.conf' \
- '(-s --salt)'{-s,--salt}':salt size for crypt algorithm' \
- '--verify[just verify password]' \
- '(-c --passwd-conf)'{-c,--passwd-conf}':password conf file:_files' \
- '--create-conf:generate a tpasswd.conf file:_files' \
- '(-v --version)'{-v,--version}'[show version]' \
- '(-h --help)'{-h,--help}'[show help]'
-
- ;;
+ srptool)
+ args+=(
+ '(-i --index)'{-i+,--index=}':index of params in tpasswd.conf'
+ '(-u --username)'{-u+,--username=}':username:_users'
+ '(-p --passwd)'{-p+,--passwd=}':password file:_files'
+ '(-s --salt)'{-s+,--salt=}'[specify salt size]:salt size for crypt algorithm'
+ '--verify[just verify password]'
+ '(-v --passwd-conf)'{-v+,--passwd-conf=}'[generate a password configuration file]:password conf file:_files'
+ '--create-conf=[generate a tpasswd.conf file]:file:_files'
+ )
+ ;;
esac
+
+_arguments -s -S $args
diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg
index d7a8ece4c..48a36eff2 100644
--- a/Completion/Unix/Command/_gpg
+++ b/Completion/Unix/Command/_gpg
@@ -1,7 +1,7 @@
#compdef gpg gpgv gpg-zip gpg2=gpg
local curcontext="$curcontext" state line expl ret=1
-local -a args allopts dups
+local -a args allopts dups extra
typeset -A opt_args
if [[ $service = gpg-zip ]]; then
@@ -38,17 +38,17 @@ fi
[[ $service = gpg ]] && args+=(
'--decrypt-files[decrypt multiple files]'
'(-b --detach-sign)'{-b,--detach-sign}'[make a detached signature]'
- '--clearsign[make a clear text signature]'
+ --clear{,-}sign'[make a clear text signature]'
'--store[store only]'
'--verify[verify a signature]'
'--verify-files[verify a list of files]'
'(-f --encrypt-files)'{-f,--encrypt-files}'[encrypt files]'
- '--list-keys[list all keys]'
+ '(-k --list-keys)'{-k,--list-keys}'[list all keys]'
'--list-public-keys[list all public keys]'
- '--list-secret-keys[list all secret keys]'
- '--list-sigs[lists keys and signatures]:key attachment:->public-keys'
- '--list-options[modify what the various --list-* commands show]'
- '--check-sigs[list key, signatures and check them]:key attachment:->public-keys'
+ '(-K --list-secret-keys)'{-K,--list-secret-keys}'[list all secret keys]'
+ --list-sig{,nature}s'[lists keys and signatures]:key attachment:->public-keys'
+ '--list-options[modify what the various --list-* commands show]: :->option-list'
+ --check-sig{,nature}s'[list key, signatures and check them]:key attachment:->public-keys'
'--fingerprint[list all keys with their fingerprints]:key attachment:->public-keys'
'--list-packets[list only the sequence of packets]'
'--gen-key[generate a new pair key]'
@@ -60,6 +60,7 @@ fi
'--delete-secret-and-public-keys:key attachment:->secret-keys'
'--gen-revoke[generate a revocation certificate]'
'--desig-revoke[generate a designated revocation certificate]'
+ '--passwd[change a passphrase]'
'--export[export all keys from all keyrings]'
'--send-keys[send keys to a keyserver]:key attachment:->public-keyids'
'--export-secret-keys:key attachment:->secret-keys'
@@ -67,7 +68,7 @@ fi
'--import[import a gpg key from a file]:attachment (file):_files'
'--fast-import[import a file without adding to trustdb]:attachment (file):_files'
'--fetch-keys[fetch key at URIs]:uri:'
- '--recv-keys[receive a list of keys from a keyserver]:key attachment:->public-keyids'
+ --rec{eive,v}-keys'[receive a list of keys from a keyserver]:key attachment:->public-keyids'
'--refresh-keys[update all keys from a keyserver]'
'--search-keys[search for keys on a key server]'
'--update-trustdb[update the trust database]'
@@ -79,7 +80,11 @@ fi
'--enarmor[en-Armor a file or stdin]'
'--print-md[print message digests]:algorithm:->ciphers::file:_files'
'--print-mds[print message digests]::file:_files'
- '--gen-random:count' '--gen-prime'
+ '--tofu-policy:policy:(good unknown bad ask auto):*:keys:->public-keys'
+ '--tofu-default-policy:policy:(good unknown bad ask auto)'
+ '--quick-generate-key:user-id: :algorithm:(default future-default rsa dsa elg ed25519 cv25519): : _values -s , usage - default sign auth encr::expiration'
+ '--quick-add-key:fingerprint: :algorithm:(default future-default rsa dsa elg ed25519 cv25519): : _values -s , usage - default sign auth encr::expiration'
+ '--gen-random:quality level:(0 1 2):count (bytes)' '--gen-prime'
'--warranty[print warranty info]'
'(-a --armor)'{-a,--armor}'[create ASCII armored output]'
'--default-key[specify default user ID for signatures]:key:->secret-keys'
@@ -126,11 +131,11 @@ fi
'--s2k-mode:value'
'--compress-algo:compression algorithm:((0\:disable\ compression 1\:zlib 2\:rfc1950))'
'--personal-'{cipher,digest,compress}'-preferences:string'
- '--card-edit[present smartcard menu]' '--card-status[show smartcard content]'
+ --{card-edit,edit-card}'[present smartcard menu]' '--card-status[show smartcard content]'
'--change-pin[present menu to change smartcard pin]'
'--list-config[display internal configuration parameters]'
'--hidden-recipient[hidden recipient]:recipient:->public-keys'
- '--dump-options[show all options]' '--default-preference-list:string'
+ '--default-preference-list:string'
'--fetch-keys:URIs'
'--hidden-encrypt-to:recipient:->public-keys'
'--compress-level:integer'
@@ -139,17 +144,14 @@ fi
'--max-output[maximum output generated when processing file]:bytes:'
'--gpg-agent-info[override GPG_AGENT_INFO]:'
'--primary-keyring:file:_files'
- '--verify-options:parameters:_multi_parts -q -S, ","
- "(show-photos show-policy-urls show-notations show-std-notations
- show-user-notations show-keyserver-urls show-uid-validity show-unusable-uids
- show-primary-uid-only pka-lookups pka-trust-increase)"'
+ '--verify-options: :->verify-options'
'--debug:flags:' '--status-file:file:_files'
'--attribute-file:file:_files' '--load-extension:file:_files'
'--s2k-count:integer'
'--sig-notation:name=value:' '--cert-notation:name=value:'
'--passphrase-file:file:_files' '--passphrase-repeat:integer:'
'--command-file:file:_files' '--trustdb-name:file:_files'
- '--trust-model:trust model:((pgp classic direct always auto))'
+ '--trust-model:trust model:(pgp classic tofu tofu+pgp direct always auto)'
'--sig-policy-url:string:' '--cert-policy-url:string:'
'--sig-keyserver-url:string:' '--comment[comment]:comment:'
'--no-comments[disable comments]'
@@ -163,8 +165,8 @@ fi
'--multifile[process multiple files]'
'--keyid-format[key id format]:key format:((short 0xshort long 0xlong))'
'--exit-on-status-write-error[exit immediately on error write]'
- '--limit-card-insert-tries:integer:'
- '--reader-port[card reader port]:port:'
+ '--limit-card-insert-tries:integer'
+ '--reader-port[card reader port]:port'
'--ctapi-driver[file to use to access smartcard reader]:file:_files'
'--pcsc-driver[file to use to access smartcard reader]:file:_files'
'--auto-key-locate:parameters'
@@ -176,7 +178,7 @@ extra=( ${allopts:|extra} )
_arguments -C -s -S -A "-*" $args $extra '*:args:->args' && ret=0
if [[ $state = args ]]; then
- if (( ${+opt_args[--export]} || ${+opt_args[--list-keys]} || ${+opt_args[--list-public-keys]} )); then
+ if (( ${+opt_args[--export]} || ${+opt_args[-k]} || ${+opt_args[--list-keys]} || ${+opt_args[--list-public-keys]} )); then
state=public-keys
elif (( ${+opt_args[--list-secret-keys]} )); then
state=secret-keys
@@ -205,19 +207,27 @@ fi
case "$state" in
public-keys)
_wanted public-keys expl 'public key' \
- compadd ${${(Mo)$(_call_program public-keys gpg $needed --list-public-keys --list-options no-show-photos 2>/dev/null):%<*>}//(<|>)/} && return
+ compadd ${${(Mo)$(_call_program public-keys $words[1] $needed --list-public-keys --list-options no-show-photos):%<*>}//(<|>)/} && return
;;
secret-keys)
_wanted secret-keys expl 'secret key' compadd \
- ${${(Mo)$(_call_program secret-keys gpg $needed --list-secret-keys --list-options no-show-photos 2>/dev/null):%<*>}//(<|>)/} && return
+ ${${(Mo)$(_call_program secret-keys $words[1] $needed --list-secret-keys --list-options no-show-photos):%<*>}//(<|>)/} && return
;;
ciphers)
_wanted ciphers expl cipher compadd \
- ${${(s.,.)${(M)${(f)"$(_call_program ciphers gpg $needed --version)"}:#Cipher*}#*:}# } && return
+ ${${(s.,.)${(M)${(f)${"$(_call_program ciphers $words[1] $needed --version)"}//,$'\n' #/, }:#Cipher*}#*:}# } && return
;;
(public-keyids)
_wanted public-keys expl 'public keyid' \
- compadd ${${${(M)${(f)"$(_call_program public-keyids gpg $needed --list-public-keys --list-options no-show-photos 2>/dev/null)"}:%pub*}#pub */}%% *} && return
+ compadd ${(M)${${(f)"$(_call_program public-keyids $words[1] $needed --list-public-keys --list-options no-show-photos)"}## #}:#[0-9A-F](#c40)} && return
+ ;;
+ (option-list)
+ _sequence _wanted options expl option \
+ compadd - {no-,}show-{photos,usage,policy-urls,{std,user}-notations,keyserver-urls,uid-validity,unusable-{uids,subkeys},keyring,sig-{expire,subpackets}} && return
+ ;;
+ (verify-options)
+ _sequence _wanted options expl option \
+ compadd - {no-,}show-{photos,policy-urls,{std,user}-notations,keyserver-urls,uid-validity,unusable-uids,primary-uid-only} {no-,}pka-{lookups,trust-increase} && return
;;
esac
diff --git a/Completion/Unix/Command/_gsettings b/Completion/Unix/Command/_gsettings
index 890b56403..2724be0ea 100644
--- a/Completion/Unix/Command/_gsettings
+++ b/Completion/Unix/Command/_gsettings
@@ -3,7 +3,7 @@
local curcontext="$curcontext" state line expl ret=1
local subcmds
-_arguments \
+_arguments -A "-*" \
'(- 1 *)--version[show version information]' \
'--schemadir[specify location of schemata]:directory:_directories' \
':command:->subcmds' \
@@ -20,6 +20,9 @@ if [[ $state = subargs ]]; then
_arguments ':schema:->schemata' ':key:->keys' ':value'
;;
(list|reset)-(keys|recursively|children)) state=schemata ;;
+ list-schemas)
+ _arguments '--print-paths'
+ ;;
*) _default && ret=0 ;;
esac
fi
diff --git a/Completion/Unix/Command/_gzip b/Completion/Unix/Command/_gzip
index f9fd17819..42d4ae705 100644
--- a/Completion/Unix/Command/_gzip
+++ b/Completion/Unix/Command/_gzip
@@ -13,7 +13,9 @@ unpigz|pigz)
'(-b --blocksize)'{-b+,--blocksize}'[set compression block size]:size (KiB)'
'(-p --processes)'{-p,--processes}'[specify number of processes to use]'
'(-z --zlib)'{-z,--zlib}'[compress to zlib (.zz) format]'
- '(-T --no-time)'{-T,--no-time}"[don't store/restore modification time in/from header]"
+ '(-m --no-time)'{-m,--no-time}"[don't store/restore modification time in/from header]"
+ '(-M --time)'{-M,--time}"[store/restore modification time in/from header]"
+ '(--synchronous)-Y[force output file write to permanent storage]'
)
;|
pigz)
@@ -23,7 +25,7 @@ pigz)
'(--rsyncable)-R[make rsync-friendly archive]'
"($excl)"{-F,--first}'[do iterations first, before block split]'
"($excl)"{-I+,--iterations}'[specify number of iterations for optimization]:iterations [15]'
- "($excl)"{-M+,--maxsplits}'[specify maximum number of split blocks]:split blocks [15]'
+ "($excl)"{-J+,--maxsplits}'[specify maximum number of split blocks]:split blocks [15]'
"($excl)"{-O,--oneblock}"[don't split into smaller blocks]"
)
;|
@@ -62,6 +64,7 @@ gzip|pigz)
'(-R)--rsyncable[make rsync-friendly archive]' \
'(--suffix)-S+[specify suffix for compressed files]:suffix:' \
'(-S)--suffix=[specify suffix for compressed files]:suffix:' \
+ '(-Y)--synchronous[force output file write to permanent storage]' \
'(--test)-t[test compressed file integrity]' \
'(-t)--test[test compressed file integrity]' \
'(--verbose)-v[verbose mode]' \
diff --git a/Completion/Unix/Command/_head b/Completion/Unix/Command/_head
index 75fc1f0a1..1e968cc11 100644
--- a/Completion/Unix/Command/_head
+++ b/Completion/Unix/Command/_head
@@ -1,4 +1,4 @@
-#compdef head
+#compdef head ghead
local curcontext=$curcontext state state_descr line expl opts args ret=1
typeset -A opt_args
diff --git a/Completion/Unix/Command/_hexdump b/Completion/Unix/Command/_hexdump
new file mode 100644
index 000000000..f700ca683
--- /dev/null
+++ b/Completion/Unix/Command/_hexdump
@@ -0,0 +1,35 @@
+#compdef hexdump hd
+
+local -a args fmts optpar
+fmts=(
+ {--one-byte-octal,-b}'[one-byte octal display]'
+ {--one-byte-char,-c}'[one-byte character display]'
+ {--two-bytes-decimal,-d}'[two-byte decimal display]'
+ {--two-bytes-octal,-o}'[two-byte octal display]'
+ {--two-bytes-hex,-x}'[two-byte hexadecimal display]'
+ {--format=,-e+}'[specify format string to be used for displaying data]:format'
+ {--format-file=,-f+}'[specify file that contains format strings]:file:_files'
+)
+args=(
+ '(H -n --length)'{--length=,-n+}'[interpret only specified amount of input]:length (bytes)'
+ '(H -s --skip)'{--skip=,-s+}'[skip specified bytes at the beginning]:offset (bytes)'
+ '(H -v --no-squeezing)'{--no-squeezing,-v}'[output identical lines]'
+)
+
+[[ $service = hexdump ]] && fmts+=( {--canonical,-C}'[canonical hex+ASCII display]' )
+
+if [[ $OSTYPE = linux* ]]; then
+ args+=(
+ '(-L --color)'{-L+,--color=}'[interpret color formatting specifiers colors are enabled by default]:mode'
+ + H
+ '(- *)'{-h,--help}'[display usage information]'
+ '(- *)'{-V,--version}'[display version information]'
+ )
+else
+ # strip long options by taking every second element
+ print -v fmts -f '%2$s' -- "$fmts[@]"
+ print -v args -f '%2$s' -- "$args[@]"
+ optpar=( -A "-*" )
+fi
+
+_arguments -s -S $optpar '*:file:_files' $args + '(formats)' '(H)'$^fmts
diff --git a/Completion/Unix/Command/_id b/Completion/Unix/Command/_id
index 74fe6d9e1..a0a03faad 100644
--- a/Completion/Unix/Command/_id
+++ b/Completion/Unix/Command/_id
@@ -16,7 +16,7 @@ if _pick_variant gnu=GNU $OSTYPE --version; then
'(- :)--version[display version]' \
':user:_users'
else
- choices="-A -a -c -G -g -M -p -P -u"
+ choices="-A -a -c -G -g -M -p -P -R -u"
args=(
"($choices)-g[print only EGID]"
"($choices -r)-G[print all GIDs]"
@@ -31,6 +31,13 @@ else
'(-g -G -u -n -r)-p[show project membership]'
)
;;
+ openbsd*)
+ args+=(
+ '(-)-c[display the login class]'
+ '(-)-p[make the output human readable]'
+ '(-)-R[display the routing table of the current process]'
+ )
+ ;;
darwin*|dragonfly*|freebsd*)
args+=( '(-)-P[print id in the form of a password file entry]' )
;|
diff --git a/Completion/Unix/Command/_install b/Completion/Unix/Command/_install
new file mode 100644
index 000000000..f5056b5d0
--- /dev/null
+++ b/Completion/Unix/Command/_install
@@ -0,0 +1,111 @@
+#compdef install ginstall
+
+local curcontext="$curcontext" lx ret=1
+local -a line state state_descr common_args args tmp
+local -A opt_args val_args
+
+# These are *almost* common — non-GNU variants need to remove the long options
+common_args=(
+ '(--backup)-b[create backups of destination files]'
+ '(-C -c --compare)'{-C,--compare}'[copy files; do nothing if identical destination file exists]'
+ '(-C -c --compare)-c[copy files (default)]'
+ '(-d --directory)'{-d,--directory}'[create directories]'
+ '(-g --group)'{-g+,--group=}'[specify destination file group]: :_groups'
+ '(-m --mode)'{-m+,--mode=}'[specify destination file mode]: :_modes'
+ '(-o --owner)'{-o+,--owner=}'[specify destination file owner]: :_users'
+ '(-p --preserve-timestamps)'{-p,--preserve-timestamps}'[preserve modification times]'
+ '(-s --strip)'{-s,--strip}'[strip binaries]'
+ '(-v --verbose)'{-v,--verbose}'[output verbosely]'
+ '*: :_files'
+)
+
+if _pick_variant gnu='Free Soft' unix --version; then
+ # Hide Linux-specific options on non-Linux platforms
+ [[ $OSTYPE == linux* ]] || lx='!'
+ args+=(
+ $common_args
+ '(-b --backup)--backup=[create backup; optionally specify method]:: :->controls'
+ "${lx}--context=[like -Z, or specify SELinux security context to set]::SELinux security context"
+ '-D[create all leading destination path components]'
+ '(: -)--help[display help information]'
+ "${lx}--preserve-context[preserve SELinux security context]"
+ '--strip-program=[specify program used to strip binaries]:strip program:_files'
+ '(-S --suffix)'{-S+,--suffix=}'[specify backup suffix]:backup suffix'
+ '(-t --target-directory)'{-t+,--target-directory=}'[copy source to specified directory]: :_directories'
+ '(-T --no-target-directory)'{-T,--no-target-directory}'[treat destination as regular file]'
+ '(: -)--version[display version information]'
+ "${lx}-Z[set SELinux security context on destination files to default type]"
+ )
+
+else
+ args+=(
+ ${common_args##((#s)|*\))(\*|)--*}
+ '-B+[specify backup suffix for -b]:backup suffix'
+ '-f+[specify destination file flags]: :_flags'
+ )
+ [[ $OSTYPE == dragonfly* ]] && args+=(
+ '!-D+[no effect (compatibility with NetBSD)]: :_directories'
+ '-L+[use user/group database files from specified directory]: :_directories'
+ '-l[fall back to system files if user/group not found in -L directory]'
+ )
+ [[ $OSTYPE == netbsd* ]] && args+=(
+ '-a+[specify shell command to run on files after install]:shell command'
+ '-r[use temporary files to perform safe copy]'
+ '-S+[specify arguments to pass to strip program]:arguments to strip program'
+ )
+ [[ $OSTYPE == (net|open)bsd* ]] && {
+ # (Net|Open)BSD has no -v for some reason
+ args=( ${args##((#s)|*\))(\*|)-v*} )
+ }
+ [[ $OSTYPE == openbsd* ]] && args+=(
+ '-D[create all leading destination path components]'
+ '-F[flush installed file contents to disk]'
+ )
+ [[ $OSTYPE == (darwin|dragonfly)* ]] && args+=(
+ '-M[disable use of mmap(2)]'
+ )
+ [[ $OSTYPE == (freebsd|netbsd)* ]] && args+=(
+ '-D+[specify destination directory used for metadata log]: :_directories'
+ '-h+[store digest in metadata log using specified method]: :->digests'
+ '(-C -c --compare)-l+[link files (rather than copy) using specified method]: :->linkflags'
+ '-M+[log mtree(8) metadata for installed files to specified file]:metadata log file:_files'
+ '+N+[use user/group database files from specified directory]: :_directories'
+ '-T+[specify mtree(8) tags to store in metadata log]:mtree(8) tags'
+ '-U[indicate that install is unprivileged]'
+ )
+ [[ $OSTYPE == netbsd* ]] || args+=(
+ '-S[use temporary files to perform safe copy]'
+ )
+fi
+
+_arguments -C -s -S : $args && ret=0
+
+case $state in
+ controls)
+ tmp=(
+ {none,off}':never make backups'
+ {numbered,t}':make numbered backups'
+ {existing,nil}':make numbered backups if they already exist'
+ # 'never' actually means 'always'...
+ {simple,never}':make simple backups'
+ )
+ _describe -t controls 'version control method' tmp && ret=0
+ ;;
+ digests)
+ tmp=( none md5 rmd160 sha1 sha256 sha512 )
+ [[ $OSTYPE == netbsd* ]] && tmp+=( sha384 )
+ _values 'digest method' $tmp && ret=0
+ ;;
+ linkflags)
+ tmp=(
+ 'h[hard links]'
+ 's[symlinks]'
+ 'm[mixed (hard links for files on same file system)]'
+ 'a[symlinks use absolute path]'
+ 'r[symlinks use relative path]'
+ )
+ _values -S '' 'link flags' $tmp && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_iostat b/Completion/Unix/Command/_iostat
index 88fc6a103..e95d62f80 100644
--- a/Completion/Unix/Command/_iostat
+++ b/Completion/Unix/Command/_iostat
@@ -1,6 +1,7 @@
#compdef iostat
-local -a args
+local -a args parser
+parser=( -s -S -A '-*' )
case $OSTYPE:l in
*bsd*)
@@ -109,23 +110,32 @@ case $OSTYPE:l in
)
;;
*linux*)
+ parser=( -s )
args=(
'-c[display CPU utilization report]'
'-d[display device utilization report]'
- '-T[only display global statistics for group_name]'
- '-g[display statistics for a group of devices]:group name'
- '-h[human readable device utilization report]'
- '-j[display persistent device name]'
+ '*-g[display statistics for a group of devices]:group name'
+ '-H[only display global statistics for group]'
+ '(--human)-h[human readable device utilization report]'
+ '--human[print sizes in human readable format]'
+ '-j[display persistent device name]:name type:(ID LABEL PATH UUID)'
'(-m)-k[display statistics in kB/s]'
'(-k)-m[display statistics in MB/s]'
'-N[display registered device mapper names]'
+ '-o[display statistics in JSON]:format:(JSON)'
+ '-p[display statistics for block devices]'
+ '-t[display the time for each report]'
+ '(- *)-V[display version information]'
+ '-x[display extended statistics]'
+ '-y[omit first statistics report following system boot]'
+ '-z[omit output for devices lacking activity]'
'*::device:_files -W /dev -g "*(-%)"'
)
;;
esac
if (( $#args )); then
- _arguments -s -w -A '-*' : $args
+ _arguments $parser : $args
return
fi
diff --git a/Completion/Unix/Command/_jq b/Completion/Unix/Command/_jq
new file mode 100644
index 000000000..55bb93c04
--- /dev/null
+++ b/Completion/Unix/Command/_jq
@@ -0,0 +1,34 @@
+#compdef jq
+
+# last updated for jq-1.5-1-a5b5cbe (debian package 1.5+dfsg-1.3)
+
+# Note:
+# Arguments to options must be in separate words. Thus,
+# {-f,--from-file}'[foo]'
+# is correct like that, without the usual {-f+,--from-file=} suffixes.
+#
+_arguments -S -s : \
+ "--version[output jq's version number]" \
+ "--seq[use application/json-seq ASCII RS/LF scheme in input and output]" \
+ "--stream[parse input streamily (changes output)]" \
+ '(-s --slurp)'{-s,--slurp}'[join input JSON objects to array before filtering]' \
+ '(-R --raw-input)'{-R,--raw-input}'[consider each input line as a JSON strings]' \
+ '(-n --null-input)'{-n,--null-input}'[input is ignored]' \
+ '(-c --compact-output)'{-c,--compact-output}"[don't pretty-print]" \
+ '(--indent)--tab[indent output using TAB characters]' \
+ '(--tab)--indent[indent output using given number of spaces]:number of spaces (integer):(2 4 8)' \
+ '(-C --color-output -M --monochrome-output)'{-C,--color-output}'[output in color]' \
+ '(-C --color-output -M --monochrome-output)'{-M,--monochrome-output}'[output without color]' \
+ '(-a --ascii-output)'{-a,--ascii-output}'[restrict output to ASCII]' \
+ '--unbuffered[flush output after each JSON object]' \
+ '(-S --sort-keys)'{-S,--sort-keys}'[output object keys in sorted order]' \
+ '(-r --raw-output -j --join-output)'{-r,--raw-output}"[don't JSON-quote output if it's a string]" \
+ '(-r --raw-output -j --join-output)'{-j,--join-output}"[like -r, without newlines between outputs]" \
+ '(-f --from-file)'{-f,--from-file}'[read filter from file]:_files' \
+ '-L+[prepend a directory to the module search path]:_directories' \
+ '(-e --exit-status)'{-e,--exit-status}'[report "false" and "null" results via exit code]' \
+ '*--arg[pre-set a variable to a string]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (string): ' \
+ '*--argjson[pre-set a variable to an object]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (JSON): ' \
+ '*--slurpfile[pre-set a variable to contents of a file]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (filename of file containing JSON):_files' \
+ "1: :_guard '|[^-]' filter" \
+ "*:_files"
diff --git a/Completion/Unix/Command/_last b/Completion/Unix/Command/_last
index f198e0fff..2013cc1c2 100644
--- a/Completion/Unix/Command/_last
+++ b/Completion/Unix/Command/_last
@@ -4,19 +4,20 @@ local pattern arg args ttys
ttys=( /dev/tty*(N) /dev/pts/*(N) reboot )
ttys=( ${ttys#/dev/} )
+[[ $OSTYPE = linux-gnu ]] || args=( -A "-*" )
for pattern arg in \
- '(solaris*|linux-gnu)' '-a[display hostname in last column]' \
- '((free|net|open)bsd*|darwin*|dragonfly*|linux-gnu)' '-h[limit sessions by hostname]:host:_hosts' \
- '((free|open)bsd*|linux-gnu)' '-s[report duration in seconds]' \
- '(freebsd*|openbsd*)' '-d[limit sessions to those active at snapshot time]:time ([[CC]YY][MMDD]hhmm[.SS])' \
- '((net|free|open)bsd*|darwin*|dragonfly*)' '-t[limit sessions by tty]:tty:_ttys -D' \
+ '(solaris*|linux-gnu)' '(--hostlast)-a[display hostname in last column]' \
+ '((free|net|open)bsd*|darwin*|dragonfly*)' '-h+[limit sessions by hostname]:host:_hosts' \
+ '((free|open)bsd*)' '-s[report duration in seconds]' \
+ '(freebsd*|openbsd*)' '-d+[limit sessions to those active at snapshot time]:time ([[CC]YY][MMDD]hhmm[.SS])' \
+ '((net|free|open)bsd*|darwin*|dragonfly*)' '-t+[limit sessions by tty]:tty:_ttys -D' \
'openbsd*' '-c[calculate total time]' \
- '^darwin*' '-f[specify account file]:file:_files' \
- '(solaris*|linux-gnu|freebsd*|openbsd*)' '-n[specify number of lines to show]:number' \
+ '^darwin*' '(--file)-f+[specify account file]:file:_files' \
+ '(solaris*|linux-gnu|freebsd*|openbsd*)' '(--limit)-n+[specify number of lines to show]:number' \
'((open|net)bsd*|dragonfly*)' '-T[show more detailed time information including year and seconds]' \
'netbsd*' '-x[assume file is in wtmpx(5) format]' \
'netbsd*' '-n[show IP of remote hosts]' \
- 'freebsd*' '-w[show seconds in durarion field]' \
+ 'freebsd*' '-w[show seconds in duration field]' \
'freebsd*' '-y[show year in session start time]'
do
[[ $OSTYPE = $~pattern ]] && args+=( $arg )
@@ -32,14 +33,21 @@ case $OSTYPE in
;;
linux-gnu)
args+=(
- '-R[suppress display of hostname field]'
- '-d[translate IP to hostname]'
- '-F[show full login and logout times and dates]'
- '-i[show IP of remote hosts]'
- '-o[read old-format wtmp]'
- '-t[limit sessions to those active at snapshot time]:time (YYYYMMDDhhmmss)'
- '-w[show full user and domain names]'
- '-x[display shutdown/runlevel entries]'
+ '(-a)--hostlast[display hostname in last column]'
+ '(-d --dns -i --ip)'{-d,--dns}'[translate IP to hostname]'
+ '(-f)--file=[specify account file]:file:_files'
+ '(-F --fulltimes)'{-F,--fulltimes}'[show full login and logout times and dates]'
+ '(-i --ip -d --dns)'{-i,--ip}'[show IP of remote hosts]'
+ '(-n)--limit=[specify number of lines to show]:number'
+ '(-R --nohostname)'{-R,--nohostname}'[suppress display of hostname field]'
+ '(-s --since)'{-s+,--since=}'[display lines since the specified time]:time (YYYYMMDDhhmmss)'
+ '(-t --until)'{-t+,--until=}'[display lines until the specified time]:time (YYYYMMDDhhmmss)'
+ '(-p --present)'{-p+,--present=}'[display who were present at the specified time]:time (YYYYMMDDhhmmss)'
+ '(-w --fullnames)'{-w,--fullnames}'[show full user and domain names]'
+ '(-x --system)'{-x,--system}'[display shutdown/runlevel entries]'
+ '--time-format=[show timestamps in the specified format]:format:(notime short full iso)'
+ '(- *)'{-h,--help}'[display usage information]'
+ '(- *)'{-V,--version}'[display version information]'
)
;;
esac
@@ -50,4 +58,4 @@ else
args+=( '*:user:_users' )
fi
-_arguments -s $args
+_arguments -s -S $args
diff --git a/Completion/Unix/Command/_ldconfig b/Completion/Unix/Command/_ldconfig
new file mode 100644
index 000000000..3c3fca538
--- /dev/null
+++ b/Completion/Unix/Command/_ldconfig
@@ -0,0 +1,81 @@
+#compdef ldconfig ldconfig.real
+
+local ret=1
+local -a args context line state state_descr
+local -A opt_args
+
+case $OSTYPE in
+ linux*)
+ args=(
+ '(x -v --verbose)'{-v,--verbose}'[output verbosely]' \
+ + x \
+ '(: -)'{-\?,--help}'[display help information]'
+ '(: -)'{-p,--print-cache}'[display libraries in current cache]'
+ '(: -)--usage[display brief usage information]'
+ '(: -)'{-V,--version}'[display version information]'
+ + l
+ '(x o)-l[manually link individual libraries (library mode)]'
+ + o
+ '(x l -c --format)'{-c+,--format=}'[specify cache format]:cache format:(old new compat)'
+ '(x l)-C+[specify cache file to use instead of /etc/ld.so.cache]:cache file:_files'
+ '(x l)-f+[specify configuration file to use instead of /etc/ld.so.conf]:configuration file:_files'
+ '(x l -i --ignore-aux-cache)'{-i,--ignore-aux-cache}'[ignore auxiliary cache file]'
+ '(x l -N)-n[process only directories specified on command line (implies -N)]'
+ '(x l)-N[do not rebuild cache]'
+ '(x l)-r+[specify root directory]:root directory:_directories'
+ '(x l)-X[do not update symbolic links]'
+ )
+ ;;
+ *bsd*|dragonfly*)
+ args=(
+ '(-U)-m[merge into the existing hints file]'
+ '(: -)-r[list the current contents of the hints file]'
+ );|
+ dragonfly*|freebsd*|openbsd*)
+ args+=(
+ '(-U)-R[rescan previously configured directories]'
+ );|
+ dragonfly*|freebsd*)
+ args+=(
+ '(-aout)-elf[generate hints for elf format shared libraries]'
+ '-f+[specify hints file]:hints file:_files'
+ '-i[run in insecure mode]'
+ );|
+ freebsd*|netbsd*|openbsd*)
+ args+=(
+ '-v[switch on verbose mode]'
+ );|
+ freebsd*|openbsd*)
+ args+=(
+ '-s[do not scan /usr/lib for shared libraries]'
+ );|
+ freebsd*)
+ args+=(
+ '-32[generate hints for 32-bit ABI shared libraries]'
+ '(-elf)-aout[generate hints for a.out format shared libraries]'
+ );|
+ netbsd*)
+ args+=(
+ '(-s)-c[do not scan directories in /etc/ls.so.conf]'
+ '(-s)-S[do not scan /usr/lib for shared libraries]'
+ '-s[do not scan /usr/lib or directories in /etc/ld.so.conf for shared libraries]'
+ );|
+ openbsd*)
+ args+=(
+ '(-m)-U[unconfigure specified directories or inaccessable directories if none specified]'
+ );|
+esac
+
+_arguments -s -S : \
+ '(x)*: :->files' \
+ $args \
+&& ret=0
+
+[[ $state == files ]] &&
+if [[ -n ${opt_args[(I)l--l]} ]]; then
+ _object_files && ret=0
+else
+ _directories && ret=0
+fi
+
+return ret
diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less
index 9092010f2..7f01952d2 100644
--- a/Completion/Unix/Command/_less
+++ b/Completion/Unix/Command/_less
@@ -91,7 +91,7 @@ _arguments -S -s -A "[-+]*" \
if [[ -n "$state" ]]; then
case $state in
prompts)
- if compset -P \?; then
+ if compset -p 1; then
_message -e prompt
else
_describe 'prompt' '(
diff --git a/Completion/Unix/Command/_ln b/Completion/Unix/Command/_ln
index efb982aba..764dc8f99 100644
--- a/Completion/Unix/Command/_ln
+++ b/Completion/Unix/Command/_ln
@@ -3,19 +3,11 @@
local curcontext="$curcontext" state line ret=1
local -A opt_args
-local -a args bsd
+local -a args opts
args=(
- '-f[remove existing destination files]'
+ '(-i)-f[remove existing destination files]'
'-s[create symbolic links instead of hard links]'
)
-bsd=(
- '-F[remove existing destination directories]'
- {-h,-n}'[do not dereference destination]'
- '-i[prompt before removing destination files]'
- '-v[print name of each linked file]'
-)
-
-local -a opts
local variant
_pick_variant -r variant gnu=gnu unix --help
@@ -50,18 +42,40 @@ 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+=( $bsd )
-elif [[ $OSTYPE == freebsd* ]]; then
- args+=( $bsd
- '(-L)-P[create hard links directly to symbolic links]'
- '(-P)-L[create hard links to symbolic link references]'
- "-w[warn if source of a symbolic link doesn't currently exist]"
- )
+ '(-f)-i[prompt before removing destination files]')
+else
+ case $OSTYPE in
+ darwin*|dragonfly*|freebsd*|netbsd*|openbsd*)
+ args+=(
+ {-h,-n}'[do not dereference destination]'
+ )
+ ;|
+ darwin*|dragonfly*|freebsd*|netbsd*)
+ args+=(
+ '(-f)-i[prompt before removing destination files]'
+ '-v[print name of each linked file]'
+ )
+ ;|
+ darwin*|dragonfly*|freebsd*)
+ args+=(
+ '-F[remove existing destination directories]'
+ )
+ ;|
+ dragonfly*|freebsd*|openbsd*)
+ args+=(
+ '(-L)-P[create hard links directly to symbolic links]'
+ '(-P)-L[create hard links to symbolic link references]'
+ )
+ ;|
+ dragonfly*|freebsd*)
+ args+=(
+ "-w[warn if source of a symbolic link doesn't currently exist]"
+ )
+ ;;
+ esac
fi
-_arguments -C -s $opts \
+_arguments -C -s $opts : \
$args \
':link target:_files' \
'*:: :->files' && ret=0
diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls
index 955b0894d..ea96de6ff 100644
--- a/Completion/Unix/Command/_ls
+++ b/Completion/Unix/Command/_ls
@@ -168,6 +168,7 @@ else
'--color=-[control use of color]:color:(never always auto)'
"*--hide=[like -I, but overridden by -a or -A]:pattern: "
+ '--hyperlink=[output terminal codes to link files using file::// URI]::when:(none auto always)'
'(--classify -F --indicator-style -p --file-type)'{--classify,-F}'[append file type indicators]'
'(--file-type -p --indicator-style -F --classify)--file-type[append file type indicators except *]'
'(--file-type -p --indicator-style -F --classify)-p[append / to directories]'
@@ -176,7 +177,7 @@ else
'(-f)--full-time[list both full date and full time]'
'(--block-size --human-readable -h --si --kilobytes -k)'{--kilobytes,-k}'[use block size of 1k]'
- '(--human-readable -h --si --kilobytes -k)--block-size=[specify block size]:block size (bytes):(1024)'
+ '(--human-readable -h --si --kilobytes -k)--block-size=[specify block size]:block size (bytes):(K M G T P E Z Y KB MB TB PB EB ZB YB)'
'(--numeric-uid-gid -n)'{--numeric-uid-gid,-n}'[numeric uid, gid]'
'(--tabsize -T)'{--tabsize=,-T+}'[specify tab size]:tab size'
diff --git a/Completion/Unix/Command/_lsof b/Completion/Unix/Command/_lsof
index bbb6eab59..86115a4ef 100644
--- a/Completion/Unix/Command/_lsof
+++ b/Completion/Unix/Command/_lsof
@@ -1,6 +1,6 @@
#compdef lsof
-local curcontext="$curcontext" state line expl fields args
+local curcontext="$curcontext" state line expl fields args alts suf hsuf pref ret=1
case $OSTYPE in
linux*) args=( '-X[skip reporting of info on network connections]' ) ;;
@@ -28,8 +28,8 @@ _arguments -C -s -S $args \
'+f[enable listing of kernel file structure info]::info type:(c f g G n)' \
'-F[select output fields]:fields:->fields' \
'-g[select by process group id]::process group id' \
- '*-i[select internet files]:address' \
- '-K[select listing of tasks of processes]' \
+ '(*)*-i[select internet files]::address:->addresses' \
+ '-K+[select listing of tasks of processes]::value:((i\:ignore\ tasks))' \
'-k[specify kernel name list file]:kernel file:_files' \
'-l[inhibit conversion of UIDs to user names]' \
'-L[list no link counts]' \
@@ -46,7 +46,7 @@ _arguments -C -s -S $args \
'-r[repeat listing endlessly]::delay (seconds)' \
'+r[repeat listing until no files listed]::delay (seconds)' \
'-R[list parent PID]' \
- '(-o)-s[list file size]' \
+ '(-o)-s+[list file size or exclude TCP/UDP files by state]::state:->states' \
'-S[specify timeout for kernel functions that might deadlock]:timeout (seconds)' \
'-T[select reporting of TCP/TPI info]::info type:((q\:queue\ length\ reporting s\:state\ reporting w\:window\ size\ reporting))' \
'(+w -w)-t[terse output]' \
@@ -57,18 +57,52 @@ _arguments -C -s -S $args \
'(-t)+w[suppress warnings]' \
'(-t)-w[enable warnings]' \
'-x[cross filesystems/traverse symlinks with +d/+D]::type:((f\:filesystems s\:symlinks))' \
- '*:file:_files' && return
+ '*:file:_files' && ret=0
case $state in
+ addresses)
+ if compset -P 1 '*:'; then
+ _ports && ret=0
+ else
+ if compset -P 1 '*@'; then
+ pref=()
+ else
+ pref=( -P @ )
+ suf=( -qS @ )
+ [[ $PREFIX = (#i)(4|6|tcp|udp)* ]] || alts=( 'ip-versions:IP version:(4 6)' )
+ compset -P '[46]'
+ alts+=( 'protocols:protocol:compadd $suf -M 'm:{a-z}={A-Z}' TCP UDP' )
+ fi
+ if compset -S '@*'; then
+ suf=()
+ else
+ hsuf=( -qS : )
+ compset -S ':*' && hsuf=()
+ alts+=( "hosts:host:_hosts $pref $hsuf" )
+ fi
+
+ _alternative $alts && ret=0
+ fi
+ ;;
fields)
fields=( ${${${${(f)"$($words[1] -F \? 2>&1)"}[2,-1]#??}// ##/:}:#(#s)[${PREFIX:-:}]:*} )
compset -P '*'
- _describe -t fields "field" fields -S '' && return
+ _describe -t fields "field" fields -S '' && ret=0
;;
filedes)
_sequence -s , _wanted -x file-descriptors expl "file descriptor" compadd - \
- cwd err jld ltz mem mmap pd rtd tr txt v86 && return
+ cwd err jld ltz mem mmap pd rtd tr txt v86 && ret=0
+ ;;
+ states)
+ if compset -P 1 '*:'; then
+ _sequence _wanted states expl state compadd - -M 'm:{a-z}={A-Z}' \
+ CLOSED IDLE BOUND LISTEN ESTABLISHED SYN_SENT SYN_RCDV ESTABLISHED \
+ CLOSE_WAIT FIN_WAIT1 CLOSING LAST_ACK FIN_WAIT_2 TIME_WAIT && ret=0
+ else
+ compset -S ':*' || suf=( -qS : )
+ _wanted protocols expl protocol compadd $suf -M 'm:{a-z}={A-Z}' TCP UDP && ret=0
+ fi
;;
esac
-return 1
+return ret
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index a2ee9ecac..1761bba71 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -69,7 +69,7 @@ _make-expandVars() {
}
_make-parseMakefile () {
- local input var val target dep TAB=$'\t' dir=$1 tmp IFS=
+ local input var val target dep TAB=$'\t' tmp IFS=
while read input
do
@@ -108,14 +108,10 @@ _make-parseMakefile () {
f=${f%[\">]}
fi
f=$(_make-expandVars $f)
- case $f in
- (/*) ;;
- (*) f=$dir/$f ;;
- esac
if [[ -r $f ]]
then
- _make-parseMakefile ${f%%/[^/]##} < $f
+ _make-parseMakefile < $f
fi
;;
esac
@@ -150,7 +146,7 @@ _make-findBasedir () {
_make() {
- local prev="$words[CURRENT-1]" file expl tmp is_gnu dir incl match
+ local prev="$words[CURRENT-1]" file expl tmp is_gnu incl match
local context state state_descr line
local -a option_specs
local -A VARIABLES VAR_ARGS opt_args
@@ -266,16 +262,16 @@ _make() {
if [[ $is_gnu == gnu ]]
then
if zstyle -t ":completion:${curcontext}:targets" call-command; then
- _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
+ _make-parseMakefile < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
else
- _make-parseMakefile $PWD < $file
+ _make-parseMakefile < $file
fi
else
if [[ $OSTYPE == (freebsd|dragonfly|netbsd)* || /$words[1] == */bmake* ]]; then
TARGETS+=(${=${(f)"$(_call_program targets "$words[1]" -s -f "$file" -V.ALLTARGETS 2> /dev/null)"}})
- _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsdg1Fstdout -f "$file" .PHONY 2> /dev/null)
+ _make-parseMakefile < <(_call_program targets "$words[1]" -nsdg1Fstdout -f "$file" .PHONY 2> /dev/null)
else
- _make-parseMakefile $PWD < $file
+ _make-parseMakefile < $file
fi
fi
fi
@@ -287,14 +283,10 @@ _make() {
compset -P 1 '*='
_value "$@" && ret=0
else
- _tags targets variables
- while _tags
- do
- _requested targets expl 'make targets' \
- compadd -Q -- $TARGETS && ret=0
- _requested variables expl 'make variables' \
- compadd -S '=' -F keys -- ${(k)VARIABLES} && ret=0
- done
+ _alternative \
+ 'targets:make target:compadd -Q -a TARGETS' \
+ 'variables:make variable:compadd -S = -F keys -k VARIABLES' \
+ '*:file:_files' && ret=0
fi
esac
diff --git a/Completion/Unix/Command/_metaflac b/Completion/Unix/Command/_metaflac
deleted file mode 100644
index 65b9eb292..000000000
--- a/Completion/Unix/Command/_metaflac
+++ /dev/null
@@ -1,54 +0,0 @@
-#compdef metaflac
-
-local _metaflac_opts _metaflac_shorts _metaflac_opers
-
-_metaflac_opts=(
- '--preserve-modtime'
- '--with-filename[prefix output with filename]'
- '--no-filename'
- '--no-utf8-convert'
- '--dont-use-padding[always rewrite the file]'
-)
-_metaflac_shorts=(
- '--show-md5sum'
- '--show-min-blocksize'
- '--show-max-blocksize'
- '--show-min-framesize'
- '--show-max-framesize'
- '--show-sample-rate'
- '--show-channels'
- '--show-bps'
- '--show-total-samples'
- '--show-vendor-tag'
- '--show-tag=:FLAC tags'
- '--remove-tag=:FLAC tags: '
- '--remove-first-tag=:FLAC tags: '
- '--remove-all-tags'
- '--set-tag=:FLAC tag and value: '
- '--import-tags-from=:flat file:_files'
- '--export-tags-to=:new file: '
- '--import-cuesheet-from=:file:_files'
- '--export-cuesheet-to=:new file: '
- '--add-replay-gain'
- '--add-seekpoint=:: '
- '--add-padding=length'
-
-)
-_metaflac_opers=(
- '--block-number=:: '
- '--block-type=:: '
- '--except-block-type=:: '
- '--application-data-format=:: '
- '--list'
- '--remove'
- '--remove-all'
- '--merge-padding'
- '--sort-padding'
-)
-
-_arguments "$_metaflac_opts[@]" \
- "*:FLAC file:_files -g \*.flac\(-.\)" \
- - "shortcuts" \
- "$_metaflac_shorts[@]" \
- - "(operations)" \
- "$_metaflac_opers[@]"
diff --git a/Completion/Unix/Command/_mkdir b/Completion/Unix/Command/_mkdir
index f2299f7c7..53536b01d 100644
--- a/Completion/Unix/Command/_mkdir
+++ b/Completion/Unix/Command/_mkdir
@@ -4,35 +4,26 @@ local curcontext="$curcontext" state line expl args variant ret=1
typeset -A opt_args
args=(
- '(-m --mode)'{-m,--mode=}'[set permission mode]:numeric mode'
+ '(-m --mode)'{-m,--mode=}'[set permission mode]: :_file_modes'
'(-p --parents)'{-p,--parents}'[make parent directories as needed]'
'(-)*: :->directories'
)
-case "$OSTYPE" in
- linux*)
- args+=(
- '(-Z --context)'{-Z,--context=}'[set SELinux context]:SELinux context'
- )
- ;;
-esac
-
-_pick_variant -r variant gnu=gnu zsh='\(eval\)' $OSTYPE --help
# It can still happen that there is a precommand command or builtin in the line.
# In such cases, the variant has to be modified suitably, after further checking
# the variant of the _command_ mkdir.
-
-# I currently don't know of any way to find out what precommands are present on
-# the line. The variant should be modified like this once a way is found out:
-
-# if [[ $variant == zsh ]]; then
-# if [[ $precommand = *command* ]]; then
-# _mkdir_command () { command mkdir "$@" }
-# _pick_variant -c _mkdir_command -r variant gnu=gnu unix --help
-# fi
-# elif [[ $precommand = *builtin* ]]; then
-# variant=zsh
-# fi
+#
+# $precommands is defined in _main_complete
+if (( ${+precommands[(r)command]} )); then
+ _mkdir_command () { command mkdir "$@" }
+ _pick_variant -c _mkdir_command -r variant gnu=gnu unix --help
+ unfunction _mkdir_command
+elif (( ${+precommands[(r)builtin]} )) || (( ${+builtins[mkdir]} )) || [[ "$(type -w mkdir)" == "*: builtin" ]]; then
+ variant=zsh
+else
+ _pick_variant -r variant gnu=gnu zsh='\(eval\)' $OSTYPE --help
+fi
+# Now $variant is set.
case $variant in
gnu|freebsd*|dragonfly*)
@@ -41,13 +32,17 @@ case $variant in
)
;|
gnu)
+ if [[ $OSTYPE == linux* ]]; then
+ args+=(
+ '(-Z --context)'{-Z,--context=}'[set SELinux context]:SELinux context'
+ )
+ fi
args+=(
'(- :)--help[display help information]'
'(- :)--version[display version information]'
)
;;
zsh) # remove all options
- args=( '*: :->directories' )
;;
*) # non-GNU: remove long options
args=( ${${${args:#(|*\))--*}//--[^ )]#/}/\( #\)/} )
diff --git a/Completion/Unix/Command/_mktemp b/Completion/Unix/Command/_mktemp
new file mode 100644
index 000000000..4b5bf99f7
--- /dev/null
+++ b/Completion/Unix/Command/_mktemp
@@ -0,0 +1,43 @@
+#compdef mktemp gmktemp
+
+local variant
+local args
+
+_pick_variant -r variant busybox=BusyBox gnu='Free Soft' unix --version
+
+args=(
+ '(-d --directory)'{-d,--directory}'[make directory instead of file]'
+ '(: -)--help[display help information]'
+ '(-p --tmpdir)'{-p+,--tmpdir=}'[make relative to specified directory]: :_directories'
+ '(-q --quiet)'{-q,--quiet}'[suppress error messages]'
+ '--suffix=[append specified suffix to template]:template suffix'
+ '-t[interpret template as single path component relative to temp dir]'
+ '(-u --dry-run)'{-u,--dry-run}'[print file name only]'
+ '(: -)'{-V,--version}'[display version information]'
+ '1: :_guard "^-*" "template name"'
+)
+
+# Non-GNU variants don't support long options (except BusyBox's --help)
+if [[ $variant == *busybox* ]]; then # See also: _busybox
+ args=( ${args:#((#s)|*\))(\*|)--^help*} )
+elif [[ $variant != gnu ]]; then
+ args=( ${args:#((#s)|*\))(\*|)--*} )
+fi
+
+[[ $variant == gnu ]] || {
+ # BusyBox, OpenBSD, and Solaris have -p, but -t doesn't take an argument
+ if [[ $variant == *busybox* ]] || [[ $OSTYPE == (openbsd|solaris)* ]]; then
+ args=( ${args:#((#s)|*\))(\*|)-t*} )
+ args+=( '-t[generate template relative to temp dir]' )
+ # Dragonfly, FreeBSD, and Darwin take an argument to -t and support any number
+ # of template files
+ else
+ args=( ${args:#((#s)|*\))(1:*|(\*|)-t*)} )
+ args+=(
+ '-t[generate template relative to temp dir using specified prefix]:template prefix'
+ '*: :_guard "^-*" "template name"'
+ )
+ fi
+}
+
+_arguments -s -S : $args
diff --git a/Completion/Unix/Command/_mosh b/Completion/Unix/Command/_mosh
index 431fdbf9e..7d1250320 100644
--- a/Completion/Unix/Command/_mosh
+++ b/Completion/Unix/Command/_mosh
@@ -1,6 +1,6 @@
#compdef mosh
-local curcontext="$curcontext" state line
+local curcontext="$curcontext" state line expl ret=1
local -a _comp_priv_prefix
_arguments -C \
@@ -12,15 +12,30 @@ _arguments -C \
'(-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]' \
+ '(--family -6)-4[use IPv4 only]' \
+ '(--family -4)-6[use IPv6 only]' \
+ '(-4 -6)--family=[specify address family]:family [prefer-inet]:(inet inet6 auto all prefer-inet prefer-inet6)' \
+ '--bind-server=[ask the server to reply from an IP address]:{ssh|any|IP}' \
'--server[specify command to run server helper]:remote file:_files' \
'--client[specify command to run client helper]:_command_names -e' \
+ "--no-ssh-pty[don't allocate a pseudo tty on ssh connection]" \
+ '--local[run mosh-server locally without using ssh]' \
+ '--experimental-remote-ip=[select method for discovering remote IP address to use for mosh]:method:(local remote proxy)' \
'1:remote host name:->userhost' \
- '*:::args:_normal' && return
+ '*:::args:_normal' && ret=0
case $state in
userhost)
- _hosts || _user_at_host && return
+ if compset -P '*@'; then
+ _wanted hosts expl 'remote host name' _ssh_hosts && ret=0
+ elif compset -S '@*'; then
+ _wanted users expl 'login name' _combination -s '[:@]' my-accounts users-hosts users -S '' && ret=0
+ else
+ _alternative \
+ 'hosts:remote host name:_ssh_hosts' \
+ 'users:login name:_combination -s "[:@]" my-accounts users-hosts users -qS@' && ret=0
+ fi
;;
esac
-return 1
+return ret
diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc
index fee5e06f4..45d93550d 100644
--- a/Completion/Unix/Command/_mpc
+++ b/Completion/Unix/Command/_mpc
@@ -53,6 +53,7 @@ _mpc_command() {
play:"start playing"
playlist:"print the current playlist"
prev:"play the previous song in the current playlist"
+ prio:"change song priorities in the queue"
random:"toggle random mode, or specify state"
repeat:"toggle repeat mode, or specify state"
single:"toggle single mode, or specify state"
diff --git a/Completion/Unix/Command/_mtr b/Completion/Unix/Command/_mtr
index 5eda9bc1a..806e344d1 100644
--- a/Completion/Unix/Command/_mtr
+++ b/Completion/Unix/Command/_mtr
@@ -1,22 +1,60 @@
#compdef mtr
-_arguments -C \
- '(-h --help)'{-h,--help}'[help]' \
- '(-v --version)'{-v,--version}'[version]' \
- '(-r --report)'{-r,--report}'[report mode]' \
- '(-w --report-wide)'{-w,--report-wide}'[wide report mode\: do not truncate hostnames]' \
- '(-c --report-cycles)'{-c,--report-cycles}'[report cycles]:number of pings' \
- '(-s --psize)'{-s,--psize}'[packet size]:number of bytes' \
- '(-t --curses)'{-t,--curses}'[curses UI]' \
- '(-e --mpls)'{-e,--mpls}'[display ICMP MPLS information]' \
- '(-o --order)'{-o,--order}'[order output fields]:fields order' \
- '(-n --no-dns)'{-n,--no-dns}'[no DNS lookups]' \
- '(-g --gtk)'{-g,--gtk}'[GTK+ UI]' \
- '(-p --split)'{-p,--split}'[output for a split-user interface]' \
- '(-l --raw)'{-l,--raw}'[raw output format]' \
- '(-a --address)'{-a,--address}'[source address]:source IP:_hosts' \
- '(-i --interval)'{-i,--interval}'[ping interval]:number of seconds' \
- '-u[use UDP instead of ICMP echo]' \
- '-4[use IPv4 only]' \
- '-6[use IPv6 only]' \
- ':destination host:_hosts'
+_arguments -s -S \
+ '(H -F --filename)'{-F,--filename}'[read hostnames from a file]' \
+ '(H -6)-4[use IPv4 only]' \
+ '(H -4)-6[use IPv6 only]' \
+ '(H -a --address)'{-a+,--address=}'[bind outgoing packets to specific interface]:source IP:_hosts' \
+ '(H -f --first-ttl)'{-f+,--first-ttl=}'[specify TTL to start]:TTL [1]' \
+ '(H -m --max-ttl)'{-m+,--max-ttl=}'[specify maximum number of hops to probe]:hops [30]' \
+ '(H -U --max-unknown)'{-U+,--max-unknown=}'[specify maximum unknown hosts]:maximum [5]' \
+ '(H -P --port)'{-P+,--port=}'[specify target port for TCP, SCTP or UDP]:port' \
+ '(H -L --localport -T --tcp -S --sctp)'{-L+,--localport=}'[specify source port number for UDP]' \
+ '(H -s --psize 2)'{-s+,--psize=}'[packet size]:packet size (bytes)' \
+ '(H -B --bitpattern)'{-B+,--bitpattern=}'[specify bit pattern to use in payload]:number (0-255)' \
+ '(H -i --interval)'{-i+,--interval=}'[specify ping interval]:interval (seconds)' \
+ '(H -G --gracetime)'{-G+,--gracetime=}'[specify time to wait for responses]:wait time (seconds)' \
+ '(H -Q --tos)'{-Q+,--tos=}'[specify type of service for IP header]:tos (0-255)' \
+ '(H -e --mpls)'{-e,--mpls}'[display ICMP MPLS information]' \
+ '(H -Z --timeout)'{-Z+,--timeout=}'[specify how long to keep probe sockets open before giving up on the connection]:timeout (seconds)' \
+ '(H -M --mark)'{-M+,--mark=}'[mark each sent packet]:mark' \
+ '(H -r --report)'{-r,--report}'[report mode]' \
+ '(H -w --report-wide)'{-w,--report-wide}"[wide report mode\: don't truncate hostnames]" \
+ '(H -c --report-cycles)'{-c+,--report-cycles=}'[report cycles]:number of pings' \
+ '(H)--displaymode=[select initial display mode]:display mode:((0\:statistics 1\:stripchart\ with\ latency 2\:stripchart\ without\ latency))' \
+ '(H -n --no-dns)'{-n,--no-dns}'[no DNS lookups]' \
+ '(H -b --show-ips)'{-b,--show-ips}'[show both IP numbers and host names]' \
+ '(H -o --order)'{-o+,--order=}'[specify order of output fields]: :_values -S "" "field order"
+ "L[loss ratio]"
+ "D[dropped packets]"
+ "R[received packets]"
+ "S[sent packets]"
+ "N[newest RTT]"
+ "B[min/best RTT]"
+ "A[average RTT]"
+ "W[max/worst RTT]"
+ "V[standard deviation]"
+ "G[geometric mean]"
+ "J[current jitter]"
+ "M[jitter mean/average]"
+ "X[worst jitter]"
+ "I[interarrival jitter]"' \
+ '(H -z --aslookup -y --ipinfo)'{-y+,--ipinfo=}'[select IP information in output]:information:((0\:display\ AS\ number 1\:display\ IP\ prefix 2\:display\ country\ code 3\:display\ RIR 4\:display\ allocation\ date))' \
+ '(H -y --ipinfo -z --aslookup)'{-z,--aslookup}'[display AS number]' \
+ '(H)1:destination host:_hosts' \
+ '(H)2:packet size (bytes)' \
+ + '(H)' \
+ '(- 1 2)'{-h,--help}'[display help information]' \
+ '(- 1 2)'{-v,--version}'[display version information]' \
+ + '(proto)' \
+ '(H)'{-u,--udp}'[use UDP instead of ICMP echo]' \
+ '(H -s --psize)'{-T,--tcp}'[use TCP instead of ICMP echo]' \
+ '(H)'{-S,--sctp}'[use SCTP instead of ICMP echo]' \
+ + '(output)' \
+ '(H)'{-t,--curses}'[curses UI]' \
+ '(H)'{-g,--gtk}'[GTK+ UI]' \
+ '(H)'{-p,--split}'[output for a split-user interface]' \
+ '(H)'{-l,--raw}'[output raw format]' \
+ '(H)'{-C,--csv}'[output comma separated values]' \
+ '(H)'{-j,--json}'[output JSON]' \
+ '(H)'{-x,--xml}'[output XML]'
diff --git a/Completion/Unix/Command/_mv b/Completion/Unix/Command/_mv
new file mode 100644
index 000000000..3592efee6
--- /dev/null
+++ b/Completion/Unix/Command/_mv
@@ -0,0 +1,42 @@
+#compdef mv gmv
+
+local args
+if _pick_variant gnu=GNU unix --version; then
+ args=(
+ '(-b --backup -n --no-clobber)--backup=[make a backup of each existing destination file]: : _values "backup type"
+ {none,off}"[never make backups]"
+ {numbered,t}"[make numbered backups]"
+ {existing,nil}"[numbered backups, if they already exist]"
+ {simple,never}"[always make simple backups]"'
+ '(-b --backup -n --no-clobber)-b[make a backup of each existing destination file]'
+ '(-f --force -i --interactive -n --no-clobber)'{-f,--force}"[don't prompt before overwriting]"
+ '(-f --force -i --interactive -n --no-clobber)'{-i,--interactive}'[prompt before overwriting existing file]'
+ '--strip-trailing-slashes[remove any trailing slashes from each source argument]'
+ '(-S --suffix)'{-S+,--suffix=}'[specify the backup suffix]:backup suffix [~]'
+ '(-t --target-directory)'{-t+,--target-directory=}'[move all source arguments into specified directory]:directory:_directories'
+ '(-T --no-target-directory)'{-T,--no-target-directory}'[treat final argument as a normal file]'
+ '(-u --update)'{-u,--update}'[move only when destination file is older or missing]'
+ '(-v --verbose)'{-v,--verbose}'[show file names after they are moved]'
+ '(- *)--help[display usage information]'
+ '(- *)--version[display version information]'
+ )
+ [[ $OSTYPE = linux* ]] && args+=(
+ '(-Z --context)'{-Z,--context}'[set SELinux security context of destination file to default type]'
+ )
+else
+ local pattern arg
+ args=(
+ "(-i -n)-f[don't prompt before overwriting]"
+ '(-f -n)-i[prompt before overwriting existing file]'
+ )
+ for pattern arg in \
+ '(darwin|dragonfly|freebsd)*' "(-f -i)-n[don't overwrite existing file]" \
+ '(darwin|dragonfly|*bsd)*' '-v[show file names after they are moved]' \
+ '(dragonfly|freebsd)*' "-h[if target is a symlink to a directory, don't follow it]"
+ do
+ [[ $OSTYPE = $~pattern ]] && args+=( $arg )
+ done
+fi
+
+_arguments -s -S $args \
+ '*:file:_files'
diff --git a/Completion/Unix/Command/_netcat b/Completion/Unix/Command/_netcat
index 4e4006b30..250d4c85d 100644
--- a/Completion/Unix/Command/_netcat
+++ b/Completion/Unix/Command/_netcat
@@ -6,11 +6,12 @@ if [[ $service = nc ]] && ! _pick_variant netcat=connect nedit -h; then
return
fi
-if (( ! $+_nc_args )); then
+if (( ! $#_cache_nc_args )); then
+ typeset -ga _cache_nc_args
local help="$(_call_program options $words[1] -h < /dev/null 2>&1)"
local -A optionmap
optionmap=(
- '*-e prog*' '-e+[program to exec after connect]:prog:_command_names -e'
+ '*-e prog*' '-e+[program to exec after connect]:program:_command_names -e'
'*-g gateway*' '-g+[source-routing hop point]:gateway:_hosts'
'*-G num*' '-G[source-routing pointer: 4, 8, 12]'
'*-i secs*' '-i+[delay interval for lines sent or ports scanned]:delay (secs)'
@@ -28,10 +29,10 @@ if (( ! $+_nc_args )); then
'*-x*' '-x'
'*-b*' '-b[allow broadcasts]'
)
- _nc_args=($optionmap[(K)"$help"])
+ _cache_nc_args=( $optionmap[(K)"$help"] )
fi
_arguments -s \
- "$_nc_args[@]" \
+ "$_cache_nc_args[@]" \
':host:_hosts' \
':port:_ports'
diff --git a/Completion/Unix/Command/_notmuch b/Completion/Unix/Command/_notmuch
index d6cc58deb..6174d2c00 100644
--- a/Completion/Unix/Command/_notmuch
+++ b/Completion/Unix/Command/_notmuch
@@ -6,12 +6,16 @@ _notmuch_commands()
notmuch_commands=(
'setup:interactively set up notmuch for first use'
'new:find and import any new message to the database'
+ 'insert:add a new message into the maildir and notmuch database'
'search:search for messages matching the search terms, display matching threads as results'
+ 'address:get addresses from messages matching the given search terms'
'reply:constructs a reply template for a set of messages'
'show:show all messages matching the search terms'
'tag:add or remove tags for all messages matching the search terms'
'dump:creates a plain-text dump of the tags of each message'
'restore:restores the tags from the given file'
+ 'compact:compact the notmuch database'
+ 'reindex:re-index all messages matching the search terms'
'help:show details on a command'
'compact:compact the notmuch database'
'config:access the notmuch configuration file'
@@ -30,7 +34,9 @@ _notmuch_help_topics()
{
local -a notmuch_help_topics
notmuch_help_topics=(
- 'search-terms:show common search-terms syntax'
+ 'search-terms:common search-term syntax'
+ 'hooks:hooks that will be run before or after certain commands'
+ 'properties:message property conventions and documentation'
)
_describe -t notmuch-help-topics 'topic' notmuch_help_topics
}
diff --git a/Completion/Unix/Command/_numfmt b/Completion/Unix/Command/_numfmt
new file mode 100644
index 000000000..999c412a1
--- /dev/null
+++ b/Completion/Unix/Command/_numfmt
@@ -0,0 +1,24 @@
+#compdef numfmt gnumfmt
+
+local units="((auto\:1K\ =\ 1000,\ 1Ki\ =\ 1024 si\:1K\ =\ 1000 iec\:1K\ =\ 1024 iec-i\:1Ki\ =\ 1024))"
+
+_arguments -S \
+ '(H)--debug[print warnings about invalid input]' \
+ '(H -z --zero-terminated -d --delimiter)'{-d+,--delimiter=}'[use specified field delimiter instead of whitespace]:delimiter' \
+ '(H)--field=[replace numbers in specified input fields]:fields [1]' \
+ '(H)--format=[use printf style floating-point format]:format' \
+ "(H)--from=[auto-scale input numbers to specified units]:unit [none]:$units" \
+ '(H)--from-unit=[specify the input unit size]:unit size [1]' \
+ '(H)--grouping[use locale-defined digit grouping e.g. 1,000,000]' \
+ '(H)--header=-[print (without converting) initial header lines]::header lines [1]' \
+ '(H)--invalid=[specify failure mode for invalid numbers]:mode [abort]:(abort fail warn ignore)' \
+ '(H)--padding=[pad the output to specified width]:width; positive - right-align; negative - left-align' \
+ '(H)--round=[use specified method for rounding when scaling]:method [from-zero]:(up down from-zero towards-zero nearest)' \
+ '(H)--suffix=[add suffix to output numbers and accept optional suffix in input numbers]:suffix' \
+ "(H)--to=[auto-scale output numbers to specified unit]:unit:$units" \
+ '(H)--to-unit=[specify output unit size]:unit size [1]' \
+ '(H -z --zero-terminated -d --delimiter)'{-z,--zero-terminated}'[line delimiter is NUL, not newline]' \
+ '(H)*: :_guard "^-*" number' \
+ + 'H' \
+ '(- *)--help[display usage information]' \
+ '(- *)--version[display version information]'
diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump
index cc213d911..ee2f3ea6f 100644
--- a/Completion/Unix/Command/_objdump
+++ b/Completion/Unix/Command/_objdump
@@ -1,3 +1,175 @@
-#compdef objdump
+#compdef objdump eu-objdump llvm-objdump
-_arguments -- '*:object file:_object_files'
+local opts args files variant curcontext=$context state state_descr line ret=1
+typeset -A opt_args
+
+files='*:object file:_object_files'
+
+_pick_variant -r variant binutils=GNU elfutils=elfutils llvm=LLVM unix --version
+
+opts=( -s -S ) # options for _arguments
+args=(
+ "(-d --disassemble)"{-d,--disassemble}"[Display assembler code of executable sections]"
+ "(-r --reloc)"{-r,--reloc}"[Display relocation information]"
+ "(-s --full-contents)"{-s,--full-contents}"[Display the full contents of all sections requested]"
+ "*"{-j+,--section=}"[Only display information for section]:section:(.bss .data .dynamic .dynsym .got .interp .shstrtab .symtab .text)"
+)
+
+case $variant in
+ binutils)
+ args+=(
+ "(-a --archive-headers)"{-a,--archive-headers}"[Display archive header information]"
+ "(-f --file-headers)"{-f,--file-headers}"[Display the contents of the overall file header]"
+ "(-p --private-headers)"{-p,--private-headers}"[Display object format specific file header contents]"
+ "*"{-P,--private=}"[Display object format specific contents]:option"
+ "(-h --section-headers --headers)"{-h,--section-headers,--headers}"[Display the contents of the section headers]"
+ "(-x --all-headers)"{-x,--all-headers}"[Display the contents of all headers]"
+ "(-D --disassemble-all)"{-D,--disassemble-all}"[Display assembler contents of all sections]"
+ "(-S --source)"{-S,--source}"[Intermix source code with disassembly]"
+ "(-g --debugging)"{-g,--debugging}"[Display debug information in object file]"
+ "(-e --debugging-tags)"{-e,--debugging-tags}"[Display debug information using ctags style]"
+ "(-G --stabs)"{-G,--stabs}"[Display (in raw form) any STABS info in the file]"
+
+ "*-W-[Display DWARF info in the file]::dwarf section:->short_dwarf_names"
+ "*--dwarf=-[Display DWARF info in the file]::dwarf section:->dwarf_names"
+
+ "(-t --syms)"{-t,--syms}"[Display the contents of the symbol table(s)]"
+ "(-T --dynamic-syms)"{-T,--dynamic-syms}"[Display the contents of the dynamic symbol table]"
+ "(-R --dynamic-reloc)"{-R,--dynamic-reloc}"[Display the dynamic relocation entries in the file]"
+ #@<file> Read options from <file>
+
+ "(- *)"{-v,--version}"[Display this program's version number]"
+ "(- *)"{-i,--info}"[List object formats and architectures supported]"
+ "(- *)"{-H,--help}"[Display this information]"
+
+ "(-b --target)"{-b+,--target=}"[Specify the target object format]:bfdname:->bfdname"
+ "(-m --architecture)"{-m+,--architecture=}"[Specify the target architecture]:machine:->machine"
+ "*"{-M+,--disassembler-options=}"[Pass text OPT on to the disassembler]:opt:->disassembler_options"
+
+ "(-E --endian)-E+[Assume endianess when disassembling]:endianess:((B\:\"Assume big endian format when disassembling\" L\:\"Assume little endian format when disassembling\"))"
+ "(-E --endian)--endian=[Assume endianess when disassembling]:endianess:((big\:\"Assume big endian format when disassembling\" little\:\"Assume little endian format when disassembling\"))"
+
+ "--file-start-context[Include context from start of file (with -S)]"
+ "*"{-I+,--include=}"[Add directory to search list for source files]:directory:_files -/"
+ "(-l --line-numbers)"{-l,--line-numbers}"[Include line numbers and filenames in output]"
+ "(-F --file-offsets)"{-F,--file-offsets}"[Include file offsets when displaying information]"
+ "(-C --demangle)-C[Decode mangled/processed symbol names]"
+ "(-C --demangle)--demangle=-[Decode mangled/processed symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat)"
+ "(-w --wide)"{-w,--wide}"[Format output for more than 80 columns]"
+ "(-z --disassemble-zeroes)"{-z,--disassemble-zeroes}"[Do not skip blocks of zeroes when disassembling]"
+
+ "--start-address=[Only process data whose address is >= ADDR]:addr"
+ "--stop-address=[Only process data whose address is <= ADDR]:addr"
+ "--prefix-addresses[Print complete address alongside disassembly]"
+ "(--show-raw-insn --no-show-raw-insn)"--{,no-}show-raw-insn"[Display hex alongside symbolic disassembly]"
+ "--insn-width=[Display WIDTH bytes on a single line for -d]:width"
+ "--adjust-vma=[Add offset to all displayed section addresses]:offset"
+ "--special-syms[Include special symbols in symbol dumps]"
+ "--prefix=[Add prefix to absolute paths for -S]:prefix"
+ "--prefix-strip=[Strip initial directory names for -S]:level"
+ "--dwarf-depth=[Do not display DIEs at depth N or greater]:n"
+ "--dwarf-start=[Display DIEs starting with N, at the same depth or deeper]:n"
+ "--dwarf-check[Make additional dwarf internal consistency checks]"
+ )
+ ;;
+ elfutils)
+ args+=(
+ "--color=-[Colorize the output]::when:(always auto never)"
+ "(- *)"{-\?,--help}"[Display help]"
+ "(- *)--usage[Display usage]"
+ "(- *)"{-V,--version}"[Display program version]"
+
+ )
+ ;;
+ llvm)
+ opts=( -S ) # no option stacking
+ args=( # start over from an empty array
+ '-aarch64-neon-syntax=[chose style of NEON code (AArch64)]:style:(generic apple)'
+ '-arch=[w -macho: select arch from a fat binary]:arch:(i386 x86_64)'
+ '-arch-name=[specify target arch to disassemble for]:arch:->llvm_targets'
+ '-archive-headers[w -macho: print archive headers]'
+ '-archive-member-offsets[w -macho -archive-headers: print offset to each archive member]'
+ '-bind[display Mach-O binding info]'
+ '-color[use colored syntax highlighting]'
+ '-data-in-code[w -macho: print data in code table]'
+ "-dis-symname=[w -macho: disassemble just the specfied symbol's instructions]"
+ '(-disassemble -d)'{-disassemble,-d}'[display assembler mnemonics for machine instructions]'
+ '(-disassemble-all -D)'{-disassemble-all,-D}'[disassemble all instruction sections]'
+ '-dsym=[w -macho -g: use the specified .dSYM file for debug info]:dsym file:_files'
+ '-dwarf=[dump of dwarf debug section]:section:(frames)'
+ "-dyld-id[w -macho: print the shared library's id for dylib Mach-O file]"
+ '-dylibs-used[w -macho: print the shared libraries used for linked Mach-O files]'
+ '-exports-trie[display Mach-O exported symbols]'
+ '-fault-map-section[display contents of faultmap section]'
+ '-filter-print-funcs=[only print IR for the specified functions]:function names'
+ '-full-leading-addr[w -macho: print full leading address]'
+ '-g[w -macho: print line information from debug info if available]'
+ '-indirect-symbols[w -macho: print indirect symbol table]'
+ '-info-plist[w -macho: print the info plist section]'
+ '-lazy-bind[display Mach-O lazy binding info]'
+ '(-line-numbers -l)'{-line-numbers,-l}'[display source line numbers with disassembly]'
+ '-link-opt-hints[w -macho: print the linker optimization hints]'
+ '(-macho -m)'{-macho,-m}'[use Mach-O specific object file parser]'
+ '*-mattr=[target specific attributes]:attributes'
+ '-mcpu=[specify target cpu type]:cpu type'
+ '-no-leading-addr[w -macho: print no leading address]'
+ '-no-leading-headers[print no leading headers]'
+ '-no-show-raw-insn[do not print instruction bytes when disassembling]'
+ '-no-symbolic-operands[w -macho: do not print operands symbolically when disassembling]'
+ '-non-verbose[w -macho: print info in non-verbose form]'
+ '-objc-meta-data[w -macho: print Objective-C runtime meta data]'
+ '-print-after-all[print IR after each pass]'
+ '-print-before-all[print IR before each pass]'
+ '-print-imm-hex[use hex format for immediate values]'
+ '-private-header[display only the first format specific file header]'
+ '(-private-headers -p)'{-private-headers,-p}'[display format specific file headers]'
+ '-r[display the relocation entries in the file]'
+ '-raw-clang-ast[dump raw binary contents of clang AST section]'
+ '-rebase[display Mach-O rebasing info]'
+ '-rng-seed=[seed for the random number generator]:seed'
+ '-s[display contents of each section]'
+ '*'{-section=,-j}'[operate on the specified section only]:section'
+ '(-section-headers -h)'{-section-headers,-h}'[display summaries of the headers for each section]'
+ '(-source -S)'{-source,-S}'[display source inlined with disassembly]'
+ '-start-address=[start disassembly at the specified address]:address'
+ '-stop-address=[stop disassembly at the specified address]:address'
+ '-t[display the symbol talbe]'
+ '-time-passes[time each pass, print elapsed time on exit]'
+ '-triple=[target triple to disassemble for]:triple'
+ '-universal-headers[w -macho: print Mach-O universal headers]'
+ '-verify-dom-info[verify dominator info (time consuming)]'
+ '-unwind-info[display unwind information]'
+ '-weak-bind[display Mach-O weak binding info]'
+ '-x86-asm-syntax=[chose style of assembler code (x86)]:style:(att intel)'
+ '(- *)-help[display available options]'
+ '(- *)-help-list[display list of available options]'
+ '(- *)-version[display version of objdump]'
+ )
+ ;;
+esac
+
+_arguments $opts -C : "$args[@]" $files && ret=0
+
+case "$state" in
+ short_dwarf_names)
+ _values -s "" "dwarf section" "l[rawline]" "L[decodedline]" "i[info]" "a[abbrev]" "p[pubnames]" "r[aranges]" "m[macro]" "f[frames]" "F[frames-interp]" "s[str]" "o[loc]" "R[Ranges]" "t[pubtypes]" "U[trace_info]" "u[trace_abbrev]" "g[gdb_index]" "T[trace_aranges]" "A[addr]" "c[cu_index]" "k[links]" "K[follow-links]" && ret=0
+ ;;
+ dwarf_names)
+ _values -s , "dwarf section" rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges addr cu_index links follow-links && ret=0
+ ;;
+ bfdname)
+ _values "object format" "${(z)${(@M)${(f)$(_call_program targets objdump --help)}##* supported targets:*}##*: }" && ret=0
+ ;;
+ machine)
+ _values "machine architecture" "${(@)${(z)${(@M)${(f)$(_call_program targets objdump --help)}##* supported architectures:*}##*: }//:/\\:}" && ret=0
+ ;;
+ disassembler_options)
+ _values -s , "disassembler options" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:# [^ ]*}# }%% *}" && ret=0
+ ;;
+ llvm_targets)
+ _values "target architecture" "${(z)${(@)${(f)$(_call_program targets
+ ${~words[1]} -version)##*Registered Targets:}/ -*}}"
+ ;;
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_od b/Completion/Unix/Command/_od
index db75b3f96..aba400660 100644
--- a/Completion/Unix/Command/_od
+++ b/Completion/Unix/Command/_od
@@ -27,7 +27,7 @@ if _pick_variant gnu=GNU unix --version; then
args+=(
'--traditional'
'--endian=[swap input bytes]:endianess:(big little)'
- {-S+,--strings=-}'[output strings of at least specfied bytes long]:length'
+ {-S+,--strings=-}'[output strings of at least specified bytes long]:length'
{-w-,--width=-}'[output specified bytes per line]:bytes'
'(- : *)--help[display help and exit]'
'(- : *)--version[output version information and exit]'
diff --git a/Completion/Unix/Command/_paste b/Completion/Unix/Command/_paste
index 6efe8eacb..d9598bfef 100644
--- a/Completion/Unix/Command/_paste
+++ b/Completion/Unix/Command/_paste
@@ -1,4 +1,4 @@
-#compdef paste
+#compdef paste gpaste
local -a args
local dopt='[specify delimiter list]:delimiter list [tab]'
diff --git a/Completion/Unix/Command/_ping b/Completion/Unix/Command/_ping
index a1a50e11f..2efe545c6 100644
--- a/Completion/Unix/Command/_ping
+++ b/Completion/Unix/Command/_ping
@@ -1,69 +1,208 @@
-#compdef ping
+#compdef ping ping6
-if _pick_variant iputils=iputils unix -V; then
-
- _arguments \
- '-a[audible]' \
- '-A[adaptive]' \
- '-b[allow pinging a broadcast address]' \
- '-B[do not allow ping to change source address]' \
- '-c:count' \
- '-d[set SO_DEBUG on the socket]' \
- '-f[flood ping]' \
- '-i:interval in seconds' \
- '-I:iface:_net_interfaces' \
- '-l:preload number' \
- '-L[suppress loopback of multicast packets]' \
- '-n[numeric output only]' \
- '-p:padding pattern' \
- '-Q:QoS TOS bits' \
- '-q[quiet]' \
- '-r[bypass normal routing tables]' \
- '-R[record route]' \
- '-s:packet size in bytes' \
- '-S:sndbuf' \
- '-t:timeout in seconds' \
- '-T:timestamp option:(tsonly tsandaddr tsprespec)' \
- '-M:Path MTU Discovery strategy:((do\:prohibit\ fragmentation want\:fragment\ locally dont\:do\ not\ set\ DF\ flag))' \
- '-U[print full user-to-user latency]' \
- '-v[verbose]' \
- '-w:deadline in seconds' \
- '-W:seconds to wait for a response' \
- ':host:_hosts'
-
-else
+local variant
+local -a args
- _arguments \
- '-A[audible for no packet]' \
- '-a[audible for each packet]' \
- '-c:count' \
- "-D[set the don't fragment bit]" \
- '-d[set SO_DEBUG on the socket]' \
- '-f[flood ping]' \
- '-G[specify maximum size for ICMP payload for sweeping pings]:size' \
- '-g[specify minimum size for ICMP payload for sweeping pings]:size [0]' \
- '-h[specify size increment for ICMP payload for sweeping pings]:size [1]' \
- '-i:wait seconds' \
- '-I[source interface for multicast packets]:iface:_net_interfaces' \
- '-L[suppress loopback of multicast packets]' \
- '-l:preload number' \
- '-M:icmp:(mask time)' \
- '-m:ttl' \
- '-n[numeric output only]' \
- '-o[exit after receiving one packet]' \
- '-P:IPsec policy' \
- '-p:padding pattern' \
- '-Q[somewhat quiet]' \
- '-q[quiet]' \
- '-R[record route]' \
- '-r[bypass normal routing tables]' \
- '-S:source address' \
- '-s:packet size in bytes' \
- '-T:ttl for multicasted packets' \
- '-t:timeout in seconds' \
- '-v[verbose]' \
- '-W:wait time (ms)' \
- '-z:type of service' \
- ':host:_hosts'
+_pick_variant -r variant iputils=iputils $OSTYPE -V
+
+case ${variant}:${${service#ping}:-4} in
+ iputils*) args=( -A "-*" ) ;|
+ *)
+ args+=(
+ '-d[set SO_DEBUG on the socket]'
+ '-n[show network addresses as numbers]'
+ '-v[verbose output]'
+ )
+ ;|
+ iputils*|aix*|*bsd*|darwin*|dragonfly*)
+ args+=(
+ '-c+[specify number of packets to send]:count'
+ '-f[flood ping]'
+ '-i+[specify delay between packets]:interval (seconds) [1]'
+ '-l+[send specified number of initial packets as fast as possible]:number of packets'
+ '-p+[specify pad bytes to fill sent packet with]:padding pattern'
+ '-q[quiet]'
+ '-s+[specify packet size]:size (bytes) [56]'
+ )
+ ;|
+ iputils:*|solaris:*|(*bsd|darwin|dragonfly)*:4)
+ args+=(
+ '-L[disable loopback of multicast packets]'
+ '-R[record route]'
+ )
+ ;|
+ iputils:*|solaris:*|((free|net)bsd|darwin|dragonfly)*:4)
+ args+=( '-r[bypass normal routing tables]' )
+ ;|
+ iputils:*|((free|net)bsd|darwin|dragonfly)*:4)
+ args+=( '-a[audible bell for each packet]' )
+ ;|
+ iputils:*|(net|open)bsd*:4)
+ args+=( '-w+[specify timeout after which ping exits]:deadline (seconds)' )
+ ;|
+ iputils:*|openbsd*:4|solaris*)
+ args+=(
+ '-t+[set IP Time to Live for outgoing packets]:ttl'
+ )
+ ;|
+ (*bsd|darwin|dragonfly)*)
+ args+=( '-I+[specify source interface for multicast packets]:interface:_net_interfaces' )
+ ;|
+ freebsd*|darwin*|dragonfly*|netbsd*:6)
+ args+=( '-S+[specify source address]:source address' )
+ ;|
+ freebsd*|darwin*|dragonfly*:4|netbsd*:4)
+ args+=( '-o[exit after receiving one packet]' )
+ ;|
+ (*bsd|darwin|dragonfly)*:4)
+ args+=( "-D[set the don't fragment bit]" )
+ ;|
+ ((free|net)bsd|darwin|dragonfly)*:4)
+ args+=(
+ '-Q[somewhat quiet]'
+ '-T+[set IP Time to Live for outgoing packets]:ttl'
+ )
+ ;|
+ freebsd*:6|darwin*:6|solaris*|netbsd*)
+ args+=(
+ '*-g+[specify gateway to use as the next hop to the destination]:gateway:_hosts'
+ )
+ ;|
+ (*bsd|darwin|dragonfly)*:6)
+ args+=( '-h+[set the IPv6 hoplimit]:hop limit' )
+ ;|
+ ((free|net)bsd|darwin|dragonfly)*:6)
+ args+=(
+ '-a+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)'
+ '-b+[set socket buffer size]:buffer size'
+ '-H[try reverse-lookups of IPv6 addresses]'
+ '-N[probe node information multicast group address]'
+ '(-s)-t[generate ICMPv6 Node Information supported query types query]'
+ '(-s)-w[generate ICMPv6 Node Information DNS Name query]' '!(-s)-W'
+ )
+ ;|
+ (*bsd|darwin)*:6)
+ args+=( '*-m[suppress fragmenting of packets into the minimum IPv6 MTU]' )
+ ;|
+ freebsd*|darwin*|dragonfly*|netbsd*:6)
+ args+=( '-P+[specify IPsec policy to be used for the probe]:policy' )
+ ;|
+ solaris2.<11->)
+ args+=(
+ '-b[bypass global IPsec policy and send and receive packets in the clear]'
+ '-N+[specify a next-hop router that the probe packet should go through]:router:_hosts'
+ )
+ ;|
+ (freebsd|darwin|dragonfly)*:4)
+ args+=(
+ '-A[audible bell for no packet]'
+ '-G+[specify maximum size for ICMP payload for sweeping pings]:size'
+ '-g+[specify minimum size for ICMP payload for sweeping pings]:size [0]'
+ '-h+[specify size increment for ICMP payload for sweeping pings]:size [1]'
+ '-M+[use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO]:ICMP:(mask time)'
+ '-m+[set IP Time to Live for outgoing packets]:ttl'
+ '-t+[specify timeout after which ping exits]:deadline (seconds)'
+ '-W+[specify time to wait for a response]:wait time (ms)'
+ '-z+[specify type of service]:type of service'
+ )
+ ;;
+ (freebsd|darwin)*:6)
+ args+=(
+ '-R[audible bell for no packet]'
+ '-r[audible bell for each packet]'
+ )
+ ;;
+ freebsd*:6)
+ args+=(
+ '-x+[specify time to wait for a response]:wait time (ms)'
+ '-X+[specify timeout after which ping exits]:deadline (seconds)'
+ )
+ ;;
+ netbsd*:4)
+ args+=(
+ '-C[send timestamps in compat format]'
+ '-E+[specify IPsec policy to be used for the probe]:policy'
+ '-h+[specify target host]:host:_hosts'
+ '-P+[use a pseudo-random sequence for the data]'
+ '-t+[specify type of service]:type of service'
+ )
+ ;;
+ (dragonfly|netbsd)*:6)
+ args+=( '-R[inject reachability confirmation hint for target host/first hop]' )
+ ;|
+ darwin*:4)
+ args+=( '-b+[bind the socket to specified interface for sending]:interface:_net_interfaces' )
+ ;|
+ darwin*:6)
+ args+=(
+ '-B+[bind the socket to specified interface for sending]:interface:_net_interfaces'
+ '-C[prohibit socket from using cellular network interface]'
+ )
+ ;|
+ darwin*)
+ args+=(
+ '-k+[specify traffic class to use for sending ICMP packets]:traffic class [CTL]:(BK_SYS BK BE RD OAM AV RV VI VO CTL)'
+ )
+ ;;
+ openbsd*:4)
+ args+=(
+ '-T+[change TOS value]:TOS value:(critical inetcontrol lowdelay netcontrol throughput reliability ef af cs)'
+ )
+ ;|
+ openbsd*)
+ args+=(
+ '-H[try reverse-lookups of addresses]'
+ '-E[audible bell for no packet]'
+ '-e[audible bell for each packet]'
+ '-V+[specify routing table to be used]:routing table'
+ )
+ ;;
+ iputils:4)
+ args+=(
+ '(-F -N)-4[use IPv4 only]'
+ '-6[use IPv6 only]'
+ )
+ ;|
+ iputils:*)
+ args+=(
+ '-A[adaptive]'
+ '-b[allow pinging a broadcast address]'
+ "-B[don't allow ping to change source address]"
+ '-D[print timestamp before each line]'
+ '(-4)-F+[allocate and set 20-bit flow label]:flow label (hex)'
+ '(-)-h[show usage information]'
+ '-I+[specify source interface]:interface:_net_interfaces'
+ '-m+[specify mark to tag outgoing packets]:mark'
+ "-M+[specify path MTU discovery strategy]:strategy:((
+ do\:prohibit\ fragmentation,\ even\ local\ one
+ want\:do\ PMTU\ discovery
+ dont\:don\'t\ set\ DF\ flag))"
+ '(-4)-N+[send ICMPv6 node information queries instead of echo request]:sub option'
+ '-O[report outstanding ICMP ECHO reply before sending next packet]'
+ '-Q+[set Quality of Service-related bits in ICMP datagrams]:QoS TOS bits'
+ '-S+[set socket sndbuf]:sndbuf'
+ '-T+[set special IP timestamp options]:timestamp option:(tsonly tsandaddr tsprespec)'
+ '-U[print full user-to-user latency]'
+ '(-)-V[display version information]'
+ '-W+[specify time to wait for a response]:wait time (seconds)'
+ )
+ ;;
+ solaris*)
+ args+=(
+ '-A+[specify address family]:address family:(inet inet6)'
+ '-F+[specify the flow label of probe packets]:number'
+ '-I+[specify delay between packets]:interval (seconds) [1]'
+ '-P+[specify type of service]:type of service (0-255) [0]'
+ '-U[send UDP packets instead of ICMP]'
+ '-a[ping all addresses, both IPv4 and IPv6 of multihomed destination]'
+ '-c+[specify the traffic class of probe packets]:traffic class (0-255)'
+ '-i+[specify source interface]:interface:_net_interfaces'
+ '-l[send the probe using loose source routing]'
+ '-p+[set base UDP port]:port [33434]'
+ '-s[send one datagram per second and collect statistics]'
+ )
+ ;;
+esac
-fi
+_arguments -s -S $args \
+ '*:host:_hosts'
diff --git a/Completion/Unix/Command/_printenv b/Completion/Unix/Command/_printenv
index ad5b49815..8bff27c90 100644
--- a/Completion/Unix/Command/_printenv
+++ b/Completion/Unix/Command/_printenv
@@ -1,4 +1,4 @@
-#compdef printenv
+#compdef printenv gprintenv
local expl
diff --git a/Completion/Unix/Command/_prove b/Completion/Unix/Command/_prove
index 17b48a54d..27a73fba2 100644
--- a/Completion/Unix/Command/_prove
+++ b/Completion/Unix/Command/_prove
@@ -46,6 +46,7 @@ _arguments \
{-a,--archive}'[store output in archive file]:file:_files' \
{-j,--jobs}'[run N jobs in parallel]:jobs:' \
'*--state=[control persistent state]: :_values -s , state last failed passed all hot todo slow fast new old fresh save' \
+ '--statefile=[specify file to use instead of .prove]:state file:_files' \
'--rc=[custom rcfile]:file:_files' \
'*--rules=[limit tests run (or not) in parallel]:rules' \
'*:file or directory:_files'
diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps
index 6f67f7933..a8208a365 100644
--- a/Completion/Unix/Command/_ps
+++ b/Completion/Unix/Command/_ps
@@ -11,7 +11,7 @@ _ps_props() {
case $OSTYPE in
linux-gnu) opts=( ${${(f)"$(_call_program properties $words[1] L)"}%% *} ) ;;
- freebsd*) opts=( $(_call_program properties $words[1] L) ) ;;
+ *bsd*|dragonfly*|darwin*) opts=( $(_call_program properties $words[1] L) ) ;;
solaris*) opts=( ${=${(f)"$(_call_program properties $words[1] - 2>&1)"}[-3,-1]} ) ;;
esac
@@ -19,8 +19,8 @@ _ps_props() {
}
local curcontext="$curcontext" state line expl ret=1
-local short long
-local -a args bsd bsdarg pids
+local short long pids
+local -a args bsd bsdarg
local -A equivs
args=(
@@ -46,26 +46,20 @@ args=(
bsd=(
'a[include processes belonging to other users]'
- 'e[show environment after command]'
'(j s u v X)l[output in long format]'
'(l s u v X)j[output in job control format]'
'x[include processes with no controlling terminal]'
- '(j l s v X)u[output in resource usage format]'
'(j l s u X)v[output in virtual memory format]'
'*w[wide output]'
- 'H[show threads as if they were processes]'
'L[display all format specifiers]'
'S[include child process data with the parent]'
'T[select processes attached to current terminal]'
- 'Z[show security data]'
)
bsdarg=(
'*p[select processes by ID]'
'*t[select processes by attached terminal]'
- '*U[select processes by effective user]'
'O[specify additional output fields]'
'o[specify output format]'
- 'N[set namelist file for WCHAN display]'
)
case $OSTYPE in
@@ -82,26 +76,73 @@ case $OSTYPE in
'-Z[show zone with which process is associated]'
)
;;
+ linux-gnu|dragonfly*|freebsd*|netbsd*|openbsd*)
+ bsd+=(
+ 'e[show environment after command]'
+ '(j l s v X)u[output in resource usage format]'
+ )
+ bsdarg+=(
+ 'N[set namelist file for WCHAN display]'
+ '*U[select processes by effective user]'
+ )
+ ;|
+ linux-gnu|dragonfly*|freebsd*|openbsd*)
+ bsd+=( 'H[show threads as if they were processes]' )
+ ;|
darwin*|dragonfly*|freebsd*|netbsd*|openbsd*)
bsd+=(
'A[select every process]'
- 'C[ignore resident time for CPU percentage]'
'c[show just executable name for command]'
'h[repeat header lines, one per page of output]'
'(r)m[sort by memory usage]'
'(m)r[sort by CPU usage]'
)
- bsdarg+=(
- 'M[extract values from specified core]'
- )
+ ;|
+ darwin*|dragonfly*|freebsd*|netbsd*)
+ bsd+=( 'C[ignore resident time for CPU percentage]' )
+ ;|
+ dragonfly*|freebsd*|netbsd*|openbsd*)
+ bsdarg+=( 'M[extract values from specified core]' )
;|
linux-gnu|netbsd*) bsdarg+=( 'k[specify sort order]' ) ;|
- darwin*|freebsd*) bsdarg+=( 'G[select processes by real group]' ) ;|
+ darwin*|freebsd*)
+ bsd+=( 'X[skip processes with no controlling terminal]' )
+ bsdarg+=( '*G[select processes by real group]' )
+ ;|
+ freebsd*|dragonfly*)
+ bsd+=( 'f[show command and environment for swapped out processes]' ) ;|
+ netbsd*|openbsd*)
+ bsdarg+=( 'W[extract swap information from specified file]' )
+ ;|
+ darwin*)
+ bsd+=(
+ 'd[select all processes except session leaders]'
+ 'E[show environment after command]'
+ 'f[full listing]'
+ 'M[show threads corresponding to each process]'
+ )
+ bsdarg+=(
+ '*g[select processes by process group leader]'
+ '*U[select processes by real user]'
+ )
+ if [[ $words[CURRENT] = -* ]]; then
+ bsd+=( 'e[select every process]' )
+ bsdarg+=( 'u[select processes by user id]' )
+ else
+ bsd+=(
+ 'e[show environment after command]'
+ '(j l v)u[output in resource usage format]'
+ )
+ fi
+ ;;
+ dragonfly*)
+ bsd+=( 'R[subsort by parent/child chain]' )
+ ;;
freebsd*)
bsd+=(
'd[show process hierarchy]'
- 'f[show command and environment for swapped out processes]'
'*J[select processes by jail ID]'
+ 'Z[show mac label]'
)
;;
netbsd*) bsd+=( '(j l u v)s[output in thread format]' ) ;;
@@ -109,7 +150,6 @@ case $OSTYPE in
bsd+=(
'k[display information about kernel threads]'
)
- bsdarg+=( 'W[extract swap information from the specified file]' )
;;
linux-gnu)
args+=(
@@ -127,7 +167,8 @@ case $OSTYPE in
'--cumulative[include child process data with the parent]'
'-n[set namelist file for WCHAN display]:file:_files'
'(--no-headers --no-heading)'{--no-headers,--no-heading}'[suppress headers]'
- '--sort=[specify sort order]:order:_ps_props -s'
+ '(-q --quick-pid -a -A -d -e -N --deselect -C -p --pid --ppid -G --Group -g --group -s --sid -t --tty -u --user -U --User --forest -H --sort)'{-q+,--quick-pid=}'[select processes by ID (quick mode)]:process ID:_sequence -s , _pids'
+ '--sort=[specify sort order]:order:_sequence -s , _ps_props -s'
'-w[wide output]'
'-m[show threads after processes]'
'-T[show threads, with SPID column]'
@@ -150,23 +191,33 @@ case $OSTYPE in
'(j l u v X)s[output in signal format]'
'V[display version information]'
'(j l s u v)X[output in register format]'
+ 'Z[show security data]'
)
+ bsdarg+=( 'q[select processes by ID (quick mode)]' )
;;
esac
-if (( CURRENT > 1 )) && [[ $OSTYPE != solaris* || ( $OSTYPE = linux-gnu && $words[CURRENT-1] != -* ) ]]; then
+if (( CURRENT > 1 )) && [[ $OSTYPE != (solaris*|linux-gnu) ||
+ ( $OSTYPE = linux-gnu && $words[CURRENT-1] != -* ) ]]; then
case $words[CURRENT-1] in
*k)
- _wanted -C option-k-1 properties expl 'property' _sequence -s , _ps_props -s - && return
- ;;
+ local sopt
+ [[ $OSTYPE = linux-gnu ]] && sopt='-s'
+ _wanted -C option-k-1 properties expl 'property' \
+ _sequence -s , _ps_props $sopt - && return ;;
+ *g) [[ $OSTYPE = darwin* ]] && _wanted -C option-g-1 processes \
+ expl 'process ID' _sequence -s , _pids && return ;;
*G) _sequence -s , _groups && return ;;
*J) _sequence _jails -0 && return ;;
*[MNW]) _files && return ;;
*t)
_wanted -C option-t-1 ttys expl tty _sequence -s , _ttys -D && return
;;
- *p) _wanted -C option-p-1 processes expl 'process ID' _sequence -s , _pids && return;;
+ *[pq]) _wanted -C "option-${words[CURRENT-1][-1]}-1" processes \
+ expl 'process ID' _sequence -s , _pids && return ;;
*U) _wanted -C option-U-1 users expl user _sequence -s , _users && return ;;
+ *u) [[ $OSTYPE = darwin* && $words[CURRENT-1] = -* ]] && \
+ _wanted -C option-u-1 users expl user _sequence -s , _users && return ;;
*[oO]) _wanted -C "option-${words[CURRENT-1][-1]}-1" properties \
expl 'property' _sequence -s , _ps_props - && return ;;
esac
@@ -175,13 +226,14 @@ fi
if [[ $OSTYPE = (*bsd*|darwin*|dragonfly*) ]]; then
compset -P - && pids=1
else
- _arguments -C -s $args '*:: :->rest' && ret=0
- [[ -z "$state" || $OSTYPE = solaris* ]] && return ret
+ [[ $OSTYPE = solaris* ]] || args+=( '*:: :->rest' )
+ _arguments -C -s $args && ret=0
+ [[ -z "$state" ]] && return ret
fi
_values -s '' -S ' ' 'options' $bsd && ret=0
_values -S ' ' 'options' $bsdarg && ret=0
if [[ -z $pids ]]; then
- _pids && compstate[insert]=
+ _pids && ret=0
fi
return ret
diff --git a/Completion/Unix/Command/_pwgen b/Completion/Unix/Command/_pwgen
new file mode 100644
index 000000000..f8ab1cb92
--- /dev/null
+++ b/Completion/Unix/Command/_pwgen
@@ -0,0 +1,19 @@
+#compdef pwgen
+
+_arguments -s -S \
+ '(-h --help -c --capitalize -A --no-capitalize)'{-c,--capitalize}'[include at least one capital letter in the password]' \
+ '(-h --help -c --capitalize -A --no-capitalize)'{-A,--no-capitalize}"[don't include capital letters in the password]" \
+ '(-h --help -n --numerals -0 --no-numerals)'{-n,--numerals}'[include at least one number in the password]' \
+ '(-h --help -n --numerals -0 --no-numerals)'{-0,--no-numerals}"[don't include numbers in the password]" \
+ '(-h --help -y --symbols)'{-y,--symbols}'[include at least one special symbol in the password]' \
+ '(-h --help -r --remove-chars)'{-r+,--remove-chars=}'[remove characters from the set of characters to generate passwords]:characters' \
+ '(-h --help -s --secure)'{-s,--secure}'[generate completely random passwords]' \
+ '(-h --help -B --ambiguous)'{-B,--ambiguous}"[don't include ambiguous characters in the password]" \
+ '(- 1 2)'{-h,--help}'[print a help message]' \
+ '(-h --help -H --sha1)'{-H+,--sha1=}'[use sha1 hash of given file as a (not so) random generator]:file:_files -S \# -qr "/ \t\n\-"' \
+ '(-h --help -1)-C[print the generated passwords in columns]' \
+ "(-h --help -C)-1[don't print the generated passwords in columns]" \
+ '(-h --help -v --no-vowels)'{-v,--no-vowels}"[don't use any vowels so as to avoid accidental nasty words]" \
+ '(-N --num-passwords 2)'{-N,--num-passwords}'[specify number of passwords to generate]' \
+ '!-a' '!--alt-phonics' \
+ '1: :_guard "^-*" "length"' '(-N --num-passwords)2: :_guard "^-*" "number of passwords"'
diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf
index 46da00cc4..282431462 100644
--- a/Completion/Unix/Command/_readelf
+++ b/Completion/Unix/Command/_readelf
@@ -19,8 +19,8 @@ args=(
'(-c --archive-index)'{-c,--archive-index}'[show symbol/file index in an archive]'
\*{-x,--hex-dump=}"[dump contents of specified section as bytes]:section:($sections)"
\*{-p,--string-dump=}"[dump contents of specified section as strings]:section:($sections)"
- '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o R t)'
- '--debug-dump=[show the contents of DWARF2 debug sections]::section:(rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges)'
+ '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o R t U u T g A c k K)'
+ '--debug-dump=[show the contents of DWARF2 debug sections]::section:(rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges addr cu_index links follow-links)'
'(-I --histogram)'{-I,--histogram}'[show histogram of bucket list lengths]'
'(-W --wide)'{-W,--wide}'[allow output width to exceed 80 characters]'
'(- *)'{-H,--help}'[display help information]'
diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm
index 6d728b157..912b5eadf 100644
--- a/Completion/Unix/Command/_rm
+++ b/Completion/Unix/Command/_rm
@@ -24,16 +24,20 @@ if _pick_variant gnu=gnu unix --help; then
else
args=(${args:#*)--*\[*})
case $OSTYPE in
- dragonfly*|freebsd*|netbsd*|openbsd*)
+ darwin*|dragonfly*|freebsd*|netbsd*|openbsd*)
args+=(
'-d[remove directories as well]'
'-P[overwrite files before deleting them]'
+ '-v[explain what is being done]'
)
;|
- dragonfly*|freebsd*|netbsd*)
+ darwin*|dragonfly*|freebsd*|netbsd*)
args+=(
- '-v[explain what is being done]'
'-W[attempt to undelete named files]'
+ )
+ ;|
+ dragonfly*|freebsd*|netbsd*)
+ args+=(
"-x[don't cross file systems when removing a hierarchy]"
)
;|
diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync
index f79ec1dfe..c1404c908 100644
--- a/Completion/Unix/Command/_rsync
+++ b/Completion/Unix/Command/_rsync
@@ -149,6 +149,7 @@ _rsync() {
'(--devices --specials)-D[same as --devices --specials]' \
'(-D)--devices[preserve devices]' \
'--no-devices[turn off --devices]' \
+ '--copy-devices[copy device contents as regular file]' \
'(-D)--specials[preserve special files]' \
'--no-specials[turn off --specials]' \
'--no-D[turn off --devices and --specials]' \
@@ -161,7 +162,8 @@ _rsync() {
'(-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]' \
+ '--checksum-choice=[choose the checksum algorithms]:algorithm:_sequence -n 2 compadd - auto md4 md5 none' \
+ '(-x --one-file-system)'{-x,--one-file-system}"[don't 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' \
@@ -190,9 +192,9 @@ _rsync() {
'--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]' \
+ '(-I --ignore-times)'{-I,--ignore-times}"[don't 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' \
+ '(-@ --modify-window)'{-@+,--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' \
@@ -240,6 +242,7 @@ _rsync() {
'--preallocate[preallocate the full length of new files]' \
'--iconv=[request charset conversion of filenames]:number' \
'--checksum-seed=:number' \
+ "--noatime[don't alter atime when opening source files]" \
'--read-batch=[read a batched update from the specified file]:file:_files'
}
diff --git a/Completion/Unix/Command/_ruby b/Completion/Unix/Command/_ruby
index bb0558fde..d69c378fc 100644
--- a/Completion/Unix/Command/_ruby
+++ b/Completion/Unix/Command/_ruby
@@ -1,8 +1,8 @@
-#compdef ruby irb erb -P (ruby|[ei]rb)[0-9.]# -value-,RUBY(LIB|OPT|PATH),-default-
+#compdef ruby irb erb ruby-mri -P (ruby|[ei]rb)[0-9.]# -value-,RUBY(LIB|OPT|PATH),-default-
local curcontext="$curcontext" state line expl desc RUBY ret=1
typeset -A opt_args
-local -a opts irb all common charsets suf
+local -a opts irb erb all common charsets suf
all=(
'*-r+[require the library before executing your script]:library name:->library'
@@ -41,6 +41,7 @@ opts=(
'(1 * -)--copyright[print the copyright]'
--{en,dis}'able=[enable or disable features]:feature:(gems did_you_mean rubyopt frozen_string_literal all)'
\!--{en,dis}able-{gems,rubyopt,all}
+ '--dump=[dump debug information]:information:_sequence compadd - insns yydebug parsetree parsetree_with_comment'
--{external,internal}'-encoding=:charset:->charsets'
'!'{-y,--yydebug}
'!--dump=:target:(version copyright usage yydebug syntax parsetree parsetree_with_comment insns)'
diff --git a/Completion/Unix/Command/_screen b/Completion/Unix/Command/_screen
index ebc8ba155..6d47d2638 100644
--- a/Completion/Unix/Command/_screen
+++ b/Completion/Unix/Command/_screen
@@ -56,6 +56,8 @@ scr_cmds=(
)
_arguments -C \
+ '(-6)-4[resolve hostnames only to IPv4 addresses]' \
+ '(-4)-4[resolve hostnames only to IPv6 addresses]' \
"-a[force all capabilities into each window's termcap]" \
'-A[adapt all windows to the new display width & height]' \
"-c[read configuration file instead of '.screenrc']:config file:_files" \
@@ -66,14 +68,16 @@ _arguments -C \
'-f-[set flow control]:flow control:((n\:flow\ control\ off a\:flow\ control\ auto \:flow\ control\ on))' \
'-h[set the size of the scrollback history buffer]:buffer size' \
'-i[interrupt output sooner when flow control is on]' \
- '(-l)-ln[login mode off (do not update utmp database)]' \
+ "(-l)-ln[login mode off (don't update utmp database)]" \
'(-ln)-l[login mode on (update utmp database)]' \
- '(-)'{-ls,-list}'[list sessions/socket directory]' \
+ '(- *)'{-ls,-list}'[list sessions/socket directory]: :->any-sessions' \
"-L[terminal's last character can be safely updated]" \
+ '-Logfile[set logfile name]:log file:_files' \
'-m[ignore $STY variable, do create a new screen session]' \
'-O[choose optimal output rather than exact vt100 emulation]' \
'-p[preselect the named window]:window number or name:((\=\:windowlist -\:blank\ window \:window\ number))' \
'-q[quiet startup, exit with non-zero return code if unsuccessful]' \
+ '-Q[send response to stdout of command query process]:screen command:(echo info lastmsg number select time title windows)' \
'-r[reattach to a detached screen process]: :->detached-sessions' \
'-Dr: :->any-sessions' \
'-dr: :->any-sessions' \
@@ -85,12 +89,12 @@ _arguments -C \
"-t[set title (window's name)]:title" \
'-T[use term as $TERM for windows, rather than "screen"]:terminal type:_terminals' \
'-U[tell screen to use UTF-8 encoding]' \
- '(-)-v[print screen version]' \
- '(-)-wipe[do nothing, clean up SockDir]' \
+ '(- *)-v[print screen version]' \
+ '(- *)-wipe[do nothing, clean up SockDir]: :->any-sessions' \
'-x[attach to a not detached screen (multi display mode)]: :->attached-sessions' \
'-Dx: :->any-sessions' \
'-dx: :->any-sessions' \
- '-X[execute command as a screen command in the specified session]:screencmd:(${scr_cmds[@]})' \
+ '-X[execute command as a screen command in the specified session]:screen command:(${scr_cmds[@]})' \
'*:: :->normal' && ret=0
if [[ -n $state ]]; then
diff --git a/Completion/Unix/Command/_seq b/Completion/Unix/Command/_seq
new file mode 100644
index 000000000..5b825675f
--- /dev/null
+++ b/Completion/Unix/Command/_seq
@@ -0,0 +1,28 @@
+#compdef seq gseq
+
+local variant args
+
+_pick_variant -r variant gnu=GNU $OSTYPE --version
+
+args=( ':: :_guard "^-[^0-9]*" '{first,step,last} )
+case $variant in
+ gnu)
+ args+=(
+ '(--help --version)'{-f+,--format=}'[use printf style floating-point format]:format'
+ '(--help --version -s --separator)'{-s+,--separator=}'[use specified separator for numbers]:separator [\n]'
+ '(--help --version -w --equal-width)'{-w,--equal-width}'[equalize width by padding with leading zeroes]'
+ '(- 1 2 3)--help[display usage information]'
+ '(- 1 2 3)--version[display version information]'
+ )
+ ;;
+ *)
+ args+=(
+ '-f+[use printf style floating-point format]:format'
+ '-s+[use specified separator for numbers]:separator [\n]'
+ '-t+[use specified string to terminate numbers]:string [\n]'
+ '-w[equalize width by padding with leading zeroes]'
+ )
+ ;;
+esac
+
+_arguments -s -A '-[^1-9]*' $args
diff --git a/Completion/Unix/Command/_setfacl b/Completion/Unix/Command/_setfacl
index af6c4d4e5..5c573a581 100644
--- a/Completion/Unix/Command/_setfacl
+++ b/Completion/Unix/Command/_setfacl
@@ -29,7 +29,7 @@ _arguments -s -S \
'(-P --physical)'{-P,--physical}'[physical walk, do not follow symbolic links]' \
'--restore=[restore ACLs]:file:_files' \
'--test[test mode (ACLs are not modified)]' \
- '--version[print version and exit]' \
- '--help[this help text]' \
+ '(- *)'{-v,--version}'[display version information]' \
+ '(- *)'{-h,--help}'[display help information]' \
'*: :_files'
fi
diff --git a/Completion/Unix/Command/_shutdown b/Completion/Unix/Command/_shutdown
new file mode 100644
index 000000000..1ac6e61ba
--- /dev/null
+++ b/Completion/Unix/Command/_shutdown
@@ -0,0 +1,61 @@
+#compdef shutdown
+
+local -a args
+
+if [[ -d /etc/systemd ]]; then
+ _arguments \
+ '--help[display usage information]' \
+ '(-H --halt)'{-H,--halt}'[halt the machine]' \
+ '(-P --poweroff -h)'{-P,--poweroff,-h}'[power-off the machine (default)]' \
+ '(-r --reboot)'{-r,--reboot}'[reboot the machine]' \
+ "(--no-wall)-k[don't shutdown, just write wall message]" \
+ "(-k)--no-wall[don't send a wall message]" \
+ '-c[cancel pending shutdown]' \
+ '1: :_guard "^-*" "time (now/hh\:mm/+mins)"' \
+ '*:warning message'
+ return
+fi
+
+case $OSTYPE in
+ *bsd*|dragonfly*|linux*)
+ args=(
+ '-h[halt the system after shutdown]'
+ '-p[turn off power after shutdown]'
+ '-r[reboot the system]'
+ '-k[kick everybody off]'
+ '-n[prevent file system cache from being flushed]'
+ '1: :_guard "^-*" "time (now/hh\:mm/+mins)"'
+ '*:warning message'
+ )
+ ;|
+ (net|open)bsd*)
+ args+=(
+ '-d[cause system to perform a dump]'
+ '-f[create /fastboot so that file systems will not be checked during the next boot]'
+ )
+ ;|
+ freebsd*|dragonfly*)
+ args+=(
+ '-o[execute halt or reboot instead of sending a signal to init]'
+ )
+ ;;
+ netbsd*)
+ args+=(
+ '-b[specify boot string to pass to reboot]:boot string'
+ '-v[enable verbose console messages]'
+ '-x[enable debug console messages]'
+ '-z[silence some console messages]'
+ '-D[prevent shutdown from detaching from the tty]'
+ )
+ ;;
+ solaris2.<11->) args=( '(-i)-r[reboot]' ) ;&
+ solaris*)
+ args+=(
+ '(-r)-i+[specify init-state]:init state:((0\:stop 1\:administrative s\:single\ user 5 6\:reboot))'
+ '-y[pre-answer yes to confirmation question]'
+ '-g+[specify grace period]:grace period (seconds) [60]'
+ )
+ ;;
+esac
+
+_arguments $args
diff --git a/Completion/Unix/Command/_smartmontools b/Completion/Unix/Command/_smartmontools
new file mode 100644
index 000000000..c60322ee0
--- /dev/null
+++ b/Completion/Unix/Command/_smartmontools
@@ -0,0 +1,61 @@
+#compdef smartctl
+
+local context state state_descr line
+
+_arguments -s -S \
+ '(H -i --info)'{-i,--info}'[show identity information for device]' \
+ '(H)--identify=-[show words and bits from indentification data]: : _values -S "" "words and bits"
+ "(n v)b[print all bits]"
+ "w[print all words]"
+ "(b v)n[suppress printing bits]"
+ "(b n)v[print all bits from valid words]"' \
+ '(H)*'{-g+,--get=}'[get device setting]:setting:(all aam apm lookahead security wcache rcache wcreorder)' \
+ '(H -a --all -x --xall -H --health -i --info -c --capabilities -A --attributes --scan --scan-open)'{-a,--all}'[show all SMART information for device]' \
+ '(H -x --xall -a --all -H --health -i --info -c --capabilities -A --attributes --scan --scan-open)'{-x,--xall}'[show all information for device]' \
+ '(H 1 --scan-open --identify -x --xall -a --all -H --health -i --info -c --capabilities -A --attributes)--scan[scan for devices]' \
+ '(H 1 --scan --identify -x --xall -a --all -H --health -i --info -c --capabilities -A --attributes)--scan-open[scan for devices and try to open each device]' \
+ '(H -q --quietmode)'{-q+,--quietmode=}'[set smartctl quiet mode]:quiet mode:(errorsonly silent noserial)' \
+ '(H -d --device)'{-d+,--device=}'[specify device type]:device type:(ata scsi nvme sat usbcypress usbjmicron usbprolific usbsunplus marvell areca 3ware hpt megaraid cciss auto test)' \
+ '(H)*'{-T+,--tolerance=}'[specify how tolerant smartctl should be of ATA SMART command failures]:tolerance:(normal conservative permissive verypermissive)' \
+ '(H -b --badsum)'{-b+,--badsum=}'[set action if checksum error is detected]:action:(warn exit ignore)' \
+ '(H)*'{-r+,--report=}'[report transactions]:transaction type:(ioctl ataioctl scsiioctl nvmeioctl)' \
+ '(H -n --nocheck)'{-n+,--nocheck=}'[exit if the device is in a low-power mode]:power mode causing exit:(never sleep standby idle)' \
+ '(H -s --smart)--smart=[enable/disable SMART on device]:enable:(on off)' \
+ '(H -o --offlineauto)'{-o+,--offlineauto=}'[enable/disable automatic offline test on device]:enable:(on off)' \
+ '(H -S --saveauto)'{-S+,--saveauto=}'[enable/disable attribute autosave on device]:enable:(on off)' \
+ '(H -s --set)'{-s+,--set=}'[enable/disable/change device setting]:setting:->settings' \
+ '(H -H --health)'{-H,--health}'[show device SMART health status]' \
+ '(H -c --capabilities)'{-c,--capabilities}'[show device SMART capabilities]' \
+ '(H -A --attributes)'{-A,--attributes}'[show device SMART vendor-specific attributes and values]' \
+ '(H)*'{-f+,--format=}'[set output format for attributes]:format:(old brief hex,id hex,val hex)' \
+ '(H)*'{-l+,--log=}'[show device log]:log:(error selftest selective directory xerror xselftest background sasphy sataphy scttemp scttempsts scttemphist scttempint scterc devstat ssd gplog smartlog nvmelog)' \
+ '(H)*'{-v+,--vendorattribute=}'[set display option for vendor attribute]:vendor attribute:->vendorattrs' \
+ '(H -F --firmwarebug)'{-F+,--firmwarebug=}'[use firmware bug workaround]:bug:(none nologdir samsung samsung2 samsung3 xerrorlba swapid)' \
+ '(H -P --presets)'{-P+,--presets=}'[specify whether to use drive-specific presets]:preset usage:(use ignore show showall)' \
+ '(H -B --drivedb)'{-B+,--drivedb=}'[read drive database from file]:file:->plusfiles' \
+ '(H -t --test)'{-t+,--test=}'[run specified self-test]:self-test:(offline short long conveyance force vendor select pending afterselect,on afterselect,off scttempint)' \
+ '(H -C --captive)'{-C,--captive}'[run self-test in captive mode]' \
+ '(H -X --abort)'{-X,--abort}'[abort any non-captive self-test]' \
+ '(H --scan --scan-open)1:disk device:_files -g "*(-%)" -P / -W /' \
+ + 'H' \
+ '(- 1)'{-h,--help,--usage}'[display help information]' \
+ '(- 1)'{-V,--version,--copyright,--license}'[display version, licence and build information]' && return
+
+case $state in
+ vendorattrs)
+ _wanted -C $context vendor-attributes expl 'vendor attribute' compadd - \
+ ${${${(f)"$(_call_program vendor-attributes $words[1] -v help)"}[(r)*help*,-1]#$'\t'}%%\[*}
+ ;;
+ plusfiles)
+ compset -P \+ || state_descr[1]+=" (prefix with + to prepend entries)"
+ _wanted -C $context files expl $state_descr _files
+ ;;
+ settings)
+ local values
+ [[ $context = option-s-1 ]] &&
+ values+=( {on\[en,off\[dis}'able SMART on device]' )
+
+ _values -S , setting $values {aam,apm,standby}':value' \
+ {lookahead,{w,r}cache,wcreorder}':enable:(on off)' security security-freeze
+ ;;
+esac
diff --git a/Completion/Unix/Command/_sort b/Completion/Unix/Command/_sort
index 91e9132ad..c81e6f856 100644
--- a/Completion/Unix/Command/_sort
+++ b/Completion/Unix/Command/_sort
@@ -44,7 +44,7 @@ case $variant in
"$ordering"{-h,--human-numeric-sort}'[compare human readable numbers (e.g., 2K 1G)]'
"$ordering"{-R,--random-sort}'[sort by random hash of keys]'
"$ordering"{-V,--version-sort}'[sort version numbers]'
- "$ordering--sort=[sort according to ordering]:ordering:(general-numeric human-numeric month numeric random version)"
+ "$ordering--sort=[specify comparator]:comparator:(general-numeric human-numeric month numeric random version)"
'(-i --ignore-nonprinting)'{-i,--ignore-nonprinting}'[consider only printable characters]'
'--random-source=[get random bytes from file]:file:_files'
'--batch-size=[maximum inputs to merge]:number'
diff --git a/Completion/Unix/Command/_split b/Completion/Unix/Command/_split
new file mode 100644
index 000000000..25b5aec2d
--- /dev/null
+++ b/Completion/Unix/Command/_split
@@ -0,0 +1,64 @@
+#compdef split gsplit
+
+local curcontext="$curcontext" variant ret=1
+local -A opt_args
+local -a state line args
+
+_pick_variant -r variant gnu=GNU $OSTYPE --version
+
+args=(
+ '-a+[generate suffixes of specified length]:length [2]' \
+ '(-l -p -n)-b+[put specified size in bytes in each output file]:size (bytes)' \
+ '(-b -p -n)-l+[put specified number of lines/records in each output file]:lines' \
+ '1:file:_files' \
+ '2: :_guard "^-*" "prefix [x]"'
+)
+
+case $variant in
+ gnu)
+ args=( -C
+ '(H -a --suffix-length)'{-a+,--suffix-length=}'[generate suffixes of specified length]:length [2]'
+ '(H)--additional-suffix=[append an additional suffix to file names]:suffix'
+ '(H -b --bytes -C --line-bytes -l --lines -n --number)'{-b+,--bytes=}'[put specified size in bytes in each output file]:size (bytes)'
+ '(H -b --bytes -C --line-bytes -l --lines -n --number)'{-C+,--line-bytes=}'[put whole lines/records up to size limit in each output file]:size (bytes)'
+ '(H --numeric-suffixes -x --hex-suffixes)-d[use numeric suffixes starting at 0]'
+ '(H -d -x --hex-suffixes)--numeric-suffixes=-[use numeric suffixes]::start value [0]'
+ '(H -d --numeric-suffixes --hex-suffixes)-x[use hex suffixes starting at 0]'
+ '(H -d --numeric-suffixes -x)--hex-suffixes=-[use hex suffixes]::start value [0]'
+ '(H -e --elide-empty-files)'{-e,--elide-empty-files}"[don't generate empty output files with '-n']"
+ '(H)--filter=[write to shell command; filename is in $FILE]:command:_cmdstring'
+ '(H -b --bytes -C --line-bytes -l --lines -n --number)'{-l+,--lines=}'[put specified number of lines/records in each output file]:lines'
+ '(H -b --bytes -C --line-bytes -l --lines -n --number)'{-n+,--number=}'[generate specified number of output files]:chunks:->chunks'
+ '(H -t --separator)'{-t+,--separator=}'[use specified record separator instead of newline]:separator'
+ '(H -u --unbuffered)'{-u,--unbuffered}"[immediately copy input to output with '-n r/...']"
+ '(H)--verbose[print a diagnostic just before each output file is opened]'
+ '(H)1:file:_files'
+ '(H)2: :_guard "^-*" "prefix [x]"'
+ + 'H'
+ '(- 1 2)--help[display usage information]'
+ '(- 1 2)--version[display version information]'
+ )
+ ;;
+ (free|net)bsd*)
+ args+=( '(-b -l -p)-n+[generate specified number of output files]:output files' )
+ ;|
+ freebsd*)
+ args+=(
+ '-d[use numeric suffixes]'
+ '(-b -l -n)-p+[split the file whenever a line matches specified pattern]:pattern'
+ )
+ ;;
+esac
+
+_arguments -s -S $args && ret=0
+
+if [[ $state = chunks ]]; then
+ if [[ ! -prefix *[0-9/]* ]]; then
+ _alternative 'modifiers: :_values -s/ "modifier" "l[don'\''t split lines/records]" "r[round robin distribution]"' \
+ 'lines: :_guard "[0-9/]#" lines' && ret=0
+ else
+ _message -e lines lines
+ fi
+fi
+
+return ret
diff --git a/Completion/Unix/Command/_sqlite b/Completion/Unix/Command/_sqlite
index df673894c..f63f4c085 100644
--- a/Completion/Unix/Command/_sqlite
+++ b/Completion/Unix/Command/_sqlite
@@ -22,7 +22,7 @@ options+=(
)
output_modes=( column HTML line list )
-(( $+sqlite3 )) && output_modes+=( csv quote )
+(( $+sqlite3 )) && output_modes+=( ascii csv quote )
exclusive=( $^dashes-${^output_modes:l} )
for display_opt in $output_modes ; do
# finagle the description to match the way SQLite's -help formats them
@@ -45,7 +45,10 @@ options+=(
$^dashes'-cmd[run specified command before reading stdin]:sqlite meta-command'
'(-*batch -*interactive)'$^dashes'-batch[force batch I/O]'
'(-*batch -*interactive)'$^dashes'-interactive[force interactive I/O]'
+ $^dashes'-lookaside[specify size and number of entries for lookaside memory]:size (bytes): :entries'
$^dashes'-mmap[set default mmap size]:size'
+ $^dashes'-newline[set output row separator]:separator [\n]'
+ $^dashes'-pagecache[specify size and number of slots for page cache memory]:size (bytes): :slots'
$^dashes'-stats[print memory stats before each finalize]'
$^dashes'-vfs[use specified default VFS]:vfs:(unix-dotfile unix-excl unix-none unix-namedsem)'
)
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 984c96e93..20a5536ee 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -4,23 +4,20 @@
_ssh () {
local curcontext="$curcontext" state line expl suf ret=1
- local args common tmp p1 file cmn cmds sdesc
+ local args common common_transfer algopt tmp p1 file cmn cmds sdesc
typeset -A opt_args
common=(
- '(-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]'
- # for protocol version 2, this can be a comma-separated list
- '-c+[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)'
+ '-c+[select encryption cipher]:encryption cipher:->ciphers'
'-F+[specify alternate config file]:config file:_files'
'*-i+[select identity file]:SSH identity file:_files -g "*(-.^AR)"'
'*-o+[specify extra options]:option string:->option'
)
common_transfer=(
- '-l[limit used bandwidth]:bandwidth in KiB/s:'
+ '-l+[limit used bandwidth]:bandwidth (Kbit/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]'
@@ -28,16 +25,17 @@ _ssh () {
'-S+[specify ssh program]:path to ssh:_command_names -e' \
'-v[verbose mode]'
)
+ algopt='-E+[specify hash algorithm for fingerprints]:algorithm:(md5 sha256)'
case "$service" in
ssh)
_arguments -C -s \
- '(-a)-A[enables forwarding of the authentication agent connection]' \
+ '(-a)-A[enable 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]:dynamic port forwarding:->dynforward' \
'-e+[set escape character]:escape character (or `none'\''):' \
- '-E[append log output to file instead of stderr]:_files' \
+ '-E+[append log output to file instead of stderr]:_files' \
'(-n)-f[go to background]' \
'-g[allow remote hosts to connect to local forwarded ports]' \
'-G[output configuration and exit]' \
@@ -45,26 +43,26 @@ _ssh () {
'-J+[connect via a jump host]: :->userhost' \
'-K[enable GSSAPI-based authentication and forwarding]' \
'-k[disable forwarding of GSSAPI credentials]' \
- '*-L[specify local port forwarding]:local port forwarding:->forward' \
+ '*-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:->macs' \
- '(-1)-N[do not execute a remote command (protocol version 2 only)]' \
+ '-m+[specify mac algorithms]: :->macs' \
+ "-N[don't execute a remote command]" \
'-n[redirect stdin from /dev/null]' \
- '-O[control an active connection multiplexing master process]:multiplex control command:((check\:"check master process is running" exit\:"request the master to exit" forward\:"request forward without command execution" stop\:"request the master to stop accepting further multiplexing requests" cancel\:"cancel existing forwardings with -L and/or -R" proxy))' \
+ '-O+[control an active connection multiplexing master process]:multiplex control command:((check\:"check master process is running" exit\:"request the master to exit" forward\:"request forward without command execution" stop\:"request the master to stop accepting further multiplexing requests" cancel\:"cancel existing forwardings with -L and/or -R" proxy))' \
'-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' \
+ '*-R+[specify remote port forwarding]:remote port forwarding:->forward' \
'-S+[specify location of control socket for connection sharing]:path to control socket:_files' \
- '-Q[query parameters]:parameter type:((cipher\:"supported symmetric ciphers" cipher-auth\:"supported symmetric ciphers that support authenticated encryption" mac\:"supported message integrity codes" kex\:"key exchange algorithms" key\:"key types" protocol-version\:"supported SSH protocol versions"))' \
- '(-1)-s[invoke subsystem]' \
- '(-1 -t)-T[disable pseudo-tty allocation (protocol version 2 only)]' \
+ '-Q+[query parameters]:parameter type:((cipher\:"supported symmetric ciphers" cipher-auth\:"supported symmetric ciphers that support authenticated encryption" mac\:"supported message integrity codes" kex\:"key exchange algorithms" key\:"key types" protocol-version\:"supported SSH protocol versions"))' \
+ '-s[invoke subsystem]' \
+ '(-t)-T[disable pseudo-tty allocation]' \
'(-T)-t[force pseudo-tty allocation]' \
'-V[show version number]' \
'(-q)*-v[verbose mode (multiple increase verbosity, up to 3)]' \
- '-W[forward standard input and output to host]:stdinout forward:->hostport' \
- '-w[request tunnel device forwarding]:local_tun[\:remote_tun] (integer or "any"):' \
+ '-W+[forward standard input and output to host]:stdinout forward:->hostport' \
+ '-w+[request tunnel device forwarding]:local_tun[\:remote_tun] (integer or "any"):' \
'(-x -Y)-X[enable (untrusted) X11 forwarding]' \
'(-X -Y)-x[disable X11 forwarding]' \
'(-x -X)-Y[enable trusted X11 forwarding]' \
@@ -79,17 +77,22 @@ _ssh () {
'*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0
;;
ssh-add)
- _arguments -s \
+ [[ $OSTYPE == darwin* ]] && args=(
+ '-A[add identities from keychain]'
+ '-K[update keychain when adding/removing identities]'
+ )
+ _arguments -s : $args \
'-c[identity is subject to confirmation via SSH_ASKPASS]' \
'-D[delete all identities]' \
'-d[remove identity]' \
- '-E[specify hash algorithm for fingerprints]:algorithm:(md5 sha256)' \
- '-e[remove keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \
+ $algopt \
+ '-e+[remove keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \
'-k[load plain private keys only and skip certificates]' \
- '-L[lists public key parameters of all identities in the agent]'\
+ '-L[list public key parameters of all identities in the agent]'\
'-l[list all identities]' \
- '-s[add keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \
- '-t[set maximum lifetime for identity]:maximum lifetime (in seconds or time format):' \
+ '-s+[add keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \
+ '-t+[set maximum lifetime for identity]:maximum lifetime (in seconds or time format):' \
+ '-q[be quiet after a successful operation]' \
'-X[unlock the agent]' \
'-x[lock the agent with a password]' \
'*:SSH identity file:_files'
@@ -97,10 +100,13 @@ _ssh () {
;;
ssh-agent)
_arguments -s \
- '(-k)-a[UNIX-domain socket to bind agent to]:UNIX-domain socket:_files' \
+ '(-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)-D[foreground mode]' \
+ "(-k)$algopt" \
'-k[kill current agent]' \
+ '(-k)-P[specify PKCS#11 shared library whitelist]:PKCS#11 library whitelist pattern' \
'(-k -c)-s[force sh-style shell]' \
'-t[set default maximum lifetime for identities]:maximum lifetime (in seconds or time format):' \
'*::command: _normal'
@@ -125,12 +131,12 @@ _ssh () {
cmn=( -b -P -N -C -m -v ) # options common to many basic commands (except -f which is common to most)
cms=( -E -q -t -g -M -S -a -J -j -K -W -I -h -n -O -V -u ) # options specific to one basic command
_arguments -s $args \
- "(${${(@)cmds:#-G}} -P -m ${${(@)cms:#-[MS]}})-b[specify number of bits in key]:bits in key" \
- "$p1(${${(@)cmds:#-[pc]}} -b -C $cms)-P[provide old passphrase]:old passphrase" \
- "(${${(@)cmds:#-p}} -m -v ${${(@)cms:#-[qt]}})-N[provide new passphrase]:new passphrase" \
- "(${${(@)cmds:#-c}} -m -v $cms)-C[provide new comment]:new comment" \
- "(-D -G -M -S -I -h -n -O -V -A)-f[$file file]:$file file:_files" \
- "$p1(${${(@)cmds:#-[ie]}})-m[specify conversion format]:format:(PEM PKCS7 RFC4716)" \
+ "(${${(@)cmds:#-G}} -P -m ${${(@)cms:#-[MS]}})-b+[specify number of bits in key]:bits in key" \
+ "$p1(${${(@)cmds:#-[pc]}} -b -C $cms)-P+[provide old passphrase]:old passphrase" \
+ "(${${(@)cmds:#-p}} -m -v ${${(@)cms:#-[qt]}})-N+[provide new passphrase]:new passphrase" \
+ "(${${(@)cmds:#-c}} -m -v $cms)-C+[provide new comment]:new comment" \
+ "(-D -G -M -S -I -h -n -O -V -A)-f+[$file file]:$file file:_files" \
+ "$p1(${${(@)cmds:#-[ie]}})-m+[specify conversion format]:format:(PEM PKCS7 RFC4716)" \
"(${${(@)cmds:#-[lGT]}} ${${(@)cmn:#-[bv]}} -f)*-v[verbose mode]" \
- '(commands)' \
"(-b -P -C -v)-p[change passphrase of private key file]" \
@@ -139,39 +145,45 @@ _ssh () {
"($cmn)-y[get public key from private key]" \
'(-b -N -m -v)-c[change comment in private and public key files]' \
"($cmn)-B[show the bubblebabble digest of key]" \
- "(-)-D[download key stored in smartcard reader]:reader" \
+ "(-)-D+[download key stored in smartcard reader]:reader" \
"($cmn)-H[hash names in known_hosts file]" \
- "($cmn)-R[remove host from known_hosts file]:host:_ssh_hosts" \
+ "($cmn)-R+[remove host from known_hosts file]:host:_ssh_hosts" \
"($cmn)-L[print the contents of a certificate]" \
"(-)-A[generate host keys for all key types]" \
"($cmn)-Q[test whether keys have been revoked in a KRL]" \
- finger \
"($cmn)-l[show fingerprint of key file]" \
- "$p1($cmn)-E[specify hash algorithm for displayed fingerprints]:hash algorithim:(md5 sha256)" \
+ "$p1($cmn)$algopt" \
- create \
'(-P -m)-q[silence ssh-keygen]' \
- "(-P -m)-t[specify the type of the key to create]:key type:(rsa dsa ecdsa ed25519)" \
+ "(-P -m)-t+[specify the type of the key to create]:key type:(rsa dsa ecdsa ed25519)" \
- dns \
"($cmn)-r[print DNS resource record]:hostname:_hosts" \
"$p1($cmn)-g[use generic DNS format]" \
- primes \
"(-P -N -C -m -f)-G[generate candidates for DH-GEX moduli]" \
- "$p1(-P -N -C -m -f)-M[specify amount of memory to use for generating DH-GEX moduli]:memory (MB)" \
- "$p1(-P -N -C -m -f)-S[specify start point]:start point (hex)" \
+ "$p1(-P -N -C -m -f)-M+[specify amount of memory to use for generating DH-GEX moduli]:memory (MB)" \
+ "$p1(-P -N -C -m -f)-S+[specify start point]:start point (hex)" \
- screen \
- "(${${(@)cmn:#-v}})-T[screen candidates for DH-GEX moduli]:output file:_files" \
- "${p1}(${${(@)cmn:#-v}})-a[specify number of rounds]:rounds" \
+ "(${${(@)cmn:#-v}})-T+[screen candidates for DH-GEX moduli]:output file:_files" \
+ "${p1}(${${(@)cmn:#-v}})-a+[specify number of rounds]:rounds" \
"${p1}(${${(@)cmn:#-v}})-J[exit after screening specified number of lines]" \
- "${p1}(${${(@)cmn:#-v}})-j[start screening at the specified line number]:line number" \
- "${p1}(${${(@)cmn:#-v}})-K[write the last line processed to file]:file:_files" \
+ "${p1}(${${(@)cmn:#-v}})-j+[start screening at the specified line number]:line number" \
+ "${p1}(${${(@)cmn:#-v}})-K+[write the last line processed to file]:file:_files" \
"${p1}(${${(@)cmn:#-v}})-W[specify desired generator]:generator" \
- certify \
"($cmn)-s[$sdesc]:CA key:_files" \
- "$p1($cmn -f -u)-I[specify key identifier to include in certificate]:key id" \
+ "$p1($cmn -f -u)-I+[specify key identifier to include in certificate]:key id" \
"$p1($cmn -f -u)-h[generate host certificate instead of a user certificate]" \
- "$p1($cmn -f -u)-n[specify user/host principal names to include in certificate]:principals" \
- "$p1($cmn -f -u)-O[specify a certificate option]:option" \
- "$p1($cmn -f -u)-V[specify certificate validity interval]:interval" \
+ "$p1($cmn -f -u -D)-U[indicate that CA key is held by ssh-agent]" \
+ "$p1($cmn -f -u -U)-D+[indicate the CA key is stored in a PKCS#11 token]:PKCS11 shared library:_files -g '*.(so|dylib)(|.<->)(-.)'" \
+ "$p1($cmn -f -u)-n+[specify user/host principal names to include in certificate]:principals" \
+ "$p1($cmn -f -u)*-O+[specify a certificate option]: : _values 'option'
+ clear critical\:name extension\:name force-command\:command\:_cmdstring
+ no-agent-forwarding no-port-forwarding no-pty no-user-rc no-x11-forwarding
+ permit-agent-forwarding permit-port-forwarding permit-pty permit-user-rc
+ permit-x11-forwarding source-address\:source\ address" \
+ "$p1($cmn -f -u)-V+[specify certificate validity interval]:interval" \
"($cmn -I -h -n -O -V)-k[generate a KRL file]" \
"$p1($cmn -I -h -n -O -V)-u[update a KRL]"
return
@@ -181,15 +193,15 @@ _ssh () {
'-a[attempt to continue interrupted transfers]' \
'-B+[specify buffer size]:buffer size (bytes) [32768]' \
'-b+[specify batch file to read]:batch file:_files' \
- '-D[connect directly to a local sftp server]:sftp server path' \
+ '-D+[connect directly to a local sftp server]:sftp server path' \
'-f[request that files be flushed immediately after transfer]' \
- '-R[specify number of outstanding requests]:number of requests [64]' \
- '-s[SSH2 subsystem or path to sftp server on the remote host]' \
+ '-R+[specify number of outstanding requests]:number of requests [64]' \
+ '-s+[SSH2 subsystem or path to sftp server on the remote host]:subsystem/path' \
'1:file:->rfile' '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0
;;
(ssh-copy-id)
_arguments \
- '-i:SSH identity file:_files' \
+ '-i+[select identity file]:SSH identity file:_files' \
':remote host name:->userhost' \
;;
esac
@@ -209,7 +221,7 @@ _ssh () {
;;
esac
case "${IPREFIX#-o}" in
- (#i)(afstokenpassing|batchmode|canonicalizefallbacklocal|challengeresponseauthentication|checkhostip|clearallforwardings|compression|enablesshkeysign|exitonforwardfailure|fallbacktorsh|forward(agent|x11)|forwardx11trusted|gatewayports|gssapiauthentication|gssapidelegatecredentials|gssapitrustdns|hashknownhosts|hostbasedauthentication|identitiesonly|kbdinteractiveauthentication|(tcp|)keepalive|nohostauthenticationforlocalhost|passwordauthentication|permitlocalcommand|proxyusefdpass|pubkeyauthentication|rhosts(|rsa)authentication|rsaauthentication|streamlocalbindunlink|usersh|kerberos(authentication|tgtpassing)|useprivilegedport|visualhostkey)=*)
+ (#i)(afstokenpassing|batchmode|canonicalizefallbacklocal|challengeresponseauthentication|checkhostip|clearallforwardings|compression|enablesshkeysign|exitonforwardfailure|fallbacktorsh|forward(agent|x11)|forwardx11trusted|gatewayports|gssapiauthentication|gssapidelegatecredentials|gssapikeyexchange|gssapirenewalforcesrekey|gssapitrustdns|hashknownhosts|hostbasedauthentication|identitiesonly|kbdinteractiveauthentication|(tcp|)keepalive|nohostauthenticationforlocalhost|passwordauthentication|permitlocalcommand|proxyusefdpass|pubkeyauthentication|rhosts(|rsa)authentication|rsaauthentication|streamlocalbindunlink|usersh|kerberos(authentication|tgtpassing)|useprivilegedport|visualhostkey)=*)
_wanted values expl 'truth value' compadd yes no && ret=0
;;
(#i)addressfamily=*)
@@ -231,32 +243,7 @@ _ssh () {
_message -e 'CNAME rule list (source_domain_list:target_domain_list, each pattern list comma separated)' && ret=0
;;
(#i)ciphers=*)
- _values -s , 'encryption cipher' \
- '3des-cbc' \
- '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
- ;;
- (#i)cipher=*)
- _wanted values expl 'encryption cipher (protocol version 1)' \
- compadd blowfish 3des des idea arcfour tss none && ret=0
- ;;
- (#i)compressionlevel=*)
- _values 'compression level' {1..9} && ret=0
+ state=ciphers
;;
(#i)connectionattempts=*)
_message -e 'connection attempts' && ret=0
@@ -296,21 +283,7 @@ _ssh () {
_wanted hosts expl 'real host name to log into' _ssh_hosts && ret=0
;;
(#i)(hostbasedkeytypes|hostkeyalgorithms|pubkeyacceptedkeytypes)=*)
- _values -s , 'key types' \
- 'ecdsa-sha2-nistp256-cert-v01@openssh.com' \
- 'ecdsa-sha2-nistp384-cert-v01@openssh.com' \
- 'ecdsa-sha2-nistp521-cert-v01@openssh.com' \
- 'ssh-ed25519-cert-v01@openssh.com' \
- 'ssh-rsa-cert-v01@openssh.com' \
- 'ssh-dss-cert-v01@openssh.com' \
- 'ssh-rsa-cert-v00@openssh.com' \
- 'ssh-dss-cert-v00@openssh.com' \
- 'ecdsa-sha2-nistp256' \
- 'ecdsa-sha2-nistp384' \
- 'ecdsa-sha2-nistp521' \
- 'ssh-ed25519' \
- 'ssh-rsa' \
- 'ssh-dss' && ret=0
+ _wanted key-types expl 'key type' _sequence compadd - $(_call_program key-types ssh -Q key) && ret=0
;;
(#i)identityfile=*)
_description files expl 'SSH identity file'
@@ -342,12 +315,9 @@ _ssh () {
_values -s , 'keyboard-interactive authentication methods' \
'bsdauth' 'pam' 'skey' && ret=0
;;
- (#i)kexalgorithms=*)
- _values -s , 'KEX algorithms' \
- ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 \
- diffie-hellman-group-exchange-sha256 \
- diffie-hellman-group-exchange-sha1 \
- diffie-hellman-group14-sha1 diffie-hellman-group1-sha1 && ret=0
+ (#i)(kexalgorithms|gssapikexalgorithms)=*)
+ _wanted algorithms expl 'key exchange algorithm' _sequence compadd - \
+ $(_call_program algorithms ssh -Q kex) && ret=0
;;
(#i)localcommand=*)
_description commands expl 'run command locally after connecting'
@@ -381,7 +351,7 @@ _ssh () {
'1' \
'2' && ret=0
;;
- (#i)proxycommand=*)
+ (#i)(proxy|remote)command=*)
_cmdstring && ret=0
;;
(#i)rekeylimit=*)
@@ -413,7 +383,13 @@ _ssh () {
(#i)streamlocalbindmask=*)
_message -e 'octal mask' && ret=0
;;
- (#i)(stricthostkeychecking|verifyhostkeydns|updatehostkeys)=*)
+ (#i)stricthostkeychecking=*)
+ _wanted values expl 'value' compadd yes no ask accept-new off && ret=0
+ ;;
+ (#i)syslogfacility=*)
+ _wanted facilities expl 'facility' compadd -M 'm:{a-z}={A-Z}' DAEMON USER AUTH LOCAL{0,1,2,3,4,5,6,7} && ret=0
+ ;;
+ (#i)(verifyhostkeydns|updatehostkeys)=*)
_wanted values expl 'truthish value' compadd yes no ask && ret=0
;;
(#i)transport=*)
@@ -446,7 +422,7 @@ _ssh () {
# old options are after the empty "\"-line
_wanted values expl 'configure file option' \
compadd -M 'm:{a-z}={A-Z}' -q -S '=' - \
- AddKeysToAgent \
+ AddKeysToAgent \
AddressFamily \
BatchMode \
BindAddress \
@@ -455,14 +431,12 @@ _ssh () {
CanonicalizeHostname \
CanonicalizeMaxDots \
CanonicalizePermittedCNAMEs \
- CertificateFile \
+ CertificateFile \
ChallengeResponseAuthentication \
CheckHostIP \
- Cipher \
Ciphers \
ClearAllForwardings \
Compression \
- CompressionLevel \
ConnectionAttempts \
ConnectTimeout \
ControlMaster \
@@ -480,17 +454,21 @@ _ssh () {
GatewayPorts \
GlobalKnownHostsFile \
GSSAPIAuthentication \
+ GSSAPIClientIdentity \
GSSAPIDelegateCredentials \
+ GSSAPIKeyExchange \
+ GSSAPIRenewalForcesRekey \
+ GSSAPIServerIdentity \
GSSAPITrustDns \
+ GSSAPIKexAlgorithms \
HashKnownHosts \
- Host \
HostbasedAuthentication \
HostbasedKeyTypes \
HostKeyAlgorithms \
HostKeyAlias \
HostName \
IdentitiesOnly \
- IdentityAgent \
+ IdentityAgent \
IdentityFile \
IgnoreUnknown \
IPQoS \
@@ -508,13 +486,13 @@ _ssh () {
PKCS11Provider \
Port \
PreferredAuthentications \
- Protocol \
ProxyCommand \
- ProxyJump \
+ ProxyJump \
ProxyUseFdpass \
PubkeyAcceptedKeyTypes \
PubkeyAuthentication \
RekeyLimit \
+ RemoteCommand \
RemoteForward \
RequestTTY \
RevokedHostKeys \
@@ -526,8 +504,8 @@ _ssh () {
StreamLocalBindMask \
StreamLocalBindUnlink \
StrictHostKeyChecking \
+ SyslogFacility \
TCPKeepAlive \
- Transport \
Tunnel \
TunnelDevice \
UpdateHostKeys \
@@ -600,11 +578,18 @@ _ssh () {
return ret
;;
macs)
- _values -s , 'MAC algorithms' hmac-md5 hmac-sha1 umac-64@openssh.com \
- hmac-ripemd160 hmac-sha1-96 hmac-md5-96 hmac-sha2-256 \
- hmac-sha2-256-96 hmac-sha2-512 hmac-sha2-512-96 && ret=0
+ _wanted macs expl 'MAC algorithm' _sequence compadd - $(_call_program macs ssh -Q mac)
+ return
+ ;;
+ ciphers)
+ _wanted ciphers expl 'encryption cipher' _sequence compadd - $(_call_program ciphers ssh -Q cipher)
+ return
;;
command)
+ if (( $+opt_args[-s] )); then
+ _wanted subsystems expl subsystem compadd sftp
+ return
+ fi
local -a _comp_priv_prefix
shift 1 words
(( CURRENT-- ))
@@ -662,46 +647,4 @@ _ssh_users () {
_combination -s '[:@]' my-accounts users-hosts users "$@"
}
-_ssh_hosts () {
- local -a config_hosts
- local config
- integer ind
-
- # If users-hosts matches, we shouldn't complete anything else.
- if [[ "$IPREFIX" == *@ ]]; then
- _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" && return
- else
- _combination -s '[:@]' my-accounts users-hosts \
- ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return
- fi
- if (( ind = ${words[(I)-F]} )); then
- config=${~words[ind+1]} 2>/dev/null
- else
- config="$HOME/.ssh/config"
- fi
- if [[ -r $config ]]; then
- local key line host
- local -a lines=("${(@f)$(<"$config")}") 2>/dev/null
- while (($#lines)); do
- IFS=$'=\t ' read -r key line <<<"${lines[1]}"
- case "$key" in
- ((#i)include)
- lines[1]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;;
- ((#i)host(|name))
- for host in ${(z)line}; do
- case $host in
- (*[*?]*) ;;
- (*) config_hosts+=("$host") ;;
- esac
- done ;&
- (*) shift lines;;
- esac
- done
- if (( ${#config_hosts} )); then
- _wanted hosts expl 'remote host name' \
- compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts
- fi
- fi
-}
-
_ssh "$@"
diff --git a/Completion/Unix/Command/_stdbuf b/Completion/Unix/Command/_stdbuf
new file mode 100644
index 000000000..e45b5a5cd
--- /dev/null
+++ b/Completion/Unix/Command/_stdbuf
@@ -0,0 +1,30 @@
+#compdef stdbuf gstdbuf
+
+local -a short long buf args
+local i opt gnu=0
+
+short=( -e -i -o )
+long=( --error --output --input )
+buf=( err in out )
+
+opt='[set initial buffering for std${buf[i]}]:mode or size:((0\:unbuffered L\:line\ buffered'
+if _pick_variant gnu=GNU freebsd --version; then
+ gnu=1
+ args=(
+ '(- *)--help[display usage information]'
+ '(- *)--version[display version information]'
+ )
+else
+ opt+=' B\:fully\ buffered'
+fi
+opt+='))'
+
+for ((i=1;i<=3;i++)); do
+ args+=( "(${long[i]})${short[i]}+${(e)opt}" )
+ (( gnu )) && args+=(
+ "(${short[i]})${long[i]}=${(e)opt}"
+ )
+done
+(( CURRENT > 2 )) && args+=( '*::command:_normal' )
+
+_arguments -s -S $args
diff --git a/Completion/Unix/Command/_strings b/Completion/Unix/Command/_strings
new file mode 100644
index 000000000..8eeff704b
--- /dev/null
+++ b/Completion/Unix/Command/_strings
@@ -0,0 +1,73 @@
+#compdef strings gstrings eu-strings
+
+local args variant format bytes
+format='[precede each string by its byte offset in the file]:format:((d\:decimal o\:octal x\:hexadecimal))'
+bytes='[specify minimum string length]:length (bytes) [4]'
+args=(
+ '(-t --radix)-o[precede each string by its decimal byte offset]'
+ '!(-n --bytes)-'{1,2,3,4,5,6,7,8,9}
+)
+
+if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfutils unix -V; then
+ args+=(
+ '(-a --all -d --data)'{-a,--all}'[look everywhere in file, not just initialised data space of object files]'
+ '(-e --encoding)'{-e+,--encoding=}'[select character size and endianness]:character type:((
+ s\:7-bit
+ S\:8-bit
+ b\:16-bit\ big-endian
+ l\:16-bit\ little-endian
+ B\:32-bit\ big-endian
+ L\:32-bit\ little-endian))'
+ '(-f --print-file-name)'{-f,--print-file-name}'[print name of the file before each string]'
+ '(-n --bytes)'{-n+,--bytes=}"$bytes"
+ '(-d -t --radix)'{-t+,--radix=}"$format"
+ '(- *)--help[display help information]'
+ '(- *)--version[display version information]'
+ )
+ case $variant in
+ elfutils|binutils)
+ args+=( '(- *)-V[display version information]' )
+ ;|
+ elftoolchain|binutils)
+ args+=(
+ '(- *)-h[display help information]'
+ '(- *)-v[display version information]'
+ )
+ ;|
+ binutils)
+ args+=(
+ '(-a --all -d --data)'{-d,--data}'[only print strings from file data sections]'
+ '(-w --include-all-whitespace)'{-w,--include-all-whitespace}'[include all whitespace as valid string characters]'
+ '(-T --target)'{-T+,--target=}'[specify binary file format]:format:compadd - ${(z)${(M)${(f)"$(_call_program targets strings --help)"}##* supported targets*}##*\: }'
+ '(-s --output-separator)'{-s+,--output-separator=}'[specify string used to separate strings in output]'
+ )
+ ;;
+ elfutils)
+ args+=(
+ '(- *)--usage[display a short usage message]'
+ '(- *)-\\?[display help information]'
+ )
+ ;;
+ esac
+else
+ args+=(
+ "(-d)-t+$format"
+ "-n+$bytes"
+ '-a[look everywhere in file, not just initialised data space of object files]'
+ )
+ case $OSTYPE in
+ darwin)
+ local -a arch
+ arch=( ${${${"$(_call_program architectures strings -arch \? 2>&1)"}#*flags are: }%%$'\n'*} )
+ args+=( '-arch[specify the architecture]:architecture:compadd -a arch' )
+ ;;
+ esac
+fi
+
+if compset -P '@'; then
+ _files
+ return
+fi
+
+_arguments -S -s $args \
+ '*:file:_files'
diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip
index f244b0ace..630140c64 100644
--- a/Completion/Unix/Command/_strip
+++ b/Completion/Unix/Command/_strip
@@ -19,17 +19,22 @@ if _pick_variant gnu=GNU solaris --version; then
'(-)--help[display usage information]'
'(-)--info[display list of architectures and object formats]'
'(-I --input-target)'{-I+,--input-target=}'[object code format of input]:bfd name:->bfdnames'
- '(-O --output-target)'{-I+,--output-target=}'[object code format of output]:bfd name:->bfdnames'
+ '(-O --output-target)'{-O+,--output-target=}'[object code format of output]:bfd name:->bfdnames'
+ '(-D --enable-deterministic-archives -U --disable-deterministic-archives)'{-U,--disable-deterministic-archives}'[disable -D behavior]'
+ '(-D --enable-deterministic-archives -U --disable-deterministic-archives)'{-D,--enable-deterministic-archives}'[produce deterministic output when stripping archives (zero file metadata)]'
'*'{-R+,--remove-section=}'[remove given sections]:section name'
'--remove-relocations=[remove relocations from specified section]:section'
'(-s --strip-all)'{-s,--strip-all}'[remove all symbols]'
'(-g -S -d --strip-debug)'{-g,-S,-d,--strip-debug}'[remove debugging symbols]'
+ '--strip-dwo[remove all DWARF .dwo sections]'
'--strip-unneeded[remove symbols not needed for relocation processing]'
+ '!(--no-merge-notes)'{-M,--merge-notes}
+ "--no-merge-notes[don't attempt to remove redundant notes]"
'*'{-K+,--keep-symbol=}'[keep given symbol]:symbol name'
'*'{-N+,--strip-symbol=}'[strip given symbol]:symbol name'
'(*)-o+[output file]:output file:_files'
'(-p --preserve-dates)'{-p,--preserve-dates}'[preserve access and modification dates]'
- '(-w --wildcard)'{-w,--wildcard}'[permit wilcards in symbol names]'
+ '(-w --wildcard)'{-w,--wildcard}'[permit wildcards in symbol names]'
'(-x --discard-all)'{-x,--discard-all}'[remove non-global symbols]'
'(-X --discard-locals)'{-X,--discard-locals}'[remove compiler-generated local symbols]'
'--keep-file-symbols[retain symbols specifying source file names]'
diff --git a/Completion/Unix/Command/_stty b/Completion/Unix/Command/_stty
index b5545ebcd..73347c5b7 100644
--- a/Completion/Unix/Command/_stty
+++ b/Completion/Unix/Command/_stty
@@ -1,4 +1,4 @@
-#compdef stty
+#compdef stty gstty
local expl
diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index b4ccccfae..b7e10c06b 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -1,4 +1,4 @@
-#compdef svn svnadmin svnadmin-static=svnadmin
+#compdef svn svnlite=svn svnadmin svnadmin-static=svnadmin
_svn () {
local curcontext="$curcontext" state line expl ret=1
@@ -24,7 +24,7 @@ _svn () {
zstyle ":completion:*:*:$service:*" cache-policy _svn_caching_policy
fi
- _arguments -C \
+ _arguments -C -A "-*" \
'(-)--help[print help information]' \
'(- *)--version[print client version information]' \
'1: :->cmds' \
@@ -34,7 +34,7 @@ _svn () {
typeset -gHA _svn_cmds
if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then
_svn_cmds=(
- ${=${(f)${${"$(_comp_locale; _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
+ ${=${(f)${${"$(_call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z-]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
)
if (( $? == 0 )); then
_store_cache svn-cmds _svn_cmds
@@ -60,39 +60,42 @@ _svn () {
if _cache_invalid svn-${cmd}-usage || \
! _retrieve_cache svn-${cmd}-usage;
then
- usage=${${(M)${(f)"$(_comp_locale; _call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] }
+ usage=${${(M)${(f)"$(_call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] }
_store_cache svn-${cmd}-usage usage
fi
if _cache_invalid svn-${cmd}-usage || \
! _retrieve_cache svn-${cmd}-args;
then
args=(
- ${=${${${(M)${(f)"$(_comp_locale; _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]}
+ ${=${${${(M)${(f)"$(_call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]}
)
while (( idx=$args[(I)*--accept:arg:] )); do
- args[(I)*--accept:arg:]=( --accept'=:automatic conflict resolution action:((working\:working base\:base '"`for i j in p postpone mc mine-conflict tc theirs-conflict mf mine-full tf theirs-full e edit l launch; do print -rn $i\\\\:$j $j\\\\:$j ""; done `"'))' )
+ args[idx]=( --accept'=:automatic conflict resolution action:((working\:working base\:base '"`for i j in p postpone mc mine-conflict tc theirs-conflict mf mine-full tf theirs-full e edit l launch; do print -rn $i\\\\:$j $j\\\\:$j ""; done `"'))' )
done
while (( idx=$args[(I)*--c(l|hangelist):arg:] )); do
- args[(I)*--c(l|hangelist):arg:]=( \*{--cl,--changelist}'=:change list:_svn_changelists' )
+ args[idx]=( \*{--cl,--changelist}'=:change list:_svn_changelists' )
done
while (( idx=$args[(I)*--config-dir:arg:] )); do
- args[(I)*--config-dir:arg:]=( --config-dir'=:config dir:_directories' )
+ args[idx]=( --config-dir'=:config dir:_directories' )
done
+ while (( idx=$args[(I)*--config-option:arg:] )); do
+ args[idx]=( '*--config-option=: :_svn_config_options' )
+ done
while (( idx=$args[(I)*--depth:arg:] )); do
- args[(I)*--depth:arg:]=( --depth'=:operation depth (how far to recurse):(empty files immediates infinity)' )
+ args[idx]=( --depth'=:operation depth (how far to recurse):(empty files immediates infinity)' )
done
while (( idx=$args[(I)*(-F|--file):arg:] )); do
- args[(I)*(-F|--file):arg:]=( '(-F --file)'{-F+,--file=}':log message file:_files' )
+ args[idx]=( '(-F --file)'{-F+,--file=}':log message file:_files' )
done
while (( idx=$args[(I)*--set-depth:arg:] )); do
- args[(I)*--set-depth:arg:]=( --set-depth'=[make working copy deeper or shallower]:new depth:(exclude empty files immediates infinity)' )
+ args[idx]=( --set-depth'=[make working copy deeper or shallower]:new depth:(exclude empty files immediates infinity)' )
done
while (( idx=$args[(I)*--trust-server-cert-failures:arg:] )); do
- args[(I)*--trust-server-cert-failures:arg:]=( --trust-server-cert-failures'=:failures:_values -s , "certificate failures to ignore" "unknown-ca[unknown authority]" "cn-mismatch[hostname mismatch]" "expired[certificate expired]" "not-yet-valid[certificate not yet valid]" "other[all other failures]"' )
+ args[idx]=( --trust-server-cert-failures'=:failures:_values -s , "certificate failures to ignore" "unknown-ca[unknown authority]" "cn-mismatch[hostname mismatch]" "expired[certificate expired]" "not-yet-valid[certificate not yet valid]" "other[all other failures]"' )
done
while (( idx=$args[(I)*--show-item:arg:] )); do
# (q) to quote the parentheses in the value
- args[(I)*--show-item:arg:]=( --show-item'=:item key:(('"`for i j in ${(kv)show_item_keys}; do print -rn - $i\\\\:"${(q)j}" ""; done`"'))' )
+ args[idx]=( --show-item'=:item key:(('"`for i j in ${(kv)show_item_keys}; do print -rn - $i\\\\:"${(q)j}" ""; done`"'))' )
done
# All other options get {-x+,--long-x=}
args=( ${args/(#b)(--[A-Za-z0-9-]##):arg:/$match[1]=:arg:} )
@@ -227,7 +230,7 @@ _svnadmin () {
if [[ -n $state ]] && (( ! $+_svnadmin_cmds )); then
typeset -gHA _svnadmin_cmds
_svnadmin_cmds=(
- ${=${(f)${${"$(_comp_locale; _call_program commands svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([-a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
+ ${=${(f)${${"$(_call_program commands svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([-a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
)
fi
@@ -242,9 +245,9 @@ _svnadmin () {
if (( $#cmd )); then
curcontext="${curcontext%:*:*}:svnadmin-${cmd}:"
- usage=${${(M)${(f)"$(_comp_locale; _call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd }
+ usage=${${(M)${(f)"$(_call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd }
args=(
- ${=${${${(M)${(f)"$(_comp_locale; _call_program options svnadmin help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
+ ${=${${${(M)${(f)"$(_call_program options svnadmin help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
)
# All options get {-x+,--long-x=}
args=( ${args/(#b)(--[A-Za-z0-9-]##):arg:/$match[1]=:arg:} )
@@ -417,6 +420,27 @@ _svnadmin_commands() {
compadd "$@" -k _svnadmin_cmds || compadd "$@" ${(s.:.)_svnadmin_cmds}
}
+(( $+functions[_svn_config_options] )) ||
+_svn_config_options() {
+ local -a expl suf
+ local cfgfile
+ compset -S ':*' || suf=( -qS : )
+ if compset -P 2 '*:'; then
+ if compset -P '*='; then
+ _message -e values 'value'
+ else
+ _message -e options 'option'
+ fi
+ elif compset -P 1 '*:'; then
+ cfgfile=( ~/.subversion/${(M)${IPREFIX%:}%(config|servers)}(N) /dev/null )
+ _description sections expl 'section'
+ compadd $suf "$expl[@]" ${${${(M)${(f)"$(<${cfgfile[1]})"}:#\[*\]}#\[}%\]}
+ else
+ _description config-files expl 'configuration file'
+ compadd $suf "$expl[@]" config servers
+ fi
+}
+
(( $+functions[_svn_props] )) ||
_svn_props() {
local properties
@@ -429,7 +453,7 @@ _svn_props() {
_svn_changelists() {
local cls
- cls=( ${${${(M)${(f)"$(_comp_locale; _call_program changelists svn status 2>/dev/null)"}:#--- Changelist*}%??}##*\'} )
+ cls=( ${${${(M)${(f)"$(_call_program changelists svn status 2>/dev/null)"}:#--- Changelist*}%??}##*\'} )
compadd "$@" -a cls && return 0
}
diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo
index ec293d469..10fa2e82e 100644
--- a/Completion/Unix/Command/_sudo
+++ b/Completion/Unix/Command/_sudo
@@ -47,7 +47,8 @@ else
'(-s --shell)'{-s,--shell}'[run shell as the target user; a command may also be specified]' \
'(-i --login)'{-i,--login}'[run login shell as the target user; a command may also be specified]' \
'(-b --background -i --login -s --shell -e --edit)'{-b,--background}'[run command in the background]' \
- '(-E --preserve-env -i --login -s --shell -e --edit)'{-E,--preserve-env}'[preserve user environment when running command]' \
+ '(--preserve-env -i --login -s --shell -e --edit)-E[preserve user environment when running command]' \
+ '(-E -i --login -s --shell -e --edit)--preserve-env=-[preserve user environment when running command]::environment variable:_sequence _parameters -g "*export*"' \
'(-H --set-home -i --login -s --shell -e --edit)'{-H,--set-home}"[set HOME variable to target user's home dir]" \
'(-P --preserve-groups -i -login -s --shell -e --edit)'{-P,--preserve-groups}"[preserve group vector instead of setting to target's]" \
'(-)1:command: _command_names -e'
diff --git a/Completion/Unix/Command/_tail b/Completion/Unix/Command/_tail
index 4e6422621..599503ab5 100644
--- a/Completion/Unix/Command/_tail
+++ b/Completion/Unix/Command/_tail
@@ -1,4 +1,4 @@
-#compdef tail
+#compdef tail gtail
local curcontext=$curcontext state state_descr line opts args ret=1
typeset -A opt_args
@@ -11,7 +11,7 @@ if _pick_variant gnu=GNU unix --version; then
'(-F --follow)-f[same as --follow=descriptor]'
'(-f --follow --retry)-F[same as --follow=name --retry]'
'--max-unchanged-stats=[with --follow=name, check file rename after the specified number of iterations]:number of iterations'
- '(-s --sleep-interval)'{-s+,--sleep-interval=}'[with -f, sleep the specfied seconds between iterations]:seconds'
+ '(-s --sleep-interval)'{-s+,--sleep-interval=}'[with -f, sleep the specified seconds between iterations]:seconds'
'--pid=[with -f, terminate after the specified process dies]:pid:_pids'
'(-q --quiet --silent -v --verbose)'{-q,--quiet,--silent}'[never output headers giving file names]'
'(-q --quiet --silent -v --verbose)'{-v,--verbose}'[always output headers giving file names]'
diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar
index 4a2404873..cff50562e 100644
--- a/Completion/Unix/Command/_tar
+++ b/Completion/Unix/Command/_tar
@@ -99,10 +99,16 @@ if [[ "$PREFIX" = --* ]]; then
# ...long options after `--'.
- _arguments -- '--owner*:user:_users' \
+ _arguments -- -l '--owner=*:user:_users' \
+ '--group=*:group:_groups' \
+ '--atime-preserve*::method:(replace system)' \
+ '--*-script=NAME:script file:_files' \
+ '--format=*:format:(gnu oldgnu pax posix ustar v7)' \
+ '--quoting-style=*:quoting style:(literal shell shell-always c c-maybe escape locale clocale)' \
+ '--totals*=SIGNAL*::signal:(HUP QUIT INT USR1 USR2)' \
'*=(PROG|COMMAND)*:program:_command_names -e' \
'*=ARCHIVE*:archive: _tar_archive' \
- '*=NAME*:file:_files' \
+ '*=FILE*:file:_files' \
'*=DIR*:directory:_files -/' \
'*=CONTROL*::version control:(t numbered nil existing never simple)'
diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo
index 57e13bdc2..b356ddbe7 100644
--- a/Completion/Unix/Command/_texinfo
+++ b/Completion/Unix/Command/_texinfo
@@ -1,4 +1,4 @@
-#compdef info tkinfo install-info makeinfo texi2any texi2dvi pdftexi2dvi texi2pdf texindex
+#compdef info tkinfo pinfo install-info makeinfo texi2any texi2dvi pdftexi2dvi texi2pdf texindex
_info_nodes_caching_policy() {
local dir oldp
@@ -45,6 +45,7 @@ case $service in
'(: - -h --help)'{-h,--help}'[display usage]' \
'(-o --output -O)--index-search=[go directly to node if found]:search string: ' \
'(--index-search -o --output -O)'{-o+,--output=}'[dump selected nodes to filename]:filename:_files -g "*(-.)"' \
+ '--init-file=[specify initialisation file]:file:_files' \
'(-n --node)'{-n+,--node=}'[specify nodes in first visited Info file]:node:->nodes' \
'--no-raw-escapes[output escapes as literal text]' \
'--restore=[read keystrokes from file]:filename:_files -g "*(-.)"' \
@@ -91,7 +92,7 @@ case $service in
'--description=[specify description for menu entry]:description' \
'(2)--dir-file=[specify dir file]:dir file:_files -g "dir(-.)"' \
'(--test --dry-run)'{--dry-run,--test}"[don't update dir file]" \
- \*{--entry,--info}'[specify directory entry to add]:text' \
+ \*{--entry,--item}'[specify directory entry to add]:text' \
'--defsection=[like --section, but only use text if no sections present in info file]:text' \
{--maxwidth,--max-width}'=[specify maximum width of dir file]:width' \
'(- 1 2)--help[display help information]' \
@@ -99,9 +100,10 @@ case $service in
'(2)--info-dir=[specify directory containing dir file]:info directory:_files -/' \
'--keep-old=[inhibit replacement of existing entries/removal of empty sections]' \
'(--name --menuentry)'{--name,--menuentry}'=[specify the menu entry for dir file]:menu entry' \
- "--no-indent[don't format new entries in the DIR file]"
+ "--no-indent[don't format new entries in the DIR file]" \
'--quiet[suppress warnings]' \
'--regex=[specify sections for file entries using a regex]:regex' \
+ '--remove-exactly[delete existing entries taking exact entry name]' \
'(--delete --remove)--section=[put new entries in specified section]:section' \
'--silent[no output except errors]' \
'(- 1 2)--version[display version information]' \
@@ -135,11 +137,13 @@ case $service in
'(-E --macro-expand)'{-E,--macro-expand}'[output macro-expanded source to specified file]:file:_files' \
'(--docbook --xml)--no-split[suppress splitting of output]' \
'--no-number-sections[output chapter and section numbers]' \
+ '!(--no-number-sections)--number-sections' \
'(-o --output=)'{-o,--output}'[specify output file]:output file:_files' \
'(--docbook --html --xml)--disable-encoding[output special characters]' \
- '(--docbook --html --xml)--fill-column=[specify width to break lines at]:width' \
+ '!(--disable-encoding)--enable-encoding' \
+ '(--docbook --html --xml)--fill-column=[specify width to break lines at]:width [72]' \
'(--docbook --html --xml)--footnote-style=[specify style for output of footnotes]:((separate\:in\ own\ node end\:at\ end\ of\ node))' \
- '(--docbook --html --xml)--paragraph-indent=[specify spaces to indent paragraphs by]' \
+ '(--docbook --html --xml)--paragraph-indent=[specify spaces to indent paragraphs by]:indent [3]' \
'(--docbook --html --xml)--split-size=[split Info files at specified size]:size [300000]' \
'(--docbook --xml --plaintext)--css-include=[specify file in include in HTML <style> output]:file:_files' \
'(--docbook --xml --plaintext)--css-ref=[generate reference to a CSS file]:URL:_urls' \
@@ -223,6 +227,27 @@ case $service in
'*::menu items:->infomanuals' && ret=0
info=( info ${(kv)opt_args[(I)-file]/-file/-f} )
;;
+ pinfo)
+ cmd=$commands[info]
+ _arguments -s -S \
+ '(- *)'{-h,--help}'[print usage information]' \
+ '(- *)'{-v,--version}'[print version information]' \
+ {-m,--manual}'[use man page]:*:: := _dispatch man man' \
+ '(-r --raw-filename -f --file)'{-r,--raw-filename,-f,--file}'[use raw filename]' \
+ '(-a --apropos)'{-a,--apropos}'[call apropos if nothing found]' \
+ {-p,--plain-apropos}'[call only apropos]:*:: := _dispatch apropos apropos' \
+ '(-c --cut-man-headers)'{-c,--cut-man-headers}'[cut out repeated man headers]' \
+ '(-l --long-manual-links)'{-l,--long-manual-links}'[use long link names in manuals]' \
+ '(-s --squeeze-manlines)'{-s,--squeeze-manlines}'[cut empty lines from manual pages]' \
+ '(-d --dont-handle-without-tag-table)'{-d,--dont-handle-without-tag-table}"[don't display texinfo pages without tag table]" \
+ '(-t --force-manual-tag-table)'{-t,--force-manual-tag-table}'[force manual detection of tag table]' \
+ '(-l --long-manual-links)'{-l,--long-manual-links}'[use long link names in manuals]' \
+ '(-x --clear-at-exit)'{-x,--clear-at-exit}'[clear screen at exit]' \
+ '--node=[jump directly to specified node]:node:->nodes' \
+ '--rcfile=[use alternate rcfile]:file:_files' \
+ '1:menu item:->infomanuals' && ret=0
+ file=${line[1]}
+ ;;
esac
if [[ -n $state ]]; then
diff --git a/Completion/Unix/Command/_tidy b/Completion/Unix/Command/_tidy
index ec2d74238..3998ccdb3 100644
--- a/Completion/Unix/Command/_tidy
+++ b/Completion/Unix/Command/_tidy
@@ -1,43 +1,31 @@
#compdef tidy
-# HTML Tidy for Linux/x86 released on 1st March 2003
+local -a opts
-local -a access autobool boolean doctype encoding
+opts=( ${${${(s.</option>.)"$(_call_program options $words[1] -xml-config)"}##*<name>}/<\/name>*<type>/;} )
+opts=( ${opts/;Integer*/:number} )
+opts=( ${opts/;Boolean*/:boolean:(yes no)} )
+opts=( ${opts/;AutoBool*/:value:(auto yes no)} )
+opts=( ${opts/;(String|Tag|Attributes)*/:value} )
+opts=( ${opts/(#bi);(enum|Encoding|DocType)*<default>(*)<*<example>([^<]#)<*/:value [${match[2]%% *}]:(${(j. .)${(@s., .)match[3]}%% *})} )
+opts=( ${(M)opts:#*:*} )
-access=( 1 2 3 )
-boolean=( yes no )
-autobool=( auto $boolean )
-doctype=( auto omit strict loose transitional )
-encoding=( ascii latin1 raw utf8 iso2022 mac utf16le utf16be utf16 win1252 ibm858 big5 shiftjis )
-
-_arguments \
+_arguments -s -A "-*" --$^opts \
'(-indent -i)'{-indent,-i}'[indent element content]' \
'-wrap[wrap text at the specified <column> (default is 68)]:column:' \
'(-upper -u)'{-upper,-u}'[force tags to upper case (default is lower case)]' \
'(-clean -c)'{-clean,-c}'[replace FONT, NOBR and CENTER tags by CSS]' \
'(-bare -b)'{-bare,-b}'[strip out smart quotes and em dashes, etc.]' \
+ '(-gdoc -g)'{-gdoc,-g}'[produce clean version of html exported by Google Docs]' \
'(-numeric -n)'{-numeric,-n}'[output numeric rather than named entities]' \
'(-errors -e)'{-errors,-e}'[only show errors]' \
'(-quiet -q)'{-quiet,-q}'[suppress nonessential output]' \
- '-omit[omit optional end tags]' \
+ '-omit[omit optional start and end tags]' \
'-xml[specify the input is well formed XML]' \
'(-asxml -asxhtml -ashtml)'{-asxml,-asxhtml}'[convert HTML to well formed XHTML]' \
'(-asxml -asxhtml)-ashtml[force XHTML to well formed HTML]' \
'-access[do additional accessibility checks (<level> = 1, 2, 3)]:priority level:(${access[@]})' \
'-raw[output values above 127 without conversion to entities]' \
- '( -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-ascii[use US-ASCII for output, ISO-8859-1 for input]' \
- '(-ascii -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-latin0[use US-ASCII for output, ISO-8859-1 for input]' \
- '(-ascii -latin0 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-latin1[use ISO-8859-1 for both input and output]' \
- '(-ascii -latin0 -latin1 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-iso2022[use ISO-2022 for both input and output]' \
- '(-ascii -latin0 -latin1 -iso2022 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-utf8[use UTF-8 for both input and output]' \
- '(-ascii -latin0 -latin1 -iso2022 -utf8 -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-mac[use MacRoman for input, US-ASCII for output]' \
- '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -ibm858 -utf16le -utf16be -utf16 -shiftjis -big5)-win1252[use Windows-1252 for input, US-ASCII for output]' \
- '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -utf16le -utf16be -utf16 -shiftjis -big5)-ibm858[use IBM-858 (CP850+Euro) for input, US-ASCII for output]' \
- '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16be -utf16 -shiftjis -big5)-utf16le[use UTF-16LE for both input and output]' \
- '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16 -shiftjis -big5)-utf16be[use UTF-16BE for both input and output]' \
- '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -shiftjis -big5)-utf16[use UTF-16 for both input and output]' \
- '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -big5)-shiftjis[use Shift_JIS for both input and output]' \
- '(-ascii -latin0 -latin1 -iso2022 -utf8 -mac -win1252 -ibm858 -utf16le -utf16be -utf16 -shiftjis )-big5[use Big5 for both input and output]' \
'(-out -o)'{-out,-o}'[specify the output markup file]:output file:_files' \
'-config[set configuration options from the specified <file>]:configuration file:_files' \
'-f[write errors to the specified <file>]:error file:_files' \
@@ -45,82 +33,30 @@ _arguments \
'(- *)'{-version,-v}'[show the version of Tidy]' \
'(- *)'{-help,-h,-\?}'[list the command line options]' \
'(- *)-help-config[list all configuration options]' \
+ '(- *)-help-env[show details of environment and runtime configuration]' \
'(- *)-show-config[list the current configuration settings]' \
- '--indent-spaces:number of spaces:' \
- '--wrap:column:' \
- '--wrap-attributes:boolean:(${boolean[@]})' \
- '--wrap-script-literals:boolean:(${boolean[@]})' \
- '--wrap-sections:boolean:(${boolean[@]})' \
- '--wrap-asp:boolean:(${boolean[@]})' \
- '--wrap-jste:boolean:(${boolean[@]})' \
- '--wrap-php:boolean:(${boolean[@]})' \
- '--literal-attributes:boolean:(${boolean[@]})' \
- '--tab-size:tab size:' \
- '--markup:boolean:(${boolean[@]})' \
- '--quiet:boolean:(${boolean[@]})' \
- '--tidy-mark:boolean:(${boolean[@]})' \
- '--indent:boolean:(${autobool[@]})' \
- '--indent-attributes:boolean:(${boolean[@]})' \
- '--hide-endtags:boolean:(${boolean[@]})' \
- '--input-xml:boolean:(${boolean[@]})' \
- '--output-xml:boolean:(${boolean[@]})' \
- '--output-xhtml:boolean:(${boolean[@]})' \
- '--output-html:boolean:(${boolean[@]})' \
- '--add-xml-pi:boolean:(${boolean[@]})' \
- '--add-xml-decl:boolean:(${boolean[@]})' \
- '--assume-xml-procins:boolean:(${boolean[@]})' \
- '--raw:boolean:(${boolean[@]})' \
- '--uppercase-tags:boolean:(${boolean[@]})' \
- '--uppercase-attributes:boolean:(${boolean[@]})' \
- '--bare:boolean:(${boolean[@]})' \
- '--clean:boolean:(${boolean[@]})' \
- '--logical-emphasis:boolean:(${boolean[@]})' \
- '--word-2000:boolean:(${boolean[@]})' \
- '--drop-empty-paras:boolean:(${boolean[@]})' \
- '--drop-font-tags:boolean:(${boolean[@]})' \
- '--drop-proprietary-attribute:boolean:(${boolean[@]})' \
- '--enclose-text:boolean:(${boolean[@]})' \
- '--enclose-block-text:boolean:(${boolean[@]})' \
- '--alt-text:alternate text:' \
- '--add-xml-space:boolean:(${boolean[@]})' \
- '--fix-bad-comments:boolean:(${boolean[@]})' \
- '--split:boolean:(${boolean[@]})' \
- '--break-before-br:boolean:(${boolean[@]})' \
- '--numeric-entities:boolean:(${boolean[@]})' \
- '--quote-marks:boolean:(${boolean[@]})' \
- '--quote-nbsp:boolean:(${boolean[@]})' \
- '--quote-ampersand:boolean:(${boolean[@]})' \
- '--write-back:boolean:(${boolean[@]})' \
- '--keep-time:boolean:(${boolean[@]})' \
- '--show-warnings:boolean:(${boolean[@]})' \
- '--error-file:error file:_files' \
- '--output-file:output file:_files' \
- '--show-body-only:boolean:(${boolean[@]})' \
- '--slide-style:style sheet file:_files' \
- '--new-inline-tags:tag names:' \
- '--new-blocklevel-tags:tag names:' \
- '--new-empty-tags:tag names:' \
- '--new-pre-tags:tag names:' \
- '--char-encoding:encoding:(${encoding[@]})' \
- '--input-encoding:encoding:(${encoding[@]})' \
- '--output-encoding:encoding:(${encoding[@]})' \
- '--doctype:doctype:(${doctype[@]})' \
- '--fix-backslash:boolean:(${boolean[@]})' \
- '--gnu-emacs:boolean:(${boolean[@]})' \
- '--fix-uri:boolean:(${boolean[@]})' \
- '--lower-literals:boolean:(${boolean[@]})' \
- '--hide-comments:boolean:(${boolean[@]})' \
- '--indent-cdata:boolean:(${boolean[@]})' \
- '--force-output:boolean:(${boolean[@]})' \
- '--show-errors:maximum number of errors:' \
- '--ascii-chars:boolean:(${boolean[@]})' \
- '--join-classes:boolean:(${boolean[@]})' \
- '--join-styles:boolean:(${boolean[@]})' \
- '--escape-cdata:boolean:(${boolean[@]})' \
- '--repeated-attributes:value:(keep-first keep-last)' \
- '--output-bom:boolean:(${autobool[@]})' \
- '--replace-color:boolean:(${boolean[@]})' \
- '--css-prefix:CSS class name:' \
- '--accessibility-check:priority level:(${access[@]})' \
- '--newline:newline character:(LF CRLF CR)' \
- '*:file:_files'
+ '(- *)-export-config[list the current settings in config file form]' \
+ '(- *)-export-default-config[list the default settings in config file form]' \
+ "(*)-help-option[show a description of specified configuration option]:config option:(${(@j. .)opts%%:*})" \
+ '(-lang -language)'{-lang,-language}'[set the two-letter language code]:language:_locales' \
+ '-xml-help[list the command line options in XML format]' \
+ '-xml-config[list all configuration options in XML format]' \
+ "-xml-strings[output all of Tidy's strings in XML format]" \
+ '-xml-error-strings[output error constants and strings in XML format]' \
+ '-xml-options-strings[output option descriptions in XML format]' \
+ '-options[specify file containing configuration settings]:config file:_files' \
+ '*:file:_files' \
+ + '(encoding)' \
+ '-ascii[use US-ASCII for output, ISO-8859-1 for input]' \
+ '-latin0[use US-ASCII for output, ISO-8859-1 for input]' \
+ '-latin1[use ISO-8859-1 for both input and output]' \
+ '-iso2022[use ISO-2022 for both input and output]' \
+ '-utf8[use UTF-8 for both input and output]' \
+ '-mac[use MacRoman for input, US-ASCII for output]' \
+ '-win1252[use Windows-1252 for input, US-ASCII for output]' \
+ '-ibm858[use IBM-858 (CP850+Euro) for input, US-ASCII for output]' \
+ '-utf16le[use UTF-16LE for both input and output]' \
+ '-utf16be[use UTF-16BE for both input and output]' \
+ '-utf16[use UTF-16 for both input and output]' \
+ '-shiftjis[use Shift_JIS for both input and output]' \
+ '-big5[use Big5 for both input and output]'
diff --git a/Completion/Unix/Command/_timeout b/Completion/Unix/Command/_timeout
new file mode 100644
index 000000000..5c27bee47
--- /dev/null
+++ b/Completion/Unix/Command/_timeout
@@ -0,0 +1,20 @@
+#compdef timeout gtimeout
+
+local args
+
+if [[ $service = g* || $OSTYPE != *bsd* ]]; then
+ # GNU coreutils as opposed to Free/NetBSD implementation
+ args=(
+ '(-v --verbose)'{-v,--verbose}'[indicate when signal is sent upon timeout]'
+ '(- *)--help[display usage information]'
+ '(- *)--version[display version information]'
+ )
+fi
+
+_arguments -S -A "-" $args \
+ '--preserve-status[always exit with the same status as command even if it times out]' \
+ "--foreground[don't propagate timeout to the command children]" \
+ '(-s --signal)'{-s,--signal}'[specify the signal to send on timeout]:signal:_signals' \
+ '(-k --kill-after)'{-k,--kill-after}'[followup first signal with SIGKILL if command persists after specified time]:time:time' \
+ '1: :_guard "[0-9.]#([smhd]|)" duration' \
+ '*:::command:_normal'
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 7ef20c666..730959e84 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -168,7 +168,7 @@ _tmux-attach-session() {
'-c+[specify working directory for the session]:directory:_directories' \
'-d[detach other clients attached to target session]' \
'-r[put the client into read-only mode]' \
- '-t+[specify target session]:target session:__tmux-sessions' \
+ '-t+[specify target session]:target session: __tmux-sessions-separately' \
"-E[don't apply update-environment option]"
}
@@ -178,19 +178,18 @@ _tmux-bind-key() {
'-c[bind to command mode instead of normal mode]' \
'-n[make the binding work without the need for the prefix key]' \
'-r[the key may repeat]' \
- '-t+[specify mode table for the binding]:mode table:__tmux-mode-tables' \
- '-R+[specify repeat count]:repeat count' \
'-T+[specify key table for the binding]:key table' \
'1:key' \
- '*:::template:_tmux'
+ '*:::template:= _tmux'
}
_tmux-break-pane() {
[[ -n ${tmux_describe} ]] && print "break a pane from an existing into a new window" && return
_arguments -s \
"-d[don't make the new window become the active one]" \
- '-F+[specify output format]:format:__tmux-format__tmux-format' \
+ '-F+[specify output format]:format:__tmux-format' \
'-P[print information of new window after it has been created]' \
+ '-n+[specify window name]:name' \
'-s+[specify source pane]:pane:__tmux-panes' \
'-t+[specify destination window]:pane:__tmux-panes'
}
@@ -212,49 +211,38 @@ _tmux-capture-pane() {
}
_tmux-choose-buffer() {
- [[ -n ${tmux_describe} ]] && print "put a window into buffer choice mode" && return
+ [[ -n ${tmux_describe} ]] && print "put a pane into buffer choice mode" && return
_arguments -s \
- '-F+[specify output format]:format:__tmux-format' \
+ '-N[start without the preview]' \
+ '-F+[specify format for each list item]:format:__tmux-formats' \
+ '-f+[filter items]:filter format:__tmux-formats' \
+ '-O+[initial sort order]:order:(time name size)' \
'-t+[specify target window]:session:__tmux-windows' \
- '*:::template:_tmux'
+ '*:::template:= _tmux'
}
_tmux-choose-client() {
[[ -n ${tmux_describe} ]] && print "put a window into client choice mode" && return
_arguments -s \
- '-F+[specify output format]:format:__tmux-format' \
- '-t+[specify target window]:session:__tmux-windows' \
- '*:::template:_tmux'
-}
-
-_tmux-choose-session() {
- [[ -n ${tmux_describe} ]] && print "put a window into session choice mode" && return
- _arguments -s \
- '-F+[specify output format]:format:__tmux-format' \
+ '-N[start without the preview]' \
+ '-F+[specify format for each list item]:format:__tmux-formats' \
+ '-f+[filter items]:filter format:__tmux-formats' \
+ '-O+[initial sort order]:order:(time name size)' \
'-t+[specify target window]:session:__tmux-windows' \
- '*:::template:_tmux'
+ '*:::template:= _tmux'
}
_tmux-choose-tree() {
[[ -n ${tmux_describe} ]] && print "put a window into tree choice mode" && return
_arguments -s \
- '-b+[override default session command]:session-command' \
- '-c+[override default window command]:window-command' \
- '-S+[specify session format]:session-format:__tmux-formats' \
+ '-N[start without the preview]' \
+ '-F+[specify format for each list item]:format:__tmux-formats' \
+ '-f+[filter items]:filter format:__tmux-formats' \
+ '-O+[initial sort order]:order:(time name size)' \
'-s[choose among sessions]' \
'-t+[specify target window]:session:__tmux-windows' \
- '-u[show generated tree uncollapsed at startup]' \
- '-W+[specify window format]:window-format:__tmux-formats' \
'-w[choose among windows]' \
- '*:::template:_tmux'
-}
-
-_tmux-choose-window() {
- [[ -n ${tmux_describe} ]] && print "put a window into window choice mode" && return
- _arguments -s \
- '-F=[specify output format]:format:__tmux-format' \
- '-t+[specify target window]:session:__tmux-windows' \
- '*:::template:_tmux'
+ '*:::template:= _tmux'
}
_tmux-clear-history() {
@@ -270,10 +258,13 @@ _tmux-clock-mode() {
_tmux-command-prompt() {
[[ -n ${tmux_describe} ]] && print "open the tmux command prompt in a client" && return
_arguments -s \
+ '-1[only accept one key press]' \
+ '-N' \
+ '-i[execute the command every time the prompt input changes]' \
'-I+[specify list of initial inputs]:initial-text (comma-separated list)' \
'-p+[specify list of prompts]:prompts (comma-separated list)' \
'-t+[specify target client]:client:__tmux-clients' \
- '*:::template:_tmux'
+ '*:::template:= _tmux'
}
_tmux-confirm-before() {
@@ -281,7 +272,7 @@ _tmux-confirm-before() {
_arguments -s \
'-p+[specify prompt]:prompt string' \
'-t+[specify target client]:client:__tmux-clients' \
- '*:::command:_tmux'
+ '*:::command:= _tmux'
}
_tmux-copy-mode() {
@@ -302,7 +293,8 @@ _tmux-detach-client() {
_arguments -s \
'-a[kill all clients except for the named by -t]' \
'-P[send SIGHUP to parent process]' \
- '-s+[specify target session and kill its clients]:session:__tmux-sessions' \
+ '-E+[run specified shell command to replace the client]:shell command:_cmdstring' \
+ '-s+[specify target session and kill its clients]:session:__tmux-sessions-attached' \
'-t+[specify target client]:client:__tmux-clients'
}
@@ -312,20 +304,22 @@ _tmux-display-message() {
'-c+[specify target client]:client:__tmux-clients' \
'-p[print message to stdout]' \
'-t+[specify target client]:client:__tmux-clients' \
- '-F+[specify output format]:format:__tmux-format' \
+ '-F+[specify output format]:format:__tmux-formats' \
':message'
}
_tmux-display-panes() {
[[ -n ${tmux_describe} ]] && print "display an indicator for each visible pane" && return
- _arguments '-t+[specify target client]:client:__tmux-clients'
+ _arguments -S \
+ '-d+[time to show indicator for]:duration (ms)' \
+ '-t+[specify target client]:client:__tmux-clients' \
+ '*:::command:= _tmux'
}
_tmux-find-window() {
[[ -n ${tmux_describe} ]] && print "search for a pattern in windows" && return
_arguments -s \
'-C[match visible contents]' \
- '-F+[specify output format]:format:__tmux-format' \
'-N[match window name]' \
'-T[match window title]' \
'-t+[specify target window]:window:__tmux-windows' \
@@ -417,13 +411,13 @@ _tmux-link-window() {
_tmux-list-buffers() {
[[ -n ${tmux_describe} ]] && print "list paste buffers of a session" && return
- _arguments '-F+[specify output format]:format:__tmux-format'
+ _arguments '-F+[specify output format]:format:__tmux-formats'
}
_tmux-list-clients() {
[[ -n ${tmux_describe} ]] && print "list clients attached to server" && return
_arguments -s \
- '-F+[specify output format]:format:__tmux-format' \
+ '-F+[specify output format]:format:__tmux-formats' \
'-t+[specify session]:session:__tmux-sessions'
}
@@ -435,7 +429,6 @@ _tmux-list-commands() {
_tmux-list-keys() {
[[ -n ${tmux_describe} ]] && print "list all key-bindings" && return
_arguments -s \
- '-t+[specify mode table]:mode table:__tmux-mode-tables' \
'-T+[specify key table]:key table'
}
@@ -449,20 +442,20 @@ _tmux-list-panes() {
fi
_arguments -s $args \
'-a[list all panes the server possesses]' \
- '-F+[specify output format]:format:__tmux-format' \
+ '-F+[specify output format]:format:__tmux-formats' \
'-s[if specified, -t chooses a session]'
}
_tmux-list-sessions() {
[[ -n ${tmux_describe} ]] && print "list sessions managed by server" && return
- _arguments '-F+[specify output format]:format:__tmux-format'
+ _arguments '-F+[specify output format]:format:__tmux-formats'
}
_tmux-list-windows() {
[[ -n ${tmux_describe} ]] && print "list windows of a session" && return
_arguments -s \
'-a[list all windows the tmux server possesses]' \
- '-F[specify output format]:format:__tmux-format' \
+ '-F[specify output format]:format:__tmux-formats' \
'-t+[specify session]:session:__tmux-sessions'
}
@@ -519,7 +512,7 @@ _tmux-new-session() {
"-d[don't attach new session to current terminal]" \
"-D[in case of -A behave like attach-session's -d]" \
"-E[don't apply update-environment option]" \
- '-F+[specify output format]:format:__tmux-format' \
+ '-F+[specify output format]:format:__tmux-formats' \
'-n+[specify initial window name]:window name' \
'-P[print information about new session after it is created]' \
'-s+[name the session]:session name:__tmux-sessions' \
@@ -535,7 +528,7 @@ _tmux-new-window() {
'-a[insert new window at next free index from -t]' \
'-c+[specify working directory for the session]:directory:_directories' \
"-d[don't make the new window become the active one]" \
- '-F+[specify output format]:format:__tmux-format' \
+ '-F+[specify output format]:format:__tmux-formats' \
'-k[destroy it if the specified window exists]' \
'-n+[specify a window name]:window name' \
'-P[print information about new window after it is created]' \
@@ -626,6 +619,7 @@ _tmux-resize-pane() {
_tmux-respawn-pane() {
[[ -n ${tmux_describe} ]] && print "reuse a pane in which a command has exited" && return
_arguments -s -A "-*" -S \
+ '-c+[specify a new working directory for the pane]:directory:_directories' \
'-k[kill window if it is in use]' \
'-t+[specify target pane]:pane:__tmux-pane' \
':command:_cmdambivalent'
@@ -634,6 +628,7 @@ _tmux-respawn-pane() {
_tmux-respawn-window() {
[[ -n ${tmux_describe} ]] && print "reuse a window in which a command has exited" && return
_arguments -s -A "-*" -S \
+ '-c+[specify a new working directory for the window]:directory:_directories' \
'-k[kill window if it is in use]' \
'-t+[specify target window]:window:__tmux-windows' \
':command:_cmdambivalent'
@@ -686,6 +681,7 @@ _tmux-select-pane() {
'-R[move to the pane right of target]' \
'-U[move to the pane above target]' \
'-P+[set pane style]:style:__tmux-style' \
+ '-T+[set the pane title]:title' \
'-t+[specify target pane]:pane:__tmux-panes'
}
@@ -705,6 +701,8 @@ _tmux-send-keys() {
'-l[disable key name lookup and send data literally]' \
'-R[reset terminal state]' \
'-M[pass through a mouse event]' \
+ '-X[send a command into copy mode]' \
+ '-N+[specify repeat count]:repeat count' \
'-t+[specify target pane]:pane:__tmux-panes' \
'*:key'
}
@@ -732,12 +730,33 @@ _tmux-set-buffer() {
_tmux-set-environment() {
[[ -n ${tmux_describe} ]] && print "(un)set an environment variable" && return
- _arguments -s -A "-*" -S \
- '-g[modify global environment]' \
- '-r[remove variable before starting new processes]' \
- '-u[unset a variable]' \
- '-t[specify target session]:target session:__tmux-sessions' \
- ':name' ':value'
+ local mode=session action=add
+ local curcontext="$curcontext" state line ret=1
+ typeset -A opt_args
+ _arguments -C -s -A "-*" -S : \
+ '(-t)-g[modify global environment]' \
+ '(-u)-r[remove variable before starting new processes]' \
+ '(-r)-u[unset a variable]' \
+ '(-g)-t[specify target session]:target session:__tmux-sessions' \
+ ': :->name' '(-u -r)2: :->value' && ret=0
+
+ if (( ${+opt_args[-g]} )); then
+ mode=global
+ fi
+ if (( ${+opt_args[-u]} )); then
+ action=unset
+ fi
+ if (( ${+opt_args[-r]} )); then
+ action=remove
+ fi
+
+ # TODO: the exclusion "(-g -r)2:" doesn't work, so simulate it here
+ if [[ $action == (remove|unset) ]] && [[ $state == value ]]; then
+ __tmux-nothing-else
+ else
+ __tmux-environment-variables $mode $state $action && ret=0
+ fi
+ return ret
}
_tmux-set-option() {
@@ -745,8 +764,9 @@ _tmux-set-option() {
local mode=session
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
- _arguments -C -s \
+ _arguments -C -s : \
'-a[append to string options]' \
+ '-F[expand formats in the option value]' \
'-g[set a global session option]' \
'-o[prevent setting of an option that is already set]' \
'-q[suppress errors about unknown or ambiguous options]' \
@@ -769,8 +789,9 @@ _tmux-set-window-option() {
[[ -n ${tmux_describe} ]] && print "set a window option" && return
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
- _arguments -C -s \
+ _arguments -C -s : \
'-a[append to string options]' \
+ '-F[expand formats in the option value]' \
'-g[set a global window option]' \
'-o[prevent setting of an option that is already set]' \
'-q[suppress errors about unknown or ambiguous options]' \
@@ -785,8 +806,10 @@ _tmux-set-hook() {
[[ -n ${tmux_describe} ]] && print "set a hook to a command" && return
_arguments -s \
'-g[add hook to global list]' \
- '-t+[specify target session]:session:__tmux-sessions'
- ':command'
+ '-u[unset a hook]' \
+ '-t+[specify target session]:session:__tmux-sessions' \
+ ':hook name:_tmux_hooks' \
+ '*:::command:= _tmux'
}
_tmux-show-hooks() {
@@ -794,7 +817,6 @@ _tmux-show-hooks() {
_arguments -s -S -A "-*" \
'-g[show global list of hooks]' \
'-t+[specify target session]:session:__tmux-sessions' \
- ':hook name:(alert-activity alert-bell alert-silence client-attached client-detached client-resized pane-died pane-exited)' \
}
_tmux-show-buffer() {
@@ -804,10 +826,21 @@ _tmux-show-buffer() {
_tmux-show-environment() {
[[ -n ${tmux_describe} ]] && print "display the environment" && return
- _arguments -s \
- '-g[show global environment]' \
+ local mode=session
+ local curcontext="$curcontext" state line ret=1
+ typeset -A opt_args
+ _arguments -C -A "-*" -s : \
+ '(-t)-g[show global environment]' \
'-s[format output as Bourne shell commands]' \
- '-t+[specify target session]:target session:__tmux-sessions'
+ '(-g)-t+[specify target session]:target session:__tmux-sessions' \
+ '1:: :->name' && ret=0
+
+ if (( ${+opt_args[-g]} )); then
+ mode=global
+ fi
+
+ __tmux-environment-variables $mode $state show && ret=0
+ return ret
}
_tmux-show-messages() {
@@ -820,21 +853,38 @@ _tmux-show-messages() {
_tmux-show-options() {
[[ -n ${tmux_describe} ]] && print "show session options" && return
- _arguments -s \
+ local mode=session
+ local curcontext="$curcontext" state line ret=1
+ typeset -A opt_args
+ _arguments -C -s : \
'-g[show global options]' \
'-q[suppress errors about unknown or ambiguous options]' \
'-s[show server options]' \
'-v[show only the option value, not the name]' \
'-w[show window options]' \
- '-t+[specify target session]:target session:__tmux-sessions'
+ '-t+[specify target session]:target session:__tmux-sessions' \
+ '*:: :->name_or_value' && ret=0
+
+ if (( ${+opt_args[-w]} )); then
+ mode=window
+ elif (( ${+opt_args[-s]} )); then
+ mode=server
+ fi
+ __tmux-options-complete ${mode} ${state} && ret=0
+ return ret
}
_tmux-show-window-options() {
[[ -n ${tmux_describe} ]] && print "show window options" && return
- _arguments -s \
+ local curcontext="$curcontext" state line ret=1
+ typeset -A opt_args
+ _arguments -C -s : \
'-g[show global options]' \
'-v[show only the option value, not the name]' \
- '-t+[specify target window]:target window:__tmux-windows'
+ '-t+[specify target window]:target window:__tmux-windows' \
+ '*:: :->name_or_value' && ret=0
+ __tmux-options-complete window ${state} && ret=0
+ return ret
}
_tmux-source-file() {
@@ -849,7 +899,8 @@ _tmux-split-window() {
_arguments -s \
'-b[create new pane left of or above target pane]' \
"-d[don't make the new window become the active one]" \
- '-F+[specify output format]:format:__tmux-format' \
+ '-F+[specify output format]:format:__tmux-formats' \
+ '-f[create new pane spanning full window width or height]' \
'-h[split horizontally]' \
'-v[split vertically]' \
"-l[define new pane's size]:size" \
@@ -910,9 +961,7 @@ _tmux-unbind-key() {
ow=( "${words[@]}" )
_arguments -C -s \
'-a[remove all key bindings]' \
- '-c[kill the window if it is only in one session]' \
'-n[remove a non-prefix binding]' \
- '-t+[specify mode table]:mode table:__tmux-mode-tables' \
'-T[specify key table]:key table' \
'*:: :->boundkeys'
@@ -980,8 +1029,65 @@ function __tmux-clients() {
_describe -t clients 'clients' clients
}
-function __tmux-format() {
- _message 'not implemented yet'
+function __tmux-environment-variables() {
+ local mode="$1" state="$2" action="$3"
+
+ local -a dash_g
+ case $mode in
+ (global) dash_g=(-g);;
+ (session) dash_g=();;
+ (*) return 1;; # bug in the caller
+ esac
+
+ local hint
+ case $action in
+ (add|remove) hint=" (or specify a new one)";;
+ (unset|show) hint="";;
+ (*) return 1;; # bug in the caller
+ esac
+
+ case ${state} in
+ (name)
+ local -a vars_and_vals=( ${(@f)"$(command tmux 2>/dev/null show-env $dash_g)"} )
+ local -a descriptions
+ local k_v k v
+ for k_v in $vars_and_vals; do
+ k=${k_v%%=*}
+ if [[ $k == -* ]]; then
+ k=${k#-}
+ v='(remove)'
+ else
+ v=${k_v#*=}
+ fi
+ descriptions+=( "${k//:/\\:}:$v" )
+ done
+ # TODO: this if/else is because '_describe ${hint:+"-x"}' prints the "No matches" error in addition to the message.
+ local msg="${dash_g[1]:+"global "}environment variables${hint}"
+ if _describe -t parameters $msg descriptions; then
+ :
+ elif [[ -n $hint ]]; then
+ _message $msg
+ fi
+ ;;
+ (value)
+ local var_and_val=${(@f)"$(command tmux 2>/dev/null show-env $dash_g -- ${(Q)words[-2]})"}
+ # TODO: this if/else is because '_description -x' prints the "No matches" error in addition to the message.
+ if [[ -n $var_and_val ]]; then
+ local -a expl
+ _description -x parameter-values expl "Value for ${words[-2]}"
+ compadd "$expl[@]" - ${var_and_val#*=}
+ else
+ _message "Value for ${words[-2]}"
+ fi
+ ;;
+ (*)
+ return 1
+ ;;
+ esac
+}
+
+__tmux-formats() {
+ _message 'not implemented yet'
}
function __tmux-colours() {
@@ -995,6 +1101,12 @@ function __tmux-colours() {
fi
}
+_tmux_hooks() {
+ _alternative \
+ 'hooks:hook name:(alert-activity alert-bell alert-silence client-attached client-detached client-resized client-session-changed pane-died pane-exited pane-set-clipboard session-created session-closed session-renamed window-linked window-renamed window-unlinked)' \
+ 'post-hooks:command post-hook:compadd - after-${_tmux_aliasmap}'
+}
+
function __tmux-get-optarg() {
local opt="$1"
local -i i
@@ -1010,12 +1122,6 @@ function __tmux-get-optarg() {
done
}
-__tmux-mode-tables() {
- local expl
- _description mode-tables expl 'mode table'
- compadd "$@" "$expl[@]" vi-edit emacs-edit vi-choice emacs-choice vi-copy emacs-copy
-}
-
__tmux-nothing-else() {
_message "no further arguments"
}
@@ -1260,6 +1366,32 @@ function __tmux-sessions() {
_describe -t sessions 'sessions' sessions "$@"
}
+function __tmux-sessions-attached() {
+ local -a sessions
+ sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
+ sessions=( ${(M)sessions:#*"(attached)"} )
+ _describe -t sessions 'attached sessions' sessions "$@"
+}
+
+# Complete attached-sessions and detached-sessions as separate tags.
+function __tmux-sessions-separately() {
+ local ret=1
+ local -a sessions detached_sessions attached_sessions
+ sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
+ detached_sessions=( ${sessions:#*"(attached)"} )
+ attached_sessions=( ${(M)sessions:#*"(attached)"} )
+
+ # ### This seems to work without a _tags loop but not with it. I suspect
+ # ### that has something to do with _describe doing its own _tags loop.
+ _tags detached-sessions attached-sessions
+ # Placing detached before attached means the default behaviour of this
+ # function better suits its only current caller, _tmux-attach-session().
+ _requested detached-sessions && _describe -t detached-sessions 'detached sessions' detached_sessions "$@" && ret=0
+ _requested attached-sessions && _describe -t attached-sessions 'attached sessions' attached_sessions "$@" && ret=0
+
+ return ret
+}
+
function __tmux-socket-name() {
local expl sdir
local curcontext="${curcontext}"
diff --git a/Completion/Unix/Command/_todo.sh b/Completion/Unix/Command/_todo.sh
index eb0be55e5..287c9ff78 100644
--- a/Completion/Unix/Command/_todo.sh
+++ b/Completion/Unix/Command/_todo.sh
@@ -17,12 +17,24 @@ local -a cmdlist itemlist match mbegin mend
integer NORMARG
_arguments -s -n : \
+ '-@[hide context names]' \
+ '-\+[hide project names]' \
+ '-c[color mode]' \
'-d[alternate config file]:config file:_files' \
'-f[force, no confirmation]' \
'-h[display help]' \
'-p[plain mode, no colours]' \
+ '-P[hide priority labels]' \
+ "-a[don't auto-archive tasks when done]" \
+ '-A[auto-archive tasks when done]' \
+ '-n[automatically remove blank lines]' \
+ '-N[preserve line numbers]' \
+ '-t[add current date to task on creation]' \
+ "-T[don't add current date to task]" \
'-v[verbose mode, confirmation messages]' \
+ '-vv[extra verbose (debug)]' \
'-V[display version etc.]' \
+ '-x[disable final filter]' \
'1:command:->commands' \
'*:arguments:->arguments' && return 0
diff --git a/Completion/Unix/Command/_tr b/Completion/Unix/Command/_tr
index d55fab5ff..1cfe1200a 100644
--- a/Completion/Unix/Command/_tr
+++ b/Completion/Unix/Command/_tr
@@ -1,7 +1,7 @@
-#compdef tr
+#compdef tr gtr
local curcontext="$curcontext" state line expl ret=1
-local args variant
+local args variant k
local -A descr
descr=(
-c '[complement characters specified by first string]'
@@ -28,7 +28,7 @@ case $variant in
;|
*)
for k in c d s; do
- args+=( -$k$descr[$k] )
+ args+=( -$k$descr[-$k] )
done
;;
esac
diff --git a/Completion/Unix/Command/_tracepath b/Completion/Unix/Command/_tracepath
deleted file mode 100644
index eb49e567d..000000000
--- a/Completion/Unix/Command/_tracepath
+++ /dev/null
@@ -1,5 +0,0 @@
-#compdef tracepath tracepath6
-
-_arguments \
- ':destination:_hosts' \
- ':port:_ports'
diff --git a/Completion/Unix/Command/_truss b/Completion/Unix/Command/_truss
index 656c94244..b798f03cb 100644
--- a/Completion/Unix/Command/_truss
+++ b/Completion/Unix/Command/_truss
@@ -15,6 +15,9 @@ args=(
)
case $OSTYPE in
+ solaris2.<11->)
+ args+=( '(-c)-A[include absolute timestamps in output]' )
+ ;|
aix*|solaris*)
args+=(
'(-c)-E[include delta timestamps of time spent within the system call]'
@@ -40,6 +43,9 @@ case $OSTYPE in
"(-c)-S[don't report signals received by the process]"
'(*)-p[trace specified existing processes]:pid:_pids'
)
+ ;|
+ freebsd<10->.*)
+ args+=( '-H[include thread ID in the output of each event]' )
;;
esac
diff --git a/Completion/Unix/Command/_uname b/Completion/Unix/Command/_uname
index 414a82a87..31af91eb7 100644
--- a/Completion/Unix/Command/_uname
+++ b/Completion/Unix/Command/_uname
@@ -1,4 +1,4 @@
-#compdef uname
+#compdef uname guname
typeset -A _uname_args
local -a args
diff --git a/Completion/Unix/Command/_unexpand b/Completion/Unix/Command/_unexpand
index c983c628f..b548b3c3a 100644
--- a/Completion/Unix/Command/_unexpand
+++ b/Completion/Unix/Command/_unexpand
@@ -1,26 +1,37 @@
-#compdef unexpand
+#compdef unexpand gunexpand expand gexpand
-local all tabs ret=1
+local all tabs
local -a args
all="convert all whitespace, instead of just initial whitespace"
-tabs="use comma separated list of tab positions"
-args=(
- "(--all)-a[$all]"
- "(--tabs)-t[$tabs]:tablist"
- "*:file:_files"
-)
+tabs="[use comma separated list of tab positions]:list of tab positions"
if _pick_variant gnu="Free Soft" unix --version; then
- args+=(
- "(-a)--all[$all]"
- "--first-only[convert only leading sequences of whitespace]"
- "(-t)--tabs=[$tabs]:tablist"
- "(* -)--help[display help message and exit]"
- "(* -)--version[output version information and exit]"
+ if [[ $service = *un* ]]; then
+ args=(
+ "(-a --help --version)--all[$all]"
+ '(--help --version)--first-only[convert only leading sequences of whitespace]'
)
+ else
+ args=(
+ '(-i --initial --help --version)'{-i,--initial}"[don't convert tabs after non blanks]"
+ )
+ fi
+
+ args+=(
+ "(-t --help --version)--tabs=${tabs}"
+ '(* -)--help[display usage information]'
+ '(* -)--version[display version information]'
+ )
+elif [[ $OSTYPE = (*bsd*|dragonfly*|darwin*) ]]; then
+ args=( -A "-*" )
fi
+[[ $service = *un* ]] && args+=( "(--all --help --version)-a[$all]" )
-_arguments "$args[@]" && ret=0
+# Most (un)expand variants, excluding BusyBox, allow e.g. -4 instead of -t4
+[[ $_cmd_variant[$service] == *busybox* ]] ||
+args+=( '!(-0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -t --tabs)-'{0..9} )
-return ret
+_arguments -s -S "$args[@]" \
+ "(--tabs --help)-t+${tabs}" \
+ '*:file:_files'
diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim
index 9fd2d63e8..042974338 100644
--- a/Completion/Unix/Command/_vim
+++ b/Completion/Unix/Command/_vim
@@ -1,4 +1,4 @@
-#compdef vim gvim gex gview nvim rvim rview rgvim rgview evim eview vimdiff gvimdiff
+#compdef vim gvim gex gview nvim rvim rview rgvim rgview evim eview vimdiff gvimdiff mvim
(( $+functions[_vim_files] )) ||
_vim_files () {
@@ -40,6 +40,7 @@ arguments=(
'(-A -H )-F[start in Farsi mode]'
'-T[set terminal type]:::_terminals'
'--not-a-term[skip warning for input/output not being a terminal]'
+ '--ttyfail[exit if input or output is not a terminal]'
'-u[use given vimrc file instead of default .vimrc]::rc file:_files'
"--noplugin[don't load plugin scripts]"
'-o-[number of windows to open (default: one for each file)]::window count: '
@@ -70,10 +71,12 @@ arguments=(
'--startuptime[write startup timing messages to given file]:log file:_files'
'--socketid[run GVIM in another window]'
'-i[use specified viminfo file]:viminfo file [~/.viminfo]:_files'
+ '--clean[defaults, no plugins, no viminfo]'
'(- *)'{-h,--help}'[print help and exit]'
'(- *)--version[print version information and exit]'
'(* -q)-t[edit file where tag is defined]:tag:_complete_tag'
'(-t -q)*:file:_vim_files'
+ '--clean[start with defaults in non-compatible mode]'
)
[[ $service != *g* ]] && arguments+='-g[start with GUI]'
[[ $service != r* ]] && arguments+='-Z[restricted mode]'
@@ -99,7 +102,7 @@ if [[ "$state" = server ]]; then
elif [[ $state = verbosity ]]; then
_tags numbers files
while _tags; do
- _requested numbers && _describe 'verbosity [10]' "(
+ _requested numbers && _describe -V 'verbosity [10]' "(
0:don\'t' display any messages'
1:'display when viminfo file is read or written'
2:'display sourced files'
diff --git a/Completion/Unix/Command/_vorbis b/Completion/Unix/Command/_vorbis
index eee4f7a5e..cb3e3f9d8 100644
--- a/Completion/Unix/Command/_vorbis
+++ b/Completion/Unix/Command/_vorbis
@@ -79,7 +79,7 @@ case $service in
esac
if [[ $state = devopts ]]; then
- if compset -p '*:'; then
+ if compset -P '*:'; then
_message -e value value
else
_wanted devopts expl 'device option' \
diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget
index 8a9cc871a..1a7e2d0a3 100644
--- a/Completion/Unix/Command/_wget
+++ b/Completion/Unix/Command/_wget
@@ -1,6 +1,6 @@
#compdef wget
-local curcontext="$curcontext" state line
+local curcontext="$curcontext" state line expl
typeset -A opt_args
_arguments -C -s \
@@ -19,12 +19,15 @@ _arguments -C -s \
'(--force-html -F)'{--force-html,-F}'[treat input file as html]' \
'(--base -B)'{--base=,-B+}'[prepend URL to relative links]:base URL:_urls' \
'--config=[specify config file]:config file:_files' \
+ '(--config)--no-config' '--rejected-log=:file:_files' \
'(--tries -t)'{--tries=,-t+}'[set number of retries]:number of retries' \
'--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]' \
+ '--start-pos=:offset' '--show-progress' \
'--progress=[set progress gauge type]:gauge type:->gauge' \
'(--timestamping -N)'{--timestamping,-N}'[retrieve only files newer than existing]' \
+ '--no-if-modified-since' \
"--no-use-server-timestamps[don't set the local file's timestamp by the one on the server]" \
'(--server-response -S)'{--server-response,-S}'[print server response]' \
"--spider[don't download anything]" \
@@ -49,11 +52,15 @@ _arguments -C -s \
'(--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]' \
+ '--use-askpass=:command:_command_names -e' \
'--no-iri[turn off IRI support]' \
'--local-encoding=[specify local encoding for IRIs]:encoding' \
'--remote-encoding=[specify default remote encoding]:encoding' \
'--unlink[remove file before clobber]' \
+ '--no-xattr[turn off storage of metadata in extended file attributes]' \
+ '(-nd --no-directories)'{-nd,--no-directories}"[don't create directories]" \
'(--force-directories -x)'{--force-directories,-x}'[force creation of directories]' \
+ '(-nH --no-host-directories)'{-nH,--no-host-directories}"[don't create host directories]" \
'--protocol-directories[use protocol name in directories]' \
'(--directory-prefix -P)'{--directory-prefix=,-P+}'[specify prefix to save files to]:prefix:_files -/' \
'--cut-dirs=:number:' \
@@ -64,6 +71,7 @@ _arguments -C -s \
'(--adjust-extension -E)'{--adjust-extension,-E}'[save all HTML/CSS documents with proper extensions]' \
"--ignore-length[ignore \`Content-Length' header field]" \
'*--header=[send a custom HTTP header]:header:->header' \
+ '--compression=:compression:(auto gzip none)' \
'--max-redirect=:number' \
'--proxy-user=:user' \
'--proxy-password=:password' \
@@ -83,7 +91,7 @@ _arguments -C -s \
'--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)' \
+ '--secure-protocol=[choose secure protocol]:protocol:(SSLv2 SSLv3 TLSv1 TLSv1_1 TLSv1_2 PFS)' \
--https-only \
"--no-check-certificate=[don't check the server certificate]" \
'--certificate=[specify client certificate]:client certificate file:_files' \
@@ -92,15 +100,20 @@ _arguments -C -s \
'--private-key-type=[specify private key type]:key type:key type:(PEM DER)' \
"--ca-certificate=[specify file with bundle of CA's]:file:_files" \
"--ca-directory=[specify dir where hash list of CA's are stored]:directory:_directories" \
+ '--crl-file=[specify file with bundle of CRLs]:file:_files' \
+ '--pinnedpubkey=:file:_files' \
'--random-file[specify file with random data for seeding generator]:file:_files' \
'--egd-file=[specify filename of EGD socket]:file:_files' \
+ '--no-hsts[disable HSTS]' \
+ '--hsts-file[specify path of HSTS database]:file:_files' \
'(--user)--ftp-user=:user' \
'(--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' \
'--preserve-permissions[preserve remote file permissions with ftp]' \
- '--retr-symlinks' \
+ --retr-symlinks --ftps-implicit --ftps-resume-ssl \
+ --ftps-clear-data-connection --ftps-fallback-to-ftp \
'--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 \
@@ -108,6 +121,7 @@ _arguments -C -s \
'(--level -l)'{--level=,-l+}'[specify maximum recursion depth]:level' \
'--delete-after' \
'(--convert-links -k)'{--convert-links,-k}'[convert links to be relative]' \
+ --convert-file-only \
'--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)]' \
@@ -129,8 +143,7 @@ _arguments -C -s \
'(-np --no-parent)'{-np,--no-parent}"[don't ascend to parent directory]" \
'--no-verbose' \
'--no-clobber' \
- '--no-directories' \
- '--no-host-directories' \
+ '--no-netrc' \
'--no-use-server-timestamps[do not set timestamp to server provided value]' \
'--htmlify=:htmlify:' \
'--no:no:->noflags' \
@@ -154,10 +167,15 @@ case "$state" in
_values -s , 'filename char restriction' \
'(windows)unix' \
'(unix)windows' \
- '(unix windows)nocontrol'
+ '(unix windows)nocontrol' \
+ ascii \
+ '(uppercase)lowercase' \
+ '(lowercase)uppercase'
;;
header)
local -a headers
+ local suf=': '
+ compquote suf
headers=(
Accept{,-{Charset,Encoding,Language,Datetime}}
Authorization
@@ -191,7 +209,6 @@ case "$state" in
X-ATT-DeviceId
X-Wap-Profile
)
- headers=($^headers\\:\ )
- _describe -t header 'HTTP header' headers
+ _wanted headers expl 'HTTP header' compadd -S $suf -a headers
;;
esac
diff --git a/Completion/Unix/Command/_whois b/Completion/Unix/Command/_whois
index 2dd04f9cd..a8180f60e 100644
--- a/Completion/Unix/Command/_whois
+++ b/Completion/Unix/Command/_whois
@@ -1,6 +1,7 @@
#compdef whois fwhois
_whois () {
+ local _whois_comp
_whois_setup
case "$0" in
fwhois) _whois_fwhois;;
diff --git a/Completion/Unix/Command/_xmlstarlet b/Completion/Unix/Command/_xmlstarlet
new file mode 100644
index 000000000..4c8257046
--- /dev/null
+++ b/Completion/Unix/Command/_xmlstarlet
@@ -0,0 +1,177 @@
+#compdef xmlstarlet xml
+
+local curcontext="$curcontext" ret=1
+local -a args state line suf
+
+args=( '(- *)--help[display usage information]' )
+_arguments -C -A "-*" $args \
+ '(-q --quiet)'{-q,--quiet}'[no error output]' \
+ "--no-doc-namespace[don't extract namespace bindings from input doc]" \
+ '!(--no-doc-namespace)--doc-namespace' \
+ '(-)--version[display version information]' \
+ '1:command:((
+ ed{,it}\:edit\ or\ update\ documents
+ sel{,ect}\:select\ date\ or\ query\ documents
+ tr{,ransform}\:transform\ documents\ using\ XSLT
+ val{,idate}\:validate\ documents
+ fo{,rmat}\:format\ documents
+ el{,ements}\:display\ element\ structure
+ {c14n,canonic}\:XML\ canonicalization
+ l{s,ist}\:list\ directory\ as\ XML
+ esc{,ape}\:escape\ special\ XML\ characters
+ unesc{,ape}\:unescape\ special\ XML\ characters
+ {pyx,xmln}\:convert\ XML\ into\ the\ line-oriented\ PYX\ format
+ {p2x,depyx}\:convert\ PYX\ into\ XML
+ ))' \
+ '*: :->args' && ret=0
+
+if [[ -n $state ]]; then
+ shift words
+ (( CURRENT-- ))
+ curcontext="${curcontext%:*:*}:$service-${words[1]}:"
+ case $words[1] in
+ el(|ements)|fo(|rmat)|sel(|ect)|c14n|canonic|xmln|pyx)
+ args+=( '1:file:_files -g "(#i)*.xml(-.)"' )
+ ;|
+ ed(|it)|sel(|ect))
+ args+=( '*-N[predefine namespaces]:namespace' )
+ ;|
+ c14n|canonic|ed(|it)|fo(|rmat)|sel(|ect)|tr(|ansform)|val(|idate))
+ args+=( '--net[allow fetching of DTDs or entities over network]' )
+ ;|
+ fo(|rmat)|tr(|ansform))
+ args+=( '(-o --omit-decl)'{-o,--omit-decl}'[omit XML declaration]' )
+ ;|
+
+ ed(|it))
+ args=(
+ '(opt)*'{-d,--delete}'[remove element]:xpath expression'
+ '(opt)*'{-i,--insert}'[add element before node matched by expression]:xpath expression - insert before matched node'
+ '(opt)*'{-a,--append}'[add element after node matched by expression]:xpath expression - insert after matched node'
+ '(opt)*'{-s,--subnode}'[add element as a child of node matched by expression]:xpath expression for parent modes'
+ '(opt)*'{-m,--move}'[move element]:xpath expression: :xpath expression'
+ '(opt)*'{-r,--rename}'[rename element]:xpath expression'
+ '(opt)*'{-u,--update}'[update element]:xpath expression'
+ '*:file:_files -g "(#i)*.xml(-.)"'
+ + opt $args
+ '(-P -S --pf --ps)'{-P,-S,--pf,--ps}'[preserve whitespace nodes]'
+ '(-O --omit-decl)'{-O,--omit-decl}'[omit XML declaration]'
+ '(-L --inplace)'{-L,--inplace}'[edit file inplace]'
+ )
+ if [[ -n ${${words[2,CURRENT-1]}[(r)-([ias]|-insert|-append|-subnode)]} ]]; then
+ args=(
+ '(opt)*'{-t,--type}'[specify type of node to add]:type:(elem text attr)'
+ '(opt)*'{-n,--name}'[specify name of node to add]:name'
+ $args
+ )
+ fi
+ if [[ -n ${${words[2,CURRENT-1]}[(r)-([iasru]|-insert|-append|-subnode|-rename|-update)]} ]]; then
+ args=( '(opt)*'{-v,--value}'[specify value of node to add or name of renamed node]:value' $args )
+ fi
+ ;;
+ el(|ements))
+ args+=(
+ '(-)-a[show attributes as well]'
+ '(-)-v[show attributes and their values]'
+ '(-)-u[print out sorted unique lines]'
+ '(-)-d-[print out sorted unique lines up to specified depth]:depth'
+ )
+ ;;
+ fo(|rmat))
+ args+=(
+ '(-t --indent-tab -s --indent-spaces -n --noindent)'{-n,--noindent}"[don't indent]"
+ '(-t --indent-tab -s --indent-spaces -n --noindent)'{-t,--indent-tab}'[indent output with tabs]'
+ '(-t --indent-tab -s --indent-spaces -n --noindent)'{-s,--indent-spaces}'[indent output with specified number of spaces]:spaces'
+ '(-R --recover)'{-R,--recover}'[try to recover what is parsable]'
+ '(-D --dropdtd)'{-D,--dropdtd}'[remove the DOCTYPE of the input docs]'
+ '(-C --nocdata)'{-C,--nocdata}'[replace cdata section with text nodes]'
+ '(-N --nsclean)'{-N,--nsclean}'[remove redundant namespace declarations]'
+ '(-e --encode)'{-e,--encode}'[output in the specified encoding]:encoding'
+ '(-H --html)'{-H,--html}'[input is HTML]'
+ )
+ ;;
+ sel(|ect))
+ [[ -n ${${words[2,CURRENT-1]}[(r)-t]} ]] && args+=(
+ \*{-c,--copy-of}'[print copy of XPath expression]:xpath expression'
+ \*{-v,--value-of}'[print value of XPath expression]:xpath expression'
+ \*{-o,--output}'[output string literal]:string'
+ \*{-n,--nl}'[print new line]'
+ \*{-f,--inp-name}'[print input file name (or URL)]'
+ \*{-m,--match}'[match XPath expression]:xpath expression'
+ \*{-v,--var}'[declare a variable]:variable'
+ \*{-i,--if,--elif}'[check condition]:condition'
+ '*--else[check if previous conditions failed]'
+ \*{-e,--elem}'[print out specified element]:element'
+ \*{-b,--break}'[break nesting]'
+ \*{-s,--sort}'[specify sort order]:order:->ordering:xpath expression'
+ )
+ args+=(
+ '(opt)*-t[start query template]'
+ + opt
+ '(-Q --quiet)'{-Q,--quiet}"[don't write anything to standard output]"
+ '(-C --comp)'{-C,--comp}'[display generated XSLT]'
+ '(-R --root)'{-R,--root}'[print root element]'
+ '(-T --text -e --elem)'{-T,--text}'[output is text]'
+ '(-I --indent)'{-I,--indent}'[indent output]'
+ '(-D --xml-decl)'{-D,--xml-decl}"[don't omit xml declaration line]"
+ '(-B --noblanks)'{-B,--noblanks}'[remove insignificant spaces from XML tree]'
+ '(-E --encode)'{-E,--encode}'[output in the specified encoding]:encoding'
+ )
+ ;;
+ tr(|ansform))
+ args+=(
+ '(--embed -E)'{--embed,-E}'[allow applying embedded stylesheet]'
+ '(1 * -)--show-ext[show list of extensions]'
+ '--val[allow validation against DTD or schema]'
+ '--xinclude[do XInclude processing on document input]'
+ '--maxdepth[increase the maximum depth]:val'
+ '--html[input is HTML]'
+ '1:xsl file:_files -g "(#i)*.xsl(|t)(-.)"'
+ '*:xml file:_files'
+ )
+ ;;
+ val(|idate))
+ args+=(
+ '!(-d --dtd -s --xsd -r --relaxng)'{-w,--well-formed}
+ '(-d --dtd -s --xsd -r --relaxng)'{-d,--dtd}'[validate against DTD]:file:_files -g "(#i)*.dtd(-.)"'
+ '(-d --dtd -s --xsd -r --relaxng)'{-s,--xsd}'[validate against XSD schema]:schema file:_files -g "(#i)*.xsd(-.)"'
+ '(-E --embed)'{-E,--embed}'[validate using embedded DTD]'
+ '(-d --dtd -s --xsd -r --relaxng)'{-r,--relaxng}'[validate against schema]:schema file:_files -g "(#i)*.rng(-.)"'
+ '(-e --err)'{-e,--err}'[print verbose error messages on stderr]'
+ '(-S --stop)'{-S,--stop}'[stop on first error]'
+ '(-b --list-bad -g --list-good)'{-b,--list-bad}"[list only files that don't validate]"
+ '(-b --list-bad -g --list-good -q --quiet)'{-g,--list-good}'[list only files that validate]'
+ '(-b --list-bad -g --list-good -q --quiet)'{-q,--quiet}"[don't list files (return result code only)]"
+ '*:file:_files -g "(#i)*.xml(-.)"'
+ )
+ ;;
+ c14n|canonic)
+ args+=(
+ '!(-)--with-comments'
+ '(-)--without-comments[XML file canonicalization without comments]'
+ '(-)--exc-with-comments[exclusive XML file canonicalization with comments]'
+ '(-)--exc-without-comments[exclusive XML file canonicalization without comments]'
+ '2:xpath file:_files'
+ '3:namespace prefix list'
+ )
+ ;;
+ (un|)esc(|ape)) args+=( '1: :_guard "^-*" string' ) ;;
+ ls|list) args+=( '1:path:_directories' ) ;;
+ depyx|p2x) args+=( '1:pyx file:_files' ) ;;
+ esac
+ _arguments -C -A "-*" $args && ret=0
+ case $state in
+ ordering)
+ compset -S ':*' || suf=( -S : )
+ if compset -P 2 '*:'; then
+ _describe -t case-order case-order '(U:upper-first L:lower-first)' && ret=0
+ elif compset -P 1 '*:'; then
+ _describe -t data-type data-type '(N:numeric T:text)' $suf && ret=0
+ else
+ _describe -t order order '(A:ascending D:descending)' $suf && ret=0
+ fi
+ ;;
+ esac
+fi
+
+return ret
diff --git a/Completion/Unix/Command/_yp b/Completion/Unix/Command/_yp
index 104a0b4df..ed3761436 100644
--- a/Completion/Unix/Command/_yp
+++ b/Completion/Unix/Command/_yp
@@ -1,25 +1,27 @@
#compdef ypcat ypmatch yppasswd ypwhich ypset ypserv ypbind yppush yppoll ypxfr domainname
-local curcontext="$curcontext" line state expl ret=1
+local curcontext="$curcontext" line state expl args ret=1
typeset -A opt_args
-if (( ! $+_yp_cache_maps )); then
- _yp_cache_maps=( "${(@)${(@f)$(_call_program maps ypwhich -m)}%% *}" )
- _yp_cache_nicks=( "${(@)${(@)${(@f)$(_call_program names ypwhich -x)}#*\"}%%\"*}" )
- _yp_args=(
- '(-x)-d[specify domain]:domain name' \
- '(-x)-k[display keys]' \
- '(-x)-t[inhibit nicknames]' \
- '(: -d -k -t)-x[display nicknames]' \
- )
+if (( ! $+_cache_yp_maps )); then
+ typeset -ga _cache_yp_maps _cache_yp_nicks
+ _cache_yp_maps=( "${(@)${(@f)$(_call_program maps ypwhich -m)}%% *}" )
+ _cache_yp_nicks=( "${(@)${(@)${(@f)$(_call_program names ypwhich -x)}#*\"}%%\"*}" )
fi
+args=(
+ '(-x)-d[specify domain]:domain name' \
+ '(-x)-k[display keys]' \
+ '(-x)-t[inhibit nicknames]' \
+ '(: -d -k -t)-x[display nicknames]' \
+)
+
case "$service" in
ypcat)
- _arguments -C -s "$_yp_args[@]" ':map name:->map' && ret=0
+ _arguments -C -s $args ':map name:->map' && ret=0
;;
ypmatch)
- _arguments -C -s "$_yp_args[@]" '::key map:->keymap' ':map name:->map' &&
+ _arguments -C -s $args '::key map:->keymap' ':map name:->map' &&
ret=0
;;
yppasswd)
@@ -96,9 +98,9 @@ if [[ "$state" = map* ]]; then
# The `-M ...' allows `pa.n<TAB>' to complete to `passwd.byname'.
_requested maps expl 'map name' \
compadd -M 'l:.|by=by l:.|=by r:|.=* r:|=*' -a \
- _yp_cache_maps && ret=0
+ _cache_yp_maps && ret=0
_requested nicknames expl nicknames \
- compadd -a _yp_cache_nicks && ret=0
+ compadd -a _cache_yp_nicks && ret=0
(( ret )) || return 0
done
elif [[ "$state" = servers ]]; then
diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs
index 553996da0..ce5df5877 100644
--- a/Completion/Unix/Command/_zfs
+++ b/Completion/Unix/Command/_zfs
@@ -6,7 +6,7 @@ _zfs() {
typeset -A opt_args
local -a subcmds rw_properties rw_propnames ro_properties create_properties
local -a share_nfs_ro_properties share_nfs_rw_properties
- local -a share_smb_ro_properties share_nfs_rw_properties
+ local -a share_smb_ro_properties share_smb_rw_properties
local -a share_ro_properties share_rw_properties
local -a difffields delegatable_perms
diff --git a/Completion/Unix/Type/_bpf_filters b/Completion/Unix/Type/_bpf_filters
index c62481e09..54e2172c9 100644
--- a/Completion/Unix/Type/_bpf_filters
+++ b/Completion/Unix/Type/_bpf_filters
@@ -1,3 +1,5 @@
+#autoload
+
# spaces are valid instead of word ends, perhaps better to just do compset -q
local -a networks fields dirs protos relop
diff --git a/Completion/Unix/Type/_directories b/Completion/Unix/Type/_directories
index 2125645fe..456af3b6c 100644
--- a/Completion/Unix/Type/_directories
+++ b/Completion/Unix/Type/_directories
@@ -1,4 +1,4 @@
-#compdef rmdir zf_rmdir dircmp -P -value-,*path,-default-
+#compdef rmdir grmdir zf_rmdir dircmp -P -value-,*path,-default-
local expl
diff --git a/Completion/Unix/Type/_dns_types b/Completion/Unix/Type/_dns_types
new file mode 100644
index 000000000..b6bc2e680
--- /dev/null
+++ b/Completion/Unix/Type/_dns_types
@@ -0,0 +1,8 @@
+#autoload
+
+local expl
+_description dns-types expl 'DNS type'
+compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z}' \
+ ANY A AAAA AFSDB APL AXFR CAA CDNSKEY CDS CERT CNAME DHCID DLV DNAME \
+ DNSKEY DS HIP HINFO IPSECKEY IXFR KEY KX LOC MX NAPTR NS NSEC NSEC3 \
+ NSEC3PARAM OPT PTR RRSIG RP SIG SOA SPF SRV SSHFP TA TKEY TLSA TSIG TXT
diff --git a/Completion/Unix/Type/_file_modes b/Completion/Unix/Type/_file_modes
new file mode 100644
index 000000000..fbe4c9363
--- /dev/null
+++ b/Completion/Unix/Type/_file_modes
@@ -0,0 +1,37 @@
+#autoload
+
+# Provides completion for file modes (formerly part of _chmod)
+
+local curcontext=$curcontext
+local -a context line state state_descr copts=( "${@}" ) privs
+local -A val_args
+
+privs=(
+ 'r[read]' 'w[write]' 'x[execute]'
+ 's[set uid/gid]' 't[sticky]'
+ 'X[execute only if directory or executable to another]'
+ "u[owner's current permissions]"
+ "g[group's current permissions]"
+ "o[others' current permissions]"
+)
+
+[[ $OSTYPE == solaris* ]] &&
+privs+=( 'l[mandatory locking]' )
+
+compset -P '*,'
+compset -S ',*'
+
+if [[ -prefix [0-7] ]]; then
+ _message -e number 'numeric mode'
+elif compset -P '[a-z]#[+-=]'; then
+ _values -O copts -S '' privilege $privs && return 0
+else
+ compset -P '*'
+ copts=( -S '' )
+ _alternative -O copts \
+ 'who:who:((a\:all u\:owner g\:group o\:others))' \
+ 'operators:operator:(+ - =)' \
+ && return 0
+fi
+
+return 1
diff --git a/Completion/Unix/Type/_object_files b/Completion/Unix/Type/_object_files
index 31a13aefc..595265116 100644
--- a/Completion/Unix/Type/_object_files
+++ b/Completion/Unix/Type/_object_files
@@ -5,7 +5,8 @@ local expl
_description files expl 'object file'
__object_file() {
- [[ -x $REPLY || $REPLY = *.([ao]|so|elf)(.<->)## || $REPLY = (core*|*.core) ]]
+ [[ -x $REPLY || $REPLY = *.(a|o|elf|dylib) || $REPLY = *.so(.<->)# ||
+ $REPLY = (core*|*.core) ]]
}
_files -g '*(-.e,__object_file,)'
diff --git a/Completion/Unix/Type/_ssh_hosts b/Completion/Unix/Type/_ssh_hosts
new file mode 100644
index 000000000..e20142cfd
--- /dev/null
+++ b/Completion/Unix/Type/_ssh_hosts
@@ -0,0 +1,41 @@
+#autoload
+
+local -a config_hosts
+local config
+integer ind
+
+# If users-hosts matches, we shouldn't complete anything else.
+if [[ "$IPREFIX" == *@ ]]; then
+ _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" && return
+else
+ _combination -s '[:@]' my-accounts users-hosts \
+ ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return
+fi
+if (( ind = ${words[(I)-F]} )); then
+ config=${~words[ind+1]} 2>/dev/null
+else
+ config="$HOME/.ssh/config"
+fi
+if [[ -r $config ]]; then
+ local key line host
+ local -a lines=("${(@f)$(<"$config")}") 2>/dev/null
+ while (($#lines)); do
+ IFS=$'=\t ' read -r key line <<<"${lines[1]}"
+ case "$key" in
+ ((#i)include)
+ lines[1]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;;
+ ((#i)host(|name))
+ for host in ${(z)line}; do
+ case $host in
+ (*[*?]*) ;;
+ (*) config_hosts+=("$host") ;;
+ esac
+ done ;&
+ (*) shift lines;;
+ esac
+ done
+ if (( ${#config_hosts} )); then
+ _wanted hosts expl 'remote host name' \
+ compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts
+ fi
+fi
diff --git a/Completion/Unix/Type/_tilde_files b/Completion/Unix/Type/_tilde_files
index b1b3b37f0..0ee12332b 100644
--- a/Completion/Unix/Type/_tilde_files
+++ b/Completion/Unix/Type/_tilde_files
@@ -29,7 +29,7 @@ case "$PREFIX" in
_files "$@" -W "$user"
;;
\~*)
- compset -P '?'
+ compset -p 1
local -a expl=( "$@" )
_alternative -O expl users:user:_users named-directories:'named directory':'compadd -k nameddirs'
;;
diff --git a/Completion/X/Command/_evince b/Completion/X/Command/_evince
index 48d5a9aeb..21b493360 100644
--- a/Completion/X/Command/_evince
+++ b/Completion/X/Command/_evince
@@ -5,12 +5,8 @@ _arguments -s -S \
'--version[display version information]' \
{-h,--help}'[display help information]' \
'--help-all[display help on all options]' \
- '--help-sm-client[display help on session management options]' \
'--help-gtk[display help on GTK+ options]' \
- normal \
- '--sm-client-disable[disable connection to session manager]' \
- '--sm-client-state-file=[specify file containing saved configuration]:file:_files' \
- '--sm-client-id=[specify session management ID]:id' \
'--class=[specify program class as used by the window manager]:class' \
'--name=[program name as used by the window manager]:name:_x_name' \
'--gdk-debug=[specify GDK debugging flags to set]:flag' \
diff --git a/Completion/X/Command/_kdeconnect b/Completion/X/Command/_kdeconnect
new file mode 100644
index 000000000..ffb7f5774
--- /dev/null
+++ b/Completion/X/Command/_kdeconnect
@@ -0,0 +1,33 @@
+#compdef kdeconnect-cli
+
+_kdeconnect_device-ids() {
+ compadd $(kdeconnect-cli --list-available --id-only)
+}
+
+_arguments \
+ '(-l --list-devices -a --list-available)'{-l,--list-devices}'[list all devices]' \
+ '(-l --list-devices -a --list-available)'{-a,--list-available}'[list available (paired and reachable) devices]' \
+ '--id-only[make --list-devices or --list-available print only the devices id, to ease scripting]' \
+ '--refresh[search for devices in the network and re-establish connections]' \
+ '(--pair --unpair)--pair[request pairing with the specified device]' \
+ '--ring[find the device by ringing it.]' \
+ '(--pair --unpair)--unpair[stop pairing to the specified device]' \
+ '(--ping --ping-msg)--ping[send a ping to the device]' \
+ '(--ping --ping-msg)--ping-msg[send a ping to the device with the specified message]:message' \
+ '--share[share a file to the device]:file:_files' \
+ '--list-notifications[display the notifications on the device]' \
+ '--lock[lock the specified device]' \
+ '--send-sms[send an SMS. Requires --destination]:message' \
+ '--destination[specify phone number to send the SMS to]:phone number' \
+ '(-d --device -n --name)'{-d,--device}'[specify device ID]:id:_kdeconnect_device-ids' \
+ '(-d --device -n --name)'{-n,--name}'[specify device name]:name' \
+ '--encryption-info[get encryption info about the device]' \
+ '--list-commands[list remote commands and their ids]' \
+ '--execute-command[execute a remote command]:command id' \
+ '(-k --send-keys)'{-k,--send-keys}'[send keys to the specified device]' \
+ "--my-id[display this device's id and exit]" \
+ '(-)'{-h,--help}'[display usage information]' \
+ '(-)'{-v,--version}'[display version information]' \
+ '(-)--author[show author information and exit]' \
+ '(-)--license[show license information and exit]' \
+ '--desktopfile[specify base file name of the desktop entry for this application]:file'
diff --git a/Completion/X/Command/_sublimetext b/Completion/X/Command/_sublimetext
new file mode 100644
index 000000000..1243d2779
--- /dev/null
+++ b/Completion/X/Command/_sublimetext
@@ -0,0 +1,13 @@
+#compdef subl
+
+_arguments -s -S : \
+ '(-a -n --add --new-window)'{-a,--add}'[add to current window]' \
+ '(-b --background)'{-b,--background}"[don't activate application]" \
+ '--command[run specified command]:command' \
+ '(: -)'{-h,--help}'[display help information]' \
+ '(-a -n --add --new-window)'{-n,--new-window}'[open new window]' \
+ '--project[load specified project]:project file:_files' \
+ '(-s --stay)'{-s,--stay}'[keep application activated]' \
+ '(: -)'{-v,--version}'[display version information]' \
+ '(-w --wait)'{-w,--wait}'[wait for files to close]' \
+ '*:file or directory:_files'
diff --git a/Completion/X/Command/_xrandr b/Completion/X/Command/_xrandr
index b0851569e..26d8cd082 100644
--- a/Completion/X/Command/_xrandr
+++ b/Completion/X/Command/_xrandr
@@ -58,8 +58,11 @@ case $state in
esac
;;
outputs)
- _wanted outputs expl output compadd \
- ${(uo)${(M)${(f)"$(_call_program outputs xrandr)"}:#* connected*}%% *} && return 0
+ local -a xrandr_output=(${(f)"$(_call_program outputs xrandr)"})
+ _alternative \
+ 'connected:connected outputs:('${(j: :)${(uo)${(M)xrandr_output:#* connected*}%% *}}')' \
+ 'disconnected:disconnected outputs:('${(j: :)${(uo)${(M)xrandr_output:#* disconnected*}%% *}}')' \
+ && return 0
;;
modes)
_wanted modes expl mode compadd \
diff --git a/Completion/X/Command/_xset b/Completion/X/Command/_xset
index 53ec635d4..b35a6466b 100644
--- a/Completion/X/Command/_xset
+++ b/Completion/X/Command/_xset
@@ -111,7 +111,7 @@ _regex_arguments _xset_parse \
\) \#
_xset () {
- local expl allopts
+ local expl allopts opt
typeset -A desc no eo
desc=(
diff --git a/Completion/Zsh/Command/_cd b/Completion/Zsh/Command/_cd
index 6b8d7ebeb..46237e73d 100644
--- a/Completion/Zsh/Command/_cd
+++ b/Completion/Zsh/Command/_cd
@@ -22,7 +22,7 @@ _cd_options() {
setopt localoptions nonomatch
local expl ret=1 curarg
-integer argstart=2 noopts
+integer argstart=2 noopts match mbegin mend
if (( CURRENT > 1 )); then
# if not in command position, may have options.
diff --git a/Completion/Zsh/Command/_stat b/Completion/Zsh/Command/_stat
index 03e42e3af..73bbef471 100644
--- a/Completion/Zsh/Command/_stat
+++ b/Completion/Zsh/Command/_stat
@@ -2,19 +2,32 @@
local expl ret=1
-if [[ "$words[CURRENT-1]" = -[AH] ]]; then
- _arrays
+if [[ $service == zstat ]] ||
+ (( ${+builtins[stat]} )) ||
+ { (( ! ${+builtins} )) && [[ $(type -w stat) == '*: builtin' ]] }
+then
+ _arguments -s -S : \
+ '(-H)-A[assign the results to array, don'\''t print]:array variable:_parameters -g "*array*"' \
+ - set1 \
+ +device +inode +mode +nlink +uid +gid +rdev \
+ +size +atime +mtime +ctime +blksize +block +link \
+ '(-A)-H[assign the results to associative array, don'\''t print]:associative array variable:_parameters -g "*association*"' \
+ '(:)-f[stat a file descriptor]:file descriptor:_file_descriptors' \
+ '(-s)-F:strftime(3) format string:_date_formats zsh' \
+ '(-s)-g[show times in GMT/UTC]' \
+ '-L[don'\''t dereference symbolic links; use lstat(2)]' \
+ '(-N)-n[always show names of files]' \
+ '(-n)-N[never show names of files]' \
+ '-o[print file modes in octal rather than decimal]' \
+ '-r[print raw data]' \
+ '-s[print mode,uid,gid and times as strings]' \
+ '(-T)-t[always show type names]' \
+ '(-t)-T[never show type names]' \
+ '*:files to stat:_files' \
+ - set2 \
+ '-l[list stat types]'
else
- _tags files options || return 1
-
- while _tags; do
- _requested files && _files && ret=0
- _requested options &&
- { ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
- [[ "$PREFIX[1]" = + || ret -eq 1 ]] } &&
- _all_labels options expl 'inode element' \
- compadd - +device +inode +mode +nlink +uid +gid +rdev \
- +size +atime +mtime +ctime +blksize +block +link
- (( ret )) || return 0
- done
+ # TODO: system-specific completion
+ # TODO: choose this codepath if 'command stat ...' or '=stat ...' is used
+ _files
fi
diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset
index 160150234..14d5d371b 100644
--- a/Completion/Zsh/Command/_typeset
+++ b/Completion/Zsh/Command/_typeset
@@ -30,7 +30,7 @@ allargs=(
k "($popts -w -z)-+k[mark function for ksh-style autoloading]"
l "($popts -T)-l[convert the value to lowercase]"
m '(-A -E -F -T -i)-m[treat arguments as patterns]'
- p '-p[output parameters in form of calls to typeset]'
+ p '-p+[output parameters in form of calls to typeset]::option:((1\:multi-line\ output\ of\ arrays))'
r '(-f)-+r[mark parameters as readonly]'
rf '-r[remember autoload path]'
Rf '-R[remember autoload path, error if not found]'
@@ -41,6 +41,7 @@ allargs=(
uf '-u[mark function for autoloadling]'
up '-u[convert the value to uppercase]'
w '(-k -z)-w[specify that arguments refer to files compiled with zcompile]'
+ W '-+W[turn on WARN_NESTED_VAR for function]'
x "($fopts)-+x[export parameter]"
z "($popts -k -w)-+z[mark function for zsh-style autoloading]"
)
@@ -54,7 +55,7 @@ case ${service} in
;;
float) use="EFHghlprtux";;
functions)
- use="UkmTtuzM"
+ use="UkmTtuzMW"
func=f
allargs[M]='(-k -t -T -u -U -z -M +M +k +t +z)-+M[define mathematical function]'
;;
diff --git a/Completion/Zsh/Command/_zmodload b/Completion/Zsh/Command/_zmodload
index 57fb990e9..3416d50c6 100644
--- a/Completion/Zsh/Command/_zmodload
+++ b/Completion/Zsh/Command/_zmodload
@@ -17,6 +17,7 @@ _arguments -n -C -S -s \
'(-u -b -c -d -p -f -A -R -I)-F[handle features]' \
'(-u -b -c -d -p -f -A -R -I)-m[treat feature arguments as patterns]' \
'(-d -e)-i[suppress error if command would do nothing]' \
+ '(-d -e -L)-s[suppress error if module is not available]' \
'(-b -c -d -p -f -F -P -m)-I[define infix condition names]' \
'(-u -b -c -d -p -f -A -R)-l[list features]' \
'(-e -u)-L[output in the form of calls to zmodload]' \
@@ -71,6 +72,7 @@ else
_files -W module_path -g '*.(dll|s[ol]|bundle)(:r)' && ret=0
_requested aliases expl 'module alias' \
compadd "$suf[@]" -k 'modules[(R)alias*]' && ret=0
+ (( ret )) || return 0
done
return ret
fi
diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle
index 0e828225e..7db73c0c0 100644
--- a/Completion/Zsh/Command/_zstyle
+++ b/Completion/Zsh/Command/_zstyle
@@ -1,7 +1,8 @@
#compdef zstyle
local state context ostate line expl ctop suf
-local nm=$compstate[nmatches] taglist patterns contexts
+local nm=$compstate[nmatches] taglist patterns contexts MATCH
+integer MBEGIN MEND
typeset -A opt_args styles
_vcs_info_hooks() {
diff --git a/Completion/Zsh/Context/_brace_parameter b/Completion/Zsh/Context/_brace_parameter
index f22db8895..4ba588cc0 100644
--- a/Completion/Zsh/Context/_brace_parameter
+++ b/Completion/Zsh/Context/_brace_parameter
@@ -178,11 +178,11 @@ if [[ $PREFIX = *'${('[^\)]# ]]; then
# "_:extended flags, for future expansion"
"S:search substrings in #, %, / expressions"
"I:search <argument>th match in #, %, / expressions"
- "B:include index of beginning of match in #, %, / expressions"
- "E:include index of one past end of match in #, %, / expressions"
- "M:include matched portion in #, %, / expressions"
+ "B:include index of beginning of match in #, % expressions"
+ "E:include index of one past end of match in #, % expressions"
+ "M:include matched portion in #, % expressions"
"N:include length of match in #, % expressions"
- "R:include rest (unmatched portion) in #, %, / expressions"
+ "R:include rest (unmatched portion) in #, % expressions"
)
_describe -t flags "parameter flag" flags -Q -S ''
return
@@ -195,7 +195,7 @@ elif compset -P '*:'; then
'+:substitute alternate value if parameter is non-null'
'=:substitute and assign alternate value if parameter is null'
'\:=:unconditionally assign value to parameter'
- '?:print error if parameter is set and non-null'
+ '?:print error if parameter is null'
'#:filter value matching pattern'
'/:replace whole word matching pattern'
'|:set difference'
diff --git a/Completion/Zsh/Context/_value b/Completion/Zsh/Context/_value
index 22372ab36..5e74100c6 100644
--- a/Completion/Zsh/Context/_value
+++ b/Completion/Zsh/Context/_value
@@ -22,7 +22,7 @@ if [[ "$service" != -value-,* ]]; then
-value-,{${compstate[parameter]},-default-},${^strs}
else
if [[ "$compstate[parameter]" != *-* &&
- "$compstate[context]" = *value &&
+ "$compstate[context]" = array_value &&
"${(Pt)${compstate[parameter]}}" = assoc* ]]; then
local expl
if (( CURRENT & 1 )); then
diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals
index a904bdf0d..915f97c1c 100644
--- a/Completion/Zsh/Type/_globquals
+++ b/Completion/Zsh/Type/_globquals
@@ -1,6 +1,7 @@
#autoload
-local state=qual expl char delim timespec default
+local state=qual expl char delim timespec default MATCH
+integer MBEGIN MEND
local -a alts tdisp sdisp tmatch smatch
local -A specmap
@@ -167,7 +168,7 @@ while [[ -n $PREFIX ]]; do
([oO])
# complete/skip sort spec
- if ! compset -P "?"; then
+ if ! compset -p 1; then
alts=(
"n:lexical order of name"
"L:size of file"
diff --git a/Completion/bashcompinit b/Completion/bashcompinit
index 902fa88a8..02290a16f 100644
--- a/Completion/bashcompinit
+++ b/Completion/bashcompinit
@@ -8,7 +8,7 @@ _bash_complete() {
local -x COMP_LINE="$words"
local -A savejobstates savejobtexts
- (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX ))
+ (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT-1]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX ))
(( COMP_CWORD = CURRENT - 1))
COMP_WORDS=( $words )
BASH_VERSINFO=( 2 05b 0 1 release )
diff --git a/Completion/compinit b/Completion/compinit
index c345ceb43..f0f8421df 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -175,7 +175,9 @@ typeset -gH _comp_setup='local -A _comp_caller_options;
exec </dev/null;
trap - ZERR;
local -a reply;
- local REPLY'
+ local REPLY;
+ local REPORTTIME;
+ unset REPORTTIME'
# These can hold names of functions that are to be called before/after all
# matches have been generated.
diff --git a/Config/version.mk b/Config/version.mk
index 9ec6475eb..731fbf16f 100644
--- a/Config/version.mk
+++ b/Config/version.mk
@@ -27,5 +27,5 @@
# This must also serve as a shell script, so do not add spaces around the
# `=' signs.
-VERSION=5.4.2
-VERSION_DATE='August 27, 2017'
+VERSION=5.4.2-test-2
+VERSION_DATE='April 4, 2018'
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 3afe990ba..f460e48a5 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -504,6 +504,15 @@ pindex(BSD_ECHO, use of)
The tt(-E) flag, or the tt(BSD_ECHO) option, can be used to disable
these escape sequences. In the latter case, tt(-e) flag can be used to
enable them.
+
+Note that for standards compliance a double dash does not terminate
+option processing; instead, it is printed directly. However, a
+single dash does terminate option processing, so the first dash,
+possibly following options, is not printed, but everything following it
+is printed as an argument. The single dash behaviour is different
+from other shells. For a more portable way of printing text, see
+tt(printf), and for a more controllable way of printing text within zsh,
+see tt(print).
)
module(echotc)(zsh/termcap)
module(echoti)(zsh/terminfo)
@@ -669,7 +678,7 @@ an empty string or whitespace) the return status is zero.
item(tt(exec) [ tt(-cl) ] [ tt(-a) var(argv0) ] [ var(command) [ var(arg) ... ] ])(
Replace the current shell with var(command) rather than forking.
If var(command) is a shell builtin command or a shell function,
-the shell executes it, then immediately exits.
+the shell executes it, and exits when the command is complete.
With tt(-c) clear the environment; with tt(-l) prepend tt(-) to the
tt(argv[0]) string of the command executed (to simulate a login shell);
@@ -1817,10 +1826,10 @@ findex(typeset)
cindex(parameters, setting)
cindex(parameters, declaring)
redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ ))ifnztexi( )))
-xitem(tt(typeset )[ {tt(PLUS())|tt(-)}tt(AHUaghlmprtux) ] \
-[ {tt(PLUS())|tt(-)}tt(EFLRZi) [ var(n) ] ])
+xitem(tt(typeset )[ {tt(PLUS())|tt(-)}tt(AHUaghlmrtux) ] \
+[ {tt(PLUS())|tt(-)}tt(EFLRZip) [ var(n) ] ])
xitem(SPACES()[ tt(+) ] [ var(name)[tt(=)var(value)] ... ])
-xitem(tt(typeset )tt(-T) [ {tt(PLUS())|tt(-)}tt(Uglprux) ] [ {tt(PLUS())|tt(-)}tt(LRZ) [ var(n) ] ])
+xitem(tt(typeset )tt(-T) [ {tt(PLUS())|tt(-)}tt(Uglrux) ] [ {tt(PLUS())|tt(-)}tt(LRZp) [ var(n) ] ])
xitem(SPACES()[ tt(+) | var(SCALAR)[tt(=)var(value)] var(array)[tt(=LPAR())var(value) ...tt(RPAR())] [ var(sep) ] ])
item(tt(typeset) tt(-f) [ {tt(PLUS())|tt(-)}tt(TUkmtuz) ] [ tt(+) ] [ var(name) ... ])(
Set or display attributes and values for shell parameters.
@@ -1980,11 +1989,16 @@ even inside a function. Note that tt(-m) is ignored if no patterns are
given, so `tt(typeset -m)' displays attributes but `tt(typeset -a +m)'
does not.
)
-item(tt(-p))(
+item(tt(-p) [ var(n) ])(
If the tt(-p) option is given, parameters and values are printed in the
form of a typeset command with an assignment, regardless of other flags
and options. Note that the tt(-H) flag on parameters is respected; no
value will be shown for these parameters.
+
+tt(-p) may be followed by an optional integer argument. Currently
+only the value tt(1) is supported. In this case arrays and associative
+arrays are printed with newlines between indented elements for
+readability.
)
item(tt(-T) [ var(scalar)[tt(=)var(value)] var(array)[tt(=LPAR())var(value) ...tt(RPAR())] [ var(sep) ] ])(
This flag has a different meaning when used with tt(-f); see below.
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 36afd7305..afe332544 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -3596,7 +3596,8 @@ findex(_arguments)
redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ @ @ @ ))ifnztexi( )))
xitem(tt(_arguments )[ tt(-nswWCRS) ] [ tt(-A) var(pat) ] [ tt(-O) var(name) ] [ tt(-M) var(matchspec) ])
xitem(SPACES()[ tt(:) ] var(spec) ...)
-item(tt(_arguments) [ var(opt) ... ] tt(-)tt(-) [ tt(-i) var(pats) ] [ tt(-s) var(pair) ] [ var(helpspec) ... ])(
+xitem(tt(_arguments )[ var(opt) ... ] tt(-)tt(-) [ tt(-l) ] [ tt(-i) var(pats) ] [ tt(-s) var(pair) ])
+item(SPACES()[ var(helpspec) ...])(
This function can be used to give a complete specification for completion
for a command whose arguments follow standard UNIX option and argument
conventions.
@@ -4139,6 +4140,12 @@ pattern and the var(action) will be used only directly after the
`tt(=)', not in the next word. This is the behaviour of a normal
specification defined with the form `tt(=-)'.
+By default, the command (with the option `tt(--help)') is run after
+resetting all the locale categories (except for tt(LC_CTYPE)) to `tt(C)'.
+If the localized help output is known to work, the option `tt(-l)' can
+be specified after the `tt(_arguments -)tt(-)' so that the command is
+run in the current locale.
+
The `tt(_arguments -)tt(-)' can be followed by the option `tt(-i)
var(patterns)' to give patterns for options which are not to be
completed. The patterns can be given as the name of an array parameter
@@ -4230,7 +4237,7 @@ The return status of tt(_call_function) itself is zero if the function
var(name) exists and was called and non-zero otherwise.
)
findex(_call_program)
-item(tt(_call_program) [ tt(-p) ] var(tag) var(string) ...)(
+item(tt(_call_program) [ tt(-l) ] [ tt(-p) ] var(tag) var(string) ...)(
This function provides a mechanism for the user to override the use of an
external command. It looks up the tt(command) style with the supplied
var(tag). If the style is set, its value is used as the command to
@@ -4239,6 +4246,11 @@ style if set, are concatenated with spaces between them and the resulting
string is evaluated. The return status is the return status of the command
called.
+By default, the command is run in an environment where all the locale
+categories (except for tt(LC_CTYPE)) are reset to `tt(C)' by calling the
+utility function tt(_comp_locale) (see below). If the option `tt(-l)' is
+given, the command is run with the current locale.
+
If the option `tt(-p)' is supplied it indicates that the command
output is influenced by the permissions it is run with. If the
tt(gain-privileges) style is set to true, tt(_call_program) will make
@@ -4299,6 +4311,18 @@ This function completes words that are valid at command position: names of
aliases, builtins, hashed commands, functions, and so on. With the tt(-e)
flag, only hashed commands are completed. The tt(-) flag is ignored.
)
+findex(_comp_locale)
+item(tt(_comp_locale))(
+This function resets all the locale categories other than tt(LC_CTYPE) to
+`tt(C)' so that the output from external commands can be easily analyzed by
+the completion system. tt(LC_CTYPE) retains the current value (taking
+tt(LC_ALL) and tt(LANG) into account), ensuring that non-ASCII characters
+in file names are still handled properly.
+
+This function should normally be run only in a subshell, because the new
+locale is exported to the environment. Typical usage would be
+`tt($LPAR()_comp_locale; )var(command) ...tt(RPAR())'.
+)
findex(_completers)
item(tt(_completers) [ tt(-p) ])(
This function completes names of completers.
diff --git a/Doc/Zsh/cond.yo b/Doc/Zsh/cond.yo
index e08fc0d36..4ca132a26 100644
--- a/Doc/Zsh/cond.yo
+++ b/Doc/Zsh/cond.yo
@@ -45,6 +45,10 @@ item(tt(-o) var(option))(
true if option named var(option) is on. var(option)
may be a single character, in which case it is a single letter option name.
(See noderef(Specifying Options).)
+
+When no option named var(option) exists, and the tt(POSIX_BUILTINS) option
+hasn't been set, return 3 with a warning. If that option is set, return 1
+with no warning.
)
item(tt(-p) var(file))(
true if var(file) exists and is a FIFO special file (named pipe).
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index a61738f84..8b447e2c7 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -83,10 +83,10 @@ subsect(Overview)
vindex(histchars, use of)
A history expansion begins with the first character of the tt(histchars)
parameter, which is `tt(!)' by default, and may occur anywhere on the
-command line; history expansions do not nest. The `tt(!)' can be escaped
-with `tt(\)' or can be enclosed between a pair of single quotes (tt(''))
-to suppress its special meaning. Double quotes will em(not) work for
-this. Following this history character is an optional event designator
+command line, including inside double quotes (but not inside single quotes
+tt('...') or C-style quotes tt($'...') nor when escaped with a backslash).
+
+The first character is followed by an optional event designator
(ifzman(see )noderef(Event Designators)) and then an optional word
designator (noderef(Word Designators)); if neither of these designators is
present, no history expansion occurs.
@@ -96,6 +96,8 @@ but before any other expansions take place and before the command is
executed. It is this expanded form that is recorded as the history event
for later references.
+History expansions do not nest.
+
By default, a history reference with no event designator refers to the
same event as any preceding history reference on that command line; if it
is the only history reference in a command, it refers to the previous
@@ -1025,9 +1027,10 @@ ifnzman(noderef(Filename Expansion))\
ifzman(the section FILENAME EXPANSION below).
)
item(tt(e))(
-Perform em(parameter expansion), em(command substitution) and
-em(arithmetic expansion) on the result. Such expansions can be
-nested but too deep recursion may have unpredictable effects.
+Perform single word shell expansions, namely em(parameter expansion),
+em(command substitution) and em(arithmetic expansion), on the
+result. Such expansions can be nested but too deep recursion may have
+unpredictable effects.
)
item(tt(f))(
Split the result of the expansion at newlines. This is a shorthand
diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index 463ac8831..d2c7cd29c 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -568,29 +568,50 @@ itemiz(With global aliasing, any command separator, any redirection
operator, and `tt(LPAR())' or `tt(RPAR())' when not part of a glob pattern)
enditemize()
-It is not presently possible to alias the `tt(LPAR()LPAR())' token that
-introduces arithmetic expressions, because until a full statement has been
-parsed, it cannot be distinguished from two consecutive `tt(LPAR())'
-tokens introducing nested subshells.
-
-When tt(POSIX_ALIASES) is set, only plain unquoted strings are eligible
-for aliasing. The tt(alias) builtin does not reject ineligible aliases,
-but they are not expanded.
-
Alias expansion is done on the shell input before any other expansion
except history expansion. Therefore, if an alias is defined for the
word tt(foo), alias expansion may be avoided by quoting part of the
word, e.g. tt(\foo). Any form of quoting works, although there is
nothing to prevent an alias being defined for the quoted form such as
-tt(\foo) as well. Also, if a separator such as tt(&&) is aliased,
-tt(\&&) turns into the two tokens tt(\&) and tt(&), each of which may
-have been aliased separately. Similarly for tt(\<<), tt(\>|), etc.
+tt(\foo) as well.
+
+When tt(POSIX_ALIASES) is set, only plain unquoted strings are eligible
+for aliasing. The tt(alias) builtin does not reject ineligible aliases,
+but they are not expanded.
For use with completion, which would remove an initial backslash followed
by a character that isn't special, it may be more convenient to quote the
word by starting with a single quote, i.e. tt('foo); completion will
automatically add the trailing single quote.
+subsect(Alias difficulties)
+
+Although aliases can be used in ways that bend normal shell syntax, not
+every string of non-white-space characters can be used as an alias.
+
+Any set of characters not listed as a word above is not a word, hence no
+attempt is made to expand it as an alias, no matter how it is defined
+(i.e. via the builtin or the special parameter tt(aliases) described in
+ifnzman(noderef(The zsh/parameter Module))\
+ifzman(the section THE ZSH/PARAMETER MODULE in zmanref(zshmodules))).
+However, as noted in the case of tt(POSIX_ALIASES) above, the shell does
+not attempt to deduce whether the string corresponds to a word at the
+time the alias is created.
+
+For example, an expression containing an tt(=) at the start of
+a command line is an assignment and cannot be expanded as an alias;
+a lone tt(=) is not an assignment but can only be set as an alias
+using the parameter, as otherwise the tt(=) is taken part of the
+syntax of the builtin command.
+
+It is not presently possible to alias the `tt(LPAR()LPAR())' token that
+introduces arithmetic expressions, because until a full statement has been
+parsed, it cannot be distinguished from two consecutive `tt(LPAR())'
+tokens introducing nested subshells.
+Also, if a separator such as tt(&&) is aliased,
+tt(\&&) turns into the two tokens tt(\&) and tt(&), each of which may
+have been aliased separately. Similarly for tt(\<<), tt(\>|), etc.
+
There is a commonly encountered problem with aliases
illustrated by the following code:
@@ -650,4 +671,5 @@ single quote if it is set.
Inside double quotes (tt("")), parameter and
command substitution occur, and `tt(\)' quotes the characters
-`tt(\)', `tt(`)', `tt(")', and `tt($)'.
+`tt(\)', `tt(`)', `tt(")', `tt($)', and the first character
+of tt($histchars) (default `tt(!)').
diff --git a/Doc/Zsh/invoke.yo b/Doc/Zsh/invoke.yo
index e03c1e25b..26108fccb 100644
--- a/Doc/Zsh/invoke.yo
+++ b/Doc/Zsh/invoke.yo
@@ -46,6 +46,20 @@ ifzman(zmanref(zshoptions))\
ifnzman(noderef(Options))\
.
+The long option `tt(-)tt(-emulate)' followed (in a separate word) by an
+emulation mode may be passed to the shell.
+The emulation modes are those described for the tt(emulate) builtin,
+see
+ifzman(zmanref(zshbuiltins))\
+ifnzman(noderef(Shell Builtin Commands)).
+The `tt(-)tt(-emulate)' option must precede any other options (which might
+otherwise be overridden), but following options are honoured, so
+may be used to modify the requested emulation mode. Note that certain
+extra steps are taken to ensure a smooth emulation when this option
+is used compared with the tt(emulate) command within the shell: for
+example, variables that conflict with POSIX usage such as tt(path) are
+not defined within the shell.
+
Options may be specified by name using the tt(-o) option. tt(-o) acts like
a single-letter option, but takes a following string as the option name.
For example,
diff --git a/Doc/Zsh/mod_stat.yo b/Doc/Zsh/mod_stat.yo
index 78649de5e..96349061e 100644
--- a/Doc/Zsh/mod_stat.yo
+++ b/Doc/Zsh/mod_stat.yo
@@ -123,7 +123,7 @@ tt(-s) option is implied.
item(tt(-l))(
List the names of the type elements (to standard
output or an array as appropriate) and return immediately;
-options other than tt(-A) and arguments are ignored.
+arguments, and options other than tt(-A), are ignored.
)
item(tt(-L))(
Perform an tt(lstat) (see manref(lstat)(2)) rather than a tt(stat)
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 42571fccd..25b3d5736 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -817,7 +817,7 @@ zsh sessions will all have the new entries from their history lists
added to the history file, in the order that they exit.
The file will still be periodically re-written to trim it when the
number of lines grows 20% beyond the value specified by
-tt($SAVEHIST) (see also the HIST_SAVE_BY_COPY option).
+tt($SAVEHIST) (see also the tt(HIST_SAVE_BY_COPY) option).
)
pindex(BANG_HIST)
pindex(NO_BANG_HIST)
@@ -1016,7 +1016,7 @@ pindex(INCAPPENDHISTORY)
pindex(NOINCAPPENDHISTORY)
cindex(history, incremental appending to a file)
item(tt(INC_APPEND_HISTORY))(
-This options works like tt(APPEND_HISTORY) except that new history lines
+This option works like tt(APPEND_HISTORY) except that new history lines
are added to the tt($HISTFILE) incrementally (as soon as they are
entered), rather than waiting until the shell exits.
The file will still be periodically re-written to trim it when the
@@ -1429,6 +1429,19 @@ ifnzman(the section Special Functions in noderef(Functions))\
ifzman(the section SPECIAL FUNCTIONS in zmanref(zshmisc))
is not counted for this purpose.
)
+pindex(CHECK_RUNNING_JOBS)
+pindex(NO_CHECK_RUNNING_JOBS)
+pindex(CHECKRUNNINGJOBS)
+pindex(NOCHECKRUNNINGJOBS)
+cindex(exiting, checking running jobs when)
+cindex(logging out, checking running jobs when)
+item(tt(CHECK_RUNNING_JOBS) <Z>)(
+Check for both running and suspended jobs when tt(CHECK_JOBS) is enabled.
+When this option is disabled, zsh checks only for suspended jobs, which
+matches the default behavior of bash.
+
+This option has no effect unless tt(CHECK_JOBS) is set.
+)
pindex(HUP)
pindex(NO_HUP)
pindex(NOHUP)
@@ -1443,7 +1456,7 @@ pindex(LONGLISTJOBS)
pindex(NOLONGLISTJOBS)
cindex(jobs, list format)
item(tt(LONG_LIST_JOBS) (tt(-R)))(
-List jobs in the long format by default.
+Print job notifications in the long format by default.
)
pindex(MONITOR)
pindex(NO_MONITOR)
@@ -2169,6 +2182,9 @@ command found in the path.
Furthermore, the tt(getopts) builtin behaves in a POSIX-compatible
fashion in that the associated variable tt(OPTIND) is not made
local to functions.
+
+Moreover, the warning and special exit code from
+tt([[ -o )var(non_existent_option)tt( ]]) are suppressed.
)
pindex(POSIX_IDENTIFIERS)
pindex(NO_POSIX_IDENTIFIERS)
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 817496b8a..9ad228679 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -91,13 +91,66 @@ cindex(array assignment)
ifzman()
indent(tt(set -A) var(name) var(value) ...)
indent(var(name)tt(=LPAR())var(value) ...tt(RPAR()))
+indent(var(name)tt(=LPAR())tt([)var(key)tt(]=)var(value) ...tt(RPAR()))
If no parameter var(name) exists, an ordinary array parameter is created.
If the parameter var(name) exists and is a scalar, it is replaced by a new
-array. To append to an array without changing the existing values, use
-the syntax:
+array.
+
+In the third form, var(key) is an expression that will be evaluated in
+arithmetic context (in its simplest form, an integer) that gives the
+index of the element to be assigned with var(value). In this form any
+elements not explicitly mentioned that come before the largest index to
+which a value is assigned are assigned an empty string. The indices
+may be in any order. Note that this syntax is strict: tt([) and tt(]=) must
+not be quoted, and var(key) may not consist of the unquoted string
+tt(]=), but is otherwise treated as a simple string. The enhanced forms
+of subscript expression that may be used when directly subscripting a
+variable name, described in the section Array Subscripts below, are not
+available.
+
+The syntaxes with and without the explicit key may be mixed. An implicit
+var(key) is deduced by incrementing the index from the previously
+assigned element. Note that it is not treated as an error
+if latter assignments in this form overwrite earlier assignments.
+
+For example, assuming the option tt(KSH_ARRAYS) is not set, the following:
+
+example(array=LPAR()one [3]=three four+RPAR())
+
+causes the array variable tt(array) to contain four elements tt(one),
+an empty string, tt(three) and tt(four), in that order.
+
+In the forms where only var(value) is specified, full command
+line expansion is performed.
+
+In the tt([)var(key)tt(]=)var(value) form,
+both var(key) and var(value) undergo all forms of expansion
+allowed for single word shell expansions (this does not include filename
+generation); these are as performed by the parameter expansion flag
+tt(LPAR()e+RPAR()) as described in
+ifzman(zmanref(zshparam))\
+ifnzman(noderef(Parameter Expansion)).
+Nested parentheses may surround var(value) and are included as part of the
+value, which is joined into a plain string; this differs from ksh which
+allows the values themselves to be arrays. A future version of zsh may
+support that. To cause the brackets to be interpreted as a character
+class for filename generation, and therefore to treat the resulting list
+of files as a set of values, quote the equal sign using any form of quoting.
+Example:
+ifzman()
+indent(var(name)tt(=LPAR())tt([a-z]'='*RPAR()))
+
+To append to an array without changing the existing values, use
+one of the following:
ifzman()
indent(var(name)tt(+=LPAR())var(value) ...tt(RPAR()))
+indent(var(name)tt(+=LPAR())tt([)var(key)tt(]=)var(value) ...tt(RPAR()))
+
+In the second form var(key) may specify an existing index as well as an
+index off the end of the old array; any existing value is overwritten by
+var(value). Also, it is possible to use tt([)var(key)tt(]+=)var(value)
+to append to the existing value at that index.
Within the parentheses on the right hand side of either form of the
assignment, newlines and semicolons are treated the same as white space,
@@ -118,15 +171,25 @@ is interpreted as alternating keys and values:
ifzman()
indent(tt(set -A) var(name) var(key) var(value) ...)
indent(var(name)tt(=LPAR())var(key) var(value) ...tt(RPAR()))
+indent(var(name)tt(=LPAR())tt([)var(key)tt(]=)var(value) ...tt(RPAR()))
+
+Note that only one of the two syntaxes above may be used in any
+given assignment; the forms may not be mixed. This is unlike the case
+of numerically indexed arrays.
Every var(key) must have a var(value) in this case. Note that this
assigns to the entire array, deleting any elements that do not appear in
the list. The append syntax may also be used with an associative array:
ifzman()
indent(var(name)tt(+=LPAR())var(key) var(value) ...tt(RPAR()))
+indent(var(name)tt(+=LPAR())tt([)var(key)tt(]=)var(value) ...tt(RPAR()))
This adds a new key/value pair if the key is not already present, and
-replaces the value for the existing key if it is.
+replaces the value for the existing key if it is. In the second
+form it is also possible to use tt([)var(key)tt(]+=)var(value) to
+append to the existing value at that key. Expansion is performed
+identically to the corresponding forms for normal arrays, as
+described above.
To create an empty array (including associative arrays), use one of:
ifzman()
@@ -265,8 +328,10 @@ startitem()
item(tt(w))(
If the parameter subscripted is a scalar then this flag makes
subscripting work on words instead of characters. The default word
-separator is whitespace. This flag may not be used with the tt(i) or
-tt(I) flag.
+separator is whitespace. When combined with the tt(i) or tt(I) flag,
+the effect is to produce the index of the first character of the
+first/last word which matches the given pattern; note that a failed
+match in this case always yields 0.
)
item(tt(s:)var(string)tt(:))(
This gives the var(string) that separates words (for use with the
@@ -668,6 +733,16 @@ This value is system dependent and is intended for debugging
purposes. It is also useful with the tt(zsh/system) module which
allows the number to be turned into a name or message.
)
+vindex(FUNCNEST)
+item(tt(FUNCNEST) <S>)(
+Integer. If greater than or equal to zero, the maximum nesting depth of
+shell functions. When it is exceeded, an error is raised at the point
+where a function is called. The default value is determined when
+the shell is configured, but is typically 500. Increasing
+the value increases the danger of a runaway function recursion
+causing the shell to crash. Setting a negative value turns off
+the check.
+)
vindex(GID)
item(tt(GID) <S>)(
The real group ID of the shell process. If you have sufficient privileges,
@@ -1394,7 +1469,7 @@ is specified with no command. Defaults to tt(more).
vindex(REPORTMEMORY)
item(tt(REPORTMEMORY))(
If nonnegative, commands whose maximum resident set size (roughly
-speaking, main memory usage) in megabytes is greater than this
+speaking, main memory usage) in kilobytes is greater than this
value have timing statistics reported. The format used to output
statistics is the value of the tt(TIMEFMT) parameter, which is the same
as for the tt(REPORTTIME) variable and the tt(time) builtin; note that
@@ -1529,7 +1604,7 @@ sitem(tt(%D))(The average amount in (unshared) data/stack space used in
kilobytes.)
sitem(tt(%K))(The total space used (tt(%X)PLUS()tt(%D)) in kilobytes.)
sitem(tt(%M))(The maximum memory the process had in use at any time in
-megabytes.)
+kilobytes.)
sitem(tt(%F))(The number of major page faults (page needed to be brought
from disk).)
sitem(tt(%R))(The number of minor page faults.)
@@ -1543,10 +1618,12 @@ sitem(tt(%c))(Number of involuntary context switches.)
sitem(tt(%J))(The name of this job.)
endsitem()
-A star may be inserted between the percent sign and flags printing time.
-This cause the time to be printed in
+A star may be inserted between the percent sign and flags printing time
+(e.g., `tt(%*E)'); this causes the time to be printed in
`var(hh)tt(:)var(mm)tt(:)var(ss)tt(.)var(ttt)'
format (hours and minutes are only printed if they are not zero).
+Alternatively, `tt(m)' or `tt(u)' may be used (e.g., `tt(%mE)') to produce
+time output in milliseconds or microseconds, respectively.
)
vindex(TMOUT)
item(tt(TMOUT))(
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index adde2d56c..c1b2f52ff 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -242,9 +242,9 @@ sect(What is it good at?)
in any other freely-available shell which zsh does not also have
(except smallness).
- itemize(
+ itemization(
it() Command line editing:
- itemize(
+ itemization(
it() programmable completion: incorporates the ability to use the
full power of zsh's globbing and shell programming features,
it() multi-line commands editable as a single buffer (even files!),
@@ -257,7 +257,7 @@ sect(What is it good at?)
it() inline expansion of variables and history commands.
)
it() Globbing --- extremely powerful, including:
- itemize(
+ itemization(
it() recursive globbing (cf. find),
it() file attribute qualifiers (size, type, etc. also cf. find),
it() full alternation and negation of patterns.
@@ -306,7 +306,7 @@ sect(On what machines will it run?)
sect(What's the latest version?)
- Zsh 5.4.2 is the latest production version. For details of all the
+ Zsh 5.5 is the latest production version. For details of all the
changes, see the NEWS file in the source distribution.
A beta of the next version is sometimes available. Development of zsh is
@@ -447,7 +447,7 @@ label(21)
substantial.
As a summary of the status:
- enumerate(
+ enumeration(
myeit() because of all the options it is not safe to assume a general
zsh run by a user will behave as if sh or ksh compatible;
myeit() invoking zsh as sh or ksh (or if either is a symbolic link to
@@ -500,9 +500,9 @@ tt(RM_STAR_SILENT),
if `emulate ksh' is in effect. Capitalised words with underlines
refer to shell options.
- itemize(
+ itemization(
it() Syntax:
- itemize(
+ itemization(
it()* Shell word splitting: see question link(3.1)(31).
it()* Arrays are (by default) more csh-like than ksh-like:
subscripts start at 1, not 0; tt(array[0]) refers to tt(array[1]);
@@ -522,7 +522,7 @@ tt(RM_STAR_SILENT),
this is a bug. Use mytt({ cmd1 && cmd2 } &) as a workaround.
)
it() Command line substitutions, globbing etc.:
- itemize(
+ itemization(
it()* Failure to match a globbing pattern causes an error (use
tt(NO_NOMATCH)).
it()* The results of parameter substitutions are treated as plain text:
@@ -565,14 +565,14 @@ tt(EXTENDED_GLOB).
assignment specially as a single word.
)
it() Command execution:
- itemize(
+ itemization(
it()* There is no tt($ENV) variable (use tt(/etc/zshrc), tt(~/.zshrc);
note also tt($ZDOTDIR)).
it()* tt($PATH) is not searched for commands specified
at invocation without -c.
)
it() Aliases and functions:
- itemize(
+ itemization(
it() The order in which aliases and functions are defined is significant:
function definitions with () expand aliases -- see question \
link(2.3)(23).
@@ -588,14 +588,14 @@ link(2.3)(23).
and only the latter behave as true functions.
)
it() Traps and signals:
- itemize(
+ itemization(
it()* Traps are not local to functions. The option LOCAL_TRAPS is
available from 3.1.6.
it() TRAPERR has become TRAPZERR (this was forced by UNICOS which
has SIGERR).
)
it() Editing:
- itemize(
+ itemization(
it() The options tt(gmacs), tt(viraw) are not supported.
Use bindkey to change the editing behaviour: mytt(set -o {emacs,vi})
becomes `bindkey -{e,v}', although `set -o emacs' and `set -o vi'
@@ -620,7 +620,7 @@ link(2.3)(23).
)
)
it() Built-in commands:
- itemize(
+ itemization(
it() Some built-ins (tt(r), tt(autoload), tt(history), tt(integer) ...)
were aliases in ksh.
it() There is no built-in command newgrp: use e.g. mytt(alias
@@ -628,7 +628,7 @@ link(2.3)(23).
it() mytt(jobs) has no mytt(-n) flag.
)
it() Other idiosyncrasies:
- itemize(
+ itemization(
it() mytt(select) always redisplays the list of selections on each loop.
)
)
@@ -644,7 +644,7 @@ sect(Similarities with csh)
particularly those with arguments.
Csh-compatibility additions include:
- itemize(
+ itemization(
it() tt(logout), tt(rehash), tt(source), tt((un)limit) built-in commands.
it() tt(*rc) file for interactive shells.
it() Directory stacks.
@@ -706,7 +706,7 @@ label(23)
Here is Bart Schaefer's guide to converting csh aliases for zsh.
- enumerate(
+ enumeration(
myeit() If the csh alias references "parameters" (tt(\!:1), tt(\!*) etc.),
then in zsh you need a function (referencing tt($1), tt($*) etc.).
Otherwise, you can use a zsh alias.
@@ -722,7 +722,7 @@ label(23)
myeit() If you have aliases that refer to each other (tt(alias ls "ls -C";
alias lf "ls -F" ==> lf == ls -C -F)) then you must either:
- itemize(
+ itemization(
it() convert all of them to zsh functions; or
it() after converting, be sure your .zshrc defines all of your
aliases before it defines any of your functions.
@@ -1097,7 +1097,7 @@ sect(What is the difference between `export' and the tt(ALL_EXPORT) option?)
This may seem a useful shorthand, but in practice it can have
unhelpful side effects:
- enumerate(
+ enumeration(
myeit() Since every variable is in the environment as well as remembered
by the shell, the memory for it needs to be allocated twice.
This is bigger as well as slower.
@@ -1365,7 +1365,7 @@ sect(Why do my autoloaded functions not autoload [the first time]?)
The problem is that there are two possible ways of autoloading a
function (see the AUTOLOADING FUNCTIONS section of the zsh manual
page zshmisc for more detailed information):
- enumerate(
+ enumeration(
myeit() The file contains just the body of the function, i.e.
there should be no line at the beginning saying mytt(function foo {)
or mytt(foo () {), and consequently no matching mytt(}) at the end.
@@ -1709,7 +1709,7 @@ sect(What's wrong with cut and paste on my xterm?)
`non-canonical input mode'. On the systems in question, input can be
lost or re-ordered when the mode changes. There are actually two
slightly different problems:
- enumerate(
+ enumeration(
myeit() When you paste something in while a programme is running, so that
the shell only retrieves it later. Traditionally, there was a test
which was used only on systems where the problem was known to exist,
@@ -1931,7 +1931,7 @@ label(327)
assume the option tt(EXTENDED_GLOB) is set and none of the pattern
characters is disabled.
- enumerate(
+ enumeration(
myeit() mytt(**/foo~*bar*) matches any file called mytt(foo) in any
subdirectory, except where mytt(bar) occurred somewhere in the path.
For example, mytt(users/barstaff/foo) will be excluded by the mytt(~)
@@ -2035,7 +2035,7 @@ sect(How does zsh deal with ambiguous completions?)
(That's assuming you're at the end of the line, otherwise tt(\C-D) will
delete the next character and you have to use tt(ESC-\C-D).) This can be
changed by the following options, among others:
- itemize(
+ itemization(
it() with tt(NO_BEEP) set, that annoying beep goes away
it() with tt(NO_LIST_BEEP), beeping is only turned off for ambiguous
completions
@@ -2243,7 +2243,7 @@ sect(How do I ensure multibyte input and output work on my system?)
There are basically three components.
- itemize(
+ itemization(
it() The locale. This describes a whole series of features specific
to countries or regions of which the character set is one. Usually
it is controlled by the environment variable tt(LANG) (there are
@@ -2436,7 +2436,7 @@ sect(What's on the wish-list?)
particularly welcome for these tasks.
Some future possibilities which have been suggested:
- itemize(
+ itemization(
it() The shell, in particular the line editor, should support Unicode
characters. Initial support for this appeared in version 4.3;
it is reasonably complete in the line editor but patchy elsewhere
diff --git a/Functions/Misc/allopt b/Functions/Misc/allopt
index 0c521f391..5d5d2885a 100644
--- a/Functions/Misc/allopt
+++ b/Functions/Misc/allopt
@@ -8,7 +8,7 @@
# Written by Sweth Chandramouli with hacks by Bart Schaefer.
listalloptions () {
- local OPT_NAME OPT_VALUE
+ local OPT_NAME OPT_VALUE IFS=$' \t\n'
builtin set -o | while read OPT_NAME OPT_VALUE ; do
if [[ ${OPT_NAME#no} != ${OPT_NAME} ]] ; then
OPT_VALUE=${(L)${${OPT_VALUE:s/on/OFF}:s/off/on}}
diff --git a/Functions/Misc/zed b/Functions/Misc/zed
index 33bd1025b..f571daf5e 100644
--- a/Functions/Misc/zed
+++ b/Functions/Misc/zed
@@ -36,6 +36,9 @@ fi
local curcontext=zed:::
+# Matching used in zstyle -m: hide result from caller.
+# Variables not used directly here.
+local -a match mbegin mend
zstyle -m ":completion:zed:*" insert-tab '*' ||
zstyle ":completion:zed:*" insert-tab yes
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
index d4030125c..cd5ef321d 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
@@ -55,8 +55,8 @@ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then
zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" \
"check-for-changes" || hgid_args+=( -r. )
- local HGRCPATH
- HGRCPATH="/dev/null" ${vcs_comm[cmd]} ${(z)hgid_args} 2> /dev/null \
+ local HGPLAIN
+ HGPLAIN=1 ${vcs_comm[cmd]} ${(z)hgid_args} 2> /dev/null \
| read -r r_csetid r_lrev r_branch
fi
fi
diff --git a/Functions/VCS_Info/VCS_INFO_formats b/Functions/VCS_Info/VCS_INFO_formats
index 4d0dd75c2..e0e1dc738 100644
--- a/Functions/VCS_Info/VCS_INFO_formats
+++ b/Functions/VCS_Info/VCS_INFO_formats
@@ -34,7 +34,7 @@ hook_com[subdir_orig]="${hook_com[subdir]}"
VCS_INFO_hook 'post-backend'
-## description:
+## description (for backend authors):
# action: a string that signals a certain non-default condition in the
# repository (like 'rebase-i' in git). If this in non-empty,
# the actionformats will be used, too.
@@ -49,6 +49,11 @@ VCS_INFO_hook 'post-backend'
# should be provided. eg:
# VCS_INFO_formats '' "${foobranch}" "${foobase}" '' '' '' "${foomisc}"
+## description (vcs_info internals):
+# This function is called by the backend with information about the repository,
+# and (after some manipulations) populates the ${msgs} variable in preparation
+# for calling VCS_INFO_set.
+
if [[ -n ${hook_com[action]} ]] ; then
zstyle -a ":vcs_info:${vcs}:${usercontext}:${rrn}" actionformats msgs
(( ${#msgs} < 1 )) && msgs[1]=' (%s)-[%b|%a]%u%c-'
diff --git a/Functions/VCS_Info/VCS_INFO_set b/Functions/VCS_Info/VCS_INFO_set
index e3f62ceef..0e5849147 100644
--- a/Functions/VCS_Info/VCS_INFO_set
+++ b/Functions/VCS_Info/VCS_INFO_set
@@ -2,6 +2,8 @@
## Written by Frank Terbeck <ft@bewatermyfriend.org>
## Distributed under the same BSD-ish license as zsh itself.
+# This function sets ${vcs_info_msg_<N>_} from ${msgs}.
+
setopt localoptions noksharrays NO_shwordsplit unset
local -i i j
diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
index 353f2609a..e17893e93 100644
--- a/Functions/Zle/edit-command-line
+++ b/Functions/Zle/edit-command-line
@@ -15,15 +15,15 @@
(( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[2]
# Open the editor, placing the cursor at the right place if we know how.
- local editor=${${VISUAL:-${EDITOR:-vi}}}
+ local editor=( "${(@Q)${(z)${VISUAL:-${EDITOR:-vi}}}}" )
case $editor in
(*vim*)
integer byteoffset=$(( $#PREBUFFER + $#LBUFFER + 1 ))
- ${=editor} -c "normal! ${byteoffset}go" -- $1;;
+ "${(@)editor}" -c "normal! ${byteoffset}go" -- $1;;
(*emacs*)
- local lines=( ${(f):-"$PREBUFFER$LBUFFER"} )
- ${=editor} +${#lines}:$((${#lines[-1]} + 1)) $1;;
- (*) ${=editor} $1;;
+ local lines=( "${(@f):-"$PREBUFFER$LBUFFER"}" )
+ "${(@)editor}" +${#lines}:$((${#lines[-1]} + 1)) $1;;
+ (*) "${(@)editor}" $1;;
esac
(( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[1]
diff --git a/INSTALL b/INSTALL
index 99895bd6c..cf70893a7 100644
--- a/INSTALL
+++ b/INSTALL
@@ -47,7 +47,7 @@ Pre-configuration
If you are using a normal source release, skip this section.
If the `configure' script does not already exist -- e.g., if you've got
-a snapshot of the bare sources just checked out from a CVS repository
+a snapshot of the bare sources just checked out from a git repository
-- some things need to be built before the configuration can proceed.
Run the script `./Util/preconfig' to do this.
diff --git a/NEWS b/NEWS
index 6847350ef..77f13bb3e 100644
--- a/NEWS
+++ b/NEWS
@@ -4,9 +4,26 @@ CHANGES FROM PREVIOUS VERSIONS OF ZSH
Note also the list of incompatibilities in the README file.
-Changes from 5.3.1 to 5.4
+Changes from 5.4.2 to 5.5
-------------------------
+The effect of the NO_INTERACTIVE_COMMENTS option extends into $(...) and
+`...` command substitutions when used on the command line. Previously,
+comments were always recognized within command substitutions unless the
+comment character "#" was disabled via reset of $histchars.
+
+An alternative assignment syntax for indicating indices for arrays
+and keys for associative arrays:
+
+typeset -a array=([1]=first [2]=second)
+typeset -A assoc=([key1]=val1 [key2]=val2)
+
+is allowed for compatibility with other shells. In the case of normal
+arrays the new syntax can be mixed with the old.
+
+Changes from 5.3.1 to 5.4.2
+---------------------------
+
The 'exec' and 'command' precommand modifiers, and options to them, are
now parsed after parameter expansion. Previously, both the modifier and
any options to it were parsed between alias expansion and parameter
diff --git a/README b/README
index e22cfc12e..4e7aa32bb 100644
--- a/README
+++ b/README
@@ -5,11 +5,12 @@ THE Z SHELL (ZSH)
Version
-------
-This is version 5.4.2 of the shell. This is a stable release. There
-are some significant bug fixes over 5.4.1 and a few visible improvements
-since 5.3.1, the previous widely released version, as well as many
-bug fixes. Note in particular the changs highlighted under
-"Incompatibilites since 5.3.1" below. See NEWS for more information.
+This is version 5.5 of the shell. This is a stable release. There
+are some significant bug fixes and a few user visible additions since
+5.4.2. All zsh installations are encouraged to upgrade.
+
+Note in particular the changes highlighted under "Incompatibilities since
+5.4.2" below. See NEWS for more information.
Installing Zsh
--------------
@@ -30,9 +31,45 @@ Zsh is a shell with lots of features. For a list of some of these, see the
file FEATURES, and for the latest changes see NEWS. For more
details, see the documentation.
-Incompatibilities since 5.3.1
+Incompatibilities since 5.4.2
-----------------------------
+1) The default build-time maximum nested function depth has been
+decreased from 1000 to 500 based on user experience. However,
+it can now be changed at run time via the variable FUNCNEST.
+If you previously configured the shell to set a different value,
+or to remove the check, this is now reflected in the default
+value of the variable.
+
+2) The syntax
+
+foo=([key]=value)
+
+can be used to set elements of arrays and associative arrays. In the
+unlikely event that you need to set an array by matching files using a
+pattern that starts with a character range followed by '=', you need to
+quote the '=', e.g.:
+
+foo=([aeiou]\=vowel)
+
+This is only required for array values contained within parentheses;
+command line expansion for normal arguments has not changed.
+
+3) The syntax
+
+[[ -o foo ]]
+
+where foo is not the name of a shell option (with optional underscores
+and optional "no" prefix) used to be treated as a syntax error, i.e.,
+the enclosing command line or file were aborted. It now emits a warning
+and returns a non-zero exit code. For further details, see the
+documentation of the -o switch in the chapter "Conditional Expressions"
+in the zshmisc(1) manual.
+
+
+Incompatibilities between 5.3.1 and 5.4.2
+-----------------------------------------
+
1) The default behaviour of code like the following has changed:
alias foo='noglob foo'
@@ -252,6 +289,17 @@ This is also necessary in the unusual eventuality that the builtins are
to be overridden by shell functions, since reserved words take
precedence over functions.
+10) For compatilibity with other shells, the syntax
+
+array=([index]=value)
+
+can be used with both assoiative arrays and normal arrays. In the
+unlikely event that you wish to create an array with an entry
+matching a file whose name consists of one of a range of characters
+matched as a [...] expression, followed by an equal sign, followed
+by arbitrary other charaters, it is now necessary to quote the equals
+sign.
+
Incompatibilites between 5.0.7 and 5.0.8
----------------------------------------
diff --git a/Src/Modules/db_gdbm.c b/Src/Modules/db_gdbm.c
index cf1322459..5f776f407 100644
--- a/Src/Modules/db_gdbm.c
+++ b/Src/Modules/db_gdbm.c
@@ -98,7 +98,7 @@ static struct builtin bintab[] = {
{ name, PM_ARRAY | PM_READONLY, (void *) var, NULL, NULL, NULL, NULL }
/* Holds names of all tied parameters */
-char **zgdbm_tied;
+static char **zgdbm_tied;
static struct paramdef patab[] = {
ROARRPARAMDEF( "zgdbm_tied", &zgdbm_tied ),
diff --git a/Src/Modules/mapfile.c b/Src/Modules/mapfile.c
index 2503b361e..7a903418f 100644
--- a/Src/Modules/mapfile.c
+++ b/Src/Modules/mapfile.c
@@ -198,7 +198,7 @@ get_contents(char *fname)
if ((fd = open(fname, O_RDONLY | O_NOCTTY)) >= 0) {
LinkList ll;
- if ((ll = readoutput(fd, 1)))
+ if ((ll = readoutput(fd, 1, 0)))
val = peekfirst(ll);
}
#endif /* USE_MMAP */
diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c
index 659fd22d5..15ee34bc8 100644
--- a/Src/Modules/pcre.c
+++ b/Src/Modules/pcre.c
@@ -88,10 +88,19 @@ bin_pcre_compile(char *nam, char **args, Options ops, UNUSED(int func))
if (zpcre_utf8_enabled())
pcre_opts |= PCRE_UTF8;
- pcre_hints = NULL; /* Is this necessary? */
+#ifdef HAVE_PCRE_STUDY
+ if (pcre_hints)
+#ifdef PCRE_CONFIG_JIT
+ pcre_free_study(pcre_hints);
+#else
+ pcre_free(pcre_hints);
+#endif
+ pcre_hints = NULL;
+#endif
if (pcre_pattern)
pcre_free(pcre_pattern);
+ pcre_pattern = NULL;
target = ztrdup(*args);
unmetafy(target, &target_len);
@@ -128,6 +137,14 @@ bin_pcre_study(char *nam, UNUSED(char **args), UNUSED(Options ops), UNUSED(int f
return 1;
}
+ if (pcre_hints)
+#ifdef PCRE_CONFIG_JIT
+ pcre_free_study(pcre_hints);
+#else
+ pcre_free(pcre_hints);
+#endif
+ pcre_hints = NULL;
+
pcre_hints = pcre_study(pcre_pattern, 0, &pcre_error);
if (pcre_error != NULL)
{
@@ -528,5 +545,21 @@ cleanup_(Module m)
int
finish_(UNUSED(Module m))
{
+#if defined(HAVE_PCRE_COMPILE) && defined(HAVE_PCRE_EXEC)
+#ifdef HAVE_PCRE_STUDY
+ if (pcre_hints)
+#ifdef PCRE_CONFIG_JIT
+ pcre_free_study(pcre_hints);
+#else
+ pcre_free(pcre_hints);
+#endif
+ pcre_hints = NULL;
+#endif
+
+ if (pcre_pattern)
+ pcre_free(pcre_pattern);
+ pcre_pattern = NULL;
+#endif
+
return 0;
}
diff --git a/Src/Modules/system.c b/Src/Modules/system.c
index 3eecd7e95..9fd4d2583 100644
--- a/Src/Modules/system.c
+++ b/Src/Modules/system.c
@@ -649,22 +649,30 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
if (timeout > 0) {
time_t end = time(NULL) + (time_t)timeout;
while (fcntl(flock_fd, F_SETLK, &lck) < 0) {
- if (errflag)
+ if (errflag) {
+ zclose(flock_fd);
return 1;
+ }
if (errno != EINTR && errno != EACCES && errno != EAGAIN) {
+ zclose(flock_fd);
zwarnnam(nam, "failed to lock file %s: %e", args[0], errno);
return 1;
}
- if (time(NULL) >= end)
+ if (time(NULL) >= end) {
+ zclose(flock_fd);
return 2;
+ }
sleep(1);
}
} else {
while (fcntl(flock_fd, timeout == 0 ? F_SETLK : F_SETLKW, &lck) < 0) {
- if (errflag)
+ if (errflag) {
+ zclose(flock_fd);
return 1;
+ }
if (errno == EINTR)
continue;
+ zclose(flock_fd);
zwarnnam(nam, "failed to lock file %s: %e", args[0], errno);
return 1;
}
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 3c1bef58f..1c93a1d02 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -254,7 +254,12 @@ get_pty(int master, int *retfd)
#elif defined(__FreeBSD__) || defined(__DragonFly__)
static char char1[] = "pqrsPQRS";
static char char2[] = "0123456789abcdefghijklmnopqrstuv";
-#else /* __FreeBSD__ || __DragonFly__ */
+#elif defined(__OpenBSD__)
+ static char char1[] = "pqrstuvwxyzPQRST";
+ static char char2[] = "0123456789"
+ "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+#else /* __FreeBSD__ || __DragonFly__ || __OpenBSD*/
static char char1[] = "pqrstuvwxyzPQRST";
static char char2[] = "0123456789abcdef";
#endif
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index 5414b8ff6..87d13afc1 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -383,7 +383,7 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
* cct is a temporary just to hold flags; it never needs freeing.
*/
struct compctl cct;
- char **argv = *av;
+ char **argv = *av, argv_end[2] = "x";
int ready = 0, hx = 0;
/* Handle `compctl + foo ...' specially: turn it into
@@ -516,14 +516,14 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
}
if ((*argv)[1]) {
p = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "retry specification expected after -%c",
**argv);
return 1;
} else {
p = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
switch (*p) {
case '+':
@@ -553,25 +553,25 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
case 'k':
if ((*argv)[1]) {
cct.keyvar = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "variable name expected after -%c", **argv);
return 1;
} else {
cct.keyvar = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 'K':
if ((*argv)[1]) {
cct.func = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "function name expected after -%c", **argv);
return 1;
} else {
cct.func = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 'Y':
@@ -582,74 +582,74 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
expl:
if ((*argv)[1]) {
cct.explain = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "string expected after -%c", **argv);
return 1;
} else {
cct.explain = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 'y':
if ((*argv)[1]) {
cct.ylist = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "function/variable expected after -%c",
**argv);
} else {
cct.ylist = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 'P':
if ((*argv)[1]) {
cct.prefix = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "string expected after -%c", **argv);
return 1;
} else {
cct.prefix = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 'S':
if ((*argv)[1]) {
cct.suffix = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "string expected after -%c", **argv);
return 1;
} else {
cct.suffix = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 'g':
if ((*argv)[1]) {
cct.glob = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "glob pattern expected after -%c", **argv);
return 1;
} else {
cct.glob = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 's':
if ((*argv)[1]) {
cct.str = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "command string expected after -%c",
**argv);
return 1;
} else {
cct.str = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 'l':
@@ -658,13 +658,13 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
return 1;
} else if ((*argv)[1]) {
cct.subcmd = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "command name expected after -%c", **argv);
return 1;
} else {
cct.subcmd = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 'h':
@@ -673,49 +673,49 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
return 1;
} else if ((*argv)[1]) {
cct.substr = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "command name expected after -%c", **argv);
return 1;
} else {
cct.substr = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 'W':
if ((*argv)[1]) {
cct.withd = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "path expected after -%c", **argv);
return 1;
} else {
cct.withd = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 'J':
if ((*argv)[1]) {
cct.gname = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "group name expected after -%c", **argv);
return 1;
} else {
cct.gname = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 'V':
if ((*argv)[1]) {
cct.gname = (*argv) + 1;
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "group name expected after -%c", **argv);
return 1;
} else {
cct.gname = *++argv;
- *argv = "" - 1;
+ *argv = argv_end;
}
cct.mask2 |= CC_NOSORT;
break;
@@ -738,7 +738,7 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
cct.mstr = NULL;
return 1;
}
- *argv = "" - 1;
+ *argv = argv_end;
} else if (!argv[1]) {
zwarnnam(name, "matching specification expected after -%c",
**argv);
@@ -751,7 +751,7 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
cct.mstr = NULL;
return 1;
}
- *argv = "" - 1;
+ *argv = argv_end;
}
break;
case 'H':
@@ -772,7 +772,7 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
cct.hnum = 0;
if (*cct.hpat == '*' && !cct.hpat[1])
cct.hpat = "";
- *argv = "" - 1;
+ *argv = argv_end;
break;
case 'C':
if (cl) {
@@ -2176,6 +2176,8 @@ gen_matches_files(int dirs, int execs, int all)
if (prpre && *prpre) {
pathpref = dupstring(prpre);
unmetafy(pathpref, &pathpreflen);
+ if (pathpreflen > PATH_MAX)
+ return;
/* system needs NULL termination, not provided by unmetafy */
pathpref[pathpreflen] = '\0';
} else {
@@ -2218,6 +2220,8 @@ gen_matches_files(int dirs, int execs, int all)
* the path buffer by appending the filename. */
ums = dupstring(n);
unmetafy(ums, &umlen);
+ if (umlen + pathpreflen + 1 > PATH_MAX)
+ continue;
memcpy(q, ums, umlen);
q[umlen] = '\0';
/* And do the stat. */
@@ -2232,6 +2236,8 @@ gen_matches_files(int dirs, int execs, int all)
/* We have to test for a path suffix. */
int o = strlen(p), tt;
+ if (o + strlen(psuf) > PATH_MAX)
+ continue;
/* Append it to the path buffer. */
strcpy(p + o, psuf);
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index 68bdf2332..313dcb92f 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -715,11 +715,10 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
case 'E':
if (p[1]) {
dat.dummies = atoi(p + 1);
- p = "" - 1;
+ p += strlen(p+1);
} else if (argv[1]) {
argv++;
dat.dummies = atoi(*argv);
- p = "" - 1;
} else {
zwarnnam(name, "number expected after -%c", *p);
zsfree(mstr);
@@ -744,13 +743,12 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
/* Pasted argument: -Xfoo. */
if (!*sp)
*sp = p + 1;
- p = "" - 1;
+ p += strlen(p+1);
} else if (argv[1]) {
/* Argument in a separate word: -X foo. */
argv++;
if (!*sp)
*sp = *argv;
- p = "" - 1;
} else {
/* Missing argument: argv[N] == "-X", argv[N+1] == NULL. */
zwarnnam(name, e, *p);
@@ -934,19 +932,45 @@ do_comp_vars(int test, int na, char *sa, int nb, char *sb, int mod)
}
case CVT_PRENUM:
case CVT_SUFNUM:
- if (!na)
- return 1;
- if (na > 0 &&
- (int)strlen(test == CVT_PRENUM ? compprefix : compsuffix) >= na) {
- if (mod) {
- if (test == CVT_PRENUM)
- ignore_prefix(na);
- else
- ignore_suffix(na);
- return 1;
- }
+ if (na < 0)
return 0;
+ if (na > 0 && mod) {
+#ifdef MULTIBYTE_SUPPORT
+ if (isset(MULTIBYTE)) {
+ if (test == CVT_PRENUM) {
+ const char *ptr = compprefix;
+ int len = 1;
+ int sum = 0;
+ while (*ptr && na && len) {
+ wint_t wc;
+ len = mb_metacharlenconv(ptr, &wc);
+ ptr += len;
+ sum += len;
+ na--;
+ }
+ if (na)
+ return 0;
+ na = sum;
+ } else {
+ char *end = compsuffix + strlen(compsuffix);
+ char *ptr = end;
+ while (na-- && ptr > compsuffix)
+ ptr = backwardmetafiedchar(compsuffix, ptr, NULL);
+ if (na >= 0)
+ return 0;
+ na = end - ptr;
+ }
+ } else
+#endif
+ if ((int)strlen(test == CVT_PRENUM ? compprefix : compsuffix) >= na)
+ return 0;
+ if (test == CVT_PRENUM)
+ ignore_prefix(na);
+ else
+ ignore_suffix(na);
+ return 1;
}
+ return 1;
case CVT_PREPAT:
case CVT_SUFPAT:
{
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index a83daeff9..e768aee5d 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -1097,6 +1097,9 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop)
if (*p) {
int arg = 0, is_fg;
+ if (idigit(*p))
+ arg = zstrtol(p, &p, 10);
+
len = MB_METACHARLENCONV(p, &cchar);
#ifdef MULTIBYTE_SUPPORT
if (cchar == WEOF)
@@ -1104,9 +1107,6 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop)
#endif
p += len;
- if (idigit(*p))
- arg = zstrtol(p, &p, 10);
-
m = 0;
switch (cchar) {
case ZWC('%'):
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index e704f9ffa..4ce8eeee5 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -1222,7 +1222,7 @@ parse_cadef(char *nam, char **args)
else if (*p == 'A') {
if (p[1]) {
nonarg = p + 1;
- p = "" - 1;
+ p += strlen(p+1);
} else if (args[1])
nonarg = *++args;
else
@@ -1230,7 +1230,7 @@ parse_cadef(char *nam, char **args)
} else if (*p == 'M') {
if (p[1]) {
match = p + 1;
- p = "" - 1;
+ p += strlen(p+1);
} else if (args[1])
match = *++args;
else
@@ -1824,7 +1824,7 @@ ca_inactive(Cadef d, char **xor, int cur, int opts)
char *x;
/* current word could be a prefix of a longer one so only do
* exclusions for single-letter options (for option clumping) */
- int single = (cur == compcurrent);
+ int single = !opts && (cur == compcurrent);
for (; (x = (opts ? "-" : *xor)); xor++) {
int excludeall = 0;
@@ -1933,7 +1933,6 @@ struct castate {
int inopt; /* set to current word pos if word is a recognised option */
int inarg; /* in a normal argument */
int nth; /* number of current normal arg */
- int doff; /* length of current option */
int singles; /* argument consists of clumped options */
int oopt;
int actopts; /* count of active options */
@@ -1943,6 +1942,7 @@ struct castate {
static struct castate ca_laststate;
static int ca_parsed = 0, ca_alloced = 0;
+static int ca_doff; /* no. of chars of ignored prefix (for clumped options or arg to an option) */
static void
freecastate(Castate s)
@@ -2033,7 +2033,7 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
state.argbeg = state.optbeg = state.nargbeg = state.restbeg = state.actopts =
state.nth = state.inopt = state.inarg = state.opt = state.arg = 1;
state.argend = argend = arrlen(compwords) - 1;
- state.doff = state.singles = state.oopt = 0;
+ state.singles = state.oopt = 0;
state.curpos = compcurrent;
state.args = znewlinklist();
state.oargs = (LinkList *) zalloc(d->nopts * sizeof(LinkList));
@@ -2057,7 +2057,7 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
line; line = compwords[cur++]) {
ddef = adef = NULL;
dopt = NULL;
- doff = state.singles = arglast = 0;
+ state.singles = arglast = 0;
oline = line;
#if 0
@@ -2080,7 +2080,7 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
remnulargs(line);
untokenize(line);
- ca_inactive(d, argxor, cur, 0);
+ ca_inactive(d, argxor, cur - 1, 0);
if ((d->flags & CDF_SEP) && cur != compcurrent && !strcmp(line, "--")) {
ca_inactive(d, NULL, cur, 1);
continue;
@@ -2114,7 +2114,7 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
state.opt = 0;
state.argbeg = state.optbeg = state.inopt = cur;
state.argend = argend;
- doff = state.doff = 0;
+ doff = 0;
state.singles = 1;
if (!state.oargs[state.curopt->num])
state.oargs[state.curopt->num] = znewlinklist();
@@ -2287,7 +2287,6 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
memcpy(&ca_laststate, &state, sizeof(state));
ca_laststate.ddef = NULL;
ca_laststate.dopt = NULL;
- ca_laststate.doff = 0;
break;
}
zaddlinknode(state.args, ztrdup(line));
@@ -2324,7 +2323,6 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
ca_laststate.ddef = NULL;
ca_laststate.dopt = NULL;
- ca_laststate.doff = 0;
break;
}
} else if (state.def && state.def->end)
@@ -2338,7 +2336,6 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
memcpy(&ca_laststate, &state, sizeof(state));
ca_laststate.ddef = NULL;
ca_laststate.dopt = NULL;
- ca_laststate.doff = 0;
} else if (cur == compcurrent && !ca_laststate.def) {
if ((ca_laststate.def = ddef)) {
ca_laststate.singles = state.singles;
@@ -2349,7 +2346,7 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
ca_laststate.opt = 1;
state.curopt->active = 1;
} else {
- ca_laststate.doff = doff;
+ ca_doff = doff;
ca_laststate.opt = 0;
}
} else {
@@ -2452,11 +2449,16 @@ ca_set_data(LinkList descr, LinkList act, LinkList subc,
!strcmp((char *) getdata(anode), arg->action))
break;
+ /* with an ignored prefix, we're not completing any normal arguments */
+ if (single && !arg->opt)
+ return;
+
if (!dnode) {
addlinknode(descr, arg->descr);
addlinknode(act, arg->action);
if (!restr) {
+
if ((restr = (arg->type == CAA_RARGS)))
restrict_range(ca_laststate.optbeg, ca_laststate.argend);
else if ((restr = (arg->type == CAA_RREST)))
@@ -2491,8 +2493,11 @@ ca_set_data(LinkList descr, LinkList act, LinkList subc,
* the case above right.
*/
if (arg->type == CAA_NORMAL &&
- opt && optdef && optdef->type == CAO_NEXT)
+ opt && optdef &&
+ (optdef->type == CAO_NEXT || optdef->type == CAO_ODIRECT ||
+ optdef->type == CAO_OEQUAL))
return;
+
if (single)
break;
@@ -2521,7 +2526,6 @@ ca_set_data(LinkList descr, LinkList act, LinkList subc,
if (!single && opt && (lopt || ca_laststate.oopt)) {
opt = NULL;
arg = ca_get_arg(ca_laststate.d, ca_laststate.nth);
-
goto rec;
}
if (!opt && oopt > 0) {
@@ -2590,6 +2594,7 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
multi = !!def->snext; /* if we have sets */
ca_parsed = cap;
+ ca_doff = 0;
while (def) { /* for each set */
use = !ca_parse_line(def, all, multi, first);
@@ -2629,23 +2634,20 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
{
LinkList descr, act, subc;
Caarg arg;
- int ign = 0, ret = 1;
+ int ret = 1;
descr = newlinklist();
act = newlinklist();
subc = newlinklist();
+ ignore_prefix(ca_doff);
while (lstate) {
arg = lstate->def;
if (arg) {
ret = 0;
- if (!ign && lstate->doff > 0) {
- ign = 1;
- ignore_prefix(lstate->doff);
- }
ca_set_data(descr, act, subc, arg->opt, arg,
- lstate->curopt, (lstate->doff > 0));
+ lstate->curopt, (ca_doff > 0));
}
lstate = lstate->snext;
}
@@ -2673,7 +2675,7 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
for (; lstate; lstate = lstate->snext) {
if (lstate->actopts &&
- (lstate->opt || (lstate->doff && lstate->def) ||
+ (lstate->opt || lstate->def ||
(lstate->def && lstate->def->opt &&
(lstate->def->type == CAA_OPT ||
(lstate->def->type >= CAA_RARGS &&
diff --git a/Src/Zle/textobjects.c b/Src/Zle/textobjects.c
index bf83906f2..c93777b65 100644
--- a/Src/Zle/textobjects.c
+++ b/Src/Zle/textobjects.c
@@ -30,13 +30,6 @@
#include "zle.mdh"
#include "textobjects.pro"
-/* class of character: 0 is whitespace, 1 is word character, 2 is other */
-static int
-wordclass(ZLE_CHAR_T x)
-{
- return (ZC_iblank(x) ? 0 : ((ZC_ialnum(x) || (ZWC('_') == x)) ? 1 : 2));
-}
-
static int
blankwordclass(ZLE_CHAR_T x)
{
diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h
index 07b310180..8261da92b 100644
--- a/Src/Zle/zle.h
+++ b/Src/Zle/zle.h
@@ -67,6 +67,7 @@ typedef wint_t ZLE_INT_T;
#define ZC_inblank iswspace
#define ZC_iupper iswupper
#define ZC_iword(x) wcsitype((x), IWORD)
+#define ZC_ipunct iswpunct
#define ZC_tolower towlower
#define ZC_toupper towupper
@@ -153,6 +154,7 @@ static inline int ZS_strncmp(ZLE_STRING_T s1, ZLE_STRING_T s2, size_t l)
#define ZC_inblank inblank
#define ZC_iupper isupper
#define ZC_iword iword
+#define ZC_ipunct ispunct
#define ZC_tolower tulower
#define ZC_toupper tuupper
diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index f7e9829c2..5601c1178 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -731,6 +731,7 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
break;
}
while (*++(*args)) {
+ char skip_this_arg[2] = "x";
switch (**args) {
case 'n':
num = args[0][1] ? args[0]+1 : args[1];
@@ -741,7 +742,7 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
return 1;
}
if (!args[0][1])
- *++args = "" - 1;
+ *++args = skip_this_arg;
saveflag = 1;
zmod.mult = atoi(num);
zmod.flags |= MOD_MULT;
@@ -760,7 +761,7 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
return 1;
}
if (!args[0][1])
- *++args = "" - 1;
+ *++args = skip_this_arg;
keymap_restore = dupstring(curkeymapname);
if (selectkeymap(keymap_tmp, 0)) {
if (remetafy)
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 5a9cccb6f..22c381237 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -456,6 +456,7 @@ checkparams(char *p)
static int
cmphaswilds(char *str)
{
+ char *ptr;
if ((*str == Inbrack || *str == Outbrack) && !str[1])
return 0;
@@ -465,6 +466,14 @@ cmphaswilds(char *str)
if (str[0] == '%' && str[1] ==Quest)
str += 2;
+ /*
+ * In ~[foo], the square brackets are not wild cards.
+ * This test matches the master one in filesubstr().
+ */
+ if (*str == Tilde && str[1] == Inbrack &&
+ (ptr = strchr(str+2, Outbrack)))
+ str = ptr + 1;
+
for (; *str;) {
if (*str == String || *str == Qstring) {
/* A parameter expression. */
@@ -2268,7 +2277,7 @@ doexpansion(char *s, int lst, int olst, int explincmd)
int ng = opts[NULLGLOB];
opts[NULLGLOB] = 1;
- globlist(vl, 1);
+ globlist(vl, PREFORK_NO_UNTOK);
opts[NULLGLOB] = ng;
}
if (errflag)
diff --git a/Src/Zle/zle_word.c b/Src/Zle/zle_word.c
index e4a878eab..89959b20c 100644
--- a/Src/Zle/zle_word.c
+++ b/Src/Zle/zle_word.c
@@ -64,7 +64,18 @@ forwardword(char **args)
return 0;
}
-#define Z_vialnum(X) (ZC_ialnum(X) || (ZWC('_') == X))
+/*
+ * class of character (for vi-mode word motion)
+ * 0: blank, 1: alnum or _, 2: punctuation, 3: the others
+ */
+
+/**/
+int
+wordclass(ZLE_CHAR_T x)
+{
+ return (ZC_iblank(x) ? 0 : ((ZC_ialnum(x) || (ZWC('_') == x)) ? 1 :
+ ZC_ipunct(x) ? 2 : 3));
+}
/**/
int
@@ -75,19 +86,16 @@ viforwardword(char **args)
if (n < 0) {
int ret;
zmult = -n;
- ret = backwardword(args);
+ ret = vibackwardword(args);
zmult = n;
return ret;
}
while (n--) {
int nl;
- if (Z_vialnum(zleline[zlecs]))
- while (zlecs != zlell && Z_vialnum(zleline[zlecs]))
- INCCS();
- else
- while (zlecs != zlell && !Z_vialnum(zleline[zlecs]) &&
- !ZC_inblank(zleline[zlecs]))
- INCCS();
+ int cc = wordclass(zleline[zlecs]);
+ while (zlecs != zlell && wordclass(zleline[zlecs]) == cc) {
+ INCCS();
+ }
if (wordflag && !n)
return 0;
nl = (zleline[zlecs] == ZWC('\n'));
@@ -160,7 +168,7 @@ viforwardblankwordend(char **args)
if (n < 0) {
int ret;
zmult = -n;
- ret = viforwardblankwordend(args);
+ ret = vibackwardblankwordend(args);
zmult = n;
return ret;
}
@@ -208,26 +216,17 @@ viforwardwordend(char **args)
zlecs = pos;
}
if (zlecs != zlell) {
+ int cc;
pos = zlecs;
INCPOS(pos);
- if (Z_vialnum(zleline[pos])) {
- for (;;) {
- zlecs = pos;
- if (zlecs == zlell)
+ cc = wordclass(zleline[pos]);
+ for (;;) {
+ zlecs = pos;
+ if (zlecs == zlell)
+ break;
+ INCPOS(pos);
+ if (wordclass(zleline[pos]) != cc)
break;
- INCPOS(pos);
- if (!Z_vialnum(zleline[pos]))
- break;
- }
- } else {
- for (;;) {
- zlecs = pos;
- if (zlecs == zlell)
- break;
- INCPOS(pos);
- if (Z_vialnum(zleline[pos]) || ZC_inblank(zleline[pos]))
- break;
- }
}
}
}
@@ -277,7 +276,7 @@ vibackwardword(char **args)
if (n < 0) {
int ret;
zmult = -n;
- ret = backwardword(args);
+ ret = viforwardword(args);
zmult = n;
return ret;
}
@@ -295,24 +294,14 @@ vibackwardword(char **args)
}
if (zlecs) {
int pos = zlecs;
- if (Z_vialnum(zleline[pos])) {
- for (;;) {
- zlecs = pos;
- if (zlecs == 0)
- break;
- DECPOS(pos);
- if (!Z_vialnum(zleline[pos]))
- break;
- }
- } else {
- for (;;) {
- zlecs = pos;
- if (zlecs == 0)
- break;
- DECPOS(pos);
- if (Z_vialnum(zleline[pos]) || ZC_inblank(zleline[pos]))
- break;
- }
+ int cc = wordclass(zleline[pos]);
+ for (;;) {
+ zlecs = pos;
+ if (zlecs == 0)
+ break;
+ DECPOS(pos);
+ if (wordclass(zleline[pos]) != cc || ZC_inblank(zleline[pos]))
+ break;
}
}
}
@@ -368,17 +357,10 @@ vibackwardwordend(char **args)
return ret;
}
while (n-- && zlecs > 1) {
- int start = 0;
- if (Z_vialnum(zleline[zlecs]))
- start = 1;
- else if (!ZC_inblank(zleline[zlecs]))
- start = 2;
+ int cc = wordclass(zleline[zlecs]);
DECCS();
while (zlecs) {
- int same = (start != 1) && ZC_iblank(zleline[zlecs]);
- if (start)
- same |= Z_vialnum(zleline[zlecs]);
- if (same == (start == 2))
+ if (wordclass(zleline[zlecs]) != cc || ZC_iblank(zleline[zlecs]))
break;
DECCS();
}
@@ -494,26 +476,17 @@ vibackwardkillword(UNUSED(char **args))
x = pos;
}
if (x > lim) {
+ int cc;
int pos = x;
DECPOS(pos);
- if (Z_vialnum(zleline[pos])) {
- for (;;) {
- x = pos;
- if (x <= lim)
- break;
- DECPOS(pos);
- if (!Z_vialnum(zleline[pos]))
- break;
- }
- } else {
- for (;;) {
- x = pos;
- if (x <= lim)
- break;
- DECPOS(pos);
- if (Z_vialnum(zleline[pos]) || ZC_iblank(zleline[pos]))
- break;
- }
+ cc = wordclass(zleline[pos]);
+ for (;;) {
+ x = pos;
+ if (x <= lim)
+ break;
+ DECPOS(pos);
+ if (wordclass(zleline[pos]) != cc)
+ break;
}
}
}
diff --git a/Src/builtin.c b/Src/builtin.c
index 2e72ba20a..fb59738f3 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -53,7 +53,7 @@ static struct builtin builtins[] =
BUILTIN("cd", BINF_SKIPINVALID | BINF_SKIPDASH | BINF_DASHDASHVALID, bin_cd, 0, 2, BIN_CD, "qsPL", NULL),
BUILTIN("chdir", BINF_SKIPINVALID | BINF_SKIPDASH | BINF_DASHDASHVALID, bin_cd, 0, 2, BIN_CD, "qsPL", NULL),
BUILTIN("continue", BINF_PSPECIAL, bin_break, 0, 1, BIN_CONTINUE, NULL, NULL),
- BUILTIN("declare", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%afghi:%klmprtuxz", NULL),
+ BUILTIN("declare", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%afghi:%klmp:%rtuxz", NULL),
BUILTIN("dirs", 0, bin_dirs, 0, -1, 0, "clpv", NULL),
BUILTIN("disable", 0, bin_enable, 0, -1, BIN_DISABLE, "afmprs", NULL),
BUILTIN("disown", 0, bin_fg, 0, -1, BIN_DISOWN, NULL, NULL),
@@ -62,7 +62,7 @@ static struct builtin builtins[] =
BUILTIN("enable", 0, bin_enable, 0, -1, BIN_ENABLE, "afmprs", NULL),
BUILTIN("eval", BINF_PSPECIAL, bin_eval, 0, -1, BIN_EVAL, NULL, NULL),
BUILTIN("exit", BINF_PSPECIAL, bin_break, 0, 1, BIN_EXIT, NULL, NULL),
- BUILTIN("export", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "E:%F:%HL:%R:%TUZ:%afhi:%lprtu", "xg"),
+ BUILTIN("export", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "E:%F:%HL:%R:%TUZ:%afhi:%lp:%rtu", "xg"),
BUILTIN("false", 0, bin_false, 0, -1, 0, NULL, NULL),
/*
* We used to behave as if the argument to -e was optional.
@@ -71,7 +71,7 @@ static struct builtin builtins[] =
*/
BUILTIN("fc", 0, bin_fc, 0, -1, BIN_FC, "aAdDe:EfiIlLmnpPrRt:W", NULL),
BUILTIN("fg", 0, bin_fg, 0, -1, BIN_FG, NULL, NULL),
- BUILTIN("float", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "E:%F:%HL:%R:%Z:%ghlprtux", "E"),
+ BUILTIN("float", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "E:%F:%HL:%R:%Z:%ghlp:%rtux", "E"),
BUILTIN("functions", BINF_PLUSOPTS, bin_functions, 0, -1, 0, "kmMstTuUWx:z", NULL),
BUILTIN("getln", 0, bin_read, 0, -1, 0, "ecnAlE", "zr"),
BUILTIN("getopts", 0, bin_getopts, 2, -1, 0, NULL, NULL),
@@ -82,11 +82,11 @@ static struct builtin builtins[] =
#endif
BUILTIN("history", 0, bin_fc, 0, -1, BIN_FC, "adDEfiLmnpPrt:", "l"),
- BUILTIN("integer", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "HL:%R:%Z:%ghi:%lprtux", "i"),
+ BUILTIN("integer", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "HL:%R:%Z:%ghi:%lp:%rtux", "i"),
BUILTIN("jobs", 0, bin_fg, 0, -1, BIN_JOBS, "dlpZrs", NULL),
BUILTIN("kill", BINF_HANDLES_OPTS, bin_kill, 0, -1, 0, NULL, NULL),
BUILTIN("let", 0, bin_let, 1, -1, 0, NULL, NULL),
- BUILTIN("local", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%ahi:%lprtux", NULL),
+ BUILTIN("local", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%ahi:%lp:%rtux", NULL),
BUILTIN("log", 0, bin_log, 0, 0, 0, NULL, NULL),
BUILTIN("logout", 0, bin_break, 0, 1, BIN_LOGOUT, NULL, NULL),
@@ -120,12 +120,12 @@ static struct builtin builtins[] =
BUILTIN("trap", BINF_PSPECIAL | BINF_HANDLES_OPTS, bin_trap, 0, -1, 0, NULL, NULL),
BUILTIN("true", 0, bin_true, 0, -1, 0, NULL, NULL),
BUILTIN("type", 0, bin_whence, 0, -1, 0, "ampfsSw", "v"),
- BUILTIN("typeset", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%afghi:%klprtuxmz", NULL),
+ BUILTIN("typeset", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%afghi:%klp:%rtuxmz", NULL),
BUILTIN("umask", 0, bin_umask, 0, 1, 0, "S", NULL),
BUILTIN("unalias", 0, bin_unhash, 0, -1, BIN_UNALIAS, "ams", NULL),
BUILTIN("unfunction", 0, bin_unhash, 1, -1, BIN_UNFUNCTION, "m", "f"),
BUILTIN("unhash", 0, bin_unhash, 1, -1, BIN_UNHASH, "adfms", NULL),
- BUILTIN("unset", BINF_PSPECIAL, bin_unset, 1, -1, 0, "fmv", NULL),
+ BUILTIN("unset", BINF_PSPECIAL, bin_unset, 1, -1, BIN_UNSET, "fmv", NULL),
BUILTIN("unsetopt", 0, bin_setopt, 0, -1, BIN_UNSETOPT, NULL, NULL),
BUILTIN("wait", 0, bin_fg, 0, -1, BIN_WAIT, NULL, NULL),
BUILTIN("whence", 0, bin_whence, 0, -1, 0, "acmpvfsSwx:", NULL),
@@ -450,15 +450,35 @@ execbuiltin(LinkList args, LinkList assigns, Builtin bn)
Asgment asg = (Asgment)node;
fputc(' ', xtrerr);
quotedzputs(asg->name, xtrerr);
- if (asg->is_array) {
- LinkNode arrnode;
+ if (asg->flags & ASG_ARRAY) {
fprintf(xtrerr, "=(");
if (asg->value.array) {
- for (arrnode = firstnode(asg->value.array);
- arrnode;
- incnode(arrnode)) {
- fputc(' ', xtrerr);
- quotedzputs((char *)getdata(arrnode), xtrerr);
+ if (asg->flags & ASG_KEY_VALUE) {
+ LinkNode keynode, valnode;
+ keynode = firstnode(asg->value.array);
+ for (;;) {
+ if (!keynode)
+ break;
+ valnode = nextnode(keynode);
+ if (!valnode)
+ break;
+ fputc('[', xtrerr);
+ quotedzputs((char *)getdata(keynode),
+ xtrerr);
+ fprintf(stderr, "]=");
+ quotedzputs((char *)getdata(valnode),
+ xtrerr);
+ keynode = nextnode(valnode);
+ }
+ } else {
+ LinkNode arrnode;
+ for (arrnode = firstnode(asg->value.array);
+ arrnode;
+ incnode(arrnode)) {
+ fputc(' ', xtrerr);
+ quotedzputs((char *)getdata(arrnode),
+ xtrerr);
+ }
}
}
fprintf(xtrerr, " )");
@@ -1519,7 +1539,7 @@ bin_fc(char *nam, char **argv, Options ops, int func)
asgl = a;
}
a->name = *argv;
- a->is_array = 0;
+ a->flags = 0;
a->value.scalar = s;
a->node.next = a->node.prev = NULL;
argv++;
@@ -1910,7 +1930,7 @@ getasg(char ***argvp, LinkList assigns)
return NULL;
}
asg.name = s;
- asg.is_array = 0;
+ asg.flags = 0;
/* search for `=' */
for (; *s && *s != '='; s++);
@@ -2171,7 +2191,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
* ii. we are creating a new local parameter
*/
if (usepm) {
- if (asg->is_array ?
+ if ((asg->flags & ASG_ARRAY) ?
!(PM_TYPE(pm->node.flags) & (PM_ARRAY|PM_HASHED)) :
(asg->value.scalar && (PM_TYPE(pm->node.flags &
(PM_ARRAY|PM_HASHED))))) {
@@ -2241,10 +2261,11 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
if (asg->value.scalar &&
!(pm = assignsparam(pname, ztrdup(asg->value.scalar), 0)))
return NULL;
- } else if (asg->is_array) {
+ } else if (asg->flags & ASG_ARRAY) {
+ int flags = (asg->flags & ASG_KEY_VALUE) ? ASSPM_KEY_VALUE : 0;
if (!(pm = assignaparam(pname, asg->value.array ?
zlinklist2array(asg->value.array) :
- mkarray(NULL), 0)))
+ mkarray(NULL), flags)))
return NULL;
}
if (errflag)
@@ -2255,7 +2276,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
return pm;
}
- if (asg->is_array ?
+ if ((asg->flags & ASG_ARRAY) ?
!(on & (PM_ARRAY|PM_HASHED)) :
(asg->value.scalar && (on & (PM_ARRAY|PM_HASHED)))) {
zerrnam(cname, "%s: inconsistent type for assignment", pname);
@@ -2287,7 +2308,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
*/
if (!ASG_VALUEP(asg) && !((pm->node.flags|on) & (PM_ARRAY|PM_HASHED))) {
asg->value.scalar = dupstring(getsparam(pname));
- asg->is_array = 0;
+ asg->flags = 0;
}
/* pname may point to pm->nam which is about to disappear */
pname = dupstring(pname);
@@ -2396,13 +2417,14 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
ztrdup(asg->value.scalar ? asg->value.scalar : ""), 0)))
return NULL;
dont_set = 1;
- asg->is_array = 0;
+ asg->flags = 0;
keeplocal = 0;
on = pm->node.flags;
} else if (PM_TYPE(on) == PM_ARRAY && ASG_ARRAYP(asg)) {
+ int flags = (asg->flags & ASG_KEY_VALUE) ? ASSPM_KEY_VALUE : 0;
if (!(pm = assignaparam(pname, asg->value.array ?
zlinklist2array(asg->value.array) :
- mkarray(NULL), 0)))
+ mkarray(NULL), flags)))
return NULL;
dont_set = 1;
keeplocal = 0;
@@ -2479,6 +2501,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
Param ipm = pm;
if (pm->node.flags & (PM_ARRAY|PM_HASHED)) {
char **arrayval;
+ int flags = (asg->flags & ASG_KEY_VALUE) ? ASSPM_KEY_VALUE : 0;
if (!ASG_ARRAYP(asg)) {
/*
* Attempt to assign a scalar value to an array.
@@ -2497,7 +2520,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
arrayval = zlinklist2array(asg->value.array);
else
arrayval = mkarray(NULL);
- if (!(pm=assignaparam(pname, arrayval, 0)))
+ if (!(pm=assignaparam(pname, arrayval, flags)))
return NULL;
} else {
DPUTS(ASG_ARRAYP(asg), "BUG: inconsistent array value for scalar");
@@ -2622,8 +2645,21 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
queue_signals();
/* Given no arguments, list whatever the options specify. */
- if (OPT_ISSET(ops,'p'))
+ if (OPT_ISSET(ops,'p')) {
printflags |= PRINT_TYPESET;
+ if (OPT_HASARG(ops,'p')) {
+ char *eptr;
+ int pflag = (int)zstrtol(OPT_ARG(ops,'p'), &eptr, 10);
+ if (pflag == 1 && !*eptr)
+ printflags |= PRINT_LINE;
+ else if (pflag || *eptr) {
+ zwarnnam(name, "bad argument to -p: %s", OPT_ARG(ops,'p'));
+ unqueue_signals();
+ return 1;
+ }
+ /* -p0 treated as -p for consistency */
+ }
+ }
hasargs = *argv != NULL || (assigns && firstnode(assigns));
if (!hasargs) {
if (!OPT_ISSET(ops,'p')) {
@@ -2750,13 +2786,15 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
* Already tied in the fashion requested.
*/
struct tieddata *tdp = (struct tieddata*)pm->u.data;
+ int flags = (asg->flags & ASG_KEY_VALUE) ?
+ ASSPM_KEY_VALUE : 0;
/* Update join character */
tdp->joinchar = joinchar;
if (asg0.value.scalar)
assignsparam(asg0.name, ztrdup(asg0.value.scalar), 0);
else if (asg->value.array)
assignaparam(
- asg->name, zlinklist2array(asg->value.array), 0);
+ asg->name, zlinklist2array(asg->value.array),flags);
return 0;
} else {
zwarnnam(name, "can't tie already tied scalar: %s",
@@ -2778,7 +2816,7 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
* to be exported properly.
*/
asg2.name = asg->name;
- asg2.is_array = 0;
+ asg2.flags = 0;
asg2.value.array = (LinkList)0;
if (!(apm=typeset_single(name, asg->name,
(Param)paramtab->getnode(paramtab,
@@ -2816,9 +2854,10 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
if (apm->ename)
zsfree(apm->ename);
apm->ename = ztrdup(asg0.name);
- if (asg->value.array)
- assignaparam(asg->name, zlinklist2array(asg->value.array), 0);
- else if (oldval)
+ if (asg->value.array) {
+ int flags = (asg->flags & ASG_KEY_VALUE) ? ASSPM_KEY_VALUE : 0;
+ assignaparam(asg->name, zlinklist2array(asg->value.array), flags);
+ } else if (oldval)
assignsparam(asg0.name, oldval, 0);
unqueue_signals();
@@ -4119,6 +4158,10 @@ bin_unhash(char *name, char **argv, Options ops, int func)
for (; *argv; argv++) {
if ((hn = ht->removenode(ht, *argv))) {
ht->freenode(hn);
+ } else if (func == BIN_UNSET && isset(POSIXBUILTINS)) {
+ /* POSIX: unset: "Unsetting a variable or function that was *
+ * not previously set shall not be considered an error." */
+ returnval = 0;
} else {
zwarnnam(name, "no such hash table element: %s", *argv);
returnval = 1;
@@ -5200,7 +5243,10 @@ bin_print(char *name, char **args, Options ops, int func)
*d++ = 'l';
#endif
*d++ = 'l', *d++ = *c, *d = '\0';
- zulongval = (curarg) ? mathevali(curarg) : 0;
+ if (!curarg)
+ zulongval = (zulong)0;
+ else if (!zstrtoul_underscore(curarg, &zulongval))
+ zulongval = mathevali(curarg);
if (errflag) {
zulongval = 0;
errflag &= ~ERRFLAG_ERROR;
@@ -5399,8 +5445,9 @@ bin_getopts(UNUSED(char *name), char **argv, UNUSED(Options ops), UNUSED(int fun
if(quiet) {
zoptarg = metafy(optbuf, lenoptbuf, META_DUP);
} else {
- zwarn(*p == '?' ? "bad option: -%c" :
- "argument expected after -%c option", opch);
+ zwarn(*p == '?' ? "bad option: %c%c" :
+ "argument expected after %c%c option",
+ "?-+"[lenoptbuf], opch);
zoptarg=ztrdup("");
}
return 0;
@@ -5550,7 +5597,8 @@ checkjobs(void)
for (i = 1; i <= maxjob; i++)
if (i != thisjob && (jobtab[i].stat & STAT_LOCKED) &&
- !(jobtab[i].stat & STAT_NOPRINT))
+ !(jobtab[i].stat & STAT_NOPRINT) &&
+ (isset(CHECKRUNNINGJOBS) || jobtab[i].stat & STAT_STOPPED))
break;
if (i <= maxjob) {
if (jobtab[i].stat & STAT_STOPPED) {
@@ -5905,7 +5953,7 @@ bin_emulate(char *nam, char **argv, Options ops, UNUSED(int func))
savehackchar = keyboardhackchar;
emulate(shname, opt_R, &new_emulation, new_opts);
optlist = newlinklist();
- if (parseopts(nam, &argv, new_opts, &cmd, optlist)) {
+ if (parseopts(nam, &argv, new_opts, &cmd, optlist, 0)) {
ret = 1;
goto restore;
}
diff --git a/Src/cond.c b/Src/cond.c
index b9a47cea5..9f13e07d7 100644
--- a/Src/cond.c
+++ b/Src/cond.c
@@ -61,7 +61,8 @@ static void cond_subst(char **strp, int glob_ok)
* of functionality.
*
* Return status is the final shell status, i.e. 0 for true,
- * 1 for false and 2 for error.
+ * 1 for false, 2 for syntax error, 3 for "option in tested in
+ * -o does not exist".
*/
/**/
@@ -86,10 +87,10 @@ evalcond(Estate state, char *fromtest)
if (tracingcond)
fprintf(xtrerr, " %s", condstr[ctype]);
ret = evalcond(state, fromtest);
- if (ret == 2)
- return ret;
- else
+ if (ret == 0 || ret == 1)
return !ret;
+ else
+ return ret;
case COND_AND:
if (!(ret = evalcond(state, fromtest))) {
if (tracingcond)
@@ -100,7 +101,8 @@ evalcond(Estate state, char *fromtest)
return ret;
}
case COND_OR:
- if ((ret = evalcond(state, fromtest)) == 1) {
+ ret = evalcond(state, fromtest);
+ if (ret == 1 || ret == 3) {
if (tracingcond)
fprintf(xtrerr, " %s", condstr[ctype]);
goto rec;
@@ -506,8 +508,12 @@ optison(char *name, char *s)
else
i = optlookup(s);
if (!i) {
- zwarnnam(name, "no such option: %s", s);
- return 2;
+ if (isset(POSIXBUILTINS))
+ return 1;
+ else {
+ zwarnnam(name, "no such option: %s", s);
+ return 3;
+ }
} else if(i < 0)
return !unset(-i);
else
diff --git a/Src/exec.c b/Src/exec.c
index cd99733f1..e154d1249 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -41,6 +41,20 @@ enum {
ADDVAR_RESTORE = 1 << 2
};
+/* Structure in which to save values around shell function call */
+
+struct funcsave {
+ char opts[OPT_SIZE];
+ char *argv0;
+ int zoptind, lastval, optcind, numpipestats;
+ int *pipestats;
+ char *scriptname;
+ int breaks, contflag, loops, emulation, noerrexit, oflags, restore_sticky;
+ Emulation_options sticky;
+ struct funcstack fstack;
+};
+typedef struct funcsave *Funcsave;
+
/*
* used to suppress ERREXIT and trapping of SIGZERR, SIGEXIT.
* Bits from noerrexit_bits.
@@ -920,7 +934,7 @@ hashcmd(char *arg0, char **pp)
for (; *pp; pp++)
if (**pp == '/') {
s = buf;
- strucpy(&s, *pp);
+ struncpy(&s, *pp, PATH_MAX);
*s++ = '/';
if ((s - buf) + strlen(arg0) >= PATH_MAX)
continue;
@@ -1305,7 +1319,9 @@ execlist(Estate state, int dont_change_job, int exiting)
noerrexit = NOERREXIT_EXIT | NOERREXIT_RETURN;
if (ltype & Z_SIMPLE) /* skip the line number */
pc2++;
- pm = setsparam("ZSH_DEBUG_CMD", getpermtext(state->prog, pc2, 0));
+ pm = assignsparam("ZSH_DEBUG_CMD",
+ getpermtext(state->prog, pc2, 0),
+ 0);
exiting = donetrap;
ret = lastval;
@@ -2325,16 +2341,19 @@ addfd(int forked, int *save, struct multio **mfds, int fd1, int fd2, int rflag,
* fd1 may already be closed here, so
* ignore bad file descriptor error
*/
- if (fdN < 0 && errno != EBADF) {
- zerr("cannot duplicate fd %d: %e", fd1, errno);
- mfds[fd1] = NULL;
- closemnodes(mfds);
- return;
+ if (fdN < 0) {
+ if (errno != EBADF) {
+ zerr("cannot duplicate fd %d: %e", fd1, errno);
+ mfds[fd1] = NULL;
+ closemnodes(mfds);
+ return;
+ }
+ } else {
+ DPUTS(fdtable[fdN] != FDT_INTERNAL,
+ "Saved file descriptor not marked as internal");
+ fdtable[fdN] |= FDT_SAVED_MASK;
}
save[fd1] = fdN;
- DPUTS(fdtable[fdN] != FDT_INTERNAL,
- "Saved file descriptor not marked as internal");
- fdtable[fdN] |= FDT_SAVED_MASK;
}
}
}
@@ -2428,29 +2447,37 @@ addvars(Estate state, Wordcode pc, int addflags)
if ((isstr = (WC_ASSIGN_TYPE(ac) == WC_ASSIGN_SCALAR))) {
init_list1(svl, ecgetstr(state, EC_DUPTOK, &htok));
vl = &svl;
- } else
+ } else {
vl = ecgetlist(state, WC_ASSIGN_NUM(ac), EC_DUPTOK, &htok);
+ if (errflag) {
+ state->pc = opc;
+ return;
+ }
+ }
if (vl && htok) {
+ int prefork_ret = 0;
prefork(vl, (isstr ? (PREFORK_SINGLE|PREFORK_ASSIGN) :
- PREFORK_ASSIGN), NULL);
+ PREFORK_ASSIGN), &prefork_ret);
if (errflag) {
state->pc = opc;
return;
}
+ if (prefork_ret & PREFORK_KEY_VALUE)
+ myflags |= ASSPM_KEY_VALUE;
if (!isstr || (isset(GLOBASSIGN) && isstr &&
haswilds((char *)getdata(firstnode(vl))))) {
- globlist(vl, 0);
+ globlist(vl, prefork_ret);
/* Unset the parameter to force it to be recreated
* as either scalar or array depending on how many
* matches were found for the glob.
*/
if (isset(GLOBASSIGN) && isstr)
- unsetparam(name);
- }
- if (errflag) {
- state->pc = opc;
- return;
+ unsetparam(name);
+ if (errflag) {
+ state->pc = opc;
+ return;
+ }
}
}
if (isstr && (empty(vl) || !nextnode(firstnode(vl)))) {
@@ -3007,6 +3034,9 @@ execcmd_exec(Estate state, Execcmd_params eparams,
}
if (exec_argv0) {
char *str, *s;
+ exec_argv0 = dupstring(exec_argv0);
+ remnulargs(exec_argv0);
+ untokenize(exec_argv0);
size_t sz = strlen(exec_argv0);
str = s = zalloc(5 + 1 + sz + 1);
strcpy(s, "ARGV0=");
@@ -3025,7 +3055,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
preargs = NULL;
/* if we get this far, it is OK to pay attention to lastval again */
- if ((noerrexit & NOERREXIT_UNTIL_EXEC) && !is_shfunc)
+ if (noerrexit & NOERREXIT_UNTIL_EXEC)
noerrexit = 0;
/* Do prefork substitutions.
@@ -3188,7 +3218,8 @@ execcmd_exec(Estate state, Execcmd_params eparams,
}
if (errflag) {
- lastval = 1;
+ if (!lastval)
+ lastval = 1;
if (oautocont >= 0)
opts[AUTOCONTINUE] = oautocont;
return;
@@ -3222,19 +3253,24 @@ execcmd_exec(Estate state, Execcmd_params eparams,
next = nextnode(node);
if (s[0] == Star && !s[1]) {
- if (!checkrmall(pwd))
- uremnode(args, node);
+ if (!checkrmall(pwd)) {
+ errflag |= ERRFLAG_ERROR;
+ break;
+ }
} else if (l >= 2 && s[l - 2] == '/' && s[l - 1] == Star) {
char t = s[l - 2];
+ int rmall;
s[l - 2] = 0;
- if (!checkrmall(*s ? s : "/"))
- uremnode(args, node);
+ rmall = checkrmall(s);
s[l - 2] = t;
+
+ if (!rmall) {
+ errflag |= ERRFLAG_ERROR;
+ break;
+ }
}
}
- if (!nextnode(firstnode(args)))
- errflag |= ERRFLAG_ERROR;
}
if (type == WC_FUNCDEF) {
@@ -3911,7 +3947,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
while ((data = ugetnode(&svl))) {
char *ptr;
asg = (Asgment)zhalloc(sizeof(struct asgment));
- asg->is_array = 0;
+ asg->flags = 0;
if ((ptr = strchr(data, '='))) {
*ptr++ = '\0';
asg->name = data;
@@ -3933,7 +3969,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
asg->name = name;
if (WC_ASSIGN_TYPE(ac) == WC_ASSIGN_SCALAR) {
char *val = ecgetstr(state, EC_DUPTOK, &htok);
- asg->is_array = 0;
+ asg->flags = 0;
if (WC_ASSIGN_TYPE2(ac) == WC_ASSIGN_INC) {
/* Fake assignment, no value */
asg->value.scalar = NULL;
@@ -3958,18 +3994,24 @@ execcmd_exec(Estate state, Execcmd_params eparams,
asg->value.scalar = val;
}
} else {
- asg->is_array = 1;
+ asg->flags = ASG_ARRAY;
asg->value.array =
ecgetlist(state, WC_ASSIGN_NUM(ac),
EC_DUPTOK, &htok);
if (asg->value.array)
{
- prefork(asg->value.array, PREFORK_ASSIGN, NULL);
- if (errflag) {
- state->pc = opc;
- break;
+ if (!errflag) {
+ int prefork_ret = 0;
+ prefork(asg->value.array, PREFORK_ASSIGN,
+ &prefork_ret);
+ if (errflag) {
+ state->pc = opc;
+ break;
+ }
+ if (prefork_ret & PREFORK_KEY_VALUE)
+ asg->flags |= ASG_KEY_VALUE;
+ globlist(asg->value.array, prefork_ret);
}
- globlist(asg->value.array, 0);
if (errflag) {
state->pc = opc;
break;
@@ -3982,8 +4024,15 @@ execcmd_exec(Estate state, Execcmd_params eparams,
state->pc = opc;
}
dont_queue_signals();
- if (!errflag)
- lastval = execbuiltin(args, assigns, (Builtin) hn);
+ if (!errflag) {
+ int ret = execbuiltin(args, assigns, (Builtin) hn);
+ /*
+ * In case of interruption assume builtin status
+ * is less useful than what interrupt set.
+ */
+ if (!(errflag & ERRFLAG_INT))
+ lastval = ret;
+ }
if (do_save & BINF_COMMAND)
errflag &= ~ERRFLAG_ERROR;
restore_queue_signals(q);
@@ -4338,8 +4387,17 @@ gethere(char **strp, int typ)
bptr = buf + bsiz;
bsiz *= 2;
}
- if (lexstop || c == '\n')
+ if (lexstop)
break;
+ if (c == '\n') {
+ if (!qt && bptr > t && *(bptr - 1) == '\\') {
+ /* line continuation */
+ bptr--;
+ c = hgetc();
+ continue;
+ } else
+ break;
+ }
*bptr++ = c;
c = hgetc();
}
@@ -4438,12 +4496,19 @@ getoutput(char *cmd, int qt)
pid_t pid;
char *s;
- if (!(prog = parse_string(cmd, 0)))
+ int onc = nocomments;
+ nocomments = (interact && unset(INTERACTIVECOMMENTS));
+ prog = parse_string(cmd, 0);
+ nocomments = onc;
+
+ if (!prog)
return NULL;
if ((s = simple_redir_name(prog, REDIR_READ))) {
/* $(< word) */
int stream;
+ LinkList retval;
+ int readerror;
singsub(&s);
if (errflag)
@@ -4451,9 +4516,15 @@ getoutput(char *cmd, int qt)
untokenize(s);
if ((stream = open(unmeta(s), O_RDONLY | O_NOCTTY)) == -1) {
zwarn("%e: %s", errno, s);
+ lastval = cmdoutval = 1;
return newlinklist();
}
- return readoutput(stream, qt);
+ retval = readoutput(stream, qt, &readerror);
+ if (readerror) {
+ zwarn("error when reading %s: %e", s, readerror);
+ lastval = cmdoutval = 1;
+ }
+ return retval;
}
if (mpipe(pipes) < 0) {
errflag |= ERRFLAG_ERROR;
@@ -4474,7 +4545,7 @@ getoutput(char *cmd, int qt)
LinkList retval;
zclose(pipes[1]);
- retval = readoutput(pipes[0], qt);
+ retval = readoutput(pipes[0], qt, NULL);
fdtable[pipes[0]] = FDT_UNUSED;
waitforpid(pid, 0); /* unblocks */
lastval = cmdoutval;
@@ -4499,7 +4570,7 @@ getoutput(char *cmd, int qt)
/**/
mod_export LinkList
-readoutput(int in, int qt)
+readoutput(int in, int qt, int *readerror)
{
LinkList ret;
char *buf, *ptr;
@@ -4528,6 +4599,8 @@ readoutput(int in, int qt)
}
*ptr++ = c;
}
+ if (readerror)
+ *readerror = ferror(fin) ? errno : 0;
fclose(fin);
while (cnt && ptr[-1] == '\n')
ptr--, cnt--;
@@ -5037,7 +5110,11 @@ execfuncdef(Estate state, Eprog redir_prog)
shf->node.flags = 0;
/* No dircache here, not a directory */
shf->filename = ztrdup(scriptfilename);
- shf->lineno = lineno;
+ shf->lineno =
+ (funcstack && (funcstack->tp == FS_FUNC ||
+ funcstack->tp == FS_EVAL)) ?
+ funcstack->flineno + lineno :
+ lineno;
/*
* redir_prog is permanently allocated --- but if
* this function has multiple names we need an additional
@@ -5057,6 +5134,7 @@ execfuncdef(Estate state, Eprog redir_prog)
LinkList args;
anon_func = 1;
+ shf->node.flags |= PM_ANONYMOUS;
state->pc = end;
end += *state->pc++;
@@ -5462,36 +5540,36 @@ int sticky_emulation_differs(Emulation_options sticky2)
mod_export int
doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
{
- char **pptab, **x, *oargv0;
- int oldzoptind, oldlastval, oldoptcind, oldnumpipestats, ret;
- int *oldpipestats = NULL;
- char saveopts[OPT_SIZE], *oldscriptname = scriptname;
+ char **pptab, **x;
+ int ret;
char *name = shfunc->node.nam;
- int flags = shfunc->node.flags, ooflags;
- int savnoerrexit;
+ int flags = shfunc->node.flags;
char *fname = dupstring(name);
- int obreaks, ocontflag, oloops, saveemulation, restore_sticky;
Eprog prog;
- struct funcstack fstack;
static int oflags;
- Emulation_options save_sticky = NULL;
-#ifdef MAX_FUNCTION_DEPTH
static int funcdepth;
-#endif
Heap funcheap;
queue_signals(); /* Lots of memory and global state changes coming */
NEWHEAPS(funcheap) {
- oargv0 = NULL;
- obreaks = breaks;
- ocontflag = contflag;
- oloops = loops;
+ /*
+ * Save data in heap rather than on stack to keep recursive
+ * function cost down --- use of heap memory should be efficient
+ * at this point. Saving is not actually massive.
+ */
+ Funcsave funcsave = zhalloc(sizeof(struct funcsave));
+ funcsave->scriptname = scriptname;
+ funcsave->argv0 = NULL;
+ funcsave->breaks = breaks;
+ funcsave->contflag = contflag;
+ funcsave->loops = loops;
+ funcsave->lastval = lastval;
+ funcsave->pipestats = NULL;
+ funcsave->numpipestats = numpipestats;
+ funcsave->noerrexit = noerrexit;
if (trap_state == TRAP_STATE_PRIMED)
trap_return--;
- oldlastval = lastval;
- oldnumpipestats = numpipestats;
- savnoerrexit = noerrexit;
/*
* Suppression of ERR_RETURN is turned off in function scope.
*/
@@ -5502,8 +5580,8 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
* immediately by a pushheap/popheap pair.
*/
size_t bytes = sizeof(int)*numpipestats;
- oldpipestats = (int *)zhalloc(bytes);
- memcpy(oldpipestats, pipestats, bytes);
+ funcsave->pipestats = (int *)zhalloc(bytes);
+ memcpy(funcsave->pipestats, pipestats, bytes);
}
starttrapscope();
@@ -5512,8 +5590,8 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
pptab = pparams;
if (!(flags & PM_UNDEFINED))
scriptname = dupstring(name);
- oldzoptind = zoptind;
- oldoptcind = optcind;
+ funcsave->zoptind = zoptind;
+ funcsave->optcind = optcind;
if (!isset(POSIXBUILTINS)) {
zoptind = 1;
optcind = 0;
@@ -5522,9 +5600,9 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
/* We need to save the current options even if LOCALOPTIONS is *
* not currently set. That's because if it gets set in the *
* function we need to restore the original options on exit. */
- memcpy(saveopts, opts, sizeof(opts));
- saveemulation = emulation;
- save_sticky = sticky;
+ memcpy(funcsave->opts, opts, sizeof(opts));
+ funcsave->emulation = emulation;
+ funcsave->sticky = sticky;
if (sticky_emulation_differs(shfunc->sticky)) {
/*
@@ -5541,7 +5619,7 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
*/
sticky = sticky_emulation_dup(shfunc->sticky, 1);
emulation = sticky->emulation;
- restore_sticky = 1;
+ funcsave->restore_sticky = 1;
installemulation(emulation, opts);
if (sticky->n_on_opts) {
OptIndex *onptr;
@@ -5560,7 +5638,7 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
/* All emulations start with pattern disables clear */
clearpatterndisables();
} else
- restore_sticky = 0;
+ funcsave->restore_sticky = 0;
if (flags & (PM_TAGGED|PM_TAGGED_LOCAL))
opts[XTRACE] = 1;
@@ -5578,11 +5656,11 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
else
opts[WARNNESTEDVAR] = 0;
}
- ooflags = oflags;
+ funcsave->oflags = oflags;
/*
* oflags is static, because we compare it on the next recursive
- * call. Hence also we maintain ooflags for restoring the previous
- * value of oflags after the call.
+ * call. Hence also we maintain a saved version for restoring
+ * the previous value of oflags after the call.
*/
oflags = flags;
opts[PRINTEXITVALUE] = 0;
@@ -5593,7 +5671,7 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
pparams = x = (char **) zshcalloc(((sizeof *x) *
(1 + countlinknodes(doshargs))));
if (isset(FUNCTIONARGZERO)) {
- oargv0 = argzero;
+ funcsave->argv0 = argzero;
argzero = ztrdup(getdata(node));
}
/* first node contains name regardless of option */
@@ -5603,32 +5681,31 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
} else {
pparams = (char **) zshcalloc(sizeof *pparams);
if (isset(FUNCTIONARGZERO)) {
- oargv0 = argzero;
+ funcsave->argv0 = argzero;
argzero = ztrdup(argzero);
}
}
-#ifdef MAX_FUNCTION_DEPTH
- if(++funcdepth > MAX_FUNCTION_DEPTH)
- {
- zerr("maximum nested function level reached");
- goto undoshfunc;
- }
-#endif
- fstack.name = dupstring(name);
+ ++funcdepth;
+ if (zsh_funcnest >= 0 && funcdepth > zsh_funcnest) {
+ zerr("maximum nested function level reached; increase FUNCNEST?");
+ lastval = 1;
+ goto undoshfunc;
+ }
+ funcsave->fstack.name = dupstring(name);
/*
* The caller is whatever is immediately before on the stack,
* unless we're at the top, in which case it's the script
* or interactive shell name.
*/
- fstack.caller = funcstack ? funcstack->name :
- dupstring(oargv0 ? oargv0 : argzero);
- fstack.lineno = lineno;
- fstack.prev = funcstack;
- fstack.tp = FS_FUNC;
- funcstack = &fstack;
+ funcsave->fstack.caller = funcstack ? funcstack->name :
+ dupstring(funcsave->argv0 ? funcsave->argv0 : argzero);
+ funcsave->fstack.lineno = lineno;
+ funcsave->fstack.prev = funcstack;
+ funcsave->fstack.tp = FS_FUNC;
+ funcstack = &funcsave->fstack;
- fstack.flineno = shfunc->lineno;
- fstack.filename = getshfuncfile(shfunc);
+ funcsave->fstack.flineno = shfunc->lineno;
+ funcsave->fstack.filename = getshfuncfile(shfunc);
prog = shfunc->funcdef;
if (prog->flags & EF_RUN) {
@@ -5636,7 +5713,7 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
prog->flags &= ~EF_RUN;
- runshfunc(prog, NULL, fstack.name);
+ runshfunc(prog, NULL, funcsave->fstack.name);
if (!(shf = (Shfunc) shfunctab->getnode(shfunctab,
(name = fname)))) {
@@ -5649,54 +5726,52 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
}
prog = shf->funcdef;
}
- runshfunc(prog, wrappers, fstack.name);
+ runshfunc(prog, wrappers, funcsave->fstack.name);
doneshfunc:
- funcstack = fstack.prev;
-#ifdef MAX_FUNCTION_DEPTH
+ funcstack = funcsave->fstack.prev;
undoshfunc:
--funcdepth;
-#endif
if (retflag) {
retflag = 0;
- breaks = obreaks;
+ breaks = funcsave->breaks;
}
freearray(pparams);
- if (oargv0) {
+ if (funcsave->argv0) {
zsfree(argzero);
- argzero = oargv0;
+ argzero = funcsave->argv0;
}
pparams = pptab;
if (!isset(POSIXBUILTINS)) {
- zoptind = oldzoptind;
- optcind = oldoptcind;
+ zoptind = funcsave->zoptind;
+ optcind = funcsave->optcind;
}
- scriptname = oldscriptname;
- oflags = ooflags;
+ scriptname = funcsave->scriptname;
+ oflags = funcsave->oflags;
endpatternscope(); /* before restoring old LOCALPATTERNS */
- if (restore_sticky) {
+ if (funcsave->restore_sticky) {
/*
* If we switched to an emulation environment just for
* this function, we interpret the option and emulation
* switch as being a firewall between environments.
*/
- memcpy(opts, saveopts, sizeof(opts));
- emulation = saveemulation;
- sticky = save_sticky;
+ memcpy(opts, funcsave->opts, sizeof(opts));
+ emulation = funcsave->emulation;
+ sticky = funcsave->sticky;
} else if (isset(LOCALOPTIONS)) {
/* restore all shell options except PRIVILEGED and RESTRICTED */
- saveopts[PRIVILEGED] = opts[PRIVILEGED];
- saveopts[RESTRICTED] = opts[RESTRICTED];
- memcpy(opts, saveopts, sizeof(opts));
- emulation = saveemulation;
+ funcsave->opts[PRIVILEGED] = opts[PRIVILEGED];
+ funcsave->opts[RESTRICTED] = opts[RESTRICTED];
+ memcpy(opts, funcsave->opts, sizeof(opts));
+ emulation = funcsave->emulation;
} else {
/* just restore a couple. */
- opts[XTRACE] = saveopts[XTRACE];
- opts[PRINTEXITVALUE] = saveopts[PRINTEXITVALUE];
- opts[LOCALOPTIONS] = saveopts[LOCALOPTIONS];
- opts[LOCALLOOPS] = saveopts[LOCALLOOPS];
- opts[WARNNESTEDVAR] = saveopts[WARNNESTEDVAR];
+ opts[XTRACE] = funcsave->opts[XTRACE];
+ opts[PRINTEXITVALUE] = funcsave->opts[PRINTEXITVALUE];
+ opts[LOCALOPTIONS] = funcsave->opts[LOCALOPTIONS];
+ opts[LOCALLOOPS] = funcsave->opts[LOCALLOOPS];
+ opts[WARNNESTEDVAR] = funcsave->opts[WARNNESTEDVAR];
}
if (opts[LOCALLOOPS]) {
@@ -5704,9 +5779,9 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
zwarn("`continue' active at end of function scope");
if (breaks)
zwarn("`break' active at end of function scope");
- breaks = obreaks;
- contflag = ocontflag;
- loops = oloops;
+ breaks = funcsave->breaks;
+ contflag = funcsave->contflag;
+ loops = funcsave->loops;
}
endtrapscope();
@@ -5714,11 +5789,11 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
if (trap_state == TRAP_STATE_PRIMED)
trap_return++;
ret = lastval;
- noerrexit = savnoerrexit;
+ noerrexit = funcsave->noerrexit;
if (noreturnval) {
- lastval = oldlastval;
- numpipestats = oldnumpipestats;
- memcpy(pipestats, oldpipestats, sizeof(int)*numpipestats);
+ lastval = funcsave->lastval;
+ numpipestats = funcsave->numpipestats;
+ memcpy(pipestats, funcsave->pipestats, sizeof(int)*numpipestats);
}
} OLDHEAPS;
@@ -5888,6 +5963,7 @@ stripkshdef(Eprog prog, char *name)
{
Wordcode pc;
wordcode code;
+ char *ptr1, *ptr2;
if (!prog)
return NULL;
@@ -5898,8 +5974,25 @@ stripkshdef(Eprog prog, char *name)
return prog;
pc++;
code = *pc++;
- if (wc_code(code) != WC_FUNCDEF ||
- *pc != 1 || strcmp(name, ecrawstr(prog, pc + 1, NULL)))
+ if (wc_code(code) != WC_FUNCDEF || *pc != 1)
+ return prog;
+
+ /*
+ * See if name of function requested (name) is same as
+ * name of function in word code. name may still have "-"
+ * tokenised. The word code shouldn't, as function names should be
+ * untokenised, but reports say it sometimes does.
+ */
+ ptr1 = name;
+ ptr2 = ecrawstr(prog, pc + 1, NULL);
+ while (*ptr1 && *ptr2) {
+ if (*ptr1 != *ptr2 && *ptr1 != Dash && *ptr1 != '-' &&
+ *ptr2 != Dash && *ptr2 != '-')
+ break;
+ ptr1++;
+ ptr2++;
+ }
+ if (*ptr1 || *ptr2)
return prog;
{
diff --git a/Src/glob.c b/Src/glob.c
index c9ec97e0e..66a95329f 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -387,7 +387,7 @@ insert(char *s, int checked)
qn = qn->next;
}
} else if (!checked) {
- if (statfullpath(s, NULL, 1)) {
+ if (statfullpath(s, &buf, 1)) {
unqueue_signals();
return;
}
diff --git a/Src/hashtable.c b/Src/hashtable.c
index 6ec2ed220..b7baa3142 100644
--- a/Src/hashtable.c
+++ b/Src/hashtable.c
@@ -1261,6 +1261,8 @@ printaliasnode(HashNode hn, int printflags)
if (printflags & PRINT_WHENCE_WORD) {
if (a->node.flags & ALIAS_SUFFIX)
printf("%s: suffix alias\n", a->node.nam);
+ else if (a->node.flags & ALIAS_GLOBAL)
+ printf("%s: global alias\n", a->node.nam);
else
printf("%s: alias\n", a->node.nam);
return;
diff --git a/Src/hashtable.h b/Src/hashtable.h
index 3606e9785..21398e17c 100644
--- a/Src/hashtable.h
+++ b/Src/hashtable.h
@@ -62,6 +62,7 @@
#define BIN_UNHASH 28
#define BIN_UNALIAS 29
#define BIN_UNFUNCTION 30
+#define BIN_UNSET 31
/* These currently depend on being 0 and 1. */
#define BIN_SETOPT 0
diff --git a/Src/hist.c b/Src/hist.c
index da5a8b29f..dbdc1e4e5 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -46,6 +46,9 @@ void (*hwaddc) _((int));
void (*hwbegin) _((int));
/**/
+void (*hwabort) _((void));
+
+/**/
void (*hwend) _((void));
/**/
@@ -201,6 +204,13 @@ int hlinesz;
static zlong defev;
+/*
+ * Flag that we stopped reading line when we got to a comment,
+ * but we want to keep it in the histofy even if there were no words
+ * (i.e. the comment was the entire line).
+ */
+static int hist_keep_comment;
+
/* Remember the last line in the history file so we can find it again. */
static struct histfile_stats {
char *text;
@@ -250,10 +260,12 @@ hist_context_save(struct hist_stack *hs, int toplevel)
hs->hungetc = hungetc;
hs->hwaddc = hwaddc;
hs->hwbegin = hwbegin;
+ hs->hwabort = hwabort;
hs->hwend = hwend;
hs->addtoline = addtoline;
hs->hlinesz = hlinesz;
hs->defev = defev;
+ hs->hist_keep_comment = hist_keep_comment;
/*
* We save and restore the command stack with history
* as it's visible to the user interactively, so if
@@ -294,10 +306,12 @@ hist_context_restore(const struct hist_stack *hs, int toplevel)
hungetc = hs->hungetc;
hwaddc = hs->hwaddc;
hwbegin = hs->hwbegin;
+ hwabort = hs->hwabort;
hwend = hs->hwend;
addtoline = hs->addtoline;
hlinesz = hs->hlinesz;
defev = hs->defev;
+ hist_keep_comment = hs->hist_keep_comment;
if (cmdstack)
zfree(cmdstack, CMDSTACKSZ);
cmdstack = hs->cstack;
@@ -451,8 +465,26 @@ herrflush(void)
{
inpopalias();
- while (!lexstop && inbufct && !strin)
- hwaddc(ingetc());
+ if (lexstop)
+ return;
+ /*
+ * The lex_add_raw test is needed if we are parsing a command
+ * substitution when expanding history for ZLE: strin is set but we
+ * need to finish off the input because the string we are reading is
+ * going to be used directly in the line that goes to ZLE.
+ *
+ * Note that this is a side effect --- this is not the usual reason
+ * for testing lex_add_raw which is to add the text to a different
+ * buffer used when we are actually parsing the command substituion
+ * (nothing to do with ZLE). Sorry.
+ */
+ while (inbufct && (!strin || lex_add_raw)) {
+ int c = ingetc();
+ if (!lexstop) {
+ hwaddc(c);
+ addtoline(c);
+ }
+ }
}
/*
@@ -986,6 +1018,11 @@ nohw(UNUSED(int c))
}
static void
+nohwabort(void)
+{
+}
+
+static void
nohwe(void)
{
}
@@ -1057,6 +1094,7 @@ hbegin(int dohist)
hungetc = inungetc;
hwaddc = nohw;
hwbegin = nohw;
+ hwabort = nohwabort;
hwend = nohwe;
addtoline = nohw;
} else {
@@ -1066,6 +1104,7 @@ hbegin(int dohist)
hungetc = ihungetc;
hwaddc = ihwaddc;
hwbegin = ihwbegin;
+ hwabort = ihwabort;
hwend = ihwend;
addtoline = iaddtoline;
if (!isset(BANGHIST))
@@ -1083,7 +1122,6 @@ hbegin(int dohist)
} else
histactive = HA_ACTIVE | HA_NOINC;
- hf = getsparam("HISTFILE");
/*
* For INCAPPENDHISTORYTIME, when interactive, save the history here
* as it gives a better estimate of the times of commands.
@@ -1104,8 +1142,10 @@ hbegin(int dohist)
*/
if (isset(INCAPPENDHISTORYTIME) && !isset(SHAREHISTORY) &&
!isset(INCAPPENDHISTORY) &&
- !(histactive & HA_NOINC) && !strin && histsave_stack_pos == 0)
+ !(histactive & HA_NOINC) && !strin && histsave_stack_pos == 0) {
+ hf = getsparam("HISTFILE");
savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST);
+ }
}
/**/
@@ -1449,7 +1489,7 @@ hend(Eprog prog)
} else
save = 0;
}
- if (chwordpos <= 2)
+ if (chwordpos <= 2 && !hist_keep_comment)
save = 0;
else if (should_ignore_line(prog))
save = -1;
@@ -1552,6 +1592,7 @@ hend(Eprog prog)
*/
while (histsave_stack_pos > stack_pos)
pophiststack();
+ hist_keep_comment = 0;
unqueue_signals();
return !(flag & HISTFLAG_NOEXEC || errflag);
}
@@ -1570,6 +1611,17 @@ ihwbegin(int offset)
chwords[chwordpos++] = hptr - chline + offset;
}
+/* Abort current history word, not needed */
+
+/**/
+void
+ihwabort(void)
+{
+ if (chwordpos%2)
+ chwordpos--;
+ hist_keep_comment = 1;
+}
+
/* add a word to the history List */
/**/
diff --git a/Src/init.c b/Src/init.c
index 87dd2e26d..c5372665a 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -244,33 +244,24 @@ static int restricted;
/**/
static void
-parseargs(char **argv, char **runscript, char **cmdptr)
+parseargs(char *zsh_name, char **argv, char **runscript, char **cmdptr)
{
char **x;
LinkList paramlist;
+ int flags = PARSEARGS_TOPLEVEL;
+ if (**argv == '-')
+ flags |= PARSEARGS_LOGIN;
argzero = posixzero = *argv++;
SHIN = 0;
- /* There's a bit of trickery with opts[INTERACTIVE] here. It starts *
- * at a value of 2 (instead of 1) or 0. If it is explicitly set on *
- * the command line, it goes to 1 or 0. If input is coming from *
- * somewhere that normally makes the shell non-interactive, we do *
- * "opts[INTERACTIVE] &= 1", so that only a *default* on state will *
- * be changed. At the end of the function, a value of 2 gets *
- * changed to 1. */
- opts[INTERACTIVE] = isatty(0) ? 2 : 0;
/*
- * MONITOR is similar: we initialise it to 2, and if it's
- * still 2 at the end, we set it to the value of INTERACTIVE.
+ * parseopts sets up some options after we deal with emulation in
+ * order to be consistent --- the code in parseopts_setemulate() is
+ * matched by code at the end of the present function.
*/
- opts[MONITOR] = 2; /* may be unset in init_io() */
- opts[HASHDIRS] = 2; /* same relationship to INTERACTIVE */
- opts[USEZLE] = 1; /* see below, related to SHINSTDIN */
- opts[SHINSTDIN] = 0;
- opts[SINGLECOMMAND] = 0;
- if (parseopts(NULL, &argv, opts, cmdptr, NULL))
+ if (parseopts(zsh_name, &argv, opts, cmdptr, NULL, flags))
exit(1);
/*
@@ -334,9 +325,45 @@ parseopts_insert(LinkList optlist, char *base, int optno)
}
/*
+ * This sets the global emulation plus the options we traditionally
+ * set immediately after that. This is just for historical consistency
+ * --- I don't think those options actually need to be set here.
+ */
+static void parseopts_setemulate(char *nam, int flags)
+{
+ emulate(nam, 1, &emulation, opts); /* initialises most options */
+ opts[LOGINSHELL] = ((flags & PARSEARGS_LOGIN) != 0);
+ opts[PRIVILEGED] = (getuid() != geteuid() || getgid() != getegid());
+
+ /* There's a bit of trickery with opts[INTERACTIVE] here. It starts *
+ * at a value of 2 (instead of 1) or 0. If it is explicitly set on *
+ * the command line, it goes to 1 or 0. If input is coming from *
+ * somewhere that normally makes the shell non-interactive, we do *
+ * "opts[INTERACTIVE] &= 1", so that only a *default* on state will *
+ * be changed. At the end of the function, a value of 2 gets *
+ * changed to 1. */
+ opts[INTERACTIVE] = isatty(0) ? 2 : 0;
+ /*
+ * MONITOR is similar: we initialise it to 2, and if it's
+ * still 2 at the end, we set it to the value of INTERACTIVE.
+ */
+ opts[MONITOR] = 2; /* may be unset in init_io() */
+ opts[HASHDIRS] = 2; /* same relationship to INTERACTIVE */
+ opts[USEZLE] = 1; /* see below, related to SHINSTDIN */
+ opts[SHINSTDIN] = 0;
+ opts[SINGLECOMMAND] = 0;
+}
+
+/*
* Parse shell options.
- * If nam is not NULL, this is called from a command; don't
- * exit on failure.
+ *
+ * If (flags & PARSEARGS_TOPLEVEL):
+ * - we are doing shell initilisation
+ * - nam is the name under which the shell was started
+ * - set up emulation and standard options based on that.
+ * Otherwise:
+ * - nam is a command name
+ * - don't exit on failure.
*
* If optlist is not NULL, it used to form a list of pointers
* into new_opts indicating which options have been changed.
@@ -345,23 +372,26 @@ parseopts_insert(LinkList optlist, char *base, int optno)
/**/
mod_export int
parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
- LinkList optlist)
+ LinkList optlist, int flags)
{
int optionbreak = 0;
int action, optno;
char **argv = *argvp;
+ int toplevel = ((flags & PARSEARGS_TOPLEVEL) != 0u);
+ int emulate_required = toplevel;
+ char *top_emulation = nam;
*cmdp = 0;
#define WARN_OPTION(F, S) \
do { \
- if (nam) \
+ if (!toplevel) \
zwarnnam(nam, F, S); \
else \
zerr(F, S); \
} while (0)
#define LAST_OPTION(N) \
do { \
- if (nam) { \
+ if (!toplevel) { \
if (*argv) \
argv++; \
goto doneargv; \
@@ -381,7 +411,7 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
argv++;
goto doneoptions;
}
- if (nam || *argv != args+1 || **argv != '-')
+ if (!toplevel || *argv != args+1 || **argv != '-')
goto badoptionstring;
/* GNU-style long options */
++*argv;
@@ -394,6 +424,19 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
printhelp();
LAST_OPTION(0);
}
+ if (!strcmp(*argv, "emulate")) {
+ ++argv;
+ if (!*argv) {
+ zerr("--emulate: argument required");
+ exit(1);
+ }
+ if (!emulate_required) {
+ zerr("--emulate: must precede other options");
+ exit(1);
+ }
+ top_emulation = *argv;
+ break;
+ }
/* `-' characters are allowed in long options */
for(args = *argv; *args; args++)
if(*args == '-')
@@ -402,9 +445,17 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
}
if (unset(SHOPTIONLETTERS) && **argv == 'b') {
+ if (emulate_required) {
+ parseopts_setemulate(top_emulation, flags);
+ emulate_required = 0;
+ }
/* -b ends options at the end of this argument */
optionbreak = 1;
} else if (**argv == 'c') {
+ if (emulate_required) {
+ parseopts_setemulate(top_emulation, flags);
+ emulate_required = 0;
+ }
/* -c command */
*cmdp = *argv;
new_opts[INTERACTIVE] &= 1;
@@ -417,15 +468,20 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
return 1;
}
longoptions:
+ if (emulate_required) {
+ parseopts_setemulate(top_emulation, flags);
+ emulate_required = 0;
+ }
if (!(optno = optlookup(*argv))) {
WARN_OPTION("no such option: %s", *argv);
return 1;
- } else if (optno == RESTRICTED && !nam) {
+ } else if (optno == RESTRICTED && toplevel) {
restricted = action;
- } else if ((optno == EMACSMODE || optno == VIMODE) && nam) {
+ } else if ((optno == EMACSMODE || optno == VIMODE) && !toplevel) {
WARN_OPTION("can't change option: %s", *argv);
} else {
- if (dosetopt(optno, action, !nam, new_opts) && nam) {
+ if (dosetopt(optno, action, toplevel, new_opts) &&
+ !toplevel) {
WARN_OPTION("can't change option: %s", *argv);
} else if (optlist) {
parseopts_insert(optlist, new_opts, optno);
@@ -442,15 +498,21 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
}
break;
} else {
+ if (emulate_required) {
+ parseopts_setemulate(top_emulation, flags);
+ emulate_required = 0;
+ }
if (!(optno = optlookupc(**argv))) {
WARN_OPTION("bad option: -%c", **argv);
return 1;
- } else if (optno == RESTRICTED && !nam) {
+ } else if (optno == RESTRICTED && toplevel) {
restricted = action;
- } else if ((optno == EMACSMODE || optno == VIMODE) && nam) {
+ } else if ((optno == EMACSMODE || optno == VIMODE) &&
+ !toplevel) {
WARN_OPTION("can't change option: %s", *argv);
} else {
- if (dosetopt(optno, action, !nam, new_opts) && nam) {
+ if (dosetopt(optno, action, toplevel, new_opts) &&
+ !toplevel) {
WARN_OPTION("can't change option: -%c", **argv);
} else if (optlist) {
parseopts_insert(optlist, new_opts, optno);
@@ -470,6 +532,10 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
}
doneargv:
*argvp = argv;
+ if (emulate_required) {
+ parseopts_setemulate(top_emulation, flags);
+ emulate_required = 0;
+ }
return 0;
}
@@ -1660,11 +1726,9 @@ zsh_main(UNUSED(int argc), char **argv)
fdtable[0] = fdtable[1] = fdtable[2] = FDT_EXTERNAL;
createoptiontable();
- emulate(zsh_name, 1, &emulation, opts); /* initialises most options */
- opts[LOGINSHELL] = (**argv == '-');
- opts[PRIVILEGED] = (getuid() != geteuid() || getgid() != getegid());
- /* sets ZLE, INTERACTIVE, SHINSTDIN and SINGLECOMMAND */
- parseargs(argv, &runscript, &cmd);
+ /* sets emulation, LOGINSHELL, PRIVILEGED, ZLE, INTERACTIVE,
+ * SHINSTDIN and SINGLECOMMAND */
+ parseargs(zsh_name, argv, &runscript, &cmd);
SHTTY = -1;
init_io(cmd);
diff --git a/Src/jobs.c b/Src/jobs.c
index 66dfb5a7e..330ee6b37 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -728,6 +728,40 @@ printtime(struct timeval *real, child_times_t *ti, char *desc)
case 'S':
fprintf(stderr, "%4.2fs", system_time);
break;
+ case 'm':
+ switch (*++s) {
+ case 'E':
+ fprintf(stderr, "%0.fms", elapsed_time * 1000.0);
+ break;
+ case 'U':
+ fprintf(stderr, "%0.fms", user_time * 1000.0);
+ break;
+ case 'S':
+ fprintf(stderr, "%0.fms", system_time * 1000.0);
+ break;
+ default:
+ fprintf(stderr, "%%m");
+ s--;
+ break;
+ }
+ break;
+ case 'u':
+ switch (*++s) {
+ case 'E':
+ fprintf(stderr, "%0.fus", elapsed_time * 1000000.0);
+ break;
+ case 'U':
+ fprintf(stderr, "%0.fus", user_time * 1000000.0);
+ break;
+ case 'S':
+ fprintf(stderr, "%0.fus", system_time * 1000000.0);
+ break;
+ default:
+ fprintf(stderr, "%%u");
+ s--;
+ break;
+ }
+ break;
case '*':
switch (*++s) {
case 'E':
@@ -891,6 +925,7 @@ should_report_time(Job j)
struct value vbuf;
Value v;
char *s = "REPORTTIME";
+ int save_errflag = errflag;
zlong reporttime = -1;
#ifdef HAVE_GETRUSAGE
char *sm = "REPORTMEMORY";
@@ -902,12 +937,14 @@ should_report_time(Job j)
return 1;
queue_signals();
+ errflag = 0;
if ((v = getvalue(&vbuf, &s, 0)))
reporttime = getintvalue(v);
#ifdef HAVE_GETRUSAGE
if ((v = getvalue(&vbuf, &sm, 0)))
reportmemory = getintvalue(v);
#endif
+ errflag = save_errflag;
unqueue_signals();
if (reporttime < 0
#ifdef HAVE_GETRUSAGE
@@ -2217,7 +2254,8 @@ bin_fg(char *name, char **argv, Options ops, int func)
return 0;
} else { /* Must be BIN_WAIT, so wait for all jobs */
for (job = 0; job <= maxjob; job++)
- if (job != thisjob && jobtab[job].stat)
+ if (job != thisjob && jobtab[job].stat &&
+ !(jobtab[job].stat & STAT_NOPRINT))
retval = zwaitjob(job, 1);
unqueue_signals();
return retval;
@@ -2251,8 +2289,11 @@ bin_fg(char *name, char **argv, Options ops, int func)
*/
retval = waitforpid(pid, 1);
}
- if (retval == 0)
- retval = lastval2;
+ if (retval == 0) {
+ if ((retval = getbgstatus(pid)) < 0) {
+ retval = lastval2;
+ }
+ }
} else if ((retval = getbgstatus(pid)) < 0) {
zwarnnam(name, "pid %d is not a child of this shell", pid);
/* presumably lastval2 doesn't tell us a heck of a lot? */
diff --git a/Src/lex.c b/Src/lex.c
index 8493d4737..44ad88043 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -158,7 +158,7 @@ mod_export int nocomments;
/* add raw input characters while parsing command substitution */
/**/
-static int lex_add_raw;
+int lex_add_raw;
/* variables associated with the above */
@@ -677,7 +677,7 @@ gettok(void)
(char *)hcalloc(lexbuf.siz = LEX_HEAP_SIZE);
add(c);
}
- hwend();
+ hwabort();
while ((c = ingetc()) != '\n' && !lexstop) {
hwaddc(c);
addtoline(c);
@@ -1291,7 +1291,9 @@ gettokstr(int c, int sub)
ALLOWHIST
if (c != '\'') {
unmatched = '\'';
- peek = LEXERR;
+ /* Not an error when called from bufferwords() */
+ if (!(lexflags & LEXFLAGS_ACTIVE))
+ peek = LEXERR;
cmdpop();
goto brk;
}
@@ -1313,7 +1315,9 @@ gettokstr(int c, int sub)
cmdpop();
if (c) {
unmatched = '"';
- peek = LEXERR;
+ /* Not an error when called from bufferwords() */
+ if (!(lexflags & LEXFLAGS_ACTIVE))
+ peek = LEXERR;
goto brk;
}
c = Dnull;
@@ -1350,7 +1354,9 @@ gettokstr(int c, int sub)
cmdpop();
if (c != '`') {
unmatched = '`';
- peek = LEXERR;
+ /* Not an error when called from bufferwords() */
+ if (!(lexflags & LEXFLAGS_ACTIVE))
+ peek = LEXERR;
goto brk;
}
c = Tick;
@@ -1392,7 +1398,7 @@ gettokstr(int c, int sub)
return LEXERR;
}
hungetc(c);
- if (unmatched)
+ if (unmatched && !(lexflags & LEXFLAGS_ACTIVE))
zerr("unmatched %c", unmatched);
if (in_brace_param) {
while(bct-- >= in_brace_param)
@@ -2128,8 +2134,12 @@ skipcomm(void)
* function at the history layer --- this is consistent with the
* intention of maintaining the history and input layers across
* the recursive parsing.
+ *
+ * Also turn off LEXFLAGS_NEWLINE because this is already skipping
+ * across the entire construct, and parse_event() needs embedded
+ * newlines to be "real" when looking for the OUTPAR token.
*/
- lexflags &= ~LEXFLAGS_ZLE;
+ lexflags &= ~(LEXFLAGS_ZLE|LEXFLAGS_NEWLINE);
dbparens = 0; /* restored by zcontext_restore_partial() */
if (!parse_event(OUTPAR) || tok != OUTPAR) {
diff --git a/Src/loop.c b/Src/loop.c
index 4859c976b..1013aeb50 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -428,7 +428,7 @@ execwhile(Estate state, UNUSED(int do_exec))
} else
for (;;) {
state->pc = loop;
- noerrexit = 1;
+ noerrexit = NOERREXIT_EXIT | NOERREXIT_RETURN;
/* In case the test condition is a functional no-op,
* make sure signal handlers recognize ^C to end the loop. */
@@ -541,8 +541,7 @@ execif(Estate state, int do_exec)
olderrexit = noerrexit;
end = state->pc + WC_IF_SKIP(code);
- if (!noerrexit)
- noerrexit = NOERREXIT_EXIT | NOERREXIT_RETURN;
+ noerrexit |= NOERREXIT_EXIT | NOERREXIT_RETURN;
while (state->pc < end) {
code = *state->pc++;
if (wc_code(code) != WC_IF ||
@@ -570,9 +569,9 @@ execif(Estate state, int do_exec)
if (olderrexit)
noerrexit = olderrexit;
else if (lastval)
- noerrexit = NOERREXIT_EXIT | NOERREXIT_RETURN | NOERREXIT_UNTIL_EXEC;
+ noerrexit |= NOERREXIT_EXIT | NOERREXIT_RETURN | NOERREXIT_UNTIL_EXEC;
else
- noerrexit = 0;
+ noerrexit &= ~ (NOERREXIT_EXIT | NOERREXIT_RETURN);
cmdpush(run == 2 ? CS_ELSE : (s ? CS_ELIFTHEN : CS_IFTHEN));
execlist(state, 1, do_exec);
cmdpop();
diff --git a/Src/math.c b/Src/math.c
index f9613001a..c3831602b 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -1306,8 +1306,6 @@ op(int what)
spval->type = MN_INTEGER;
} else
spval->u.l = !spval->u.l;
- stack[sp].lval = NULL;
- stack[sp].pval = NULL;
break;
case COMP:
if (spval->type & MN_FLOAT) {
@@ -1315,8 +1313,6 @@ op(int what)
spval->type = MN_INTEGER;
} else
spval->u.l = ~spval->u.l;
- stack[sp].lval = NULL;
- stack[sp].pval = NULL;
break;
case POSTPLUS:
a = *spval;
@@ -1335,16 +1331,12 @@ op(int what)
(void)setmathvar(stack + sp, a);
break;
case UPLUS:
- stack[sp].lval = NULL;
- stack[sp].pval = NULL;
break;
case UMINUS:
if (spval->type & MN_FLOAT)
spval->u.d = -spval->u.d;
else
spval->u.l = -spval->u.l;
- stack[sp].lval = NULL;
- stack[sp].pval = NULL;
break;
case QUEST:
DPUTS(sp < 2, "BUG: math: three shall be the number of the counting.");
@@ -1377,6 +1369,8 @@ op(int what)
zerr("bad math expression: out of integers");
return;
}
+ stack[sp].lval = NULL;
+ stack[sp].pval = NULL;
}
diff --git a/Src/mem.c b/Src/mem.c
index 840bbb6e4..77e4375f0 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -1719,7 +1719,13 @@ calloc(MALLOC_ARG_T n, MALLOC_ARG_T size)
if (!(l = n * size))
return (MALLOC_RET_T) m_high;
- r = malloc(l);
+ /*
+ * use realloc() (with a NULL `p` argument it behaves exactly the same
+ * as malloc() does) to prevent an infinite loop caused by sibling-call
+ * optimizations (the malloc() call would otherwise be replaced by an
+ * unconditional branch back to line 1719 ad infinitum).
+ */
+ r = realloc(NULL, l);
memset(r, 0, l);
@@ -1879,16 +1885,14 @@ bin_mem(char *name, char **argv, Options ops, int func)
mod_export void
zfree(void *p, UNUSED(int sz))
{
- if (p)
- free(p);
+ free(p);
}
/**/
mod_export void
zsfree(char *p)
{
- if (p)
- free(p);
+ free(p);
}
/**/
diff --git a/Src/options.c b/Src/options.c
index 2b5795bab..590652ea9 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -111,6 +111,7 @@ static struct optname optns[] = {
{{NULL, "chasedots", OPT_EMULATE}, CHASEDOTS},
{{NULL, "chaselinks", OPT_EMULATE}, CHASELINKS},
{{NULL, "checkjobs", OPT_EMULATE|OPT_ZSH}, CHECKJOBS},
+{{NULL, "checkrunningjobs", OPT_EMULATE|OPT_ZSH}, CHECKRUNNINGJOBS},
{{NULL, "clobber", OPT_EMULATE|OPT_ALL}, CLOBBER},
{{NULL, "combiningchars", 0}, COMBININGCHARS},
{{NULL, "completealiases", 0}, COMPLETEALIASES},
diff --git a/Src/params.c b/Src/params.c
index 6fbee880c..de7730ae7 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -101,6 +101,19 @@ zlong lastval, /* $? */
rprompt_indent, /* $ZLE_RPROMPT_INDENT */
ppid, /* $PPID */
zsh_subshell; /* $ZSH_SUBSHELL */
+
+/* $FUNCNEST */
+/**/
+mod_export
+zlong zsh_funcnest =
+#ifdef MAX_FUNCTION_DEPTH
+ MAX_FUNCTION_DEPTH
+#else
+ /* Disabled by default but can be enabled at run time */
+ -1
+#endif
+ ;
+
/**/
zlong lineno, /* $LINENO */
zoptind, /* $OPTIND */
@@ -337,6 +350,7 @@ IPDEF5("COLUMNS", &zterm_columns, zlevar_gsu),
IPDEF5("LINES", &zterm_lines, zlevar_gsu),
IPDEF5U("ZLE_RPROMPT_INDENT", &rprompt_indent, rprompt_indent_gsu),
IPDEF5("SHLVL", &shlvl, varinteger_gsu),
+IPDEF5("FUNCNEST", &zsh_funcnest, varinteger_gsu),
/* Don't import internal integer status variables. */
#define IPDEF6(A,B,F) {{NULL,A,PM_INTEGER|PM_SPECIAL|PM_DONTIMPORT},BR((void *)B),GSU(F),10,0,NULL,NULL,NULL,0}
@@ -535,10 +549,13 @@ scancopyparams(HashNode hn, UNUSED(int flags))
HashTable
copyparamtable(HashTable ht, char *name)
{
- HashTable nht = newparamtable(ht->hsize, name);
- outtable = nht;
- scanhashtable(ht, 0, 0, 0, scancopyparams, 0);
- outtable = NULL;
+ HashTable nht = 0;
+ if (ht) {
+ nht = newparamtable(ht->hsize, name);
+ outtable = nht;
+ scanhashtable(ht, 0, 0, 0, scancopyparams, 0);
+ outtable = NULL;
+ }
return nht;
}
@@ -1204,7 +1221,7 @@ isident(char *s)
/**/
static zlong
getarg(char **str, int *inv, Value v, int a2, zlong *w,
- int *prevcharlen, int *nextcharlen)
+ int *prevcharlen, int *nextcharlen, int flags)
{
int hasbeg = 0, word = 0, rev = 0, ind = 0, down = 0, l, i, ishash;
int keymatch = 0, needtok = 0, arglen, len, inpar = 0;
@@ -1407,6 +1424,8 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w,
if (ishash) {
HashTable ht = v->pm->gsu.h->getfn(v->pm);
if (!ht) {
+ if (flags & SCANPM_CHECKING)
+ return isset(KSHARRAYS) ? 1 : 0;
ht = newparamtable(17, v->pm->node.nam);
v->pm->gsu.h->setfn(v->pm, ht);
}
@@ -1848,7 +1867,8 @@ getindex(char **pptr, Value v, int flags)
zlong we = 0, dummy;
int startprevlen, startnextlen;
- start = getarg(&s, &inv, v, 0, &we, &startprevlen, &startnextlen);
+ start = getarg(&s, &inv, v, 0, &we, &startprevlen, &startnextlen,
+ flags);
if (inv) {
if (!v->isarr && start != 0) {
@@ -1922,7 +1942,7 @@ getindex(char **pptr, Value v, int flags)
if ((com = (*s == ','))) {
s++;
- end = getarg(&s, &inv, v, 1, &dummy, NULL, NULL);
+ end = getarg(&s, &inv, v, 1, &dummy, NULL, NULL, flags);
} else {
end = we ? we : start;
}
@@ -2704,7 +2724,7 @@ setarrvalue(Value v, char **val)
v->pm->gsu.a->setfn(v->pm, val);
} else if (v->start == -1 && v->end == 0 &&
PM_TYPE(v->pm->node.flags) == PM_HASHED) {
- arrhashsetfn(v->pm, val, 1);
+ arrhashsetfn(v->pm, val, ASSPM_AUGMENT);
} else if ((PM_TYPE(v->pm->node.flags) == PM_HASHED)) {
freearray(val);
zerr("%s: attempt to set slice of associative array",
@@ -3185,6 +3205,140 @@ assignaparam(char *s, char **val, int flags)
if (flags & ASSPM_WARN)
check_warn_pm(v->pm, "array", created, may_warn_about_nested_vars);
+
+ /*
+ * At this point, we may have array entries consisting of
+ * - a Marker element --- normally allocated array entry but
+ * with just Marker char and null
+ * - an array index element --- as normal for associative array,
+ * but non-standard for normal array which we handle now.
+ * - a value for the indexed element.
+ * This only applies if the flag ASSPM_KEY_VALUE is passed in,
+ * indicating prefork() detected this syntax.
+ *
+ * For associative arrays we just junk the Makrer elements.
+ */
+ if (flags & ASSPM_KEY_VALUE) {
+ char **aptr;
+ if (PM_TYPE(v->pm->node.flags) & PM_ARRAY) {
+ /*
+ * This is an ordinary array with key / value pairs.
+ */
+ int maxlen, origlen, nextind;
+ char **fullval, **origptr;
+ zlong *subscripts = (zlong *)zhalloc(arrlen(val) * sizeof(zlong));
+ zlong *iptr = subscripts;
+ if (flags & ASSPM_AUGMENT) {
+ origptr = v->pm->gsu.a->getfn(v->pm);
+ maxlen = origlen = arrlen(origptr);
+ } else {
+ maxlen = origlen = 0;
+ origptr = NULL;
+ }
+ nextind = 0;
+ for (aptr = val; *aptr; ) {
+ if (**aptr == Marker) {
+ *iptr = mathevali(*++aptr);
+ if (*iptr < 0 ||
+ (!isset(KSHARRAYS) && *iptr == 0)) {
+ unqueue_signals();
+ zerr("bad subscript for direct array assignment: %s", *aptr);
+ return NULL;
+ }
+ if (!isset(KSHARRAYS))
+ --*iptr;
+ nextind = *iptr + 1;
+ ++iptr;
+ aptr += 2;
+ } else {
+ ++nextind;
+ ++aptr;
+ }
+ if (nextind > maxlen)
+ maxlen = nextind;
+ }
+ fullval = zshcalloc((maxlen+1) * sizeof(char *));
+ if (!fullval) {
+ zerr("array too large");
+ return NULL;
+ }
+ fullval[maxlen] = NULL;
+ if (flags & ASSPM_AUGMENT) {
+ char **srcptr = origptr;
+ for (aptr = fullval; aptr <= fullval + origlen; aptr++) {
+ *aptr = ztrdup(*srcptr);
+ srcptr++;
+ }
+ }
+ iptr = subscripts;
+ nextind = 0;
+ for (aptr = val; *aptr; ++aptr) {
+ char *old;
+ if (**aptr == Marker) {
+ int augment = ((*aptr)[1] == '+');
+ zsfree(*aptr);
+ zsfree(*++aptr); /* Index, no longer needed */
+ old = fullval[*iptr];
+ if (augment && old) {
+ fullval[*iptr] = bicat(old, *++aptr);
+ zsfree(*aptr);
+ } else {
+ fullval[*iptr] = *++aptr;
+ }
+ nextind = *iptr + 1;
+ ++iptr;
+ } else {
+ old = fullval[nextind];
+ fullval[nextind] = *aptr;
+ ++nextind;
+ }
+ if (old)
+ zsfree(old);
+ /* aptr now on value in both cases */
+ }
+ if (*aptr) { /* Shouldn't be possible */
+ DPUTS(1, "Extra element in key / value array");
+ zsfree(*aptr);
+ }
+ free(val);
+ for (aptr = fullval; aptr < fullval + maxlen; aptr++) {
+ /*
+ * Remember we don't have sparse arrays but and they're null
+ * terminated --- so any value we don't set has to be an
+ * empty string.
+ */
+ if (!*aptr)
+ *aptr = ztrdup("");
+ }
+ setarrvalue(v, fullval);
+ unqueue_signals();
+ return v->pm;
+ } else if (PM_TYPE(v->pm->node.flags & PM_HASHED)) {
+ /*
+ * We strictly enforce [key]=value syntax for associative
+ * arrays. Marker can only indicate a Marker / key / value
+ * triad; it cannot be there by accident.
+ *
+ * It's too inefficient to strip Markers here, and they
+ * can't be there in the other form --- so just ignore
+ * them willy nilly lower down.
+ */
+ for (aptr = val; *aptr; aptr += 3) {
+ if (**aptr != Marker) {
+ unqueue_signals();
+ freearray(val);
+ zerr("bad [key]=value syntax for associative array");
+ return NULL;
+ }
+ }
+ } else {
+ unqueue_signals();
+ freearray(val);
+ zerr("invalid use of [key]=value assignment syntax");
+ return NULL;
+ }
+ }
+
if (flags & ASSPM_AUGMENT) {
if (v->start == 0 && v->end == -1) {
if (PM_TYPE(v->pm->node.flags) & PM_ARRAY) {
@@ -3675,30 +3829,49 @@ nullsethashfn(UNUSED(Param pm), HashTable x)
/* Function to set value of an association parameter using key/value pairs */
/**/
-mod_export void
-arrhashsetfn(Param pm, char **val, int augment)
+static void
+arrhashsetfn(Param pm, char **val, int flags)
{
/* Best not to shortcut this by using the existing hash table, *
* since that could cause trouble for special hashes. This way, *
* it's up to pm->gsu.h->setfn() what to do. */
- int alen = arrlen(val);
+ int alen = 0;
HashTable opmtab = paramtab, ht = 0;
- char **aptr = val;
+ char **aptr;
Value v = (Value) hcalloc(sizeof *v);
v->end = -1;
+ for (aptr = val; *aptr; ++aptr) {
+ if (**aptr != Marker)
+ ++alen;
+ }
+
if (alen % 2) {
freearray(val);
zerr("bad set of key/value pairs for associative array");
return;
}
- if (augment) {
+ if (flags & ASSPM_AUGMENT) {
ht = paramtab = pm->gsu.h->getfn(pm);
}
- if (alen && (!augment || !paramtab)) {
+ if (alen && (!(flags & ASSPM_AUGMENT) || !paramtab)) {
ht = paramtab = newparamtable(17, pm->node.nam);
}
- while (*aptr) {
+ for (aptr = val; *aptr; ) {
+ int eltflags = 0;
+ if (**aptr == Marker) {
+ /* Either all elements have Marker or none. Checked in caller. */
+ if ((*aptr)[1] == '+') {
+ /* Actually, assignstrvalue currently doesn't handle this... */
+ eltflags = ASSPM_AUGMENT;
+ /* ...so we'll use the trick from setsparam(). */
+ v->start = INT_MAX;
+ } else {
+ v->start = 0;
+ }
+ v->end = -1;
+ zsfree(*aptr++);
+ }
/* The parameter name is ztrdup'd... */
v->pm = createparam(*aptr, PM_SCALAR|PM_UNSET);
/*
@@ -3709,7 +3882,7 @@ arrhashsetfn(Param pm, char **val, int augment)
v->pm = (Param) paramtab->getnode(paramtab, *aptr);
zsfree(*aptr++);
/* ...but we can use the value without copying. */
- setstrvalue(v, *aptr++);
+ assignstrvalue(v, *aptr++, eltflags);
}
paramtab = opmtab;
pm->gsu.h->setfn(pm, ht);
@@ -5498,9 +5671,7 @@ printparamvalue(Param p, int printflags)
{
char *t, **u;
- if (printflags & PRINT_KV_PAIR)
- putchar(' ');
- else
+ if (!(printflags & PRINT_KV_PAIR))
putchar('=');
/* How the value is displayed depends *
@@ -5528,40 +5699,60 @@ printparamvalue(Param p, int printflags)
/* array */
if (!(printflags & PRINT_KV_PAIR)) {
putchar('(');
- putchar(' ');
+ if (!(printflags & PRINT_LINE))
+ putchar(' ');
}
u = p->gsu.a->getfn(p);
if(*u) {
+ if (printflags & PRINT_LINE) {
+ if (printflags & PRINT_KV_PAIR)
+ printf(" ");
+ else
+ printf("\n ");
+ }
quotedzputs(*u++, stdout);
while (*u) {
- putchar(' ');
+ if (printflags & PRINT_LINE)
+ printf("\n ");
+ else
+ putchar(' ');
quotedzputs(*u++, stdout);
}
+ if ((printflags & (PRINT_LINE|PRINT_KV_PAIR)) == PRINT_LINE)
+ putchar('\n');
}
if (!(printflags & PRINT_KV_PAIR)) {
- putchar(' ');
+ if (!(printflags & PRINT_LINE))
+ putchar(' ');
putchar(')');
}
break;
case PM_HASHED:
/* association */
- if (!(printflags & PRINT_KV_PAIR)) {
- putchar('(');
- putchar(' ');
- }
{
- HashTable ht = p->gsu.h->getfn(p);
+ HashTable ht;
+ int found = 0;
+ if (!(printflags & PRINT_KV_PAIR)) {
+ putchar('(');
+ if (!(printflags & PRINT_LINE))
+ putchar(' ');
+ }
+ ht = p->gsu.h->getfn(p);
if (ht)
- scanhashtable(ht, 1, 0, PM_UNSET,
- ht->printnode, PRINT_KV_PAIR);
+ found = scanhashtable(ht, 1, 0, PM_UNSET,
+ ht->printnode, PRINT_KV_PAIR |
+ (printflags & PRINT_LINE));
+ if (!(printflags & PRINT_KV_PAIR)) {
+ if (found && (printflags & PRINT_LINE))
+ putchar('\n');
+ putchar(')');
+ }
}
- if (!(printflags & PRINT_KV_PAIR))
- putchar(')');
break;
}
- if (printflags & PRINT_KV_PAIR)
+ if ((printflags & (PRINT_KV_PAIR|PRINT_LINE)) == PRINT_KV_PAIR)
putchar(' ');
- else
+ else if (!(printflags & PRINT_KV_PAIR))
putchar('\n');
}
@@ -5655,7 +5846,14 @@ printparamnode(HashNode hn, int printflags)
zputs(p->node.nam, stdout);
putchar('\n');
} else {
+ if (printflags & PRINT_KV_PAIR) {
+ if (printflags & PRINT_LINE)
+ printf("\n ");
+ putchar('[');
+ }
quotedzputs(p->node.nam, stdout);
+ if (printflags & PRINT_KV_PAIR)
+ printf("]=");
printparamvalue(p, printflags);
}
diff --git a/Src/parse.c b/Src/parse.c
index 27052527d..47e5a246a 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -808,8 +808,13 @@ par_sublist(int *cmplx)
WC_SUBLIST_END),
f, (e - 1 - p), c);
cmdpop();
- } else
+ } else {
+ if (tok == AMPER || tok == AMPERBANG) {
+ c = 1;
+ *cmplx |= c;
+ }
set_sublist_code(p, WC_SUBLIST_END, f, (e - 1 - p), c);
+ }
return 1;
} else {
ecused--;
@@ -1843,6 +1848,10 @@ par_simple(int *cmplx, int nr)
incmdpos = oldcmdpos;
isnull = 0;
assignments = 1;
+ } else if (IS_REDIROP(tok)) {
+ *cmplx = c = 1;
+ nr += par_redir(&r, NULL);
+ continue;
} else
break;
zshlex();
@@ -2737,7 +2746,8 @@ freeeprog(Eprog p)
DPUTS(p->nref < 0 && !(p->flags & EF_HEAP), "Real EPROG has nref < 0");
DPUTS(p->nref < -1, "Uninitialised EPROG nref");
#ifdef MAX_FUNCTION_DEPTH
- DPUTS(p->nref > MAX_FUNCTION_DEPTH + 10, "Overlarge EPROG nref");
+ DPUTS(zsh_funcnest >=0 && p->nref > zsh_funcnest + 10,
+ "Overlarge EPROG nref");
#endif
if (p->nref > 0 && !--p->nref) {
for (i = p->npats, pp = p->pats; i--; pp++)
@@ -3667,15 +3677,15 @@ try_dump_file(char *path, char *name, char *file, int *ksh, int test_only)
* function. */
queue_signals();
if (!rd &&
- (rc || std.st_mtime > stc.st_mtime) &&
- (rn || std.st_mtime > stn.st_mtime) &&
+ (rc || std.st_mtime >= stc.st_mtime) &&
+ (rn || std.st_mtime >= stn.st_mtime) &&
(prog = check_dump_file(dig, &std, name, ksh, test_only))) {
unqueue_signals();
return prog;
}
/* No digest file. Now look for the per-function compiled file. */
if (!rc &&
- (rn || stc.st_mtime > stn.st_mtime) &&
+ (rn || stc.st_mtime >= stn.st_mtime) &&
(prog = check_dump_file(wc, &stc, name, ksh, test_only))) {
unqueue_signals();
return prog;
@@ -3714,7 +3724,7 @@ try_source_file(char *file)
rn = stat(file, &stn);
queue_signals();
- if (!rc && (rn || stc.st_mtime > stn.st_mtime) &&
+ if (!rc && (rn || stc.st_mtime >= stn.st_mtime) &&
(prog = check_dump_file(wc, &stc, tail, NULL, 0))) {
unqueue_signals();
return prog;
diff --git a/Src/prompt.c b/Src/prompt.c
index c478e69fb..95da52559 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -315,7 +315,7 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
case '/':
case 'C':
/* `/' gives 0, `/any' gives 1, etc. */
- if (*ss++ == '/' && *ss)
+ if (*ss && *ss++ == '/' && *ss)
arg--;
for (; *ss; ss++)
if (*ss == '/')
@@ -1087,7 +1087,7 @@ countprompt(char *str, int *wp, int *hp, int overf)
#endif
for (; *str; str++) {
- if (w >= zterm_columns && overf >= 0) {
+ if (w > zterm_columns && overf >= 0) {
w = 0;
h++;
}
diff --git a/Src/subst.c b/Src/subst.c
index 5b1bf8988..a265a187e 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -35,6 +35,50 @@
/**/
char nulstring[] = {Nularg, '\0'};
+/* Check for array assignent with entries like [key]=val.
+ *
+ * Insert Marker node, convert following nodes to list to alternate key
+ * / val form, perform appropriate substitution, and return last
+ * inserted (value) node if found.
+ *
+ * Caller to check errflag.
+ */
+
+/**/
+static LinkNode
+keyvalpairelement(LinkList list, LinkNode node)
+{
+ char *start, *end, *dat;
+
+ if ((start = (char *)getdata(node)) &&
+ start[0] == Inbrack &&
+ (end = strchr(start+1, Outbrack)) &&
+ /* ..]=value or ]+=Value */
+ (end[1] == Equals ||
+ (end[1] == '+' && end[2] == Equals))) {
+ static char marker[2] = { Marker, '\0' };
+ static char marker_plus[3] = { Marker, '+', '\0' };
+ *end = '\0';
+
+ dat = start + 1;
+ singsub(&dat);
+ untokenize(dat);
+ if (end[1] == '+') {
+ setdata(node, marker_plus);
+ node = insertlinknode(list, node, dat);
+ dat = end + 3;
+ } else {
+ setdata(node, marker);
+ node = insertlinknode(list, node, dat);
+ dat = end + 2;
+ }
+ singsub(&dat);
+ untokenize(dat);
+ return insertlinknode(list, node, dat);
+ }
+ return NULL;
+}
+
/* Do substitutions before fork. These are:
* - Process substitution: <(...), >(...), =(...)
* - Parameter substitution
@@ -46,24 +90,35 @@ char nulstring[] = {Nularg, '\0'};
*
* "flag"s contains PREFORK_* flags, defined in zsh.h.
*
- * "ret_flags" is used to return values from nested parameter
- * substitions. It may be NULL in which case PREFORK_SUBEXP
- * must not appear in flags; any return value from below
- * will be discarded.
+ * "ret_flags" is used to return PREFORK_* values from nested parameter
+ * substitions. It may be NULL in which case PREFORK_SUBEXP must not
+ * appear in flags; any return value from below will be discarded.
*/
/**/
mod_export void
prefork(LinkList list, int flags, int *ret_flags)
{
- LinkNode node, stop = 0;
+ LinkNode node, insnode, stop = 0;
int keep = 0, asssub = (flags & PREFORK_TYPESET) && isset(KSHTYPESET);
int ret_flags_local = 0;
if (!ret_flags)
ret_flags = &ret_flags_local; /* will be discarded */
queue_signals();
- for (node = firstnode(list); node; incnode(node)) {
+ node = firstnode(list);
+ while (node) {
+ if ((flags & (PREFORK_SINGLE|PREFORK_ASSIGN)) == PREFORK_ASSIGN &&
+ (insnode = keyvalpairelement(list, node))) {
+ node = insnode;
+ incnode(node);
+ *ret_flags |= PREFORK_KEY_VALUE;
+ continue;
+ }
+ if (errflag) {
+ unqueue_signals();
+ return;
+ }
if (isset(SHFILEEXPANSION)) {
/*
* Here and below we avoid taking the address
@@ -82,11 +137,29 @@ prefork(LinkList list, int flags, int *ret_flags)
*/
setdata(node, cptr);
}
- if (!(node = stringsubst(list, node,
- flags & ~(PREFORK_TYPESET|PREFORK_ASSIGN),
- ret_flags, asssub))) {
- unqueue_signals();
- return;
+ else
+ {
+ if (!(node = stringsubst(list, node,
+ flags & ~(PREFORK_TYPESET|PREFORK_ASSIGN),
+ ret_flags, asssub))) {
+ unqueue_signals();
+ return;
+ }
+ }
+ incnode(node);
+ }
+ if (isset(SHFILEEXPANSION)) {
+ /*
+ * stringsubst() may insert new nodes, so doesn't work
+ * well in the same loop as file expansion.
+ */
+ for (node = firstnode(list); node; incnode(node)) {
+ if (!(node = stringsubst(list, node,
+ flags & ~(PREFORK_TYPESET|PREFORK_ASSIGN),
+ ret_flags, asssub))) {
+ unqueue_signals();
+ return;
+ }
}
}
for (node = firstnode(list); node; incnode(node)) {
@@ -107,7 +180,9 @@ prefork(LinkList list, int flags, int *ret_flags)
filesub(&cptr, flags & (PREFORK_TYPESET|PREFORK_ASSIGN));
setdata(node, cptr);
}
- } else if (!(flags & PREFORK_SINGLE) && !keep)
+ } else if (!(flags & PREFORK_SINGLE) &&
+ !(*ret_flags & PREFORK_KEY_VALUE) &&
+ !keep)
uremnode(list, node);
if (errflag) {
unqueue_signals();
@@ -400,16 +475,31 @@ quotesubst(char *str)
return str;
}
+/* Glob entries of a linked list.
+ *
+ * flags are from PREFORK_*, but only two are handled:
+ * - PREFORK_NO_UNTOK: pass into zglob() a flag saying do not untokenise.
+ * - PREFORK_KEY_VALUE: look out for Marker / Key / Value list triads
+ * and don't glob them. The key and value should already have
+ * been untokenised as they are not subject to further expansion.
+ */
+
/**/
mod_export void
-globlist(LinkList list, int nountok)
+globlist(LinkList list, int flags)
{
LinkNode node, next;
badcshglob = 0;
for (node = firstnode(list); !errflag && node; node = next) {
next = nextnode(node);
- zglob(list, node, nountok);
+ if ((flags & PREFORK_KEY_VALUE) &&
+ *(char *)getdata(node) == Marker) {
+ /* Skip key / value pair */
+ next = nextnode(nextnode(next));
+ } else {
+ zglob(list, node, (flags & PREFORK_NO_UNTOK) != 0);
+ }
}
if (noerrs)
badcshglob = 0;
@@ -2340,7 +2430,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
val = aval[0];
isarr = 0;
}
- s = dyncat(val, s);
+ s = val ? dyncat(val, s) : dupstring(s);
/* Now behave po-faced as if it was always like that... */
subexp = 0;
/*
@@ -2389,7 +2479,13 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
*/
if (!subexp || aspar) {
char *ov = val;
-
+ int scanflags = hkeys | hvals;
+ if (arrasg)
+ scanflags |= SCANPM_ASSIGNING;
+ if (qt)
+ scanflags |= SCANPM_DQUOTED;
+ if (chkset)
+ scanflags |= SCANPM_CHECKING;
/*
* Second argument: decide whether to use the subexpression or
* the string next on the line as the parameter name.
@@ -2418,9 +2514,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
if (!(v = fetchvalue(&vbuf, (subexp ? &ov : &s),
(wantt ? -1 :
((unset(KSHARRAYS) || inbrace) ? 1 : -1)),
- hkeys|hvals|
- (arrasg ? SCANPM_ASSIGNING : 0)|
- (qt ? SCANPM_DQUOTED : 0))) ||
+ scanflags)) ||
(v->pm && (v->pm->node.flags & PM_UNSET)) ||
(v->flags & VALFLAG_EMPTY))
vunset = 1;
@@ -3747,11 +3841,15 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
if (isarr) {
char **ap;
- for (ap = aval; *ap; ap++)
+ for (ap = aval; *ap; ap++) {
+ untokenize(*ap);
list = bufferwords(list, *ap, NULL, shsplit);
+ }
isarr = 0;
- } else
+ } else {
+ untokenize(val);
list = bufferwords(NULL, val, NULL, shsplit);
+ }
if (!list || !firstnode(list))
val = dupstring("");
diff --git a/Src/utils.c b/Src/utils.c
index 5055d69fe..3587c3622 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1832,7 +1832,7 @@ adjustlines(int signalled)
else
shttyinfo.winsize.ws_row = zterm_lines;
#endif /* TIOCGWINSZ */
- if (zterm_lines <= 0) {
+ if (zterm_lines < 0) {
DPUTS(signalled, "BUG: Impossible TIOCGWINSZ rows");
zterm_lines = tclines > 0 ? tclines : 24;
}
@@ -1856,7 +1856,7 @@ adjustcolumns(int signalled)
else
shttyinfo.winsize.ws_col = zterm_columns;
#endif /* TIOCGWINSZ */
- if (zterm_columns <= 0) {
+ if (zterm_columns < 0) {
DPUTS(signalled, "BUG: Impossible TIOCGWINSZ cols");
zterm_columns = tccolumns > 0 ? tccolumns : 80;
}
@@ -2177,10 +2177,12 @@ gettempfile(const char *prefix, int use_heap, char **tempname)
{
char *fn;
int fd;
+ mode_t old_umask;
#if HAVE_MKSTEMP
char *suffix = prefix ? ".XXXXXX" : "XXXXXX";
queue_signals();
+ old_umask = umask(0177);
if (!prefix && !(prefix = getsparam("TMPPREFIX")))
prefix = DEFAULT_TMPPREFIX;
if (use_heap)
@@ -2198,6 +2200,7 @@ gettempfile(const char *prefix, int use_heap, char **tempname)
int failures = 0;
queue_signals();
+ old_umask = umask(0177);
do {
if (!(fn = gettempname(prefix, use_heap))) {
fd = -1;
@@ -2212,6 +2215,7 @@ gettempfile(const char *prefix, int use_heap, char **tempname)
#endif
*tempname = fn;
+ umask(old_umask);
unqueue_signals();
return fd;
}
@@ -2283,10 +2287,11 @@ struncpy(char **s, char *t, int n)
{
char *u = *s;
- while (n--)
- *u++ = *t++;
+ while (n-- && (*u = *t++))
+ u++;
*s = u;
- *u = '\0';
+ if (n > 0) /* just one null-byte will do, unlike strncpy(3) */
+ *u = '\0';
}
/* Return the number of elements in an array of pointers. *
@@ -2455,6 +2460,67 @@ zstrtol_underscore(const char *s, char **t, int base, int underscore)
return neg ? -(zlong)calc : (zlong)calc;
}
+/*
+ * If s represents a complete unsigned integer (and nothing else)
+ * return 1 and set retval to the value. Otherwise return 0.
+ *
+ * Underscores are always allowed.
+ *
+ * Sensitive to OCTAL_ZEROES.
+ */
+
+/**/
+mod_export int
+zstrtoul_underscore(const char *s, zulong *retval)
+{
+ zulong calc = 0, newcalc = 0, base;
+
+ if (*s == '+')
+ s++;
+
+ if (*s != '0')
+ base = 10;
+ else if (*++s == 'x' || *s == 'X')
+ base = 16, s++;
+ else if (*s == 'b' || *s == 'B')
+ base = 2, s++;
+ else
+ base = isset(OCTALZEROES) ? 8 : 10;
+ if (base < 2 || base > 36) {
+ return 0;
+ } else if (base <= 10) {
+ for (; (*s >= '0' && *s < ('0' + base)) ||
+ *s == '_'; s++) {
+ if (*s == '_')
+ continue;
+ newcalc = calc * base + *s - '0';
+ if (newcalc < calc)
+ {
+ return 0;
+ }
+ calc = newcalc;
+ }
+ } else {
+ for (; idigit(*s) || (*s >= 'a' && *s < ('a' + base - 10))
+ || (*s >= 'A' && *s < ('A' + base - 10))
+ || *s == '_'; s++) {
+ if (*s == '_')
+ continue;
+ newcalc = calc*base + (idigit(*s) ? (*s - '0') : (*s & 0x1f) + 9);
+ if (newcalc < calc)
+ {
+ return 0;
+ }
+ calc = newcalc;
+ }
+ }
+
+ if (*s)
+ return 0;
+ *retval = calc;
+ return 1;
+}
+
/**/
mod_export int
setblock_fd(int turnonblocking, int fd, long *modep)
@@ -2709,6 +2775,9 @@ checkrmall(char *s)
const int max_count = 100;
if ((rmd = opendir(unmeta(s)))) {
int ignoredots = !isset(GLOBDOTS);
+ /* ### TODO: Passing ignoredots here is wrong. See workers/41672
+ aka <https://bugs.debian.org/875460>.
+ */
while (zreaddir(rmd, ignoredots)) {
count++;
if (count > max_count)
@@ -2724,8 +2793,10 @@ checkrmall(char *s)
else if (count > 0)
fprintf(shout, "zsh: sure you want to delete all %d files in ",
count);
- else
+ else {
+ /* We don't know how many files the glob will expand to; see 41707. */
fprintf(shout, "zsh: sure you want to delete all the files in ");
+ }
nicezputs(s, shout);
if(isset(RMSTARWAIT)) {
fputs("? (waiting ten seconds)", shout);
@@ -4325,7 +4396,7 @@ spname(char *oldname)
* Rationale for this, if there ever was any, has been forgotten. */
for (;;) {
while (*old == '/') {
- if ((new - newname) >= (sizeof(newname)-1))
+ if (new >= newname + sizeof(newname) - 1)
return NULL;
*new++ = *old++;
}
@@ -4354,17 +4425,20 @@ spname(char *oldname)
* odd to the human reader, and we may make use of the total *
* distance for all corrections at some point in the future. */
if (bestdist < maxthresh) {
- strcpy(new, spnameguess);
- strcat(new, old);
- return newname;
+ struncpy(&new, spnameguess, sizeof(newname) - (new - newname));
+ struncpy(&new, old, sizeof(newname) - (new - newname));
+ return (new >= newname + sizeof(newname) -1) ? NULL : newname;
} else
return NULL;
} else {
maxthresh = bestdist + thresh;
bestdist += thisdist;
}
- for (p = spnamebest; (*new = *p++);)
+ for (p = spnamebest; (*new = *p++);) {
+ if (new >= newname + sizeof(newname) - 1)
+ return NULL;
new++;
+ }
}
}
@@ -4947,6 +5021,16 @@ ztrsub(char const *t, char const *s)
return l;
}
+/*
+ * Wrapper for readdir().
+ *
+ * If ignoredots is true, skip the "." and ".." entries.
+ *
+ * When __APPLE__ is defined, recode dirent names from UTF-8-MAC to UTF-8.
+ *
+ * Return the dirent's name, metafied.
+ */
+
/**/
mod_export char *
zreaddir(DIR *dir, int ignoredots)
@@ -5420,7 +5504,7 @@ mb_metastrlenend(char *ptr, int width, char *eptr)
wchar_t wc;
int num, num_in_char, complete;
- if (!isset(MULTIBYTE))
+ if (!isset(MULTIBYTE) || MB_CUR_MAX == 1)
return eptr ? (int)(eptr - ptr) : ztrlen(ptr);
laststart = ptr;
diff --git a/Src/zsh.h b/Src/zsh.h
index abe9a9c82..8b4898477 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -223,9 +223,16 @@ struct mathfunc {
* tokens here.
*/
/*
- * Marker used in paramsubst for rc_expand_param.
- * Also used in pattern character arrays as guaranteed not to
- * mark a character in a string.
+ * Marker is used in the following special circumstances:
+ * - In paramsubst for rc_expand_param.
+ * - In pattern character arrays as guaranteed not to mark a character in
+ * a string.
+ * - In assignments with the ASSPM_KEY_VALUE flag set in order to
+ * mark that there is a key / value pair following. If this
+ * comes from [key]=value the Marker is followed by a null;
+ * if from [key]+=value the Marker is followed by a '+' then a null.
+ * All the above are local uses --- any case where the Marker has
+ * escaped beyond the context in question is an error.
*/
#define Marker ((char) 0xa2)
@@ -1217,17 +1224,25 @@ struct alias {
struct asgment {
struct linknode node;
char *name;
- int is_array;
+ int flags;
union {
char *scalar;
LinkList array;
} value;
};
+/* Flags for flags element of asgment */
+enum {
+ /* Array value */
+ ASG_ARRAY = 1,
+ /* Key / value array pair */
+ ASG_KEY_VALUE = 2
+};
+
/*
* Assignment is array?
*/
-#define ASG_ARRAYP(asg) ((asg)->is_array)
+#define ASG_ARRAYP(asg) ((asg)->flags & ASG_ARRAY)
/*
* Assignment has value?
@@ -1361,6 +1376,14 @@ struct options {
int argscount, argsalloc;
};
+/* Flags to parseargs() */
+
+enum {
+ PARSEARGS_TOPLEVEL = 0x1, /* Call to initialise shell */
+ PARSEARGS_LOGIN = 0x2 /* Shell is login shell */
+};
+
+
/*
* Handler arguments are: builtin name, null-terminated argument
* list excluding command name, option structure, the funcid element from the
@@ -1852,6 +1875,7 @@ struct tieddata {
#define PM_DONTIMPORT_SUID (1<<19) /* do not import if running setuid */
#define PM_LOADDIR (1<<19) /* (function) filename gives load directory */
#define PM_SINGLE (1<<20) /* special can only have a single instance */
+#define PM_ANONYMOUS (1<<20) /* (function) anonymous function */
#define PM_LOCAL (1<<21) /* this parameter will be made local */
#define PM_SPECIAL (1<<22) /* special builtin parameter */
#define PM_DONTIMPORT (1<<23) /* do not import this variable */
@@ -1890,6 +1914,7 @@ struct tieddata {
* necessarily want to match multiple
* elements
*/
+#define SCANPM_CHECKING (1<<10) /* Check if set, no need to create */
/* "$foo[@]"-style substitution
* Only sign bit is significant
*/
@@ -1953,7 +1978,14 @@ enum {
/* SHWORDSPLIT forced off in nested subst */
PREFORK_NOSHWORDSPLIT = 0x20,
/* Prefork is part of a parameter subexpression */
- PREFORK_SUBEXP = 0x40
+ PREFORK_SUBEXP = 0x40,
+ /* Prefork detected an assignment list with [key]=value syntax,
+ * Only used on return from prefork, not meaningful passed down.
+ * Also used as flag to globlist.
+ */
+ PREFORK_KEY_VALUE = 0x80,
+ /* No untokenise: used only as flag to globlist */
+ PREFORK_NO_UNTOK = 0x100
};
/*
@@ -2052,6 +2084,11 @@ enum {
ASSPM_WARN = (ASSPM_WARN_CREATE|ASSPM_WARN_NESTED),
/* Import from environment, so exercise care evaluating value */
ASSPM_ENV_IMPORT = 1 << 3,
+ /* Array is key / value pairs.
+ * This is normal for associative arrays but variant behaviour for
+ * normal arrays.
+ */
+ ASSPM_KEY_VALUE = 1 << 4
};
/* node for named directory hash table (nameddirtab) */
@@ -2092,13 +2129,14 @@ typedef groupset *Groupset;
#define PRINT_KV_PAIR (1<<3)
#define PRINT_INCLUDEVALUE (1<<4)
#define PRINT_TYPESET (1<<5)
+#define PRINT_LINE (1<<6)
/* flags for printing for the whence builtin */
-#define PRINT_WHENCE_CSH (1<<6)
-#define PRINT_WHENCE_VERBOSE (1<<7)
-#define PRINT_WHENCE_SIMPLE (1<<8)
-#define PRINT_WHENCE_FUNCDEF (1<<9)
-#define PRINT_WHENCE_WORD (1<<10)
+#define PRINT_WHENCE_CSH (1<<7)
+#define PRINT_WHENCE_VERBOSE (1<<8)
+#define PRINT_WHENCE_SIMPLE (1<<9)
+#define PRINT_WHENCE_FUNCDEF (1<<10)
+#define PRINT_WHENCE_WORD (1<<11)
/* Return values from loop() */
@@ -2301,6 +2339,7 @@ enum {
CHASEDOTS,
CHASELINKS,
CHECKJOBS,
+ CHECKRUNNINGJOBS,
CLOBBER,
APPENDCREATE,
COMBININGCHARS,
@@ -2953,10 +2992,12 @@ struct hist_stack {
void (*hungetc) _((int));
void (*hwaddc) _((int));
void (*hwbegin) _((int));
+ void (*hwabort) _((void));
void (*hwend) _((void));
void (*addtoline) _((int));
unsigned char *cstack;
int csp;
+ int hist_keep_comment;
};
/*
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 0302c9624..217f7bea4 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -103,6 +103,12 @@
0:`exec' with -a option, no space
>/bin/SPLOOSH
+ (exec -a foo* $ZTST_testdir/../Src/zsh -fc 'print -r -- ${(V)0}')
+ (exec -a "" $ZTST_testdir/../Src/zsh -fc 'print -r -- ${(V)0}')
+0:rationalisation of arguments to exec -a
+>foo*
+>
+
(
opts=(-a /bin/WHOOOSH)
exec $opts /bin/sh -c 'echo $0'
@@ -363,6 +369,10 @@
(time cat) >&/dev/null
0:`time' keyword (status only)
+ TIMEFMT='%E %mE %uE %* %m%mm %u%uu'; time (:)
+0:`time' keyword with custom TIMEFMT
+*?[0-9]##.[0-9](#c2)s [0-9]##ms [0-9]##us %\* %m%mm %u%uu
+
if [[ -f foo && -d . && -n $ZTST_testdir ]]; then
true
else
diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst
index e68e93e0d..99f7aae26 100644
--- a/Test/A02alias.ztst
+++ b/Test/A02alias.ztst
@@ -137,3 +137,14 @@
thisworks)
0:NO_ALIAS_FUNC_DEF works if the alias is a complete definition
>That worked
+
+ type \bar
+ type -w \bar
+ type \\bar
+ type -w \\bar
+0:type -w of alias -g
+>bar is a global alias for echo
+>bar: global alias
+>\bar is an alias for echo
+>\bar: alias
+
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
index cb82751ce..b5b65cf5d 100644
--- a/Test/A04redirect.ztst
+++ b/Test/A04redirect.ztst
@@ -114,7 +114,7 @@
heretest() {
print First line
cat <<' HERE'
- $foo$foo met celeste 'but with extra' "stuff to test quoting"
+ $foo$foo met celeste 'but with extra' "stuff to test quoting"\
HERE
print Last line
}
@@ -125,19 +125,57 @@
heretest
0:Re-evaluation of function output with here document, quoted
>First line
-> $foo$foo met celeste 'but with extra' "stuff to test quoting"
+> $foo$foo met celeste 'but with extra' "stuff to test quoting"\
>Last line
>First line
-> $foo$foo met celeste 'but with extra' "stuff to test quoting"
+> $foo$foo met celeste 'but with extra' "stuff to test quoting"\
>Last line
>First line
-> $foo$foo met celeste 'but with extra' "stuff to test quoting"
+> $foo$foo met celeste 'but with extra' "stuff to test quoting"\
>Last line
read -r line <<' HERE'
HERE
1:No input, not even newline, from empty here document.
+ heretest() {
+ print First line
+ cat <<-HERE
+ $foo\
+ $foo
+ some\
+ stuff
+ to\
+ test
+ tab\stripping
+ HERE
+ print Last line
+ }
+ heretest
+ eval "$(functions heretest)"
+ heretest
+ eval "$(functions heretest)"
+ heretest
+0:Line continuation in here-document with unquoted delimiter
+>First line
+>bar bar
+>some stuff
+>to test
+>tab\stripping
+>Last line
+>First line
+>bar bar
+>some stuff
+>to test
+>tab\stripping
+>Last line
+>First line
+>bar bar
+>some stuff
+>to test
+>tab\stripping
+>Last line
+
#
# exec tests: perform these in subshells so if they fail the
# shell won't exit.
@@ -622,3 +660,19 @@
>FOO
>HERE
>}
+
+ a=b 2>/dev/null c=d
+ print $a
+ print $c
+0:Redirect in the middle of assignments
+>b
+>d
+
+ umask 0777
+ cat <<' HERE'
+ look ma, no permissions
+ HERE
+ cat <<<"it's a miracle"
+0:Here-{string,document}s succeed with restrictive umask
+> look ma, no permissions
+>it's a miracle
diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst
index b27bb4f6b..996af064f 100644
--- a/Test/B02typeset.ztst
+++ b/Test/B02typeset.ztst
@@ -721,3 +721,101 @@
# 'date' did not run.
>Status is printed, 1
*?*: failed to change user ID: *
+
+ typeset -A keyvalhash=([one]=eins [two]=zwei)
+ keyvalhash+=([three]=drei)
+ for key in ${(ok)keyvalhash}; do
+ print $key $keyvalhash[$key]
+ done
+0:[key]=val for hashes
+>one eins
+>three drei
+>two zwei
+
+ local keyvalarray=([1]=one [3]=three)
+ print -l "${keyvalarray[@]}"
+ keyvalarray+=([2]=two)
+ print -l "${keyvalarray[@]}"
+ local keyvalarray=([1]=one [3]=three)
+ print -l "${keyvalarray[@]}"
+0:[key]=val for normal arrays
+>one
+>
+>three
+>one
+>two
+>three
+>one
+>
+>three
+
+ touch foo Xnot_globbedX
+ inkey="another key" val="another value"
+ typeset -A keyvalhash=([$(echo the key)]=$(echo the value)
+ [$inkey]=$val
+ [*]=?not_globbed?)
+ for key in ${(ok)keyvalhash}; do
+ print -l $key $keyvalhash[$key]
+ done
+ typeset -A keyvalhash=([$(echo the key)]=$(echo the value)
+ [$inkey]=$val
+ [*]=?not_globbed?)
+ for key in ${(ok)keyvalhash}; do
+ print -l $key $keyvalhash[$key]
+ done
+ typeset -p keyvalhash
+0:Substitution in [key]=val syntax
+>*
+>?not_globbed?
+>another key
+>another value
+>the key
+>the value
+>*
+>?not_globbed?
+>another key
+>another value
+>the key
+>the value
+>typeset -A keyvalhash=( ['*']='?not_globbed?' ['another key']='another value' ['the key']='the value' )
+
+ local keyvalarray=(first [2]=second third [6]=sixth seventh [5]=fifth new_sixth)
+ print -l "${keyvalarray[@]}"
+0:mixed syntax [key]=val with normal arrays
+>first
+>second
+>third
+>
+>fifth
+>new_sixth
+>seventh
+
+ local -A keyvalhash=(1 one [2]=two 3 three)
+1:Mixed syntax with [key]=val not allowed for hash.
+?(eval):1: bad [key]=value syntax for associative array
+
+ local -a myarray
+ typeset -p1 myarray
+ myarray=("&" sand '""' "" plugh)
+ typeset -p1 myarray
+0:typeset -p1 output for array
+>typeset -a myarray=()
+>typeset -a myarray=(
+> '&'
+> sand
+> '""'
+> ''
+> plugh
+>)
+
+ local -A myhash
+ typeset -p1 myhash
+ myhash=([one]=two [three]= [four]="[]")
+ typeset -p1 myhash
+0:typeset -p1 output for associative array
+>typeset -A myhash=()
+>typeset -A myhash=(
+> [four]='[]'
+> [one]=two
+> [three]=''
+>)
diff --git a/Test/B07emulate.ztst b/Test/B07emulate.ztst
index 2de097e25..7b1592fa9 100644
--- a/Test/B07emulate.ztst
+++ b/Test/B07emulate.ztst
@@ -251,3 +251,28 @@
emulate sh -c '[[ a == a ]]'
0:regression test for POSIX_ALIASES reserved words
F:Some reserved tokens are handled in alias expansion
+
+ for mode in ksh bash zsh; do
+ $ZTST_testdir/../Src/zsh --emulate $mode -f -c 'emulate'
+ done
+0:--emulate option
+>ksh
+>sh
+>zsh
+
+ $ZTST_testdir/../Src/zsh -f --emulate sh
+1:--emulate must be first
+*?*: --emulate: must precede other options
+
+ $ZTST_testdir/../Src/zsh --emulate
+1:--emulate needs an argument
+*?*: --emulate: argument required
+
+ for opt in shwordsplit noshwordsplit; do
+ $ZTST_testdir/../Src/zsh --emulate sh -f -o $opt -c '
+ [[ -o shwordsplit ]] && echo yes || echo no
+ '
+ done
+0:--emulate followed by other options
+>yes
+>no
diff --git a/Test/B10getopts.ztst b/Test/B10getopts.ztst
new file mode 100644
index 000000000..7eba5a4b1
--- /dev/null
+++ b/Test/B10getopts.ztst
@@ -0,0 +1,81 @@
+# Test the getopts builtin.
+
+%prep
+
+ test_getopts() {
+ local OPTARG OPTIND opt
+ local -a res
+ while getopts abc: opt 2>&1; do
+ [[ $opt == [?:] ]] || res+=( $opt )
+ done
+ (( $#res )) && print -r -- $res
+ return $(( $#res ? 0 : 1 ))
+ }
+
+%test
+
+ test_getopts
+1:no arguments
+
+ test_getopts foo
+1:one operand
+
+ test_getopts -a
+0:one option
+>a
+
+ test_getopts -a foo
+0:one option, one operand
+>a
+
+ test_getopts -a foo -b
+0:one option, two operands, leading hyphen
+>a
+
+ test_getopts -ab
+0:two options, single argument
+>a b
+
+ test_getopts -a -b
+0:two options, separate arguments
+>a b
+
+ test_getopts -a -b +a
+0:three options, + variant
+>a b +a
+
+ test_getopts -cx
+0:one option with value, single argument
+>c
+
+ test_getopts +cx
+0:one option with value, single argument, + variant
+>+c
+
+ test_getopts -c x
+0:one option with value, separate arguments
+>c
+
+ test_getopts -acx
+0:two options, one with value, single argument
+>a c
+
+ test_getopts -ac x
+0:two options, one with value, separate arguments
+>a c
+
+ test_getopts -c
+1:one option missing value
+>test_getopts:3: argument expected after -c option
+
+ test_getopts +c
+1:one option missing value, + variant
+>test_getopts:3: argument expected after +c option
+
+ test_getopts -x
+1:one illegal option
+>test_getopts:3: bad option: -x
+
+ test_getopts +x
+1:one illegal option, + variant
+>test_getopts:3: bad option: +x
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
index 61da763ac..30409adf3 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -420,3 +420,16 @@
0:type of variable when created in arithmetic context
>integer
>scalar
+
+ integer a=1
+ print $(( ++a * 2 ))
+ print $(( ++a ))
+ print $(( a++ * 2 ))
+ print $(( a ))
+ print $(( ++a++ * 2 ))
+1: Allow rvalue but not lvalue operations with result of increment
+>4
+>3
+>6
+>4
+?(eval):6: bad math expression: lvalue required
diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
index 38525016c..4ffb07dd4 100644
--- a/Test/C02cond.ztst
+++ b/Test/C02cond.ztst
@@ -440,6 +440,26 @@ F:Failures in these cases do not indicate a problem in the shell.
> [[ 'a' == 'b' || 'b' = 'c' || 'c' != 'd' ]]
>}
+ (setopt posixbuiltins; [[ -o invalidoption ]]; echo set: $?; echo "line 1: no warning" >&2)
+ (unsetopt posixbuiltins; [[ -o invalidoption ]]; echo unset: $?)
+ [[ -o invalidoption || -n nonempty ]]; echo "in disjunction, true: $?"
+ [[ -o invalidoption || -z nonempty ]]; echo "in disjunction, false: $?"
+ [[ ! -o invalidoption ]]; echo "negated: $?"
+ [[ -o invalidoption && -n nonempty ]] || echo "in conjunction: $?"
+0:-o invalidoption
+>set: 1
+?line 1: no warning
+>unset: 3
+?(eval):2: no such option: invalidoption
+>in disjunction, true: 0
+?(eval):3: no such option: invalidoption
+>in disjunction, false: 1
+?(eval):4: no such option: invalidoption
+>negated: 3
+?(eval):5: no such option: invalidoption
+>in conjunction: 3
+?(eval):6: no such option: invalidoption
+
%clean
# This works around a bug in rm -f in some versions of Cygwin
chmod 644 unmodish
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index 759401225..f22962550 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -465,6 +465,41 @@
)
1:ERREXIT in loop with simple commands
+ (set -e
+ f()
+ {
+ false && false
+ }
+ if false; then
+ :
+ else
+ # ERR_EXIT should trigger on return from function, not in function.
+ f
+ echo Fail 1
+ echo Fail 2
+ f
+ echo Fail 3
+ fi)
+1:ERREXIT with false from inside && within function
+
+ (set -e
+ f()
+ {
+ }
+ if false; then
+ :
+ else
+ f
+ echo Succeed 1
+ echo Succeed 2
+ f
+ echo Succeed 3
+ fi)
+0:ERREXIT not triggered on empty function after false in if.
+>Succeed 1
+>Succeed 2
+>Succeed 3
+
fn() {
emulate -L zsh
setopt errreturn
@@ -626,6 +661,40 @@ F:Must be tested with a top-level script rather than source or function
>before-out
>before-in
+ mkdir -p zdotdir
+ print >zdotdir/.zshenv '
+ setopt norcs errreturn
+ fn() {
+ if false; then
+ print Bad
+ else
+ print Good
+ fi
+ print Better
+ }
+ fn
+ print In .zshenv'
+ ZDOTDIR=$PWD/zdotdir $ZTST_testdir/../Src/zsh -c 'true'
+0:ERR_RETURN within initialisation code with special flags
+>Good
+>Better
+>In .zshenv
+
+ fn2() {
+ if false; then
+ print Bad
+ else
+ print Good
+ fi
+ }
+ fn() {
+ setopt err_return
+ fn2 || true
+ }
+ fn
+0:ERR_RETURN in "else" branch in nested function
+>Good
+
(setopt err_exit
for x in y; do
false && true
diff --git a/Test/C04funcdef.ztst b/Test/C04funcdef.ztst
index 6a675e0b4..5786018e0 100644
--- a/Test/C04funcdef.ztst
+++ b/Test/C04funcdef.ztst
@@ -515,6 +515,23 @@
0:autoload with absolute path not cancelled by bare autoload
>I have been loaded by explicit path.
+ (
+ FUNCNEST=0
+ fn() { true; }
+ fn
+ )
+1:
+?fn:4: maximum nested function level reached; increase FUNCNEST?
+
+ (
+ fpath=(.)
+ print "foo-bar() { print this should run automatically; }" >foo-bar
+ autoload -Uz foo-bar
+ foo-bar
+ )
+0:autoload containing dash
+>this should run automatically
+
%clean
rm -f file.in file.out
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 3c93990f1..3b187f492 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -2200,3 +2200,225 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
>Option
>Regular text
>Option
+
+ (setopt nonomatch
+ print ${(z):-foo-bar*thingy?}
+ )
+0:(z) splitting with remaining tokens
+>foo-bar*thingy?
+
+ typeset -A keyvalhash
+ keyvalhash=([one]=eins [two]=zwei)
+ keyvalhash+=([three]=drei)
+ for key in ${(ok)keyvalhash}; do
+ print $key $keyvalhash[$key]
+ done
+0:[key]=val for hashes
+>one eins
+>three drei
+>two zwei
+
+ local keyvalarray
+ keyvalarray=([1]=one [3]=three)
+ print -l "${keyvalarray[@]}"
+ keyvalarray+=([2]=two)
+ print -l "${keyvalarray[@]}"
+0:[key]=val for normal arrays
+>one
+>
+>three
+>one
+>two
+>three
+
+ (setopt KSH_ARRAYS
+ local keyvalarray
+ keyvalarray=([0]=one [2]=three)
+ print -l "${keyvalarray[@]}"
+ keyvalarray+=([1]=two)
+ print -l "${keyvalarray[@]}")
+0:[key]=val for normal arrays with KSH_ARRAYS
+>one
+>
+>three
+>one
+>two
+>three
+
+ typeset -A keyvalhash
+ touch foo Xnot_globbedX
+ key="another key" val="another value"
+ keyvalhash=([$(echo the key)]=$(echo the value)
+ [$key]=$val
+ [*]=?not_globbed?)
+ for key in ${(ok)keyvalhash}; do
+ print -l $key $keyvalhash[$key]
+ done
+0:Substitution in [key]=val syntax
+>*
+>?not_globbed?
+>another key
+>another value
+>the key
+>the value
+
+ local keyvalarray
+ keyvalarray=(1 2 3)
+ keyvalarray+=([5]=5 [7]=7)
+ keyvalarray+=([4]=4 [6]=6)
+ print $#keyvalarray
+ print $keyvalarray
+0:append to normal array using [key]=val
+>7
+>1 2 3 4 5 6 7
+
+ (setopt KSH_ARRAYS
+ local keyvalarray
+ keyvalarray=(1 2 3)
+ keyvalarray+=([4]=5 [6]=7)
+ keyvalarray+=([3]=4 [5]=6)
+ print ${#keyvalarray[*]}
+ print ${keyvalarray[*]})
+0:append to normal array using [key]=val with KSH_ARRAYS
+>7
+>1 2 3 4 5 6 7
+
+ local -A keyvalhash
+ keyvalhash=(['1first element!']=first' 'value
+ ["2second element?"]=second" "value
+ [$'3third element#']=third$' 'value
+ [\4\f\o\u\r\t\h\ \e\l\e\m\e\n\t\\]=fourth\ value)
+ for key in ${(ok)keyvalhash}; do
+ print -rl -- $key $keyvalhash[$key]
+ done
+0:quoting in [key]=value syntax
+>1first element!
+>first value
+>2second element?
+>second value
+>3third element#
+>third value
+>4fourth element\
+>fourth value
+
+ local keyvalarray
+ keyvalarray=(first [2]=second third [6]=sixth seventh [5]=fifth new_sixth)
+ print -l "${keyvalarray[@]}"
+0:mixed syntax [key]=val with normal arrays
+>first
+>second
+>third
+>
+>fifth
+>new_sixth
+>seventh
+
+ (setopt KSH_ARRAYS
+ local keyvalarray
+ keyvalarray=(first [1]=second third [5]=sixth seventh [4]=fifth new_sixth)
+ print -l "${keyvalarray[@]}")
+0:mixed syntax [key]=val with normal arrays with KSH_ARRAYS
+>first
+>second
+>third
+>
+>fifth
+>new_sixth
+>seventh
+
+ local -A keyvalhash
+ keyvalhash=(1 one [2]=two 3 three)
+1:Mixed syntax with [key]=val not allowed for hash.
+?(eval):2: bad [key]=value syntax for associative array
+
+ touch KVA1one KVA2two KVA3three
+ local keyvalarray
+ keyvalarray=(KVA* [4]=*)
+ print -l "${keyvalarray[@]}"
+0:Globbing in non-[key]=val parts of mixed syntax.
+>KVA1one
+>KVA2two
+>KVA3three
+>*
+
+ (setopt KSH_ARRAYS
+ touch KVA1one KVA2two KVA3three
+ local keyvalarray
+ keyvalarray=(KVA* [3]=*)
+ print -l "${keyvalarray[@]}")
+0:Globbing in non-[key]=val parts of mixed syntax with KSH_ARRAYS
+>KVA1one
+>KVA2two
+>KVA3three
+>*
+
+ local -a keyvalarray
+ keyvalarray=(1 2 3)
+ keyvalarray+=([1]+=a [2]=b)
+ print $keyvalarray
+0:Append to element(s) of array
+>1a b 3
+
+ (setopt KSH_ARRAYS
+ local -a keyvalarray
+ keyvalarray=(1 2 3)
+ keyvalarray+=([0]+=a [1]=b)
+ print ${keyvalarray[*]})
+0:Append to element(s) of array with KSH_ARRAYS
+>1a b 3
+
+ local -A keyvalhash
+ keyvalhash=([a]=a [b]=b [c]=c)
+ keyvalhash+=([a]+=yee [b]=ee)
+ local key val
+ for key in "${(ok)keyvalhash[@]}"; do
+ val=${keyvalhash[$key]}
+ print -r -- $key $val
+ done
+0:Append to element(s) of associative array
+>a ayee
+>b ee
+>c c
+
+ local -a keyvalarray
+ keyvalarray=([1]=who [2]=anyway [1]+=is [1]+=that [1]+=mysterious [1]+=man)
+ print -rl -- "${keyvalarray[@]}"
+0:Append to element of array on creation
+>whoisthatmysteriousman
+>anyway
+
+ (setopt KSH_ARRAYS
+ local -a keyvalarray
+ keyvalarray=([0]=who [1]=anyway [0]+=is [0]+=that [0]+=mysterious [0]+=man)
+ print -rl -- "${keyvalarray[@]}")
+0:Append to element of array on creation with KSH_ARRAYS
+>whoisthatmysteriousman
+>anyway
+
+ local -A keyvalhash
+ keyvalhash=([one]=hows [one]+=your [one]+=father [one]+=today)
+ print -rl -- ${(kv)keyvalhash}
+0:Append to element of associative array on creation
+>one
+>howsyourfathertoday
+
+ local b=$'a+=(${(o)$(ls -1 \'.*\' | perl -alne \'\nEND{ print " "; }\'\n)})'
+ printf ': %s\n' "${(@Z+cn+)b}"
+0:(Z) flag splitting with $( closed after embedded newline
+>: a+=(
+>: ${(o)$(ls -1 '.*' | perl -alne '
+>END{ print " "; }'
+>)}
+>: )
+
+ local b=$'# \' single\n# \" double\n# ` backtick\nword'
+ (setopt CSH_JUNKIE_QUOTES
+ printf ': %s\n' "${(@Z+n+)b}")
+0:(z) flag with CSH_JUNKIE_QUOTES
+>: #
+>: ' single
+>: #
+>: " double
+>: #
+>: ` backtick
+>: word
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index 8101ff539..0f6bb3455 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -1026,6 +1026,28 @@
>$lspath $lspath =
>$lspath
+ () {
+ emulate -L sh
+ v='~/one ~/two'
+ print -l -- $v $v
+ }
+0:SH_FILE_EXPANSION option with GLOB_SUBST et al.
+F:Regression test for workers/41811
+>~/one
+>~/two
+>~/one
+>~/two
+
+ (
+ setopt shfileexpansion
+ set -- also appearing
+ print -l $*$*
+ )
+0:SH_FILE_EXPANSION interaction with inserting nodes from parameters
+>also
+>appearingalso
+>appearing
+
testpat() {
if [[ $1 = ${~2} ]]; then print $1 $2 yes; else print $1 $2 no; fi
}
diff --git a/Test/V10private.ztst b/Test/V10private.ztst
index 78ecd48ea..880784e12 100644
--- a/Test/V10private.ztst
+++ b/Test/V10private.ztst
@@ -123,7 +123,7 @@
print ${(kv)hash_test}
0:private hides value from surrounding scope in nested scope
>typeset -a hash_test=( top level )
->typeset -A hash_test=( in function )
+>typeset -A hash_test=( [in]=function )
>typeset -g -a hash_test=( top level )
>array-local top level
>top level
diff --git a/Test/W02jobs.ztst b/Test/W02jobs.ztst
new file mode 100644
index 000000000..65b860072
--- /dev/null
+++ b/Test/W02jobs.ztst
@@ -0,0 +1,186 @@
+# Tests for interactive job control
+
+%prep
+
+ if [[ $OSTYPE == cygwin ]]; then
+ ZTST_unimplemented='the zsh/zpty module does not work on Cygwin'
+ elif zmodload zsh/zpty 2> /dev/null; then
+ zpty_start() {
+ export PS1= PS2=
+ zpty -d
+ zpty zsh "${(q)ZTST_testdir}/../Src/zsh -fiV +Z"
+ }
+ zpty_input() {
+ zpty -w zsh "${(F)@}" $'\n'
+ }
+ zpty_stop() {
+ # exit twice in case of check_jobs
+ zpty -w zsh $'exit\nexit\n'
+ # zpty gives no output when piped without these braces (?)
+ { zpty -r zsh } | sed $'/[^[:space:]]/!d; s/\r$//;'
+ zpty -d
+ :
+ }
+ else
+ ZTST_unimplemented='the zsh/zpty module is not available'
+ fi
+
+%test
+
+ zpty_start
+ zpty_input 'setopt no_long_list_jobs'
+ zpty_input ': &'
+ zpty_input 'wait'
+ zpty_stop
+0:job notification with no_long_list_jobs
+*>\[1] [0-9]##
+*>\[1] + done[[:space:]]##:
+
+ zpty_start
+ zpty_input 'setopt long_list_jobs'
+ zpty_input ': &'
+ zpty_input 'wait'
+ zpty_stop
+0:job notification with long_list_jobs
+*>\[1] [0-9]##
+*>\[1] + [0-9]## done[[:space:]]##:
+
+ zpty_start
+ zpty_input 'setopt no_hup no_check_jobs'
+ zpty_input 'sleep 3 &'
+ zpty_stop
+0:running job with no_hup + no_check_jobs
+*>\[1] [0-9]##
+
+ zpty_start
+ zpty_input 'setopt no_check_jobs'
+ zpty_input 'sleep 3 &'
+ zpty_stop
+0:running job with no_check_jobs
+*>\[1] [0-9]##
+*>zsh:*SIGHUPed*
+
+ zpty_start
+ zpty_input 'setopt check_jobs no_check_running_jobs'
+ zpty_input 'sleep 3 &'
+ zpty_stop
+0:running job with check_jobs + no_check_running_jobs
+*>\[1] [0-9]##
+*>zsh:*SIGHUPed*
+
+ zpty_start
+ zpty_input 'setopt check_jobs check_running_jobs'
+ zpty_input 'sleep 3 &'
+ zpty_stop
+0:running job with check_jobs + check_running_jobs
+*>\[1] [0-9]##
+*>zsh:*running jobs*
+*>zsh:*SIGHUPed*
+
+ zpty_start
+ zpty_input 'setopt check_jobs no_check_running_jobs'
+ zpty_input 'sleep 3'
+ sleep 0.1
+ zpty_input $'\C-z'
+ zpty_stop
+0:suspended job with check_jobs + no_check_running_jobs
+*>zsh:*(stopped|suspended)*sleep*
+*>zsh:*(stopped|suspended) jobs*
+# no 'SIGHUPed' message for suspended jobs
+
+ zpty_start
+ zpty_input 'setopt check_jobs check_running_jobs'
+ zpty_input 'sleep 3'
+ sleep 0.1
+ zpty_input $'\C-z'
+ zpty_stop
+0:suspended job with check_jobs + check_running_jobs
+*>zsh:*(stopped|suspended)*sleep*
+*>zsh:*(stopped|suspended) jobs*
+# no 'SIGHUPed' message for suspended jobs
+
+ zpty_start
+ zpty_input 'sleep 5 & sleep 4 & sleep 3 &'
+ zpty_input 'jobs'
+ zpty_stop
+0:`jobs` (misc.) with multiple running jobs
+*>\[1] [0-9]##
+*>\[2] [0-9]##
+*>\[3] [0-9]##
+*>\[1] running*sleep 5*
+*>\[2] - running*sleep 4*
+*>\[3] + running*sleep 3*
+*>zsh:*SIGHUPed*
+
+ zpty_start
+ zpty_input 'sleep 3 &'
+ zpty_input 'jobs -l'
+ zpty_input 'jobs -p'
+ zpty_stop
+0:`jobs -l` and `jobs -p` with running job
+*>\[1] [0-9]##
+*>\[1] + [0-9]## running*sleep*
+*>\[1] + [0-9]## running*sleep*
+*>zsh:*SIGHUPed*
+
+ zpty_start
+ zpty_input 'sleep 3 &'
+ zpty_input 'jobs -d'
+ zpty_stop
+0:`jobs -d` with running job
+*>\[1] [0-9]##
+*>\[1] + running*sleep*
+*>\(pwd : ?*\)
+*>zsh:*SIGHUPed*
+
+ zpty_start
+ zpty_input 'sleep 3 &'
+ zpty_input 'jobs -r'
+ zpty_input 'print -- -'
+ zpty_input 'jobs -s'
+ zpty_stop
+0:`jobs -r` and `jobs -s` with running job
+*>\[1] [0-9]##
+*>\[1] + running*sleep*
+*>-
+*>zsh:*SIGHUPed*
+
+ zpty_start
+ zpty_input 'sleep 5'
+ sleep 0.1
+ zpty_input $'\C-z'
+ zpty_input 'jobs -r'
+ zpty_input 'print -- -'
+ zpty_input 'jobs -s'
+ zpty_stop
+0:`jobs -r` and `jobs -s` with suspended job
+*>zsh:*(stopped|suspended)*sleep*
+*>-
+*>\[1] + (stopped|suspended)*sleep*
+# no 'SIGHUPed' message for suspended jobs
+
+ zpty_start
+ zpty_input 'sleep 10 & sleep 9 & sleep 8 & sleep 7 &'
+ sleep 0.1
+ zpty_input 'kill %4'
+ sleep 0.1
+ zpty_input 'kill -HUP %3'
+ sleep 0.1
+ zpty_input 'kill -INT %2'
+ sleep 0.1
+ zpty_input 'kill -KILL %1'
+ sleep 0.1
+ zpty_stop
+0:various `kill` signals with multiple running jobs
+*>\[1] [0-9]##
+*>\[2] [0-9]##
+*>\[3] [0-9]##
+*>\[4] [0-9]##
+*>\[4] ? terminate*sleep*
+*>\[3] ? hangup*sleep*
+*>\[2] ? interrupt*sleep*
+*>\[1] ? kill*sleep*
+
+%clean
+
+ zmodload -ui zsh/zpty
diff --git a/Test/X02zlevi.ztst b/Test/X02zlevi.ztst
index d3b533490..4e7966e12 100644
--- a/Test/X02zlevi.ztst
+++ b/Test/X02zlevi.ztst
@@ -1,6 +1,16 @@
# Tests of the vi mode of ZLE
%prep
+ unset -m LC_\*
+ ZSH_TEST_LANG=
+ langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8
+ $(locale -a 2>/dev/null | egrep 'utf8|UTF-8'))
+ for LANG in $langs; do
+ if [[ é = ? ]]; then
+ ZSH_TEST_LANG=$LANG
+ break;
+ fi
+ done
if [[ $OSTYPE = cygwin ]]; then
ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
elif ( zmodload zsh/zpty 2>/dev/null ); then
@@ -463,12 +473,12 @@
> aww
>CURSOR: 0
- zletest $' --ww ww--\eo\eoww\eo\eo--\eo\eo ww\e' gei{a,=,b,c,=,d,e,=,f}$'\e'
+ zletest $' --ww ww--\eo\eoww\eo\eo--\eo\eo ww\e' gei{a,=,b,c,d,=,e,f,=,g}$'\e'
0:backward word end
->BUFFER: f -=-wew wdw-=-
->c
->wbw
->
+>BUFFER: g -=-wfw wew-=-
+>d
+>wcw
+>b
>-=-
>a
> ww
@@ -529,6 +539,15 @@
> wwe
>CURSOR: 29
+ if [[ -z $ZSH_TEST_LANG ]]; then
+ ZTST_skip="no UTF-8 locale for Zle vi-mode test"
+ else
+ zletest $'/あいう/えお/かき\ebxgegex0wxex'
+ fi
+0:word motion with multibyte characters
+>BUFFER: /い/え/き
+>CURSOR: 2
+
zletest $' ----word ---- word word---- ----\e42|daw30|daw22|daw14|daw2|daw'
0:delete all word on blanks
>BUFFER: word
diff --git a/Test/X03zlebindkey.ztst b/Test/X03zlebindkey.ztst
index 013d3dfb3..298d7df5d 100644
--- a/Test/X03zlebindkey.ztst
+++ b/Test/X03zlebindkey.ztst
@@ -126,3 +126,20 @@
>CURSOR: 1
>BUFFER: ホ
>CURSOR: 1
+
+ zpty_run 'bindkey " " magic-space'
+ setopt interactivecomments
+ zletest 'echo $(( x ) x ) y'
+ zletest 'echo $(( ##x ) ##x ) y'
+ unsetopt interactivecomments
+ zletest 'echo $(( x ) x ) y'
+ zletest 'echo $(( ##x ) ##x ) y'
+0:history expansion of failed command substitution using magic-space binding
+>BUFFER: echo $(( x ) x ) y
+>CURSOR: 18
+>BUFFER: echo $(( ##x ) ##x ) y
+>CURSOR: 22
+>BUFFER: echo $(( x ) x ) y
+>CURSOR: 18
+>BUFFER: echo $(( ##x ) ##x ) y
+>CURSOR: 22
diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst
index 113a45076..b1c0e40e5 100644
--- a/Test/Y01completion.ztst
+++ b/Test/Y01completion.ztst
@@ -56,6 +56,21 @@
>FI:{file1}
>FI:{file2}
+ # Temporarily modify format set in comptest
+ comptesteval 'zstyle -s ":completion:*:descriptions" format oldfmt'
+ comptesteval 'zstyle ":completion:*:descriptions" format \
+ ${oldfmt/>*</>%5F123abc%f %B123abc%b<}'
+ comptest $': \t'
+ comptesteval 'zstyle ":completion:*:descriptions" format $oldfmt'
+0:custom description with formatting sequences
+>line: {: }{}
+*>DESCRIPTION:{*123abc*123abc*~*F123*}
+>DI:{dir1}
+>DI:{dir2}
+>FI:{file1}
+>FI:{file2}
+F:regression test workers/42164
+
# Depends on path assignment in comptestinit
comptesteval "path=( $ZTST_srcdir:A )"
comptest $'zt\t'
diff --git a/Test/Y03arguments.ztst b/Test/Y03arguments.ztst
index 25bb96b84..761b4b1d2 100644
--- a/Test/Y03arguments.ztst
+++ b/Test/Y03arguments.ztst
@@ -237,6 +237,27 @@
>NO:{-a}
>NO:{-b}
+ tst_arguments '*'{-x+,--xxx=}':optarg:(1)' '*:operand:(a)'
+ comptest $'tst \t'
+ comptest $'tst -x \t'
+ comptest $'tst -x\t'
+ comptest $'tst --xxx=\t'
+ comptest $'tst --xxx \t'
+ comptest $'tst a -x\t'
+ comptest $'tst a -x \t'
+ comptest $'tst a --xxx=\t'
+ comptest $'tst a --xxx \t'
+0:optarg completion following rest operand on line (workers/42141)
+>line: {tst a }{}
+>line: {tst -x 1 }{}
+>line: {tst -x1 }{}
+>line: {tst --xxx=1 }{}
+>line: {tst --xxx 1 }{}
+>line: {tst a -x1 }{}
+>line: {tst a -x 1 }{}
+>line: {tst a --xxx=1 }{}
+>line: {tst a --xxx 1 }{}
+
tst_arguments '-a' '*::rest:{compadd - -b}'
comptest $'tst arg -\t'
0:rest arguments
@@ -333,6 +354,12 @@
0:option after a word
>line: {tst word -x }{}
+ tst_arguments -A '-*' -x --extra ::first
+ comptest $'tst word -\t'
+0:long option after word that doesn't match -A pattern
+>line: {tst word -}{}
+>MESSAGE:{no more arguments}
+
tst_arguments -A'-*' -x :word
comptest $'tst word -\t'
0:option after word that doesn't match -A pattern, no space before pattern
@@ -358,6 +385,14 @@
0:repeatable options
>line: {tst -v -v }{}
+ tst_arguments - set1 '--label=:arg:(a b)' - set2 ':rest:(rest args --label=not)'
+ comptest $'tst --label=\t'
+0:rest arguments from another set not completed after option from first set
+>line: {tst --label=}{}
+>DESCRIPTION:{arg}
+>NO:{a}
+>NO:{b}
+
tst_arguments -A '-*' - help -h -V - other -a '*: :(-x more)'
comptest $'tst -a -x m\t'
0:continue completion after rest argument that looks like an option (with sets)
@@ -471,12 +506,18 @@
>NO:{-c}
>NO:{-g}
- tst_arguments '(-)-h' -a -b -c
+ tst_arguments '(-)-h' -a -b -c --long +p
comptest $'tst -h -\t'
0:exclude all other options
>line: {tst -h -}{}
>MESSAGE:{no arguments}
+ tst_arguments --args -b -c +p '(-)1:normal'
+ comptest $'tst arg -\t'
+0:exclude all options from a normal argument
+>line: {tst arg -}{}
+>MESSAGE:{no more arguments}
+
tst_arguments -a '(-a)-b'
comptest $'tst - -b\C-b\C-b\C-b\t'
0:exclusion only applies to later words
diff --git a/configure.ac b/configure.ac
index ec0bdae6e..1a498f8b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -415,13 +415,13 @@ ifdef([max_function_depth],[undefine([max_function_depth])])dnl
AH_TEMPLATE([MAX_FUNCTION_DEPTH],
[Define for function depth limits])
AC_ARG_ENABLE(max-function-depth,
-AC_HELP_STRING([--enable-max-function-depth=MAX], [limit function depth to MAX, default 1000]),
+AC_HELP_STRING([--enable-max-function-depth=MAX], [limit function depth to MAX, default 500]),
[if test x$enableval = xyes; then
- AC_DEFINE(MAX_FUNCTION_DEPTH, 1000)
+ AC_DEFINE(MAX_FUNCTION_DEPTH, 500)
elif test x$enableval != xno; then
AC_DEFINE_UNQUOTED(MAX_FUNCTION_DEPTH, $enableval)
fi],
-[AC_DEFINE(MAX_FUNCTION_DEPTH, 1000)]
+[AC_DEFINE(MAX_FUNCTION_DEPTH, 500)]
)
ifdef([default_readnullcmd],[undefine([default_readnullcmd])])dnl