summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog450
-rw-r--r--Completion/Linux/Command/_mdadm10
-rw-r--r--Completion/Linux/Command/_strace39
-rw-r--r--Completion/Solaris/Command/.distfiles11
-rw-r--r--Completion/Solaris/Command/_beadm76
-rw-r--r--Completion/Solaris/Command/_dladm562
-rw-r--r--Completion/Solaris/Command/_dtrace41
-rw-r--r--Completion/Solaris/Command/_flowadm115
-rw-r--r--Completion/Solaris/Command/_fmadm111
-rw-r--r--Completion/Solaris/Command/_ipadm375
-rw-r--r--Completion/Solaris/Command/_netstat61
-rw-r--r--Completion/Solaris/Command/_pkg5431
-rw-r--r--Completion/Solaris/Command/_prstat45
-rw-r--r--Completion/Solaris/Command/_ps77
-rw-r--r--Completion/Solaris/Command/_snoop87
-rw-r--r--Completion/Solaris/Command/_svcadm43
-rw-r--r--Completion/Solaris/Command/_svccfg19
-rw-r--r--Completion/Solaris/Command/_svcprop3
-rw-r--r--Completion/Solaris/Command/_zlogin17
-rw-r--r--Completion/Solaris/Command/_zoneadm147
-rw-r--r--Completion/Solaris/Type/.distfiles2
-rw-r--r--Completion/Solaris/Type/_be_name18
-rw-r--r--Completion/Solaris/Type/_svcs_fmri48
-rw-r--r--Completion/Solaris/Type/_zones13
-rw-r--r--Completion/Unix/Command/.distfiles4
-rw-r--r--Completion/Unix/Command/_getconf2
-rw-r--r--Completion/Unix/Command/_git1
-rw-r--r--Completion/Unix/Command/_gradle114
-rw-r--r--Completion/Unix/Command/_init_d1
-rw-r--r--Completion/Unix/Command/_mosh12
-rw-r--r--Completion/Unix/Command/_mount9
-rw-r--r--Completion/Unix/Command/_quilt22
-rw-r--r--Completion/Unix/Command/_ssh13
-rw-r--r--Completion/Unix/Command/_systemctl311
-rw-r--r--Completion/Unix/Command/_systemd459
-rw-r--r--Completion/Unix/Command/_tmux26
-rw-r--r--Completion/Unix/Command/_wget2
-rw-r--r--Completion/Unix/Command/_xmlsoft6
-rw-r--r--Completion/Unix/Command/_zfs342
-rw-r--r--Completion/Unix/Command/_zpool190
-rw-r--r--Completion/Unix/Type/.distfiles2
-rw-r--r--Completion/Unix/Type/_pdf2
-rw-r--r--Completion/Unix/Type/_ps1234109
-rw-r--r--Completion/Unix/Type/_zfs_dataset70
-rw-r--r--Completion/Unix/Type/_zfs_keysource_props15
-rw-r--r--Completion/Zsh/Command/_print116
-rw-r--r--Completion/Zsh/Command/_typeset6
-rw-r--r--Completion/compinit10
-rw-r--r--Config/version.mk4
-rw-r--r--Doc/.distfiles1
-rw-r--r--Doc/Makefile.in5
-rw-r--r--Doc/Zsh/builtins.yo39
-rw-r--r--Doc/Zsh/cond.yo5
-rw-r--r--Doc/Zsh/contrib.yo34
-rw-r--r--Doc/Zsh/expn.yo19
-rw-r--r--Doc/Zsh/options.yo5
-rw-r--r--Doc/Zsh/params.yo32
-rw-r--r--Doc/Zsh/zle.yo37
-rw-r--r--Doc/intro.ms30
-rw-r--r--Etc/.distfiles1
-rw-r--r--Etc/FAQ.yo21
-rw-r--r--Etc/NEWS-4.3356
-rw-r--r--FEATURES4
-rw-r--r--Functions/Misc/add-zsh-hook22
-rw-r--r--Functions/Misc/promptnl2
-rw-r--r--Functions/Misc/zargs16
-rw-r--r--Functions/Misc/zkbd15
-rw-r--r--Functions/Prompts/prompt_fade_setup2
-rw-r--r--Functions/Prompts/promptinit1
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git2
-rw-r--r--Functions/VCS_Info/vcs_info_setsys1
-rw-r--r--Functions/Zftp/zfcd_match1
-rw-r--r--Functions/Zle/forward-word-match36
-rw-r--r--Functions/Zle/replace-string9
-rw-r--r--Functions/Zle/select-word-style138
-rw-r--r--Functions/Zle/split-shell-arguments2
-rw-r--r--Functions/Zle/url-quote-magic5
-rw-r--r--MACHINES126
-rw-r--r--Misc/vcs_info-examples12
-rw-r--r--NEWS642
-rw-r--r--README22
-rw-r--r--Src/Modules/parameter.c20
-rw-r--r--Src/Modules/regex.c23
-rw-r--r--Src/Zle/zle.h1
-rw-r--r--Src/Zle/zle_params.c32
-rw-r--r--Src/Zle/zle_utils.c30
-rw-r--r--Src/builtin.c100
-rw-r--r--Src/exec.c27
-rw-r--r--Src/glob.c15
-rw-r--r--Src/hashtable.c3
-rw-r--r--Src/hist.c3
-rw-r--r--Src/init.c123
-rw-r--r--Src/jobs.c24
-rw-r--r--Src/options.c16
-rw-r--r--Src/params.c141
-rw-r--r--Src/prompt.c16
-rw-r--r--Src/subst.c69
-rw-r--r--Src/utils.c53
-rw-r--r--Src/zsh_system.h4
-rw-r--r--Test/C02cond.ztst2
-rw-r--r--Test/D04parameter.ztst71
-rw-r--r--configure.ac49
102 files changed, 5619 insertions, 1495 deletions
diff --git a/ChangeLog b/ChangeLog
index f00df2b5b..d8540140b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,449 @@
+2012-07-21 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: update for 5.0.0 release.
+
+2012-07-17 Barton E. Schaefer <schaefer@zsh.org>
+
+ * users/17051 (cf. 30571): Completion/compinit: explicit IFS for
+ "read" of bindkey, dumpfiles, etc.
+
+2012-07-15 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Bart: 30560: Src/builtin.c: unset array element by setting
+ to null.
+
+2012-07-08 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Danek: 30562: Completion/Solaris/Command/_dladm,
+ Completion/Solaris/Command/_flowadm,
+ Completion/Solaris/Command/_ipadm,
+ Completion/Solaris/Command/_zoneadm,
+ Completion/Unix/Command/_zfs, Completion/Unix/Command/_zpool,
+ Completion/Unix/Type/_zfs_dataset: Solaris completion updates.
+
+2012-06-30 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 30540: Src/builtin.c: process the rest of the typeset flags when
+ changing the numeric type of SECONDS e.g. from integer to float.
+
+2012-06-27 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: belatedly commit version number update.
+
+2012-06-26 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 30533: Src/utils.c: when processing a change in the value of
+ COLUMNS, do not assert the change into the tty driver winsize.
+ The code for this was dead the whole time IPDEF5 was broken and
+ this seems a bad time to make it live; besides which it is not
+ consistent about the handling of LINES (which is ignored when
+ changed by itself, but would be asserted when COLUMNS changes).
+
+ * 30530: Src/params.c: fix long-broken IPDEF5 definition to use
+ the GSU struct, thus fixing problems with values of LINES or
+ COLUMNS less than 1.
+
+2012-06-21 Peter Stephenson <pws@csr.com>
+
+ * Danek (plus .distfiles changes): 30520:
+ Completion/Solaris/Command/.distfiles:
+ Completion/Solaris/Command/_beadm,
+ Completion/Solaris/Command/_dladm,
+ Completion/Solaris/Command/_dtrace,
+ Completion/Solaris/Command/_flowadm,
+ Completion/Solaris/Command/_fmadm,
+ Completion/Solaris/Command/_ipadm,
+ Completion/Solaris/Command/_netstat,
+ Completion/Solaris/Command/_pkg5,
+ Completion/Solaris/Command/_prstat,
+ Completion/Solaris/Command/_ps,
+ Completion/Solaris/Command/_snoop,
+ Completion/Solaris/Command/_svcadm,
+ Completion/Solaris/Command/_svccfg,
+ Completion/Solaris/Command/_svcprop,
+ Completion/Solaris/Command/_zlogin,
+ Completion/Solaris/Command/_zoneadm,
+ Completion/Solaris/Type/.distfiles,
+ Completion/Solaris/Type/_be_name,
+ Completion/Solaris/Type/_svcs_fmri,
+ Completion/Solaris/Type/_zones,
+ Completion/Unix/Command/_zfs,
+ Completion/Unix/Command/_zpool,
+ Completion/Unix/Type/.distfiles,
+ Completion/Unix/Type/_zfs_dataset,
+ Completion/Unix/Type/_zfs_keysource_props: updated completions
+ for Solaris 11.
+
+ * 30518: configure.ac, Src/zsh_system.h: attempt to supply
+ tgoto() prototype only when missing for Solaris 10 and earlier.
+
+ * 30519 (correction noticed by Danek): MACHINES: try to
+ modernise.
+
+2012-06-18 Peter Stephenson <pws@csr.com>
+
+ * Dima Kogan: 30515: Src/glob.c: glob size test failed on very
+ large files owing to integer type error.
+
+2012-06-15 Phil Pennock <pdpennock@users.sourceforge.net>
+
+ * 30513: zsh/regex metafy fixes for widechar; similar to 29838.
+
+2012-06-15 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 30509: FEATURES, README, Etc/FAQ.yo: updates for 5.0.0.
+
+ * Danek: 30510: Doc/Zsh/params.yo: bad indentation.
+
+2012-06-10 Clint Adams <clint@zsh.org>
+
+ * 30503: Completion/Unix/Command/_mosh: rudimentary
+ completion for mosh.
+
+2012-06-10 Mikael Magnusson <mikachu@gmail.com>
+
+ * Jeremy Mates: 30505: Completion/Unix/Command/_wget: Allow
+ multiple --header=.
+
+2012-06-06 Barton E. Schaefer <schaefer@zsh.org>
+
+ * users/17134: Functions/Misc/promptnl: avoid bad math error
+
+2012-06-06 Peter Stephenson <pws@csr.com>
+
+ * Vincent: 30497: Completion/Unix/Command/_xmlsoft: option
+ completion issue.
+
+2012-06-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * users/17132: Doc/Zsh/contrib.yo,
+ Functions/Zle/forward-word-match,
+ Functions/Zle/select-word-style: skip-whitespace-first style for
+ compatibility with bash and other editors in forward-word.
+
+2012-05-31 Peter Stephenson <pws@csr.com>
+
+ * Foudil Brétel: 30495: Completion/Unix/Command/_systemd (also
+ Completion/Unix/Command/.distfiles): replace
+ Completion/Unix/Command/_systemctl and add various enhancements.
+
+2012-05-23 Frank Terbeck <ft@bewatermyfriend.org>
+
+ * Juliano Ravasi: 30488:
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_git: Fix
+ initialisation of `$stgit_unapplied'.
+
+2012-05-22 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Jun T.: 30483: Completion/Unix/Command/_mount: improved
+ completion on MacOS.
+
+ * Danek: 30485: Src/jobs.c: trailing garbage after signal
+ number not recognised in kill builtin.
+
+2012-05-21 Peter Stephenson <pws@csr.com>
+
+ * c.f 30482 (Peter Jaros): Completion/Unix/Command/_tmux: typo
+ in description.
+
+2012-05-17 Mikael Magnusson <mikachu@gmail.com>
+
+ * 30473: Completion/Linux/Command/_strace: update for 4.7 and
+ mark all options as taking sticked arguments.
+
+ * 30474: Completion/Unix/Command/_ssh: Add -O cancel.
+
+2012-05-14 Mikael Magnusson <mikachu@gmail.com>
+
+ * 30468: Functions/Prompts/prompt_fade_setup: add missing $
+ reported by Devon Meunier.
+
+ * 30466: Completion/Unix/Type/.distfiles,
+ Completion/Unix/Type/_ps1234, Completion/Zsh/Command/_print:
+ Add new completer for prompt format specifiers and hook it up
+ to print -P and assigning to the various prompt parameters.
+ Add completion for printf and print -f formats.
+
+2012-05-08 Barton E. Schaefer <schaefer@zsh.org>
+
+ * unposted, see users/17062: Doc/Zsh/contrib.yo: Briefly describe
+ option semantic differences from xargs to zargs. (Merged with
+ PWS edits.)
+
+2012-05-08 Peter Stephenson <pws@csr.com>
+
+ * 30469: Src/builtin.c: allow reverse listing of history using
+ fc -r, but don't allow reverse execution of commands at all.
+
+ * unposted: Doc/Zsh/contrib.yo: clarify that zargs is different
+ from xargs.
+
+2012-05-03 Peter Stephenson <pws@csr.com>
+
+ * unposted, see 30465: Doc/Zsh/expn.yo, Doc/Zsh/params.yo: add
+ index entries and cross-references for matching parameters.
+
+2012-05-02 Mikael Magnusson <mikachu@gmail.com>
+
+ * 30461, 30462 (tweaked): Functions/Prompts/promptinit,
+ Functions/VCS_Info/vcs_info_setsys, Functions/Zftp/zfcd_match,
+ Functions/Zle/url-quote-magic: add missing local for match,
+ mbegin and mend.
+
+ * 30425 (fixed): Src/Zle/zle_params.c, Doc/Zsh/zle.yo:
+ Add localhistory/globalhistory to $ZLE_STATE as set by the
+ set-local-history zle widget.
+
+2012-05-01 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * users/17046: Src/utils.c, Test/D04parameter.ztst: don't
+ count too many elements when splitting quoted parameter
+ substitution on null separator.
+
+2012-05-01 Mikael Magnusson <mikachu@gmail.com>
+
+ * 30456: Completion/Unix/Command/_getconf: Use new array syntax.
+
+2012-04-25 Peter Stephenson <pws@csr.com>
+
+ * 30455: NEWS, Src/params.c: remove max array length test.
+
+2012-04-25 Mikael Magnusson <mikachu@gmail.com>
+
+ * 30429: Completion/Unix/Command/_init_d: Avoid error when the
+ service doesn't exist.
+
+ * 30430: Doc/intro.ms: Fix some errors and outdatedness.
+
+ * 30444: NEWS: Add entry for new syntax added in 30431 below.
+
+2012-04-22 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: Src/subst.c: add test for valid identifier to 30431.
+
+ * Test/D04parameter.ztst: 30439: Src/subst.c,
+ Test/D04parameter.ztst: ${...:*...} with nonexistent or
+ non-array variable second should return no results.
+
+ * 30431 (typo in _typeset fixed):
+ Completion/Zsh/Command/_typeset, Doc/Zsh/expn.yo, Src/params.c,
+ Src/subst.c, Test/D04parameter.ztst: add ${...:|...} and
+ ${...:*...} operators for removal or inclusion of results
+ by array element.
+
+2012-04-21 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 30433: Src/hist.c: double backslash is not line continuation.
+
+2012-04-20 Mikael Magnusson <mikachu@gmail.com>
+
+ * 30412: Doc/Zsh/zle.yo: Document the set-local-history
+ widget in the list of widgets.
+
+ * Vin Shelton: 30427: Doc/Zsh/zle.yo: Remove erroneous enditem
+ from previous commit.
+
+2012-04-16 Peter Stephenson <pws@csr.com>
+
+ * Michael Prokop: 30414: Completion/Linux/Command/_mdadm: more
+ flexible configuration file usage.
+
+ * 30413: Src/params.c, Src/utils.c, Test/D04parameter.ztst:
+ (q-) parameter flag should quote the empty string and should
+ report an error with extra trailing q's.
+
+2012-04-15 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: NEWS: incorporate the remainder of Bart's
+ suggestions from 30408.
+
+ * 30410 (with the addition of one other case): Src/jobs.c: avoid
+ some divide-by-zero errors in TIMEFMT interpretation.
+
+2012-04-14 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 30402: Doc/.distfiles, Doc/Makefile.in: turn intro.ms into
+ intro.pdf for doc distribution. Still needs some tidy ups.
+
+2012-04-14 Mikael Magnusson <mikachu@gmail.com>
+
+ * 30406: NEWS: some typo fixes.
+
+2012-04-13 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: Etc/.distfiles: missed this.
+
+ * Christian Neukirchen: 30398, 30399: Doc/params.yo: TIMEFMT
+ documentation.
+
+ * 30400 (plus a few extra tweaks): NEWS, Etc/NEWS-4.3: update
+ NEWS for forthcoming 5.0 release.
+
+2012-04-13 Peter Stephenson <pws@csr.com>
+
+ * 30391: Src/params.c: New hash-based arrayuniq() doesn't
+ care about (or set the flag correctly for) disabled hash nodes,
+ so we need to ignore that flag.
+
+2012-04-12 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 30388, 30389 (Stephane): Functions/Misc/zargs: handle
+ zero-length arguments.
+
+2012-04-09 Barton E. Schaefer <schaefer@zsh.org>
+
+ * unposted: Test/D04parameter.ztst: hash seive needs more than 10
+ array elements for arrayuniq() testing. This test will need to
+ be tweaked if that size changes.
+
+ * unposted (see users/17000): Src/params.c: fix allocation bug in
+ 16991 by using heap memory for hash nodes; throw an error if out
+ of heap; pull hash table creation out into a helper function and
+ use arrlen() to count the array.
+
+ * Václav Zeman: users/16991: Src/params.c: implement hash-table
+ seive variant of arrayuniq() to improve speed at cost of space,
+ falls back on the constant-space version for small arrays.
+
+ * 30383: Src/params.c: improve the constant-space variant of
+ arrayuniq() by optimizing shifts.
+
+2012-04-01 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * users/16944: Functions/Zle/url-quote-magic: some more "local"s
+ needed.
+
+2012-03-30 Peter Stephenson <pws@csr.com>
+
+ * unposted: Functions/Zle/split-shell-arguments: add some
+ typeset -g's to avoid WARN_CREATE_GLOBAL warnings.
+
+ * unposted: Src/init.c: add some braces to avoid warnings from
+ some versions of gcc.
+
+2012-03-29 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: Doc/Zsh/zle.yo: add missing parenthesis.
+
+ * users/16932: Doc/Zsh/zle.yo, Functions/Zle/replace-string:
+ Src/Zle/zle.h, Src/Zle/zle_params.c, Src/Zle/zle_utils.c:
+ implement $UNDO_CHANGE_NO and argument to undo widget.
+
+2012-03-25 Mikael Magnusson <mikachu@gmail.com>
+
+ * Jesper Nygårds: 30378: Completion/Unix/Command/.distfiles,
+ Completion/Unix/Command/_gradle: new gradle completion.
+
+2012-03-24 Mikael Magnusson <mikachu@gmail.com>
+
+ * 30371: Completion/Unix/Command/_ssh: You can specify -i
+ multiple times.
+
+ * 30372: Completion/Unix/Command/_tmux: Redirect error output
+ produced when no tmux server is running to /dev/null.
+
+ * 30368: Completion/Unix/Command/_tmux: Make completion work
+ when an unambiguous prefix for a known subcommand is given, as
+ in 'tmux att -<tab>'.
+
+2012-03-23 Simon Ruderich <simon@ruderich.org>
+
+ * 30366: Misc/vcs_info-examples: Fix outdated quilt examples.
+ * 30367: Doc/Zsh/contrib.yo: vcs_info, mention settings used for
+ patch-format/nopatch-format.
+
+2012-03-13 Peter Stephenson <pws@csr.com>
+
+ * Luka Perkov: 30354: Completion/Unix/Command/_quilt: update
+
+ * 30351 changed as in 30352: Src/params.c, Src/utils.c: metafy
+ scalar and array parameter values as they are imported from
+ strings defined outside zsh.
+
+2012-03-07 Peter Stephenson <pws@csr.com>
+
+ * users/16865: Doc/Zsh/cond.yo: note that -eq and friends are
+ less convenient for purely numeric work than conditional
+ expressions.
+
+2012-03-06 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Alexey: 30322: Completion/Unix/Command/_xmlsoft: accept more
+ file types.
+
+2012-03-06 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 30320: Doc/Zsh/builtins.yo, Src/builtin.c, Src/init.c,
+ Src/options.c: "emulate" accepts invocation-time setopt flags
+ after the shell name, in addition to "-c command".
+
+ * 30320 (bonus): Doc/Zsh/params.yo: document interaction of
+ sun_keyboard_hack with the KEYBOARD_HACK paramter.
+
+ * 30320 (misc.): Etc/FAQ.yo: rectify a minor omission.
+
+2012-03-05 Clint Adams <clint@zsh.org>
+
+ * 30314: Completion/Unix/Command/_ssh: add completion for
+ ssh-copy-id.
+
+ * 30316: Completion/Unix/Type/_pdf: complete .pdf for evince and
+ epdfview.
+
+ * 30317: Completion/Unix/Command/_git: complete git merge --ff-only
+
+2012-03-05 Peter Stephenson <pws@csr.com>
+
+ * 30307 plus change suggested by Wayne in 30309: configure.ac,
+ Src/exec.c, Src/glob.c, Src/prompt.c, Src/utils.c,
+ Src/Modules/parameter.c: use %lld format where available when
+ zlong is long long.
+
+2012-03-01 Peter Stephenson <pws@csr.com>
+
+ * 30303: Doc/builtins.yo, Src/options.c: emulate executed inside
+ a function marked for execution tracing enables xtrace.
+
+2012-02-29 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 30272 (tweaked): Src/exec.c: most failures of fork() cause
+ non-interactive shells to exit nonzero; bad options to "exec"
+ cause exit under POSIX_BUILTINS behavior.
+
+ * unposted (see users/16715): Doc/Zsh/options.yo: document the
+ effects of HASH_LIST_ALL on spelling correction.
+
+ * 30184: Src/hashtable.c: the HASH_EXECUTABLES_ONLY test matches
+ the test used during path search in exec.c:iscom().
+
+ * unposted (see 30090): Functions/Misc/add-zsh-hook: add -h and
+ -L options for help text and a list of extant hooks respectively.
+
+ * unposted (see users/16697): Functions/Misc/zkbd: select a more
+ reasonable output file name when the DISPLAY variable refers to a
+ local socket file (MacOS); fix problem with writing the output
+ file when the user overrides the default value of TERM.
+
+2012-02-29 Mikael Magnusson <mikachu@gmail.com>
+
+ * 30276: Src/glob.c: Use zlong rather than int when calculating
+ brace expansions of the form {1..9}.
+
+2012-02-29 Peter Stephenson <pws@csr.com>
+
+ * 30299: Src/subst.c, Test/D04parameter.ztst: "$*" was split
+ in SHWORDSPLIT if IFS was unset or empty.
+
+2012-02-26 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Alexey I. Froloff: 30270: Test/C02cond.ztst: we don't care
+ about errors from df when testing whether the file system has
+ noatime.
+
+ * unposted: Config/version.mk: Update version to 4.3.17-dev-0 to
+ avoid clash with release, also fix incorrect year noticed by
+ Darryl Zurn.
+
2012-02-23 Peter Stephenson <p.w.stephenson@ntlworld.com>
* unposted: 4.3.17.
@@ -9,7 +455,7 @@
2012-02-20 Barton E. Schaefer <schaefer@zsh.org>
- * 30242: Src/subst.c, Test/D05parameter.ztst: use PREFORK_SINGLE
+ * 30242: Src/subst.c, Test/D04parameter.ztst: use PREFORK_SINGLE
for the right-hand side of ${...=...} when SH_WORD_SPLIT is in
effect (POSIX emulation).
@@ -16010,5 +16456,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5594 $
+* $Revision: 1.5681 $
*****************************************************
diff --git a/Completion/Linux/Command/_mdadm b/Completion/Linux/Command/_mdadm
index 461e66617..940eb6887 100644
--- a/Completion/Linux/Command/_mdadm
+++ b/Completion/Linux/Command/_mdadm
@@ -147,7 +147,15 @@ fi
_mds () {
local -a vals
- vals=( ${${${(M)${(f)"$(< /etc/mdadm.conf)"}##ARRAY *}//ARRAY /}%%[[:blank:]]*} )
+ if [ -r /etc/mdadm.conf ] ; then
+ local mdadm_conf=/etc/mdadm.conf
+ elif [ -r /etc/mdadm/mdadm.conf ] ; then
+ local mdadm_conf=/etc/mdadm/mdadm.conf
+ else
+ _message "could not find mdadm.conf"
+ return 1
+ fi
+ vals=( ${${${(M)${(f)"$(< $mdadm_conf)"}##ARRAY *}//ARRAY /}%%[[:blank:]]*} )
_describe -t mds "RAID devices" vals
_arguments \
"(-h --help)"{-h,--help}'[display a mode specific help message]'
diff --git a/Completion/Linux/Command/_strace b/Completion/Linux/Command/_strace
index 695e800c7..45ebfcf1a 100644
--- a/Completion/Linux/Command/_strace
+++ b/Completion/Linux/Command/_strace
@@ -85,29 +85,34 @@ _expression () {
_arguments \
'()-c[count time, calls, and errors for each system call and report a summary]' \
- -d'[show some debugging output of strace itself on the standard error]' \
- -f'[trace child processes as they are created by currently traced processes]' \
- -ff'[write each process trace to <filename>.<pid> (when using -o <filename>]' \
+ '()-C[count time, calls, and errors for each system call and report a summary in addition to regular output]' \
+ '-d[show some debugging output of strace itself on the standard error]' \
+ '-D[run tracer as detached grandchild, keeping traced process as direct child of calling process]' \
+ '-f[trace child processes as they are created by currently traced processes]' \
+ '-ff[write each process trace to <filename>.<pid> (when using -o <filename>]' \
'(-c -d -f -ff -i -q -r -t -tt -ttt -T -v -V -x -xx -a -e -o -O -p -s -S -u -E)-h[print help]' \
- -i'[print the instruction pointer at the time of the system call]' \
- -q'[suppress messages about attaching, detaching etc.]' \
- -r'[print a relative timestamp upon entry to each system call]' \
+ '-i[print the instruction pointer at the time of the system call]' \
+ '-q[suppress messages about attaching, detaching etc.]' \
+ '-r[print a relative timestamp upon entry to each system call]' \
'(-ttt)-t[prefix each line of the trace with the time of day]' \
'(-ttt -tt)-tt[prefix each line of the trace with the time of day including the microseconds]' \
'(-tt -t)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]' \
- -T'[show the time spent in system calls]' \
- -v'[print unabbreviated versions of environment, stat, termios, etc. calls]' \
+ '-T[show the time spent in system calls]' \
+ '-y[print paths associated with file descriptor arguments]' \
+ '-v[print unabbreviated versions of environment, stat, termios, etc. calls]' \
'(-c -d -f -ff -h -i -q -r -t -tt -ttt -T -v -x -xx -a -e -o -O -p -s -S -u -E)-V[print the version number of strace]' \
'(-xx)-x[print all non-ASCII strings in hexadecimal string format]' \
'(-x)-xx[print all strings in hexadecimal string format]' \
- -a'[align return values in a specific column (default 40)]:column number' \
- '*-e[select events to trace or how to trace]:system call:_expression' \
- '-o[write the trace output to the file]:output file:_files' \
- '-O[overhead for tracing system calls]:overhead microseconds' \
- '(:)-p[attach to the process with specified process ID and begin tracing]:process ID:_pids' \
- '-s[specify the maximum string size to print (default 32)]:maximum string size' \
- '-S[sort the output of the histogram (-c option) by the specified criterion]:sort by:(time calls name nothing)' \
- '-u[run as specified user]:user:_users' \
- '*-E[remove variable from the inherited list of environment or define a value]:variable:_printenv' \
+ '-I+[when strace can be interrupted by signals]:interruptible:((1\:"no signals are blocked" 2\:"fatal signals are blocked while decoding syscall (default)" 3\:"fatal signals are always blocked (default if '\''-o FILE PROG'\''" 4\:"fatal signals and SIGTSTP are always blocked"))' \
+ '*-P+[trace only system calls accessing given path]:path:_files' \
+ '-a+[align return values in a specific column (default 40)]:column number' \
+ '*-e+[select events to trace or how to trace]:system call:_expression' \
+ '-o+[write the trace output to the file]:output file:_files' \
+ '-O+[overhead for tracing system calls]:overhead microseconds' \
+ '(:)-p+[attach to the process with specified process ID and begin tracing]:process ID:_pids' \
+ '-s+[specify the maximum string size to print (default 32)]:maximum string size' \
+ '-S+[sort the output of the histogram (-c option) by the specified criterion]:sort by:(time calls name nothing)' \
+ '-u+[run as specified user]:user:_users' \
+ '*-E+[remove variable from the inherited list of environment or define a value]:variable:_printenv' \
'(-):command name: _command_names -e' \
'*::arguments:_normal'
diff --git a/Completion/Solaris/Command/.distfiles b/Completion/Solaris/Command/.distfiles
index fa3d89ccd..a900851aa 100644
--- a/Completion/Solaris/Command/.distfiles
+++ b/Completion/Solaris/Command/.distfiles
@@ -1,17 +1,28 @@
DISTFILES_SRC='
.distfiles
+_beadm
_coreadm
_dhcpinfo
_dladm
+_dtrace
_dumpadm
+_flowadm
+_fmadm
_gcore
_inetadm
+_ipadm
+_netstat
_pfexec
+_pkg5
+_prstat
+_ps
_ptree
_savecore
+_snoop
_svcadm
_svccfg
_svcprop
_svcs
_zlogin
+_zoneadm
'
diff --git a/Completion/Solaris/Command/_beadm b/Completion/Solaris/Command/_beadm
new file mode 100644
index 000000000..6e498bee3
--- /dev/null
+++ b/Completion/Solaris/Command/_beadm
@@ -0,0 +1,76 @@
+#compdef beadm
+
+_beadm() {
+ local context state line subcmds
+ typeset -A opt_args
+
+ subcmds=( activate create destroy list mount rename unmount )
+
+ if [[ $service == "beadm" ]]; then
+ _arguments -C -A "-*" \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl 'beadm subcommand' compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+ fi
+
+ case $service in
+ (activate)
+ _arguments -A "-*" \
+ ':BE name:_be_name'
+ ;;
+
+ (create)
+ # TODO: Add support for -o, and for creating snapshots
+ _arguments -A "-*" \
+ '-a[Activate new BE]' \
+ '-d[Description]:' \
+ '-e[Base BE]:BE name or snapshot:_be_name -t all' \
+ '-p[Create new BE in specified ZFS pool]:ZFS pool:_zfs_pool' \
+ ':new BE name:'
+ ;;
+
+ (destroy)
+ _arguments -A "-*" \
+ '-f[Unmount BE if necessary]' \
+ "-F[Don't prompt for verification]" \
+ ':BE or BE snapshot:_be_name'
+ ;;
+
+ (list)
+ _arguments -A "-*" \
+ '-a[List subordinate filesystems and snapshots]' \
+ '-d[List subordinate filesystems]' \
+ '-s[List snapshots]' \
+ '-H[Parseable format]' \
+ ':BE name:_be_name'
+ ;;
+
+ (mount)
+ _arguments -A "-*" \
+ ':BE name:_be_name' \
+ ':mountpoint:_path_files -/'
+ ;;
+
+ (rename)
+ _arguments -A "-*" \
+ ':existing BE name:_be_name' \
+ ':new BE name:'
+ ;;
+
+ (unmount)
+ _arguments -A "-*" \
+ '-f[Force unmount]' \
+ ':BE name:_be_name'
+ ;;
+
+ (*)
+ _message "unknown beadm subcommand: $service"
+ esac
+}
+
+_beadm "$@"
diff --git a/Completion/Solaris/Command/_dladm b/Completion/Solaris/Command/_dladm
index 3c1595b52..5e5ab0172 100644
--- a/Completion/Solaris/Command/_dladm
+++ b/Completion/Solaris/Command/_dladm
@@ -1,4 +1,5 @@
#compdef dladm
+# Synced with the S11U1 build 19 man page
_dladm_links() {
compadd "$@" - $(dladm show-link -p -o link)
@@ -36,11 +37,6 @@ _dladm_ethers() {
compadd "$@" - $(dladm show-ether -p -o link)
}
-_dladm_linkprops() {
- # TODO: complete property values, when available
- compadd "$@" - $(dladm show-linkprop -c -o property)
-}
-
_dladm_vnics() {
compadd "$@" - $(dladm show-vnic -p -o link)
}
@@ -49,35 +45,60 @@ _dladm_etherstubs() {
compadd "$@" - $(dladm show-etherstub)
}
+_dladm_bridges() {
+ compadd "$@" - $(dladm show-bridge -p -o bridge)
+}
+
+_dladm_iptuns() {
+ compadd "$@" - $(dladm show-iptun -p -o link)
+}
+
+_dladm_parts() {
+ compadd "$@" - $(dladm show-part -p -o link)
+}
+
+_dladm_iblinks() {
+ compadd "$@" - $(dladm show-ib -p -o link)
+}
+
_dladm() {
local context state line expl
typeset -A opt_args
- local -a subcmds rw_properties rw_propnames ro_properties
- local -a link_properties link_stats_properties
+ local -a subcmds
+ local -a linkprops linkprops_general linkprops_nonvlanvnic linkprops_wifi
+ local -a linkprops_ether linkprops_ib linkprops_iptun
+ local -a link_properties link_stats_properties vnic_properties
local -a aggr_properties aggr_lacp_properties aggr_ext_properties
local -a vlan_properties wifi_properties wifi_connect_properties
local -a ether_properties linkprop_properties secobj_properties
+ local -a bridge_properties bridge_stats_properties bridge_link_properties
+ local -a bridge_link_stats_properties bridge_fwd_properties
+ local -a bridge_fwd_properties bridge_trill_properties
+ local -a iptun_properties tunnel_values part_properties ib_properties
# TODO: some subcommands can take multiple comma-separated targets
# TODO: some option sets may be different based on other commandline flags
# TODO: some subcommands may take different arguments based on options
subcmds=(
- "show-ether" "show-usage"
+ "help" "show-ether" "show-ib" "show-usage"
{"rename","show"}"-link"
{"add","create","delete","modify","remove","show"}"-aggr"
{"connect","disconnect","scan","show"}"-wifi"
{"reset","set","show"}"-linkprop"
{"create","delete","show"}"-secobj"
- {"create","delete","show"}"-vlan"
+ {"create","delete","modify","show"}"-vlan"
{"delete","show"}"-phys"
- {"create","delete","show"}"-vnic"
+ {"create","delete","modify","show"}"-vnic"
{"create","delete","show"}"-etherstub"
+ {"create","modify","delete","add","remove","show"}"-bridge"
+ {"create","modify","delete","show"}"-iptun"
+ {"create","delete","show"}"-part"
)
if [[ $service == "dladm" ]]; then
_arguments -C -A "-*" \
- '-\?[help]' \
+ '-\?[Help]' \
'*::command:->subcmd' && return 0
if (( CURRENT == 1 )); then
@@ -88,10 +109,10 @@ _dladm() {
curcontext="${curcontext%:*}=$service:"
fi
- link_properties=( "link" "class" "mtu" "state" "over" )
+ link_properties=( "link" "zone" "class" "mtu" "state" "over" )
link_stats_properties=( "link" "ipackets" "rbytes" "ierrors" "opackets" "obytes" "oerrors" )
- aggr_properties=( "link" "policy" "addrpolicy" "lacpactivity" "lacptimer" "flags" )
+ aggr_properties=( "link" "policy" "addrpolicy" "lacpactivity" "lacptimer" "mode" "flags" )
aggr_lacp_properties=( "link" "port" "aggregatable" "sync" "coll" "dist" "defaulted" "expired" )
aggr_ext_properties=( "link" "port" "speed" "duplex" "state" "address" "portstate" )
@@ -108,34 +129,158 @@ _dladm() {
vnic_properties=( "link" "over" "speed" "macaddr" "macaddrtype" )
+ bridge_properties=( "bridge" "address" "priority" "bmaxage" "bhellotime" "bfwddelay"
+ "forceproto" "tctime" "tccount" "tchange" "desroot" "rootcost" "rootport"
+ "maxage" "hellotime" "fwddelay" "holdtime" )
+ bridge_stats_properties=( "bridge" "drops" "forwards" "mbcast" "recv" "sent" "unknown" )
+ bridge_link_properties=( "link" "index" "state" "uptime" "opercost" "operp2p" "operedge"
+ "desroot" "descost" "desbridge" "desport" "tcack" )
+ bridge_link_stats_properties=( "link" "cfgbpdu" "tcnbpdu" "rstpbpdu" "txbpdu" "drops" "recv" "xmit" )
+ bridge_fwd_properties=( "dest" "age" "flags" "output" )
+ bridge_trill_properties=( "nick" "flags" "link" "nexthop" )
+
+ iptun_properties=( "link" "type" "flags" "local" "remote" )
+ tunnel_values=( "local:address/host: " "remote:address/host: " )
+
+ part_properties=( "link" "pkey" "over" "state" "flags" )
+
+ ib_properties=( "link" "hcaguid" "portguid" "port" "state" "pkeys" )
+
+ linkprops_general=(
+ "autopush:streams modules:"
+ "cos:value:(0 1 2 3 4 5 6 7)"
+ "cpus:processors:"
+ "cpus-effective"
+ "etsbw-lcl:percentage:"
+ "etsbw-lcl-advice"
+ "etsbw-lcl-effective"
+ "etsbw-rmt-effective"
+ "lro:value:(off on auto)"
+ "lro-effective"
+ "mac-address:MAC address:"
+ "maxbw:bandwith:"
+ "pool:pools:"
+ "pool-effective"
+ "priority:priority:(high medium low)"
+ "rxringsavail"
+ "rxrings:value:"
+ "rxhwclntavail"
+ "txringsavail"
+ "txrings:value:"
+ "txhwclntavail"
+ "forward:value:(0 1)"
+ "stp_priority:value:"
+ "stp_cost:value:"
+ "stp_edge:value:(0 1)"
+ "stp_p2p:value:(true false auto)"
+ "stp_mcheck:value:(0 1)"
+ "protection:value:(mac-nospoof ip-nospoof dhcp-nospoof restricted)"
+ "vsi-mgrid:IPv6 address:"
+ "vsi-mgrid-effective"
+ "vsi-mgrid-enc:encoding:(oracle_v1 none)"
+ "vsi-mgrid-enc-effective"
+ "vsi-typeid:value:"
+ "vsi-typeid-effective"
+ "vsi-vers:value:"
+ "vsi-vers-effective"
+ "zone:value:_zones"
+ )
+ linkprops_nonvlanvnic=(
+ "default_tag:value:"
+ "learn_decay:value:"
+ "learn_limit:value:"
+ "rxfanout:value:"
+ "rxfanout-effective:value:"
+ "stp:value:(0 1)"
+ )
+ linkprops_wifi=(
+ "channel:value:"
+ "powermode:value:(off max fast)"
+ "radio:value:(on off)"
+ "speed:value:"
+ )
+ linkprops_ether=(
+ "duplex"
+ "state"
+ "adv_autoneg_cap"
+ "adv_10gfdx_cap"
+ "adv_1000fdx_cap"
+ "adv_1000hdx_cap"
+ "adv_100fdx_cap"
+ "adv_100hdx_cap"
+ "adv_10fdx_cap"
+ "adv_10hdx_cap"
+ "en_10gfdx_cap:value:(0 1)"
+ "en_1000fdx_cap:value:(0 1)"
+ "en_1000hdx_cap:value:(0 1)"
+ "en_100fdx_cap:value:(0 1)"
+ "en_100hdx_cap:value:(0 1)"
+ "en_10fdx_cap:value:(0 1)"
+ "en_10hdx_cap:value:(0 1)"
+ "flowctrl:value:(auto no rx tx pfc bi)"
+ "flowctrl-effective"
+ "gvrp-timeout:value:"
+ "mtu:value:"
+ "ntcs"
+ "pfcmap:value:"
+ "pfcmap-lcl-effective"
+ "pfcmap-rmt-effective"
+ "speed"
+ "tagmode:value:(normal vlanonly)"
+ "vlan-announce:value:(off gvrp)"
+ )
+ linkprops_ib=(
+ "linkmode:value:(cm ud)"
+ )
+ linkprops_iptun=(
+ "hoplimit:value:"
+ "encaplimit:value:"
+ )
+ linkprops=(
+ $linkprops_general $linkprops_wifi $linkprops_ether
+ $linkprops_ib $linkprops_iptun
+ )
+
case $service in
+ ("help")
+ _arguments ':subcommand:($subcmds)'
+ ;;
+
("show-link")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent link configuration]' \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent link configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
- set1 \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $link_properties' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $link_properties' \
- set2 \
- '(-s --statistics)'{-s,--statistics}'[display link statistics]' \
- '(-i --interval)'{-i,--interval}'[specify an interval]:interval:' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $link_stats_properties' \
- ':link name:_dladm_links' \
+ '(-s --statistics)'{-s,--statistics}'[Display link statistics]' \
+ '(-i --interval)'{-i,--interval}'[Specify an interval]:interval:' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $link_stats_properties' \
+ ':link name:_dladm_links'
;;
("rename-link")
_arguments -A "-*" \
- '-R[root directory]:directory:_path_files -/' \
+ '-R[Root directory]:directory:_path_files -/' \
':old link name:_dladm_links' \
- ':new link name:' \
+ ':new link name:'
;;
("show-phys")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent link configuration]' \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-s --statistics)'{-s,--statistics}'[display link statistics]' \
- '(-i --interval)'{-i,--interval}'[specify an interval]:interval:' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" link media state speed duplex device' \
+ '-D[Show Data Center Bridging information]:featureset:(ets pfc)' \
+ '-H[Show hardware resource usage]' \
+ '-L[Display location information]' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent link configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '-m[Display MAC address information]' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
+ '(-s --statistics)'{-s,--statistics}'[Display link statistics]' \
+ '(-i --interval)'{-i,--interval}'[Specify an interval]:interval:' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" link media state speed duplex device' \
':physical link name:_dladm_devs'
;;
@@ -146,97 +291,116 @@ _dladm() {
("create-aggr")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[aggregation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
- '(-P --policy)'{-P,--policy}'[port selection policy]:policy:_values -s , "policy" L2 L3 L4' \
+ '(-t --temporary)'{-t,--temporary}'[Aggregation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
+ '(-m --mode)'{-m,--mode}'[Aggregation mode]:mode:(dlmp trunk)' \
+ '(-P --policy)'{-P,--policy}'[Port selection policy]:policy:_values -s , "policy" L2 L3 L4' \
'(-L --lacp-mode)'{-L,--lacp-mode}'[LACP mode]:lacp mode:(off active passive)' \
'(-T --lacp-timer)'{-T,--lacp-timer}'[LACP timer]:lacp timer:(short long)' \
- '(-u --unicast)'{-u,--unicast}'[unicast address]:unicast address:' \
+ '(-u --unicast)'{-u,--unicast}'[Unicast address]:unicast address:' \
':aggregate link name:'
;;
("modify-aggr")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[aggregation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
- '(-P --policy)'{-P,--policy}'[port selection policy]:policy:_values -s , "policy" L2 L3 L4' \
+ '(-t --temporary)'{-t,--temporary}'[Aggregation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
+ '(-m --mode)'{-m,--mode}'[Aggregation mode]:mode:(dlmp trunk)' \
+ '(-P --policy)'{-P,--policy}'[Port selection policy]:policy:_values -s , "policy" L2 L3 L4' \
'(-L --lacp-mode)'{-L,--lacp-mode}'[LACP mode]:lacp mode:(off active passive)' \
'(-T --lacp-timer)'{-T,--lacp-timer}'[LACP timer]:lacp timer:(short long)' \
- '(-u --unicast)'{-u,--unicast}'[unicast address]:unicast address:' \
+ '(-u --unicast)'{-u,--unicast}'[Unicast address]:unicast address:' \
':aggregate link name:_dladm_aggrs'
;;
("delete-aggr")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
+ '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
':aggregate link name:_dladm_aggrs'
;;
("add-aggr")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[aggregation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
+ '(-t --temporary)'{-t,--temporary}'[Aggregation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
':aggregate link name:_dladm_aggrs'
;;
("remove-aggr")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[aggregation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-l --link)'{-l,--link}'[component link]:link:_dladm_aggr_ports' \
+ '(-t --temporary)'{-t,--temporary}'[Aggregation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_aggr_ports' \
':aggregate link name:_dladm_aggrs'
;;
("show-aggr")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent link configuration]' \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-s --statistics)'{-s,--statistics}'[display link statistics]' \
- '(-i --interval)'{-i,--interval}'[specify an interval]:interval:' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent link configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-s --statistics)'{-s,--statistics}'[Display link statistics]' \
+ '(-i --interval)'{-i,--interval}'[Specify an interval]:interval:' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':aggregate link name:_dladm_links' \
- set1 \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $aggr_properties' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $aggr_properties' \
- lacp \
'(-L --lacp)'{-L,--lacp}'[LACP information]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $aggr_lacp_properties' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $aggr_lacp_properties' \
- extended \
- '(-x --extended)'{-x,--extended}'[extended information]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $aggr_ext_properties' \
+ '(-x --extended)'{-x,--extended}'[Extended information]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $aggr_ext_properties'
;;
("create-vlan")
_arguments -A "-*" \
'(-t --temporary)'{-t,--temporary}'[VLAN should be temporary]' \
- '(-f --force)'{-f,--force}'[force VLAN creation]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
+ '(-f --force)'{-f,--force}'[Force VLAN creation]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
'-v[VLAN ID]:id:' \
':VLAN link name:'
;;
("delete-vlan")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
+ '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
':VLAN link name:_dladm_vlans'
;;
+ ("modify-vlan")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[VLAN should be temporary]' \
+ '(-f --force)'{-f,--force}'[Force VLAN creation]' \
+ '(-R --root-dir)'{-R,--root-dir}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
+ '-v[VLAN ID]:id:' \
+ - set1 \
+ '-L[Source link]:link:_dladm_links' \
+ - set2 \
+ ':VLAN link name:'
+ ;;
+
("show-vlan")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent link configuration]' \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $vlan_properties' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent link configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $vlan_properties' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':VLAN link name:_dladm_vlans'
;;
("scan-wifi")
_arguments -A "-*" \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $wifi_connect_properties' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $wifi_connect_properties' \
':wireless link name:_dladm_wifi_links'
;;
@@ -244,146 +408,312 @@ _dladm() {
_arguments -A "-*" \
'(-e --essid)'{-e,--essid}'[ESSID name]:network:_dladm_wifi_nets' \
'(-b --bsstype)'{-b,--bsstype}'[BSS type]:' \
- '(-m --mode)'{-m,--mode}'[802.11 mode]:mode:(a b g)' \
- '(-k --key)'{-k,--key}'[key name]:key:_dladm_secobjs' \
- '(-s --sec)'{-s,--sec}'[security mode]:(none wep wpa)' \
- '(-a --auth)'{-a,--auth}'[authentication mode]:mode:(open shared)' \
- '(-c --create-ibss)'{-c,--create-ibss}'[create an ad-hoc network]' \
- '(-T --timeout)'{-T,--timeout}'[association timeout]:(forever)' \
+ '(-m --mode)'{-m,--mode}'[802.11 mode]:802.11 mode:(a b g n)' \
+ '(-k --key)'{-k,--key}'[Key name]:key:_dladm_secobjs' \
+ '(-s --sec)'{-s,--sec}'[Security mode]:security mode:(none wep wpa)' \
+ '(-a --auth)'{-a,--auth}'[Authentication mode]:authentication mode:(open shared)' \
+ '(-c --create-ibss)'{-c,--create-ibss}'[Create an ad-hoc network]' \
+ '(-T --timeout)'{-T,--timeout}'[Association timeout]:association timeout:(forever)' \
':wireless link name:_dladm_wifi_links'
;;
("disconnect-wifi")
_arguments -A "-*" \
- set1 \
- '(-a --all-links)'{-a,--all-links}'[all links]' \
+ '(-a --all-links)'{-a,--all-links}'[All links]' \
- set2 \
':wireless link name:_dladm_wifi_links'
;;
("show-wifi")
_arguments -A "-*" \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $wifi_properties' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $wifi_properties' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':wireless link name:_dladm_wifi_links'
;;
("show-ether")
_arguments -A "-*" \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-x --extended)'{-x,--extended}'[extended output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $ether_properties' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-x --extended)'{-x,--extended}'[Extended output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $ether_properties' \
+ '-P[protocol]:protocol:(ecp vdp)' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':ethernet link name:_dladm_ethers'
;;
("set-linkprop")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[change should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-p --prop)'{-p,--prop}'[properties]:property:_dladm_linkprops' \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-p --prop)'{-p,--prop}'[Properties]:property:_values -s , "property" ${(M)linkprops\:#*\:*}' \
':link name:_dladm_links'
;;
("reset-linkprop")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[change should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-p --prop)'{-p,--prop}'[properties]:property:_dladm_linkprops' \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-p --prop)'{-p,--prop}'[Properties]:property:_values -s , "property" ${${(M)linkprops\:#*\:*}%%\:*}' \
':link name:_dladm_links'
;;
("show-linkprop")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent link properties]' \
- '(-c --parseable)'{-c,--parseable}'[parseable output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $linkprop_properties' \
- '(-p --prop)'{-p,--prop}'[properties]:property:_dladm_linkprops' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent link properties]' \
+ '(-c --parseable)'{-c,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $linkprop_properties' \
+ '(-p --prop)'{-p,--prop}'[Properties]:property:_values -s , "property" ${linkprops%%\:*}' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':link name:_dladm_links'
;;
("create-secobj")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[creation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-c --class)'{-c,--class}'[class]:class:(wep wpa)' \
- '(-f --file)'{-f,--file}'[file containing object value]:file:_path_files' \
+ '(-t --temporary)'{-t,--temporary}'[Creation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-c --class)'{-c,--class}'[Class]:class:(wep wpa)' \
+ '(-f --file)'{-f,--file}'[File containing object value]:file:_path_files' \
':object name:'
;;
("delete-secobj")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
+ '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
':object name:_dladm_secobjs'
;;
("show-secobj")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent object information]' \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $secobj_properties' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent object information]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $secobj_properties' \
':object name:_dladm_secobjs'
;;
("create-vnic")
# TODO: MAC address completion could be richer
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[creation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
- '(-l --link)'{-l,--link}'[component link]:link:_dladm_links' \
- '(-m --mac-address)'{-m,--mac-address}'[MAC address]:address:(factory random auto)' \
+ '(-t --temporary)'{-t,--temporary}'[Creation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
+ '(-m --mac-address)'{-m,--mac-address}'[MAC address]:address:(factory random auto vrrp)' \
'-v[VLAN ID]:id:' \
- '(-p --prop)'{-p,--prop}'[property values]:value:' \
+ '(-p --prop)'{-p,--prop}'[Property values]:value:_values -s , "property" ${(M)linkprops_general\:#*\:*}' \
':VNIC name:'
;;
("delete-vnic")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
+ '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
':VNIC name:_dladm_vnics'
;;
+ ("modify-vnic")
+ # TODO: MAC address completion could be richer
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Creation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
+ '(-m --mac-address)'{-m,--mac-address}'[MAC address]:address:(factory random auto vrrp)' \
+ '-v[VLAN ID]:id:' \
+ '(-p --prop)'{-p,--prop}'[Property values]:value:_values -s , "property" ${(M)linkprops_general\:#*\:*}' \
+ - set1 \
+ '-L[Source link]:link:_dladm_links' \
+ - set2 \
+ ':VNIC name:'
+ ;;
+
("show-vnic")
_arguments -A "-*" \
- '(-P --persistent)'{-P,--persistent}'[display persistent object information]' \
- '(-p --parseable)'{-p,--parseable}'[parseable output]' \
- '(-o --output)'{-o,--output}'[properties to display]:property:_values -s , "property" $vnic_properties' \
- '(-l --link)'{-l,--link}'[limit to VNICs on link]:link:_dladm_links' \
- '(-s --statistics)'{-s,--statistics}'[display VNIC statistics]' \
- '(-i --interval)'{-i,--interval}'[specify an interval]:interval:' \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent object information]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $vnic_properties' \
+ '(-l --link)'{-l,--link}'[Limit to VNICs on link]:link:_dladm_links' \
+ '(-s --statistics)'{-s,--statistics}'[Display VNIC statistics]' \
+ '(-i --interval)'{-i,--interval}'[Specify an interval]:interval:' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':VNIC name:_dladm_vnics'
;;
("create-etherstub")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[creation should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
+ '(-t --temporary)'{-t,--temporary}'[Creation should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
':etherstub name:'
;;
("delete-etherstub")
_arguments -A "-*" \
- '(-t --temporary)'{-t,--temporary}'[deletion should be temporary]' \
- '(-R --root)'{-R,--root}'[root directory]:directory:_path_files -/' \
+ '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
':etherstub name:_dladm_etherstubs'
;;
("show-etherstub")
_arguments -A "-*" \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
':etherstub name:_dladm_etherstubs'
;;
("show-usage")
_arguments -A "-*" \
- '(-f --file)'{-f,--file}'[read records from file]:_path_files' \
- '(-F --format)'{-f,--format}'[plotfile format]:(gnuplot)' \
- '(-p --plot)'{-p,--plot}'[write plot to file]:' \
- '(-e --start)'{-e,--start}'[start time]:date/time (MM/DD/YYYY,hh\:mm\:ss)' \
- '(-s --stop)'{-s,--stop}'[stop time]:date/time (MM/DD/YYYY,hh\:mm\:ss)' \
+ '(-f --file)'{-f,--file}'[Read records from file]:file:_path_files' \
+ '(-F --format)'{-F,--format}'[Plotfile format]:plotfile format:(gnuplot)' \
+ '(-p --plot)'{-p,--plot}'[Write plot to file]:' \
+ '(-e --start)'{-e,--start}'[Start time]:date/time (MM/DD/YYYY,hh\:mm\:ss)' \
+ '(-s --stop)'{-s,--stop}'[Stop time]:date/time (MM/DD/YYYY,hh\:mm\:ss)' \
':link name:_dladm_links'
;;
+ ("create-bridge")
+ _arguments -A "-*" \
+ '(-P --protect)'{-P,--protect}'[Specify a protection method]:protection method:(stp trill)' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-p --priority)'{-p,--priority}'[Specify the bridge priority]:value' \
+ '(-m --max-age)'{-m,--max-age}'[Specify the max age for config info]:value' \
+ '(-h --hello-time)'{-h,--hello-time}'[Specify the hello time]:value' \
+ '(-d --forward-delay)'{-d,--forward-delay}'[Specify the forward delay]:value' \
+ '(-f --force-protocol)'{-f,--force-protocol}'[Specify forced maximum supported protocol]:value' \
+ '*'{-l,--link}'[Specify link to add]:link:_dladm_links' \
+ ':bridge name:'
+ ;;
+
+
+ ("modify-bridge")
+ _arguments -A "-*" \
+ '(-P --protect)'{-P,--protect}'[Specify a protection method]:protection method:(stp trill)' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-p --priority)'{-p,--priority}'[Specify the bridge priority]:value' \
+ '(-m --max-age)'{-m,--max-age}'[Specify the max age for config info]:value' \
+ '(-h --hello-time)'{-h,--hello-time}'[Specify the hello time]:value' \
+ '(-d --forward-delay)'{-d,--forward-delay}'[Specify the forward delay]:value' \
+ '(-f --force-protocol)'{-f,--force-protocol}'[Specify forced maximum supported protocol]:value' \
+ ':bridge name:_dladm_bridges'
+ ;;
+
+
+ ("delete-bridge")
+ _arguments -A "-*" \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ ':bridge name:_dladm_bridges'
+ ;;
+
+
+ ("add-bridge"|"remove-bridge")
+ _arguments -A "-*" \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '*'{-l,--link}'[Specify link to add]:link:_dladm_links' \
+ ':bridge name:_dladm_bridges'
+ ;;
+
+
+ ("show-bridge")
+ # XXX $bridge_stats_properties get added into -o completions for set1
+ # XXX $bridge_link_stats_properties get added into -o completions for set3
+ _arguments -A "-*" \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ - set1 \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $bridge_properties' \
+ - set2 \
+ '(-s --statistics)'{-s,--statistics}'[Display statistics]' \
+ '(-i --interval)'{-i,--interval}'[Specify an interval]:seconds' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $bridge_stats_properties' \
+ - set3 \
+ '(-l --link)'{-l,--link}'[Display link status or statistics]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $bridge_link_properties' \
+ - set4 \
+ '(-s --statistics)'{-s,--statistics}'[Display statistics]' \
+ '(-l --link)'{-l,--link}'[Display link status or statistics]' \
+ '(-i --interval)'{-i,--interval}'[Specify an interval]:seconds' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $bridge_link_stats_properties' \
+ - set5 \
+ '(-f --forwarding)'{-f,--forwarding}'[Display forwarding entries]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $bridge_fwd_properties' \
+ - set6 \
+ '(-t --trill)'{-t,--trill}'[Display TRILL nickname entries]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $bridge_trill_properties' \
+ ':bridge name:_dladm_bridges'
+ ;;
+
+
+ ("create-iptun")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Temporary tunnel]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-T --type)'{-T,--type}'[Tunnel type]:tunnel type:(ipv4 ipv6 6to4)' \
+ '(-a --address)'{-a,--address}'[Endpoint addresses]:address/host:_values -s , "address/host" $tunnel_values' \
+ ':tunnel name:'
+ ;;
+
+ ("modify-iptun")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Temporary modification]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-a --address)'{-a,--address}'[Endpoint addresses]:address/host:_values -s , "address/host" $tunnel_values' \
+ ':tunnel name:_dladm_iptuns'
+ ;;
+
+ ("delete-iptun")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Temporary deletion]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ ':tunnel name:_dladm_iptuns'
+ ;;
+
+ ("show-iptun")
+ _arguments -A "-*" \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent tunnel configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $iptun_properties' \
+ '-Z[Display ZONE column in output]' \
+ '-z[zone]:zonename:_values -s , "zone" $(zoneadm list)' \
+ ':tunnel name:_dladm_iptuns'
+ ;;
+
+ ("create-part")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Temporary partition]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ '(-f --force)'{-f,--force}'[Force partition creation]' \
+ '(-l --link)'{-l,--link}'[IP-over-IB physical link name]:IB link:_dladm_iblinks' \
+ '(-p --prop)'{-p,--prop}'[Set link properties]:link property:_values -s , "property" ${(M)linkprops_nonvlanvnic\:#*\:*} ${(M)linkprops_general\:#*\:*}' \
+ '(-P --pkey)'{-P,--pkey}'[Set parition key]:hex number:' \
+ ':partition link name:'
+ ;;
+
+ ("delete-part")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Temporary deletion]' \
+ '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
+ ':link name:_dladm_parts'
+ ;;
+
+ ("show-part")
+ _arguments -A "-*" \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent partition configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-l --link)'{-l,--link}'[Information for this link]:link name:_dladm_iblinks' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $part_properties' \
+ ':partition link name:_dladm_parts'
+ ;;
+
+ ("show-ib")
+ _arguments -A "-*" \
+ '(-P --persistent)'{-P,--persistent}'[Display persistent partition configuration]' \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $ib_properties' \
+ ':IB link name:_dladm_iblinks'
+ ;;
+
(*)
_message "unknown dladm subcommand: $service"
;;
diff --git a/Completion/Solaris/Command/_dtrace b/Completion/Solaris/Command/_dtrace
new file mode 100644
index 000000000..a095589eb
--- /dev/null
+++ b/Completion/Solaris/Command/_dtrace
@@ -0,0 +1,41 @@
+#compdef dtrace
+# Synced with Nevada build 160 man pages
+
+_dtrace() {
+ _arguments -s \
+ '-32[generate 32-bit D programs and ELF files]' \
+ '-64[generate 64-bit D programs and ELF files]' \
+ '-a[claim anonymous tracing state]' \
+ '-A[generate driver.conf(4) directives for anonymous tracing]' \
+ '-b[set trace buffer size]' \
+ '-c[run specified command and exit upon its completion]' \
+ '-C[run cpp(1) preprocessor on script files]' \
+ '-D[define symbol when invoking preprocessor]' \
+ '-e[exit after compiling request but prior to enabling probes]' \
+ '-f[enable or list probes matching the specified function name]:function: ' \
+ '-F[coalesce trace output by function]' \
+ '-G[generate an ELF file containing embedded dtrace program]' \
+ '-H[print included files when invoking preprocessor]' \
+ '-h[Generate a header file]' \
+ '-i[enable or list probes matching the specified probe id]' \
+ '-I[add include directory to preprocessor search path]:include dir:_files -/' \
+ '-L[Add directory to search path for DTrace libraries]:lib dir:_files -/' \
+ '-l[list probes matching specified criteria]' \
+ '-m[enable or list probes matching the specified module name]:module: ' \
+ '-n[enable or list probes matching the specified probe name]:name: ' \
+ '-o[set output file]:output file:_files' \
+ '-p[grab specified process-ID and cache its symbol tables]:pid:_pids' \
+ '-P[enable or list probes matching the specified provider name]:provider: ' \
+ '-q[set quiet mode (only output explicitly traced data)]' \
+ '-s[enable or list probes according to the specified D script]' \
+ '-S[print D compiler intermediate code]' \
+ '-U[undefine symbol when invoking preprocessor]' \
+ '-v[set verbose mode (report program stability attributes)]' \
+ '-V[report DTrace API version]' \
+ '-w[permit destructive actions]' \
+ '-x[enable or modify compiler and tracing options]' \
+ '-X[specify ISO C conformance settings for preprocessor]:ISO C conformance:((a\:"ISO plus K&R extensions (default)" c\:"Strictly conformant ISO C" s\:"K&R C only" t\:"ISO plus K&R extensions"))' \
+ '-Z[permit probe descriptions that match zero probes]'
+}
+
+_dtrace "$@"
diff --git a/Completion/Solaris/Command/_flowadm b/Completion/Solaris/Command/_flowadm
new file mode 100644
index 000000000..53a9f2210
--- /dev/null
+++ b/Completion/Solaris/Command/_flowadm
@@ -0,0 +1,115 @@
+#compdef flowadm
+# Synced with the S11U1 build 19 man page
+
+_flowadm() {
+
+local -a subcmds tr props
+local expl
+
+_flowadm_flow(){
+ compadd "$@" - $(flowadm show-flow -p -o flow)
+}
+
+_flowadm_flow_int(){
+ compadd "$@" - $(flowadm show-flow -p -o flow)
+ compadd "$@" - $(dladm show-phys -p -o device)
+}
+
+subcmds=(
+ "help"
+ "show-flow"
+ "add-flow"
+ "remove-flow"
+ "set-flowprop"
+ "reset-flowprop"
+ "show-flowprop"
+)
+
+tr=(
+ "tcp"
+ "udp"
+ "sctp"
+ "icmp"
+ "icmpv6"
+)
+
+props=(
+ "maxbw"
+)
+
+if [[ $service == "flowadm" ]]; then
+ _arguments -C -A "-*" \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl "flowadm subcommand" compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+fi
+case $service in
+
+ ("help")
+ _arguments ':subcommand:($subcmds)'
+ ;;
+
+ ("show-flow")
+ _arguments -A "-*" \
+ '-o[specify field to display]:field:(flow link ipaddr proto port dsfield)' \
+ '-p[parsable output]' \
+ '-P[persistent flow property information]' \
+ - set1 \
+ '-l[display information for link]:link or flow:_net_interfaces' \
+ - set2 \
+ ':flow:_flowadm_flow' \
+ ;;
+
+ ("add-flow")
+ _arguments -A "-*" \
+ '-t[temporary changes - do not persist across reboots]' \
+ '-R[alternate root dir]:alternate root:_files' \
+ '-l[specify link to which flow will be added]:link:_net_interfaces' \
+ '-a[specify attribute]:attribute:(local_ip= remote_ip= transport=$tr local_port= dsfield=)' \
+ '-p[set property value]:property:(maxbw=)' \
+ ;;
+
+ ("remove-flow")
+ _arguments -A "-*" \
+ '-t[temporary changes - do not persist across reboots]' \
+ '-R[alternate root dir]:alternate root:_files' \
+ - set1 \
+ '-l[specify link from which flow will be deleted]:link:_net_interfaces' \
+ - set2 \
+ ':flow:_flowadm_flow' \
+ ;;
+
+ ("set-flowprop")
+ _arguments -A "-*" \
+ '-t[temporary changes - do not persist across reboots]' \
+ '-R[alternate root dir]:alternate root:_files' \
+ '-p[set property value]:property:(maxbw=)' \
+ ':flow:_flowadm_flow' \
+ ;;
+
+ ("reset-flowprop")
+ _arguments -A "-*" \
+ '-t[temporary changes - do not persist across reboots]' \
+ '-R[alternate root dir]:alternate root:_files' \
+ '-p[set property value]:property:(maxbw=)' \
+ ':flow:_flowadm_flow' \
+ ;;
+
+ ("show-flowprop")
+ _arguments -A "-*" \
+ '-c[parsable output (requires -o)]' \
+ '-l[specify link whose properties will be shown]:link:_net_interfaces' \
+ '-P[persistent flow property information]' \
+ '-p[property to show]:property:_values -s , "property" $props' \
+ ':flow:_flowadm_flow' \
+ ;;
+
+esac
+}
+
+_flowadm "$@"
diff --git a/Completion/Solaris/Command/_fmadm b/Completion/Solaris/Command/_fmadm
new file mode 100644
index 000000000..56dac4f96
--- /dev/null
+++ b/Completion/Solaris/Command/_fmadm
@@ -0,0 +1,111 @@
+#compdef fmadm
+# Synced with the Nevada build 168 man page
+
+_fm_modules() {
+ compadd "$@" - $(fmadm config 2> /dev/null | awk 'NR == 1 {continue} {print $1}')
+}
+
+_fm_faulted_fmris() {
+ compadd "$@" - $(fmadm faulty -r 2> /dev/null | awk '{print $1}')
+}
+
+_fm_faulted_uuids() {
+ compadd "$@" - $(fmadm faulty -s 2> /dev/null | tail +4 | awk '{print $4}')
+}
+
+_fm_faulted_labels() {
+ local q='"'
+ compadd "$@" - $(fmadm faulty -f 2> /dev/null | while read line; do
+ if [[ $line == "----"* ]]; then
+ read line
+ if [[ $line == '"'* ]]; then
+ print ${${line[(r)$q,(rn:2:)$q]}[2,-2]}
+ fi
+ fi
+ done)
+}
+
+_fmadm() {
+ local context state line expl
+ local -A opt_args
+ local -a subcmds
+
+ # TODO: lookup-alias and remove-alias need completion based on the
+ # output of list-alias, but I have no examples of that output.
+
+ subcmds=(
+ "acquit" "config" "faulty" "flush" "load" "unload"
+ "repaired" "replaced" "reset" "rotate"
+ "add-alias" "remove-alias" "lookup-alias" "list-alias" "sync-alias"
+ )
+
+ if [[ $service == "fmadm" ]]; then
+ _arguments -C -A "-*" \
+ '-q[Quite mode]' \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl "fmadm subcommand" compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+ fi
+
+ case $service in
+ ("acquit")
+ _alternative \
+ "fmadm-acquit-label:label:_fm_faulted_labels" \
+ "fmadm-acquit-uuid:uuid:_fm_faulted_uuids" \
+ "fmadm-acquit-fmri:fmri:_fm_faulted_fmris"
+ ;;
+
+ ("config")
+ ;;
+
+ ("faulty")
+ _arguments -A "-*" \
+ '-a[Display all faults]' \
+ '-f[Display faulty FRUs]' \
+ '-g[Group faults]' \
+ '-i[Display persistent cache IDs]' \
+ '-n[Limit output to n entries]:number:' \
+ '-p[Page output]' \
+ '-r[Display resources]' \
+ '-s[Display one-line summaries]' \
+ '-u[Only display fault with given uuid]:uuid:_fm_faulted_uuids' \
+ '-v[Display full output]'
+ ;;
+
+ ("flush")
+ _fm_faulted_fmris
+ ;;
+
+ ("load")
+ _path_files -g "/*"
+ ;;
+
+ ("unload")
+ _fm_modules
+ ;;
+
+ ("repaired"|"replaced")
+ _alternative \
+ "fmadm-acquit-label:label:_fm_faulted_labels" \
+ "fmadm-acquit-fmri:fmri:_fm_faulted_fmris"
+ ;;
+
+ ("reset")
+ _arguments -A "-*" \
+ '-s[Reset named SERD]:serd:' \
+ ':module:_fm_modules'
+ ;;
+
+ ("rotate")
+ _values "logfile" "errlog" "fltlog" "infolog" "infolog_hival"
+ ;;
+
+ esac
+}
+
+_fmadm "$@"
diff --git a/Completion/Solaris/Command/_ipadm b/Completion/Solaris/Command/_ipadm
new file mode 100644
index 000000000..34d1eacba
--- /dev/null
+++ b/Completion/Solaris/Command/_ipadm
@@ -0,0 +1,375 @@
+#compdef ipadm
+# Synced with the S11U1 build 19 man page
+
+_ipadm_ifs() {
+ local -a extra
+
+ zparseopts -D -E -a extra /+:
+
+ compadd "$@" - $(ipadm show-if -p -o ifname) $extra[2,-1]
+}
+
+_ipadm_enabled_ifs() {
+ # Interfaces not marked "disabled"
+ compadd "$@" - "${(@)${(@)${(f)$(ipadm show-if -p -o state,ifname)}:#disabled:*}#*:}"
+}
+
+_ipadm_disabled_ifs() {
+ compadd "$@" - "${(@)${(@)${(f)$(ipadm show-if -p -o state,ifname)}#disabled:*}:#*:*}"
+}
+
+_ipadm_vnis() {
+ compadd "$@" - "${(@)${(@)${(f)$(ipadm show-if -p -o class,ifname)}#vni:*}:#*:*}"
+}
+
+_ipadm_ipmps() {
+ compadd "$@" - "${(@)${(@)${(f)$(ipadm show-if -p -o class,ifname)}#ipmp:*}:#*:*}"
+}
+
+_ipadm_get_possible_values() {
+ local -a proto poss
+ local cmd
+
+ cmd=${${(M)words:#set-*}/set/show}
+ if [[ $cmd == "show-prop" ]]; then
+ # You have to specify a protocol for show-prop if you specify a
+ # property, so we loop through them all.
+ poss=()
+ for proto in ipv4 ipv6 icmp tcp udp sctp; do
+ poss=( $poss ${(u)=$(ipadm $cmd -c -p ${IPREFIX%=} -o possible $proto 2> /dev/null)//,/ } )
+ done
+ poss=( ${(u)poss:#\?} )
+ else
+ proto=${=opt_args[-m]:+-m $opt_args[-m]}
+ poss=( ${(u)=$(ipadm $cmd -c -p ${IPREFIX%=} $proto -o possible)//,/ } )
+ fi
+ if [[ $poss[1] == [0-9]##-[0-9]## ]]; then
+ if (( $#poss > 1 )); then
+ _message -e "number in ranges ${(j:, :)poss}"
+ else
+ _message -e "number in range $poss"
+ fi
+ elif [[ -z $poss[1] ]]; then
+ _message -e "value"
+ else
+ compadd "$@" - $poss
+ fi
+}
+
+_ipadm_addrobjs() {
+ compadd "$@" - $(ipadm show-addr -p -o addrobj)
+}
+
+_ipadm_addrobjs_or_ifs() {
+ compadd "$@" - $(ipadm show-addr -p -o addrobj) \
+ $(ipadm show-if -p -o ifname)
+}
+
+_ipadm_protos() {
+ compadd "$@" - $(ipadm show-prop -c -o proto)
+}
+
+_ipadm() {
+ local context state line expl
+ local -A opt_args
+ local -a subcmds
+ local -a if_properties if_propproperties if_properties2
+ local -a addr_properties addr_propproperties
+ local -a addrobj_properties
+ local -a proto_ipv4_properties proto_ipv6_properties proto_tcp_properties
+ local -a proto_udp_properties proto_sctp_properties proto_icmp_properties
+ local -a proto_all_properties proto_propproperties
+
+ subcmds=(
+ "help"
+ {"show","disable","enable"}"-if"
+ {"create","delete"}"-ip"
+ {"create","delete"}"-vni"
+ {"create","delete","add","remove"}"-ipmp"
+ {"set","reset","show"}"-ifprop"
+ {"create","delete","show","up","down","refresh","disable","enable"}"-addr"
+ {"set","reset","show"}"-addrprop"
+ {"set","reset","show"}"-prop"
+ )
+
+ if_properties=( "ifname" "class" "state" "active" "current" "persistent" "over" )
+
+ if_propproperties=( "ifname" "property" "proto" "perm" "current" "persistent" "default" "possible" )
+
+ if_properties2=(
+ "arp:value:_ipadm_get_possible_values"
+ "forwarding:value:_ipadm_get_possible_values"
+ "metric:value:_ipadm_get_possible_values"
+ "mtu:value:_ipadm_get_possible_values"
+ "nud:value:_ipadm_get_possible_values"
+ "usesrc:value:_ipadm_ifs -/ none"
+ "exchange_routes:value:_ipadm_get_possible_values"
+ "group:value:_ipadm_get_possible_values"
+ "standby:value:_ipadm_get_possible_values"
+ )
+
+ addr_properties=(
+ "broadcast:value:_ipadm_get_possible_values"
+ "deprecated:value:_ipadm_get_possible_values"
+ "prefixlen:value:_ipadm_get_possible_values"
+ "private:value:_ipadm_get_possible_values"
+ "reqhost:value:_ipadm_get_possible_values"
+ "transmit:value:_ipadm_get_possible_values"
+ "zone:value:_zones -t c"
+ )
+
+ addr_propproperties=( "addrobj" "property" "perm" "current" "persistent" "default" "possible" )
+
+ addrobj_properties=(
+ "addrobj" "type" "state" "current" "persistent" "addr"
+ "cid-type" "cid-value" "begin" "expire" "renew"
+ )
+
+ proto_ipv4_properties=( "hostmodel" "ttl" "forwarding" )
+ proto_ipv6_properties=( "hostmodel" "hoplimit" "forwarding" )
+ proto_tcp_properties=( "cong_default" "cong_enabled" "ecn" "extra_priv_ports" "max_buf" "recv_buf"
+ "send_buf" "sack" "smallest_anon_port" "largest_anon_port" "smallest_nonpriv_port" )
+ proto_udp_properties=( "extra_priv_ports" "max_buf" "recv_buf" "send_buf" "smallest_anon_port"
+ "largest_anon_port" "smallest_nonpriv_port" )
+ proto_sctp_properties=( "cong_default" "cong_enabled" "extra_priv_ports" "max_buf" "recv_buf"
+ "send_buf" "smallest_anon_port" "largest_anon_port" "smallest_nonpriv_port" )
+ proto_icmp_properties=( "max_buf" "recv_buf" "send_buf" )
+ proto_all_properties=( $proto_ipv4_properties $proto_ipv6_properties $proto_tcp_properties
+ $proto_udp_properties $proto_sctp_properties $proto_icmp_properties )
+ proto_all_properties=( $^proto_all_properties:value:_ipadm_get_possible_values )
+
+ proto_propproperties=( "proto" "property" "perm" "current" "persistent" "default" "possible" )
+
+ if [[ $service == "ipadm" ]]; then
+ _arguments -C -A "-*" \
+ '-\?[Help]' \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl "ipadm subcommand" compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+ fi
+
+ case $service in
+ ("help")
+ _arguments ':subcommand:($subcmds)'
+ ;;
+
+ ("create-ip")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Interface should be temporary]' \
+ ':interface name:'
+ ;;
+
+ ("delete-ip")
+ _arguments -A "-*" \
+ ':interface name:_ipadm_ifs'
+ ;;
+
+ ("create-vni")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Interface should be temporary]' \
+ ':VNI name:'
+ ;;
+
+ ("delete-vni")
+ _arguments -A "-*" \
+ ':VNI name:_ipadm_vnis'
+ ;;
+
+ ("create-ipmp")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Interface should be temporary]' \
+ '(-i --interface)'{-i,--interface}'[List of underlying interfaces]:interface name:_values -s , "interface" $(ipadm show-if -p -o ifname)' \
+ ':IPMP interface name:'
+ ;;
+
+ ("delete-ipmp")
+ _arguments -A "-*" \
+ '(-f --force)'{-f,--force}'[First remove all underlying interfaces from group]' \
+ ':IPMP interface name:_ipadm_ipmps'
+ ;;
+
+ ("add-ipmp")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Interface should be temporary]' \
+ '(-i --interface)'{-i,--interface}'[List of underlying interfaces]:interface name:_values -s , "interface" $(ipadm show-if -p -o ifname)' \
+ ':IPMP interface name:_ipadm_ipmps'
+ ;;
+
+ ("remove-ipmp")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Interface should be temporary]' \
+ '(-i --interface)'{-i,--interface}'[List of underlying interfaces]:interface name:_values -s , "interface" $(ipadm show-if -p -o ifname)' \
+ ':IPMP interface name:_ipadm_ipmps'
+ ;;
+
+ ("show-if")
+ _arguments -A "-*" \
+ '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $if_properties' \
+ ':interface name:_ipadm_ifs'
+ ;;
+
+ ("disable-if")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ ':interface name:_ipadm_enabled_ifs'
+ ;;
+
+ ("enable-if")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ ':interface name:_ipadm_disabled_ifs'
+ ;;
+
+ ("set-ifprop")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-m --module)'{-m,--module}'[Protocol]:protocol:(ipv4 ipv6)' \
+ '(-p --prop)'{-p,--prop}'[Property to set]:property:_values -s , "property" $if_properties2' \
+ ':interface name:_ipadm_ifs'
+ ;;
+
+ ("reset-ifprop")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-m --module)'{-m,--module}'[Protocol]:protocol:(ipv4 ipv6)' \
+ '(-p --prop)'{-p,--prop}'[Property to reset]:property:($if_properties2)' \
+ ':interface name:_ipadm_ifs'
+ ;;
+
+ ("show-ifprop")
+ _arguments -A "-*" \
+ '(-c --parseable)'{-c,--parseable}'[Parseable output]' \
+ '(-m --module)'{-m,--module}'[Protocol]:protocol:(ipv4 ipv6)' \
+ '(-o --output)'{-o,--output}'[Property properties to display]:property:_values -s , "property" $if_propproperties' \
+ '(-p --prop)'{-p,--prop}'[Interface properties to display]:property:_values -s , "property" ${if_properties2%%\:*}' \
+ ':interface name:_ipadm_ifs'
+ ;;
+
+ ("create-addr")
+ # This causes all options and arguments following -T to be
+ # stuck into $opt_args[-T]. It feels hacky, but it seems
+ # to do the trick.
+ # XXX When -T is static, it's not necessary.
+ _arguments -C -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Address should be temporary]' \
+ '-T[Address type]:*::address type:->newaddr'
+
+ if [[ $state == "newaddr" ]]; then
+
+ case ${opt_args[-T]#-T:} in
+ ("static:"*)
+ local -a addrthingsv4
+ addrthingsv4=( "local:address: " "remote:address: ")
+ _arguments -A "-*" \
+ '(-d --down)'{-d,--down}'[Address should be marked down]' \
+ '(-a --address)'{-a,--address}'[Address specification]:address:_values -s , "address" $addrthingsv4' \
+ ':address object name:_ipadm_addrobjs_or_ifs'
+ ;;
+
+ ("dhcp:"*)
+ _arguments -A "-*" \
+ '(-w --wait)'{-w,--wait}'[Seconds to wait for completion]:number or "forever":{if [[ -prefix [0-9]## ]]; then _message -e "number of seconds"; else _wanted forever expl "number or \"forever\"" compadd forever; fi}' \
+ '-h[Request a specific hostname]:hostname:' \
+ ':address object name:_ipadm_addrobjs_or_ifs'
+ ;;
+
+ ("addrconf:"*)
+ local -a addrthingsv6 statefulness
+ addrthingsv6=( "local:interface id: " "remote:interface id: ")
+ statefulness=( "stateful:statefulness:(yes no)" "stateless:statelessness:(yes no)" )
+ _arguments -A "-*" \
+ '(-i --interface-id)'{-i,--interface-id}'[Interface ID]:address:_values -s , "interface id" $addrthingsv6' \
+ '(-p --prop)'{-p,--prop}'[Statefulness configuration]:statefulness configuration:_values -s , "statefulness" $statefulness' \
+ ':address object name:_ipadm_addrobjs_or_ifs'
+ ;;
+ (*)
+ _wanted commands expl "address type" compadd static dhcp addrconf
+ ;;
+ esac
+ fi
+
+ ;;
+
+ ("delete-addr")
+ _arguments -A "-*" \
+ '(-r --release)'{-r,--release}'[Release DHCP-acquired address]' \
+ ':address object name:_ipadm_addrobjs'
+ ;;
+
+ ("show-addr")
+ _arguments -A "-*" \
+ '(-d --dhcp -p --parseable)'{-d,--dhcp}'[Display DHCP status fields]' \
+ '(-p --parseable -d --dhcp)'{-p,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $addrobj_properties' \
+ ':address object name:_ipadm_addrobjs_or_ifs'
+ ;;
+
+ ({"up","down","disable","enable"}"-addr")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ ':address object name:_ipadm_addrobjs'
+ ;;
+
+ ("refresh-addr")
+ _arguments -A "-*" \
+ '(-i --inform)'{-i,--inform}'[Retrieve DHCP parameters]' \
+ ':address object name:_ipadm_addrobjs'
+ ;;
+
+ ("set-addrprop")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-p --prop)'{-p,--prop}'[Property to set]:property:_values -s , "property" $addr_properties' \
+ ':address object name:_ipadm_addrobjs'
+ ;;
+
+ ("reset-addrprop")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-p --prop)'{-p,--prop}'[Property to reset]:property:(${addr_properties%%\:*})' \
+ ':address object name:_ipadm_addrobjs'
+ ;;
+
+ ("show-addrprop")
+ _arguments -A "-*" \
+ '(-c --parseable)'{-c,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Property properties to display]:property:_values -s , "property" $addr_propproperties' \
+ '(-p --prop)'{-p,--prop}'[Address object properties to display]:property:_values -s , "property" ${addr_properties%%\:*}' \
+ ':address object name:_ipadm_addrobjs_or_ifs'
+ ;;
+
+ ("set-prop")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-p --prop)'{-p,--prop}'[Property to set]:property:_values -s , "property" $proto_all_properties' \
+ ':protocol name:_ipadm_protos'
+ ;;
+
+ ("reset-prop")
+ _arguments -A "-*" \
+ '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
+ '(-p --prop)'{-p,--prop}'[Property to reset]:property:(${proto_all_properties%%\:*})' \
+ ':protocol name:_ipadm_protos'
+ ;;
+
+ ("show-prop")
+ _arguments -A "-*" \
+ '(-c --parseable)'{-c,--parseable}'[Parseable output]' \
+ '(-o --output)'{-o,--output}'[Property properties to display]:property:_values -s , "property" $proto_propproperties' \
+ '(-p --prop)'{-p,--prop}'[Protocol properties to display]:property:_values -s , "property" ${proto_all_properties%%\:*}' \
+ ':protocol name:_ipadm_protos'
+ ;;
+
+ (*)
+ _message "unknown ipadm subcommand: $service"
+ ;;
+ esac
+}
+
+_ipadm "$@"
diff --git a/Completion/Solaris/Command/_netstat b/Completion/Solaris/Command/_netstat
new file mode 100644
index 000000000..bf8e5aaa4
--- /dev/null
+++ b/Completion/Solaris/Command/_netstat
@@ -0,0 +1,61 @@
+#compdef netstat
+
+_netstat() {
+ local -a f_rules
+
+ f_rules=(
+ 'af\::specify address family: inet, inet6, unix, number'
+ 'outif\::specify output interface: ifName, ifIndex, any, none'
+ 'dst\::specify destination IP: ip-addr[/mask], any, none'
+ 'flags\::select routes tagged with flags: [+ -]?[ABDGHLMSU]+'
+ )
+
+ _arguments \
+ - set1 \
+ '-a[show state of all sockets, all routing tables or all interfaces]' \
+ '-R[show extended security attributes for sockets and routing tables]' \
+ '-n[do not resolve addresses to names]' \
+ '-v[verbose]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ '-P[specify protocol]:protocol:(ip ipv6 icmp icmpv6 igmp udp tcp rawip)' \
+ - set2 \
+ '-r[show routing table]' \
+ '-f[filter routing table]:rule:(($f_rules))' \
+ '-a[show state of all sockets, all routing tables or all interfaces]' \
+ '-v[verbose]' \
+ '-n[do not resolve addresses to names]' \
+ '-R[show extended security attributes for sockets and routing tables]' \
+ - set3 \
+ '-g[show multicast group memberships]' \
+ '-n[do not resolve addresses to names]' \
+ '-v[verbose]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ - set4 \
+ '-i[show state of interfaces]' \
+ '-a[show state of all sockets, all routing tables or all interfaces]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ '-n[do not resolve addresses to names]' \
+ '-I[select interface]:interface:_net_interfaces' \
+ - set5 \
+ '-m[show STREAMS memory statistics]' \
+ '-v[verbose]' \
+ - set6 \
+ '-p[show net to media tables]' \
+ '-n[do not resolve addresses to names]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ - set7 \
+ '-s[show per protocol statistics]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ '-P[specify protocol]:protocol:(ip ipv6 icmp icmpv6 igmp udp tcp rawip)' \
+ - set8 \
+ '-M[show multicast routing tables]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ '-n[do not resolve addresses to names]' \
+ '-s[show per protocol statistics]' \
+ - set9 \
+ '-D[show status of DHCP configured interfaces]' \
+ '-f[specify address family]:address family:(inet inet6 unix)' \
+ '-I[select interface]:interface:_net_interfaces' \
+}
+
+_netstat "$@"
diff --git a/Completion/Solaris/Command/_pkg5 b/Completion/Solaris/Command/_pkg5
new file mode 100644
index 000000000..bcd4e3daf
--- /dev/null
+++ b/Completion/Solaris/Command/_pkg5
@@ -0,0 +1,431 @@
+#compdef pkg
+
+_pkg5_pkgs() {
+ local cache_policy cache_id=pkg5_installed_pkgs:$HOST:${pkg5_root//\//+}
+ typeset -a -g _pkg5_installed_pkgs
+
+ zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
+ if [[ -z "$cache_policy" ]]; then
+ zstyle ":completion:${curcontext}:" cache-policy _pkg5_installed_caching_policy
+ fi
+
+ if ( [[ $#_pkg5_installed_pkgs -eq 0 ]] || _cache_invalid $cache_id ) && ! _retrieve_cache $cache_id; then
+ _pkg5_installed_pkgs=( $(
+ pkg -R $pkg5_root list -H | while read pkg junk; do
+ pkga=( ${(s:/:)pkg} )
+ for i in {1..$#pkga}; do
+ print ${(j:/:)${pkga[$i,-1]}}
+ done
+ done) )
+ _store_cache $cache_id _pkg5_installed_pkgs
+ fi
+
+ compadd "$@" - ${_pkg5_installed_pkgs}
+}
+
+_pkg5_pkgs_a() {
+ local cache_policy cache_id=pkg5_known_pkgs:$HOST:${pkg5_root//\//+}
+ typeset -a -g _pkg5_known_pkgs
+
+ zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
+ if [[ -z "$cache_policy" ]]; then
+ zstyle ":completion:${curcontext}:" cache-policy _pkg5_known_caching_policy
+ fi
+
+ if ( [[ $#_pkg5_known_pkgs -eq 0 ]] || _cache_invalid $cache_id ) && ! _retrieve_cache $cache_id; then
+ _pkg5_known_pkgs=( $(
+ pkg -R $pkg5_root list -aH --no-refresh | while read pkg junk; do
+ pkga=( ${(s:/:)pkg} )
+ for i in {1..$#pkga}; do
+ print ${(j:/:)${pkga[$i,-1]}}
+ done
+ done) )
+ _store_cache $cache_id _pkg5_known_pkgs
+ fi
+
+ compadd "$@" - ${_pkg5_known_pkgs}
+}
+
+_pkg5_avoided_pkgs() {
+ compadd "$@" - $(pkg -R $pkg5_root unavoid)
+}
+
+_pkg5_pubs() {
+ compadd "$@" - $(pkg -R $pkg5_root publisher -H | awk '{print $1}')
+}
+
+_pkg5_variants() {
+ compadd "$@" - $(pkg -R $pkg5_root variant -H | awk '{print $1}')
+}
+
+_pkg5_facets() {
+ compadd "$@" - $(pkg -R $pkg5_root facet -H | awk '{print $1}')
+}
+
+_pkg5_known_caching_policy() {
+ [[ $pkg5_root/var/pkg/state/known/catalog.attrs -nt "$1" ]]
+}
+
+_pkg5_installed_caching_policy() {
+ [[ $pkg5_root/var/pkg/state/installed/catalog.attrs -nt "$1" ]]
+}
+
+_pkg5() {
+ local expl context state line pkg5_root prop
+ typeset -A opt_args
+ local -a subcmds pkg5_actions pkg5_cattr pkg5_sattr be_opts
+ local -a publisher_properties image_properties certs
+
+ subcmds=(
+ install uninstall list update refresh version help
+ info search verify fix revert contents image-create
+ {change-,}{variant,facet} avoid unavoid history
+ {{un,}set-,}property {add,remove}-property-value
+ {{un,}set-,}publisher purge-history rebuild-index
+ update-format freeze unfreeze {{un,}set-,}mediator
+ )
+
+ pkg5_actions=(
+ set depend dir driver file group hardlink legacy license link
+ signature unknown user
+ )
+
+ # Pseudo attributes for the contents subcommand
+ pkg5_cattr=(
+ action.hash action.key action.name action.raw
+ pkg.fmri pkg.name pkg.publisher pkg.shortfmri
+ )
+
+ # Pseudo attributes for the search subcommand
+ pkg5_sattr=(
+ $pkg5_cattr search.match search.match_type
+ )
+
+ publisher_properties=(
+ "signature-policy:value:(ignore verify require-signatures require-names)"
+ "signature-required-names:value:"
+ )
+
+ image_properties=(
+ "be-policy:value:(default always-new create-backup when-required)"
+ "ca-path:value:_path_files -/"
+ "check-certificate-revocation:value:(true false)"
+ "flush-content-cache-on-success:value:(true false)"
+ "mirror-discovery:value:(true false)"
+ "send-uuid:value:(true false)"
+ "signature-policy:value:(ignore verify require-signatures require-names)"
+ "signature-required-names:value:"
+ "trust-anchor-directory:value:_path_files -/"
+ "use-system-repo:value:(true false)"
+ )
+
+ if [[ $service == "pkg" ]]; then
+ _arguments -C -A "-*" \
+ '(-\? --help)'{-\?,--help}'[Help]' \
+ '-R[Root directory]:directory:_path_files -/' \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl "pkg subcommand" compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+ fi
+
+ pkg5_root=${${${opt_args[-R]}:-$PKG_IMAGE}:-/}
+
+ certs=( $(pkg -R $pkg5_root property -H ca-path | awk '{print $2}')/* )
+
+ # Options common to subcommands which might have to deal with BEs.
+ # Note that --backup-be-name needs to precede --be-name in order to
+ # ensure that completion sees "--b" as being ambiguous.
+ be_opts=(
+ "(--require-new-be)--deny-new-be[Fail the operation if a new BE would be required]"
+ "(--deny-new-be)--require-new-be[Force a new BE to be created]"
+ "--backup-be-name[Specify the name for the backup BE]:BE name: "
+ "--be-name[Specify a BE name]:BE name: "
+ "--no-be-activate[Don't activate the new BE]"
+ "(--require-backup-be)--no-backup-be[Don't leave behind a backup BE]"
+ "(--no-backup-be)--require-backup-be[Force leaving behind a backup BE]"
+ )
+
+ case $service in
+ ("install")
+ _arguments -A "-*" \
+ '-n[Dry run]' \
+ '-q[Quiet]' \
+ '-v[Verbose]' \
+ '-g[Specify additional source of packages]:source:_path_files -/' \
+ "--accept[Accept all licenses]" \
+ "--licenses[Display all licenses]" \
+ "--reject[Specify an FMRI to exclude from the result]:fmri:_pkg5_pkgs" \
+ "--no-refresh[Don't refresh catalogs]" \
+ "--no-index[Don't reindex search database]" \
+ $be_opts \
+ '*:package:_pkg5_pkgs_a'
+ ;;
+
+ ("uninstall")
+ _arguments -A "-*" \
+ '-n[Dry run]' \
+ '-q[Quiet]' \
+ '-v[Verbose]' \
+ $be_opts \
+ "--no-index[Don't reindex search database]" \
+ '*:package:_pkg5_pkgs'
+ ;;
+
+ ("update")
+ _arguments -A "-*" \
+ "-f[Don't check for pkg(5) updates]" \
+ '-n[Dry run]' \
+ '-q[Quiet]' \
+ '-v[Verbose]' \
+ '-g[Specify additional source of packages]:source:_path_files -/' \
+ "--accept[Accept all licenses]" \
+ "--licenses[Display all licenses]" \
+ $be_opts \
+ "--reject[Specify an FMRI to exclude from the result]:fmri:_pkg5_pkgs" \
+ "--no-refresh[Don't refresh catalogs]" \
+ "--no-index[Don't reindex search database]" \
+ '*:package:_pkg5_pkgs'
+ ;;
+
+ ("list")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '-a[Show not-installed packages]' \
+ '-f[Show all versions]' \
+ '-g[Specify additional source of packages]:source:_path_files -/' \
+ '-n[Show newest versions]' \
+ '-s[Show summaries]' \
+ '-u[Show upgradable versions]' \
+ '-v[Show verbose pkg: FMRIs]' \
+ "--no-refresh[Don't refresh catalogs]" \
+ '*:package:_pkg5_pkgs_a'
+ ;;
+
+ ("refresh")
+ _arguments -A "-*" \
+ "--full[Full refresh]" \
+ '*:publisher:_pkg5_pubs'
+ ;;
+
+ ("info")
+ _arguments -A "-*" \
+ '--license[Display license text(s)]' \
+ '(-r)-l[Installed package]' \
+ '(-l)-r[Uninstalled package; fetch info from depot]:*:package:_pkg5_pkgs_a' \
+ '*:package:_pkg5_pkgs'
+ ;;
+
+ ("search")
+ _arguments -A "-*" \
+ "(-p)-a[Show matching actions]" \
+ '-l[Local search]' \
+ '(-a)-p[Show packages]' \
+ '-r[Remote search]' \
+ '-H[Omit headers]' \
+ '-I[Case sensitive search]' \
+ '-s[Depot URI]' \
+ '*-o[Attribute output]:attributes:_values -s , "attribute" $pkg5_sattr' \
+ ':query:'
+ ;;
+
+ ("verify")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '-q[Quiet]' \
+ '-v[Verbose]' \
+ '*:package:_pkg5_pkgs'
+ ;;
+
+ ("fix")
+ _arguments -A "-*" \
+ '--accept[Accept all licenses]' \
+ '--licenses[Display all licenses]' \
+ '*:package:_pkg5_pkgs'
+ ;;
+
+ ("revert")
+ _arguments -A "-*" \
+ '-n[Dry run]' \
+ '-v[Verbose]' \
+ '--tagged[Revert all tagged files]:tag:' \
+ $be_opts \
+ "--no-refresh[Don't refresh catalogs]" \
+ "--no-index[Don't reindex search database]" \
+ '*:file:_path_files'
+ ;;
+
+ ("contents")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '-m[Print raw manifests]' \
+ '*-a[Attribute matching]:attribute=pattern:' \
+ '*-o[Attribute output]:attributes:_values -s , "attribute" $pkg5_cattr' \
+ '*-s[Sort key]:attribute:' \
+ '*-t[Action type]:action:_values -s , "action" $pkg5_actions' \
+ '-r[Fetch manifests from depot]:*:package:_pkg5_pkgs_a' \
+ '*:package:_pkg5_pkgs'
+ ;;
+
+ ("image-create")
+ _arguments -A "-*" \
+ '(-f --force)'{-f,--force}'[Force image creation]' \
+ '(-F --full -P --partial -U --user)'{-F,--full}'[Full image]' \
+ '(-F --full -P --partial -U --user)'{-P,--partial}'[Partial image]' \
+ '(-F --full -P --partial -U --user)'{-U,--user}'[User image]' \
+ '(-z --zone)'{-z,--zone}'[Zoned image]' \
+ '-k[Path to SSL key]:file:_path_files' \
+ '-c[Path to SSL cert]:file:_path_files' \
+ "--no-refresh[Don't refresh catalogs]" \
+ "*--variant[Specify image variants]:variant=instance:" \
+ "*--facet[Specify image facets]:facet=True/False:" \
+ '(-p --publisher)'{-p,--publisher}'[Specify publisher]:prefix=URI:' \
+ ':directory:_path_files -/'
+ ;;
+
+ ("change-variant")
+ _arguments -A "-*" \
+ '-n[Dry run]' \
+ '-q[Quiet'] \
+ '-v[Verbose'] \
+ '-g[Specify additional source of packages]:source:_path_files -/' \
+ '--accept[Accept all licenses]' \
+ '--licenses[Display all licenses]' \
+ $be_opts \
+ "*:variant:_values -s , 'variant' $(pkg -R $pkg5_root variant -H | awk '{print $1}')" \
+ ;;
+
+ ("change-facet")
+ _arguments -A "-*" \
+ '-n[Dry run]' \
+ '-q[Quiet'] \
+ '-v[Verbose'] \
+ '-g[Specify additional source of packages]:source:_path_files -/' \
+ '--accept[Accept all licenses]' \
+ '--licenses[Display all licenses]' \
+ $be_opts \
+ "*:facet:_values -s , 'facet' $(pkg -R $pkg5_root facet -H | awk '{print $1}')" \
+ ;;
+
+ ("variant")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '*:variant:_pkg5_variants'
+ ;;
+
+ ("facet")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '*:facet:_pkg5_facets'
+ ;;
+
+ ("avoid")
+ _arguments -A "-*" \
+ '*:package:_pkg5_pkgs_a'
+ ;;
+
+ ("unavoid")
+ _arguments -A "-*" \
+ '*:package:_pkg5_avoided_pkgs'
+ ;;
+
+ ("set-property")
+ _arguments -A "-*" \
+ ':property:_values "property" $image_properties' \
+ ':value:'
+ ;;
+
+ ("add-property-value")
+ _arguments -A "-*" \
+ ':property:_values "property" $image_properties' \
+ ':value:'
+ ;;
+
+ ("remove-property-value")
+ _arguments -A "-*" \
+ ':property:(${image_properties%%\:*})' \
+ ':value:'
+ ;;
+
+ ("unset-property")
+ _arguments -A "-*" \
+ '*:property:(${image_properties%%\:*})'
+ ;;
+
+ ("property")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '*:property:(${image_properties%%\:*})'
+ ;;
+
+ ("set-publisher")
+ _arguments -A "-*" \
+ '-P[Make preferred]' \
+ '(-e --enable)'{-e,--enable}'[Enable publisher]' \
+ '(-d --disable)'{-d,--disable}'[Disable publisher]' \
+ '(-g --add-origin)'{-g,--add-origin}'[Add origin URI]:uri:' \
+ '(-G --remove-origin)'{-G,--remove-origin}'[Remove origin URI]:uri:' \
+ '(-m --add-mirror)'{-m,--add-mirror}'[Add mirror URI]:uri:' \
+ '(-M --remove-mirror)'{-M,--remove-mirror}'[Remove mirror URI]:uri:' \
+ '-p[Repository URI]:url:' \
+ "--no-refresh[Don't refresh catalogs]" \
+ '--reset-uuid[Reset the image UUID for this publisher]' \
+ '--sticky[Make this publisher sticky]' \
+ '--non-sticky[Make this publisher non-sticky]' \
+ '--search-after[Set publisher search-order]:publisher:_pkg5_pubs' \
+ '--search-before[Set publisher search-order]:publisher:_pkg5_pubs' \
+ '--approve-ca-cert[Add trusted CA certificate]:CA cert path:_path_files' \
+ '--revoke-ca-cert[Revoke CA certificate]:CA cert hash:(${${certs#/etc/openssl/certs/}%.0})' \
+ '--unset-ca-cert[Remove trusted CA certificate]:CA cert hash:' \
+ '--set-property[Set publisher property]:property:_values "property" $publisher_properties' \
+ '--unset-property[Remove publisher property]:property:(${publisher_properties%%\:*})' \
+ '--add-property-value[Add publisher property value]:property:_values "property" $publisher_properties' \
+ '--remove-property-value[Remove publisher property value]:property:(${publisher_properties%%\:*})' \
+ ':publisher:_pkg5_pubs'
+ ;;
+
+ ("unset-publisher")
+ _arguments -A "-*" \
+ '*:publisher:_pkg5_pubs'
+ ;;
+
+ ("publisher")
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '-P[Display only preferred publisher]' \
+ '-n[Display only enabled publishers]' \
+ '*:publisher:_pkg5_pubs'
+ ;;
+
+ ("history")
+ local -a hist_columns
+ hist_columns=(
+ "be" "be_uuid" "client" "client_ver" "command" "finish"
+ "id" "new_be" "new_be_uuid" "operation" "outcome"
+ "reason" "snapshot" "start" "time" "user"
+ )
+ _arguments -A "-*" \
+ '-H[Omit headers]' \
+ '-l[Long history]' \
+ '-n[Last n records]:number:' \
+ '-o[Column]:number:_values -s , "column" $hist_columns' \
+ '-t[Time range]'
+ ;;
+
+ ("freeze"|"unfreeze")
+ ;;
+
+ ("mediator"|"set-mediator"|"unset-mediator")
+ ;;
+
+ (*)
+ _message "unknown pkg subcommand: $service" ;;
+
+ esac
+}
+
+_pkg5 "$@"
diff --git a/Completion/Solaris/Command/_prstat b/Completion/Solaris/Command/_prstat
new file mode 100644
index 000000000..963fad649
--- /dev/null
+++ b/Completion/Solaris/Command/_prstat
@@ -0,0 +1,45 @@
+#compdef prstat
+
+_prstat()
+{
+ d_opt=(
+ "u"\:"seconds past the epoch"
+ "d"\:"standard date format"
+ )
+
+ sort_key=(
+ "cpu"\:"process CPU usage (default)"
+ "pri"\:"process priority"
+ "rss"\:"resident set size"
+ "size"\:"size of process image"
+ "time"\:"process execution time"
+ )
+
+ _arguments -A "-*" \
+ '-a[information about processes and users]' \
+ '-c[new reports below previous reports instead of overprinting them]' \
+ '-C[processes or lwps that are bound to processor sets in the list]:processor set list:' \
+ '-d[specify the representation of time]:time representation:(($d_opt))' \
+ '-h[only processes or lwps whose home lgroup is in the list]:lgroup list:' \
+ '-H[information about home lgroup]' \
+ '-j[only processes or lwps whose project ID is in the given list]:project list:' \
+ '-J[information about processes and projects]' \
+ '-k[only processes or lwps whose task ID is in tasklist]:task list'\
+ '-L[statistics for each light-weight process (LWP)]' \
+ '-m[microstate process accounting information]' \
+ '-n[restrict number of output lines]:ntop,[nbottom]' \
+ '-p[only processes whose process ID is in the list]:PID list' \
+ '-P[only processes or lwps which have most recently executed on a CPU in the list]:CPU list' \
+ '-R[Put prstat in the real time scheduling class]' \
+ '-s[Sort key (descending)]:key:(($sort_key))' \
+ '-S[Sort key (ascending)]:key:(($sort_key))' \
+ '-t[total usage summary for each user]' \
+ '-T[information about processes and tasks]' \
+ '-u[only processes whose effective user ID is in the list]:UID:_users' \
+ '-U[only processes whose real user ID is in the list]:UID:_users' \
+ '-v[verbose process usage]' \
+ '-z[only processes or LWPs whose zone ID is in the list]:zone ID:' \
+ '-Z[information about processes and zones]'
+}
+
+_prstat "$@"
diff --git a/Completion/Solaris/Command/_ps b/Completion/Solaris/Command/_ps
new file mode 100644
index 000000000..5ae61832a
--- /dev/null
+++ b/Completion/Solaris/Command/_ps
@@ -0,0 +1,77 @@
+#compdef ps
+
+_ps()
+{
+ local -a o_opt
+
+o_opt=(
+ "user[user ID]"
+ "ruser[real user ID]"
+ "group[group ID]"
+ "rgroup[real group ID]"
+ "pid[process ID]"
+ "ppid[parent process ID]"
+ "pgid[process group ID]"
+ "pcpu[ratio of CPU time used recently to CPU time available]"
+ "vsz[total size of the process in virtual memory, in kilobytes]"
+ "nice[decimal value of the system scheduling priority of the process]"
+ "etime[elapsed time since the process was started]"
+ "time[cumulative CPU time of the process]"
+ "tty[name of the controlling terminal of the process]"
+ "comm[name of the command being executed]"
+ "args[command with all its arguments as a string]"
+ "f[flags associated with the process]"
+ "s[state of the process]"
+ "c[processor utilization for scheduling]"
+ "uid[effective user ID number]"
+ "ruid[real user ID number]"
+ "gid[effective group ID number]"
+ "rgid[real group ID numberu]"
+ "projid[project ID number]"
+ "project[project name]"
+ "zoneid[zone ID number]"
+ "zone[zone name]"
+ "sid[process ID of the session leader]"
+ "taskid[task ID of the process]"
+ "class[scheduling class]"
+ "pri[priority, higher number - higher priority]"
+ "opri[obsolete priority, lower number - higher priority]"
+ "lwp[lwd ID number]"
+ "nlwp[number of lwps in the process]"
+ "psr[number of the processor to which the process or lwp is bound]"
+ "pset[ID of the processor set to which the process or lwp is bound]"
+ "addr[memory address of the process]"
+ "osz[total size of the process in virtual memory, in pages]"
+ "wchan[address of an event for which the process is sleeping]"
+ "stime[starting time or date of the process]"
+ "rss[resident set size of the process, in kilobytes]"
+ "pmem[ratio of resident set size to physical memory on the machine, in %]"
+ "fname[first 8 bytes of base name of process's executable file]"
+ "ctid[contract ID number]"
+ "lgrp[home lgroup]"
+)
+_arguments \
+ '-a[information about all processes most frequently requested]' \
+ '-c[information in a format that reflects scheduler properties]' \
+ '-d[information about all processes except session leaders]' \
+ '-e[information about every process]' \
+ '-f[full listing]' \
+ '-g[only process data whose group leaders ID number(s) appears in grplist]:group leader ID list' \
+ '-G[information for processes whose real group ID numbers are in gidlist]:real group ID list' \
+ '-H[prints the home lgroup of the process]' \
+ '-j[prints session ID and process group ID]' \
+ '-l[long listing]' \
+ '-L[information about each light weight process]' \
+ '-o[specify output format]:property:_values -s , "property" $o_opt' \
+ '-p[only process data whose process ID numbers are given in proclist]:process ID list' \
+ '-P[Prints the number of the processor to which the process or lwp is bound]' \
+ '-s[information on all session leaders whose IDs appear in sidlist]:session leader ID list' \
+ '-t[lists only process data associated with term]:term' \
+ '-u[only process data whose effective user ID number or login name is given in uidlist]:UID:_users' \
+ '-U[information for processes whose real user ID numbers or login names are in uidlist]:UID:_users' \
+ '-y[both RSS and SZ is reported in kilobytes, instead pages (used with -l)]' \
+ '-z[lists only processes in the specified zones]:zone list' \
+ '-Z[prints the name of the zone with which the process is associated]'
+}
+
+_ps "$@"
diff --git a/Completion/Solaris/Command/_snoop b/Completion/Solaris/Command/_snoop
new file mode 100644
index 000000000..f734c2fb1
--- /dev/null
+++ b/Completion/Solaris/Command/_snoop
@@ -0,0 +1,87 @@
+#compdef snoop
+
+_snoop() {
+ local -a t_opt exp
+
+t_opt=(
+ "r"\:"time relative to first packet"
+ "a"\:"absolute time"
+ "d"\:"delta time - time since receiving previous packet"
+)
+
+exp=(
+ "ether"
+ "ethertype"
+ "host"
+ "from"
+ "to"
+ "ip"
+ "ip6"
+ "arp"
+ "rarp"
+ "pppoe"
+ "pppoed"
+ "pppoes"
+ "vlan"
+ "vlan-id"
+ "broadcast"
+ "multicast"
+ "bootp"
+ "dhcp"
+ "dhcp6"
+ "apple"
+ "decnet"
+ "greater"
+ "less"
+ "udp"
+ "tcp"
+ "icmp"
+ "icmp6"
+ "ah"
+ "esp"
+ "net"
+ "port"
+ "rpc"
+ "zone"
+ "ldap"
+ "gateway"
+ "nofrag"
+ ">"
+ ">="
+ "<"
+ "<="
+ "="
+ "!="
+ "and"
+ "or"
+ "not"
+ "slp"
+ "sctp"
+ "ospf"
+)
+
+ _arguments \
+ '-a[generate audio signal on receiving packets]' \
+ '-c[quit after capturing maxcount packets]:maxcount' \
+ '-d[capture packets from specified device]:device:_net_interfaces' \
+ '-i[display packets previously captured to file]:file:_files' \
+ '-n[use file as IP address-to-name mapping table]:file:_files' \
+ '-o[save captured packets to file]:file:_files' \
+ '-p[display one or more packets from captured file]:first packet number [ , last packet number]' \
+ '-q[do not display packet counter when capturing to file]' \
+ '-r[do not resolve IP addresses to names]' \
+ '-s[truncate each packet after snaplen bytes]:snaplen' \
+ '-t[time-stamp presentation]:time-stamp mode:(($t_opt))' \
+ '-C[list code generated from filter expression]' \
+ '-D[display number of packets dropped on the summary line]' \
+ '-N[create IP-address-to-name mapping table file (used with -i)]' \
+ '-I[capture packets from specified interface]:interface:_net_interfaces' \
+ '-P[capture packets in non-promiscuous mode]' \
+ '-S[display size of the entire link layer frame in bytes]' \
+ '-V[verbose summary mode]' \
+ '-v[verbose mode]' \
+ '-x[display offset and length of packet in HEX and ASCII]:offset [ , length]' \
+ '*:expression:(($exp))' \
+}
+
+_snoop "$@"
diff --git a/Completion/Solaris/Command/_svcadm b/Completion/Solaris/Command/_svcadm
index 8cd001f29..f24675b41 100644
--- a/Completion/Solaris/Command/_svcadm
+++ b/Completion/Solaris/Command/_svcadm
@@ -4,11 +4,11 @@ _svcadm() {
local context state line subcmds
typeset -A opt_args
- subcmds=( enable disable restart refresh mark clear milestone )
+ subcmds=( enable disable restart refresh mark delegate clear milestone )
if [[ $service == "svcadm" ]]; then
_arguments -C -A "-*" \
- '-v[print actions verbosely]' \
+ '-v[Print actions verbosely]' \
'*::command:->subcmd' && return 0
if (( CURRENT == 1 )); then
@@ -21,24 +21,24 @@ _svcadm() {
case $service in
(enable)
- _arguments \
- '-r[recursively enable dependencies]' \
- '-s[wait for service to come online]' \
- '-t[state change is temporary]' \
+ _arguments -A "-*" \
+ '-r[Recursively enable dependencies]' \
+ '-s[Wait for service to come online]' \
+ '-t[State change is temporary]' \
'*:instance FMRI:_svcs_fmri -i'
;;
(disable)
- _arguments \
- '-s[wait for service to become disabled]' \
- '-t[state change is temporary]' \
+ _arguments -A "-*" \
+ '-s[Wait for service to become disabled]' \
+ '-t[State change is temporary]' \
'*:instance FMRI:_svcs_fmri -i'
;;
(mark)
- _arguments \
- '-I[change state immediately]' \
- '-t[state change is temporary]' \
+ _arguments -A "-*" \
+ '-I[Change state immediately]' \
+ '-t[State change is temporary]' \
':state:(degraded maintenance)' \
':instance FMRI:_svcs_fmri -i'
;;
@@ -48,20 +48,19 @@ _svcadm() {
'*:instance FMRI:_svcs_fmri -i'
;;
+ (delegate)
+ _arguments -A "-*" \
+ '-s[Wait for instances to come online]' \
+ ':restarter FMRI:_svcs_fmri -r' \
+ '*:FMRI:_svcs_fmri -i'
+ ;;
+
(milestone)
- _arguments \
- '-d[make milestone the default]' \
+ _arguments -A "-*" \
+ '-d[Make milestone the default]' \
'*:milestone FMRI:_svcs_fmri -m'
;;
-# # The delegate subcommand has been removed, replaced by just using
-# # the restarter fmri
-# (delegate)
-# _arguments \
-# '1:restarter FMRI:_svcs_fmri -r' \
-# '*:instance FMRI:_svcs_fmri -i'
-# ;;
-
(*)
_message "unknown svcadm subcommand: $service"
esac
diff --git a/Completion/Solaris/Command/_svccfg b/Completion/Solaris/Command/_svccfg
index 10b84bda3..08c5e4bcd 100644
--- a/Completion/Solaris/Command/_svccfg
+++ b/Completion/Solaris/Command/_svccfg
@@ -21,7 +21,16 @@ _svccfg() {
local context state line subcmds
typeset -A opt_args
- subcmds=( apply describe extract import validate export inventory delete addpropvalue delpropvalue )
+ # Subcommands that don't make sense on the commandline are missing
+ subcmds=(
+ apply export extract import inventory validate
+ add delete list
+ addpg addpropvalue delcust delpg delprop delpropvalue describe
+ editprop listpg listprop listcust setenv setprop unsetenv
+ setnotify listnotify delnotify
+ listsnap revert selectsnap
+ refresh
+ )
if [[ $service == "svccfg" ]]; then
_arguments -s \
@@ -74,7 +83,13 @@ _svccfg() {
":property group or property:_svccfg_properties $fmri"
;;
- (extract)
+ (extract|add|delete|list|addpg|addpropvalue|delcust|delpg|delprop)
+ ;;
+
+ (delpropvalue|editprop|listpg|listprop|listcust|setenv|setprop|unsetenv)
+ ;;
+
+ (setnotify|listnotify|delnotify|listsnap|revert|selectsnap|refresh)
;;
(*)
diff --git a/Completion/Solaris/Command/_svcprop b/Completion/Solaris/Command/_svcprop
index 60d74a1ad..4a5436caf 100644
--- a/Completion/Solaris/Command/_svcprop
+++ b/Completion/Solaris/Command/_svcprop
@@ -11,6 +11,9 @@ _svcprop() {
'-p[prints values of named property or property group]' \
':FMRI:_svcs_fmri -i' \
- set2 \
+ '-a[display all properties]' \
+ '-g[group type filter]:group type:' \
+ '*-l[properties from a layer]:layer:(admin site-profile system-profile manifest)' \
'(-c -s)-C[retrieve properties without composition]' \
'(-C -s)-c[retrieve properties with composition]' \
'(-c -C)-s[retrieve properties from snapshot]:snapshot:' \
diff --git a/Completion/Solaris/Command/_zlogin b/Completion/Solaris/Command/_zlogin
index 8c55d8671..04018eb87 100644
--- a/Completion/Solaris/Command/_zlogin
+++ b/Completion/Solaris/Command/_zlogin
@@ -1,16 +1,19 @@
#compdef zlogin
+# Synced with the Nevada build 162 man page
_zlogin() {
_arguments -s \
- '-E[disable escape character]' \
- '-e[specify escape character]:character:' \
- '-l[specify username]:username:_users' \
- ':zonename:' \
+ '-E[Disable escape character]' \
+ '-e[Specify escape character]:character:' \
+ '-l[Specify username]:username:_users' \
+ ':zonename:_zones' \
- set1 \
- '-C[connect to zone console]' \
+ '-C[Connect to zone console]' \
+ '-d[Disconnect on zone halt]' \
- set2 \
- '-S["safe" login mode]' \
- ':utility'
+ '-S["Safe" login mode]' \
+ '(-):command name: _command_names -e' \
+ '*::utility: _normal'
}
_zlogin "$@"
diff --git a/Completion/Solaris/Command/_zoneadm b/Completion/Solaris/Command/_zoneadm
new file mode 100644
index 000000000..3f42673e1
--- /dev/null
+++ b/Completion/Solaris/Command/_zoneadm
@@ -0,0 +1,147 @@
+#compdef zoneadm
+# Synced with the S11U1 build 19 man page
+
+_zoneadm_bootargs() {
+ # This is a subset of the arguments to kernel(1M)
+ _arguments -A "-*" \
+ '-i[Alternate init]:path:_path_files' \
+ '-m[SMF options]:option:_values "SMF option" debug milestone= quiet verbose' \
+ '-s[Boot single user]'
+}
+
+_zoneadm() {
+ local context state line expl
+ typeset -A opt_args
+ local -a subcmds fields
+ local -a solaris_attach solaris_install
+ local -a solaris10_attach solaris10_install
+ local brand brand_args
+
+ subcmds=(
+ attach boot clone detach halt help install list mark move
+ ready reboot uninstall verify
+ )
+
+ solaris_attach=(
+ '(-d)-a[Path to archive]:path:_path_files'
+ '(-a)-d[Path to zonepath]:directory:_path_files -/'
+ )
+ solaris_install=(
+ - set1
+ '-c[Path to certificate]:path:_path_files'
+ '*-e[Additional package]:package:'
+ '-k[Path to key]:path:_path_files'
+ '-P[Publisher/URI mapping]:publisher:'
+ - set2
+ '(-d)-a[Path to archive]:path:_path_files'
+ '(-a)-d[Path to installed zone root]:directory:path_files -/'
+ '-p[Preserve system configuration]'
+ '-s[Install silently]'
+ '-u[Unconfigure after installation]'
+ '-v[Verbose]'
+ )
+
+ solaris10_attach=(
+ '(-d)-a[Path to archive]:path:_path_files'
+ '(-a)-d[Path to zonepath]:directory:_path_files -/'
+ )
+ solaris10_install=(
+ '(-d)-a[Path to archive]:path:_path_files'
+ '(-a)-d[Path to installed zone root]:directory:path_files -/'
+ '-p[Preserve system configuration]'
+ '-s[Install silently]'
+ '-u[Unconfigure after installation]'
+ '-v[Verbose]'
+ )
+
+ if [[ $service == "zoneadm" ]]; then
+ _arguments -C -A "-*" \
+ '-R[Alternate root]:alternate root:_path_files -/' \
+ '-u[Zone UUID]:zone UUID: ' \
+ '-z[Zone name]:zone name:_zones' \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl "zoneadm subcommand" compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}=$service:"
+ fi
+
+ case $service in
+ ("boot")
+ # Completion of boot arguments after -- is kinda hacky.
+ _arguments -S -A "-*" \
+ '-w[Force writable root]' \
+ '-W[Boot in transient r/w mode]' \
+ '*:boot options:_zoneadm_bootargs'
+ ;;
+
+ ("clone")
+ _arguments -A "-*" \
+ '-m[Clone mode]:mode:_values "mode" copy' \
+ '-s[Source snapshot]:snapshot:_zfs_dataset -t snap' \
+ ':source zone:_zones'
+ ;;
+
+ ("attach")
+ if [[ -n $opt_args[-z] ]]; then
+ brand=${"${(@s,:,)$(zoneadm -z $opt_args[-z] list -p)}"[6]}
+ brand_args=${brand}_attach
+ fi
+ _arguments -A "-*" \
+ '-F[Force attach]' \
+ '-n[Path to zone manifest]:path to zone manifest:_path_files' \
+ '-u[Update on attach]' \
+ ${(P)brand_args}
+ ;;
+
+ ("detach")
+ _arguments -A "-*" \
+ '-n[Dry run]'
+ ;;
+
+ ("halt"|"ready"|"reboot"|"verify")
+ ;;
+
+
+ ("help")
+ _wanted commands expl "zoneadm subcommand" compadd -a subcmds
+ ;;
+
+ ("install")
+ if [[ -n $opt_args[-z] ]]; then
+ brand=${"${(@s,:,)$(zoneadm -z $opt_args[-z] list -p)}"[6]}
+ brand_args=${brand}_install
+ fi
+ _arguments -A "-*" \
+ ${(P)brand_args}
+ ;;
+
+ ("list")
+ _arguments -A "-*" \
+ '-c[Configured zones]' \
+ '-i[Installed zones]' \
+ '(-v)-p[Parsable output]' \
+ '(-p)-v[Verbose mode]'
+ ;;
+
+ ("mark")
+ _arguments -A "-*" \
+ ':state:(incomplete unavailable)'
+ ;;
+
+ ("move")
+ _arguments -A "-*" \
+ ':new zone path:_path_files -/'
+ ;;
+
+ ("uninstall")
+ _arguments -A "-*" \
+ '-F[Force]'
+ ;;
+ esac
+}
+
+_zoneadm "$@"
diff --git a/Completion/Solaris/Type/.distfiles b/Completion/Solaris/Type/.distfiles
index 8db1e1aaa..2f937ee13 100644
--- a/Completion/Solaris/Type/.distfiles
+++ b/Completion/Solaris/Type/.distfiles
@@ -1,4 +1,6 @@
DISTFILES_SRC='
.distfiles
+_be_name
_svcs_fmri
+_zones
'
diff --git a/Completion/Solaris/Type/_be_name b/Completion/Solaris/Type/_be_name
new file mode 100644
index 000000000..b25a8ff22
--- /dev/null
+++ b/Completion/Solaris/Type/_be_name
@@ -0,0 +1,18 @@
+#autoload
+
+local -a type be_names
+local name uuid activate mtpt space policy created snap
+
+zparseopts -D -E -a type t+:
+
+beadm list -H | while IFS=\; read name uuid active mtpt space policy created; do
+ be_names=( $be_names $name )
+done
+
+if [[ -n $type[(r)all] ]]; then
+ beadm list -sH | while IFS=\; read name snap space policy created; do
+ be_names=( $be_names $snap )
+ done
+fi
+
+compadd "$@" - $be_names
diff --git a/Completion/Solaris/Type/_svcs_fmri b/Completion/Solaris/Type/_svcs_fmri
index 684dc8d6d..80d3516c0 100644
--- a/Completion/Solaris/Type/_svcs_fmri
+++ b/Completion/Solaris/Type/_svcs_fmri
@@ -22,39 +22,52 @@ _svcs_fmri() {
# Grab all FMRIs that have a word beginning with $PREFIX,
# making sure not to return the portion of the FMRI before
# $PREFIX. Use the cache if it exists and the user wants to.
- if ( [[ $#_smf_fmris -eq 0 ]] || _cache_invalid $cache_id ) && ! _retrieve_cache $cache_id; then
+ if ( [[ $#_smf_fmris -eq 0 ]] || _cache_invalid $cache_id ) \
+ && ! _retrieve_cache $cache_id; then
_smf_fmris=( ${(f)"$(svcs -a -H -o fmri)"} )
_store_cache $cache_id _smf_fmris
fi
- # Each element of the array is removed which doesn't match (^|.*/)$PREFIX.*
+ # Each element of the array is removed which doesn't match
+ # (^|.*/)$PREFIX.*
fmri_abbrevs=( ${(M)_smf_fmris:#((#s)|*[/:])$PREFIX*} )
# Go through the remaining elements and remove the characters
# in front of $PREFIX.
- for i in {1..$#fmri_abbrevs}; do
+ for ((i = 1; i <= $#fmri_abbrevs; i++ )); do
# Either one of these will work, but they're too
# greedy, preventing multiple matches below.
fmri_abbrevs[i]=${${fmri_abbrevs[i]}/((#s)|*[\/:])(#b)($PREFIX*)/$match[1]}
#fmri_abbrevs[i]=${${(M)${fmri_abbrevs[i]}:#(#b)((#s)|*/)$PREFIX*}#$match[1]}
done
- # Remove the "default" instance identifier if we can (not for
- # svccfg)
- # TODO Can't remove default when there are other instances.
+ # Remove the "default" instance identifier if it's the only
+ # instance for a given service (not for svccfg).
if [[ $type == "-i" ]]; then
- fmri_abbrevs=( ${fmri_abbrevs//:default(#e)/} )
+ local -a svcs insts nabbrevs
+ local s
+ svcs=( ${(u)fmri_abbrevs%:*} )
+ for s in $svcs; do
+ insts=( ${(@M)fmri_abbrevs:#$s:*} )
+ if [[ $#insts -eq 1 && $insts[1] == *":default" ]]; then
+ nabbrevs=($nabbrevs ${insts//:default})
+ elif [[ $#insts -eq 0 ]]; then
+ # Turns out we're completing the
+ # instance name.
+ nabbrevs=($nabbrevs $s)
+ else
+ nabbrevs=($nabbrevs $insts)
+ fi
+ done
+ fmri_abbrevs=( $nabbrevs )
fi
- # Search for a second match within each result.
- # for m in $fmri_abbrevs; do
- # if [[ -n ${(M)m:#((#s)|*/)$PREFIX*/$PREFIX*} ]]; then
- # fmri_abbrevs=( $fmri_abbrevs ${${(SMI:1:)m%%/$PREFIX*}#/} )
- # fi
- # done
+ # After playing with _multi_parts, I'm not sure it's actually
+ # that useful.
+ # _wanted fmri expl "full or unambiguously abbreviated FMRIs" \
+ # _multi_parts -i / fmri_abbrevs
- # After playing with _multi_parts, I'm not sure it's actually that useful.
- # _wanted fmri expl "full or unambiguously abbreviated FMRIs" _multi_parts / fmri_abbrevs
- _wanted fmri expl "full or unambiguously abbreviated FMRIs" compadd $fmri_abbrevs
+ _wanted fmri expl "full or unambiguously abbreviated FMRIs" \
+ compadd $fmri_abbrevs
;;
(-m)
@@ -64,7 +77,8 @@ _svcs_fmri() {
(-r)
# TODO: need some way to pick out only restarters
- _wanted fmri expl "restarter FMRIs" compadd master svc:/network/inetd:default
+ _wanted fmri expl "restarter FMRIs" \
+ compadd master reset svc:/network/inetd:default
;;
(*)
diff --git a/Completion/Solaris/Type/_zones b/Completion/Solaris/Type/_zones
new file mode 100644
index 000000000..0c2d273a2
--- /dev/null
+++ b/Completion/Solaris/Type/_zones
@@ -0,0 +1,13 @@
+#autoload
+
+local -a type typearg
+local zonelist
+
+zparseopts -D -E -a type t+:
+
+[[ -n $type[(r)c] ]] && typearg=-c
+[[ -n $type[(r)i] ]] && typearg=-i
+
+zonelist=( ${="$(zoneadm list $typearg)"} )
+
+compadd "$@" - $zonelist
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index e54c6c0d2..355cb9cf9 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -83,6 +83,7 @@ _go
_gpg
_gphoto2
_gprof
+_gradle
_graphicsmagick
_grep
_groff
@@ -130,6 +131,7 @@ _mh
_mkdir
_module
_monotone
+_mosh
_mount
_mpc
_mt
@@ -211,7 +213,7 @@ _subversion
_sudo
_surfraw
_sysctl
-_systemctl
+_systemd
_tar
_tardy
_tcpdump
diff --git a/Completion/Unix/Command/_getconf b/Completion/Unix/Command/_getconf
index 76d9c7686..f2c713a52 100644
--- a/Completion/Unix/Command/_getconf
+++ b/Completion/Unix/Command/_getconf
@@ -27,7 +27,7 @@ if [[ CURRENT -eq 2 ]]; then
_tags syswideconfig pathconfig standardsconfig confstring restconfig
allkeys=(${${(f)"$(getconf -a 2>/dev/null)"}%%[: ]*})
- restkeys=(${allkeys:#(${(j.|.)~mykeys})})
+ restkeys=(${allkeys:|mykeys})
while _tags; do
_requested -V syswideconfig expl 'systemwide configuration variables' \
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 5ed921850..88c765fb0 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5753,6 +5753,7 @@ __git_setup_merge_options () {
'(--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]'
'(--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,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies'
'*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]'
'(-q --quiet -v --verbose)'{-q,--quiet}'[suppress all output]'
diff --git a/Completion/Unix/Command/_gradle b/Completion/Unix/Command/_gradle
new file mode 100644
index 000000000..bc5aed0cd
--- /dev/null
+++ b/Completion/Unix/Command/_gradle
@@ -0,0 +1,114 @@
+#compdef gradle gradlew
+
+local curcontext="$curcontext" ret=1 state state_descr line
+local gradle_inspect=yes cache_policy tag_order
+local -A opt_args
+local -a gradle_group_tasks gradle_all_tasks
+
+# Set the caching policy to invalidate cache if the build file is newer than the cache.
+_gradle_caching_policy() {
+ [[ $gradle_buildfile -nt $1 ]]
+}
+
+zstyle -s ":completion:*:*:$service:*" cache-policy cache_policy || \
+ zstyle ":completion:*:*:$service:*" cache-policy _gradle_caching_policy
+
+# By default, we only complete main tasks (belonging to a group). Secondary tasks are
+# completed if no main tasks are found.
+zstyle -a ":completion:*:*:$service:*" tag-order tag_order || \
+ zstyle ":completion:*:*:$service:*" tag-order 'gradle_group' 'gradle_all'
+
+# The completion inspects the current build file to find tasks to complete. Setting
+# this style to 'no' or 'false' turns off inspection. In that case only the built-in tasks
+# are completed.
+zstyle -T ":completion:*:*:$service:*" gradle-inspect || gradle_inspect=no
+
+_arguments -C \
+ '(-)'{-\?,-h,--help}'[Shows this help message.]' \
+ {-a,--no-rebuild}'[Do not rebuild project dependencies.]' \
+ {-b,--build-file}'[Specifies the build file.]:build file:_files -g "*.gradle(-.)"' \
+ {-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
+ {-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g "*.properties(-.)"' \
+ '--continue[Continues task execution after a task failure.]' \
+ \*{-D+,--system-prop}'[Set system property of the JVM (e.g. -Dmyprop=myvalue).]:system property (prop=val):' \
+ '(-i --info -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
+ '(--nodaemon)--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
+ '--foreground[Starts the Gradle daemon in the foreground.]' \
+ {-g,--gradle-user-home}'[Specifies the gradle user home directory.]:home directory:_directories' \
+ '(-)--gui[Launches the Gradle GUI.]' \
+ {-I,--init-script}'[Specifies an initialization script.]:init script:_files -g "*.gradle(-.)"' \
+ '(-d --debug -q --quiet)'{-i,--info}'[Set log level to info.]' \
+ {-m,--dry-run}'[Runs the builds with all task actions disabled.]' \
+ '--no-color[Do not use color in the console output.]' \
+ '(--daemon)--no-daemon[Do not use the Gradle daemon to run the build.]' \
+ '--no-opt[Ignore any task optimization.]' \
+ '--offline[The build should operate without accessing network resources.]' \
+ \*{-P+,--project-prop}'[Set project property for the build script (e.g. -Pmyprop=myvalue).]:project property (prop=val):' \
+ {-p,--project-dir}'[Specifies the start directory for Gradle.]:start directory:_directories' \
+ '--profile[Profiles build execution time and generates a report in the <build_dir>/reports/profile directory.]' \
+ '--project-cache-dir[Specifies the project-specific cache directory.]:cache directory:_directories' \
+ '(-d --debug -i --info)'{-q,--quiet}'[Log errors only.]' \
+ "--refresh[Refresh the state of resources of the type(s) specified.]:refresh policy:(dependencies)" \
+ '(-s --stacktrace)'{-S,--full-stacktrace}'[Print out the full (very verbose) stacktrace for all exceptions.]' \
+ '(-S --full-stacktrace)'{-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
+ '(-)--stop[Stops the Gradle daemon if it is running.]' \
+ {-u,--no-search-upward}"[Don't search in parent folders for a settings.gradle file.]" \
+ '(-)'{-v,--version}'[Print version info.]' \
+ {-x,--exclude-task}'[Specify a task to be excluded from execution.]:task to exclude:->alltask' \
+ '*:task:->task' \
+ && ret=0
+
+if [[ -n $state ]]; then
+ if [[ $gradle_inspect == yes ]]; then
+ # If a build file is specified after '-b' or '--build-file', use this file. Otherwise,
+ # default is the file 'build.gradle' in the current directory.
+ local gradle_buildfile=${${(v)opt_args[(i)-b|--build-file]}:-build.gradle}
+
+ if [[ -f $gradle_buildfile ]]; then
+ # Cache name is constructed from the absolute path of the build file.
+ local cache_name=${${gradle_buildfile:a}//[^[:alnum:]]/_}
+ if _cache_invalid $cache_name || ! _retrieve_cache $cache_name; then
+ zle -R "Generating cache from $gradle_buildfile"
+ local outputline
+ local -a match mbegin mend
+ # Run gradle/gradlew and retrieve possible tasks.
+ for outputline in ${(f)"$($service --build-file $gradle_buildfile -q tasks --all)"}; do
+ if [[ $outputline == [[:blank:]]#(#b)([[:alnum:]]##)' - '(*) ]]; then
+ # The descriptions of main tasks start at beginning of line, descriptions of
+ # secondary tasks are indented.
+ if [[ $outputline == [[:alnum:]]* ]]; then
+ gradle_group_tasks+=( "$match[1]:$match[2]" )
+ else
+ gradle_all_tasks+=( "$match[1]:$match[2]" )
+ fi
+ fi
+ done
+ _store_cache $cache_name gradle_group_tasks gradle_all_tasks
+ fi
+
+ if [[ $state == task ]]; then
+ _tags gradle_group gradle_all
+ while _tags; do
+ # Offer main tasks and secondary tasks in different tags.
+ _requested gradle_group && _describe 'group tasks' gradle_group_tasks && ret=0
+ _requested gradle_all && _describe 'secondary tasks' gradle_all_tasks && ret=0
+ (( ret )) || break
+ done
+ elif [[ $state == alltask ]]; then
+ # After '--exclude-task', we don't make a distinction between main tasks and
+ # secondary tasks.
+ _describe 'all tasks' gradle_group_tasks -- gradle_all_tasks && ret=0
+ fi
+ fi
+ else
+ _describe 'built-in tasks' '(
+ "dependencies:Displays the dependencies of root project."
+ "help:Displays a help message."
+ "projects:Displays the sub-projects of root project."
+ "properties:Displays the properties of root project."
+ "tasks:Displays the tasks runnable from root project."
+ )' && ret=0
+ fi
+fi
+
+return ret
diff --git a/Completion/Unix/Command/_init_d b/Completion/Unix/Command/_init_d
index dd9933a46..bbf62fc0d 100644
--- a/Completion/Unix/Command/_init_d
+++ b/Completion/Unix/Command/_init_d
@@ -68,6 +68,7 @@ else
what='(st(art|op|atus)|(force-|)re(start|load)|debug_(up|down)|dump(|_stats)|add|delete|clean|list)'
+ [[ -x $script ]] || return 1
read -u0 -k2 magic < $script && [[ $magic = '#!' ]] &&
cmds=( ${${(j:|:s:|:)${(M)${(f)"$(< $script)"}:#[[:blank:]]#(\'|)${~what}([[:blank:]]#\|[[:blank:]]#${~what})#(\'|)\)}}//[^-a-z_]} )
diff --git a/Completion/Unix/Command/_mosh b/Completion/Unix/Command/_mosh
new file mode 100644
index 000000000..c940f9015
--- /dev/null
+++ b/Completion/Unix/Command/_mosh
@@ -0,0 +1,12 @@
+#compdef mosh
+
+_arguments \
+ '--client=:client helper:_command_names -e' \
+ '--server=:server helper:_files' \
+ '--ssh=:ssh command to run:_files' \
+ '(-a -n)--predict=:when:(adaptive always never)' \
+ '(--predict -n)-a[predict always]' \
+ '(--predict -a)-n[predict never]' \
+ {-p,--port=}':port:_ports' \
+ ':remote:_hosts' \
+ ':remote command:_command_names -e'
diff --git a/Completion/Unix/Command/_mount b/Completion/Unix/Command/_mount
index 409d253ab..b48aaa236 100644
--- a/Completion/Unix/Command/_mount
+++ b/Completion/Unix/Command/_mount
@@ -690,7 +690,7 @@ if [[ "$service" = mount ]]; then
deffs=hsfs
typeops=-F
;;
- freebsd*|dragonfly*)
+ freebsd*|dragonfly*|darwin*)
args=( -s
'(:)-a[mount all filesystems in fstab]'
'-d[cause everything to be done except for the actual system call]'
@@ -765,7 +765,7 @@ else
'*:dev or dir:->udevordir'
)
;;
- freebsd*|dragonfly*)
+ freebsd*|dragonfly*|darwin*)
args=(
'(*)-a[unmount all mounted file systems]'
'-A[unmount all mounted file systems except the root]'
@@ -904,6 +904,11 @@ udevordir)
mp_tmp+=( $mline[(w)3] )
done
;;
+ darwin*)
+ tmp=( "${(@f)$(/sbin/mount)}" )
+ dev_tmp=( "${(@)${(@)tmp%% *}:#map}" )
+ mp_tmp=( "${(@)${(@)tmp#* on }%% \(*}" )
+ ;;
*)
/sbin/mount | while read mline; do
mp_tmp+=( $mline[(w)1] )
diff --git a/Completion/Unix/Command/_quilt b/Completion/Unix/Command/_quilt
index 130f38149..2ceb2ffaa 100644
--- a/Completion/Unix/Command/_quilt
+++ b/Completion/Unix/Command/_quilt
@@ -32,8 +32,8 @@ _arguments \
'--quiltrc[Use the specified configuration file]:files:_files' \
'--version[Print the version number and exit]' \
':quilt command:(add annotate applied delete diff edit files fold fork graph
- grep header import mail new next patches pop previous push refresh rename
- revert series setup shell snapshot top unapplied upgrade)' \
+ grep header import mail new next patches pop previous push refresh remove
+ rename revert series setup snapshot top unapplied upgrade)' \
'*::subcmd:->subcmd' && return 0
case "$state" in (subcmd)
@@ -109,6 +109,9 @@ case "$state" in (subcmd)
'-T ps[Directly produce a PostScript output file]' \
':quilt series:_quilt_series'
;;
+ (grep)
+ _arguments '-h'
+ ;;
(header)
_arguments '-h' \
'-a[Append the exiting patch header]' \
@@ -131,6 +134,7 @@ case "$state" in (subcmd)
(mail)
_arguments '-h' \
'-m[Text to use as the text in the introduction]:quilt select text: ' \
+ '-M[Like the -m option, but read the introduction from file]:files:_files' \
'--prefix[Use an alternate prefix in the bracketed part of the subjects generated]:quilt select prefix: ' \
'--mbox[Store all messages in the specified file in mbox format]:files:_files' \
'--send[Send the messages directly]' \
@@ -145,7 +149,8 @@ case "$state" in (subcmd)
'*:quilt series:_quilt_series'
;;
(new)
- _arguments '-h'
+ _arguments '-h' \
+ '-p[Select a patch style]:quilt patch style:(0 1 ab)'
;;
(next)
_arguments '-h' \
@@ -175,6 +180,8 @@ case "$state" in (subcmd)
'-q[Quiet operation]' \
'-f[Force apply, even if the patch has rejects]' \
'-v[Verbose operation]' \
+ '--fuzz[Set the maximum fuzz factor]' \
+ '--merge=[Merge the patch file into the original files]:quilt select merge:(merge diff3)' \
'--leave-rejects[Leave around the reject files patch produced]' \
'--color=[Use syntax coloring]:quilt select color:(always auto never)' \
':quilt unapplied:_quilt_unapplied'
@@ -196,6 +203,10 @@ case "$state" in (subcmd)
'--strip-trailing-whitespace[Strip trailing whitespace at the end of lines]' \
':quilt series:_quilt_series'
;;
+ (remove)
+ _arguments '-h' \
+ '-P[Patch to remove]:quilt series:_quilt_series'
+ ;;
(rename)
_arguments '-h' \
'-P[Patch to rename]:quilt series:_quilt_series'
@@ -214,12 +225,9 @@ case "$state" in (subcmd)
'-d[Optional path prefix for the resulting source tree]:quilt select path-prefix: ' \
'--sourcedir[Directory that contains the package sources]:quilt select package sources directory: ' \
'-v[Verbose debug output]' \
+ '--fuzz[Set the maximum fuzz factor]' \
':files:_files'
;;
- (shell)
- _arguments '-h' \
- ':quilt select shell command:_command_names -e'
- ;;
(snapshot)
_arguments '-h' \
'-d[Remove current snapshot]'
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 8f1fb74aa..7e85e2bb6 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -1,6 +1,6 @@
-#compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen sftp
+#compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen sftp ssh-copy-id
-# Completions currently based on OpenSSH 5.9 (released on 2011-09-06).
+# Completions currently based on OpenSSH 6.0 (released on 2012-04-22).
#
# TODO: update ssh-keygen (not based on 5.9)
# TODO: sshd, ssh-keyscan, ssh-keysign
@@ -18,7 +18,7 @@ _ssh () {
# for protocol version 2, this can be a comma-separated list
'-c+[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)'
'-F+[specify alternate config file]:config file:_files'
- '-i+[select identity file]:SSH identity file:_files'
+ '*-i+[select identity file]:SSH identity file:_files'
'*-o+[specify extra options]:option string:->option'
)
common_transfer=(
@@ -50,7 +50,7 @@ _ssh () {
'(-1)-m+[specify mac algorithms]:mac spec:->macs' \
'(-1)-N[do not execute a remote command (protocol version 2 only)]' \
'-n[redirect stdin from /dev/null]' \
- '-O: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"))' \
+ '-O: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"))' \
'-P[use non privileged port]' \
'-p+[specify port on remote host]:port number on remote host' \
'(-v)*-q[quiet operation]' \
@@ -133,6 +133,11 @@ _ssh () {
'-s[SSH2 subsystem or path to sftp server on the remote host]' \
'1:file:->rfile' '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0
;;
+ (ssh-copy-id)
+ _arguments \
+ '-i:SSH identity file:_files' \
+ ':remote host name:->userhost' \
+ ;;
esac
while [[ -n "$state" ]]; do
diff --git a/Completion/Unix/Command/_systemctl b/Completion/Unix/Command/_systemctl
deleted file mode 100644
index 3f54092a1..000000000
--- a/Completion/Unix/Command/_systemctl
+++ /dev/null
@@ -1,311 +0,0 @@
-#compdef systemctl
-
-# Copyright (c) 2011 Foudil Brétel <foudil.newbie+zshsystemctl@gmail.com>
-#
-# This file is released under the GPLv3.
-#
-# inspired from _yum and systemctl-bash-completion.sh (shipped with systemctl)
-#
-# TODO: enable options after commands. Ex: systemctl list-units --all --full
-
-# Main dispatcher
-_systemctl()
-{
- local curcontext="$curcontext" state lstate line
-
- # -s for aggregated options like -aP
- _arguments -s \
- {-h,--help}'[Show help]' \
- '--version[Show package version]' \
- {-t,--type=}'[List only units of a particular type]:unit type:(automount device mount path service snapshot socket swap target timer)' \
- \*{-p,--property=}'[Show only properties by specific name]:unit property:' \
- {-a,--all}'[Show all units/properties, including dead/empty ones]' \
- '--failed[Show only failed units]' \
- "--full[Don't ellipsize unit names on output]" \
- '--fail[When queueing a new job, fail if conflicting jobs are pending]' \
- '--ignore-dependencies[When queueing a new job, ignore all its dependencies]' \
- '--kill-mode=[How to send signal]:killmode:(control-group process)' \
- '--kill-who=[Who to send signal to]:killwho:(main control all)' \
- {-s,--signal=}'[Which signal to send]:signal:_signals' \
- {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \
- {-P,--privileged}'[Acquire privileges before execution]' \
- {-q,--quiet}'[Suppress output]' \
- '--no-block[Do not wait until operation finished]' \
- "--no-wall[Don't send wall message before halt/power-off/reboot]" \
- "--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \
- '--no-legend[Do not print a legend, i.e. the column headers and the footer with hints]' \
- '--no-pager[Do not pipe output into a pager]' \
- '--no-ask-password[Do not ask for system passwords]' \
- '--order[When generating graph for dot, show only order]' \
- '--require[When generating graph for dot, show only requirement]' \
- '--system[Connect to system manager]' \
- '--user[Connect to user service manager]' \
- '--global[Enable/disable unit files globally]' \
- {-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \
- '--defaults[When disabling unit files, remove default symlinks only]' \
- '--root=[Enable unit files in the specified root directory]:directory:_directories' \
- '*::systemctl command:_systemctl_command'
-}
-
-_hosts_or_user_at_host()
-{
- _alternative \
- 'users-hosts:: _user_at_host' \
- 'hosts:: _hosts'
-}
-
-(( $+functions[_systemctl_command] )) || _systemctl_command()
-{
- local -a _systemctl_cmds
- _systemctl_cmds=(
- "list-units:List units"
- "start:Start (activate) one or more units"
- "stop:Stop (deactivate) one or more units"
- "reload:Reload one or more units"
- "restart:Start or restart one or more units"
- "condrestart:Restart one or more units if active"
- "try-restart:Restart one or more units if active"
- "reload-or-restart:Reload one or more units is possible, otherwise start or restart"
- "force-reload:Reload one or more units is possible, otherwise restart if active"
- "reload-or-try-restart:Reload one or more units is possible, otherwise restart if active"
- "isolate:Start one unit and stop all others"
- "kill:Send signal to processes of a unit"
- "is-active:Check whether units are active"
- "status:Show runtime status of one or more units"
- "show:Show properties of one or more units/jobs or the manager"
- "reset-failed:Reset failed state for all, one, or more units"
- "list-unit-files:List installed unit files"
- "enable:Enable one or more unit files"
- "disable:Disable one or more unit files"
- "preset:Enable/disable one or more unit files based on preset configuration"
- "mask:Mask one or more units"
- "unmask:Unmask one or more units"
- "link:Link one or more units into the search path"
- "is-enabled:Check whether unit files are enabled"
- "load:Load one or more units"
- "list-jobs:List jobs"
- "cancel:Cancel all, one, or more jobs"
- "monitor:Monitor unit/job changes"
- "dump:Dump server status"
- "dot:Dump dependency graph for dot(1)"
- "snapshot:Create a snapshot"
- "delete:Remove one or more snapshots"
- "daemon-reload:Reload systemd manager configuration"
- "daemon-reexec:Reexecute systemd manager"
- "show-environment:Dump environment"
- "set-environment:Set one or more environment variables"
- "unset-environment:Unset one or more environment variables"
- "default:Enter system default mode"
- "rescue:Enter system rescue mode"
- "emergency:Enter system emergency mode"
- "halt:Shut down and halt the system"
- "poweroff:Shut down and power-off the system"
- "reboot:Shut down and reboot the system"
- "kexec:Shut down and reboot the system with kexec"
- "exit:Ask for user instance termination"
- )
-
- if (( CURRENT == 1 )); then
- _describe -t commands 'systemctl command' _systemctl_cmds || compadd "$@"
- else
- local curcontext="$curcontext"
-
- cmd="${${_systemctl_cmds[(r)$words[1]:*]%%:*}}"
- # Deal with any aliases
- case $cmd in
- condrestart) cmd="try-restart";;
- force-reload) cmd="reload-or-try-restart";;
- esac
-
- if (( $#cmd )); then
- curcontext="${curcontext%:*:*}:systemctl-${cmd}:"
-
- local update_policy
- zstyle -s ":completion:${curcontext}:" cache-policy update_policy
- if [[ -z "$update_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy _systemctl_caching_policy
- fi
-
- _call_function ret _systemctl_$cmd || _message 'no more arguments'
- else
- _message "unknown systemctl command: $words[1]"
- fi
- return ret
- fi
-}
-
-__check_option_nolegend()
-{
- systemctl --no-legend --version 2>&1 | grep -q 'unrecognized option'
- print -Pn '%(?..--no-legend)'
-}
-nolegend=$(__check_option_nolegend)
-
-
-# Fills the unit lists
-_systemctl_all_units()
-{
- if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) &&
- ! _retrieve_cache SYS_ALL_UNITS;
- then
- _sys_all_units=( $(systemctl ${nolegend} list-units --full --all \
- | cut -d' ' -f1 2>/dev/null) )
- _store_cache SYS_ALL_UNITS _sys_all_units
- fi
-}
-
-_systemctl_inactive_units()
-{
- _sys_inactive_units=( $(systemctl ${nolegend} list-units --full --all \
- | awk '$3 != "active" {print $1}' 2>/dev/null) )
-}
-
-_systemctl_active_units()
-{
- _sys_active_units=( $(systemctl ${nolegend} list-units --full \
- | cut -d' ' -f1 2>/dev/null) )
-}
-
-_systemctl_failed_units()
-{
- _sys_failed_units=( $(systemctl ${nolegend} list-units --full --failed \
- | cut -d' ' -f1 2>/dev/null) )
-}
-
-_filter_units_by_property () {
- local property=$1 value=$2 ; shift ; shift
- local -a units ; units=($*)
- local -a props ; props=( $(systemctl show --property "$property" -- \
- ${units[*]} | grep -v '^$') )
- for ((i=1; $i <= ${#units[*]}; i++)); do
- if [[ "${props[i]}" = "$property=$value" ]]; then
- echo "${units[i]}"
- fi
- done
-}
-
-# Completion functions for ALL_UNITS
-for fun in enable disable is-active is-enabled status show ; do
- (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
- {
- _systemctl_all_units
- compadd "$@" -a - _sys_all_units
- }
-done
-
-# Completion functions for STARTABLE_UNITS
-(( $+functions[_systemctl_start] )) || _systemctl_start()
-{
- _systemctl_inactive_units
- compadd "$@" - $( _filter_units_by_property CanStart yes \
- ${_sys_inactive_units[*]} | grep -Ev '\.(device|snapshot)$' )
-}
-
-# Completion functions for RESTARTABLE_UNITS
-for fun in restart reload-or-restart ; do
- (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
- {
- _systemctl_all_units
- compadd "$@" - $( _filter_units_by_property CanStart yes \
- ${_sys_all_units[*]} | grep -Ev '\.(device|snapshot|socket|timer)$' )
- }
-done
-
-# Completion functions for STOPPABLE_UNITS
-for fun in stop kill try-restart condrestart ; do
- (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
- {
- _systemctl_active_units
- compadd "$@" - $( _filter_units_by_property CanStop yes \
- ${_sys_active_units[*]} )
- }
-done
-
-# Completion functions for RELOADABLE_UNITS
-for fun in reload reload-or-try-restart force-reload ; do
- (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
- {
- _systemctl_active_units
- compadd "$@" - $( _filter_units_by_property CanReload yes \
- ${_sys_active_units[*]} )
- }
-done
-
-# Completion functions for ISOLATABLE_UNITS
-(( $+functions[_systemctl_isolate] )) || _systemctl_isolate()
-{
- _systemctl_all_units
- compadd "$@" - $( _filter_units_by_property AllowIsolate yes \
- ${_sys_all_units[*]} )
-}
-
-# Completion functions for FAILED_UNITS
-(( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed()
-{
- _systemctl_failed_units
- compadd "$@" -a - _sys_failed_units || _message "no failed-unit found"
-}
-
-# Completion functions for JOBS
-(( $+functions[_systemctl_cancel] )) || _systemctl_cancel()
-{
- compadd "$@" - $(systemctl ${nolegend} list-jobs \
- | cut -d' ' -f1 2>/dev/null ) || _message "no job found"
-}
-
-# Completion functions for SNAPSHOTS
-(( $+functions[_systemctl_delete] )) || _systemctl_delete()
-{
- compadd "$@" - $(systemctl ${nolegend} list-units --type snapshot --full \
- --all | cut -d' ' -f1 2>/dev/null ) || _message "no snampshot found"
-}
-
-# Completion functions for ENVS
-for fun in set-environment unset-environment ; do
- (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
- {
- local fun=$0 ; fun=${fun##_systemctl_}
- local suf
- if [[ "${fun}" = "set-environment" ]]; then
- suf='-S='
- fi
-
- compadd "$@" ${suf} - $(systemctl show-environment \
- | sed 's_\([^=]\+\)=.*_\1_' )
- }
-done
-
-# no completion for:
-# [STANDALONE]='daemon-reexec daemon-reload default dot dump emergency exit
-# halt kexec list-jobs list-units monitor poweroff reboot
-# rescue show-environment'
-# [NAME]='snapshot load'
-
-_systemctl_caching_policy()
-{
- local _sysunits
- local -a oldcache
-
- # rebuild if cache is more than a day old
- oldcache=( "$1"(mh+1) )
- (( $#oldcache )) && return 0
-
- _sysunits=($(systemctl ${nolegend} --full --all | cut -d' ' -f1))
-
- if (( $#_sysunits )); then
- for unit in $_sysunits; do
- [[ "$unit" -nt "$1" ]] && return 0
- done
- fi
-
- return 1
-}
-
-_systemctl "$@"
-
-# Local Variables:
-# mode: sh
-# sh-indentation: 2
-# indent-tabs-mode: nil
-# sh-basic-offset: 2
-# End:
diff --git a/Completion/Unix/Command/_systemd b/Completion/Unix/Command/_systemd
new file mode 100644
index 000000000..585ed9c41
--- /dev/null
+++ b/Completion/Unix/Command/_systemd
@@ -0,0 +1,459 @@
+#compdef systemctl systemd-loginctl
+
+# Copyright (c) 2011 Foudil Brétel <foudil.newbie+zshsystemctl@gmail.com>
+#
+# This file is released under the GPLv3.
+#
+# inspired from _yum and systemctl-bash-completion.sh (shipped with systemctl)
+#
+# TODO: enable options after commands. Ex: systemctl list-units --all --full
+
+# Main dispatcher
+_systemd()
+{
+ local curcontext="$curcontext" state lstate line
+
+ case "$service" in
+ systemctl)
+ # -s for aggregated options like -aP
+ _arguments -s \
+ {-h,--help}'[Show help]' \
+ '--version[Show package version]' \
+ {-t,--type=}'[List only units of a particular type]:unit type:(automount device mount path service snapshot socket swap target timer)' \
+ \*{-p,--property=}'[Show only properties by specific name]:unit property:()' \
+ {-a,--all}'[Show all units/properties, including dead/empty ones]' \
+ '--failed[Show only failed units]' \
+ "--full[Don't ellipsize unit names on output]" \
+ '--fail[When queueing a new job, fail if conflicting jobs are pending]' \
+ '--ignore-dependencies[When queueing a new job, ignore all its dependencies]' \
+ '--kill-mode=[How to send signal]:killmode:(control-group process)' \
+ '--kill-who=[Who to send signal to]:killwho:(main control all)' \
+ {-s,--signal=}'[Which signal to send]:signal:_signals' \
+ {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \
+ {-P,--privileged}'[Acquire privileges before execution]' \
+ {-q,--quiet}'[Suppress output]' \
+ '--no-block[Do not wait until operation finished]' \
+ "--no-wall[Don't send wall message before halt/power-off/reboot]" \
+ "--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \
+ '--no-legend[Do not print a legend, i.e. the column headers and the footer with hints]' \
+ '--no-pager[Do not pipe output into a pager]' \
+ '--no-ask-password[Do not ask for system passwords]' \
+ '--order[When generating graph for dot, show only order]' \
+ '--require[When generating graph for dot, show only requirement]' \
+ '--system[Connect to system manager]' \
+ '--user[Connect to user service manager]' \
+ '--global[Enable/disable unit files globally]' \
+ {-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \
+ '--root=[Enable unit files in the specified root directory]:directory:_directories' \
+ '--runtime[Enable unit files only temporarily until next reboot]' \
+ '*::systemctl command:_systemctl_command'
+ ;;
+
+ systemd-loginctl)
+ _arguments -s \
+ {-h,--help}'[Show help]' \
+ '--version[Show package version]' \
+ \*{-p,--property=}'[Show only properties by this name]:unit property:' \
+ {-a,--all}'[Show all properties, including empty ones]' \
+ '--failed[Show only failed units]' \
+ '--kill-who=[Who to send signal to]:killwho:(main control all)' \
+ {-s,--signal=}'[Which signal to send]:signal:_signals' \
+ {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \
+ {-P,--privileged}'[Acquire privileges before execution]' \
+ '--no-pager[Do not pipe output into a pager]' \
+ '*::systemd-loginctl command:_systemd_loginctl_command'
+ ;;
+
+ *) _message 'eh?' ;;
+ esac
+
+}
+
+_hosts_or_user_at_host()
+{
+ _alternative \
+ 'users-hosts:: _user_at_host' \
+ 'hosts:: _hosts'
+}
+
+(( $+functions[_systemctl_command] )) || _systemctl_command()
+{
+ local -a _systemctl_cmds
+ _systemctl_cmds=(
+ "list-units:List units"
+ "start:Start (activate) one or more units"
+ "stop:Stop (deactivate) one or more units"
+ "reload:Reload one or more units"
+ "restart:Start or restart one or more units"
+ "condrestart:Restart one or more units if active"
+ "try-restart:Restart one or more units if active"
+ "reload-or-restart:Reload one or more units is possible, otherwise start or restart"
+ "force-reload:Reload one or more units is possible, otherwise restart if active"
+ "reload-or-try-restart:Reload one or more units is possible, otherwise restart if active"
+ "isolate:Start one unit and stop all others"
+ "kill:Send signal to processes of a unit"
+ "is-active:Check whether units are active"
+ "status:Show runtime status of one or more units"
+ "show:Show properties of one or more units/jobs or the manager"
+ "reset-failed:Reset failed state for all, one, or more units"
+ "load:Load one or more units"
+ "list-unit-files:List installed unit files"
+ "enable:Enable one or more unit files"
+ "disable:Disable one or more unit files"
+ "reenable:Reenable one or more unit files"
+ "preset:Enable/disable one or more unit files based on preset configuration"
+ "mask:Mask one or more units"
+ "unmask:Unmask one or more units"
+ "link:Link one or more units files into the search path"
+ "is-enabled:Check whether unit files are enabled"
+ "list-jobs:List jobs"
+ "cancel:Cancel all, one, or more jobs"
+ "dump:Dump server status"
+ "dot:Dump dependency graph for dot(1)"
+ "snapshot:Create a snapshot"
+ "delete:Remove one or more snapshots"
+ "show-environment:Dump environment"
+ "set-environment:Set one or more environment variables"
+ "unset-environment:Unset one or more environment variables"
+ "daemon-reload:Reload systemd manager configuration"
+ "daemon-reexec:Reexecute systemd manager"
+ "default:Enter system default mode"
+ "rescue:Enter system rescue mode"
+ "emergency:Enter system emergency mode"
+ "halt:Shut down and halt the system"
+ "poweroff:Shut down and power-off the system"
+ "reboot:Shut down and reboot the system"
+ "kexec:Shut down and reboot the system with kexec"
+ "exit:Ask for user instance termination"
+ )
+
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'systemctl command' _systemctl_cmds || compadd "$@"
+ else
+ local curcontext="$curcontext"
+
+ cmd="${${_systemctl_cmds[(r)$words[1]:*]%%:*}}"
+ # Deal with any aliases
+ case $cmd in
+ condrestart) cmd="try-restart";;
+ force-reload) cmd="reload-or-try-restart";;
+ esac
+
+ if (( $#cmd )); then
+ curcontext="${curcontext%:*:*}:systemctl-${cmd}:"
+
+ local update_policy
+ zstyle -s ":completion:${curcontext}:" cache-policy update_policy
+ if [[ -z "$update_policy" ]]; then
+ zstyle ":completion:${curcontext}:" cache-policy _systemctl_caching_policy
+ fi
+
+ _call_function ret _systemctl_$cmd || _message 'no more arguments'
+ else
+ _message "unknown systemctl command: $words[1]"
+ fi
+ return ret
+ fi
+}
+
+__systemctl()
+{
+ systemctl --full --no-legend --no-pager "$@"
+}
+
+
+# Fills the unit list
+_systemctl_all_units()
+{
+ if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) &&
+ ! _retrieve_cache SYS_ALL_UNITS;
+ then
+ _sys_all_units=( $(__systemctl list-units --all | { while read a b; do echo "$a"; done; }) )
+ _store_cache SYS_ALL_UNITS _sys_all_units
+ fi
+}
+
+# Fills the unit list including all file units
+_systemctl_really_all_units()
+{
+ local -a all_unit_files;
+ local -a really_all_units;
+ if ( [[ ${+_sys_really_all_units} -eq 0 ]] || _cache_invalid SYS_REALLY_ALL_UNITS ) &&
+ ! _retrieve_cache SYS_REALLY_ALL_UNITS;
+ then
+ all_unit_files=( $(__systemctl list-unit-files | { while read a b; do echo "$a"; done; }) )
+ _systemctl_all_units
+ really_all_units=($_sys_all_units $all_unit_files)
+ _sys_really_all_units=(${(u)really_all_units})
+ _store_cache SYS_REALLY_ALL_UNITS _sys_really_all_units
+ fi
+}
+
+_filter_units_by_property() {
+ local property=$1 value=$2 ; shift ; shift
+ local -a units ; units=($*)
+ local prop unit
+ for ((i=1; $i <= ${#units[*]}; i++)); do
+ # FIXME: "Failed to issue method call: Unknown unit" errors are ignored for
+ # now (related to DBUS_ERROR_UNKNOWN_OBJECT). in the future, we need to
+ # revert to calling 'systemctl show' once for all units, which is way
+ # faster
+ unit=${units[i]}
+ prop=$(systemctl show --no-pager --property="$property" ${unit} 2>/dev/null)
+ if [[ "${prop}" = "$property=$value" ]]; then
+ echo "${unit}"
+ fi
+ done
+}
+
+_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read a b; do echo "$a"; done; }) )}
+_systemctl_inactive_units(){_sys_inactive_units=($(__systemctl list-units --all | { while read a b c d; do [[ $c == "inactive" ]] && echo "$a"; done; }) )}
+_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read a b; do echo "$a"; done; }) )}
+_systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files | { while read a b; do [[ $b == "enabled" ]] && echo "$a"; done; }) )}
+_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files | { while read a b; do [[ $b == "disabled" ]] && echo "$a"; done; }) )}
+_systemctl_masked_units() {_sys_masked_units=( $(__systemctl list-unit-files | { while read a b; do [[ $b == "masked" ]] && echo "$a"; done; }) )}
+
+# Completion functions for ALL_UNITS
+for fun in is-active is-enabled status show mask preset ; do
+ (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
+ {
+ _systemctl_really_all_units
+ compadd "$@" -a - _sys_really_all_units
+ }
+done
+
+# Completion functions for ENABLED_UNITS
+for fun in disable reenable ; do
+ (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
+ {
+ _systemctl_enabled_units
+ compadd "$@" -a - _sys_enabled_units
+ }
+done
+
+# Completion functions for DISABLED_UNITS
+(( $+functions[_systemctl_enable] )) || _systemctl_enable()
+{
+ _systemctl_disabled_units
+ compadd "$@" -a - _sys_disabled_units
+}
+
+# Completion functions for FAILED_UNITS
+(( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed()
+{
+ _systemctl_failed_units
+ compadd "$@" -a - _sys_failed_units || _message "no failed unit found"
+}
+
+# Completion functions for STARTABLE_UNITS
+(( $+functions[_systemctl_start] )) || _systemctl_start()
+{
+ _systemctl_inactive_units
+ compadd "$@" -a - _sys_inactive_units
+}
+
+# Completion functions for STOPPABLE_UNITS
+for fun in stop kill try-restart condrestart ; do
+ (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
+ {
+ _systemctl_active_units
+ compadd "$@" - $( _filter_units_by_property CanStop yes \
+ ${_sys_active_units[*]} )
+ }
+done
+
+# Completion functions for ISOLATABLE_UNITS
+(( $+functions[_systemctl_isolate] )) || _systemctl_isolate()
+{
+ _systemctl_all_units
+ compadd "$@" - $( _filter_units_by_property AllowIsolate yes \
+ ${_sys_all_units[*]} )
+}
+
+# Completion functions for RELOADABLE_UNITS
+for fun in reload reload-or-try-restart force-reload ; do
+ (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
+ {
+ _systemctl_active_units
+ compadd "$@" - $( _filter_units_by_property CanReload yes \
+ ${_sys_active_units[*]} )
+ }
+done
+
+# Completion functions for RESTARTABLE_UNITS
+for fun in restart reload-or-restart ; do
+ (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
+ {
+ _systemctl_all_units
+ compadd "$@" - $( _filter_units_by_property CanStart yes \
+ ${_sys_all_units[*]} | while read line; do \
+ [[ "$line" =~ \.(device|snapshot|socket|timer)$ ]] || echo "$line"; \
+ done )
+ }
+done
+
+# Completion functions for MASKED_UNITS
+(( $+functions[_systemctl_unmask] )) || _systemctl_unmask()
+{
+ _systemctl_masked_units
+ compadd "$@" -a - _sys_masked_units || _message "no masked unit found"
+}
+
+# Completion functions for JOBS
+(( $+functions[_systemctl_cancel] )) || _systemctl_cancel()
+{
+ compadd "$@" - $(__systemctl list-jobs \
+ | cut -d' ' -f1 2>/dev/null ) || _message "no job found"
+}
+
+# Completion functions for SNAPSHOTS
+(( $+functions[_systemctl_delete] )) || _systemctl_delete()
+{
+ compadd "$@" - $(__systemctl list-units --type snapshot --all \
+ | cut -d' ' -f1 2>/dev/null ) || _message "no snampshot found"
+}
+
+# Completion functions for ENVS
+for fun in set-environment unset-environment ; do
+ (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
+ {
+ local fun=$0 ; fun=${fun##_systemctl_}
+ local suf
+ if [[ "${fun}" = "set-environment" ]]; then
+ suf='-S='
+ fi
+
+ compadd "$@" ${suf} - $(systemctl show-environment \
+ | while read line; do echo "${line%%\=}";done )
+ }
+done
+
+(( $+functions[_systemctl_link] )) || _systemctl_link() { _files }
+
+# no systemctl completion for:
+# [STANDALONE]='daemon-reexec daemon-reload default dot dump
+# emergency exit halt kexec list-jobs list-units
+# list-unit-files poweroff reboot rescue show-environment'
+# [NAME]='snapshot load'
+
+_systemctl_caching_policy()
+{
+ local _sysunits
+ local -a oldcache
+
+ # rebuild if cache is more than a day old
+ oldcache=( "$1"(mh+1) )
+ (( $#oldcache )) && return 0
+
+ _sysunits=($(__systemctl --all | cut -d' ' -f1))
+
+ if (( $#_sysunits )); then
+ for unit in $_sysunits; do
+ [[ "$unit" -nt "$1" ]] && return 0
+ done
+ fi
+
+ return 1
+}
+
+
+
+_systemd_loginctl_all_sessions(){_sys_all_sessions=($(systemd-loginctl list-sessions | { while read a b; do echo "$a"; done; }) )}
+_systemd_loginctl_all_users() {_sys_all_users=( $(systemd-loginctl list-users | { while read a b; do echo "$a"; done; }) )}
+_systemd_loginctl_all_seats() {_sys_all_seats=( $(systemd-loginctl list-seats | { while read a b; do echo "$a"; done; }) )}
+
+# Completion functions for SESSIONS
+for fun in session-status show-session activate lock-session unlock-session terminate-session kill-session ; do
+ (( $+functions[_systemd_loginctl_$fun] )) || _systemd_loginctl_$fun()
+ {
+ _systemd_loginctl_all_sessions
+ compadd "$@" -a - _sys_all_sessions
+ }
+done
+
+# Completion functions for USERS
+for fun in user-status show-user enable-linger disable-linger terminate-user kill-user ; do
+ (( $+functions[_systemd_loginctl_$fun] )) || _systemd_loginctl_$fun()
+ {
+ _systemd_loginctl_all_users
+ compadd "$@" -a - _sys_all_users
+ }
+done
+
+# Completion functions for SEATS
+(( $+functions[_systemd_loginctl_seats] )) || _systemd_loginctl_seats()
+{
+ _systemd_loginctl_all_seats
+ compadd "$@" -a - _sys_all_seats
+}
+for fun in seat-status show-seat terminate-seat ; do
+ (( $+functions[_systemd_loginctl_$fun] )) || _systemd_loginctl_$fun()
+ { _systemd_loginctl_seats }
+done
+
+# Completion functions for ATTACH
+(( $+functions[_systemd_loginctl_attach] )) || _systemd_loginctl_attach()
+{
+ _systemd_loginctl_all_seats
+
+ _arguments -w -C -S -s \
+ ':seat:_systemd_loginctl_seats' \
+ '*:device:_files'
+}
+
+# no systemd-loginctl completion for:
+# [STANDALONE]='list-sessions list-users list-seats flush-devices'
+
+(( $+functions[_systemd_loginctl_command] )) || _systemd_loginctl_command()
+{
+ local -a _systemd_loginctl_cmds
+ _systemd_loginctl_cmds=(
+ "list-sessions:List sessions"
+ "session-status:Show session status"
+ "show-session:Show properties of one or more sessions"
+ "activate:Activate a session"
+ "lock-session:Screen lock one or more sessions"
+ "unlock-session:Screen unlock one or more sessions"
+ "terminate-session:Terminate one or more sessions"
+ "kill-session:Send signal to processes of a session"
+ "list-users:List users"
+ "user-status:Show user status"
+ "show-user:Show properties of one or more users"
+ "enable-linger:Enable linger state of one or more users"
+ "disable-linger:Disable linger state of one or more users"
+ "terminate-user:Terminate all sessions of one or more users"
+ "kill-user:Send signal to processes of a user"
+ "list-seats:List seats"
+ "seat-status:Show seat status"
+ "show-seat:Show properties of one or more seats"
+ "attach:Attach one or more devices to a seat"
+ "flush-devices:Flush all device associations"
+ "terminate-seat:Terminate all sessions on one or more seats"
+ )
+
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'systemd-loginctl command' _systemd_loginctl_cmds || compadd "$@"
+ else
+ local curcontext="$curcontext"
+
+ cmd="${${_systemd_loginctl_cmds[(r)$words[1]:*]%%:*}}"
+
+ if (( $#cmd )); then
+ curcontext="${curcontext%:*:*}:systemd_loginctl-${cmd}:"
+
+ _call_function ret _systemd_loginctl_$cmd || _message 'no more arguments'
+ else
+ _message "unknown systemd-loginctl command: $words[1]"
+ fi
+ return ret
+ fi
+}
+
+_systemd "$@"
+
+# Local Variables:
+# mode: sh
+# sh-indentation: 2
+# indent-tabs-mode: nil
+# sh-basic-offset: 2
+# End:
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 5fb721960..a8f133295 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -572,7 +572,7 @@ function _tmux-new-session() {
[[ -n ${tmux_describe} ]] && print "Create a new session" && return
local -a args
args=(
- '-d[attach the new session the current terminal]'
+ '-d[do not attach new session to current terminal]'
'-n[name the initial window]:window name'
'-s[name the session]:session name'
'-t[specify target session]:sessions:__tmux-sessions'
@@ -1097,7 +1097,7 @@ function __tmux-buffers() {
local -a bopts; bopts=()
fi
- buffers=( ${${(f)"$(command tmux list-buffers "${bopts[@]}")"}/:[ $'\t']##/:} )
+ buffers=( ${${(f)"$(command tmux 2> /dev/null list-buffers "${bopts[@]}")"}/:[ $'\t']##/:} )
_describe -t buffers 'buffers' buffers
}
@@ -1105,7 +1105,7 @@ function __tmux-bound-keys() {
local expl
local -a keys
- keys=( ${${${${(f)"$(command tmux list-keys "$@")"}/:[ $'\t']##/:}/(#s)[ $'\t']##/}/(#s):/\\:} )
+ keys=( ${${${${(f)"$(command tmux 2> /dev/null list-keys "$@")"}/:[ $'\t']##/:}/(#s)[ $'\t']##/}/(#s):/\\:} )
_describe -t keys 'keys' keys
}
@@ -1124,7 +1124,7 @@ function __tmux-choose-stuff() {
function __tmux-clients() {
local expl
local -a clients
- clients=( ${${(f)"$(command tmux list-clients)"}/:[ $'\t']##/:} )
+ clients=( ${${(f)"$(command tmux 2> /dev/null list-clients)"}/:[ $'\t']##/:} )
_describe -t clients 'clients' clients
}
@@ -1400,7 +1400,7 @@ function __tmux-panes() {
opts=( )
fi
num=0
- command tmux list-panes "${opts[@]}" | while IFS= read -r line; do
+ command tmux 2> /dev/null list-panes "${opts[@]}" | while IFS= read -r line; do
panes+=( $(( num++ )):${line//:/} )
done
_describe -t panes 'panes' panes "$@"
@@ -1421,7 +1421,7 @@ function __tmux-server-options() {
function __tmux-sessions() {
local expl
local -a sessions
- sessions=( ${${(f)"$(command tmux list-sessions)"}/:[ $'\t']##/:} )
+ sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
_describe -t sessions 'sessions' sessions "$@"
}
@@ -1479,7 +1479,7 @@ function __tmux-windows() {
else
opts=( )
fi
- wins=( ${${(M)${(f)"$(command tmux list-windows "${opts[@]}")"}:#<->*}/:[ $'\t']##/:} )
+ wins=( ${${(M)${(f)"$(command tmux 2> /dev/null list-windows "${opts[@]}")"}:#<->*}/:[ $'\t']##/:} )
_describe -t windows 'windows' wins "$@"
if [[ ${IPREFIX} != *: ]]; then
_wanted sessions expl 'sessions' __tmux-sessions -S:
@@ -1528,6 +1528,18 @@ function _tmux() {
if [[ -n ${_tmux_aliasmap[$tmuxcommand]} ]] ; then
tmuxcommand="${_tmux_aliasmap[$tmuxcommand]}"
fi
+ if ! (( ${+functions[_tmux-$tmuxcommand]} )); then
+ local low high
+ low=$_tmux_commands[(i)$tmuxcommand*]
+ high=$_tmux_commands[(I)$tmuxcommand*]
+ if (( low == high )); then
+ tmuxcommand=${_tmux_commands[low]%%:*}
+ elif (( low < high )); then
+ _message -e "Ambiguous command $tmuxcommand"
+ else
+ _message -e "Subcommand $tmuxcommand not known"
+ fi
+ fi
curcontext="${curcontext%:*:*}:tmux-${tmuxcommand}:"
_call_function ret _tmux-${tmuxcommand}
fi
diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget
index e54a08b27..51d640d62 100644
--- a/Completion/Unix/Command/_wget
+++ b/Completion/Unix/Command/_wget
@@ -54,7 +54,7 @@ _arguments -C -s \
'--no-cache[disallow server-cached data]' \
'(--html-extension -E)'{--html-extension,-E}'[save all HTML documents with a .html extension]' \
"--ignore-length[ignore \`Content-Length' header field]" \
- '--header=:string' \
+ '*--header=:string' \
'--proxy-user=:user' \
'--proxy-password=:password' \
'--referer=:URL:_urls' \
diff --git a/Completion/Unix/Command/_xmlsoft b/Completion/Unix/Command/_xmlsoft
index a1f727442..ed5bfe7f7 100644
--- a/Completion/Unix/Command/_xmlsoft
+++ b/Completion/Unix/Command/_xmlsoft
@@ -41,8 +41,8 @@ case $service in
'--maxparserdepth[increase the maximum parser depth]:depth' \
'--html[input document is an HTML file]' \
'--encoding[the input document character encoding]:encoding:(${encoding[@]})' \
- '--param[pass a parameter,value pair]:name::value (xpath expression)' \
- '--stringparam[pass a parameter]:name::value' \
+ '*--param[pass a parameter,value pair]:name::value (xpath expression)' \
+ '*--stringparam[pass a parameter]:name::value' \
'--path[provide a set of paths for resources]:paths:_files -/' \
'--nonet[refuse to fetch DTDs or entities over network]' \
'--nowrite[refuse to write to any file or resource]' \
@@ -53,7 +53,7 @@ case $service in
'--xincludestyle[do XInclude processing on stylesheets]' \
'--load-trace[print trace of all external entites loaded]' \
{--profile,--norman}'[dump profiling information]' \
- '1:stylesheet:_files -g "*.xsl(-.)"' \
+ '1:stylesheet:_files -g "*.xslt#(-.)"' \
':file:_files -g "*.xml(-.)"' && return
;;
xmllint)
diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs
index ff404278a..4cc24a59f 100644
--- a/Completion/Unix/Command/_zfs
+++ b/Completion/Unix/Command/_zfs
@@ -1,55 +1,100 @@
#compdef zfs
+# Synced with the S11U1 build 20 man page
_zfs() {
local context state line expl
typeset -A opt_args
- local -a subcmds rw_properties rw_propnames ro_properties
+ local -a subcmds rw_properties rw_propnames ro_properties create_properties
+ local -a difffields delegatable_perms
subcmds=(
"create" "destroy" "clone" "promote" "rename" "snapshot"
"rollback" "list" "set" "get" "inherit" "mount" "unmount"
"share" "unshare" "send" "receive" "allow" "unallow"
- "upgrade"
+ "upgrade" "userspace" "groupspace" "hold" "holds" "release"
+ "diff" "key" "help"
)
+ # TODO: userused@ and groupused@ could have more extensive handling
ro_properties=(
"name" "type" "creation" "used" "available" "referenced"
- "compressratio" "mounted" "origin"
+ "compressratio" "mounted" "origin" "usedbychildren"
+ "usedbydataset" "usedbyrefreservation" "usedbysnapshots"
+ "defer_destroy" "userused@" "userrefs" "groupused@"
+ "keychangedate" "keystatus" "rekeydate"
)
# TODO: Be cleverer about what values can be set. Is there any way to
# set the sorting for *size properties to false by default?
rw_properties=(
- "aclinherit:value:(discard noallow secure passthrough)"
- "aclmode:value:(discard groupmask passthrough)"
+ "aclinherit:value:(discard noallow restricted passthrough passthrough-x)"
+ "aclmode:value:(discard mask passthrough)"
"atime:value:(on off)"
- "canmount:value:(on off)"
- "checksum:value:(on off fletcher2 fletcher4 sha256)"
- "compression:value:(on off lzjb gzip gzip-{1..9})"
+ "canmount:value:(on off noauto)"
+ "checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)"
+ "compression:value:(on off lzjb gzip gzip-{1..9} zle)"
"copies:value:(1 2 3)"
+ "dedup:value:(on off verify sha256 sha256,verify)"
"devices:value:(on off)"
+ "encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)"
"exec:value:(on off)"
- "mountpoint:value:{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}"
+ "groupquota@:value:" # TODO: complete group=size|none
+ "keysource:value:_zfs_keysource_props"
+ "logbias:value:(latency throughput)"
+ "mlslabel:value:(none)" # TODO: list sensitivity labels
+ "mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}"
+ "multilevel:value:(on off)"
+ "nbmand:value:(on off)"
+ "primarycache:value:(all none metadata)"
"quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}"
"readonly:value:(on off)"
- "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K)"
- "reservation:value:" # <size>, "none"
+ "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
+ "refquota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refquota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refquota' compadd none; fi}"
+ "refreservation:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refreservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refreservation' compadd none; fi}"
+ "reservation:value:{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == reservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'reservation' compadd none; fi}"
+ "rstchown:value:(on off)"
+ "secondarycache:value:(all none metadata)"
"setuid:value:(on off)"
- "shareiscsi:value:(on off)" # or "type=<type>"
- "sharenfs:value:(on off)" # or share(1M) options
+ "shadow:value:" # TODO: complete URI|none
+ "share:share properties:"
+ "sharenfs:value:(on off)"
+ "sharesmb:value:(on off)"
"snapdir:value:(hidden visible)"
- "version:value:(1 2 current)"
- "volblocksize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K)"
+ "sync:value:(standard always disabled)"
+ "userquota@:value:" # TODO: complete user=size|none
+ "version:value:(1 2 3 4 current)"
"volsize:value:" # <size>
+ "vscan:value:(on off)"
"xattr:value:(on off)"
"zoned:value:(on off)"
)
+ create_properties=(
+ $rw_properties
+ "casesensitivity:value:(sensitive insensitive mixed)"
+ "normalization:value:(none formC formD formKC formKD)"
+ "utf8only:value:(on off)"
+ "volblocksize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
+ )
+
+ delegatable_perms=(
+ "allow" "clone" "create" "destroy" "diff" "hold" "key"
+ "keychange" "mount" "promote" "receive" "release" "rename"
+ "rollback" "send" "share" "snapshot"
+ "groupused" "userused" "userprop"
+ ${create_properties%%:*}
+ )
+
rw_propnames=( ${rw_properties%%:*} )
+ difffields=(
+ object parent size links linkschange name oldname user group
+ ctime mtime atime crtime
+ )
+
if [[ $service == "zfs" ]]; then
_arguments -C -A "-*" \
- '-\?[help]' \
+ '-\?[Help]' \
'*::command:->subcmd' && return 0
if (( CURRENT == 1 )); then
@@ -63,124 +108,143 @@ _zfs() {
case $service in
("create")
_arguments -A "-*" \
- '-p[create parent datasets]' \
- '-o[set initial properties]:property:_values -s , "property" $rw_properties' \
+ '-p[Create parent datasets]' \
+ '-o[Set initial properties]:property:_values -s , "property" $create_properties' \
- set1 \
- ':filesystem:' \
+ ':filesystem:_zfs_dataset -t fs -e "parent dataset"' \
- set2 \
- '-s[create sparse volume]' \
- '-b[set volblocksize]:blocksize:' \
- '-V[set size]:size:' \
- ':volume:'
+ '-s[Create sparse volume]' \
+ '-b[Set volblocksize]:blocksize:' \
+ '-V[Set size]:size:' \
+ ':volume:_zfs_dataset -t fs -e "parent dataset"'
;;
("destroy")
_arguments -A "-*" \
- '-r[recursively destroy all children]' \
- '-R[recursively destroy all dependents]' \
- '-f[force unmounts]' \
- ':filesystem/volume/snapshot:_zfs_dataset'
+ '-r[Recursively destroy all children]' \
+ '-R[Recursively destroy all dependents]' \
+ - set1 \
+ '-d[delete or mark deferred]' \
+ ':snapshot:_zfs_dataset -t snap' \
+ - set2 \
+ '-f[Force unmounts]' \
+ ':filesystem/volume/snapshot:_zfs_dataset -t fs -t vol'
;;
("snapshot")
_arguments -A "-*" \
- '-r[recursively snapshot all descendant datasets]' \
+ '-r[Recursively snapshot all descendant datasets]' \
+ '-o[Set property]:property:_values -s , "property" $create_properties' \
':filesystem/volume:_zfs_dataset -t fs -t vol -S@'
;;
("rollback")
_arguments -A "-*" \
- '-r[recursively destroy more recent snapshots]' \
- '-R[recursively destroy more recent snapshots and clones]' \
- '-f[force unmounts]' \
+ '-r[Recursively destroy more recent snapshots]' \
+ '-R[Recursively destroy more recent snapshots and clones]' \
+ '-f[Force unmounts]' \
':snapshot:_zfs_dataset -t snap'
;;
("clone")
# XXX needs to bail if there are no snapshots
_arguments -A "-*" \
- '-p[create parent datasets]' \
+ '-p[Create parent datasets]' \
+ '-K[Create encryption key]' \
+ '-o[Set property]:property:_values -s , "property" $create_properties' \
':snapshot:_zfs_dataset -t snap' \
- ':filesystem/volume:'
+ ':filesystem/volume:_zfs_dataset -t fs -e "parent dataset"'
;;
("promote")
- # XXX complete only cloned filesystems
_arguments \
- ':filesystem:_zfs_dataset -t fs' \
+ ':filesystem:_zfs_dataset -t clone' \
;;
("rename")
_arguments -A "-*" \
- - set1 \
- '-p[create parent datasets]' \
- ':filesystem/volume/snapshot:_zfs_dataset' \
- ':filesystem/volume/snapshot:' \
- - set2 \
- '-r[recursively rename snapshots of all descendent datasets]' \
- ':snapshot:_zfs_dataset -t snap' \
- ':snapshot:'
+ '(-r)-p[Create parent datasets]' \
+ '(-p)-r[Recursively rename snapshots of all descendent datasets]' \
+ ':dataset:_zfs_dataset -r1' \
+ ':dataset:_zfs_dataset -r2'
;;
("list")
_arguments -A "-*" \
- '-r[recursively display children]' \
- '-H[scripting mode]' \
- '-o[properties to list]:property:_values -s , "property" $ro_properties $rw_propnames' \
- '*-s[sort key (ascending)]:property:_values "property" $ro_properties $rw_propnames' \
- '*-S[sort key (descending)]:property:_values "property" $ro_properties $rw_propnames' \
- '-t[dataset types to list]:dataset type:_values -s , "dataset type" filesystem snapshot volume' \
- '*:filesystem/volume/snapshot:_zfs_dataset'
+ '-r[Recursively display children]' \
+ '-H[Scripting mode]' \
+ '-d[Depth]:value:' \
+ '-o[Properties to list]:property:_values -s , "property" $ro_properties $rw_propnames' \
+ '*-s[Sort key (ascending)]:property:_values "property" $ro_properties $rw_propnames' \
+ '*-S[Sort key (descending)]:property:_values "property" $ro_properties $rw_propnames' \
+ '-t[Dataset types to list]:dataset type:_values -s , "dataset type" all filesystem snapshot volume' \
+ '*:filesystem/volume/snapshot/path:_zfs_dataset -p'
;;
("set")
_arguments \
+ '-r[Recursively apply value]' \
':property:_values -s , "property" $rw_properties' \
'*:filesystem/volume:_zfs_dataset -t fs -t vol'
;;
("get")
_arguments -A "-*" \
- "-r[recursively display children's properties]" \
- '-H[scripting mode]' \
- '-p[display numbers exactly]' \
- '-s[specify sources]:source:_values -s , "source" local default inherited temporary none' \
- '-o[specify fields]:field:_values -s , "field" name property value source' \
+ "-r[Recursively display children's properties]" \
+ '-d[Depth]:value:' \
+ '-H[Scripting mode]' \
+ '-p[Display numbers exactly]' \
+ '-s[Specify sources]:source:_values -s , "source" local default inherited temporary none' \
+ '-o[Specify fields]:field:_values -s , "field" name property value source' \
':property:_values -s , "property" $ro_properties $rw_propnames all' \
'*:filesystem/volume/snapshot:_zfs_dataset'
;;
("inherit")
_arguments -A "-*" \
- '-r[recursively inherit property for all children]' \
+ '-r[Recursively inherit property for all children]' \
+ '-S[Revert to received property value]' \
':property:_values -s , "property" $ro_properties $rw_properties' \
'*:filesystem/volume:_zfs_dataset -t fs -t vol'
;;
+ ("userspace"|"groupspace")
+ _arguments -A "-*" \
+ '-n[Print numeric ID]' \
+ '-i[Translate SID to POSIX ID]' \
+ '-H[Tab-delimited output with no headers]' \
+ '-p[Parseable mode]' \
+ '-o[Properties to list]:property:_values -s , "property" type name used quota' \
+ '*-s[Sort key (ascending)]:property:_values "property" type name used quota' \
+ '*-S[Sort key (descending)]:property:_values "property" type name used quota' \
+ '-t[Types to list]:type:_values -s , "type" all posixuser smbuser posixgroup smbgroup' \
+ '*:filesystem/volume/snapshot:_zfs_dataset'
+ ;;
+
("mount")
_arguments -A "-*" \
- '-o[mount options]:mount options:_values -s , "option" {,no}{devices,exec,setuid} ro rw' \
- '-O[overlay mount]' \
- '-v[report mount progress]' \
+ '-o[Mount options]:mount options:_values -s , "option" {,no}{devices,exec,setuid} ro rw' \
+ '-O[Overlay mount]' \
+ '-v[Report mount progress]' \
- set1 \
':filesystem:_zfs_dataset -t fs' \
- set2 \
- '-a[mount all available ZFS filesystems]'
+ '-a[Mount all available ZFS filesystems]'
;;
("unmount")
_arguments -A "-*" \
- set1 \
- '-f[force unmount]' \
+ '-f[Force unmount]' \
':filesystem:_zfs_dataset -t fs -t mtpt' \
- set2 \
- '-a[unmount all ZFS filesystems]'
+ '-a[Unmount all ZFS filesystems]'
;;
("share")
_arguments -A "-*" \
- set1 \
- '-a[share all available ZFS filesystems]' \
+ '-a[Share all available ZFS filesystems]' \
- set2 \
':filesystem:_zfs_dataset -t fs'
;;
@@ -188,45 +252,165 @@ _zfs() {
("unshare")
_arguments -A "-*" \
- set1 \
- '-a[unshare all shared ZFS filesystems]' \
+ '-a[Unshare all shared ZFS filesystems]' \
- set2 \
- '-F[force unshare]' \
':filesystem:_zfs_dataset -t fs -t mtpt'
;;
("send")
_arguments -A "-*" \
- '-i[generate an incremental stream]:snapshot:_zfs_dataset -t snap' \
+ '-b' \
+ '-i[Generate an incremental stream]:snapshot:_zfs_dataset -t snap' \
+ '-D[Perform dedup processing]' \
+ '-p[Send properties]' \
+ '-v[Verbose]' \
+ - set1 \
+ '-I[Generate an incremental stream with intermediary snapshots]:snapshot:_zfs_dataset -t snap' \
+ '-R[Generate a replication stream package]' \
+ ':snapshot:_zfs_dataset -t snap' \
+ - set2 \
+ '-c[Create a self-contained stream]' \
+ '-r[Generate a recursive stream package]' \
':snapshot:_zfs_dataset -t snap'
;;
("receive")
_arguments -A "-*" \
- '-v[verbose]' \
- '-n[do not receive the stream]' \
- '-F[force a rollback if necessary]' \
+ '-v[Verbose]' \
+ '-n[Do not receive the stream]' \
+ '-F[Force a rollback if necessary]' \
+ '-u[Filesystem is not mounted]' \
+ '-o[Include property change in the stream]::' \
+ '-x[Exclude property change from the stream]:property:' \
- set1 \
':filesystem/volume/snapshot:_zfs_dataset' \
- set2 \
- '-d[set path prefix]:filesystem:_zfs_dataset -t fs'
+ '(-e)-d[Set path prefix from stream, excluding only pool name]' \
+ '(-d)-e[Set path prefix from stream, using last path element]' \
+ '-:filesystem:_zfs_dataset -t fs'
;;
- ("allow"|"unallow")
- _message "unimplemented zfs subcommand: $service"
+ ("allow")
+ _arguments -A "-*" \
+ - set1 \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set2 \
+ '(-g)-u[User]:user:_users' \
+ '(-u)-g[Group]:group:_groups' \
+ '-l[Allow for named dataset]' \
+ '-d[Allow for descendent datasets]' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set3 \
+ '-e[Everyone]' \
+ '-l[Allow for named dataset]' \
+ '-d[Allow for descendent datasets]' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set4 \
+ '-c[Create-time permissions]' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set5 \
+ '-s[Define or modify permission sets]' \
+ ':setname:' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol'
+ ;;
+
+ ("unallow")
+ _arguments -A "-*" \
+ '-r[Recursive removal]' \
+ - set1 \
+ '-s[Remove permissions from or delete a permission set]:permission set:' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set2 \
+ '(-g)-u[User]:user:_users' \
+ '(-u)-g[Group]:group:_groups' \
+ '-l[Allow for named dataset]' \
+ '-d[Allow for descendent datasets]' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set3 \
+ '-e[Everyone]' \
+ '-l[Allow for named dataset]' \
+ '-d[Allow for descendent datasets]' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol' \
+ - set4 \
+ '-c[Create-time permissions]' \
+ ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol'
;;
("upgrade")
_arguments -A "-*" \
- set1 \
- '-v[verbose]' \
+ '-v[Verbose]' \
- set2 \
- '-a[upgrade all filesystems on all pools]' \
- '-r[upgrade descendent filesystems, too]' \
- '-V[upgrade to specified version]:version:(1 2)' \
+ '-a[Upgrade all filesystems on all pools]' \
+ '-r[Upgrade descendent filesystems, too]' \
+ '-V[Upgrade to specified version]:version:(1 2)' \
- set3 \
- '-r[upgrade descendent filesystems, too]' \
- '-V[upgrade to specified version]:version:(1 2)' \
- ':filesystem:_zfs_dataset -t fs' \
+ '-r[Upgrade descendent filesystems, too]' \
+ '-V[Upgrade to specified version]:version:(1 2)' \
+ ':filesystem:_zfs_dataset -t fs'
+ ;;
+
+ ("hold")
+ _arguments -A "-*" \
+ '-r[Apply hold recursively]' \
+ ':tag:' \
+ ':snapshot:_zfs_dataset -t snap'
+ ;;
+
+ ("holds")
+ _arguments -A "-*" \
+ '-r[List holds recursively]' \
+ ':snapshot:_zfs_dataset -t snap'
+ ;;
+
+ ("release")
+ _arguments -A "-*" \
+ '-r[Release holds recursively]' \
+ ':tag:' \
+ ':snapshot:_zfs_dataset -t snap'
+ ;;
+
+ ("diff")
+ _arguments -A "-*" \
+ '-F[Add column for filetype character]' \
+ '-H[Parseable output]' \
+ '-e[Only show new and changed files]' \
+ '*-o[Show fields]:field:_values "field" $difffields' \
+ '-t[Add column for ctime]' \
+ - set1 \
+ ':snapshot:_zfs_dataset -t snap' \
+ ':snapshot or filesystem:_zfs_dataset -t snap -t fs' \
+ - set2 \
+ '-E[Show difference from empty]' \
+ ':snapshot or filesystem:_zfs_dataset -t snap -t fs'
+ ;;
+
+ ("key")
+ _arguments -A "-*" \
+ - set1 \
+ '-a[Apply to all datasets in all pools]' \
+ '(-u -K -f)-l[Load the encryption key]' \
+ '(-l -K)-u[Unload the encryption key]' \
+ '(-l -u -f)-K[Create a new data encryption key]' \
+ '(-l -K)-f[Unmount the dataset before unloading the encryption key]' \
+ '-r[Apply recursively]' \
+ ':filesystem or volume:_zfs_dataset -t fs -t vol' \
+ - set2 \
+ '-c[Change the encryption key]' \
+ '-o[Change a property]:property:_zfs_keysource_props' \
+ ':filesystem or volume:_zfs_dataset -t fs -t vol'
+ ;;
+
+ ("help")
+ compadd property $subcmds $ro_properties ${rw_properties%%:*}
;;
(*)
diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool
index 9692121ae..0af2ab32d 100644
--- a/Completion/Unix/Command/_zpool
+++ b/Completion/Unix/Command/_zpool
@@ -1,41 +1,91 @@
#compdef zpool
+# Synced with the S11U1 build 19 man page
_zpool() {
- local -a subcmds fields
+ local context state line expl
+ local -a subcmds fields ro_props rw_props versions create_properties_dataset
subcmds=(
- create destroy add remove list iostat status online
- offline clear attach detach replace scrub import export
- upgrade history get set
+ create destroy add remove list iostat status online
+ offline clear attach detach replace scrub import export
+ upgrade history get set split
)
- fields=(
- name\:"Pool name" size\:"Total size" used\:"Space used"
- available\:"Space available" capacity\:"Space used (percentage)"
- health\:"Health status"
+ versions=(
+ ${${${(M)"${(f)$(zpool upgrade -v)}":#[[:space:]]#<->*}##[[:space:]]}%%[[:space:]]*}
)
- properties=(
- "bootfs:value:"
- "autoreplace:value:(on off)"
- "delegation:value:(on off)"
+ ro_props=(
+ "all[All properties]"
+ "allocated[Space allocated]"
+ "capacity[Space used (percentage)]"
+ "dedupratio[Deduplication ratio]"
+ "free[Space unallocated]"
+ "guid[Unique identifier]"
+ "health[Health status]"
+ "size[Total size]"
)
- propnames=( ${properties%%:*} )
-
- import_properties=(
- xattr
- copies
- shareiscsi
- canmount
- share
- sharenfs
- userprop
- mount
+
+ rw_props=(
+ "altroot[Alternate root directory]:value:"
+ "autoexpand[Automatic pool expansion]:value:(on off)"
+ "autoreplace[Automatic device replacement]:value:(on off)"
+ "bootfs[Default bootable dataset]:value:"
+ "cachefile[Pool configuration cache file location]:value:"
+ "dedupditto[Threshold for number of copies]:value:"
+ "delegation[Delegated administration]:value:(on off)"
+ "failmode[Failure-mode behavior]:value:(wait continue panic)"
+ "listsnaps[Show snapshots in 'zfs list']:value:(on off)"
+ "version[Pool version]:version:($versions)"
+ )
+
+ fields=( ${ro_props%%:*} ${rw_props%%:*} )
+
+ create_properties_dataset=(
+ "aclinherit:value:(discard noallow restricted passthrough passthrough-x)"
+ "aclmode:value:(discard mask passthrough)"
+ "atime:value:(on off)"
+ "canmount:value:(on off noauto)"
+ "checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)"
+ "compression:value:(on off lzjb gzip gzip-{1..9} zle)"
+ "copies:value:(1 2 3)"
+ "dedup:value:(on off verify sha256 sha256,verify)"
+ "devices:value:(on off)"
+ "encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)"
+ "exec:value:(on off)"
+ "groupquota@:value:" # TODO: complete group=size|none
+ "keysource:value:_zfs_keysource_props"
+ "logbias:value:(latency throughput)"
+ "mlslabel:value:(none)" # TODO: list sensitivity labels
+ "mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}"
+ "nbmand:value:(on off)"
+ "primarycache:value:(all none metadata)"
+ "quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}"
+ "readonly:value:(on off)"
+ "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
+ "refquota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refquota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refquota' compadd none; fi}"
+ "refreservation:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refreservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refreservation' compadd none; fi}"
+ "reservation:value:{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == reservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'reservation' compadd none; fi}"
+ "rstchown:value:(on off)"
+ "secondarycache:value:(all none metadata)"
+ "setuid:value:(on off)"
+ "shadow:value:" # TODO: complete URI|none
+ "share:share properties:"
+ "sharenfs:value:(on off)"
+ "sharesmb:value:(on off)"
+ "snapdir:value:(hidden visible)"
+ "sync:value:(standard always disabled)"
+ "userquota@:value:" # TODO: complete user=size|none
+ "version:value:(1 2 3 4 current)"
+ "volsize:value:" # <size>
+ "vscan:value:(on off)"
+ "xattr:value:(on off)"
+ "zoned:value:(on off)"
)
if [[ $service == "zpool" ]]; then
_arguments -C -A "-*" \
- '-\?[help]' \
+ '-\?[Help]' \
'*::command:->subcmd' && return 0
if (( CURRENT == 1 )); then
@@ -48,7 +98,9 @@ _zpool() {
case $service in
(clear)
- _arguments \
+ _arguments -A "-*" \
+ '-F[Discard transactions to allow pool opening]' \
+ '-n[With -F, check if discarding transactions would work]' \
':pool name:_zfs_pool' \
'*:virtual device:_files'
;;
@@ -56,38 +108,46 @@ _zpool() {
(create)
# TODO: investigate better vdev handling
_arguments -A "-*" \
- '-f[force use of in-use devices]' \
- '-n[display configuration without creating pool]' \
- '-R[use alternate root]:alternate root:_files -/' \
- '-m[set mountpoint for root dataset]:mountpoint:' \
+ '-B[Create EFI boot partition on whole disks]' \
+ '-o[Set pool property at creation time]:property:_values -s , "property" $rw_props' \
+ '-O[Set dataset property at creation time]:property:_values -s , "property" $create_properties_dataset' \
+ '-f[Force use of in-use devices]' \
+ '-l[Display configuration in /dev/chassis location form]' \
+ '-n[Display configuration without creating pool]' \
+ '-R[Use alternate root]:alternate root:_files -/' \
+ '-m[Set mountpoint for root dataset]:mountpoint:' \
':pool name:' \
'*:virtual device:_files'
;;
(destroy)
_arguments -A "-*" \
- '-f[force active datasets to be unmounted]' \
+ '-f[Force active datasets to be unmounted]' \
':pool name:_zfs_pool'
;;
(add)
_arguments -A "-*" \
- '-f[force use of in-use devices]' \
- '-n[display configuration without modifying pool]' \
+ '-f[Force use of in-use devices]' \
+ '-l[Display configuration in /dev/chassis location form]' \
+ '-n[Display configuration without modifying pool]' \
':pool name:_zfs_pool' \
'*:virtual device:_files'
;;
(list)
_arguments \
- '-H[scripted mode]' \
- '-o[fields to list]:field:_values -s , "field" ${^fields/\:/[}\]' \
+ '-H[Scripted mode]' \
+ '-T[timestamp]:value:(u d)' \
+ '-o[Fields to list]:field:_values -s , "field" $fields' \
'::pool name:_zfs_pool'
;;
(iostat)
_arguments -A "-*" \
- '-v[verbose statistics]' \
+ '-l[Display configuration in /dev/chassis location form]' \
+ '-T[timestamp]:value:(u d)' \
+ '-v[Verbose statistics]' \
'*::pool name:_zfs_pool' \
'::interval:' \
'::count:'
@@ -95,20 +155,23 @@ _zpool() {
(status)
_arguments -A "-*" \
- '-v[verbose information]' \
- '-x[show only unhealthy pools]' \
+ '-l[Display configuration in /dev/chassis location form]' \
+ '-v[Verbose information]' \
+ '-x[Show only unhealthy pools]' \
+ '-T[timestamp]:value:(u d)' \
'*::pool name:_zfs_pool'
;;
(offline)
_arguments -A "-*" \
- '-t[offline until next reboot]' \
+ '-t[Offline until next reboot]' \
':pool name:_zfs_pool' \
'*:virtual device:_files'
;;
(online)
_arguments \
+ '-e[Expand device to use all available space]' \
':pool name:_zfs_pool' \
'*:virtual device:_files'
;;
@@ -116,7 +179,7 @@ _zpool() {
(attach)
# TODO: first device should choose first from existing.
_arguments \
- '-f[force attach, even if in use]' \
+ '-f[Force attach, even if in use]' \
':pool name:_zfs_pool' \
':virtual device:_files' \
':virtual device:_files'
@@ -130,7 +193,7 @@ _zpool() {
(replace)
_arguments -A "-*" \
- '-f[force attach, even if in use]' \
+ '-f[Force attach, even if in use]' \
':pool name:_zfs_pool' \
':virtual device:_files' \
'::virtual device:_files'
@@ -138,57 +201,72 @@ _zpool() {
(scrub)
_arguments -A "-*" \
- '-s[stop scrubbing]' \
+ '-s[Stop scrubbing]' \
'*:pool name:_zfs_pool'
;;
(export)
_arguments -A "-*" \
- '-f[forcefully unmount all datasets]' \
+ '-f[Forcefully unmount all datasets]' \
'*:pool name:_zfs_pool'
;;
(import)
- # TODO: -o should complete options
+ # TODO: -o should complete mount options, too
_arguments -A "-*" \
- '*-d[search for devices or files in directory]:_files -/' \
- '-D[destroyed pools]' \
- '-f[force import]' \
+ '-D[Destroyed pools]' \
+ '(-d)*-c[Use cache file]:cache file:_files' \
+ '(-c)*-d[Search for devices or files in directory]:directory:_files -/' \
+ '-f[Force import]' \
+ '-l[Display configuration in /dev/chassis location form]' \
+ '-m[Ignore missing log devices]' \
+ '-R[Alternate root]:alternate root:_files -/' \
+ '-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \
- set1 \
- '-o[mount options]' \
- '-p[set property]:property:_values -s , "property" $import_properties' \
- '-R[alternate root]:_files -/' \
'*:pool name or id:_zfs_pool' \
'::new pool name:' \
- set2 \
- '-a[all pools]'
+ '-N[Do not mount any filesystems]' \
+ '-a[All pools]'
;;
(get)
_arguments -A "-*" \
- ':property:_values -s , "property" $propnames all' \
+ ':property:_values -s , "property" $fields' \
'*:pool name:_zfs_pool'
;;
(set)
_arguments -A "-*" \
- ':property:_values -s , "property" $properties' \
+ ':property:_values -s , "property" $rw_props' \
'*:pool name:_zfs_pool'
;;
+ (split)
+ _arguments -A "-*" \
+ '-R[Alternate root]:alternate root:_files -/' \
+ '-l[Display configuration in /dev/chassis location form]' \
+ '-n[Display configuration without splitting]' \
+ '-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \
+ ':pool name or id:_zfs_pool' \
+ ':new pool name:' \
+ '*::virtual device:_files -/'
+ ;;
+
(upgrade)
_arguments -A "-*" \
- set1 \
- '-v[display ZFS versions and descriptions]' \
+ '-v[Display ZFS versions and descriptions]' \
- set2 \
- '-a[upgrade all pools]' \
+ "-V[Upgrade to given version]:version:($versions)" \
+ '-a[Upgrade all pools]' \
'*:pool name:_zfs_pool'
;;
(history)
_arguments -A "-*" \
- '-i[display internal events]' \
- '-l[long format]' \
+ '-i[Display internal events]' \
+ '-l[Long format]' \
'*:pool name:_zfs_pool'
;;
diff --git a/Completion/Unix/Type/.distfiles b/Completion/Unix/Type/.distfiles
index 4c0d688ac..4b5102191 100644
--- a/Completion/Unix/Type/.distfiles
+++ b/Completion/Unix/Type/.distfiles
@@ -36,6 +36,7 @@ _pids
_ports
_printers
_ps
+_ps1234
_pspdf
_services
_signals
@@ -49,5 +50,6 @@ _user_at_host
_users
_users_on
_zfs_dataset
+_zfs_keysource_props
_zfs_pool
'
diff --git a/Completion/Unix/Type/_pdf b/Completion/Unix/Type/_pdf
index a2601997b..f20f94e79 100644
--- a/Completion/Unix/Type/_pdf
+++ b/Completion/Unix/Type/_pdf
@@ -1,4 +1,4 @@
-#compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf apvlv
+#compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf apvlv evince epdfview
local expl ext=''
diff --git a/Completion/Unix/Type/_ps1234 b/Completion/Unix/Type/_ps1234
new file mode 100644
index 000000000..13c90b50c
--- /dev/null
+++ b/Completion/Unix/Type/_ps1234
@@ -0,0 +1,109 @@
+#compdef -value-,PROMPT,-default- -value-,PROMPT2,-default- -value-,PROMPT3,-default- -value-,PROMPT4,-default- -value-,RPROMPT,-default- -value-,RPROMPT2,-default- -value-,PS1,-default- -value-,PS2,-default- -value-,PS3,-default- -value-,PS4,-default- -value-,RPS1,-default- -value-,RPS2,-default- -value-,SPROMPT,-default-
+
+local -a specs
+local expl paren
+
+if [[ -n $compstate[quote] ]]; then
+ paren='('
+else
+ paren='\('
+fi
+
+if [[ $PREFIX == *%(-|)<-># ]]; then
+ specs=(
+ 'm:hostname up to first .'
+ '_:status of parser'
+ 'd:current working directory'
+ '/:current working directory'
+ '~:current working directory, with ~ replacement'
+ 'N:name of current script or shell function'
+ 'x:name of file containing code being executed'
+ 'c:deprecated'
+ '.:deprecated'
+ 'C:deprecated'
+ 'F:start using fg color'
+ 'K:start using bg color'
+ 'G:counts as extra character inside %{...%}'
+ )
+ if [[ $PREFIX == *% ]]; then
+ if [[ $service == -value-,SPROMPT,* ]]; then
+ specs+=(
+ 'r:suggested correction'
+ 'R:corrected string'
+ )
+ fi
+ specs+=(
+ '%:A %'
+ '):A )'
+ 'l:current line (tty) with /dev/tty stripped'
+ 'M:full hostname'
+ 'n:username'
+ 'y:current line (tty)'
+ '#:a # when root, % otherwise'
+ '?:return status of last command'
+ 'h:current history event number'
+ '!:current history event number'
+ 'i:current line number'
+ 'I:current source line number'
+ 'j:number of jobs'
+ 'L:$SHLVL'
+ 'D:date in yy-mm-dd format'
+ 'T:current time of day, 24-hour format'
+ 't:current time of day, 12-hour am/pm format'
+ '@:current time of day, 12-hour am/pm format'
+ '*:current time of day, 24-hour format with seconds'
+ 'w:the date in day-dd format'
+ 'W:the date in mm/dd/yy format'
+ 'D{}:format string like strftime'
+ 'B:start bold'
+ 'b:stop bold'
+ 'E:clear to end of line'
+ 'U:start underline'
+ 'u:stop underline'
+ 'S:start standout'
+ 's:stop standout'
+ 'f:reset fg color'
+ 'k:reset bg color'
+ '{:start literal escape sequence'
+ '}:stop literal escape sequence'
+ 'v:value from $psvar array'
+ '(:ternary expression %(x.true-string.false-string)'
+ '<<:truncation from left %len<string<'
+ '>>:truncation from right %len>string>'
+ '[]:truncation from who knows where'
+ )
+ fi
+ compset -P "*"
+ _describe -t prompt-format-specifier 'prompt format specifier' specs -S ''
+ _message -e prompt-format-specifier number
+elif [[ $PREFIX == *%$paren(-|)<-># ]]; then
+ specs=(
+ '!:running with privileges'
+ '#:effective uid'
+ '?:exit status'
+ '_:at least n shell constructs started'
+ 'C:at least n path elements'
+ '/:at least n path elements'
+ '.:at least n path elements'
+ 'c:at least n path elements'
+ '~:at least n path elements'
+ 'D:month'
+ 'd:day of month'
+ 'g:effective gid'
+ 'j:number of jobs'
+ 'L:SHLVL'
+ 'l:number of characters already printed'
+ 'S:SECONDS parameter at least n'
+ 'T:current hour'
+ 't:current minute'
+ 'v:psvar has at least n elements'
+ 'V:element n of psvar is set and non-empty'
+ 'w:day of week (Sunday = 0)'
+ )
+ compset -P "*"
+ _describe -t ternary-prompt-expression 'ternary prompt format test character' specs -S ''
+ _message -e ternary-prompt-expression number
+else
+ _describe -t prompt-format-specifier 'prompt format specifier' '(%)' -S ''
+ _default "$@"
+fi
diff --git a/Completion/Unix/Type/_zfs_dataset b/Completion/Unix/Type/_zfs_dataset
index 1840fb413..d862011ac 100644
--- a/Completion/Unix/Type/_zfs_dataset
+++ b/Completion/Unix/Type/_zfs_dataset
@@ -1,15 +1,64 @@
#autoload
-local -a type typearg list
+local -a type expl_type_arr rsrc rdst paths_allowed
+local -a typearg datasetlist expl mlist
+local expl_type
-zparseopts -D -E -a type t+:
+# -e takes an argument which is passed as as the "descr" argument to _wanted
+# -p indicates that filesystem paths, not just dataset names, are allowed
+# -r1 indicates that we're completing the source of a rename
+# -r2 indicates that we're completing the destination of a rename
+# -t takes arguments (what kinds of datasets) and can appear multiple times
+zparseopts -D -E e:=expl_type_arr p=paths_allowed r1=rsrc r2=rdst t+:=type
-[[ -n $type[(r)fs] ]] && typearg=( filesystem )
-[[ -n $type[(r)vol] ]] && typearg=( $typearg volume )
-[[ -n $type[(r)snap] ]] && typearg=( $typearg snapshot )
-[[ -n $typearg ]] && typearg=( -t ${(j:,:)typearg} )
+[[ -n $type[(r)fs] ]] && typearg=( filesystem )
+[[ -n $type[(r)vol] ]] && typearg=( $typearg volume )
+[[ -n $type[(r)snap] ]] && typearg=( $typearg snapshot )
+if [[ -n $typearg ]]; then
+ typearg=( -t ${(j:,:)typearg} )
+# We know we're in zfs list if paths_allowed is non-empty.
+elif [[ -n $opt_args[-t] && ${#paths_allowed} -gt 0 ]]; then
+ typearg=( -t $opt_args[-t] )
+fi
+
+if [[ ${#paths_allowed} -gt 0 && $PREFIX == /* ]]; then
+ _path_files
+ return
+fi
+
+if [[ ${#rsrc} -gt 0 ]]; then
+ # With the -r option to zfs rename, we can only rename snapshots. With the
+ # -p option, we can only rename filesystems and volumes.
+ if [[ -n $words[(r)-r] ]]; then
+ typearg=( -t snapshot )
+ elif [[ -n $words[(r)-p] ]]; then
+ typearg=( -t filesystem,volume )
+ else
+ typearg=( -t filesystem,snapshot,volume )
+ fi
+fi
-datasetlist=( ${="$(zfs list -H -o name $typearg)":#no datasets available} )
+if [[ ${#rdst} -gt 0 ]]; then
+ if [[ ${words[CURRENT - 1]} == *@* ]]; then
+ # If we're renaming snapshots, there's nothing to complete, so
+ # we simply give instructions. (In non-recursive cases, we
+ # could put the name of the snapshotted dataset first, but why
+ # bother with the long form?)
+ _message -e 'snapshot name (beginning with "@")'
+ return
+ else
+ # The parent dataset must be a filesystem, and can't rename
+ # a dataset into another pool. Plus we hardcode the expl.
+ typearg=( -t fs -r ${${words[CURRENT - 1]}%%/*} )
+ expl_type_arr=( -e "parent dataset" )
+ fi
+fi
+
+if [[ -n $type[(r)clone] ]]; then
+ datasetlist=( ${="$(zfs list -H -o name,origin -t fs | awk "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} )
+else
+ datasetlist=( ${="$(zfs list -H -o name $typearg)":#no datasets available} )
+fi
expl_type=${typearg[2,-1]//,/\/}
if [[ -n $type[(r)mtpt] ]]; then
@@ -18,5 +67,8 @@ if [[ -n $type[(r)mtpt] ]]; then
expl_type="$expl_type/mountpoint"
fi
-# compadd "$@" - $list
-_wanted dataset expl "$expl_type" _multi_parts "$@" / datasetlist
+if [[ -n $expl_type_arr[2] ]]; then
+ expl_type=$expl_type_arr[2]
+fi
+
+_wanted dataset expl "$expl_type" _multi_parts "$@" -q / datasetlist
diff --git a/Completion/Unix/Type/_zfs_keysource_props b/Completion/Unix/Type/_zfs_keysource_props
new file mode 100644
index 000000000..01f63257a
--- /dev/null
+++ b/Completion/Unix/Type/_zfs_keysource_props
@@ -0,0 +1,15 @@
+#autoload
+
+local -a suf
+local expl
+
+compset -S ",*" || suf=(-S ,)
+if compset -P 1 "*,"; then
+ _alternative "zfs-keylocator-prompt:\"prompt\" locator:(prompt)" \
+ "zfs-keylocator-file:file locator:_path_files" \
+ "zfs-keylocator-pkcs11:PKCS#11 locator: " \
+ "zfs-keylocator-https:HTTPS URL locator: "
+else
+ _description format expl "keysource format"
+ compadd $suf -q "$expl[@]" "$@" raw hex passphrase
+fi
diff --git a/Completion/Zsh/Command/_print b/Completion/Zsh/Command/_print
index af0501b7a..405393355 100644
--- a/Completion/Zsh/Command/_print
+++ b/Completion/Zsh/Command/_print
@@ -1,32 +1,84 @@
-#compdef print
-
-local state expl line eflag pflag
-
-# -e flag available only after -R
-eflag="${words[1,CURRENT-1][(r)-*R*]:+-e[enable escapes]}"
-
-# -p flag only relevant if we have a coprocess
-(:>&p) 2>/dev/null &&
- pflag='(-s -u -z)-p[print arguments to input of coprocess]'
-
-_arguments -C -s -A "-*" -S \
- '(-f)-r[ignore escape conventions of echo]' \
- '(-r -b -f -m -s -l -N -o -O -i -c -u -p -z -D -P)-R[emulate BSD echo (no escapes, -n & -e flags only)]' \
- '-b[recognise bindkey escape sequences]' \
- '-m[remove arguments matching specified pattern]' \
- '(-r -n -R -l -N -c)-f+[print arguments as for the printf builtin]:format' \
- '(-u -p -z)-s[place results in the history list]' \
- '(-c -f)-n[do not add a newline to the result]' \
- '(-N -c -f)-l[print arguments separated by newlines]' \
- '(-n -l -c -f)-N[print arguments separated and terminated by nulls]' \
- '(-O)-o[sort arguments in ascending order]' \
- '(-o)-O[sort arguments in descending order]' \
- '-i[case-insensitive sorting]' \
- '(-n -l -N -f -s -z)-a[with -c/-C, print arguments across before down]' \
- '(-n -l -N -f -C -s -z)-c[print arguments in columns]' \
- '(-n -l -N -f -c -s -z)-C+[print arguments in specified number of columns]:columns' \
- '(-s -p -z)-u+[specify file descriptor to print arguments to]:file descriptor:_file_descriptors' \
- '(-s -p -u)-z[push arguments onto editing buffer stack]' \
- '-D[substitute any arguments which are named directories using ~ notation]' \
- '-P[perform prompt expansion]' \
- $pflag $eflag '*:default:_default'
+#compdef print printf
+
+local state expl line eflag pflag rest ret=1
+
+if [[ $service = print ]]; then
+ # -e flag available only after -R
+ eflag="${words[1,CURRENT-1][(r)-*R*]:+-e[enable escapes]}"
+
+ # -p flag only relevant if we have a coprocess
+ (:>&p) 2>/dev/null &&
+ pflag='(-s -u -z)-p[print arguments to input of coprocess]'
+
+ if [[ -n ${words[1,CURRENT][(r)-*P*]} ]]; then
+ rest='*: :_ps1234'
+ else
+ rest='*: :_default'
+ fi
+
+ _arguments -C -s -A "-*" -S \
+ '(-f)-r[ignore escape conventions of echo]' \
+ '(-r -b -f -m -s -l -N -o -O -i -c -u -p -z -D -P)-R[emulate BSD echo (no escapes, -n & -e flags only)]' \
+ '-b[recognise bindkey escape sequences]' \
+ '-m[remove arguments matching specified pattern]' \
+ '(-r -n -R -l -N -c)-f+[print arguments as for the printf builtin]:format:->printfformat' \
+ '(-u -p -z)-s[place results in the history list]' \
+ '(-c -f)-n[do not add a newline to the result]' \
+ '(-N -c -f)-l[print arguments separated by newlines]' \
+ '(-n -l -c -f)-N[print arguments separated and terminated by nulls]' \
+ '(-O)-o[sort arguments in ascending order]' \
+ '(-o)-O[sort arguments in descending order]' \
+ '-i[case-insensitive sorting]' \
+ '(-n -l -N -f -s -z)-a[with -c/-C, print arguments across before down]' \
+ '(-n -l -N -f -C -s -z)-c[print arguments in columns]' \
+ '(-n -l -N -f -c -s -z)-C+[print arguments in specified number of columns]:columns' \
+ '(-s -p -z)-u+[specify file descriptor to print arguments to]:file descriptor:_file_descriptors' \
+ '(-s -p -u)-z[push arguments onto editing buffer stack]' \
+ '-D[substitute any arguments which are named directories using ~ notation]' \
+ '-P[perform prompt expansion]' \
+ $pflag $eflag $rest && ret=0
+elif [[ $service = printf ]]; then
+ state=printf
+fi
+
+if [[ $state = printf ]]; then
+ _arguments -C -s -S \
+ '1:format:->printfformat' \
+ '*: :_default' && ret=0
+fi
+
+if [[ $state = printfformat ]]; then
+ if [[ ${(Q)PREFIX} = *%((-|)<->|[-#0 +*.])# ]]; then
+ local -a specs
+ specs=(
+ '#:alternate form'
+ '0:zeropad to length n'
+ '-:left adjust result'
+ ' :leave one space in front of positive number from signed conversion'
+ '+:always place sign before a number from signed conversion'
+ '*:field width in next argument'
+ '.:precision'
+ 'c:print the first character of the argument'
+ 's:print the argument as a string'
+ {d,i}':signed decimal number or with leading " numeric value of following character'
+ 'o:unsigned octal number'
+ 'u:unsigned decimal number'
+ {x,X}':unsigned hexadecimal number, letters capitalized as x'
+ {e,E}':double number in scientific notation'
+ 'f:double number'
+ {g,G}':double number as %f or %e depending on size'
+ '%:a percent sign'
+ 'n:store number of printed bytes in parameter specified by argument'
+ 'b:as %s but interpret escape sequences in argument'
+ 'q:as %s but shell quote result'
+ )
+ compset -P "*"
+ _describe -t print-format-specifier 'print format specifier' specs -S ''
+ _message -e print-format-specifier 'number'
+ else
+ _describe -t print-format-specifier 'print format specifier' '(%)' -S ''
+ fi
+ ret=0
+fi
+
+return ret
diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset
index 9c9165563..d44783d64 100644
--- a/Completion/Zsh/Command/_typeset
+++ b/Completion/Zsh/Command/_typeset
@@ -75,9 +75,11 @@ if [[ "$state" = vars_eq ]]; then
if (( $+opt_args[-w] ));then
_wanted files expl 'zwc file' _files -g '*.zwc(-.)'
elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then
- args=(${^fpath}/*(:t))
+ args=(${^fpath}/*(-.:t))
# Filter out functions already loaded or marked for autoload.
- args=(${args:#(${(kj.|.)~functions})})
+ local -a funckeys
+ funckeys=(${(k)functions})
+ args=(${args:|funckeys})
_wanted functions expl 'shell function' compadd -a args
else
_functions
diff --git a/Completion/compinit b/Completion/compinit
index 489d662c3..7b8a34619 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -326,7 +326,7 @@ compdef() {
[[ $2 = .menu-select ]] && zmodload -i zsh/complist
zle -C "$1" "$2" "$func"
if [[ -n $new ]]; then
- bindkey "$3" | read -A opt
+ bindkey "$3" | IFS=$' \t' read -A opt
[[ $opt[-1] = undefined-key ]] && bindkey "$3" "$1"
else
bindkey "$3" "$1"
@@ -353,7 +353,7 @@ compdef() {
# And bind the keys...
for i; do
if [[ -n $new ]]; then
- bindkey "$i" | read -A opt
+ bindkey "$i" | IFS=$' \t' read -A opt
[[ $opt[-1] = undefined-key ]] || continue
fi
bindkey "$i" "$func"
@@ -469,7 +469,7 @@ _i_done=''
if [[ -f "$_comp_dumpfile" ]]; then
if [[ -n "$_i_check" ]]; then
- read -rA _i_line < "$_comp_dumpfile"
+ IFS=$' \t' read -rA _i_line < "$_comp_dumpfile"
if [[ _i_autodump -eq 1 && $_i_line[2] -eq $#_i_files &&
$ZSH_VERSION = $_i_line[4] ]]
then
@@ -491,7 +491,7 @@ if [[ -z "$_i_done" ]]; then
_i_name="${_i_file:t}"
(( $+_i_test[$_i_name] + $_i_wfiles[(I)$_i_file] )) && continue
_i_test[$_i_name]=yes
- read -rA _i_line < $_i_file
+ IFS=$' \t' read -rA _i_line < $_i_file
_i_tag=$_i_line[1]
shift _i_line
case $_i_tag in
@@ -527,7 +527,7 @@ zle -la menu-select && zle -C menu-select .menu-select _main_complete
# If the default completer set includes _expand, and tab is bound
# to expand-or-complete, rebind it to complete-word instead.
-bindkey '^i' | read -A _i_line
+bindkey '^i' | IFS=$' \t' read -A _i_line
if [[ ${_i_line[2]} = expand-or-complete ]] &&
zstyle -a ':completion:' completer _i_line &&
(( ${_i_line[(i)_expand]} <= ${#_i_line} )); then
diff --git a/Config/version.mk b/Config/version.mk
index 2035929f4..4832aae11 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=4.3.17
-VERSION_DATE='February 22, 2011'
+VERSION=5.0.0
+VERSION_DATE='July 21, 2012'
diff --git a/Doc/.distfiles b/Doc/.distfiles
index 07263317c..b639949d3 100644
--- a/Doc/.distfiles
+++ b/Doc/.distfiles
@@ -18,4 +18,5 @@ DISTFILES_DOC='
*.html
zsh.dvi
zsh.pdf
+ intro.pdf
'
diff --git a/Doc/Makefile.in b/Doc/Makefile.in
index d30149da0..df3e1410b 100644
--- a/Doc/Makefile.in
+++ b/Doc/Makefile.in
@@ -94,7 +94,7 @@ dvi: zsh.dvi
zsh.dvi: $(sdir)/zsh.texi
$(TEXI2DVI) $(sdir)/zsh.texi
-pdf: zsh.pdf
+pdf: zsh.pdf intro.pdf
.PHONY: pdf
zsh.pdf: $(sdir)/zsh.texi
@@ -104,6 +104,9 @@ zsh.pdf: $(sdir)/zsh.texi
PDFTEX=$(PDFETEX) $(TEXI2DVI) --pdf $(sdir)/zsh.texi; \
fi
+intro.pdf: $(sdir)/intro.ms
+ pdfroff -ms $(sdir)/intro.ms >intro.pdf
+
texi: $(sdir)/zsh.texi
.PHONY: texi
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 5d717479a..98c470a54 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -348,7 +348,7 @@ cindex(compatibility, csh)
cindex(sh, compatibility)
cindex(ksh, compatibility)
cindex(csh, compatibility)
-item(tt(emulate) [ tt(-LR) ] [ {tt(zsh)|tt(sh)|tt(ksh)|tt(csh)} [ tt(-c) tt(arg) ] ])(
+item(tt(emulate) [ tt(-LR) ] [ {tt(zsh)|tt(sh)|tt(ksh)|tt(csh)} [ var(flags) ... ] ])(
Without any argument print current emulation mode.
With single argument set up zsh options to emulate the specified shell
@@ -359,33 +359,48 @@ will be used as a default; more precisely, the tests performed on the
argument are the same as those used to determine the emulation at startup
based on the shell name, see
ifzman(\
-the section `Compatibility' in zmanref(zshmisc)
+the section COMPATIBILITY in zmanref(zsh)
)\
ifnzman(\
noderef(Compatibility)
)\
.
-If the tt(-R) option is given, all options
+If the tt(emulate) command occurs inside a function that has been
+marked for execution tracing with tt(functions -t) then the tt(xtrace)
+option will be turned on regardless of emulation mode or other options.
+Note that code executed inside the function by the tt(.), tt(source), or
+tt(eval) commands is not considered to be running directly from the
+function, hence does not provoke this behaviour.
+
+If the tt(-R) switch is given, all settable options
are reset to their default value corresponding to the specified emulation
mode, except for certain options describing the interactive
environment; otherwise, only those options likely to cause portability
-problems in scripts and functions are altered. If the tt(-L) option is given,
+problems in scripts and functions are altered. If the tt(-L) switch is given,
the options tt(LOCAL_OPTIONS) and tt(LOCAL_TRAPS) will be set as
well, causing the effects of the tt(emulate) command and any tt(setopt) and
tt(trap) commands to be local to the immediately surrounding shell
function, if any; normally these options are turned off in all emulation
-modes except tt(ksh). The tt(-L) and tt(-c) are mutually exclusive.
-
-If tt(-c) tt(arg) is given, evaluate tt(arg) while the requested
-emulation is temporarily in effect. The emulation and all options will
-be restored to their original values before tt(emulate) returns. The
-tt(-R) flag may be used.
+modes except tt(ksh). The tt(-L) switch is mutually exclusive with the
+use of tt(-c) in var(flags).
+
+The var(flags) may be any of the invocation-time flags described in
+ifnzman(noderef(Invocation))\
+ifzman(the section INVOCATION in zmanref(zsh)),
+except that `tt(-o EMACS)' and `tt(-o VI)' may not be used. Flags such
+as `tt(+r)'/`tt(+o RESTRICTED)' may be prohibited in some circumstances.
+If tt(-c) var(arg) appears in var(flags), var(arg) is evaluated while the
+requested emulation is temporarily in effect. In this case the emulation
+mode and all options are restored to their previous values before
+tt(emulate) returns. The tt(-R) switch may precede the name of the shell
+to emulate; note this has a meaning distinct from including tt(-R) in
+var(flags).
Use of tt(-c) enables `sticky' emulation mode for functions defined
within the evaluated expression: the emulation mode is associated
thereafter with the function so that whenever the function is executed
-the emulation (respecting the tt(-R) flag, if present) and all
+the emulation (respecting the tt(-R) switch, if present) and all
options are set before entry to the function, and restored after exit.
If the function is called when the sticky emulation is already in
effect, either within an `tt(emulate) var(shell) tt(-c)' expression or
@@ -427,7 +442,7 @@ within sticky emulation.)
sitem(3.)(No special handling is provided for functions marked for
tt(autoload) nor for functions present in wordcode created by
the tt(zcompile) command.)
-sitem(4.)(The presence or absence of the tt(-R) flag to tt(emulate)
+sitem(4.)(The presence or absence of the tt(-R) switch to tt(emulate)
corresponds to different sticky emulation modes, so for example
`tt(emulate sh -c)', `tt(emulate -R sh -c)' and `tt(emulate csh -c)'
are treated as three distinct sticky emulations.)
diff --git a/Doc/Zsh/cond.yo b/Doc/Zsh/cond.yo
index 71971b4b3..9f8a7d820 100644
--- a/Doc/Zsh/cond.yo
+++ b/Doc/Zsh/cond.yo
@@ -151,6 +151,11 @@ based on ASCII value of their characters.
)
item(var(exp1) tt(-eq) var(exp2))(
true if var(exp1) is numerically equal to var(exp2).
+Note that for purely numeric comparisons use of the
+tt(LPAR()LPAR())var(...)tt(RPAR()RPAR()) builtin described in
+ifzman(the section `ARITHMETIC EVALUATION')\
+ifnzman(noderef(Arithmetic Evaluation)) is more convenient than
+conditional expressions.
)
item(var(exp1) tt(-ne) var(exp2))(
true if var(exp1) is numerically not equal to var(exp2).
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index aee0bd7f4..139a68150 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -999,8 +999,8 @@ endsitem()
In tt(patch-format) and tt(nopatch-format) these replacements are done:
startsitem()
-sitem(tt(%p))(The name of the top-most applied patch.)
-sitem(tt(%u))(The number of unapplied patches.)
+sitem(tt(%p))(The name of the top-most applied patch (tt(applied-string)).)
+sitem(tt(%u))(The number of unapplied patches (tt(unapplied-string)).)
sitem(tt(%n))(The number of applied patches.)
sitem(tt(%c))(The number of unapplied patches.)
sitem(tt(%g))(The names of active tt(mq) guards (tt(hg) backend).)
@@ -1734,6 +1734,16 @@ context is examined and if it contains the string tt(back), the word before
the cursor is considered, else the word after cursor is considered. Some
examples are given below.
+The style tt(skip-whitespace-first) is only used with the
+tt(forward-word) widget. If it is set to true, then tt(forward-word)
+skips any non-word-characters, followed by any non-word-characters:
+this is similar to the behaviour of other word-orientated widgets,
+and also that used by other editors, however it differs from the
+standard zsh behaviour. When using tt(select-word-style) the widget
+is set in the context tt(:zle:*) to tt(true) if the word style is
+tt(bash) and tt(false) otherwise. It may be overridden by setting it in
+the more specific context tt(:zle:forward-word*).
+
Here are some examples of use of the styles, actually taken from the
simplified interface in tt(select-word-style):
@@ -3463,11 +3473,11 @@ game.
)
findex(zargs)
item(tt(zargs) [ var(option) ... tt(-)tt(-) ] [ var(input) ... ] [ tt(-)tt(-) var(command) [ var(arg) ... ] ])(
-This function works like GNU xargs, except that instead of reading lines
-of arguments from the standard input, it takes them from the command line.
-This is useful because zsh, especially with recursive glob operators,
-often can construct a command line for a shell function that is longer
-than can be accepted by an external command.
+This function has a similar purpose to GNU xargs. Instead of
+reading lines of arguments from the standard input, it takes them from
+the command line. This is useful because zsh, especially with recursive
+glob operators, often can construct a command line for a shell function
+that is longer than can be accepted by an external command.
The var(option) list represents options of the tt(zargs) command itself,
which are the same as those of tt(xargs). The var(input) list is the
@@ -3501,7 +3511,15 @@ example(zargs -e.. -- **/*(.) .. ls -l)
This is a good choice in that example because no plain file can be named
`tt(..)', but the best end-marker depends on the circumstances.
-For details of the other tt(zargs) options, see zmanref(xargs) or run
+The options tt(-i), tt(-I), tt(-l), tt(-L), and tt(-n) differ slightly
+from their usage in tt(xargs). There are no input lines for tt(zargs) to
+count, so tt(-l) and tt(-L) count through the var(input) list, and tt(-n)
+counts the number of arguments passed to each execution of var(command),
+em(including) any var(arg) list. Also, any time tt(-i) or tt(-I) is used,
+each var(input) is processed separately as if by `tt(-L) tt(1)'.
+
+For details of the other tt(zargs) options, see zmanref(xargs) (but note
+the difference in function between tt(zargs) and tt(xargs)) or run
tt(zargs) with the tt(-)tt(-help) option.
)
findex(zed)
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 25c44f331..8afd92532 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -604,6 +604,19 @@ If var(name) is an array
the matching array elements are removed (use the `tt((M))' flag to
remove the non-matched elements).
)
+item(tt(${)var(name)tt(:|)var(arrayname)tt(}))(
+If var(arrayname) is the name (N.B., not contents) of an array
+variable, then any elements contained in var(arrayname) are removed
+from the substitution of var(name). If the substitution is scalar,
+either because var(name) is a scalar variable or the expression is
+quoted, the elements of var(arrayname) are instead tested against the
+entire expression.
+)
+item(tt(${)var(name)tt(:*)var(arrayname)tt(}))(
+Similar to the preceding subsitution, but in the opposite sense,
+so that entries present in both the original substitution and as
+elements of var(arrayname) are retained and others removed.
+)
xitem(tt(${)var(name)tt(:)var(offset)tt(}))
item(tt(${)var(name)tt(:)var(offset)tt(:)var(length)tt(}))(
This syntax gives effects similar to parameter subscripting
@@ -1954,6 +1967,9 @@ item(tt(I))(
Case sensitive: locally negates the effect of tt(i) or tt(l) from
that point on.
)
+vindex(match)
+vindex(mbegin)
+vindex(mend)
item(tt(b))(
Activate backreferences for parenthesised groups in the pattern;
this does not work in filename generation. When a pattern with a set of
@@ -2022,6 +2038,9 @@ matches; tt(LPAR()#c,)var(M)tt(RPAR()) is equivalent to specifying var(N)
as 0; tt(LPAR()#c)var(N)tt(,RPAR()) specifies that there is no maximum
limit on the number of matches.
)
+vindex(MATCH)
+vindex(MBEGIN)
+vindex(MEND)
item(tt(m))(
Set references to the match data for the entire string matched; this is
similar to backreferencing and does not work in filename generation. The
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index dd237c0ef..3114ecc05 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -313,8 +313,9 @@ pindex(NO_HASH_LIST_ALL)
pindex(HASHLISTALL)
pindex(NOHASHLISTALL)
item(tt(HASH_LIST_ALL) <D>)(
-Whenever a command completion is attempted, make sure the entire
-command path is hashed first. This makes the first completion slower.
+Whenever a command completion or spelling correction is attempted, make
+sure the entire command path is hashed first. This makes the first
+completion slower but avoids false reports of spelling errors.
)
pindex(LIST_AMBIGUOUS)
pindex(NO_LIST_AMBIGUOUS)
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index e9a3c722d..5991921f8 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -226,6 +226,7 @@ example (assuming the option tt(KSH_ARRAYS) is not in effect):
example([[ ${array[(i)pattern]} -le ${#array} ]])
If tt(KSH_ARRAYS) is in effect, the tt(-le) should be replaced by tt(-lt).
+)
item(tt(R))(
Like `tt(r)', but gives the last match. For associative arrays, gives
all possible matches. May be used for assigning to ordinary array
@@ -244,7 +245,6 @@ required; using a parameter to hold the key has the desired effect:
example(key2='original key'
print ${array[(Re)$key2]})
)
-)
item(tt(i))(
Like `tt(r)', but gives the index of the match instead; this may not be
combined with a second argument. On the left side of an assignment,
@@ -1003,6 +1003,10 @@ and replaces the tt(SUNKEYBOARDHACK) option which did this for
backquotes only. Should the chosen character be one of singlequote,
doublequote or backquote, there must also be an odd number of them
on the command line for the last one to be removed.
+
+For backward compabitility, if the tt(SUNKEYBOARDHACK) option is
+explicitly set, the value of tt(KEYBOARD_HACK) reverts to backquote.
+If the option is explicitly unset, this variable is set to empty.
)
vindex(KEYTIMEOUT)
item(tt(KEYTIMEOUT))(
@@ -1099,6 +1103,22 @@ whose value is not used by the shell. The tt(manpath)
array can be useful, however, since setting it also sets
tt(MANPATH), and vice versa.
)
+xitem(tt(match))
+xitem(tt(mbegin))
+item(tt(mend))(
+Arrays set by the shell when the tt(b) globbing flag is used in pattern
+matches. See the subsection em(Globbing flags) in
+ifzman(the documentation for em(Filename Generation) in zmanref(zshexpn))\
+ifnzman(noderef(Filename Generation)).
+)
+xitem(tt(MATCH))
+xitem(tt(MBEGIN))
+item(tt(MEND))(
+Set by the shell when the tt(m) globbing flag is used in pattern
+matches. See the subsection em(Globbing flags) in
+ifzman(the documentation for em(Filename Generation) in zmanref(zshexpn))\
+ifnzman(noderef(Filename Generation)).
+)
vindex(module_path)
vindex(MODULE_PATH)
item(tt(module_path) <S> <Z> (tt(MODULE_PATH) <S>))(
@@ -1283,7 +1303,7 @@ the workaround `tt(TERM=$TERM)' unnecessary.
vindex(TIMEFMT)
item(tt(TIMEFMT))(
The format of process time reports with the tt(time) keyword.
-The default is `tt(%E real %U user %S system %P %J)'.
+The default is `tt(%J %U user %S system %P cpu %*E total)'.
Recognizes the following escape sequences, although not all
may be available on all systems, and some that are available
may not be useful:
@@ -1296,12 +1316,12 @@ sitem(tt(%E))(Elapsed time in seconds.)
sitem(tt(%P))(The CPU percentage, computed as
(100*tt(%U)PLUS()tt(%S))/tt(%E).)
sitem(tt(%W))(Number of times the process was swapped.)
-sitem(tt(%X))(The average amount in (shared) text space used in Kbytes.)
+sitem(tt(%X))(The average amount in (shared) text space used in kilobytes.)
sitem(tt(%D))(The average amount in (unshared) data/stack space used in
-Kbytes.)
-sitem(tt(%K))(The total space used (%X+%D) in Kbytes.)
+kilobytes.)
+sitem(tt(%K))(The total space used (%X+%D) in kilobytes.)
sitem(tt(%M))(The maximum memory the process had in use at any time in
-Kbytes.)
+megabytes.)
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.)
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index d3624b1ce..3e8c25a90 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -877,6 +877,12 @@ any predisplay string should be highlighted in bold.
Note that the effect of tt(region_highlight) is not saved and disappears
as soon as the line is accepted.
)
+vindex(UNDO_CHANGE_NO)
+item(tt(UNDO_CHANGE_NO) (integer))(
+A number representing the state of the undo history. The only use
+of this is passing as an argument to the tt(undo) widget in order to
+undo back to the recorded point. Read-only.
+)
vindex(WIDGET)
item(tt(WIDGET) (scalar))(
The name of the widget currently being executed; read-only.
@@ -902,11 +908,20 @@ item(tt(ZLE_STATE) (scalar))(
Contains a set of space-separated words that describe the current tt(zle)
state.
-Currently, the only state shown is the insert mode as set by the
-tt(overwrite-mode) or tt(vi-replace) widgets. The string contains
-`tt(insert)' if characters to be inserted on the command line move existing
-characters to the right, `tt(overwrite)' if characters to be inserted
-overwrite existing characters.
+Currently, the states shown are the insert mode as set by the
+tt(overwrite-mode) or tt(vi-replace) widgets and whether history commands
+will visit imported entries as controlled by the set-local-history widget.
+The string contains `tt(insert)' if characters to be inserted on the
+command line move existing characters to the right or `tt(overwrite)'
+if characters to be inserted overwrite existing characters. It contains
+`tt(localhistory)' if only local history commands will be visited or
+`tt(globalhistory)' if imported history commands will also be visited.
+
+The substrings are sorted in alphabetical order so that if you want to
+test for two specific substrings in a future-proof way, you can do match
+by doing:
+
+example(if [[ $ZLE_STATE == *insert*globalhistory* ]]; then ...; fi)
)
enditem()
@@ -1464,6 +1479,13 @@ Search forward in the history for a line beginning with the current
line up to the cursor.
This leaves the cursor in its original position.
)
+tindex(set-local-history)
+item(tt(set-local-history))(
+By default, history movement commands visit the imported lines as well as
+the local lines. This widget lets you toggle this on and off, or set it with
+the numeric argument. Zero for both local and imported lines and nonzero for
+only local lines.
+)
enditem()
texinode(Modifying Text)(Arguments)(History Control)(Zle Widgets)
subsect(Modifying Text)
@@ -2164,7 +2186,10 @@ command is typed. By default it beeps.
)
tindex(undo)
item(tt(undo) (^_ ^Xu ^X^U) (unbound) (unbound))(
-Incrementally undo the last text modification.
+Incrementally undo the last text modification. When called from a
+user-defined widget, takes an optional argument indicating a previous state
+of the undo history as returned by the tt(UNDO_CHANGE_NO) variable;
+modifications are undone until that state is reached.
)
tindex(redo)
item(tt(redo))(
diff --git a/Doc/intro.ms b/Doc/intro.ms
index f4f7062d0..fcca33dd8 100644
--- a/Doc/intro.ms
+++ b/Doc/intro.ms
@@ -135,7 +135,7 @@ run303
run123\0\0run2
%\0ls\0run<300->
run303
-%\0ls\0run<>
+%\0ls\0run<->
run123\0\0run2\0\0\0\0run234\0\0run240\0\0run303
.De
The \fINUMERICGLOBSORT\fP option will sort files with numbers
@@ -143,7 +143,7 @@ according to the number. This will not work with \fCls\fP as it
resorts its arguments:
.Ds
%\0setopt\0numericglobsort
-%\0echo\0run<>
+%\0echo\0run<->
run2\0run123\0run234\0run240\0run303
.De
Grouping is possible:
@@ -692,12 +692,12 @@ by setting a few more options and parameters:
2\0\0\0\0\0\0\0/usr/bin
3\0\0\0\0\0\0\0/usr
4\0\0\0\0\0\0\0~
-/tmp>\0ls\0=2/df
+/tmp>\0ls\0~2/df
/usr/bin/df
/tmp>\0cd\0-4
~>
.De
-Note that \fC=2\fP expanded to the second directory in the
+Note that \fC~2\fP expanded to the second directory in the
history list, and that \fCcd -3\fP recalled the third
directory in the list.
.PP
@@ -2282,11 +2282,20 @@ The same is true of \fBCDPATH\fP and \fBcdpath\fP:
In general, predefined parameters with names in all lowercase are
arrays; assignments to them take the form:
.Ds
-\fIname\fR\fC=(\fR\0\fIelem\fR\0...\\0\fC)\fR
+\fIname\fR\fC=(\fR\0\fIelem\fR\0...\0\fC)\fR
.De
Predefined parameters with names in all uppercase are strings. If
there is both an array and a string version of the same parameter, the
-string version is a colon-separated list, like \fBPATH\fP.
+string version is a colon-separated list, like \fBPATH\fP. You can use
+.Ds
+%\0typeset\0-T\0FOO\0foo
+.De
+to create more of these yourself.
+.Ds
+%\0foo=(\0a\0b\0c\0)
+%\0echo\0$FOO
+a:b:c
+.De
.PP
\fBHISTFILE\fP is the name of the history file, where the history
is saved when a shell exits.
@@ -2314,7 +2323,7 @@ exit
\0\0\029\0\0HISTSIZE=3
\0\0\030\0\0history
.De
-If you have several incantations of \fBzsh\fP running at the same
+If you have several instances of \fBzsh\fP running at the same
time, like when using the X window system, it might be preferable to
append the history of each shell to a file when a shell exits instead
of overwriting the old contents of the file. You can get this
@@ -2432,6 +2441,7 @@ and command line while leaving command output unhighlighted, try this:
%\0POSTEDIT=`echotc\0se`
%\0PROMPT='%S%%\0'
.De
+This trick is mostly superceded by the zle_highlight array parameter.
.Sh "Login/logout watching"
.PP
You can specify login or logout events to monitor
@@ -2595,10 +2605,14 @@ in csh.
zsh:\0unmatched\0'
.De
\fIGLOBDOTS\fP lets files beginning with a \fC.\fP be matched without
-explicitly specifying the dot.
+explicitly specifying the dot. This can also be specified for a particular
+pattern by appending (D) to it.
.Ds
%\0ls\0-d\0*x*
Mailboxes
+%\0ls\0-d\0*x*(D)
+\&.exrc\0\0\0\0\0\0\0\0\0.pnewsexpert\0\0.xserverrc
+\&.mushexpert\0\0\0.xinitrc\0\0\0\0\0\0Mailboxes
%\0setopt\0globdots
%\0ls\0-d\0*x*
\&.exrc\0\0\0\0\0\0\0\0\0.pnewsexpert\0\0.xserverrc
diff --git a/Etc/.distfiles b/Etc/.distfiles
index 1f31e7acb..0f64a1fc3 100644
--- a/Etc/.distfiles
+++ b/Etc/.distfiles
@@ -10,6 +10,7 @@ FAQ
FAQ.yo
FTP-README
Makefile.in
+NEWS-4.3
STD-TODO TODO
changelog2html.pl
completion-style-guide
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index ee79a6ac4..eb1399b0f 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -52,8 +52,8 @@ myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2010/02/15)
COMMENT(-- the following are for Usenet and must appear first)\
description(\
mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 2010/02/15
-mydit(Submitted-By:) email(pws@pwstephenson.fsnet.co.uk (Peter Stephenson))
+mydit(Last-Modified:) 2012/06/15
+mydit(Submitted-By:) email(coordinator@zsh.org (Peter Stephenson))
mydit(Posting-Frequency:) Monthly
mydit(Copyright:) (C) P.W. Stephenson, 1995--2010 (see end of document)
)
@@ -301,13 +301,9 @@ sect(On what machines will it run?)
sect(What's the latest version?)
- Zsh 4.2.7 is the latest production version. The latest development
- version is 4.3.17; this contains support for multibyte character strings
- (such as UTF-8 locales). All the main features for multibyte
- support are now in place and this is likely soon to become the
- stable series 5.0.
-
- There will not be any further 4.2 releases.
+ Zsh 5.0.0 is the latest production version, replacing the now
+ rather antiquated 4.2.7. 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
patch by patch, with each intermediate version publicly available. Note
@@ -722,7 +718,7 @@ label(23)
appear inside the tt({ }) the way they get appended to an alias.
myeit() If the csh alias references its own name (tt(alias rm "rm -i")),
- then in a zsh function you need the "command" keyword
+ then in a zsh function you need the "command" or "builtin" keyword
(function tt(rm() { command rm -i "$@" })), but in a zsh alias
you don't (tt(alias rm="rm -i")).
@@ -2292,8 +2288,9 @@ Wischnowsky).
nsect(Copyright Information:)
This document is copyright (C) P.W. Stephenson, 1995, 1996, 1997,
-1998, 1999, 2000. This text originates in the U.K. and the author asserts
-his moral rights under the Copyrights, Designs and Patents Act, 1988.
+1998, 1999, 2000, 2012. This text originates in the U.K. and the author
+asserts his moral rights under the Copyrights, Designs and Patents Act,
+1988.
Permission is hereby granted, without written agreement and without
license or royalty fees, to use, copy, modify, and distribute this
diff --git a/Etc/NEWS-4.3 b/Etc/NEWS-4.3
new file mode 100644
index 000000000..19b3daada
--- /dev/null
+++ b/Etc/NEWS-4.3
@@ -0,0 +1,356 @@
+This file describes changes made during the 4.3 series of releases;
+it is superseded by the description of changes between 4.2 and 5.0
+in the main NEWS file.
+
+
+Changes since 4.3.15
+--------------------
+
+The option HASH_EXECUTABLES_ONLY has been added. When this is set,
+directories in the command path will be checked for executables before
+they are added to the command table (hash); otherwise, all files in the
+directory are added. The effect of this option was present in 4.3.15,
+which could cause significant delays when hashing on systems with
+network directories in the path.
+
+Changes since 4.3.12
+--------------------
+
+There are no significant feature changes to the shell itself, although
+many bug fixes and improvements to functions.
+
+Changes since 4.3.11
+--------------------
+
+The zsh/parameter module has a new readonly associative array
+$usergroups whose keys are the names of system groups of which the
+current user is a member and whose values are the corresponding
+group identifiers.
+
+The region_highlight array, which controls highlighting of the
+command line from zle widgets, is now updated dynamically as
+the command line is edited.
+
+In POSIX emulation ("emulate sh") the shell is more accurate about
+when it should or should not exit on errors.
+
+The ${NAME:OFFSET:LENGTH} syntax now supports negative LENGTH, which
+counts back from the end of the string.
+
+The (g:opts:) flag in parameter expansion processes escape sequences like
+the echo and print builtins. opts can be any combination of o, e and c.
+With e, acts like print rather than echo except for octal escapes which
+are controlled separately by the o option. With c, interpret control
+sequences like "^X" as bindkey does. Regardless of the opts, \c is not
+interpreted.
+
+Changes between versions 4.3.10 and 4.3.11
+------------------------------------------
+
+When the shell is invoked with the base name of a script, for example as
+`zsh scriptname', previous versions of zsh have used the name directly,
+whereas other shells use the value of $PATH to find the script. The
+option PATH_SCRIPT has been added to provide the alternative behaviour.
+This is turned on where appropriate in compatibility modes.
+
+Parameters, globbing, etc.
+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+Parameter expansion has been enhanced to provide the ${NAME:OFFSET} and
+${NAME:OFFSET:LENGTH} syntax for substrings and subarrays present in
+several other shells. OFFSET always uses zero-based indexing. The only
+clash with existing zsh syntax occurs if OFFSET begins with an
+alphabetic character or `&', which is not likely.
+
+The (D) flag in parameter expansion abbreviates directories in the
+substituted value. The (q-) flag does minimal shell quotation of arguments
+for maximum human readability of the result.
+
+The (Z) flag in parameter expansion is an enhanced version of the (z)
+flag that takes an argument indicating how the string to be split
+is treated. (Z:c:) parses comments as strings; (Z:C:) parses comments
+and strips them; (Z:n:) treats newlines as ordinary whitespace: (z)
+has always treated unquoted newlines as shell delimiters and turned them
+into semicolons, though this was not previously documented.
+
+Numeric expansion with braces has been extended so that a step may be
+given, as in {3..9..2}. The step may be negative as may the start and
+end of the range (this is also new).
+
+The glob qualifier P can be used to add a separate word before each
+match. For example, *(P:-f:) produces the command line
+`-f file1 -f file2 ...'.
+
+Regular expression matches now use the same variables for storing matched
+components as shell pattern matching. The function system now provides the
+function regexp-replace for replacing text using regular expressions. The
+zle widget functions replace-string, replace-string-again, if defined with
+regex in the name (e.g. "zle -N replace-regexp replace-string"), perform
+regular expression matches. In replacement text \& and \1 have the
+standard meaning.
+
+Line editor and completion
+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+The completion system now has a style path-completion. Setting this to
+false inhibits completion of paths before the current path component,
+e.g. /u/b/z no longer completes to /usr/bin/zsh. This is useful on systems
+where this form of completion is pathologically slow due to network
+performance.
+
+With the MULTIBYTE option, the line editor now highlights bytes in the
+input that are not part of a valid character in the current locale in hex
+as <XX> for hex digits X; highlighting is controlled by the "special"
+keyword in the zle_highlight array. These can be distinguished from
+unprintable Unicode characters which also use "special" highlighting as the
+latter are always two or four bytes long, e.g. <XXXX>, <XXXXXXXX>.
+
+zle_highlight also controls highlighting of a removable completion
+suffix, e.g. the "/" automatically appended to directories. This uses
+the keyword "suffix".
+
+The line editor now sets the variable ZLE_LINE_ABORTED if there is
+an error when editing the line. The following code can be used
+to create a bindable editor widget to restore the aborted line:
+ recover-line() { LBUFFER=$ZLE_LINE_ABORTED RBUFFER=; }
+ zle -N recover-line
+and then either bind recover-line to a key sequence or use
+`M-x recover-line <RET>'.
+
+The parameter ZLE_STATE, available in user-defined line editor widgets,
+gives information on the state of the line editor. Currently this is
+whether the line editor is in insert or overwrite mode.
+
+Miscellaneous options
+-+-+-+-+-+-+-+-+-+-+-
+
+The new shell option HIST_LEX_WORDS causes history lines read in from
+a file to be split in the same way as normal shell lines, instead of
+simply on whitespace. It's an option as although the result is more
+accurate it can take a long time when the history size is large.
+
+The shell option MONITOR can be set in non-interactive shells, and also in
+subshells (as created by surrounding commands with parentheses), turning on
+job control for that subshell. The initial behaviour of a subshell is
+still to turn job control off, however if the new POSIX_JOBS option is set
+MONITOR remains active in subshells.
+
+The new shell option POSIX_CD, active in emulations of POSIX-based shells,
+makes the cd builtin POSIX-compatible.
+
+The POSIX_JOBS option already referred to has various other
+compatibility enchancements.
+
+The new shell option POSIX_STRINGS makes a null character in $'...'
+expansion terminate the string, as is already the case in bash. This is
+not particularly useful behaviour but may become a POSIX requirement.
+
+The new shell option POSIX_TRAPS causes the EXIT trap to behave in the same
+way as in other shells, i.e. it is only run when the shell exits.
+
+The new shell option SOURCE_TRACE causes the shell to report files
+containing shell code that the shell executes directly, i.e. startup files
+or files run with the `source' or `.' builtins.
+
+The shell option SUN_KEYBOARD_HACK has been supplemented by a more general
+mechanism: the KEYBOARD_HACK variable defines the character to be ignored.
+
+Add-on modules and function
+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+
+The module zsh/system has a new "zsystem" builtin whose subcommands perform
+system level tasks. Currently "zsystem flock" performs advisory file
+locking (for aficionados, this uses the fcntl() system call so works over
+the network on Linux). This is a particularly convenient way of locking
+files for the length of a subshell. "zsystem supports flock" provides a
+test for this feature.
+
+There is now a function system for recording and restoring recently
+entered directories in a persistent fashion, with support in completion
+and (if explicitly installed) dynamic directory expansion. See the
+entry for cdr in the zshcontrib manual page.
+
+
+Changes between versions 4.3.9 and 4.3.10
+-----------------------------------------
+
+The command "emulate <mode> -c ..." evaluates an expression in a given
+emulation. The emulation is sticky for functions defined within the
+expression.
+
+The variable CORRECT_IGNORE gives a pattern that can be ignored
+in spelling correction. CORRECT_IGNORE='_*' ignores completion functions.
+
+The option POSIX_ALIASES improves compatibility of aliases with other
+shells.
+
+The variable ZSH_PATCHLEVEL can be used to test for unreleased versions of
+the shell; it is present but less useful in released versions.
+
+The variables ZLE_REMOVE_SUFFIX_CHARS and ZLE_SPACE_SUFFIX_CHARS allow more
+control over the way automatically removed suffixes are treated in
+completion.
+
+Major changes between versions 4.3.6 and 4.3.9
+----------------------------------------------
+
+The option COMBINING_CHARS has been added. When it is set, the
+line editor assumes the terminal is capable of displaying zero-width
+combining characters (typically accents) correctly as modifications
+to the base character, and will act accordingly. Note it is not set
+by default owing to vagaries of terminals. The system is reported
+to work on MacOS, where this is particularly important as accented
+characters in file names are stored in their decomposed form (i.e.
+with base and combining characters).
+
+The option HIST_FCNTL_LOCK has been added to provide locking of history
+files using the system call fcntl(). On recent NFS implementations this
+may provide better reliability.
+
+The syntax ~[...] provides a dynamic form of directory naming,
+supplementing the existing static ~name syntax. A user-defined shell
+function, zsh_directory_name, is used to handle both expansion of names to
+directories and contraction of directories to names.
+
+Patterns can now be used in incremental searches with the new widgets
+history-incremental-pattern-search-backward and
+history-incremental-pattern-search-forward. These are not bound to
+keys by default.
+
+Highlighting and colouring of sections of the command line is now
+supported, controlled by the array parameter zle_highlight and the ZLE
+special parameter region_highlight.
+
+Colouring of prompts is now supported within the shell by prompt
+escapes. The prompt theme system has been updated.
+
+Various changes have been added to make debugging of shell code easier:
+ - As noted in README, the option DEBUG_BEFORE_CMD is now set by default.
+ - In DEBUG traps, $ZSH_DEBUG_CMD gives the code for which the trap is
+ called as a string.
+ - "setopt ERR_EXIT" in a DEBUG trap causes the code not to be executed.
+ - $ZSH_SUBSHELL indicates the subshell level at which code is being
+ executed.
+ - The zsh/parameter module has various additional arrays similar to
+ the existing $funcstack and $functrace, namely $funcsourcetrace
+ and $funcfiletrace. The consistency and informativeness of
+ the output of all these arrays has been improved.
+ - Prompt escapes %x and %I show the source file and line number in
+ debug prompts (compare %N and %i which show names and line numbers
+ in the execution environment).
+ - The option NO_MULTI_FUNCDEF can turn off multiple definition of
+ functions at once, a rarely used feature that can cause problems
+ with misplaced "()".
+ - The "fc" builtin has been enhanced to make non-interactive use possible
+ and output consistent when the history is manipulated with "print -s".
+
+The completion style accept-exact-dirs has been added. When true, this
+suppresses attempts to complete non-final directory segments of a filename
+path when the directory exists. (For example, /home/pws/src/zsh/<TAB>
+discovers that /home/pws/src/zsh exists and leaves the directory component
+alone, while /h/p/s/z/<TAB> completes to /home/pws/src/zsh/... as before.)
+This should improve completion behaviour noticeably in special cases, such
+as remote paths under Cygwin.
+
+Major changes between versions 4.3.5 and 4.3.6
+----------------------------------------------
+
+cd, chdir, pushd and popd now take a -q option to suppress side effects
+including printing the directory stack (for pushd and popd) and executing
+the chpwd hook functions (for all four).
+
+The parameter subscript (e) flag now forces the argument to be treated
+as a string where it would previously have been treated as a pattern,
+for example ${array[(ie)*]} substitutes the index of the element whose
+value is "*".
+
+Major changes between versions 4.3.4 and 4.3.5
+----------------------------------------------
+
+- The new extended globbing flag (#cN,M) behaves similarly to the extended
+ regular expression syntax {N,M}.
+
+- The zsh/datetime module has been enhanced and a calendar function
+ system has been added along the lines of (but much enhanced from)
+ the traditional Unix "calendar" utility. This is still under
+ development. See the zshcalsys manual. (The calendar functions
+ were in 4.3.4 but were not listed in this file. There have been
+ significant enhancements since 4.3.4.)
+
+- A new module zsh/curses provides a builtin zcurses for access to
+ to the curses screen manipulation package. See the entry for zsh/curses
+ in the zshmodules manual.
+
+- The module system has been enhanced to support the notion of "features"
+ that give more control over which builtins, parameters, conditions
+ and math functions are loaded from a module. In particular,
+ "zmodload -F zsh/stat b:zstat" makes the builtin previously called
+ "stat" available as "zstat" (only) to avoid clashes with a system
+ command named "stat".
+
+Major changes between versions 4.2 and 4.3.4
+--------------------------------------------
+
+- There is support for multibyte character sets. This is now reasonably
+ close to complete, although Unicode combining characters don't work
+ properly. See Multibyte Character Support in INSTALL.
+
+- The shell can now run an installation function for a new user
+ (a user with no .zshrc, .zshenv, .zprofile or .zlogin file) without
+ any additional setting up by the administrator. See "THE ZSH/NEWUSER
+ MODULE" in the zshmodules manual page.
+
+- The manual now has a Roadmap section (manual page zshroadmap) to
+ give new users an indication of the most interesting parts of the
+ manual.
+
+- New option PROMPT_SP (on by default): works around the problem that the
+ line editor can overwrite output with no newline at the end. See the
+ zshoptions manual page.
+
+- New option HIST_SAVE_BY_COPY (on by default): history is saved by
+ copying and renaming instead of directly overwriting. See the
+ zshoptions manual page.
+
+- New redirection syntax e.g. {myfd}>file opens a new file descriptor
+ and stores the number in $myfd, so that >&$myfd will work. Chosen
+ not to break existing code (and to be compatible with proposals for the
+ Korn shell). See the section REDIRECTION in the zshmisc manual page.
+
+- Substitutions of the form ${var:-"$@"}, ${var:+"$@"} and similar where
+ word-splitting is applied to the text after the :- or :+ (in particular,
+ where the SH_WORD_SPLIT option is in effect for compatibility) now
+ behave as in other Bourne- and POSIX-compatible shells when in the
+ appropriate emulation mode.
+
+- New Posix-style zsh-specific tests [[:IDENT:]], [[:IFS:]],
+ [[:IFSSPACE:]], [[:WORD:]] test if character can appear in identifier,
+ is an IFS character, is an IFS whitespace character, or is considered
+ as part of a word (is alphanumeric or appears in $WORDCHARS). These
+ works correctly on multibyte characters if the appropriate support
+ is present. See the section FILENAME GENERATION in the zshexpn
+ manual page.
+
+- Time comparisons on files when sorting or using test operators will
+ use high-resolution timestamps when available. This gives a
+ resolution of a nanosecond instead of a second.
+
+- The idiom =(<<<...) is optimised so that the shell internally turns
+ the ... into the contents of a file whose name is then substituted.
+ The syntax has always been usable by means of the NULLCMD feature,
+ but previously it generated an intermediate process; it has now
+ been rewritten along the same lines as the optimisation for $(<...)
+ that inserts a file into the command line without the use of an
+ external programme.
+
+- Supplied functions catch and throw provide limited support for
+ exception handling using the `{ ... } always { ... }' syntax.
+ See the section EXCEPTION HANDLING in the zshcontrib manual page.
+
+- Signals now accept the SIG as part of the name for compatibility with
+ other shells.
+
+- Editor function argument-base allows non-decimal arguments for
+ editor widgets. See the entry in the zshzle manual page.
+
+- As always, there are many enhancements to completion functions.
diff --git a/FEATURES b/FEATURES
index 9b0d0c29d..29d896558 100644
--- a/FEATURES
+++ b/FEATURES
@@ -2,6 +2,10 @@
ZSH FEATURES
------------
+(Note that this file only lists basic shell features, for those who
+may not have encountered zsh before. Those familiar with zsh are
+unlikely to find anything new here.)
+
very close to ksh/sh grammar, with csh additions
most features of ksh, bash, and tcsh
can emulate ksh or POSIX sh
diff --git a/Functions/Misc/add-zsh-hook b/Functions/Misc/add-zsh-hook
index c49688643..ee37d674d 100644
--- a/Functions/Misc/add-zsh-hook
+++ b/Functions/Misc/add-zsh-hook
@@ -19,12 +19,13 @@ hooktypes=(
chpwd precmd preexec periodic zshaddhistory zshexit
zsh_directory_name
)
+local usage="Usage: $0 hook function\nValid hooks are:\n $hooktypes"
local opt
local -a autoopts
-integer del
+integer del list help
-while getopts "dDUzk" opt; do
+while getopts "dDhLUzk" opt; do
case $opt in
(d)
del=1
@@ -34,6 +35,14 @@ while getopts "dDUzk" opt; do
del=2
;;
+ (h)
+ help=1
+ ;;
+
+ (L)
+ list=1
+ ;;
+
([Uzk])
autoopts+=(-$opt)
;;
@@ -45,9 +54,12 @@ while getopts "dDUzk" opt; do
done
shift $(( OPTIND - 1 ))
-if (( $# != 2 || ${hooktypes[(I)$1]} == 0 )); then
- print "Usage: $0 hook function\nValid hooks are:\n $hooktypes"
- return 1
+if (( list )); then
+ typeset -mp "(${1:-${(@j:|:)hooktypes}})_functions"
+ return $?
+elif (( help || $# != 2 || ${hooktypes[(I)$1]} == 0 )); then
+ print -u$(( 2 - help )) $usage
+ return $(( 1 - help ))
fi
local hook="${1}_functions"
diff --git a/Functions/Misc/promptnl b/Functions/Misc/promptnl
index a98c4b8ee..155d58770 100644
--- a/Functions/Misc/promptnl
+++ b/Functions/Misc/promptnl
@@ -62,7 +62,7 @@ done
# If the cursor is not in the first column, emit EOLMARK and newline.
-(( ${${RECV#*\;}%R} > 1 )) && print -P -- $EOLMARK
+(( ${${${RECV#*\;}%R}:-0} > 1 )) && print -P -- $EOLMARK
return 0
diff --git a/Functions/Misc/zargs b/Functions/Misc/zargs
index 8350b1aba..71fd42835 100644
--- a/Functions/Misc/zargs
+++ b/Functions/Misc/zargs
@@ -167,14 +167,14 @@ if [[ $eof == -(e|-eof) ]]; then ((end=ARGC+1))
elif (( $#eof )); then end=$argv[(i)${eof##-(e|-eof=)}]
else end=$argv[(i)--]
fi
-local -a args call command; command=( ${argv[end+1,-1]} )
+local -a args call command; command=( "${(@)argv[end+1,-1]}" )
if (( $opts[(I)-(null|0)] ))
-then set -- ${(ps:\000:)argv[1,end-1]}
-else set -- $argv[1,end-1]
+then set -- "${(@ps:\000:)argv[1,end-1]}"
+else set -- "${(@)argv[1,end-1]}"
fi
-if [[ -n $command ]]
+if (( $#command ))
then (( c = $#command - 1 ))
else command=( print -r -- )
fi
@@ -187,7 +187,7 @@ local execute='
then print -u2 -r -- "$call"
fi
eval "{
- \$call
+ \"\${(@)call}\"
} $bg"'
local ret=0 analyze='
case $? in
@@ -275,11 +275,11 @@ do
((ARGC)) || break
for (( end=l; end && ${(c)#argv[1,end]} > s; end/=2 )) { }
(( end > n && ( end = n ) ))
- args=( $argv[1,end] )
+ args=( "${(@)argv[1,end]}" )
shift $((end > ARGC ? ARGC : end))
if (( $#i ))
- then call=( ${command/$i/$args} )
- else call=( $command $args )
+ then call=( "${(@)command/$i/$args}" )
+ else call=( "${(@)command}" "${(@)args}" )
fi
if (( ${(c)#call} > s ))
then
diff --git a/Functions/Misc/zkbd b/Functions/Misc/zkbd
index a28354b07..1065a84f1 100644
--- a/Functions/Misc/zkbd
+++ b/Functions/Misc/zkbd
@@ -14,8 +14,7 @@ local zkbd term key seq
zkbd=${ZDOTDIR:-$HOME}/.zkbd
[[ -d $zkbd ]] || mkdir $zkbd || return 1
-print 'typeset -g -A key\n' > $zkbd/$TERM.tmp || return 1
-trap "unfunction getmbkey getseq; command rm -f $zkbd/$TERM.tmp" 0
+trap 'unfunction getmbkey getseq; command rm -f $zkbd/$TERM.tmp' 0
trap "return 1" 1 2 15
getmbkey () {
@@ -57,6 +56,7 @@ getseq () {
read term"?Enter current terminal type: [$TERM] "
[[ -n $term ]] && TERM=$term
+print 'typeset -g -A key\n' > $zkbd/$TERM.tmp || return 1
cat <<\EOF
@@ -251,21 +251,22 @@ else
fi
fi
-local termID=${DISPLAY:-$VENDOR-$OSTYPE}
-command mv $zkbd/$TERM.tmp $zkbd/$TERM-$termID
+local termID=${${DISPLAY:t}:-$VENDOR-$OSTYPE} termFile=$zkbd/$TERM.tmp
+command mv $termFile $zkbd/$TERM-$termID && termFile=$zkbd/$TERM-$termID
cat <<EOF
Parameter assignments for the keys you typed have been written to the file:
-$zkbd/$TERM-$termID
+$termFile
You may read this file into ${ZDOTDIR:-$HOME}/.zshrc or another startup
file with the "source" or "." commands, then reference the \$key parameter
-in bindkey commands, like this:
+in bindkey commands, for example like this:
- source ${zkbd/$HOME/~}/\$TERM-\${DISPLAY:-\$VENDOR-\$OSTYPE}
+ source ${(D)zkbd}/\$TERM-\${\${DISPLAY:t}:-\$VENDOR-\$OSTYPE}
[[ -n \${key[Left]} ]] && bindkey "\${key[Left]}" backward-char
[[ -n \${key[Right]} ]] && bindkey "\${key[Right]}" forward-char
# etc.
+Adjust the name of the file being sourced, as necessary.
EOF
diff --git a/Functions/Prompts/prompt_fade_setup b/Functions/Prompts/prompt_fade_setup
index 0b433dc48..d915cc0de 100644
--- a/Functions/Prompts/prompt_fade_setup
+++ b/Functions/Prompts/prompt_fade_setup
@@ -31,7 +31,7 @@ prompt_fade_setup () {
autoload -Uz prompt_special_chars
prompt_special_chars
- PS1="%F{$fadebar_cwd}%B%K{$fadebar_cwd}$schars[333]$schars[262]$schars[261]$schars[260]%F{$userhost}%K{$fadebar_cwd}%B%n@%m%b%F{$fadebar_cwd}%K{black}$schars[333]$schars[262]$schars[261]$schars[260]%F{$date}%K{black}%B %D{%a %b %d} %D{%I:%M:%S%P} $prompt_newline%F{fadebar_cwd}%K{black}%B%~/%b%k%f "
+ PS1="%F{$fadebar_cwd}%B%K{$fadebar_cwd}$schars[333]$schars[262]$schars[261]$schars[260]%F{$userhost}%K{$fadebar_cwd}%B%n@%m%b%F{$fadebar_cwd}%K{black}$schars[333]$schars[262]$schars[261]$schars[260]%F{$date}%K{black}%B %D{%a %b %d} %D{%I:%M:%S%P} $prompt_newline%F{$fadebar_cwd}%K{black}%B%~/%b%k%f "
PS2="%F{$fadebar_cwd}%K{black}$schars[333]$schars[262]$schars[261]$schars[260]%f%k>"
prompt_opts=(cr subst percent)
diff --git a/Functions/Prompts/promptinit b/Functions/Prompts/promptinit
index 66e73a7a5..edf2d028b 100644
--- a/Functions/Prompts/promptinit
+++ b/Functions/Prompts/promptinit
@@ -15,6 +15,7 @@ promptinit () {
emulate -L zsh
setopt extendedglob
local ppath='' name theme
+ local -a match mbegin mend
# Autoload all prompt_*_setup functions in fpath
for theme in $^fpath/prompt_*_setup(N); do
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 01bf9f3f5..9364fd021 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -134,7 +134,7 @@ if [[ -d $patchdir ]] ; then
stgit_applied=(${(f)"$(< "${patchdir}/applied")"})
stgit_applied=( ${(Oa)stgit_applied} )
stgit_unapplied=(${(f)"$(< "${patchdir}/unapplied")"})
- stgit_unapplied=( ${(oa)stgit_applied} )
+ stgit_unapplied=( ${(oa)stgit_unapplied} )
if VCS_INFO_hook 'gen-applied-string' "${stgit_applied[@]}"; then
if (( ${#stgit_applied} )); then
diff --git a/Functions/VCS_Info/vcs_info_setsys b/Functions/VCS_Info/vcs_info_setsys
index 1484464ce..a4c3036be 100644
--- a/Functions/VCS_Info/vcs_info_setsys
+++ b/Functions/VCS_Info/vcs_info_setsys
@@ -7,6 +7,7 @@ setopt extendedglob typeset_silent
local sys
typeset -ga VCS_INFO_backends
+local -a match mbegin mend
VCS_INFO_backends=()
diff --git a/Functions/Zftp/zfcd_match b/Functions/Zftp/zfcd_match
index 16de5c81c..95de4c583 100644
--- a/Functions/Zftp/zfcd_match
+++ b/Functions/Zftp/zfcd_match
@@ -13,6 +13,7 @@ local ZFTP_VERBOSE=45
# should we redirect 2>/dev/null or let the user see it?
local tmpf=${TMPPREFIX}zfcm$$
+local -a match mbegin mend
if [[ $ZFTP_SYSTEM = UNIX* ]]; then
# hoo, aren't we lucky: this makes things so much easier
diff --git a/Functions/Zle/forward-word-match b/Functions/Zle/forward-word-match
index 50e18cbde..e5b5ef3a6 100644
--- a/Functions/Zle/forward-word-match
+++ b/Functions/Zle/forward-word-match
@@ -8,32 +8,36 @@ local -a matched_words
integer count=${NUMERIC:-1}
if (( count < 0 )); then
- (( NUMERIC = -count ))
- zle ${WIDGET/forward/backward}
- return
+ (( NUMERIC = -count ))
+ zle ${WIDGET/forward/backward}
+ return
fi
while (( count-- )); do
-
- match-words-by-style
-
+ match-words-by-style
+
+ if zstyle -t $curcontext skip-whitespace-first; then
+ # Standard non-zsh behaviour: skip leading whitespace and the word.
+ word=$matched_words[4]$matched_words[5]
+ else
+ # Traditional zsh behaviour.
# For some reason forward-word doesn't work like the other word
# commands; it skips whitespace only after any matched word
# characters.
-
if [[ -n $matched_words[4] ]]; then
- # just skip the whitespace
- word=$matched_words[4]
+ # just skip the whitespace
+ word=$matched_words[4]
else
- # skip the word and trailing whitespace
- word=$matched_words[5]$matched_words[6]
+ # skip the word and trailing whitespace
+ word=$matched_words[5]$matched_words[6]
fi
+ fi
- if [[ -n $word ]]; then
- (( CURSOR += ${#word} ))
- else
- return 1
- fi
+ if [[ -n $word ]]; then
+ (( CURSOR += ${#word} ))
+ else
+ return 1
+ fi
done
return 0
diff --git a/Functions/Zle/replace-string b/Functions/Zle/replace-string
index a3416a403..68aac28d2 100644
--- a/Functions/Zle/replace-string
+++ b/Functions/Zle/replace-string
@@ -4,6 +4,9 @@ setopt extendedglob
autoload -Uz read-from-minibuffer replace-string-again
local p1 p2
+integer changeno=$UNDO_CHANGE_NO
+
+{
if [[ -n $_replace_string_src ]]; then
p1="[$_replace_string_src -> $_replace_string_rep]"$'\n'
@@ -30,4 +33,10 @@ if [[ -n $REPLY ]]; then
typeset -g _replace_string_rep=$REPLY
fi
+} always {
+ # Undo back to the original line; we don't want the
+ # undo history of editing the strings left.
+ zle undo $changeno
+}
+
replace-string-again $curwidget
diff --git a/Functions/Zle/select-word-style b/Functions/Zle/select-word-style
index 95d2e4446..1e472229c 100644
--- a/Functions/Zle/select-word-style
+++ b/Functions/Zle/select-word-style
@@ -4,71 +4,75 @@ setopt extendedglob
local -a word_functions
word_functions=(backward-kill-word backward-word
- capitalize-word down-case-word
- forward-word kill-word
- transpose-words up-case-word)
+ capitalize-word down-case-word
+ forward-word kill-word
+ transpose-words up-case-word)
[[ -z $1 ]] && autoload -Uz read-from-minibuffer
-local REPLY detail f wordstyle
+local REPLY detail f wordstyle teststyle
if ! zle -l $word_functions[1]; then
- for f in $word_functions; do
- autoload -Uz $f-match
- zle -N $f $f-match
- done
+ for f in $word_functions; do
+ autoload -Uz $f-match
+ zle -N $f $f-match
+ done
fi
while true; do
-
- if [[ -n $WIDGET && -z $1 ]]; then
- read-from-minibuffer -k1 "Word styles (hit return for more detail):
+ if [[ -n $WIDGET && -z $1 ]]; then
+ read-from-minibuffer -k1 "Word styles (hit return for more detail):
(b)ash (n)ormal (s)hell (w)hitespace (d)efault (q)uit
(B), (N), (S), (W) as above with subword matching
${detail}? " || return 1
- else
- REPLY=$1
- fi
-
- detail=
-
- case $REPLY in
- ([bB]*)
- # bash style
- wordstyle=standard
- zstyle ':zle:*' word-chars ''
- ;;
-
- ([nN]*)
- # normal zsh style
- wordstyle=standard
- zstyle ':zle:*' word-chars "$WORDCHARS"
- ;;
-
- ([sS]*)
- # shell command arguments or special tokens
- wordstyle=shell
- ;;
-
- ([wW]*)
- # whitespace-delimited
- wordstyle=space
- ;;
-
- (d*)
- # default: could also return widgets to builtins here
- wordstyle=
- zstyle -d ':zle:*' word-chars
- ;;
-
- (q*)
- # quit without setting
- return 1
- ;;
-
- (*)
- detail="\
+ else
+ REPLY=$1
+ fi
+
+ detail=
+
+ case $REPLY in
+ ([bB]*)
+ # bash style
+ wordstyle=standard
+ zstyle ':zle:*' word-chars ''
+ zstyle ':zle:*' skip-whitespace-first true
+ ;;
+
+ ([nN]*)
+ # normal zsh style
+ wordstyle=standard
+ zstyle ':zle:*' word-chars "$WORDCHARS"
+ zstyle ':zle:*' skip-whitespace-first false
+ ;;
+
+ ([sS]*)
+ # shell command arguments or special tokens
+ wordstyle=shell
+ zstyle ':zle:*' skip-whitespace-first false
+ ;;
+
+ ([wW]*)
+ # whitespace-delimited
+ wordstyle=space
+ zstyle ':zle:*' skip-whitespace-first false
+ ;;
+
+ (d*)
+ # default: could also return widgets to builtins here
+ wordstyle=
+ zstyle -d ':zle:*' word-chars
+ zstyle -d ':zle:*' skip-whitespace-first
+ ;;
+
+ (q*)
+ # quit without setting
+ return 1
+ ;;
+
+ (*)
+ detail="\
(b)ash: Word characters are alphanumerics only
(n)ormal: Word characters are alphanumerics plus \$WORDCHARS
(s)hell: Words are command arguments using shell syntax
@@ -76,21 +80,21 @@ ${detail}? " || return 1
(d)efault: Use default, no special handling (usually same as \`n')
(q)uit: Quit without setting a new style
"
- if [[ -z $WIDGET || -n $1 ]]; then
- print "Usage: $0 word-style
+ if [[ -z $WIDGET || -n $1 ]]; then
+ print "Usage: $0 word-style
where word-style is one of the characters in parentheses:
$detail" >&2
- return 1
- fi
- continue
- ;;
- esac
-
- if [[ -n $wordstyle ]]; then
- if [[ $REPLY = [[:upper:]]* ]]; then
- wordstyle+=-subword
- fi
- zstyle ':zle:*' word-style $wordstyle
+ return 1
+ fi
+ continue
+ ;;
+ esac
+
+ if [[ -n $wordstyle ]]; then
+ if [[ $REPLY = [[:upper:]]* ]]; then
+ wordstyle+=-subword
fi
- return
+ zstyle ':zle:*' word-style $wordstyle
+ fi
+ return
done
diff --git a/Functions/Zle/split-shell-arguments b/Functions/Zle/split-shell-arguments
index 32b04fcb5..11a928719 100644
--- a/Functions/Zle/split-shell-arguments
+++ b/Functions/Zle/split-shell-arguments
@@ -17,6 +17,7 @@ integer pos=1 cpos=$((CURSOR+1)) opos iword ichar
bufwords=(${(Z+n+)BUFFER})
+typeset -ga reply
reply=()
while [[ ${BUFFER[pos]} = [[:space:]] ]]; do
(( pos++ ))
@@ -44,6 +45,7 @@ for word in "${bufwords[@]}"; do
fi
done
+typeset -g REPLY REPLY2
if (( iword == 0 )); then
# At the end of the line, so off the indexable positions
# (but still a valid cursor position).
diff --git a/Functions/Zle/url-quote-magic b/Functions/Zle/url-quote-magic
index c7bb88c5d..fbcc7c19c 100644
--- a/Functions/Zle/url-quote-magic
+++ b/Functions/Zle/url-quote-magic
@@ -60,7 +60,7 @@
# Use compsys for nested quoting analysis and command parsing.
# Establish default values for styles, but only if not already set
-local -a reply
+local -a reply match mbegin mend
zstyle -m ':url-quote-magic:\*' url-metas '*' ||
zstyle ':url-quote-magic:*' url-metas '*?[]^(|)~#{}='
@@ -84,7 +84,7 @@ zstyle -m ':urlglobber' url-other-schema '*' ||
# Define the "urlglobber" helper function and shorthand "globurl" alias
function urlglobber {
- local -a args globbed localschema otherschema
+ local -a args globbed localschema otherschema reply
local arg command="$1"
shift
zstyle -s :urlglobber url-local-schema localschema '|'
@@ -109,6 +109,7 @@ alias globurl='noglob urlglobber '
function url-quote-magic {
setopt localoptions noksharrays extendedglob
local qkey="${(q)KEYS}"
+ local -a reply
if [[ "$KEYS" != "$qkey" ]]
then
local lbuf="$LBUFFER$qkey"
diff --git a/MACHINES b/MACHINES
index 50530299d..ffd68d79c 100644
--- a/MACHINES
+++ b/MACHINES
@@ -35,8 +35,8 @@ Apple: MacOS X/Darwin 10.x
Reported to compile with no problems on 10.4.
- Multibyte support works, although (as on other architectures)
- Unicode combining characters are not properly handled.
+ Multibyte support works; you probably wish to set the
+ option COMBINING_CHARS, which is not enabled by default.
Problems have been noted when outputting multibyte characters
to the terminal from a "preexec" function.
@@ -62,31 +62,9 @@ Red Hat Inc.: Cygwin
Path completion will fail inside these mounts; make sure that
every mount point really exists.
-DEC: Ultrix (Alpha or DECstation)
-DEC: Mach 3.0 (DECstation 5000/25)
-DEC: OSF/1 1.2, 1.3, 2.0, 3.x, DEC Unix 4.x (Alpha)
- [Out of date.]
-
- In OSF/1 3.x, there is apparently a bug in the header file
- /usr/include/rpcsvc/ypclnt.h; the prototype for yp_all() has a
- struct ypall_callback as its final argument, which should be a
- pointer (struct ypall_callback *). This prevents compilation of
- one of zsh' files (zle_tricky.c). If you can't modify the header
- file, create a directory called `rpcsvc' in zsh's Src subdirectory
- and put a fixed version of the header file to it before compiling.
-
- The strip coming with gcc-2.7.2 seems to create unusable binaries.
- This problem is not related to zsh. If you have such problems,
- remove the bogus strip and use /bin/strip instead.
-
- On Digital UNIX 4.0, compilation with gcc and with --enable-dynamic
- apparently needs configuring with explicit flags when compiling
- with debugging enabled:
- DLLD=gcc LDFLAGS='-g -rpath <path-to-.so-files>' ./configure ...
-
-FreeBSD: FreeBSD 2.2.7, 3.x, 4.x
- Should build `out-of-the-box'. On FreeBSD 2.2, dynamic loading
- does not work, but it does with 3.x and 4.x.
+FreeBSD: FreeBSD 2.2.7, 3.x, 4.x, ... 7
+ Should build `out-of-the-box'. On FreeBSD 2.2, dynamic loading
+ does not work, but it does with 3.x and later.
HP: HP-UX 9, 10.20, 11.x (PA-RISC, Itanium)
Should build `out-of-the-box'.
@@ -108,9 +86,6 @@ HP: HP-UX 9, 10.20, 11.x (PA-RISC, Itanium)
Compiling with gcc 2.7.1 is known to fail with header file
conflicts. Use the HP ANSI C compiler.
-HP/Compaq: Tru64 4.x, 5.x
- Should build `out-of-the-box'.
-
IBM: AIX 3.2, 4.x, 5.x
Should build `out-of-the-box'.
@@ -132,20 +107,18 @@ IBM: AIX 3.2, 4.x, 5.x
very unhappy (GCC 3.0 apparently does not mind). Zsh now defaults
to termcap on AIX; any info about this problem is appreciated.
-Linux: Linux 2.x (various 32-bit and 64-bit processors)
+Linux: Linux 2.x, 3.x (various 32-bit and 64-bit processors)
Should build `out-of-the-box'.
+ The following problems should not occur with recent
+ distributions.
+
If you are using an early minor version of libc 5, then a bug
in the auto-configuration process may cause zsh to think that
your system doesn't support the lstat function. If the configure
process reports that there is no lstat, edit config.h and change
HAVE_LSTAT to 1. libc-5.2.18 or later does not have this problem.
- Various problems have been reported when using optimisation
- with the experimental GNU compiler, egcs. In particular,
- on Linux Alpha with egcs 1.0.3a and 1.1.1 using -O1 or greater,
- the completion code is not correctly compiled.
-
Some versions of glibc2 have a conflict with <asm/resource.h>
which causes a redefinition warning on RLIM_INFINITY. This
causes configure to decide that <sys/resource.h> is not present,
@@ -162,65 +135,7 @@ OpenBSD: OpenBSD 2.x, 3.x
OpenIndiana: OpenIndiana 151a
Problems have been reported with awk when used to generate
prototype files for building zsh. Upgrading to gawk (GNU awk)
- version 4.0.0 fixes this.
-
-SIEMENS: Reliant UNIX
- [Out of date.]
-
- Builds `out-of-the-box'. Dynamic loading is supported.
- Large Files and 64-bit integers are supported as of version 5.44
- and CDS/CDS++ compiler.
-
-SIEMENS: SINIX
- [Out of date.]
-
- MX (Intel) platform: SINIX-L/M 5.41
- Builds out-of-the-box with EGCS. Neither dynamic loading nor
- 64-bit integers are supported. Native compiler was not tried
- mostly because GCC/EGCS builds out-of-the-box as well. If you
- succeed with native compiler, send a patch for this file
- to zsh-workers.
-
- RM (MIPS) platform: SINIX-N/Y 5.42
- Should build out-of-the-box but it was not tested. Neither
- dynamic loading nor 64-bit integers are supported.
- Note, that this version is obsolete and users are expected to
- update to Reliant UNIX.
-
-SGI: IRIX 6.2, 6.3
- [Out of date.]
-
- Should build `out-of-the-box'.
-
-SGI: IRIX 6.5
- Should build `out-of-the-box'; however, if using the native
- compiler, "cc" rather than "c99" is recommended. Compilation
- with gcc is also reported to work. Multibyte is supported.
-
- On 6.5.2, zsh malloc routines are reported not to work; also
- full optimization (cc -O3 -OPT:Olimit=0) causes problems.
-
- If using the SGI compiler, variable length arrays need to
- be turned off. configure can work this out for itself if it
- is passed the option --enable-cflags='-LANG:vla=off -O' (combined
- with other flags if necessary).
-
- The zpty module is not currently supported. This causes the
- tests starting `Y' in the Test directory to fail, even though
- the features to be tested are working.
-
-Sun: SunOS 4.1.x
- [Out of date.]
-
- Under 4.1.3 if yellow pages is used, username completion may cause
- segmentation violation. This is a bug in the shared library not
- in zsh. Some libc.so.1.9.* has this bug (it fails in yp_all).
- Statically linked binaries will work if linked with libc.so.1.8.1
- (which means that if you can get a statically linked binary
- compiled under 4.1.2 that it will probably work). An alternative
- but untested solution may be to undefine HAVE_NIS in config.h.
- This may work, but the first username completion will be _very_
- slow (as slow as in tcsh).
+ version 4.0.0 fixes this.
Sun: Solaris 2.x, 8, 9, ...
It is recommended that the system library version of iconv()
@@ -243,9 +158,10 @@ Other machines
--------------
Zsh has previously been compiled on the following machines, but the
-developers do not have direct access to them and the reports may be out of
-date. We would be glad to receive any reports of success or failure on
-these OS's --- and, of course, any others not mentioned in this file.
+developers do not have direct access to them and the reports may be out
+of date. Some of these OS's are now very long in the tooth. We would
+be glad to receive any reports of success or failure on these OS's ---
+and, of course, any others not mentioned in this file.
Apple/NeXT OpenStep 4.2 for i386.
Reported to work at least with gcc 2.8.1 and gawk 2.15 patchlevel
@@ -257,9 +173,23 @@ Cray: Unicos (C90 and T90)
Data General: DG/UX 5.4R3.10 MU01 (various AViiONs)
Should build `out-of-the-box'.
+DEC: Ultrix (Alpha or DECstation)
+DEC: Mach 3.0 (DECstation 5000/25)
+DEC: OSF/1 1.2, 1.3, 2.0, 3.x, DEC Unix 4.x (Alpha)
+
+HP/Compaq: Tru64 4.x, 5.x
+
Next: NextStep 3.*
Should build `out-of-the-box', but the zsh malloc routines are
not recommended.
SCO: UnixWare 2.1.3
Builds `out-of-the-box'.
+
+SGI: IRIX 6.2, 6.3, 6.5
+
+SIEMENS: SINIX
+
+SIEMENS: Reliant UNIX
+
+Sun: SunOS 4.1.x
diff --git a/Misc/vcs_info-examples b/Misc/vcs_info-examples
index ba3b2c367..0afb79084 100644
--- a/Misc/vcs_info-examples
+++ b/Misc/vcs_info-examples
@@ -392,9 +392,9 @@ function foobar() {
}
# In standalone-mode, vcs_info pretends as if quilt actually was a VCS.
-# Well, kind of. The vcs string is set to '-quilt-'. So let's define a
-# format just for that mode:
-zstyle ':vcs_info:-quilt-:*' formats " [%s%Q]-"
+# Well, kind of. The vcs string is set to '-quilt-.quilt-standalone'. So let's
+# define a format just for that mode:
+zstyle ':vcs_info:-quilt-.quilt-standalone:*' formats " [%s%Q]-"
# As with other format insertions, you got total control over what is being
# inserted. The `%Q' insertion is controlled by the `quiltformat' and
@@ -411,16 +411,16 @@ zstyle ':vcs_info:-quilt-:*' formats " [%s%Q]-"
# There are two hooks you can use to setup what these contain. Those would be
# `gen-applied-string' and `gen-unapplied-string'. We'll go with the default
# here... ...no need to go into every insane detail.
-zstyle ':vcs_info:*' quiltformat '#%p [%n|%c]'
+zstyle ':vcs_info:*' patch-format '#%p [%n|%c]'
# quilt-nopatch-format (default: "no patch applied")
-zstyle ':vcs_info:*' quilt-nopatch-format '#cleeaaaaan!1!!'
+zstyle ':vcs_info:*' nopatch-format '#cleeaaaaan!1!!'
# To retrieve information about unapplied patches, vcs_info invokes `quilt'
# itself. Even though that's pretty quick, it's not needed for the default
# behaviour. If we want to have `%c' and `%u' to contain meaningful data,
# we have to enable retrieval of unapplied data:
-zstyle ':vcs_info:*' quilt-get-unapplied true
+zstyle ':vcs_info:*' get-unapplied true
# With quilt, the location of its patches are configurable. It's either
# $QUILT_PATCHES or `patches' if that's unset. Let's assume we're a debian
diff --git a/NEWS b/NEWS
index 629836466..23097b6aa 100644
--- a/NEWS
+++ b/NEWS
@@ -4,357 +4,306 @@ CHANGES FROM PREVIOUS VERSIONS OF ZSH
Note also the list of incompatibilities in the README file.
-Changes since 4.3.15
---------------------
-
-The option HASH_EXECUTABLES_ONLY has been added. When this is set,
-directories in the command path will be checked for executables before
-they are added to the command table (hash); otherwise, all files in the
-directory are added. The effect of this option was present in 4.3.15,
-which could cause significant delays when hashing on systems with
-network directories in the path.
-
-Changes since 4.3.12
---------------------
-
-There are no significant feature changes to the shell itself, although
-many bug fixes and improvements to functions.
-
-Changes since 4.3.11
---------------------
-
-The zsh/parameter module has a new readonly associative array
-$usergroups whose keys are the names of system groups of which the
-current user is a member and whose values are the corresponding
-group identifiers.
-
-The region_highlight array, which controls highlighting of the
-command line from zle widgets, is now updated dynamically as
-the command line is edited.
-
-In POSIX emulation ("emulate sh") the shell is more accurate about
-when it should or should not exit on errors.
-
-The ${NAME:OFFSET:LENGTH} syntax now supports negative LENGTH, which
-counts back from the end of the string.
-
-The (g:opts:) flag in parameter expansion processes escape sequences like
-the echo and print builtins. opts can be any combination of o, e and c.
-With e, acts like print rather than echo except for octal escapes which
-are controlled separately by the o option. With c, interpret control
-sequences like "^X" as bindkey does. Regardless of the opts, \c is not
-interpreted.
-
-Changes between versions 4.3.10 and 4.3.11
-------------------------------------------
-
-When the shell is invoked with the base name of a script, for example as
-`zsh scriptname', previous versions of zsh have used the name directly,
-whereas other shells use the value of $PATH to find the script. The
-option PATH_SCRIPT has been added to provide the alternative behaviour.
-This is turned on where appropriate in compatibility modes.
-
-Parameters, globbing, etc.
--+-+-+-+-+-+-+-+-+-+-+-+-+
-
-Parameter expansion has been enhanced to provide the ${NAME:OFFSET} and
-${NAME:OFFSET:LENGTH} syntax for substrings and subarrays present in
-several other shells. OFFSET always uses zero-based indexing. The only
-clash with existing zsh syntax occurs if OFFSET begins with an
-alphabetic character or `&', which is not likely.
-
-The (D) flag in parameter expansion abbreviates directories in the
-substituted value. The (q-) flag does minimal shell quotation of arguments
-for maximum human readability of the result.
-
-The (Z) flag in parameter expansion is an enhanced version of the (z)
-flag that takes an argument indicating how the string to be split
-is treated. (Z:c:) parses comments as strings; (Z:C:) parses comments
-and strips them; (Z:n:) treats newlines as ordinary whitespace: (z)
-has always treated unquoted newlines as shell delimiters and turned them
-into semicolons, though this was not previously documented.
-
-Numeric expansion with braces has been extended so that a step may be
-given, as in {3..9..2}. The step may be negative as may the start and
-end of the range (this is also new).
-
-The glob qualifier P can be used to add a separate word before each
-match. For example, *(P:-f:) produces the command line
-`-f file1 -f file2 ...'.
-
-Regular expression matches now use the same variables for storing matched
-components as shell pattern matching. The function system now provides the
-function regexp-replace for replacing text using regular expressions. The
-zle widget functions replace-string, replace-string-again, if defined with
-regex in the name (e.g. "zle -N replace-regexp replace-string"), perform
-regular expression matches. In replacement text \& and \1 have the
-standard meaning.
-
-Line editor and completion
--+-+-+-+-+-+-+-+-+-+-+-+-+
-
-The completion system now has a style path-completion. Setting this to
-false inhibits completion of paths before the current path component,
-e.g. /u/b/z no longer completes to /usr/bin/zsh. This is useful on systems
-where this form of completion is pathologically slow due to network
-performance.
-
-With the MULTIBYTE option, the line editor now highlights bytes in the
-input that are not part of a valid character in the current locale in hex
-as <XX> for hex digits X; highlighting is controlled by the "special"
-keyword in the zle_highlight array. These can be distinguished from
-unprintable Unicode characters which also use "special" highlighting as the
-latter are always two or four bytes long, e.g. <XXXX>, <XXXXXXXX>.
-
-zle_highlight also controls highlighting of a removable completion
-suffix, e.g. the "/" automatically appended to directories. This uses
-the keyword "suffix".
-
-The line editor now sets the variable ZLE_LINE_ABORTED if there is
-an error when editing the line. The following code can be used
-to create a bindable editor widget to restore the aborted line:
- recover-line() { LBUFFER=$ZLE_LINE_ABORTED RBUFFER=; }
- zle -N recover-line
-and then either bind recover-line to a key sequence or use
-`M-x recover-line <RET>'.
-
-The parameter ZLE_STATE, available in user-defined line editor widgets,
-gives information on the state of the line editor. Currently this is
-whether the line editor is in insert or overwrite mode.
-
-Miscellaneous options
--+-+-+-+-+-+-+-+-+-+-
-
-The new shell option HIST_LEX_WORDS causes history lines read in from
-a file to be split in the same way as normal shell lines, instead of
-simply on whitespace. It's an option as although the result is more
-accurate it can take a long time when the history size is large.
-
-The shell option MONITOR can be set in non-interactive shells, and also in
-subshells (as created by surrounding commands with parentheses), turning on
-job control for that subshell. The initial behaviour of a subshell is
-still to turn job control off, however if the new POSIX_JOBS option is set
-MONITOR remains active in subshells.
-
-The new shell option POSIX_CD, active in emulations of POSIX-based shells,
-makes the cd builtin POSIX-compatible.
-
-The POSIX_JOBS option already referred to has various other
-compatibility enchancements.
-
-The new shell option POSIX_STRINGS makes a null character in $'...'
-expansion terminate the string, as is already the case in bash. This is
-not particularly useful behaviour but may become a POSIX requirement.
-
-The new shell option POSIX_TRAPS causes the EXIT trap to behave in the same
-way as in other shells, i.e. it is only run when the shell exits.
-
-The new shell option SOURCE_TRACE causes the shell to report files
-containing shell code that the shell executes directly, i.e. startup files
-or files run with the `source' or `.' builtins.
-
-The shell option SUN_KEYBOARD_HACK has been supplemented by a more general
-mechanism: the KEYBOARD_HACK variable defines the character to be ignored.
-
-Add-on modules and function
--+-+-+-+-+-+-+-+-+-+-+-+-+-
-
-The module zsh/system has a new "zsystem" builtin whose subcommands perform
-system level tasks. Currently "zsystem flock" performs advisory file
-locking (for aficionados, this uses the fcntl() system call so works over
-the network on Linux). This is a particularly convenient way of locking
-files for the length of a subshell. "zsystem supports flock" provides a
-test for this feature.
-
-There is now a function system for recording and restoring recently
-entered directories in a persistent fashion, with support in completion
-and (if explicitly installed) dynamic directory expansion. See the
-entry for cdr in the zshcontrib manual page.
-
-
-Changes between versions 4.3.9 and 4.3.10
------------------------------------------
+Changes between 4.2 and 5.0
+---------------------------
+
+The following changes first appeared in the 4.3 series of releases;
+see also the file Etc/NEWS-4.3.
+
+Here is a summary of the most significant changes:
+
+- Multibyte characters strings are supported throughout the shell.
+ Various options, editor features, and expansion flags have been
+ added to aid in using them.
+
+- The following new options have appeared: COMBINING_CHARS,
+ DEBUG_BEFORE_CMD, HASH_EXECUTABLES_ONLY, HIST_FCNTL_LOCK,
+ HIST_LEX_WORDS, HIST_SAVE_BY_COPY, MULTIBYTE, NO_MULTI_FUNCDEF,
+ PATH_SCRIPT, POSIX_ALIASES, POSIX_CD, POSIX_JOBS, POSIX_STRINGS,
+ POSIX_TRAPS, PROMPT_SP, SOURCE_TRACE.
+
+- Highlighting and colouring of the command line is supported.
+
+- Job control is supported in non-interactive shells and subshells.
+
+- The zshroadmap manual page provides a slightly more helpful
+ introduction to the shell manual than was previously available.
+
+- There have been some notable enhancements to POSIX comptability
+ when the shell is in a corresponding emulation (e.g. "emulate sh").
+
+Expansion (parameters, globbing, etc.) and redirection
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+- The character group tests [[:IDENT:]], [[:IFS:]], [[:IFSSPACE:]],
+ [[:WORD:]] in patterns allow testing if a character can be
+ part of an identifier, is an IFS character, is an IFS whitespace
+ character, or is considered part of the word using the line editor's
+ logic based on the shell variable WORDCHARS.
+
+- In extended globbing, "(#cN,M)" means "match the preceding group
+ at least N but no more than M times".
+
+- The glob qualifier P can be used with an argument to add an extra
+ word before each glob match.
+
+- The syntax ~[...] provides dynamic directory naming by means
+ of the shell function zsh_directory_name or associated hook functions.
+ This is useful for expanding paths with many variable components as
+ commonly found in software development.
+
+- Parameter substitution has the ${NAME:OFFSET} and ${NAME:OFFSET:LENGTH}
+ syntax for compatibility with other shells (and zero-based indexing
+ is used to enhance compatibility). LENGTH may be negative to count
+ from the end.
+
+- The arbitrary limit on parameter subscripts (262144) has been removed.
+ As it was not configurable and tested in an inconvenient place it
+ was deemed preferable to remove it completely. The limit was originally
+ introduced to prevent accidental creation of a large parameter array
+ by typos that generated assignments along the lines of "12345678=0".
+ The general advice is not to do that.
+
+- The parameter substitution flag (D) abbreviates directories in parameters
+ using the familiar ~ form.
+
+- The parameter substitution flag (g) can take delimited arguments o, e and
+ c to provide echo- and print-style expansion: (g::) provides basic
+ echo-style expansion; (g:e:) provides the extended capabilities of
+ print; (g:o:) provides octal escapes without a leading zero; (g:c:)
+ additionally expands "^c" style control characters as for bindkey.
+ Options may be combined, e.g. (g:eoc:).
+
+- The parameter substitution flag (m) indicates that string lengths used
+ calculated by the (l) and (r) flags or the # operator should take
+ account of the printing width of characters in multibyte mode, whether
+ 0, 1 or more. (mm) causes printing characters to count as 1 and
+ non-printing chracters to count as 0.
+
+- The parameter substitution flag (q-) picks the most minimal way of
+ quoting the parameter words, to make the result as readable as possible.
+
+- The parameter substitution flag (Z), a variant of (z), takes arguments
+ describing how to split a variable using shell syntax: (Z:c:) parses
+ comments as strings (the default is not to treat comment characters
+ specially); (Z:C:) parses comments and strips them; (Z:n:) treats
+ newlines as ordinary whitespace (the default is to turn unquoted
+ newlines into semicolons; this is now documented).
+
+- The parameter subscript flag (e) forces the argument to be treated
+ as a string, never a pattern, e.g. ${array[(ie)*]} looks for the
+ index of the array element containing the literal string "*".
+
+- The operators :| and :* in parameter substitution allow for array
+ subtraction and intersection in the form ${name:|array}. With the :|
+ operator, all entries in $name that are also in $array will be removed
+ from the substitution. Conversely for the :* operation only the
+ entries that are in both arrays will be substituted.
+
+- Numeric expansions can have a positive or negative step
+ e.g. "{3..9..2}". Negative start and end of ranges are also now
+ supported.
+
+- =(<<<...) is optimised to eliminate the need for an external process.
+ It writes the given string to a file and substitutes the name on the
+ command line.
+
+- The redirection operations "{myfd}>file" and "{myfd}>&-" open and
+ close a new file descriptor (at least 10) contained in the shell
+ variable myfd, which can be written to with ">&$myfd". This allows
+ arbitrary file descriptors rather than the explicit range 0 to 9.
+
+- New prompt escapes:
+ %x and %I show source file and line number, useful in $PS4 (the
+ existing %N and %i show names and lines in the execution environment
+ rather than the source file).
+ %F, %K, %f, %k allow colouring of prompts both using ANSI colour names
+ and values supported by individual terminal emulators.
+
+Builtins and shell functions
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+- Directory-changing builtins take an option -q to suppress side
+ effects such as printing directories or calling the chpwd hook functions.
+
+- Various enhancements have been made to traps:
+ - The option DEBUG_BEFORE_CMD is on by default, so DEBUG traps
+ can be used to debug code about to be run
+ - $ZSH_DEBUG_CMD in such a trap gives the code to be run
+ - "setopt ERR_EXIT" in a DEBUG trap causes the code not to be executed
+
+- The "fc" builtin is now more useful non-interactively.
+
+Shell variables (parameters)
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+- New variables:
+ CORRECT_IGNORE can be set to a pattern to be ignored in spelling correction.
+ KEYBOARD_HACK defines characters to be ignored if typed unmatched at
+ the end of the line (an extension of the SUN_KEYBOARD_HACK option,
+ but note that setting the option will override the variable).
+ ZSH_PATCHLEVEL provides a unique indication of the code compiled to
+ make the shell, even between releases.
+ ZSH_SUBSHELL indicates the subshell level, incremented once per fork, at
+ which the code is being run.
+
+Options
+-+-+-+-
+
+- New options:
+ COMBINING_CHARS: assume that the terminal displays combining
+ characters correctly. The shell cannot determine this by itself,
+ hence the option. This is highly recommended for MacOS X where
+ file names are stored with accented characters split into basic
+ and combining characters.
+ DEBUG_BEFORE_CMD (on by default): execute debug traps before the
+ code they refer to. This is a change of the default behaviour
+ as the new behaviour is much more useful.
+ HASH_EXECUTABLES_ONLY: don't insert non-executable files into the
+ command hash used e.g. by completion; this is optional as the
+ resulting behaviour may be very slow on network paths.
+ HIST_FCNTL_LOCK: Use the system's file locking mechanism instead
+ of an ad-hoc mechanism for locking history files.
+ HIST_LEX_WORDS: Perform lexical analysis on history lines read from
+ files, so the words are more accurately determined. May be very slow.
+ HIST_SAVE_BY_COPY (on by default): if unset, write a history file in
+ place by truncating the old one. Only needs to be turned off in
+ special circumstances.
+ MULTIBYTE (on by default if available): both variables and editor
+ command lines are treated as sequences of multibyte characters
+ rather than raw bytes depending on the locale. May be turned off
+ within functions to perform bytewise operations.
+ MULTI_FUNCDEF (on by default): "foo bar () { ... }" defines two
+ functions. This is often found to be confusing and bug-prone,
+ so you may want to unset it.
+ PATH_SCRIPT: search the path for a script specified as the first
+ argument to the shell on invocation.
+ POSIX_ALIASES: reserved words are not candidates for alias expansion.
+ POSIX_CD: make directory changing more POSIX-compatible.
+ POSIX_JOBS: make job control more POSIX compliant.
+ POSIX_STRINGS: $'...\0...' always processes \0 as a NULL, but if the
+ option is set the remainder of the string is ignored.
+ POSIX_TRAPS: EXIT traps are not executed on return from shell functions.
+ PROMPT_SP: improves display of lines not ending with newlines when
+ PROMPT_CR is in effect.
+ SOURCE_TRACE: print information as files are executed with ".",
+ "source", or as startup or shutdown files.
+
+Line editor
+-+-+-+-+-+-
+
+- Supports multibyte characters, including characters wider than one
+ screen cell and (with the COMBINING_CHARS option) combining characters.
+
+- New builtin widgets:
+ arguments-base: allow non-decimal numeric arguments
+ history-incremental-pattern-search-{backward,forward}: support
+ patterns in incremental searches.
+
+- New special variables:
+ region_highlight allows arbitrary highlighting of parts of the
+ command line; it is maintained dynamically.
+ UNDO_CHANGE_NO gives a unique record of the current change state of
+ the command line, for undoing back to a particular point using
+ the undo widget.
+ zle_highlight provides master control of highlighting for special
+ modes, e.g. unprintable characters.
+ ZLE_LINE_ABORTED records an editor line that was aborted by an error
+ or C-g. It can be used to recover aborted lines.
+ ZLE_STATE give miscellaneous information, currently whether the line
+ editor is in insert or overwrite mode.
+
+- The undo widget takes an argument, a previous value of $UNDO_CHANGE_NO.
+
+Completion
+-+-+-+-+-+
+
+- Many new and enhanced completion functions
+
+- New styles:
+ accept-exact-dirs: suppress path expansion of directory components
+ that already exist, speeding up completion significantly on slow
+ network directories.
+ path-completion: can be used to suppress directory components before
+ the current one completely, so e.g. /u/b<TAB> only completes after the
+ "b", not the "u".
+
+- New special variables:
+ ZLE_REMOVE_SUFFIX_CHARS, ZLE_SPACE_SUFFIX_CHARS provide enhanced
+ flexibility over suffix removal.
+
+- Matching control, typically handled with the matcher-list style,
+ supports named character ranges, such as [:upper:], wherever
+ ranges were allowed, for example 'm:{[:upper:]}={[:lower:]}'.
+ However, matching control does not yet handle multibyte characters
+ properly, so this is currently limited to ASCII.
+
+Syntax and compatibility
+-+-+-+-+-+-+-+-+-+-+-+-+
+
+- Substitutions of the form ${var:-"$@"} and ${var:+"$@"} now behave
+ much more like other shells when appropriate (e.g. with the
+ SH_WORD_SPLIT option).
+
+- Assignments within variable substitutions, such as ${var=value},
+ are also more compatible with other shells where appropriate.
+
+- The emulate command can now be passed an expression to be evaluated
+ in a "sticky" emulation, so that functions defined there always
+ behave in the appropriate emulation.
+
+- "emulate sh" and similar modes have improved compatibility with
+ respect to deciding whether the shell should exit on errors.
+
+- Signals now accept SIG as part of the name.
+
+Modules
+-+-+-+-
+
+- Modules now present "features", specific builtins (b:), parameters
+ (p:), conditions (c:) and math functions (f:), allowing more control
+ over what is imported from a module.
+
+- The zsh/curses module provides access to the "curses" screen
+ manipulation package.
+
+- The zsh/datetime module has a calendar utility, although it is not
+ as robust as standalone calendar utilities.
+
+- The zsh/newuser module and associated functions has facilities for
+ setting up startup files for a first-time user.
+
+- The zsh/parameter module contains some new arrays to aid in tracing
+ of the shell's call stack: $funcsourcetrace and $funcfiletrace.
+
+- The zsh/parameter module provides $usergroups, an associative arrays
+ whose keys are the names of groups the current user belongs to, with
+ the group identifier as the corresponding value.
+
+- The zsh/system module has a zsystem builtin which provides file
+ locking and also a forward-compatible means for testing subcommands
+ supported.
-The command "emulate <mode> -c ..." evaluates an expression in a given
-emulation. The emulation is sticky for functions defined within the
-expression.
-
-The variable CORRECT_IGNORE gives a pattern that can be ignored
-in spelling correction. CORRECT_IGNORE='_*' ignores completion functions.
-
-The option POSIX_ALIASES improves compatibility of aliases with other
-shells.
-
-The variable ZSH_PATCHLEVEL can be used to test for unreleased versions of
-the shell; it is present but less useful in released versions.
-
-The variables ZLE_REMOVE_SUFFIX_CHARS and ZLE_SPACE_SUFFIX_CHARS allow more
-control over the way automatically removed suffixes are treated in
-completion.
+Internal improvements
+-+-+-+-+-+-+-+-+-+-+-
-Major changes between versions 4.3.6 and 4.3.9
-----------------------------------------------
+- High resolution timestamps are used internally for certain
+ comparisons when available.
-The option COMBINING_CHARS has been added. When it is set, the
-line editor assumes the terminal is capable of displaying zero-width
-combining characters (typically accents) correctly as modifications
-to the base character, and will act accordingly. Note it is not set
-by default owing to vagaries of terminals. The system is reported
-to work on MacOS, where this is particularly important as accented
-characters in file names are stored in their decomposed form (i.e.
-with base and combining characters).
-
-The option HIST_FCNTL_LOCK has been added to provide locking of history
-files using the system call fcntl(). On recent NFS implementations this
-may provide better reliability.
-
-The syntax ~[...] provides a dynamic form of directory naming,
-supplementing the existing static ~name syntax. A user-defined shell
-function, zsh_directory_name, is used to handle both expansion of names to
-directories and contraction of directories to names.
-
-Patterns can now be used in incremental searches with the new widgets
-history-incremental-pattern-search-backward and
-history-incremental-pattern-search-forward. These are not bound to
-keys by default.
-
-Highlighting and colouring of sections of the command line is now
-supported, controlled by the array parameter zle_highlight and the ZLE
-special parameter region_highlight.
-
-Colouring of prompts is now supported within the shell by prompt
-escapes. The prompt theme system has been updated.
-
-Various changes have been added to make debugging of shell code easier:
- - As noted in README, the option DEBUG_BEFORE_CMD is now set by default.
- - In DEBUG traps, $ZSH_DEBUG_CMD gives the code for which the trap is
- called as a string.
- - "setopt ERR_EXIT" in a DEBUG trap causes the code not to be executed.
- - $ZSH_SUBSHELL indicates the subshell level at which code is being
- executed.
- - The zsh/parameter module has various additional arrays similar to
- the existing $funcstack and $functrace, namely $funcsourcetrace
- and $funcfiletrace. The consistency and informativeness of
- the output of all these arrays has been improved.
- - Prompt escapes %x and %I show the source file and line number in
- debug prompts (compare %N and %i which show names and line numbers
- in the execution environment).
- - The option NO_MULTI_FUNCDEF can turn off multiple definition of
- functions at once, a rarely used feature that can cause problems
- with misplaced "()".
- - The "fc" builtin has been enhanced to make non-interactive use possible
- and output consistent when the history is manipulated with "print -s".
-
-The completion style accept-exact-dirs has been added. When true, this
-suppresses attempts to complete non-final directory segments of a filename
-path when the directory exists. (For example, /home/pws/src/zsh/<TAB>
-discovers that /home/pws/src/zsh exists and leaves the directory component
-alone, while /h/p/s/z/<TAB> completes to /home/pws/src/zsh/... as before.)
-This should improve completion behaviour noticeably in special cases, such
-as remote paths under Cygwin.
-
-Major changes between versions 4.3.5 and 4.3.6
-----------------------------------------------
+Add-on functions
+-+-+-+-+-+-+-+-+
-cd, chdir, pushd and popd now take a -q option to suppress side effects
-including printing the directory stack (for pushd and popd) and executing
-the chpwd hook functions (for all four).
+- The VCS_Info system provides a way of keeping track of the state
+ of numerous version control systems within the shell.
-The parameter subscript (e) flag now forces the argument to be treated
-as a string where it would previously have been treated as a pattern,
-for example ${array[(ie)*]} substitutes the index of the element whose
-value is "*".
+- cdr etc.: change to a directory from a list that persists between
+ shell instances, with completion support.
-Major changes between versions 4.3.4 and 4.3.5
-----------------------------------------------
+- regexp-replace replaces text in variables using regular expressions;
+ it may be used by zle function widgets based on the functions
+ replace-string and replace-string-again to provide regular expression
+ replacements in the line editor.
-- The new extended globbing flag (#cN,M) behaves similarly to the extended
- regular expression syntax {N,M}.
-
-- The zsh/datetime module has been enhanced and a calendar function
- system has been added along the lines of (but much enhanced from)
- the traditional Unix "calendar" utility. This is still under
- development. See the zshcalsys manual. (The calendar functions
- were in 4.3.4 but were not listed in this file. There have been
- significant enhancements since 4.3.4.)
-
-- A new module zsh/curses provides a builtin zcurses for access to
- to the curses screen manipulation package. See the entry for zsh/curses
- in the zshmodules manual.
-
-- The module system has been enhanced to support the notion of "features"
- that give more control over which builtins, parameters, conditions
- and math functions are loaded from a module. In particular,
- "zmodload -F zsh/stat b:zstat" makes the builtin previously called
- "stat" available as "zstat" (only) to avoid clashes with a system
- command named "stat".
-
-Major changes between versions 4.2 and 4.3.4
---------------------------------------------
-
-- There is support for multibyte character sets. This is now reasonably
- close to complete, although Unicode combining characters don't work
- properly. See Multibyte Character Support in INSTALL.
-
-- The shell can now run an installation function for a new user
- (a user with no .zshrc, .zshenv, .zprofile or .zlogin file) without
- any additional setting up by the administrator. See "THE ZSH/NEWUSER
- MODULE" in the zshmodules manual page.
-
-- The manual now has a Roadmap section (manual page zshroadmap) to
- give new users an indication of the most interesting parts of the
- manual.
-
-- New option PROMPT_SP (on by default): works around the problem that the
- line editor can overwrite output with no newline at the end. See the
- zshoptions manual page.
-
-- New option HIST_SAVE_BY_COPY (on by default): history is saved by
- copying and renaming instead of directly overwriting. See the
- zshoptions manual page.
-
-- New redirection syntax e.g. {myfd}>file opens a new file descriptor
- and stores the number in $myfd, so that >&$myfd will work. Chosen
- not to break existing code (and to be compatible with proposals for the
- Korn shell). See the section REDIRECTION in the zshmisc manual page.
-
-- Substitutions of the form ${var:-"$@"}, ${var:+"$@"} and similar where
- word-splitting is applied to the text after the :- or :+ (in particular,
- where the SH_WORD_SPLIT option is in effect for compatibility) now
- behave as in other Bourne- and POSIX-compatible shells when in the
- appropriate emulation mode.
-
-- New Posix-style zsh-specific tests [[:IDENT:]], [[:IFS:]],
- [[:IFSSPACE:]], [[:WORD:]] test if character can appear in identifier,
- is an IFS character, is an IFS whitespace character, or is considered
- as part of a word (is alphanumeric or appears in $WORDCHARS). These
- works correctly on multibyte characters if the appropriate support
- is present. See the section FILENAME GENERATION in the zshexpn
- manual page.
-
-- Time comparisons on files when sorting or using test operators will
- use high-resolution timestamps when available. This gives a
- resolution of a nanosecond instead of a second.
-
-- The idiom =(<<<...) is optimised so that the shell internally turns
- the ... into the contents of a file whose name is then substituted.
- The syntax has always been usable by means of the NULLCMD feature,
- but previously it generated an intermediate process; it has now
- been rewritten along the same lines as the optimisation for $(<...)
- that inserts a file into the command line without the use of an
- external programme.
-
-- Supplied functions catch and throw provide limited support for
- exception handling using the `{ ... } always { ... }' syntax.
- See the section EXCEPTION HANDLING in the zshcontrib manual page.
-
-- Signals now accept the SIG as part of the name for compatibility with
- other shells.
-
-- Editor function argument-base allows non-decimal arguments for
- editor widgets. See the entry in the zshzle manual page.
-
-- As always, there are many enhancements to completion functions.
Changes in 4.2 since version 4.2.0
----------------------------------
@@ -423,6 +372,7 @@ Changes in 4.2 since version 4.2.0
- Glob qualifier (+func) is shorthand for (e:func:) (calls a command,
typically a shell function, with no argument).
+
New features between zsh versions 4.0 and 4.2
---------------------------------------------
@@ -544,12 +494,14 @@ significant of a large number of improvements in the shell are:
- Various new options for compatibility with this, that and the other
See the 3.1.x changes below for more detail.
+
New features in zsh version 3.1.8 and 3.1.9
-------------------------------------------
These are primarily bug-fix versions. There are only a few user-visible
changes.
- Array slices ${array[a,b]} with b < a now correctly have zero length.
+
New features in zsh version 3.1.7
---------------------------------
Further enhancements to new completion system:
@@ -653,6 +605,7 @@ Other:
- Better null-command behaviour in sh and csh emulation
- Internal memory usage optimisations
+
New features in zsh version 3.1.6 (beta version)
------------------------------------------------
Note also the changes for 3.0.6, which include changes between 3.1.5. and
@@ -739,6 +692,7 @@ Configuration changes:
- Generation of signal names should be more reliable
- Customizable installation of shell functions from distribution.
+
New features in zsh version 3.0.6
---------------------------------
diff --git a/README b/README
index 513732f16..c5c18a90d 100644
--- a/README
+++ b/README
@@ -5,11 +5,11 @@ THE Z SHELL (ZSH)
Version
-------
-This is version 4.3.17 of the shell. This is a development release,
-but is believed to be reasonably stable. Sites where the users need to
-edit command lines with multibyte characters (in particular UTF-8)
-will probably want to upgrade. The previous widely released version
-of the shell was 4.3.15.
+This is version 5.0.0 of the shell. This is a stable release.
+There have been only incremental changes since the last development
+version, 4.3.17. The new major version number represents the
+substantial changes since the 4.2 stable release series. The
+changes are detailed in the file NEWS.
Installing Zsh
--------------
@@ -33,16 +33,8 @@ details, see the documentation.
Possible incompatibilities
---------------------------
-In some 4.3.X releases of zsh, the completion system added a ".." as a
-trial completion whenever completing directories. This was a bug: as
-documented in the zshcompsys manual, this feature needs to be turned on by
-a style:
-
- zstyle ':completion:*' special-dirs true
-
-
-The rest of this section documents incompatibilities in the shell since the
-4.2 series of releases.
+Here are some incompatibilities in the shell since the 4.2 series of
+releases. It is hoped most users will not be adversely affected by these.
In previous releases of the shell, builtin commands and precommand
modifiers that did not accept options also did not recognize the
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index 092efa0c3..4d29ba635 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -531,7 +531,11 @@ functracegetfn(UNUSED(Param pm))
char *colonpair;
colonpair = zhalloc(strlen(f->caller) + (f->lineno > 9999 ? 24 : 6));
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+ sprintf(colonpair, "%s:%lld", f->caller, f->lineno);
+#else
sprintf(colonpair, "%s:%ld", f->caller, (long)f->lineno);
+#endif
*p = colonpair;
}
@@ -559,7 +563,11 @@ funcsourcetracegetfn(UNUSED(Param pm))
char *fname = f->filename ? f->filename : "";
colonpair = zhalloc(strlen(fname) + (f->flineno > 9999 ? 24 : 6));
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+ sprintf(colonpair, "%s:%lld", fname, f->flineno);
+#else
sprintf(colonpair, "%s:%ld", fname, (long)f->flineno);
+#endif
*p = colonpair;
}
@@ -594,7 +602,11 @@ funcfiletracegetfn(UNUSED(Param pm))
*/
colonpair = zhalloc(strlen(f->caller) +
(f->lineno > 9999 ? 24 : 6));
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+ sprintf(colonpair, "%s:%lld", f->caller, f->lineno);
+#else
sprintf(colonpair, "%s:%ld", f->caller, (long)f->lineno);
+#endif
} else {
/*
* Calling context is a function or eval; we need to find
@@ -604,7 +616,7 @@ funcfiletracegetfn(UNUSED(Param pm))
* together with the $functrace line number for the current
* context.
*/
- long flineno = (long)(f->prev->flineno + f->lineno);
+ zlong flineno = f->prev->flineno + f->lineno;
/*
* Line numbers in eval start from 1, not zero,
* so offset by one to get line in file.
@@ -614,7 +626,11 @@ funcfiletracegetfn(UNUSED(Param pm))
fname = f->prev->filename ? f->prev->filename : "";
colonpair = zhalloc(strlen(fname) + (flineno > 9999 ? 24 : 6));
- sprintf(colonpair, "%s:%ld", fname, flineno);
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+ sprintf(colonpair, "%s:%lld", fname, flineno);
+#else
+ sprintf(colonpair, "%s:%ld", fname, (long)flineno);
+#endif
}
*p = colonpair;
diff --git a/Src/Modules/regex.c b/Src/Modules/regex.c
index 08e815003..ce57de986 100644
--- a/Src/Modules/regex.c
+++ b/Src/Modules/regex.c
@@ -3,7 +3,7 @@
*
* This file is part of zsh, the Z shell.
*
- * Copyright (c) 2007 Phil Pennock
+ * Copyright (c) 2007,2012 Phil Pennock
* All Rights Reserved.
*
* Permission is hereby granted, without written agreement and without
@@ -56,14 +56,19 @@ zcond_regex_match(char **a, int id)
regex_t re;
regmatch_t *m, *matches = NULL;
size_t matchessz = 0;
- char *lhstr, *rhre, *s, **arr, **x;
+ char *lhstr, *lhstr_zshmeta, *rhre, *rhre_zshmeta, *s, **arr, **x;
int r, n, return_value, rcflags, reflags, nelem, start;
- lhstr = cond_str(a,0,0);
- rhre = cond_str(a,1,0);
+ lhstr_zshmeta = cond_str(a,0,0);
+ rhre_zshmeta = cond_str(a,1,0);
rcflags = reflags = 0;
return_value = 0; /* 1 => matched successfully */
+ lhstr = ztrdup(lhstr_zshmeta);
+ unmetafy(lhstr, NULL);
+ rhre = ztrdup(rhre_zshmeta);
+ unmetafy(rhre, NULL);
+
switch(id) {
case ZREGEX_EXTENDED:
rcflags |= REG_EXTENDED;
@@ -101,7 +106,7 @@ zcond_regex_match(char **a, int id)
if (nelem) {
arr = x = (char **) zalloc(sizeof(char *) * (nelem + 1));
for (m = matches + start, n = start; n <= (int)re.re_nsub; ++n, ++m, ++x) {
- *x = ztrduppfx(lhstr + m->rm_so, m->rm_eo - m->rm_so);
+ *x = metafy(lhstr + m->rm_so, m->rm_eo - m->rm_so, META_DUP);
}
*x = NULL;
}
@@ -112,7 +117,7 @@ zcond_regex_match(char **a, int id)
char *ptr;
m = matches;
- s = ztrduppfx(lhstr + m->rm_so, m->rm_eo - m->rm_so);
+ s = metafy(lhstr + m->rm_so, m->rm_eo - m->rm_so, META_DUP);
setsparam("MATCH", s);
/*
* Count the characters before the match.
@@ -174,12 +179,16 @@ zcond_regex_match(char **a, int id)
break;
default:
DPUTS(1, "bad regex option");
- return 0; /* nothing to cleanup, especially not "re". */
+ return_value = 0;
+ goto CLEAN_BASEMETA;
}
if (matches)
zfree(matches, matchessz);
regfree(&re);
+CLEAN_BASEMETA:
+ free(lhstr);
+ free(rhre);
return return_value;
}
diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h
index bedf28f17..cf44b47d2 100644
--- a/Src/Zle/zle.h
+++ b/Src/Zle/zle.h
@@ -269,6 +269,7 @@ struct change {
ZLE_STRING_T ins; /* characters to insert */
int insl; /* no. of characters in ins */
int old_cs, new_cs; /* old and new cursor positions */
+ zlong changeno; /* unique number of this change */
};
#define CH_NEXT (1<<0) /* next structure is also part of this change */
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index 3fdb5f8ed..a9bbf136a 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -93,6 +93,8 @@ static const struct gsu_integer pending_gsu =
{ get_pending, NULL, zleunsetfn };
static const struct gsu_integer region_active_gsu =
{ get_region_active, set_region_active, zleunsetfn };
+static const struct gsu_integer undo_change_no_gsu =
+{ get_undo_current_change, NULL, zleunsetfn };
static const struct gsu_array killring_gsu =
{ get_killring, set_killring, unset_killring };
@@ -133,6 +135,8 @@ static struct zleparam {
{ "RBUFFER", PM_SCALAR, GSU(rbuffer_gsu), NULL },
{ "REGION_ACTIVE", PM_INTEGER, GSU(region_active_gsu), NULL},
{ "region_highlight", PM_ARRAY, GSU(region_highlight_gsu), NULL },
+ { "UNDO_CHANGE_NO", PM_INTEGER | PM_READONLY, GSU(undo_change_no_gsu),
+ NULL },
{ "WIDGET", PM_SCALAR | PM_READONLY, GSU(widget_gsu), NULL },
{ "WIDGETFUNC", PM_SCALAR | PM_READONLY, GSU(widgetfunc_gsu), NULL },
{ "WIDGETSTYLE", PM_SCALAR | PM_READONLY, GSU(widgetstyle_gsu), NULL },
@@ -705,21 +709,17 @@ get_context(UNUSED(Param pm))
static char *
get_zle_state(UNUSED(Param pm))
{
- char *zle_state = NULL, *ptr = NULL;
+ char *zle_state = NULL, *ptr = NULL, **arr = NULL;
int itp, istate, len = 0;
/*
- * When additional substrings are added, they should be kept in
- * alphabetical order, so the user can easily match against this
- * parameter: if [[ $ZLE_STATE == *bar*foo*zonk* ]]; then ...; fi
+ * Substrings are sorted at the end, so the user can
+ * easily match against this parameter:
+ * if [[ $ZLE_STATE == *bar*foo*zonk* ]]; then ...; fi
*/
for (itp = 0; itp < 2; itp++) {
char *str;
- /*
- * Currently there is only one state: insert or overwrite.
- * This loop is to make it easy to add others.
- */
- for (istate = 0; istate < 1; istate++) {
+ for (istate = 0; istate < 2; istate++) {
int slen;
switch (istate) {
case 0:
@@ -729,6 +729,13 @@ get_zle_state(UNUSED(Param pm))
str = "overwrite";
}
break;
+ case 1:
+ if (hist_skip_flags & HIST_FOREIGN) {
+ str = "localhistory";
+ } else {
+ str = "globalhistory";
+ }
+ break;
default:
str = "";
@@ -742,7 +749,7 @@ get_zle_state(UNUSED(Param pm))
} else {
/* Accumulating string */
if (istate)
- *ptr++ = ' ';
+ *ptr++ = ':';
memcpy(ptr, str, slen);
ptr += slen;
}
@@ -755,5 +762,10 @@ get_zle_state(UNUSED(Param pm))
}
}
+ arr = colonsplit(zle_state, 0);
+ strmetasort(arr, SORTIT_ANYOLDHOW, NULL);
+ zle_state = zjoin(arr, ' ', 1);
+ freearray(arr);
+
return zle_state;
}
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 45e30445e..cf6787f3a 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -1359,6 +1359,10 @@ static struct change *changes, *curchange;
static struct change *nextchanges, *endnextchanges;
+/* incremented to provide a unique change number */
+
+static zlong undo_changeno;
+
/**/
void
initundo(void)
@@ -1368,6 +1372,7 @@ initundo(void)
curchange->prev = curchange->next = NULL;
curchange->del = curchange->ins = NULL;
curchange->dell = curchange->insl = 0;
+ curchange->changeno = undo_changeno = 0;
lastline = zalloc((lastlinesz = linesz) * ZLE_CHAR_SIZE);
ZS_memcpy(lastline, zleline, (lastll = zlell));
lastcs = zlecs;
@@ -1492,6 +1497,7 @@ mkundoent(void)
ch->flags = 0;
ch->prev = NULL;
}
+ ch->changeno = ++undo_changeno;
endnextchanges = ch;
}
@@ -1512,8 +1518,15 @@ setlastline(void)
/**/
int
-undo(UNUSED(char **args))
+undo(char **args)
{
+ zlong last_change = (zlong)0;
+
+ if (*args)
+ {
+ last_change = zstrtol(*args, NULL, 0);
+ }
+
handleundo();
do {
if(!curchange->prev)
@@ -1522,7 +1535,8 @@ undo(UNUSED(char **args))
curchange = curchange->prev;
else
break;
- } while(curchange->flags & CH_PREV);
+ } while (*args ? curchange->changeno != last_change :
+ (curchange->flags & CH_PREV));
setlastline();
return 0;
}
@@ -1637,3 +1651,15 @@ zlecallhook(char *name, char *arg)
errflag = saverrflag;
retflag = savretflag;
}
+
+/*
+ * Return the number corresponding to the last change made.
+ */
+
+/**/
+zlong
+get_undo_current_change(UNUSED(Param pm))
+{
+ return undo_changeno;
+}
+
diff --git a/Src/builtin.c b/Src/builtin.c
index b43c08235..b5a98cbd2 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -58,7 +58,7 @@ static struct builtin builtins[] =
BUILTIN("disable", 0, bin_enable, 0, -1, BIN_DISABLE, "afmrs", NULL),
BUILTIN("disown", 0, bin_fg, 0, -1, BIN_DISOWN, NULL, NULL),
BUILTIN("echo", BINF_SKIPINVALID, bin_print, 0, -1, BIN_ECHO, "neE", "-"),
- BUILTIN("emulate", 0, bin_emulate, 0, 3, 0, "LR", NULL),
+ BUILTIN("emulate", 0, bin_emulate, 0, -1, 0, "LR", NULL),
BUILTIN("enable", 0, bin_enable, 0, -1, BIN_ENABLE, "afmrs", 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),
@@ -1498,7 +1498,7 @@ bin_fc(char *nam, char **argv, Options ops, int func)
}
if (OPT_ISSET(ops,'l')) {
/* list the required part of the history */
- retval = fclist(stdout, ops, first, last, asgf, pprog);
+ retval = fclist(stdout, ops, first, last, asgf, pprog, 0);
unqueue_signals();
}
else {
@@ -1530,7 +1530,7 @@ bin_fc(char *nam, char **argv, Options ops, int func)
}
}
ops->ind['n'] = 1; /* No line numbers here. */
- if (!fclist(out, ops, first, last, asgf, pprog)) {
+ if (!fclist(out, ops, first, last, asgf, pprog, 1)) {
char *editor;
if (func == BIN_R)
@@ -1639,7 +1639,7 @@ fcsubs(char **sp, struct asgment *sub)
/**/
static int
fclist(FILE *f, Options ops, zlong first, zlong last,
- struct asgment *subs, Patprog pprog)
+ struct asgment *subs, Patprog pprog, int is_command)
{
int fclistdone = 0;
zlong tmp;
@@ -1652,8 +1652,8 @@ fclist(FILE *f, Options ops, zlong first, zlong last,
last = first;
first = tmp;
}
- if (first > last) {
- zwarnnam("fc", "history events are in wrong order, aborted");
+ if (is_command && first > last) {
+ zwarnnam("fc", "history events can't be executed backwards, aborted");
if (f != stdout)
fclose(f);
return 1;
@@ -1976,9 +1976,10 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
tc = 0; /* but don't do a normal conversion */
}
} else if (!setsecondstype(pm, on, off)) {
- if (value && !setsparam(pname, ztrdup(value)))
+ if (value && !(pm = setsparam(pname, ztrdup(value))))
return NULL;
- return pm;
+ usepm = 1;
+ err = 0;
}
}
if (err)
@@ -3054,6 +3055,34 @@ bin_unset(char *name, char **argv, Options ops, int func)
*sse = ']';
}
paramtab = tht;
+ } else if (PM_TYPE(pm->node.flags) == PM_SCALAR ||
+ PM_TYPE(pm->node.flags) == PM_ARRAY) {
+ struct value vbuf;
+ vbuf.isarr = (PM_TYPE(pm->node.flags) == PM_ARRAY ?
+ SCANPM_ARRONLY : 0);
+ vbuf.pm = pm;
+ vbuf.flags = 0;
+ vbuf.start = 0;
+ vbuf.end = -1;
+ vbuf.arr = 0;
+ *ss = '[';
+ if (getindex(&ss, &vbuf, SCANPM_ASSIGNING) == 0 &&
+ vbuf.pm && !(vbuf.pm->node.flags & PM_UNSET)) {
+ if (PM_TYPE(pm->node.flags) == PM_SCALAR) {
+ setstrvalue(&vbuf, ztrdup(""));
+ } else {
+ /* start is after the element for reverse index */
+ int start = vbuf.start - !!(vbuf.flags & VALFLAG_INV);
+ if (start < arrlen(vbuf.pm->u.arr)) {
+ char *arr[2];
+ arr[0] = "";
+ arr[1] = 0;
+ setarrvalue(&vbuf, zarrdup(arr));
+ }
+ }
+ }
+ returnval = errflag;
+ errflag = 0;
} else {
zerrnam(name, "%s: invalid element for unset", s);
returnval = 1;
@@ -4958,14 +4987,14 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func))
{
int opt_L = OPT_ISSET(ops, 'L');
int opt_R = OPT_ISSET(ops, 'R');
- int saveemulation, savesticky_emulation;
- int ret;
+ int saveemulation, savesticky_emulation, savehackchar;
+ int ret = 1;
char saveopts[OPT_SIZE];
+ char *cmd = 0;
+ const char *shname = *argv;
/* without arguments just print current emulation */
- if (!*argv) {
- const char *shname;
-
+ if (!shname) {
if (opt_L || opt_R) {
zwarnnam("emulate", "not enough arguments");
return 1;
@@ -4995,39 +5024,46 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func))
/* with single argument set current emulation */
if (!argv[1]) {
- emulate(*argv, OPT_ISSET(ops,'R'));
+ emulate(shname, OPT_ISSET(ops,'R'));
if (OPT_ISSET(ops,'L'))
opts[LOCALOPTIONS] = opts[LOCALTRAPS] = 1;
return 0;
}
- /* If "-c command" is given, evaluate command using specified
- * emulation mode.
- */
- if (strcmp(argv[1], "-c")) {
- zwarnnam("emulate", "unknown argument %s", argv[1]);
- return 1;
- }
+ argv++;
+ memcpy(saveopts, opts, sizeof(opts));
+ savehackchar = keyboardhackchar;
+ cmd = parseopts("emulate", &argv);
- if (!argv[2]) {
- zwarnnam("emulate", "not enough arguments");
- return 1;
+ /* parseopts() has consumed anything that looks like an option */
+ if (*argv) {
+ zwarnnam("emulate", "unknown argument %s", *argv);
+ goto restore;
}
- if (opt_L) {
- zwarnnam("emulate", "option -L incompatible with -c");
- return 1;
- }
+ /* If "-c command" is given, evaluate command using specified
+ * emulation mode.
+ */
+ if (cmd) {
+ if (opt_L) {
+ zwarnnam("emulate", "option -L incompatible with -c");
+ goto restore;
+ }
+ *--argv = cmd; /* on stack, never free()d, see execbuiltin() */
+ } else
+ return 0;
- memcpy(saveopts, opts, sizeof(opts));
saveemulation = emulation;
savesticky_emulation = sticky_emulation;
- emulate(*argv, OPT_ISSET(ops,'R'));
+ emulate(shname, OPT_ISSET(ops,'R'));
sticky_emulation = emulation;
- ret = eval(argv+2);
- memcpy(opts, saveopts, sizeof(opts));
+ ret = eval(argv);
sticky_emulation = savesticky_emulation;
emulation = saveemulation;
+ restore:
+ memcpy(opts, saveopts, sizeof(opts));
+ keyboardhackchar = savehackchar;
+ inittyptab(); /* restore banghist */
return ret;
}
diff --git a/Src/exec.c b/Src/exec.c
index 503e0843d..6ebc9c014 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1617,9 +1617,8 @@ execpline(Estate state, wordcode slcode, int how, int last1)
(list_pipe || (pline_level && !(jn->stat & STAT_SUBJOB)))))
deletejob(jn, 0);
thisjob = pj;
-
}
- if (slflags & WC_SUBLIST_NOT)
+ if ((slflags & WC_SUBLIST_NOT) && !errflag)
lastval = !lastval;
}
if (!pline_level)
@@ -1679,9 +1678,13 @@ execpline2(Estate state, wordcode pcode,
if (pipe(synch) < 0) {
zerr("pipe failed: %e", errno);
+ lastval = errflag = 1;
+ return;
} else if ((pid = zfork(&bgtime)) == -1) {
close(synch[0]);
close(synch[1]);
+ lastval = errflag = 1;
+ return;
} else if (pid) {
char dummy, *text;
@@ -2490,7 +2493,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
if (!firstnode(args)) {
zerr("exec requires a command to execute");
errflag = lastval = 1;
- return;
+ goto done;
}
uremnode(args, firstnode(args));
if (!strcmp(next, "--"))
@@ -2507,12 +2510,12 @@ execcmd(Estate state, int input, int output, int how, int last1)
if (!firstnode(args)) {
zerr("exec requires a command to execute");
errflag = lastval = 1;
- return;
+ goto done;
}
if (!nextnode(firstnode(args))) {
zerr("exec flag -a requires a parameter");
errflag = lastval = 1;
- return;
+ goto done;
}
exec_argv0 = (char *)
getdata(nextnode(firstnode(args)));
@@ -2813,15 +2816,12 @@ execcmd(Estate state, int input, int output, int how, int last1)
if (pipe(synch) < 0) {
zerr("pipe failed: %e", errno);
- if (oautocont >= 0)
- opts[AUTOCONTINUE] = oautocont;
- return;
+ goto fatal;
} else if ((pid = zfork(&bgtime)) == -1) {
close(synch[0]);
close(synch[1]);
- if (oautocont >= 0)
- opts[AUTOCONTINUE] = oautocont;
- return;
+ lastval = errflag = 1;
+ goto fatal;
}
if (pid) {
@@ -3252,7 +3252,11 @@ execcmd(Estate state, int input, int output, int how, int last1)
}
if (isset(PRINTEXITVALUE) && isset(SHINSTDIN) &&
lastval && !subsh) {
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+ fprintf(stderr, "zsh: exit %lld\n", lastval);
+#else
fprintf(stderr, "zsh: exit %ld\n", (long)lastval);
+#endif
fflush(stderr);
}
@@ -3365,6 +3369,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
* classify as a builtin) we treat all errors as fatal.
* The "command" builtin is not special so resets this behaviour.
*/
+ fatal:
if (redir_err || errflag) {
if (!isset(INTERACTIVE)) {
if (forked)
diff --git a/Src/glob.c b/Src/glob.c
index d003d95da..ca2ffaf51 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -997,7 +997,9 @@ gmatchcmp(Gmatch a, Gmatch b)
break;
}
if (r)
- return (int) ((s->tp & GS_DESC) ? -r : r);
+ return (s->tp & GS_DESC) ?
+ (r < 0L ? 1 : -1) :
+ (r > 0L ? 1 : -1);
}
return 0;
}
@@ -2089,7 +2091,8 @@ xpandbraces(LinkList list, LinkNode *np)
char *dots, *p, *dots2 = NULL;
LinkNode olast = last;
/* Get the first number of the range */
- int rstart = zstrtol(str+1,&dots,10), rend = 0, err = 0, rev = 0, rincr = 1;
+ zlong rstart = zstrtol(str+1,&dots,10), rend = 0;
+ int err = 0, rev = 0, rincr = 1;
int wid1 = (dots - str) - 1, wid2 = (str2 - dots) - 2, wid3 = 0;
int strp = str - str3;
@@ -2134,7 +2137,7 @@ xpandbraces(LinkList list, LinkNode *np)
}
if (rstart > rend) {
/* Handle decreasing ranges correctly. */
- int rt = rend;
+ zlong rt = rend;
rend = rstart;
rstart = rt;
rev = !rev;
@@ -2147,7 +2150,11 @@ xpandbraces(LinkList list, LinkNode *np)
for (; rend >= rstart; rend -= rincr) {
/* Node added in at end, so do highest first */
p = dupstring(str3);
- sprintf(p + strp, "%0*d", minw, rend);
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+ sprintf(p + strp, "%0*lld", minw, rend);
+#else
+ sprintf(p + strp, "%0*ld", minw, (long)rend);
+#endif
strcat(p + strp, str2 + 1);
insertlinknode(list, last, p);
if (rev) /* decreasing: add in reverse order. */
diff --git a/Src/hashtable.c b/Src/hashtable.c
index 775b6a277..be71a1cc9 100644
--- a/Src/hashtable.c
+++ b/Src/hashtable.c
@@ -664,7 +664,8 @@ hashdir(char **dirp)
* executable plain files.
*/
if (unset(HASHEXECUTABLESONLY) ||
- (stat(pathbuf, &statbuf) == 0 &&
+ (access(pathbuf, X_OK) == 0 &&
+ stat(pathbuf, &statbuf) == 0 &&
S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IXUGO)))
add = 1;
}
diff --git a/Src/hist.c b/Src/hist.c
index 4d522dddb..0e63dca37 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2225,7 +2225,8 @@ readhistline(int start, char **bufp, int *bufsiz, FILE *in)
}
else {
buf[len - 1] = '\0';
- if (len > 1 && buf[len - 2] == '\\') {
+ if (len > 1 && buf[len - 2] == '\\' &&
+ (len < 3 || buf[len - 3] != '\\')) {
buf[--len - 1] = '\n';
if (!feof(in))
return readhistline(len, bufp, bufsiz, in);
diff --git a/Src/init.c b/Src/init.c
index 9820070fb..6f14943e1 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -215,6 +215,7 @@ loop(int toplevel, int justonce)
return LOOP_OK;
}
+/* Shared among parseargs(), parseopts(), init_io(), and init_misc() */
static char *cmd;
static int restricted;
@@ -222,9 +223,7 @@ static int restricted;
static void
parseargs(char **argv, char **runscript)
{
- int optionbreak = 0;
char **x;
- int action, optno;
LinkList paramlist;
argzero = *argv++;
@@ -247,6 +246,49 @@ parseargs(char **argv, char **runscript)
opts[SHINSTDIN] = 0;
opts[SINGLECOMMAND] = 0;
+ cmd = parseopts(NULL, &argv);
+
+ paramlist = znewlinklist();
+ if (*argv) {
+ if (unset(SHINSTDIN)) {
+ if (cmd)
+ argzero = *argv;
+ else
+ *runscript = *argv;
+ opts[INTERACTIVE] &= 1;
+ argv++;
+ }
+ while (*argv)
+ zaddlinknode(paramlist, ztrdup(*argv++));
+ } else if (!cmd)
+ opts[SHINSTDIN] = 1;
+ if(isset(SINGLECOMMAND))
+ opts[INTERACTIVE] &= 1;
+ opts[INTERACTIVE] = !!opts[INTERACTIVE];
+ if (opts[MONITOR] == 2)
+ opts[MONITOR] = opts[INTERACTIVE];
+ if (opts[HASHDIRS] == 2)
+ opts[HASHDIRS] = opts[INTERACTIVE];
+ pparams = x = (char **) zshcalloc((countlinknodes(paramlist) + 1) * sizeof(char *));
+
+ while ((*x++ = (char *)getlinknode(paramlist)));
+ free(paramlist);
+ argzero = ztrdup(argzero);
+}
+
+/**/
+mod_export char *
+parseopts(char *nam, char ***argvp)
+{
+ int optionbreak = 0;
+ int action, optno;
+ char *cmd = 0; /* deliberately hides static */
+ char **argv = *argvp;
+
+#define WARN_OPTION(F, S) if (nam) zwarnnam(nam, F, S); else zerr(F, S)
+#define LAST_OPTION(N) \
+ if (nam) { if (*argv) argv++; goto doneargv; } else exit(N)
+
/* loop through command line options (begins with "-" or "+") */
while (!optionbreak && *argv && (**argv == '-' || **argv == '+')) {
char *args = *argv;
@@ -267,11 +309,11 @@ parseargs(char **argv, char **runscript)
if (!strcmp(*argv, "version")) {
printf("zsh %s (%s-%s-%s)\n",
ZSH_VERSION, MACHTYPE, VENDOR, OSTYPE);
- exit(0);
+ LAST_OPTION(0);
}
if (!strcmp(*argv, "help")) {
printhelp();
- exit(0);
+ LAST_OPTION(0);
}
/* `-' characters are allowed in long options */
for(args = *argv; *args; args++)
@@ -292,75 +334,58 @@ parseargs(char **argv, char **runscript)
if (!*++*argv)
argv++;
if (!*argv) {
- zerr("string expected after -o");
- exit(1);
+ WARN_OPTION("string expected after -o", NULL);
+ LAST_OPTION(1);
}
longoptions:
if (!(optno = optlookup(*argv))) {
- zerr("no such option: %s", *argv);
- exit(1);
- } else if (optno == RESTRICTED)
+ WARN_OPTION("no such option: %s", *argv);
+ LAST_OPTION(1);
+ } else if (optno == RESTRICTED && !nam) {
restricted = action;
- else
- dosetopt(optno, action, 1);
+ } else if ((optno == EMACSMODE || optno == VIMODE) && nam) {
+ WARN_OPTION("can't change option: %s", *argv);
+ } else if (dosetopt(optno, action, !nam) && nam) {
+ WARN_OPTION("can't change option: %s", *argv);
+ }
break;
} else if (isspace(STOUC(**argv))) {
/* zsh's typtab not yet set, have to use ctype */
while (*++*argv)
if (!isspace(STOUC(**argv))) {
- badoptionstring:
- zerr("bad option string: `%s'", args);
- exit(1);
+ badoptionstring:
+ WARN_OPTION("bad option string: '%s'", args);
+ LAST_OPTION(1);
}
break;
} else {
if (!(optno = optlookupc(**argv))) {
- zerr("bad option: -%c", **argv);
- exit(1);
- } else if (optno == RESTRICTED)
+ WARN_OPTION("bad option: -%c", **argv);
+ LAST_OPTION(1);
+ } else if (optno == RESTRICTED && !nam) {
restricted = action;
- else
- dosetopt(optno, action, 1);
+ } else if ((optno == EMACSMODE || optno == VIMODE) && nam) {
+ WARN_OPTION("can't change option: %s", *argv);
+ } else if (dosetopt(optno, action, !nam) && nam) {
+ WARN_OPTION("can't change option: -%c", **argv);
+ }
}
}
argv++;
}
- doneoptions:
- paramlist = znewlinklist();
+ doneoptions:
if (cmd) {
if (!*argv) {
- zerr("string expected after -%s", cmd);
- exit(1);
+ WARN_OPTION("string expected after -%s", cmd);
+ LAST_OPTION(1);
}
cmd = *argv++;
}
- if (*argv) {
- if (unset(SHINSTDIN)) {
- if (cmd)
- argzero = *argv;
- else
- *runscript = *argv;
- opts[INTERACTIVE] &= 1;
- argv++;
- }
- while (*argv)
- zaddlinknode(paramlist, ztrdup(*argv++));
- } else if (!cmd)
- opts[SHINSTDIN] = 1;
- if(isset(SINGLECOMMAND))
- opts[INTERACTIVE] &= 1;
- opts[INTERACTIVE] = !!opts[INTERACTIVE];
- if (opts[MONITOR] == 2)
- opts[MONITOR] = opts[INTERACTIVE];
- if (opts[HASHDIRS] == 2)
- opts[HASHDIRS] = opts[INTERACTIVE];
- pparams = x = (char **) zshcalloc((countlinknodes(paramlist) + 1) * sizeof(char *));
-
- while ((*x++ = (char *)getlinknode(paramlist)));
- free(paramlist);
- argzero = ztrdup(argzero);
+ doneargv:
+ *argvp = argv;
+ return cmd;
}
-
+
/**/
static void
printhelp(void)
diff --git a/Src/jobs.c b/Src/jobs.c
index 94d25bb85..c9c549e1e 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -716,17 +716,22 @@ printtime(struct timeval *real, child_times_t *ti, char *desc)
#endif
#ifdef HAVE_STRUCT_RUSAGE_RU_IXRSS
case 'X':
- fprintf(stderr, "%ld", (long)(ti->ru_ixrss / total_time));
+ fprintf(stderr, "%ld",
+ total_time ?
+ (long)(ti->ru_ixrss / total_time) :
+ (long)0);
break;
#endif
#ifdef HAVE_STRUCT_RUSAGE_RU_IDRSS
case 'D':
fprintf(stderr, "%ld",
+ total_time ?
(long) ((ti->ru_idrss
#ifdef HAVE_STRUCT_RUSAGE_RU_ISRSS
+ ti->ru_isrss
#endif
- ) / total_time));
+ ) / total_time) :
+ (long)0);
break;
#endif
#if defined(HAVE_STRUCT_RUSAGE_RU_IDRSS) || \
@@ -735,6 +740,7 @@ printtime(struct timeval *real, child_times_t *ti, char *desc)
case 'K':
/* treat as D if X not available */
fprintf(stderr, "%ld",
+ total_time ?
(long) ((
#ifdef HAVE_STRUCT_RUSAGE_RU_IXRSS
ti->ru_ixrss
@@ -747,7 +753,8 @@ printtime(struct timeval *real, child_times_t *ti, char *desc)
#ifdef HAVE_STRUCT_RUSAGE_RU_ISRSS
+ ti->ru_isrss
#endif
- ) / total_time));
+ ) / total_time) :
+ (long)0);
break;
#endif
#ifdef HAVE_STRUCT_RUSAGE_RU_MAXRSS
@@ -2157,10 +2164,15 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
/* check for, and interpret, a signal specifier */
if (*argv && **argv == '-') {
- if (idigit((*argv)[1]))
+ if (idigit((*argv)[1])) {
+ char *endp;
/* signal specified by number */
- sig = atoi(*argv + 1);
- else if ((*argv)[1] != '-' || (*argv)[2]) {
+ sig = zstrtol(*argv + 1, &endp, 10);
+ if (*endp) {
+ zwarnnam(nam, "invalid signal number: %s", *argv);
+ return 1;
+ }
+ } else if ((*argv)[1] != '-' || (*argv)[2]) {
char *signame;
/* with argument "-l" display the list of signal names */
diff --git a/Src/options.c b/Src/options.c
index 5fbb06b11..c6db75372 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -523,6 +523,20 @@ emulate(const char *zsh_name, int fully)
if (fully)
emulation |= EMULATE_FULLY;
installemulation();
+
+ if (funcstack && funcstack->tp == FS_FUNC) {
+ /*
+ * We are inside a function. Decide if it's traced.
+ * Pedantic note: the function in the function table isn't
+ * guaranteed to be what we're executing, but it's
+ * close enough.
+ */
+ Shfunc shf = (Shfunc)shfunctab->getnode(shfunctab, funcstack->name);
+ if (shf && (shf->node.flags & PM_TAGGED)) {
+ /* Tracing is on, so set xtrace */
+ opts[XTRACE] = 1;
+ }
+ }
}
/* setopt, unsetopt */
@@ -753,6 +767,8 @@ dosetopt(int optno, int value, int force)
return -1;
#endif /* GETPWNAM_FAKED */
} else if ((optno == EMACSMODE || optno == VIMODE) && value) {
+ if (sticky_emulation)
+ return -1;
zleentry(ZLE_CMD_SET_KEYMAP, optno);
opts[(optno == EMACSMODE) ? VIMODE : EMACSMODE] = 0;
} else if (optno == SUNKEYBOARDHACK) {
diff --git a/Src/params.c b/Src/params.c
index 59d5daf2f..8649178ef 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -315,7 +315,7 @@ IPDEF4("LINENO", &lineno),
IPDEF4("PPID", &ppid),
IPDEF4("ZSH_SUBSHELL", &zsh_subshell),
-#define IPDEF5(A,B,F) {{NULL,A,PM_INTEGER|PM_SPECIAL},BR((void *)B),GSU(varinteger_gsu),10,0,NULL,NULL,NULL,0}
+#define IPDEF5(A,B,F) {{NULL,A,PM_INTEGER|PM_SPECIAL},BR((void *)B),GSU(F),10,0,NULL,NULL,NULL,0}
IPDEF5("COLUMNS", &zterm_columns, zlevar_gsu),
IPDEF5("LINES", &zterm_lines, zlevar_gsu),
IPDEF5("OPTIND", &zoptind, varinteger_gsu),
@@ -698,16 +698,18 @@ createparamtable(void)
* So allow the user to set it in the special cases where it's
* useful.
*/
- setsparam("TMPPREFIX", ztrdup(DEFAULT_TMPPREFIX));
- setsparam("TIMEFMT", ztrdup(DEFAULT_TIMEFMT));
- setsparam("WATCHFMT", ztrdup(default_watchfmt));
+ setsparam("TMPPREFIX", ztrdup_metafy(DEFAULT_TMPPREFIX));
+ setsparam("TIMEFMT", ztrdup_metafy(DEFAULT_TIMEFMT));
+ setsparam("WATCHFMT", ztrdup_metafy(default_watchfmt));
hostnam = (char *)zalloc(256);
gethostname(hostnam, 256);
- setsparam("HOST", ztrdup(hostnam));
+ setsparam("HOST", ztrdup_metafy(hostnam));
zfree(hostnam, 256);
- setsparam("LOGNAME", ztrdup((str = getlogin()) && *str ? str : cached_username));
+ setsparam("LOGNAME",
+ ztrdup_metafy((str = getlogin()) && *str ?
+ str : cached_username));
#if !defined(HAVE_PUTENV) && !defined(USE_SET_UNSET_ENV)
/* Copy the environment variables we are inheriting to dynamic *
@@ -778,22 +780,22 @@ createparamtable(void)
if(uname(&unamebuf)) setsparam("CPUTYPE", ztrdup("unknown"));
else
{
- machinebuf = ztrdup(unamebuf.machine);
+ machinebuf = ztrdup_metafy(unamebuf.machine);
setsparam("CPUTYPE", machinebuf);
}
-
+
#else
- setsparam("CPUTYPE", ztrdup("unknown"));
+ setsparam("CPUTYPE", ztrdup_metafy("unknown"));
#endif
- setsparam("MACHTYPE", ztrdup(MACHTYPE));
- setsparam("OSTYPE", ztrdup(OSTYPE));
- setsparam("TTY", ztrdup(ttystrname));
- setsparam("VENDOR", ztrdup(VENDOR));
- setsparam("ZSH_NAME", ztrdup(zsh_name));
- setsparam("ZSH_VERSION", ztrdup(ZSH_VERSION));
- setsparam("ZSH_PATCHLEVEL", ztrdup(ZSH_PATCHLEVEL));
+ setsparam("MACHTYPE", ztrdup_metafy(MACHTYPE));
+ setsparam("OSTYPE", ztrdup_metafy(OSTYPE));
+ setsparam("TTY", ztrdup_metafy(ttystrname));
+ setsparam("VENDOR", ztrdup_metafy(VENDOR));
+ setsparam("ZSH_NAME", ztrdup_metafy(zsh_name));
+ setsparam("ZSH_VERSION", ztrdup_metafy(ZSH_VERSION));
+ setsparam("ZSH_PATCHLEVEL", ztrdup_metafy(ZSH_PATCHLEVEL));
setaparam("signals", sigptr = zalloc((SIGCOUNT+4) * sizeof(char *)));
- for (t = sigs; (*sigptr++ = ztrdup(*t++)); );
+ for (t = sigs; (*sigptr++ = ztrdup_metafy(*t++)); );
noerrs = 0;
}
@@ -1903,6 +1905,18 @@ fetchvalue(Value v, char **pptr, int bracks, int flags)
if (!bracks && *s)
return NULL;
*pptr = s;
+#if 0
+ /*
+ * Check for large subscripts that might be erroneous.
+ * This code is too gross in several ways:
+ * - the limit is completely arbitrary
+ * - the test vetoes operations on existing arrays
+ * - it's not at all clear a general test on large arrays of
+ * this kind is any use.
+ *
+ * Until someone comes up with workable replacement code it's
+ * therefore commented out.
+ */
if (v->start > MAX_ARRLEN) {
zerr("subscript too %s: %d", "big", v->start + !isset(KSHARRAYS));
return NULL;
@@ -1919,6 +1933,7 @@ fetchvalue(Value v, char **pptr, int bracks, int flags)
zerr("subscript too %s: %d", "small", v->end);
return NULL;
}
+#endif
return v;
}
@@ -3454,18 +3469,104 @@ tiedarrunsetfn(Param pm, UNUSED(int exp))
/**/
static void
-arrayuniq(char **x, int freeok)
+simple_arrayuniq(char **x, int freeok)
{
char **t, **p = x;
+ char *hole = "";
+ /* Find duplicates and replace them with holes */
while (*++p)
for (t = x; t < p; t++)
- if (!strcmp(*p, *t)) {
+ if (*t != hole && !strcmp(*p, *t)) {
if (freeok)
zsfree(*p);
- for (t = p--; (*t = t[1]) != NULL; t++);
+ *p = hole;
break;
}
+ /* Swap non-holes into holes in optimal jumps */
+ for (p = t = x; *t != NULL; t++) {
+ if (*t == hole) {
+ while (*p == hole)
+ ++p;
+ if ((*t = *p) != NULL)
+ *p++ = hole;
+ } else if (p == t)
+ p++;
+ }
+ /* Erase all the remaining holes, just in case */
+ while (++t < p)
+ *t = NULL;
+}
+
+/**/
+static void
+arrayuniq_freenode(HashNode hn)
+{
+ (void)hn;
+}
+
+/**/
+HashTable
+newuniqtable(zlong size)
+{
+ HashTable ht = newhashtable((int)size, "arrayuniq", NULL);
+ /* ??? error checking */
+
+ ht->hash = hasher;
+ ht->emptytable = emptyhashtable;
+ ht->filltable = NULL;
+ ht->cmpnodes = strcmp;
+ ht->addnode = addhashnode;
+ ht->getnode = gethashnode2;
+ ht->getnode2 = gethashnode2;
+ ht->removenode = removehashnode;
+ ht->disablenode = disablehashnode;
+ ht->enablenode = enablehashnode;
+ ht->freenode = arrayuniq_freenode;
+ ht->printnode = NULL;
+
+ return ht;
+}
+
+/**/
+static void
+arrayuniq(char **x, int freeok)
+{
+ char **it, **write_it;
+ zlong array_size = arrlen(x);
+ HashTable ht;
+
+ if (array_size == 0)
+ return;
+ if (array_size < 10 || !(ht = newuniqtable(array_size + 1))) {
+ /* fallback to simpler routine */
+ simple_arrayuniq(x, freeok);
+ return;
+ }
+
+ for (it = x, write_it = x; *it;) {
+ if (! gethashnode2(ht, *it)) {
+ HashNode new_node = zhalloc(sizeof(struct hashnode));
+ if (!new_node) {
+ /* Oops, out of heap memory, no way to recover */
+ zerr("out of memory in arrayuniq");
+ break;
+ }
+ (void) addhashnode2(ht, *it, new_node);
+ *write_it = *it;
+ if (it != write_it)
+ *it = NULL;
+ ++write_it;
+ }
+ else {
+ if (freeok)
+ zsfree(*it);
+ *it = NULL;
+ }
+ ++it;
+ }
+
+ deletehashtable(ht);
}
/**/
diff --git a/Src/prompt.c b/Src/prompt.c
index d15b7c0d4..e51ce2451 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -663,12 +663,20 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
break;
case 'L':
addbufspc(DIGBUFSIZE);
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+ sprintf(bv->bp, "%lld", shlvl);
+#else
sprintf(bv->bp, "%ld", (long)shlvl);
+#endif
bv->bp += strlen(bv->bp);
break;
case '?':
addbufspc(DIGBUFSIZE);
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+ sprintf(bv->bp, "%lld", lastval);
+#else
sprintf(bv->bp, "%ld", (long)lastval);
+#endif
bv->bp += strlen(bv->bp);
break;
case '%':
@@ -764,7 +772,11 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
if (funcstack->tp == FS_EVAL)
lineno--;
addbufspc(DIGBUFSIZE);
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+ sprintf(bv->bp, "%lld", flineno);
+#else
sprintf(bv->bp, "%ld", (long)flineno);
+#endif
bv->bp += strlen(bv->bp);
break;
}
@@ -772,7 +784,11 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
/* FALLTHROUGH */
case 'i':
addbufspc(DIGBUFSIZE);
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+ sprintf(bv->bp, "%lld", lineno);
+#else
sprintf(bv->bp, "%ld", (long)lineno);
+#endif
bv->bp += strlen(bv->bp);
break;
case 'x':
diff --git a/Src/subst.c b/Src/subst.c
index b9229861b..932f41287 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1649,7 +1649,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
* This is one of the things that decides whether multsub
* will produce an array, but in an extremely indirect fashion.
*/
- int nojoin = (pf_flags & PREFORK_SHWORDSPLIT) ? !(ifs && *ifs) : 0;
+ int nojoin = (pf_flags & PREFORK_SHWORDSPLIT) ? !(ifs && *ifs) && !qt : 0;
/*
* != 0 means ${...}, otherwise $... What works without braces
* is largely a historical artefact (everything works with braces,
@@ -1828,6 +1828,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
quotemod = 1;
quotetype = QT_SINGLE_OPTIONAL;
} else {
+ if (quotetype == QT_SINGLE_OPTIONAL) {
+ /* extra q's after '-' not allowed */
+ goto flagerr;
+ }
quotemod++, quotetype++;
}
break;
@@ -2872,6 +2876,69 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
}
break;
}
+ } else if (inbrace && (*s == '|' || *s == Bar ||
+ *s == '*' || *s == Star)) {
+ int intersect = (*s == '*' || *s == Star);
+ char **compare, **ap, **apsrc;
+ ++s;
+ if (*itype_end(s, IIDENT, 0)) {
+ untokenize(s);
+ zerr("not an identifier: %s", s);
+ return NULL;
+ }
+ compare = getaparam(s);
+ if (compare) {
+ HashTable ht = newuniqtable(arrlen(compare)+1);
+ int present;
+ for (ap = compare; *ap; ap++)
+ (void)addhashnode2(ht, *ap, (HashNode)
+ zhalloc(sizeof(struct hashnode)));
+ if (!vunset && isarr) {
+ if (!copied) {
+ aval = arrdup(aval);
+ copied = 1;
+ }
+ for (ap = apsrc = aval; *apsrc; apsrc++) {
+ untokenize(*apsrc);
+ present = (gethashnode2(ht, *apsrc) != NULL);
+ if (intersect ? present : !present) {
+ if (ap != apsrc) {
+ *ap = *apsrc;
+ }
+ ap++;
+ }
+ }
+ *ap = NULL;
+ } else {
+ if (vunset) {
+ if (unset(UNSET)) {
+ *idend = '\0';
+ zerr("%s: parameter not set", idbeg);
+ deletehashtable(ht);
+ return NULL;
+ }
+ val = dupstring("");
+ } else {
+ present = (gethashnode2(ht, val) != NULL);
+ if (intersect ? !present : present)
+ val = dupstring("");
+ }
+ }
+ deletehashtable(ht);
+ } else if (intersect) {
+ /*
+ * The intersection with nothing is nothing...
+ * Seems a bit pointless complaining that the first
+ * expression is unset here if the second is, too.
+ */
+ if (!vunset) {
+ if (isarr) {
+ aval = mkarray(NULL);
+ } else {
+ val = dupstring("");
+ }
+ }
+ }
} else { /* no ${...=...} or anything, but possible modifiers. */
/*
* Handler ${+...}. TODO: strange, why do we handle this only
diff --git a/Src/utils.c b/Src/utils.c
index 014cb2fa2..d35ca1dfd 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -275,9 +275,13 @@ zerrmsg(FILE *file, const char *fmt, va_list ap)
#endif
char *errmsg;
- if ((unset(SHINSTDIN) || locallevel) && lineno)
+ if ((unset(SHINSTDIN) || locallevel) && lineno) {
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+ fprintf(file, "%lld: ", lineno);
+#else
fprintf(file, "%ld: ", (long)lineno);
- else
+#endif
+ } else
fputc((unsigned char)' ', file);
while (*fmt)
@@ -1682,7 +1686,7 @@ adjustwinsize(int from)
(shttyinfo.winsize.ws_row != ttyrows ||
shttyinfo.winsize.ws_col != ttycols)) {
/* shttyinfo.winsize is already set up correctly */
- ioctl(SHTTY, TIOCSWINSZ, (char *)&shttyinfo.winsize);
+ /* ioctl(SHTTY, TIOCSWINSZ, (char *)&shttyinfo.winsize); */
}
#endif /* TIOCGWINSZ */
@@ -3110,7 +3114,7 @@ wordcount(char *s, char *sep, int mul)
r = 1;
sl = strlen(sep);
for (; (c = findsep(&s, sep, 0)) >= 0; s += sl)
- if ((c && *(s + sl)) || mul)
+ if ((c || mul) && (sl || *(s + sl)))
r++;
} else {
char *t = s;
@@ -4009,6 +4013,28 @@ metafy(char *buf, int len, int heap)
/*
+ * Duplicate a string, metafying it as we go.
+ *
+ * Typically, this is used only for strings imported from outside
+ * zsh, as strings internally are either already metafied or passed
+ * around with an associated length.
+ */
+/**/
+mod_export char *
+ztrdup_metafy(const char *s)
+{
+ /* To mimic ztrdup() behaviour */
+ if (!s)
+ return NULL;
+ /*
+ * metafy() does lots of different things, so the pointer
+ * isn't const. Using it with META_DUP should be safe.
+ */
+ return metafy((char *)s, -1, META_DUP);
+}
+
+
+/*
* Take a null-terminated, metafied string in s into a literal
* representation by converting in place. The length is in *len
* len is non-NULL; if len is NULL, you don't know the length of
@@ -4709,7 +4735,7 @@ quotestring(const char *s, char **e, int instring)
char *v;
int alloclen;
char *buf;
- int sf = 0, shownull;
+ int sf = 0, shownull = 0;
/*
* quotesub is used with QT_SINGLE_OPTIONAL.
* quotesub = 0: mechanism not active
@@ -4724,14 +4750,12 @@ quotestring(const char *s, char **e, int instring)
const char *uend;
slen = strlen(s);
- if (instring == QT_BACKSLASH_SHOWNULL) {
- shownull = 1;
- instring = QT_BACKSLASH;
- } else {
- shownull = 0;
- }
switch (instring)
{
+ case QT_BACKSLASH_SHOWNULL:
+ shownull = 1;
+ instring = QT_BACKSLASH;
+ /*FALLTHROUGH*/
case QT_BACKSLASH:
/*
* With QT_BACKSLASH we may need to use $'\300' stuff.
@@ -4739,22 +4763,23 @@ quotestring(const char *s, char **e, int instring)
* storage and using heap for correct size at end.
*/
alloclen = slen * 7 + 1;
- if (!*s && shownull)
- alloclen += 2; /* for '' */
break;
case QT_SINGLE_OPTIONAL:
/*
* Here, we may need to add single quotes.
+ * Always show empty strings.
*/
alloclen = slen * 4 + 3;
- quotesub = 1;
+ quotesub = shownull = 1;
break;
default:
alloclen = slen * 4 + 1;
break;
}
+ if (!*s && shownull)
+ alloclen += 2; /* for '' */
quotestart = v = buf = zshcalloc(alloclen);
diff --git a/Src/zsh_system.h b/Src/zsh_system.h
index f38533023..f20a7bb90 100644
--- a/Src/zsh_system.h
+++ b/Src/zsh_system.h
@@ -874,3 +874,7 @@ extern short ospeed;
# endif
# endif
#endif
+
+#ifdef TGOTO_PROTO_MISSING
+char *tgoto(const char *cap, int col, int row);
+#endif
diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
index 57427557f..494261ee3 100644
--- a/Test/C02cond.ztst
+++ b/Test/C02cond.ztst
@@ -139,7 +139,7 @@
elif [[ "$(find . -prune -fstype nfs 2>/dev/null)" == "." ]]; then
print -u$ZTST_fd "Warning: not testing [[ -N file ]] (not supported with NFS)"
true
- elif test -f /etc/mtab && { grep $(df . | tail -n1 | awk '{print $1}') /etc/mtab | grep -q noatime; }; then
+ elif test -f /etc/mtab && { grep $(df . 2>/dev/null| tail -n1 | awk '{print $1}') /etc/mtab | grep -q noatime; }; then
print -u$ZTST_fd "Warning: not testing [[ -N file ]] (not supported with noatime file system)"
true
else
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 7eb721226..01f841218 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -169,6 +169,34 @@
>a-string-with-slashes
>a-string-with-slashes
+ args=('one' '#foo' '(bar' "'three'" two)
+ mod=('#foo' '(bar' "'three'" sir_not_appearing_in_this_film)
+ print ${args:|mod}
+ print ${args:*mod}
+ print "${(@)args:|mod}"
+ print "${(@)args:*mod}"
+ args=(two words)
+ mod=('one word' 'two words')
+ print "${args:|mod}"
+ print "${args:*mod}"
+ scalar='two words'
+ print ${scalar:|mod}
+ print ${scalar:*mod}
+ print ${args:*nonexistent}
+ empty=
+ print ${args:*empty}
+0:"|" array exclusion and "*" array intersection
+>one two
+>#foo (bar 'three'
+>one two
+>#foo (bar 'three'
+>
+>two words
+>
+>two words
+>
+>
+
str1='twocubed'
array=(the number of protons in an oxygen nucleus)
print $#str1 ${#str1} "$#str1 ${#str1}" $#array ${#array} "$#array ${#array}"
@@ -385,6 +413,13 @@
>$'playing \'stupid\' "games" \\w\\i\\t\\h $quoting.'
>'playing '\'stupid\'' "games" \w\i\t\h $quoting.'
+ x=( a '' '\b' 'c d' '$e' )
+ print -r ${(q)x}
+ print -r ${(q-)x}
+0:Another ${(q...)...} test
+>a '' \\b c\ d \$e
+>a '' '\b' 'c d' '$e'
+
print -r -- ${(q-):-foo}
print -r -- ${(q-):-foo bar}
print -r -- ${(q-):-"*(.)"}
@@ -1076,6 +1111,16 @@
>i
>willJOYCE
+ print -l JAMES${(u)${=:-$(echo yes yes she said yes i will yes she said she will and yes she did yes)}}JOYCE
+0:New hash seive unique algorithm for arrays of more than 10 elements
+>JAMESyes
+>she
+>said
+>i
+>will
+>and
+>didJOYCE
+
foo=
print "${${foo}/?*/replacement}"
0:Quoted zero-length strings are handled properly
@@ -1247,7 +1292,7 @@
>in
>it
- foo="line:with::missing::fields:in:it"
+ foo="line:with::missing::fields:in:it:"
print -l "${(@s.:.)foo}"
0:Retention of empty fields in quoted splitting with "@"
>line
@@ -1258,6 +1303,20 @@
>fields
>in
>it
+>
+
+ str=abcd
+ print -l ${(s..)str}
+ print -l "${(s..)str}"
+0:splitting of strings into characters
+>a
+>b
+>c
+>d
+>a
+>b
+>c
+>d
array=('%' '$' 'j' '*' '$foo')
print ${array[(i)*]} "${array[(i)*]}"
@@ -1475,3 +1534,13 @@
print ${#foo}
0:Nularg removed from split empty string
>0
+
+ (set -- a b c
+ setopt shwordsplit
+ IFS=
+ print -rl "$*"
+ unset IFS
+ print -rl "$*")
+0:Regression test for shwordsplit with null or unset IFS and quoted array
+>abc
+>a b c
diff --git a/configure.ac b/configure.ac
index 54999b164..6c0459747 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1010,6 +1010,37 @@ main() { return sizeof(ino_t) < 8; }
fi
fi
fi
+AH_TEMPLATE([ZLONG_IS_LONG_LONG],
+[Define to 1 if the zlong type uses long long int.])
+if test "$zsh_cv_64_bit_type" = "long long"; then
+ dnl Remember this so we can get (s)printf output right.
+ AC_DEFINE(ZLONG_IS_LONG_LONG)
+fi
+
+dnl We'll blithely assume (f)printf supports the same types as sprintf.
+AC_CACHE_CHECK(for %lld printf support, zsh_cv_printf_has_lld,
+[AC_TRY_RUN(
+[#include <stdio.h>
+#include <string.h>
+int main(int argc, char **argv)
+{
+ long long foo = ((long long)0xdead << 40) | 0xf00d;
+ char buf[80];
+ sprintf(buf, "before%lldafter", foo);
+ if (!strcmp(buf, "before62677660341432333after")) {
+ return 0;
+ }
+ return 1;
+}
+],
+zsh_cv_printf_has_lld=yes,
+zsh_cv_printf_has_lld=no,
+zsh_cv_printf_has_lld=no)])
+AH_TEMPLATE(PRINTF_HAS_LLD,
+[Define to 1 if printf and sprintf support %lld for long long.])
+if test x$zsh_cv_printf_has_lld = xyes; then
+ AC_DEFINE(PRINTF_HAS_LLD)
+fi
dnl Check for sigset_t. Currently I'm looking in
dnl <sys/types.h> and <signal.h>. Others might need
@@ -1572,6 +1603,8 @@ AH_TEMPLATE([HAVE_NUMNAMES],
[Define if you have the terminfo numnames symbol.])
AH_TEMPLATE([HAVE_STRNAMES],
[Define if you have the terminfo strnames symbol.])
+AH_TEMPLATE([TGOTO_PROTO_MISSING],
+[Define if there is no prototype for the tgoto() terminal function.])
if test x$zsh_cv_path_term_header != xnone; then
AC_DEFINE(ZSH_HAVE_TERM_H)
@@ -1587,26 +1620,42 @@ if test x$zsh_cv_path_term_header != xnone; then
AC_TRY_LINK($term_includes, [char **test = boolcodes; puts(*test);],
AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes, boolcodes=no)
AC_MSG_RESULT($boolcodes)
+
AC_MSG_CHECKING(if numcodes is available)
AC_TRY_LINK($term_includes, [char **test = numcodes; puts(*test);],
AC_DEFINE(HAVE_NUMCODES) numcodes=yes, numcodes=no)
AC_MSG_RESULT($numcodes)
+
AC_MSG_CHECKING(if strcodes is available)
AC_TRY_LINK($term_includes, [char **test = strcodes; puts(*test);],
AC_DEFINE(HAVE_STRCODES) strcodes=yes, strcodes=no)
AC_MSG_RESULT($strcodes)
+
AC_MSG_CHECKING(if boolnames is available)
AC_TRY_LINK($term_includes, [char **test = boolnames; puts(*test);],
AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes, boolnames=no)
AC_MSG_RESULT($boolnames)
+
AC_MSG_CHECKING(if numnames is available)
AC_TRY_LINK($term_includes, [char **test = numnames; puts(*test);],
AC_DEFINE(HAVE_NUMNAMES) numnames=yes, numnames=no)
AC_MSG_RESULT($numnames)
+
AC_MSG_CHECKING(if strnames is available)
AC_TRY_LINK($term_includes, [char **test = strnames; puts(*test);],
AC_DEFINE(HAVE_STRNAMES) strnames=yes, strnames=no)
AC_MSG_RESULT($strnames)
+
+ dnl There are apparently defective terminal library headers on some
+ dnl versions of Solaris before 11.
+ AC_MSG_CHECKING(if tgoto prototype is missing)
+ tgoto_includes="$term_includes
+/* guaranteed to clash with any valid tgoto prototype */
+extern void tgoto(int **stuff, float **more_stuff);"
+ AC_TRY_LINK($tgoto_includes,
+ [int *stuff; float *more_stuff; tgoto(&stuff, &more_stuff);],
+ AC_DEFINE(TGOTO_PROTO_MISSING) tgotoprotomissing=yes, tgotoprotomissing=no)
+ AC_MSG_RESULT($tgotoprotomissing)
else
ZSH_TERM_H=
fi