summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2013-11-07 14:52:31 +0100
committerAxel Beckert <abe@deuxchevaux.org>2013-11-07 14:52:31 +0100
commitd799ac78a744a5359563af55b4dee9e91255a1dc (patch)
tree73475ed7089e6ee050085a96b88018994b43bdfc
parentabfb3b136a4ad5b2832fb7d920442a2bb28c0697 (diff)
parent375115c7dfd6dff576915d25fe2ecdd381dd9d81 (diff)
downloadzsh-d799ac78a744a5359563af55b4dee9e91255a1dc.tar.gz
zsh-d799ac78a744a5359563af55b4dee9e91255a1dc.zip
Merge branch 'upstream' into debian
-rw-r--r--.cvsignore1
-rw-r--r--.editorconfig4
-rw-r--r--.gitignore7
-rw-r--r--ChangeLog1073
-rw-r--r--Completion/Base/Utility/.distfiles26
-rw-r--r--Completion/Base/Utility/_comp_locale20
-rw-r--r--Completion/Base/Widget/_complete_help70
-rw-r--r--Completion/Base/Widget/_complete_tag5
-rw-r--r--Completion/Debian/Command/.distfiles2
-rw-r--r--Completion/Debian/Command/_dak4
-rw-r--r--Completion/Debian/Command/_dcut160
-rw-r--r--Completion/Debian/Command/_dput61
-rw-r--r--Completion/Debian/Command/_linda26
-rw-r--r--Completion/Linux/Command/_brctl6
-rw-r--r--Completion/Linux/Command/_btrfs2
-rw-r--r--Completion/Unix/Command/.distfiles4
-rw-r--r--Completion/Unix/Command/_awk6
-rw-r--r--Completion/Unix/Command/_cat43
-rw-r--r--Completion/Unix/Command/_cp92
-rw-r--r--Completion/Unix/Command/_cut74
-rw-r--r--Completion/Unix/Command/_devtodo6
-rw-r--r--Completion/Unix/Command/_django2
-rw-r--r--Completion/Unix/Command/_du18
-rw-r--r--Completion/Unix/Command/_etags63
-rw-r--r--Completion/Unix/Command/_git700
-rw-r--r--Completion/Unix/Command/_gradle16
-rw-r--r--Completion/Unix/Command/_graphicsmagick2
-rw-r--r--Completion/Unix/Command/_gzip6
-rw-r--r--Completion/Unix/Command/_imagemagick2
-rw-r--r--Completion/Unix/Command/_java24
-rw-r--r--Completion/Unix/Command/_make86
-rw-r--r--Completion/Unix/Command/_osc149
-rw-r--r--Completion/Unix/Command/_perforce10
-rw-r--r--Completion/Unix/Command/_prove51
-rw-r--r--Completion/Unix/Command/_psutils34
-rw-r--r--Completion/Unix/Command/_qemu6
-rw-r--r--Completion/Unix/Command/_rsync13
-rw-r--r--Completion/Unix/Command/_sed2
-rw-r--r--Completion/Unix/Command/_sh11
-rw-r--r--Completion/Unix/Command/_sort62
-rw-r--r--Completion/Unix/Command/_ssh2
-rw-r--r--Completion/Unix/Command/_subversion14
-rw-r--r--Completion/Unix/Command/_systemd12
-rw-r--r--Completion/Unix/Command/_twisted109
-rw-r--r--Completion/Unix/Command/_vcsh149
-rw-r--r--Completion/Unix/Command/_wget20
-rw-r--r--Completion/Unix/Command/_xmlsoft16
-rw-r--r--Completion/Unix/Type/.distfiles2
-rw-r--r--Completion/Unix/Type/_files2
-rw-r--r--Completion/Unix/Type/_java_class2
-rw-r--r--Completion/Unix/Type/_postscript (renamed from Completion/Unix/Type/_ps)0
-rw-r--r--Completion/Unix/Type/_terminals2
-rw-r--r--Completion/X/Command/_mplayer4
-rw-r--r--Completion/X/Command/_xrandr50
-rw-r--r--Completion/Zsh/Command/_cd16
-rw-r--r--Completion/Zsh/Command/_disable15
-rw-r--r--Completion/Zsh/Command/_enable14
-rw-r--r--Completion/Zsh/Command/_fc32
-rw-r--r--Completion/Zsh/Command/_typeset28
-rw-r--r--Completion/Zsh/Context/_math4
-rw-r--r--Completion/Zsh/Context/_zcalc_line2
-rw-r--r--Completion/Zsh/Type/.distfiles3
-rw-r--r--Completion/Zsh/Type/_math_params3
-rw-r--r--Completion/Zsh/Type/_module_math_func9
-rw-r--r--Completion/Zsh/Type/_user_math_func9
-rw-r--r--Completion/bashcompinit4
-rw-r--r--Completion/compaudit47
-rw-r--r--Completion/compinit3
-rw-r--r--Completion/openSUSE/Command/_osc4
-rw-r--r--Completion/openSUSE/Command/_zypper5
-rw-r--r--Config/version.mk4
-rw-r--r--Doc/Zsh/builtins.yo158
-rw-r--r--Doc/Zsh/calsys.yo17
-rw-r--r--Doc/Zsh/compsys.yo170
-rw-r--r--Doc/Zsh/contrib.yo82
-rw-r--r--Doc/Zsh/expn.yo54
-rw-r--r--Doc/Zsh/func.yo24
-rw-r--r--Doc/Zsh/jobs.yo15
-rw-r--r--Doc/Zsh/mod_curses.yo6
-rw-r--r--Doc/Zsh/mod_mapfile.yo9
-rw-r--r--Doc/Zsh/mod_mathfunc.yo2
-rw-r--r--Doc/Zsh/mod_parameter.yo8
-rw-r--r--Doc/Zsh/options.yo44
-rw-r--r--Doc/Zsh/params.yo18
-rw-r--r--Doc/Zsh/prompt.yo9
-rw-r--r--Doc/Zsh/zle.yo5
-rw-r--r--Doc/zmacros.yo1
-rw-r--r--Doc/ztexi.yo6
-rw-r--r--Etc/FAQ.yo2
-rw-r--r--Etc/zsh-development-guide152
-rw-r--r--Functions/Calendar/age14
-rw-r--r--Functions/MIME/zsh-mime-handler15
-rw-r--r--Functions/Misc/run-help4
-rw-r--r--Functions/Misc/zcalc28
-rw-r--r--Functions/Misc/zmv15
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git34
-rw-r--r--Functions/Zle/down-line-or-beginning-search2
-rw-r--r--Functions/Zle/keeper27
-rw-r--r--Functions/Zle/modify-current-argument35
-rw-r--r--Functions/Zle/up-line-or-beginning-search2
-rw-r--r--LICENCE12
-rw-r--r--Makefile.in1
-rw-r--r--NEWS20
-rw-r--r--README18
-rw-r--r--Src/Builtins/rlimits.awk6
-rw-r--r--Src/Builtins/rlimits.c56
-rw-r--r--Src/Modules/mathfunc.c9
-rw-r--r--Src/Modules/parameter.c40
-rw-r--r--Src/Modules/parameter.mdd2
-rw-r--r--Src/Modules/stat.c4
-rw-r--r--Src/Modules/zpty.c33
-rw-r--r--Src/Zle/compcore.c5
-rw-r--r--Src/Zle/compctl.c1
-rw-r--r--Src/Zle/computil.c63
-rw-r--r--Src/Zle/zle_main.c47
-rw-r--r--Src/Zle/zle_move.c16
-rw-r--r--Src/Zle/zle_tricky.c29
-rw-r--r--Src/Zle/zle_utils.c1
-rw-r--r--Src/builtin.c76
-rw-r--r--Src/exec.c158
-rw-r--r--Src/glob.c59
-rw-r--r--Src/hist.c118
-rw-r--r--Src/init.c9
-rw-r--r--Src/input.c4
-rw-r--r--Src/jobs.c137
-rw-r--r--Src/lex.c1
-rw-r--r--Src/math.c21
-rw-r--r--Src/options.c3
-rw-r--r--Src/params.c2
-rw-r--r--Src/parse.c45
-rw-r--r--Src/pattern.c480
-rw-r--r--Src/prompt.c43
-rw-r--r--Src/signals.c8
-rw-r--r--Src/signals.h8
-rw-r--r--Src/subst.c10
-rw-r--r--Src/utils.c22
-rw-r--r--Src/zsh.h82
-rw-r--r--Src/zsh.mdd12
-rw-r--r--Src/zsh_system.h2
-rw-r--r--Test/.distfiles2
-rw-r--r--Test/A04redirect.ztst11
-rw-r--r--Test/A05execution.ztst24
-rw-r--r--Test/C01arith.ztst15
-rw-r--r--Test/C02cond.ztst25
-rw-r--r--Test/D02glob.ztst58
-rw-r--r--Test/D03procsubst.ztst8
-rw-r--r--Test/D04parameter.ztst7
-rw-r--r--Test/E01options.ztst15
-rw-r--r--Test/E02xtrace.ztst9
-rw-r--r--Test/V01zmodload.ztst2
-rw-r--r--Test/V03mathfunc.ztst6
-rw-r--r--Test/V08zpty.ztst28
-rw-r--r--Test/X02zlevi.ztst20
-rw-r--r--Test/comptest33
-rw-r--r--configure.ac9
155 files changed, 5007 insertions, 1421 deletions
diff --git a/.cvsignore b/.cvsignore
index 971a308be..95cdc587b 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -13,3 +13,4 @@ stamp-h
stamp-h.in
autom4te.cache
*.swp
+.git
diff --git a/.editorconfig b/.editorconfig
index 58421c055..145dc3740 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,4 +1,6 @@
-root = true # Top-most editorconfig file
+# Top-most editorconfig file
+
+root = true
[*]
end_of_line = lf
diff --git a/.gitignore b/.gitignore
index 7d02c9aa2..d0172e39b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,13 @@ TAGS
Config/defs.mk
+CVS
+.#*
+
+Doc/intro.a4.pdf
+Doc/intro.a4.ps
+Doc/intro.us.pdf
+Doc/intro.us.ps
Doc/version.yo
Doc/zsh*.1
Doc/zsh.texi
diff --git a/ChangeLog b/ChangeLog
index 9bdfa81bd..5f5dc719c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,1071 @@
+2013-11-06 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: Completion/Debian/Command/.distfiles,
+ Completion/Unix/Type/.distfiles, Config/version.mk, Etc/FAQ.yo,
+ README, Src/pattern.c, Src/signals.c, Test/.distfiles: updates
+ for 4.0.2-test-1 in preparation for 4.0.3. Updated files
+ in .distfiles and add mod_export declarations.
+
+2013-11-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Stefan Neudorf: 31936: Doc/Zsh/builtins.yo,
+ Src/Builtins/rlimits.awk, Src/Builtins/rlimits.c: rationalise
+ thread limits
+
+ * Stefan Neudorf: 31935: Doc/Zsh/builtins.yo,
+ Src/Builtins/rlimits.awk, Src/Builtins/rlimits.c: further
+ limit updates for 31930, 39134.
+
+2013-10-31 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Stefan Neudorf: 31930 / 31934: Doc/Zsh/builtins.yo,
+ Src/Builtins/rlimits.awk, Src/Builtins/rlimits.c, configure.ac,
+ Src/Builtins/rlimits.c: New BSD limits; avoid clash with
+ ulimit -k.
+
+2013-10-29 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31929: Src/jobs.c: fix DPUTS3() test condition from 31906.
+
+2013-10-28 Bart Schaefer <schaefer@zsh.org>
+
+ * unposted: NEWS: mention HISTORY_IGNORE
+
+2013-10-28 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31922: Src/Zle/zle_utils.c (zlecharasstring): missing
+ flip of bit five when Meta marker inserted.
+
+2013-10-27 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31912: Src/exec.c: in closemn(), distinguish closing for >&-
+ from closing for a real redirect. Fixes knock-on multios bug
+ introduced by workers/20666 way back in 2005.
+
+ * unposted (cf. users/18063): Functions/Zle/keeper: clean up
+ some syntax nits, add working link to old Unix Review article
+
+ * 31919: Src/exec.c, Src/init.c: fix deadlock when a shell builtin
+ with a multio redirection is used on the left side of a pipeline,
+ by making sure stdin/out/err file descriptors are closed for the
+ multio copy process, which means not re-using those descriptors
+ after they are closed and marked FDT_UNUSED in fdtable[]. For
+ completeness, initialize their fdtable[] state to FDT_EXTERNAL.
+
+2013-10-27 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31909: Jun T: Completion/Unix/Command/_cat: new completion.
+
+2013-10-26 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31906: Src/jobs.c, Test/A05execution.ztst: printjob() should not
+ reference oldjobtab for job numbers unless it is being called from
+ bin_fg(). Add a DPUTS check in case this goes horribly wrong.
+ printjob() also must not attempt to update pipestats when called
+ from bin_fg(). Finally, acquire_pgrp() cannot acquire the tty
+ group leader if the shell is not interactive, so avoid looping
+ infinitely in the attempt. Update the $pipestatus stress test so
+ that it also exercises the oldjobtab repair.
+
+2013-10-26 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Jun T: 31902: rationalise gamma function in mathfunc for
+ consistency with various libraries and user expectations.
+
+2013-10-25 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31890 (with Mikael's fixes in 31891): NEWS: add descriptions
+ of new features since 5.0.2.
+
+2013-10-24 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31889: Test/D02glob.ztst: tests for disable -p.
+
+ * 31877: Src/pattern.c: fix behaviour of disable -p for
+ entities with parentheses.
+
+2013-10-24 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31885: Src/jobs.c: fix PIPEFAIL behavior when the last command
+ in a pipeline is executed within the current shell; add comments
+
+2013-10-24 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31888: Test/A05execution.ztst: add test of pipestatus
+ that was reliably failing before 31879.
+
+ * 31882: Src/Zle/compcore.c: better insulation of
+ completion widget excecution against job environment.
+
+ * 31884: Test/A05execution.ztst: eliminate variable output
+ from test due to vagaries of uniq implementation.
+
+2013-10-23 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31879: Src/jobs.c: improve $pipestatus behavior when the last
+ command in the pipeline is executed within the current shell
+
+ * unposted (cf. Frank Terbeck: 30047): Test/A05redirect.ztst:
+ stress test for $pipestatus handling
+
+2013-10-23 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31873: Doc/Zsh/builtins.yo: Document conventions for use of
+ command options with builtin commands.
+
+2013-10-21 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31869: Src/input.c: reduce WINCH-twaddling in shingetline()
+
+2013-10-21 Øystein Walle <oystwa@gmail.com>
+
+ * 31861: Completion/Unix/Command/_git: _git: Add git-clean
+ -i/--interactive support
+
+ * 31863: Completion/Unix/Command/_git: _git: Add new arguments
+ introduced in Git v1.8.4
+
+ * 31862: Completion/Unix/Command/_git: _git: Add status.short and
+ status.branch
+
+ * 31866: Completion/Unix/Command/_git: _git: Reword --heads to
+ match new meaning
+
+ * 31864: Completion/Unix/Command/_git: _git: Add two sub-comamnds
+ introduced in v1.8.4
+
+ * 31865: Completion/Unix/Command/_git: _git: Make --batch(-check)
+ accept an argument
+
+2013-10-21 m0viefreak <m0viefreak.cm@googlemail.com>
+
+ * 31856: Completion/Unix/Command/_git: _git: fix a few
+ "undocumented" options
+
+ * 31855: Completion/Unix/Command/_git: _git: revert: add
+ '-e,--edit'
+
+2013-10-21 Øystein Walle <oystwa@gmail.com>
+
+ * 31858: Completion/Unix/Command/_git: _git: fix wrong default
+ value
+
+2013-10-21 m0viefreak <m0viefreak.cm@googlemail.com>
+
+ * 31857: Completion/Unix/Command/_git: _git: Remove unsupported -q
+ option from diff options
+
+2013-10-21 Øystein Walle <oystwa@gmail.com>
+
+ * 31853: Completion/Unix/Command/_git: _git: Add missing column.*
+ config variables
+
+ * 31854: Completion/Unix/Command/_git: _git: Make git-show accept
+ diff arguments
+
+ * 31859: Completion/Unix/Command/_git: _git: re-order the last two
+ git-blame arguments
+
+2013-10-19 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31851: Src/exec.c: execstring() should display string to
+ be executed with VERBOSE option.
+
+2013-10-19 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31849: Doc/Zsh/params.yo: note effect of KSH_ZERO_SUBSCRIPT
+ on the arrays of positional parameters e.g. ${argv[0]} vs. $0
+
+2013-10-18 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31846: Src/exec.c: fix NOEXEC option in execsimple().
+
+2013-10-18 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31840: Completion/Unix/Command/_make: "read" used wrong $IFS
+
+2013-10-17 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31836 (cf. 31823): Doc/Zsh/params.yo, Src/hist.c: add
+ HISTORY_IGNORE pattern to exclude matching lines in the
+ internal history from the HISTFILE at write time.
+
+ * 31832: Src/exec.c: make execrestore() more signal-safe.
+
+2013-10-17 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31830: Doc/Zsh/func.yo, README, Src/hist.c, Src/zsh.h:
+ If a zshaddhistory hook returns status 2, save the line on
+ the internal history but don't write it out.
+
+2013-10-16 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Users/18033: Doc/Zsh/builtins.yo, Doc/Zsh/jobs.yo,
+ Doc/Zsh/options.yo: try to document interaction between exit and
+ asynchronous jobs that don't look asynchronous.
+
+2013-10-16 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31827: Doc/Zsh/func.yo: options needed for example. Only
+ works with INCAPPENDHISTORY or SHAREHISTORY.
+
+2013-10-15 Peter Stephenson <p.stephenson@samsung.com>
+
+ * unposted: Doc/Zsh/func.yo: trivial typo in zshaddhistory doc.
+
+2013-10-12 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31818: Completion/Unix/Command/_sh, Doc/Zsh/compsys.yo: to avoid
+ side effects, reposition the _arguments call in _sh for the zsh
+ special case. Document the side effects so avoided, and clean up
+ the _arguments documentation a bit along the way.
+
+2013-10-11 Mikael Magnusson <mikachu@gmail.com>
+
+ * 31805: Doc/Zsh/mod_parameter.yo, Src/Modules/parameter.c,
+ Src/Modules/parameter.mdd, Src/pattern.c, Test/V01zmodload.ztst:
+ Add $patchars and $dis_patchars to zsh/parameter module
+
+ * 31805: Completion/Zsh/Command/_disable,
+ Completion/Zsh/Command/_enable, Doc/Zsh/builtins.yo: Update
+ _enable and _disable for -p, fix related typo in docs
+
+ * 31806: Completion/Zsh/Command/_disable,
+ Completion/Zsh/Command/_enable, Workaround special characters
+ in alias and function names breaking _arguments syntax
+
+2013-10-11 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31815: Src/hist.c: more fallout from 31789: we need to save
+ using pushed history file before we pop.
+
+2013-10-10 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31810: Test/E02xtrace.ztst: tests for simple cases of XTRACE
+ output for conditions.
+
+ * 31809: Src/exec.c: make whitespace clear in trace output for
+ patterns.
+
+2013-10-08 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Eric Cook: 31801: Completion/Linux/Command/_btrfs: some
+ additional variables need to be local.
+
+2013-10-08 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31797: Src/hist.c: partly fix long-standing history expansion
+ bug in which in some circumstances a default history expansion
+ would occur even when there is neither an event nor a word
+ designator, which is contradictory to the documentation.
+ There are still some cases in which expansion is attempted
+ when it should not be, but in most of those cases the expansion
+ simply fails.
+
+2013-10-07 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31794: Src/hist.c: further refinement that SHAREHISTORY should
+ work as it always did because it's careful about file locking.
+
+ * 31793: Src/hist.c (hbegin): Modify 31789 so that the save
+ history here only happens for interactive editing.
+
+2013-10-06 Wayne Davison <wayned@users.sourceforge.net>
+
+ * users/18024: Completion/Unix/Command/_rsync: add new options for
+ rsync 3.1.0.
+
+2013-10-06 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * users/18023: Doc/Zsh/options.yo, Src/jobs.c, Src/options.c,
+ Src/zsh.h, Test/E01options.ztst: add PIPEFAIL option and test.
+
+2013-10-05 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Hang Pingtian: 31789: Src/hist.c: add history for
+ INCAPPENDHISTORY later so history time works.
+
+2013-10-03 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31784: Src/Zle/computil.c: when deciding whether there is enough
+ horizontal space to show completion descriptions for each match in
+ a listing, treat the separator as part of the description rather
+ than as part of the match, and account for lines that have already
+ wrapped due to very long matches.
+
+ * 31781: Src/Zle/computil.c: "compdescribe -i" must clear the
+ completion list column padding width along with the rest of the
+ description state. Cf. 31782.
+
+2013-09-26 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31772: Src/params.c: queue_signals() to prevent re-entry into
+ endparamscope().
+
+ * 31770: Src/hist.c: memmove() instead of memcpy() for overlapping
+ regions.
+
+2013-09-25 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31765: Src/Zle/zle_main.c: on entry to editor, if starting in
+ vi insert mode mark this as the start of an insertion (duh).
+
+2013-09-23 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31764 (with correction of sense of a test): Src/glob.c,
+ Src/pattern.c: use of array before initialisation wreaked havoc
+ in detecting glob qualifiers.
+
+2013-09-22 m0viefreak <m0viefreak.cm@googlemail.com>
+
+ * 31754: Completion/Unix/Command/_git: _git: git rm: make git rm
+ --cached work as intended
+
+2013-09-22 Øystein Walle <oystwa@gmail.com>
+
+ * 31752: Completion/Unix/Command/_git: _git: change completion
+ text for consistency
+
+2013-09-22 m0viefreak <m0viefreak.cm@googlemail.com>
+
+ * 31753: Completion/Unix/Command/_git: _git: correct some
+ "undocumented" options
+
+2013-09-22 Øystein Walle <oystwa@gmail.com>
+
+ * 31749: Completion/Unix/Command/_git: _git: fix some typos in
+ description texts
+
+ * 31751: Completion/Unix/Command/_git: _git: remove TODOs of
+ actually documented options
+
+2013-09-22 m0viefreak <m0viefreak.cm@googlemail.com>
+
+ * 31746: Completion/Unix/Command/_git: _git: reword _git-config
+ TODO
+
+ * 31748: Completion/Unix/Command/_git: _git: support completing
+ remote branches without <remote>/ prefix
+
+2013-09-22 Øystein Walle <oystwa@gmail.com>
+
+ * 31747: Completion/Unix/Command/_git: _git: completion updates to
+ match latest git v1.8.3 part 2
+
+ * 31750: Completion/Unix/Command/_git: _git: add new configuration
+ options to match latest git v1.8.3
+
+2013-09-22 m0viefreak <m0viefreak.cm@googlemail.com>
+
+ * 31741: Completion/Unix/Command/_git: _git: fix a wrong variable
+ in __git_config_values
+
+ * 31743: Completion/Unix/Command/_git: _git: fix usage of ->int:
+ for some entries in _git-config
+
+ * 31744: Completion/Unix/Command/_git: _git: make git submodule
+ <cmd> completion work
+
+ * 31745: Completion/Unix/Command/_git: _git: correctly use
+ __git_guard_number in some cases
+
+ * 31755: Completion/Unix/Command/_git: _git: completion updates to
+ match latest git v1.8.3
+
+2013-09-21 Barton E. Schaefer <schaefer@zsh.org>
+
+ * unposted: Src/glob.c: improve an error message.
+
+2013-09-19 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31737: Src/Zle/computil.c (get_cadef): same fix as get_cvdef.
+
+2013-09-19 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Axel Beckert: 31735: Src/Zle/computil.c (get_cvdef):
+ off-by-one in obscure loop handling could cause crash in complex
+ completion.
+
+2013-09-14 Luka Perkov <luka@openwrt.org>
+
+ * 31723: Completion/Unix/Command/_systemd: _systemd: add more
+ system commands
+
+ * 31726: Completion/Unix/Command/_git: _git: add few more
+ arguments for cherry-pick and revert
+
+2013-09-10 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31714: Completion/Zsh/Command/_cd: handle ".." properly when
+ $PWD or the path prefix traverses a symbolic link.
+
+2013-09-08 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31711: Doc/Zsh/contrib.yo, Functions/MIME/zsh-mime-handler:
+ add execute-never style for MIME handler for files on alien file
+ systems.
+
+2013-09-07 Luka Perkov <luka@openwrt.org>
+
+ * 31708: Completion/Unix/Command/_git: _git: add --fixup and
+ --squash options to commit
+
+2013-09-06 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Luka Perkov: 31702: Completion/Unix/Command/_git:
+ check for presence of "-i" when checking for "--interactive".
+
+ * 31706: Src/builtin.c, Test/C02cond.ztst: standardise
+ handling of "test ! <x> <y> <z>".
+
+2013-09-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31696: Src/parse.c, Test/C02cond.ztst: in "test", no one
+ can hear if you shriek. Treat exclamation marks as strings in
+ "! -a ..." and "! -o ...".
+
+2013-09-02 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31685: Doc/Zsh/mod_mapfile.yo: documentation of how to get
+ lines from a file is not correct.
+
+2013-08-29 Peter Stephenson <p.stephenson@samsung.com>
+
+ * users/17955: Doc/Zsh/contrib.yo,
+ Functions/MIME/zsh-mime-handler: "disown" style makes MIME
+ handlers put into background run without job control.
+
+ * based on 31641, 31642: Completion/Unix/Command/_make: support
+ a couple of different variants of make.
+
+2013-08-26 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31672: Src/Modules/zpty.c, Test/V08zpty.ztst: add test that
+ was failing and fix race when setting up pty.
+
+2013-08-25 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31665: Src/Modules/zpty.c, Test/V08zpty.ztst, Test/.distfiles:
+ zpty should attach terminal on slave.
+
+2013-08-17 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31637: Src/builtin.c: change of directory should not be retried
+ relative to the current directory when it has already failed along
+ some path that does not refer to the current directory.
+
+2013-08-11 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31650: Src/utils.c: use zlong for mailcheck parameters to
+ ensure sufficient range.
+
+2013-08-10 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31648: joe M: Src/utils.c: fix timing errors in mailcheck.
+
+2013-08-08 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Src/Zle/zle_tricky.c (inststrlen): 31644: the wrong length was
+ used when inserting multibyte characters from a string from
+ outside ZLE into the editing buffer.
+
+ * users/17908: Src/hist.c Src/Zle/zle_main.c Src/zsh.h: if
+ modifying history with ZLE active, keep the history line
+ recorded in ZLE in sync.
+
+2013-08-07 Phil Pennock <pdpennock@users.sourceforge.net>
+
+ * 31634: Functions/Misc/run-help: run-help compat with alias to
+ noglob/nocorrect
+
+2013-08-05 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31631: configure.ac, Src/builtin.c: use cygwin_conv_path in
+ preference to cygwin_conv_to_posix_path if available.
+
+2013-08-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Yuusuke Yoshimoto: 31632: Completion/Unix/Type/_java_class:
+ suppress stderr from jar when completing classes.
+
+2013-08-02 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31611: Src/Zle/zle_tricky.c: attempt to fix crash in
+ "for in 1; do <[TAB] x".
+
+2013-08-01 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Thomas Klausner: 31625: Completion/X/Command/_mplayer: mplayer
+ supports .ts (transport stream) files.
+
+2013-07-29 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 17891: Src/builtin.c: fix error message for invalid file
+ descriptor in "print -u".
+
+2013-07-28 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Manuel Presnitz: 31592 (with minor changes of phrasing):
+ Doc/Zsh/builtins.yo, Doc/Zsh/expn.yo, Doc/Zsh/prompt.yo: improve
+ documentation for named directory handling.
+
+2013-07-25 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Jun T.: 31756: Completion/Unix/Command/_make: further make
+ completion improvements: tke care of mutually exclusive options;
+ add _description using $state_descr; add completions for
+ --debug=flag; fix typo (pointed out by Daniel Shahaf).
+
+ * 31574: Src/parse.c: alternative fix to 31545 if FD_CLOEXEC is
+ not available, removing dump records more consistently.
+
+2013-07-24 Richard Hartmann <richih.mailinglist@gmail.com>
+
+ * 31571: Completion/Unix/Command/_vcsh: Update
+
+ * 31572: Completion/Debian/Command/_linda,
+ Completion/Debian/Command/.distfiles: Remove _linda
+
+2013-07-24 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Src/hist.c: 31570: with HIST_REDUCE_BLANKS don't truncate
+ the line after the last word if there's more non-white-space
+ text (probably a comment but we don't assume that).
+
+2013-07-22 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: Src/lex.c: correct previous commit: should call
+ hwend(), not ihwend().
+
+ * 31559: Src/lex.c: Fix problem with history lines for comments
+ that occur in the middle of an alias.
+
+ * Eric Cook: 31558: Completion/Command/Unix/_qemu: name of
+ binary has changed.
+
+2013-07-21 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31549: Src/exec,c, Src/zsh.h: replace ad-hoc subsh_close file
+ descriptor for pipes with new addfilelist() job-based mechanism.
+
+2013-07-20 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31545: Src/exec.c, Src/parse.c: if FD_CLOEXEC is available,
+ so mark dump file file descriptors, avoiding possible
+ multiple use of file descriptors.
+
+2013-07-19 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * c.f. 31531: Completion/Unix/Command/_imagemagick,
+ Completion/Unix/Command/_graphicsmagick: complete .xcf files.
+
+2013-07-19 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31536 (plus memory leak fixed, plus test code):
+ Src/jobs.c, Test/D03procsubst.ztst: fix hang in 31528 by
+ closing process substitution file descriptors when waiting
+ for job to finish.
+
+2013-07-17 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31528: Src/exec.c, Src/jobs.c, Src/zsh.h: use job table
+ to record file descriptors associated with process
+ substitution.
+
+ * Jun T: 31525: Completion/Unix/Command/_make: fix some option
+ handling.
+
+2013-07-12 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Nick Cross: 31512: Completion/Unix/Command/_make:
+ extra GNU options plus fix to makefile completion.
+
+2013-07-11 Peter Stephenson <p.stephenson@samsung.com>
+
+ * users/17856: Completion/Command/Unix/_make: rewrite to use
+ _arguments so as to make adding option handling easier.
+
+2013-07-03 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31503: Doc/Zsh/contrib.yo, Functions/Misc/zmv: split words
+ in program passed to zmv with -p and add -P for programs
+ that don't understand the "--" convention.
+
+2013-06-28 Clint Adams <clint@zsh.org>
+
+ * 31500: Completion/Debian/Command/_dput: dput-ng completion
+ support from Sebastian Ramacher.
+
+ * 31499: Completion/Debian/Command/_dcut: dcut completion
+ from Sebastian Ramacher.
+
+ * 31498: Completion/Debian/Command/_dak: complete files for
+ subcommands that are not explicitly specified.
+
+2013-06-27 Mikael Magnusson <mikachu@gmail.com>
+
+ * 31483: Call zrefresh() before unqueue()ing signals, was
+ moved in 31174.
+
+2013-06-18 Frank Terbeck <ft@bewatermyfriend.org>
+
+ * 31485: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info, git: Avoid error messages for `guilt' users
+
+2013-06-13 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31465: Completion/compinit, Src/glob.c, Src/pattern.c: fix
+ basic completion and globbing use of pattern disables.
+
+ * 31444: Doc/Zsh/builtins.yo, Doc/Zsh/options.yo,
+ Doc/zmacros.yo, Src/builtin.c, Src/exec.c, Src/options.c,
+ Src/pattern.c, Src/zsh.h: Basic (not fully functional) code for
+ enable/disable -p.
+
+2013-06-13 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31474: Makefile.in, Src/zsh.mdd: create patchlevel.h correctly
+ when running make in a separate build tree
+
+2013-06-10 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Hong Xu: 31462: .editorconfig: move comment to individual
+ line.
+
+ * Bruce Stephens (via Axel Beckert of Debian): 31459:
+ Doc/ztexi.yo: alignment of zsh info menu entry is wrong.
+
+2013-06-09 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 31466: .cvsignore, .gitignore: Cause git and cvs to ignore
+ one another.
+
+ * 31205: Completion/Base/Widget/_complete_help: Do not display
+ "(eval)" as a tag context.
+
+2013-06-01 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31441: Src/glob.c, Src/pattern.c, Src/zsh.h: use an array
+ based on ZPC_* enum to decide which forms of pattern are enabled.
+
+2013-05-30 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31436: Doc/Zsh/expn.yo: KSH_GLOB syntax does not
+ support recursive directories.
+
+2013-05-29 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31433: Completion/Unix/Command/_gzip: zcat -f doesn't
+ need files with suffix .gz.
+
+ * 31422: Doc/Zsh/calsys.yo, Functions/Calendar/age: better
+ heuristic for timestamps in use of :file feature.
+
+2013-05-22 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31405: Doc/Zsh/options.yo: weasel words about
+ PRINT_EXIT_STATUS option.
+
+2013-05-21 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31419: Src/Modules/stat.c: Add time zone and year to
+ default time format with -s option to zstat.
+
+ * 31418: Doc/Zsh/calsys.yo, Functions/Calendar/age:
+ in "age" docs correct typo and note the feature that
+ you can supply a file as a timestamp on the command line.
+
+ * Stephane: 31417: Functions/Calendar/age: needs --
+ to protect againts files starting with -.
+
+2013-05-20 Barton Schaefer <schaefer@zsh.org>
+
+ * 31416: Src/builtin.c: upon "read" of a short line, assign all
+ variables passed as arguments.
+
+2013-05-14 Peter Stephenson <p.stephenson@samsung.com>
+
+ * unposted: Completion/Unix/Command/_perforce: Improve
+ Perforce jobs completion to limit potentially huge output
+ using jobview by default; fix quoting of arguments passed on
+ to eval within _call_program.
+
+2013-05-10 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Richard Hartmann <richih.mailinglist@gmail.com>: 31389:
+ Completion/X/Command/_mplayer: add .ogv.
+
+ * Mihai Moldovan <ionic@ionic.de>: 31387: Src/zsh_system.h:
+ unused functions when compiling with clang.
+
+2013-05-05 Frank Terbeck <ft@bewatermyfriend.org>
+
+ * unposted: Src/exec.c: Revert "31372: Do not block SIGWINCH for
+ child processes" as suggested by Bart.
+
+ * 31376: Src/exec.c: Make sure every execve() is prefixed by
+ winch_unblock()
+
+2013-05-05 Bart Schaefer <schaefer@zsh.org>
+
+ * 31372: Src/exec.c: Do not block SIGWINCH for child processes
+
+2013-05-05 Kenyon Ralph <kenyon@kenyonralph.com>
+
+ * 31371: Completion/Linux/Command/_brctl: _brctl: update brctl
+ subcommands
+
+2013-05-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31369: Completion/Base/Utility/_comp_locale: action if locale
+ command is not usable.
+
+2013-04-29 Bart Schaefer <schaefer@zsh.org>
+
+ * 31361: Src/init.c: handle negative optno ("no" prefix used)
+ when storing options with parseopts_insert() for sticky contexts
+
+ * 31353: Src/math.c: fix handling of floating point in ternary
+
+ * 31350: Src/init.c, Src/input.c, Src/signals.h, Src/utils.c,
+ Src/Zle/zle_main.c: block SIGWINCH nearly all the time, except
+ when about to calculate prompts or do synchronous read, so
+ syscalls are not interrupted by window size changes.
+
+2013-04-29 Jun T <takimoto-j@kba.biglobe.ne.jp>
+
+ * 31357: Completion/Unix/Command/_cp: add support for Mac OS X
+
+2013-04-29 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31356: Completion/Unix/Command/_subversion: typo noted by Bart.
+
+ * 31355: Completion/Base/Utility/.distfiles,
+ Completion/Base/Utility/_comp_locale,
+ Completion/Unix/Command/_subversion: _comp_locale tries to
+ sanitise locales but keep CTYPE; use this for subversion completion.
+
+2013-04-25 Ramkumar Ramachandra <artagnon@gmail.com>
+
+ * 31288: Completion/Unix/Command/_git: _git: fix shortlog
+ completer
+
+2013-04-21 Ramkumar Ramachandra <artagnon@gmail.com>
+
+ * 31286: Completion/Unix/Command/_git: _git: add a couple of
+ browsers
+
+ * 31289: Completion/Unix/Command/_git: _git: branch.*.pushremote,
+ remote.pushdefault
+
+2013-04-20 Torstein Hegge <hegge@resisty.net>
+
+ * 31159: Completion/Unix/Command/_git: git: Pass prefix filter to
+ ls-files even if it matches no files
+
+2013-04-20 Jun T <takimoto-j@kba.biglobe.ne.jp>
+
+ * 31281: Completion/Unix/Command/_du: _du: add support for Mac OS
+ X
+
+2013-04-20 Bart Schaefer <schaefer@zsh.org>
+
+ * 31272: Src/Zle/compctl.c: avoid double free.
+
+2013-04-16 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Daniel Friesel: 31265: Completion/Unix/Command/_devtodo:
+ improved option handling.
+
+2013-04-13 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: .gitignore: ignore PDF and PS versions of intro file.
+
+2013-04-12 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31263 (changed * to - for consistency with elsewhere):
+ Doc/Zsh/mod_curses.yo: suppress texinfo warning by adding item
+ arguments.
+
+ * 31261: Doc/Zsh/compsys.yo, Doc/ztexi.yo: updates needed
+ with latest texinfo.
+
+2013-04-10 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * users/17754: Src/builtin.c: failing to retie an array
+ and colon-separated scalar shouldn't be a fatal error.
+
+2013-04-09 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31246: Makefile.in, Src/zsh.mdd: make a separate patch level
+ header for releases.
+
+2013-04-08 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: Completion/Unix/Command/.distfiles,
+ Completion/Unix/Command/.distfiles: remove mention of files no
+ longer there.
+
+2013-04-07 Bart Schaefer <schaefer@zsh.org>
+
+ * 31234: Completion/Base/Widget/_complete_help: use an "always"
+ block instead of "trap" to clean up various function overrides
+
+2013-04-05 Frank Terbeck <ft@bewatermyfriend.org>
+
+ * 31174: Src/Zle/zle_main.c: 31174: zle: Make sure state changes
+ are refreshed after init hook
+
+ * 31172: Src/Zle/zle_main.c: 31172: Let vared define custom init
+ and finish hooks
+
+ * 31175: Doc/Zsh/zle.yo: 31175: Add documentation for the new -i
+ and -f options of vared
+
+ * 31221: Completion/Unix/Command/_git: Handle zero defined aliases
+ better
+
+ * 31222: Functions/Zle/down-line-or-beginning-search,
+ Functions/Zle/up-line-or-beginning-search: Don't trigger
+ warn_create_global
+
+2013-04-04 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 31203: Completion/Unix/Command/.distfiles,
+ Completion/Unix/Command/_etags: new etags completion.
+
+2013-02-18 Aaron Schrab <aaron@schrab.com>
+
+ * 07478c6b: Src/zsh.mdd: Generate patch level using `git describe`
+
+2013-04-02 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Jun T.: 31183: Src/Zle/zle_move.c: record old line rather than
+ history line in vi-goto-mark.
+
+2013-03-29 Mikael Magnusson <mikachu@gmail.com>
+
+ * 31182: Completion/Unix/Command/_awk: Allow sticked arguments.
+
+2013-03-20 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Han Pingtian: 31167 (with tweak):
+ Completion/Unix/Command/_ssh: limit use of colons for detecting
+ a remote path.
+
+2013-03-19 Bart Schaefer <schaefer@zsh.org>
+
+ * 31158: Src/pattern.c: following a wildcard with a repetition
+ produces a bad pattern error instead of an unbounded search
+
+2013-03-17 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31156: Completion/Zsh/Context/_math,
+ Completion/Zsh/Context/_zcalc_line, Completion/Zsh/Type/.distfile,
+ Completion/Zsh/Type/_math_params,
+ Completion/Zsh/Type/_module_math_func,
+ Completion/Zsh/Type/_user_math_func: improved math context
+ completion: functions.
+
+ * 31155: Doc/Zsh/contrib.yo, Functions/Misc/zcalc: minor
+ extra zcalc features and documentation.
+
+2013-03-15 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31154: Doc/Zsh/contrib.yo, Functions/Misc/zcalc: make zcalc
+ understand continuation lines using backslash.
+
+2013-03-14 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31151: Pavol Juhas: complete (C etc) tags better
+ when file system is not case sensitive.
+
+2013-03-13 Mikael Magnusson <mikachu@gmail.com>
+
+ * unposted: Doc/Zsh/contrib.yo: Also adjust a mention of psvar
+ in the vcs info documentation.
+
+ * 31140: Src/math.c: when the math recursion limit is hit, make
+ sure to not leave *ep pointing nowhere, which caused a crash
+ sometimes. Also print the token that we refused to evaluate
+ because of the limit.
+
+2013-03-13 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted, c.f. thread from 31144: Doc/Zsh/params.yo: all psvar
+ entries can be shown in prompts nowadays.
+
+2013-03-10 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31141: Src/exec.c, Test/A04redirect.ztst: NO_CLOBBER for {fd}
+ syntax should only apply if $fd is exactly an fd and nothing
+ else.
+
+2013-03-10 Mikael Magnusson <mikachu@gmail.com>
+
+ * 30496: Src/prompt.c: Parse argument to %F and %K as prompt
+ sequences. This allows constructs like %F{%3v} to use $psvar[3]
+ for the color.
+
+ * 30490: Completion/Unix/Command/_java: Complete files for the
+ -keystore argument.
+
+ * 30639: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ Add support for showing the current action is cherry-pick (happens
+ when cherry-picking a range).
+
+ * 31136: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ just set parameters instead of passing over a pipe.
+
+2013-03-05 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * users/17666: Doc/Zsh/contrib.yo, Functions/Misc/zcalc: -f
+ option to zcalc sets FORCE_FLOAT.
+
+ * users/17665: Doc/Zsh/options.yo, Src/math.c, Src/options.c,
+ Src/zsh.h, Test/C01arith.ztst: add FORCE_FLOAT option.
+
+2013-02-27 Oliver Kiddle <opk@zsh.org>
+
+ * 31076: Completion/Linux/Command/_yast,
+ Completion/Unix/Type/_pids, Completion/Unix/Type/_pdf:
+ fix cases of more than one completion function for a command
+
+ * 31077: Completion/Unix/Command/_sort: update for new
+ options in GNU sort
+
+ * c.f. 31071: Completion/Unix/Type/_postscript,
+ Completion/Unix/Command/_psutils: remove duplicate _osc and
+ rename _ps to avoid name clash
+
+2013-02-22 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31061: Completion/Zsh/Command/_typeset: "functions" completion
+ takes account of options already on the command line.
+
+ * 31060: Src/builtin.c: "+" before a flag for "functions" or
+ "autoload" should suppress display of function body.
+
+2013-02-21 Oliver Kiddle <opk@zsh.org>
+
+ * 31058: Completion/Zsh/Command/_fc, Completion/Unix/Command/_cut,
+ Completion/Unix/Command/_sed, Completion/Unix/Command/_wget,
+ Completion/Unix/Command/_xmlsoft: add options from newer
+ versions of some commands to completion functions
+
+2013-02-19 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31055: Completion/compaudit: missing '$' in search of /proc
+ file system.
+
+2013-02-12 Oliver Kiddle <opk@zsh.org>
+
+ * 31041: Test/comptest, Test/X02zlevi.ztst: add support for
+ testing line editor widgets from the test suite
+
+ * unposted: Etc/zsh-development-guide: remove duplication in
+ git guidelines
+
+2013-02-09 Oliver Kiddle <opk@zsh.org>
+
+ * Morita Sho: 31038: Completion/Unix/Type/_terminals:
+ add location of terminfo entries on Debian
+
+ * 31037: Src/Zle/zle_move.c: return to previous position
+ with vi-goto-mark using `` or ''
+
+2013-02-07 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Wieland Hoffmann: 31030: Completion/X/Command/_mplayer:
+ improve label for selected files.
+
+ * Wieland Hoffmann: 31029: README: correct directory.
+
+ * Han Pingtian: 31027: Completion/Unix/Type/_files: remove
+ the -g's from the glob options.
+
+2013-02-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Eric P. Mangold: c.f. 31016
+ http://twistedmatrix.com/trac/browser/trunk/twisted/python/twisted-completion.zsh?format=txt:
+ completion for twisted using internally generated completion.
+
+2013-02-01 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 31015: Completion: compaudit: where we can find who owns the
+ zsh executable, allow the same owner to own completion files.
+
+2013-02-01 Mikael Magnusson <mikachu@gmail.com>
+
+ * unposted: Fix _prove completer commit.
+
+2013-01-29 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Jesper Nygårds: 31012: Completion/Unix/Command/_gradle:
+ updates.
+
+ * Dmitry Roshchin: 31008: Completion/openSUSE/Command/_zypper,
+ Completion/openSUSE/Command/_osc: updates.
+
+2013-01-26 Bart Schaefer <schaefer@zsh.org>
+
+ * 31000: Doc/Zsh/contrib.yo: fix typo in example.
+
+2013-01-24 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * users/17608: Doc/Zsh/contrib.yo,
+ Functions/Zle/modify-current-argument: use function to modify
+ current command line argument.
+
+2013-01-22 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 30993: Src/subst.c, Test/D04parameter.ztst: parameter
+ modifiers :wq operating on an empty string crashed the shell.
+ The shell isn't supposed to crash.
+
+2013-01-20 Oliver Kiddle <opk@zsh.org>
+
+ * 30987: Completion/X/Command/_xrandr: only call xrandr when
+ necessary and use _call_program
+
+2013-01-14 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 30960: Alexey Bezhan: Completion/Unix/Command/_django:
+ compatibility issue.
+
+2013-01-10 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 30958: Jeremy Mates: Completion/Unix/Command/_prove,
+ Completion/Unix/Command/.distfiles: new completion.
+
+2013-01-07 Bart Schaefer <schaefer@zsh.org>
+
+ * unposted (see 30952): Src/builtin.c: tweak to 30949 to fix the
+ buffer pointer.
+
+2013-01-06 Bart Schaefer <schaefer@zsh.org>
+
+ * 30949: Src/builtin.c: restore "read -q" behavior lost by 27188.
+
+2013-01-05 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 30946: Robert Kovacsics: Completion/X/Command/_xrandr: use
+ command to generate completions.
+
+2013-01-04 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 30941: Completion/bashcompinit: scalars giving status of bash
+ completion should be exported for external programmes.
+
+2013-01-03 Bart Schaefer <schaefer@zsh.org>
+
+ * users/17524: Doc/Zsh/expn.yo: misc. parameter flag clarifications.
+
+2013-01-03 Peter Stephenson <pws@csr.com>
+
+ * unposted: Config/version.mk: update version to 5.0.2-dev-0
+ to avoid clash with release.
+
2012-12-21 Peter Stephenson <p.w.stephenson@ntlworld.com>
* unposted: README, Config/version.mk, Etc/FAQ.yo: release
@@ -409,8 +1477,3 @@
2012-07-21 Peter Stephenson <p.w.stephenson@ntlworld.com>
* unposted: update for 5.0.0 release.
-
-*****************************************************
-* This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5778 $
-*****************************************************
diff --git a/Completion/Base/Utility/.distfiles b/Completion/Base/Utility/.distfiles
index 97d86bdbf..91ddf881b 100644
--- a/Completion/Base/Utility/.distfiles
+++ b/Completion/Base/Utility/.distfiles
@@ -1,9 +1,25 @@
DISTFILES_SRC='
.distfiles
-_alternative _call_program _nothing _sub_commands
-_arg_compile _combination _regex_arguments _values
-_arguments _set_command _retrieve_cache _guard
-_cache_invalid _describe _sep_parts _pick_variant
-_call_function _multi_parts _store_cache _regex_words
+_alternative
+_arg_compile
+_arguments
+_cache_invalid
+_call_function
+_comp_locale
_complete_help_generic
+_call_program
+_combination
+_set_command
+_describe
+_multi_parts
+_nothing
+_regex_arguments
+_retrieve_cache
+_sep_parts
+_store_cache
+_sub_commands
+_values
+_guard
+_pick_variant
+_regex_words
'
diff --git a/Completion/Base/Utility/_comp_locale b/Completion/Base/Utility/_comp_locale
new file mode 100644
index 000000000..e55338b97
--- /dev/null
+++ b/Completion/Base/Utility/_comp_locale
@@ -0,0 +1,20 @@
+#autoload
+
+# Arrange that LC_CTYPE retains the current setting so characters in
+# file names are handled properly, but other locales are set to C so
+# that the completion system can process output without surprises.
+
+# This exports new locale settings, so should only
+# be run in a subshell. A typical use is in a $(...).
+
+local ctype
+
+if ctype=${${(f)"$(locale 2>/dev/null)"}:#^LC_CTYPE=*}; then
+ unset -m LC_\*
+ [[ -n $ctype ]] && eval export $ctype
+else
+ ctype=${LC_ALL:-${LC_CTYPE:-${LANG:-C}}}
+ unset -m LC_\*
+ export LC_CTYPE=$ctype
+fi
+export LANG=C
diff --git a/Completion/Base/Widget/_complete_help b/Completion/Base/Widget/_complete_help
index 99f2f2dba..0563c618f 100644
--- a/Completion/Base/Widget/_complete_help
+++ b/Completion/Base/Widget/_complete_help
@@ -6,41 +6,41 @@ _complete_help() {
local _sort_tags=_help_sort_tags text i j k tmp
typeset -A help_funcs help_tags help_sfuncs help_styles
- compadd() { return 1 }
- zstyle() {
- local _f="${${(@)${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}% *}"
-
- [[ -z "$_f" ]] && _f="${${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}"
-
- if [[ "$help_sfuncs[$2]" != *${_f}* ||
- "$help_styles[${2}${_f}]" != *${3}* ]]; then
-
- [[ "$help_sfuncs[$2]" != *${_f}* ]] && help_sfuncs[$2]+=$'\0'"${_f}"
- local _t
-
- case "$1" in
- -s) _t='[string] ';;
- -a) _t='[array] ';;
- -h) _t='[assoc] ';;
- *) _t='[boolean]';;
- esac
- help_styles[${2}${_f}]+=",${_t} ${3}:${_f}"
- fi
-
- # No need to call the completers more than once with different match specs.
-
- if [[ "$3" = matcher-list ]]; then
- set -A "$4" ''
- else
- builtin zstyle "$@"
- fi
+ {
+ compadd() { return 1 }
+ zstyle() {
+ local _f="${${(@)${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}% *}"
+
+ [[ -z "$_f" ]] && _f="${${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}"
+
+ if [[ "$help_sfuncs[$2]" != *${_f}* ||
+ "$help_styles[${2}${_f}]" != *${3}* ]]; then
+
+ [[ "$help_sfuncs[$2]" != *${_f}* ]] && help_sfuncs[$2]+=$'\0'"${_f}"
+ local _t
+
+ case "$1" in
+ -s) _t='[string] ';;
+ -a) _t='[array] ';;
+ -h) _t='[assoc] ';;
+ *) _t='[boolean]';;
+ esac
+ help_styles[${2}${_f}]+=",${_t} ${3}:${_f}"
+ fi
+
+ # No need to call the completers more than once with different match specs.
+
+ if [[ "$3" = matcher-list ]]; then
+ set -A "$4" ''
+ else
+ builtin zstyle "$@"
+ fi
+ }
+
+ ${1:-_main_complete}
+ } always {
+ unfunction compadd zstyle
}
- trap 'unfunction compadd zstyle' EXIT INT
-
- ${1:-_main_complete}
-
- unfunction compadd zstyle
- trap - EXIT INT
for i in "${(@ok)help_funcs}"; do
text+=$'\n'"tags in context :completion:${i}:"
@@ -73,7 +73,7 @@ _complete_help() {
}
_help_sort_tags() {
- local f="${${(@)${(@)funcstack[3,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}% *}"
+ local f="${${(@)${(@)funcstack[3,(i)_(main_complete|complete|approximate|normal)]}:#(_(dispatch|wanted|requested|all_labels|next_label)|\(eval\))}% *}"
if [[ "$help_funcs[$curcontext]" != *${f}* ||
"$help_tags[${curcontext}${f}]" != *(${(j:|:)~argv})* ]]; then
diff --git a/Completion/Base/Widget/_complete_tag b/Completion/Base/Widget/_complete_tag
index 5a26c3890..5b50f1d85 100644
--- a/Completion/Base/Widget/_complete_tag
+++ b/Completion/Base/Widget/_complete_tag
@@ -32,6 +32,11 @@ while [[ ! -f $c_path$c_Tagsfile &&
c_path=../$c_path
done
+if [[ -f $c_path$c_Tagsfile && $c_path$c_Tagsfile -ef $c_path$c_tagsfile &&
+ "$(head -1 $c_path$c_tagsfile)" == '!_TAG_'* ]]; then
+ c_Tagsfile=
+fi
+
if [[ -f $c_path$c_Tagsfile ]]; then
# prefer the more comprehensive TAGS, which unfortunately is a
# little harder to parse.
diff --git a/Completion/Debian/Command/.distfiles b/Completion/Debian/Command/.distfiles
index 772d08089..ed1575091 100644
--- a/Completion/Debian/Command/.distfiles
+++ b/Completion/Debian/Command/.distfiles
@@ -14,6 +14,7 @@ _cdbs-edit-patch
_dak
_dchroot
_dchroot-dsa
+_dcut
_debchange
_debdiff
_debfoster
@@ -30,7 +31,6 @@ _dupload
_git-buildpackage
_invoke-rc.d
_lighttpd
-_linda
_lintian
_madison
_make-kpkg
diff --git a/Completion/Debian/Command/_dak b/Completion/Debian/Command/_dak
index 5aaaeefbc..840fc0017 100644
--- a/Completion/Debian/Command/_dak
+++ b/Completion/Debian/Command/_dak
@@ -238,6 +238,10 @@ case $cmd in
)
;;
+ (*)
+ _files
+ ;;
+
esac
_arguments -s "$args[@]" && ret=0
diff --git a/Completion/Debian/Command/_dcut b/Completion/Debian/Command/_dcut
new file mode 100644
index 000000000..210d54429
--- /dev/null
+++ b/Completion/Debian/Command/_dcut
@@ -0,0 +1,160 @@
+#compdef dcut
+
+# TODO: dcut supports two ways to be called:
+# * dcut HOST COMMAND ...
+# * dcut COMMAND ...
+# So ideally, if the first argument is completed, both commands and hosts should
+# be offered. If host is given, the second argument should be completed as
+# command and if not, it should be completed as command specific option.
+
+function _dput_hosts() {
+ local expl
+
+ if ( [[ ${+_dput_cfhosts} -eq 0 ]] || _cache_invalid dputhosts ) && ! _retrieve_cache dputhosts; then
+ local cmd
+ if _pick_variant dputng="usage: dput" dput -H ; then
+ cmd=(dirt hosts)
+ else
+ cmd=(dput -H)
+ fi
+ _dput_cfhosts=(${${(M)${(f)"$($cmd)"}:#*=>*}/ =>*/})
+ _store_cache dputhosts _dput_cfhosts
+ fi
+
+ _wanted dputhosts expl 'target host' compadd -a _dput_cfhosts
+}
+
+function _dcut_commands() {
+ local -a cmds
+ if _pick_variant dcutng="usage: dcut" dcut -v ; then
+ cmds=(
+ dm:'manage Debian Maintainer permissions'
+ break-the-archive:'break the archive'
+ reschedule:'reschedule a deferred upload'
+ cancel:'cancel a deferred upload'
+ rm:'remove a file from the upload queue'
+ upload:'upload a command file'
+ )
+ else
+ cmds=(
+ rm:'remove a file from the upload queue'
+ cancel:'cancel a deferred upload'
+ reschedule:'reschedule a deferred upload'
+ )
+ fi
+ _describe -t commands command cmds
+}
+
+function _dcut() {
+ local -a all_opts dcut_opts dcut_ng_opts
+ local state line context
+ local -A opt_args
+ local curcontext="${curcontext}"
+
+ all_opts=(
+ '(-c --config)'{-c,--config=}'[specify config file]:config file:_files'
+ '(-h --help)'{-h,--help}'[show help message and exit]'
+ '(-m --maintainer)'{-m,--maintainer=}'[use maintainer for upload field and GPG key selection]:maintainer address'
+ '(-k --keyid)'{-k,--keyid}'[use key id for signing]:keyid'
+ '(-O --output)'{-O,--output=}'[write command file to file instead of uploading]:output file:_files'
+ '(-P --passive)'{-P,--passive}'[use passive FTP for uploads]'
+ '(-v --version)'{-v,--version}'[show version information]'
+ ': :_dcut_commands'
+ )
+
+ dcut_opts=(
+ '(-d --debug)'{-d,--debug}'[debug mode]'
+ '(-s --simulate)'{-s,--simulate}'[simulate an upload only]'
+ '(-i --input)'{-i,--input=}'[create commands file to remove every file listed in the changes file]:changes file:_files -g"*.changes(-.)"'
+ '(-U --upload)'{-U,--upload=}'[upload commands file]:commands file:_files'
+ '(--host 1)'{--host=}'[upload to host if it is named like a command]:host:_dput_hosts'
+ '*:: :->dcut_command_arguments'
+ )
+
+ dcut_ng_opts=(
+ '*'{-d,--debug}'[enable debug messages, repeat twice to increase the verbosity level]'
+ '*'{-s,--simulate}'[simulate an upload only, repeat twice to increase level of simulation]'
+ '*:: :->dcut_ng_command_arguments'
+ )
+
+ if _pick_variant dcutng="usage: dcut" dcut -v ; then
+ _arguments -C \
+ "$all_opts[@]" "$dcut_ng_opts[@]" && return
+ else
+ _arguments -C \
+ "$all_opts[@]" "$dcut_opts[@]" && return
+ fi
+
+ case $state in
+ (dcut_command_arguments)
+ # arguments to dcut commands
+ local -a opts
+ case ${line[1]} in
+ (cancel)
+ # dcut cancel arguments
+ opts=(
+ '1::changes file:_files -g"*.changes(-.)"'
+ )
+ ;;
+ (reschedule)
+ # dcut reschedule arguments
+ opts=(
+ '1::changes file:_files -g"*.changes(-.)"'
+ '2::new delayed queue:(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)'
+ )
+ ;;
+ (rm)
+ # dcut rm arguments
+ opts=(
+ '--searchdirs[search in all directores for the given files]'
+ '1::file to be deleted:_files'
+ )
+ ;;
+ esac
+ _arguments "$opts[@]" && return
+ ;;
+ (dcut_ng_command_arguments)
+ # arguments to dput-ng's dcut commands
+ local -a opts
+ case ${line[1]} in
+ (cancel)
+ # dcut cancel arguments
+ opts=(
+ '(-f --filename)'{-f,--filename}'[.changes file name of the upload to be cancelled]:file name:_files -g"*.changes(-.)"'
+ )
+ ;;
+ (dm)
+ # dcut dm arguments
+ opts=(
+ '--uid[full name and address or GPG fingerprint of the Debian Maintainer]'
+ '*--allow[grant permission to upload a source package]:source package'
+ '*--deny[remove permission to upload a source pckage]:source package'
+ )
+ ;;
+ (reschedule)
+ # dcut reschedule arguments
+ opts=(
+ '(-f --filename)'{-f,--filename}'[.changes file name to be rescheduled]:file name:_files -g"*.changes(-.)"'
+ '(-d --days)'{-d,--days}'[new delayed queue]:days:(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)'
+ )
+ ;;
+ (rm)
+ # dcut rm arguments
+ opts=(
+ '*'{-f,--filename}'[file name to be removed]:file name:_files'
+ '--searchdirs[search in all directores for the given files]'
+ )
+ ;;
+ (upload)
+ # dcut upload arguments
+ opts=(
+ '-f --filename)'{-f,--filename}'[file to be uploaded]:file name:_files'
+ )
+ ;;
+ esac
+ _arguments "$opts[@]" && return
+ ;;
+ esac
+}
+
+_dcut "$@"
diff --git a/Completion/Debian/Command/_dput b/Completion/Debian/Command/_dput
index 20465346c..bf6c2baee 100644
--- a/Completion/Debian/Command/_dput
+++ b/Completion/Debian/Command/_dput
@@ -1,28 +1,57 @@
#compdef dput
_dput() {
-_arguments \
- '(-c --config)'{-c,--config}'[specify config file]:config file:_files' \
- '(-d --debug)'{-d,--debug}'[debug mode]' \
- '(-D --dinstall)'{-D,--dinstall}'[run dinstall after upload]' \
- '(-e --delayed)'{-E,--delayed}'[number of days in delayed queue]:number of days:(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)' \
- '(-f --force)'{-f,--force}'[force upload of already uploaded package]' \
- '(-H --host-list)'{-H,--host-list}'[display host list]' \
- '(-l --lintian)'{-l,--lintian}'[run lintian before upload]' \
- '(-o --check-only)'{-o,--check-only}'[check the package, do not upload]' \
- '(-p --print)'{-p,--print}'[print configuration]' \
- '(-s --simulate)'{-s,--simulate}'[simulate an upload only]' \
- '(-u --unchecked)'{-u,--unchecked}'[do not check GPG signature on the changes file]' \
- '(-v --version)'{-v,--version}'[show version information]' \
- '1::host:_dput_hosts' \
- '*:changes file:_files -g "*.changes(-.)"'
+ local -a all_opts dput_opts dput_ng_opts
+
+ all_opts=(
+ '(-c --config)'{-c,--config}'[specify config file]:config file:_files'
+ '(-h --help)'{-h,--help}'[show help message and exit]'
+ '(-f --force)'{-f,--force}'[force an upload]'
+ '(-P --passive)'{-P,--passive}'[use passive FTP for uploads]'
+ '(-U --no-upload-log)'{-U,--no-upload-log}'[do not write an .upload log after uploading]'
+ '(-D --dinstall)'{-D,--dinstall}'[run dinstall after upload]'
+ '(-e --delayed)'{-e,--delayed}'[number of days in delayed queue]:number of days:(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)'
+ '(-l --lintian)'{-l,--lintian}'[run lintian before upload]'
+ '(-o --check-only)'{-o,--check-only}'[check the package, do not upload]'
+ '(-u --unchecked)'{-u,--unchecked}'[do not check GPG signature on the changes file]'
+ '(-v --version)'{-v,--version}'[show version information]'
+ '1::host:_dput_hosts'
+ '*:changes file:_files -g "*.changes(-.)"'
+ )
+
+ dput_opts=(
+ '(-d --debug)'{-d,--debug}'[debug mode]'
+ '(-H --host-list)'{-H,--host-list}'[display host list]'
+ '(-s --simulate)'{-s,--simulate}'[simulate an upload only]'
+ '(-p --print)'{-p,--print}'[print configuration]'
+ )
+
+ dput_ng_opts=(
+ '*'{-d,--debug}'[enable debug messages, repeat twice to increase the verbosity level]'
+ '*'{-s,--simulate}'[simulate an upload only, repeat twice to increase level of simulation]'
+ '(-F --full-upload-log)'{-F,--full-upload-log}'[write more verbose .upload logs]'
+ )
+
+ if _pick_variant dputng="usage: dput" dput -H ; then
+ _arguments \
+ "$all_opts[@]" "$dput_ng_opts[@]"
+ else
+ _arguments \
+ "$all_opts[@]" "$dput_opts[@]"
+ fi
}
_dput_hosts() {
local expl
if ( [[ ${+_dput_cfhosts} -eq 0 ]] || _cache_invalid dputhosts ) && ! _retrieve_cache dputhosts; then
- _dput_cfhosts=(${${(M)${(f)"$(dput -H)"}:#*=>*}/ =>*/})
+ local cmd
+ if _pick_variant dputng="usage: dput" dput -H ; then
+ cmd=(dirt hosts)
+ else
+ cmd=(dput -H)
+ fi
+ _dput_cfhosts=(${${(M)${(f)"$($cmd)"}:#*=>*}/ =>*/})
_store_cache dputhosts _dput_cfhosts
fi
diff --git a/Completion/Debian/Command/_linda b/Completion/Debian/Command/_linda
deleted file mode 100644
index 12ca72f3e..000000000
--- a/Completion/Debian/Command/_linda
+++ /dev/null
@@ -1,26 +0,0 @@
-#compdef linda
-
-_arguments \
- '(-c --config)'{-c,--config=}':config file:_files' \
- '(-C --checks)'{-C,--checks=}':check regexes:' \
- '(-d --debug)*'{-d,--debug}'[debug]' \
- '(-D --disable-local)*'{-D,--disable-local}'[disable registration of local checks]' \
- '(-f --format)'{-f,--format=}':output format:(branden long lintian figlet)' \
- '(-h --help)'{-h,--help}'[help]' \
- '(-i --info)'{-i,--info}'[info]' \
- '(-l --lab)'{-l,--lab=}':lab root:_files -/' \
- '(-L --list-checks)'{-L,--list-checks=}':list checks:' \
- '(-m --more-overrides)'{-m,--more-overrides=}':more overrides:' \
- '(-n --no-cull)'{-n,--no-cull}'[do not delete lab after completion]' \
- '(-o --show-overridden)'{-o,--show-overridden}'[display errors that are overridden]' \
- '(-p --print-overrides)'{-p,--print-overrides}'[print parsed overrides]' \
- '(-P --profiling)'{-P,--profiling}'[print profiling stats]' \
- '(-q --quiet)'{-q,--quiet}'[quiet]' \
- '(-s --show-tag)'{-s,--show-tag}'[print tag along with errors]' \
- '(-S --seteuid)'{-S,--seteuid}'[do not seteuid to nobody]' \
- '(-t --types)'{-t,--types=}':types string:_values -s , "types" Error Warning eXperimental Informational' \
- '(-T --traceback)'{-T,--traceback}'[show a traceback from any exception]' \
- '(-U --unpack)'{-U,--unpack}':unpack level:' \
- '(-v --verbose)'{-v,--verbose}'[verbose]' \
- '(-V --version)'{-V,--version}'[version]' \
- ':package:_files -g "*.(changes|u#deb|dsc)(-.)"'
diff --git a/Completion/Linux/Command/_brctl b/Completion/Linux/Command/_brctl
index 877326821..6e65d122c 100644
--- a/Completion/Linux/Command/_brctl
+++ b/Completion/Linux/Command/_brctl
@@ -10,10 +10,12 @@ if (( CURRENT == 2 )); then
show:show\ all\ current\ bridge\ instances
addif:add\ interface\ to\ bridge
delif:remove\ interface\ from\ bridge
+ hairpin:toggle\ hairpin\ mode\ on\ a\ port
showmacs:show\ a\ list\ of\ learned\ MAC\ addresses
setageing:set\ MAC\ address\ ageing\ time
setgcint:set\ grabage\ collection\ interval
stp:control\ use\ of\ spanning\ tree\ protocol
+ showstp:show\ bridge\ stp\ info
setbridgeprio:set\ bridge\ priority
setfd:set\ bridge\ forward\ delay
sethello:set\ bridge\ hello\ time
@@ -41,7 +43,7 @@ else
setbridgeprio)
_message -e priority 'priority'
;;
- setpathcost|setportprio)
+ setpathcost|setportprio|hairpin)
_message -e ports 'port'
;;
stp)
@@ -56,6 +58,8 @@ else
_message -e cost 'cost'
elif [[ $subcmd == setportprio ]]; then
_message -e priority 'priority'
+ elif [[ $subcmd == hairpin ]]; then
+ _message -e onoff 'on|off'
fi
fi
fi
diff --git a/Completion/Linux/Command/_btrfs b/Completion/Linux/Command/_btrfs
index eac827050..da2514e99 100644
--- a/Completion/Linux/Command/_btrfs
+++ b/Completion/Linux/Command/_btrfs
@@ -1,7 +1,7 @@
#compdef btrfs
local curcontext="$curcontext" curstate state line expl grp cmd ret=1
-local -a groups args
+local -a groups args cmds_1 cmds_2 cmds_3 cmds_4 cmds_5 cmds_6
groups=( subvolume filesystem device scrub balance inspect-internal help version )
cmds_1=( create delete list snapshot get-default set-default find-new help )
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index 36d922f9a..178406ffd 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -20,6 +20,7 @@ _bzip2
_bzr
_cal
_calendar
+_cat
_ccal
_cdcd
_cdrdao
@@ -57,6 +58,7 @@ _elm
_enscript
_env
_espeak
+_etags
_fakeroot
_feh
_fetchmail
@@ -152,7 +154,6 @@ _nmap
_notmuch
_npm
_nslookup
-_osc
_pack
_patch
_pax
@@ -173,6 +174,7 @@ _pon
_postfix
_prcs
_printenv
+_prove
_psutils
_pump
_pydoc
diff --git a/Completion/Unix/Command/_awk b/Completion/Unix/Command/_awk
index da748e9be..c493c3b04 100644
--- a/Completion/Unix/Command/_awk
+++ b/Completion/Unix/Command/_awk
@@ -14,8 +14,8 @@
# Fixing this is beyond my current _arguments expertise--help
# appreciated.
-_arguments -S -s '-F[define input field separator to be an extended regular expression]:extended regular expression:' \
- '*-v[assign values to variables]:assignment:' \
- '(1)-f[program file]:program file:_files' \
+_arguments -S -s '-F+[define input field separator to be an extended regular expression]:extended regular expression:' \
+ '*-v+[assign values to variables]:assignment:' \
+ '(1)-f+[program file]:program file:_files' \
'1:program text:' \
'*:input files:_files'
diff --git a/Completion/Unix/Command/_cat b/Completion/Unix/Command/_cat
new file mode 100644
index 000000000..e223d90d9
--- /dev/null
+++ b/Completion/Unix/Command/_cat
@@ -0,0 +1,43 @@
+#compdef cat
+
+local -a args
+
+if _pick_variant gnu=GNU unix --version; then
+ args=(
+ '(-A --show-all)'{-A,--show-all}'[equivalent to -vET]'
+ '(-b --number-nonblank -n --number)'{-b,--number-nonblank}'[number nonempty output lines, overrides -n]'
+ '-e[equivalent to -vE]'
+ '(-E --show-ends)'{-E,--show-ends}'[display $ at end of each line]'
+ '(-n --number)'{-n,--number}'[number all output lines]'
+ '(-s --squeeze-blank)'{-s,--squeeze-blank}'[suppress repeated empty output lines]'
+ '-t[equivalent to -vT]'
+ '(-T --show-tabs)'{-T,--show-tabs}'[display TAB characters as ^I]'
+ '-u[ignored]'
+ '(-v --show-nonprinting)'{-v,--show-nonprinting}'[use ^ and M- notation, except for LFD and TAB]'
+ '(- : *)--help[display help and exit]'
+ '(- : *)--version[output version information and exit]'
+ '*:files:_files'
+ )
+
+elif [[ "$OSTYPE" == (freebsd|dragonfly|darwin)* ]]; then
+ args=(
+ '(-n)-b[number non-blank output lines]'
+ '(-v)-e[display $ at the end of each line (implies -v)]'
+ '-n[number all output lines]'
+ '-s[squeeze multiple blank lines into one]'
+ '(-v)-t[display tab as ^I (implies -v)]'
+ '-u[do not buffer output]'
+ '-v[display non-printing chars as ^X or M-a]'
+ '(-)*:files:_files'
+ )
+
+else
+ # POSIX reqires '-u', and most OSes may support '-n'
+ args=(
+ '-n[number all output lines]'
+ '-u[do not buffer output]'
+ '*:files:_files'
+ )
+fi
+
+_arguments -s -S : $args
diff --git a/Completion/Unix/Command/_cp b/Completion/Unix/Command/_cp
index 958214a18..5013f852c 100644
--- a/Completion/Unix/Command/_cp
+++ b/Completion/Unix/Command/_cp
@@ -1,34 +1,62 @@
#compdef cp
-_arguments -s \
- '(-a --archive)'{-a,--archive}'[same as -dpR]' \
- '(-b --backup)-b[backup]' \
- '(-b --backup)--backup=[backup]:method:(none off numbered t existing nil simple never)' \
- '--copy-contents[copy contents of special files when recursive]' \
- '-d[same as --no-dereference --preserve=links]' \
- '(-f --force)'{-f,--force}'[remove and retry for destinations that cannot be opened]' \
- '(-i --interactive)'{-i,--interactive}'[prompt before overwrite]' \
- '-H[follow command-line symbolic links]' \
- '(-l --link)'{-l,--link}'[link files instead of copying]' \
- '(-L --dereference)'{-L,--dereference}'[always follow symbolic links]' \
- '(-n --no-clobber)'{-n,--no-clobber}'[do not overwrite an existing file]' \
- '(-P --no-dereference)'{-P,--no-dereference}'[never follow symbolic links]' \
- '-p[same as --preserve=mode,ownership,timestamps]' \
- '--preserve=[preserve specified attributes]:attributes to preserve:_values -s , mode timestamps ownership links context xattr all' \
- '--no-preserve=[don'\''t preserve specified attributes]:attributes not to preserve:_values -s , mode timestamps ownership links context xattr all' \
- '--parents[append source path to target directory]' \
- '(-R -r --recursive)'{-R,-r,--recursive}'[copy directories recursively]' \
- '--reflink=[control clone/CoW copies]:when to perform a lightweight copy:(always auto)' \
- '--remove-destination[remove each existing destination file before attempting to open it]' \
- '--sparse=[control creation of sparse files]:when to create sparse files:(auto always never)' \
- '--strip-trailing-slashes[remove any trailing slashes from each source argument]' \
- '(-s --symbolic-link)'{-s,--symbolic-link}'[make symbolic links instead of copies of non-directories]' \
- '(-S --suffix)'{-S,--suffix=}'[override the usual backup suffix]:backup suffix:' \
- '(-t --target-directory)'{-t,--target-directory=}'[copy all source arguments into target directory]:target directory:_files -/' \
- '(-T --no-target-directory)'{-T,--no-target-directory}'[treat DEST as a normal file]' \
- '(-u --update)'{-u,--update}'[copy only when source is newer than destination or destination is missing]' \
- '(-v --verbose)'{-v,--verbose}'[explain what is being done]' \
- '(-x --one-file-system)'{-x,--one-file-system}'[stay on this file system]' \
- '--help' \
- '--version' \
- '*:file or directory:_files'
+if _pick_variant gnu=GNU unix --version; then
+ _arguments -s -S \
+ '(-a --archive)'{-a,--archive}'[same as -dR --preserve=all]' \
+ '(-b --backup)-b[backup]' \
+ '(-b --backup)--backup=[backup]:method:(none off numbered t existing nil simple never)' \
+ '--copy-contents[copy contents of special files when recursive]' \
+ '-d[same as --no-dereference --preserve=links]' \
+ '(-f --force)'{-f,--force}'[remove and retry for destinations that cannot be opened]' \
+ '(-i --interactive)'{-i,--interactive}'[prompt before overwrite]' \
+ '-H[follow command-line symbolic links]' \
+ '(-l --link)'{-l,--link}'[link files instead of copying]' \
+ '(-L --dereference)'{-L,--dereference}'[always follow symbolic links]' \
+ '(-n --no-clobber)'{-n,--no-clobber}'[do not overwrite an existing file]' \
+ '(-P --no-dereference)'{-P,--no-dereference}'[never follow symbolic links]' \
+ '-p[same as --preserve=mode,ownership,timestamps]' \
+ '--preserve=[preserve specified attributes]:attributes to preserve:_values -s , mode timestamps ownership links context xattr all' \
+ '--no-preserve=[don'\''t preserve specified attributes]:attributes not to preserve:_values -s , mode timestamps ownership links context xattr all' \
+ '--parents[append source path to target directory]' \
+ '(-R -r --recursive)'{-R,-r,--recursive}'[copy directories recursively]' \
+ '--reflink=[control clone/CoW copies]:when to perform a lightweight copy:(always auto)' \
+ '--remove-destination[remove each existing destination file before attempting to open it]' \
+ '--sparse=[control creation of sparse files]:when to create sparse files:(auto always never)' \
+ '--strip-trailing-slashes[remove any trailing slashes from each source argument]' \
+ '(-s --symbolic-link)'{-s,--symbolic-link}'[make symbolic links instead of copies of non-directories]' \
+ '(-S --suffix)'{-S,--suffix=}'[override the usual backup suffix]:backup suffix:' \
+ '(-t --target-directory)'{-t,--target-directory=}'[copy all source arguments into target directory]:target directory:_files -/' \
+ '(-T --no-target-directory)'{-T,--no-target-directory}'[treat DEST as a normal file]' \
+ '(-u --update)'{-u,--update}'[copy only when source is newer than destination or destination is missing]' \
+ '(-v --verbose)'{-v,--verbose}'[explain what is being done]' \
+ '(-x --one-file-system)'{-x,--one-file-system}'[stay on this file system]' \
+ '--help' \
+ '--version' \
+ '*:file or directory:_files'
+
+elif [[ "$OSTYPE" == darwin* ]]; then
+ _arguments -s -S \
+ '-R[copy directories recursively]' \
+ '(-L -P)-H[with -R, follow symlinks on the command line]' \
+ '(-H -P)-L[with -R, follow all symlinks]' \
+ '(-H -L)-P[with -R, do not follow symlinks (default)]' \
+ '(-i -n)-f[force overwriting existing file]' \
+ '(-f -n)-i[confirm before overwriting existing file]' \
+ '(-f -i)-n[do not overwrite existing file]' \
+ '-a[same as -pRP]' \
+ '-p[preserve timestamps, mode, owner, flags, ACLs, and Extended Attributes]' \
+ '-v[show file names as they are copied]' \
+ '-X[do not copy Extended Attributes or resource forks]' \
+ '(-)*:file or directory:_files'
+
+else # assume POSIX
+ _arguments -s -S \
+ '-R[copy directories recursively]' \
+ '(-L -P)-H[with -R, follow symlinks on the command line]' \
+ '(-H -P)-L[with -R, follow all symlinks]' \
+ '(-H -L)-P[do not follow symlinks]' \
+ '(-i)-f[force overwriting existing file]' \
+ '(-f)-i[confirm before overwriting existing file]' \
+ '-p[preserve timestamps, mode, and owner]' \
+ '(-)*:file or directory:_files'
+fi
diff --git a/Completion/Unix/Command/_cut b/Completion/Unix/Command/_cut
index 81e8c257b..1024c20a7 100644
--- a/Completion/Unix/Command/_cut
+++ b/Completion/Unix/Command/_cut
@@ -5,54 +5,54 @@ typeset -A _cut_args
if _pick_variant gnu="Free Soft" unix --version; then
case $LANG in
(de_DE.UTF-8)
- _cut_args=(
- bytes "nur diese Bytes ausgeben"
- characters "nur diese Zeichen ausgeben"
- delimiter "Delimiter anstelle von Tabulator als Trenner benutzen"
- fields "nur diese Felder und alle Zeilen OHNE Trennzeichen ausgeben"
- n "(ignoriert)"
- complement "das Komplement der Menge der gew$'\u00e4'hlten Bytes, Zeichen oder Felder bilden"
- only-delimited "keine Zeilen ausgeben, die keinen Trenner enthalten"
- output-delimiter "Zeichenkette als Ausgabetrennzeichen benutzen"
- help "diese Hilfe anzeigen und beenden"
- version "Versionsinformation anzeigen und beenden"
- )
+ _cut_args=(
+ bytes "nur diese Bytes ausgeben"
+ characters "nur diese Zeichen ausgeben"
+ delimiter "Delimiter anstelle von Tabulator als Trenner benutzen"
+ fields "nur diese Felder und alle Zeilen OHNE Trennzeichen ausgeben"
+ n "(ignoriert)"
+ complement $'das Komplement der Menge der gew\u00e4hlten Bytes, Zeichen oder Felder bilden'
+ only-delimited "keine Zeilen ausgeben, die keinen Trenner enthalten"
+ output-delimiter "Zeichenkette als Ausgabetrennzeichen benutzen"
+ help "diese Hilfe anzeigen und beenden"
+ version "Versionsinformation anzeigen und beenden"
+ )
;;
(*)
- _cut_args=(
- bytes "select only these bytes"
- characters "select only these characters"
- delimiter "use DELIM instead of TAB for field delimiter"
- fields "select only these fields and lines without the delimiter character"
- n "(ignored)"
- complement "complement the set of selected bytes, characters or fields"
- only-delimited "do not print lines not containing delimiters"
- output-delimiter "use STRING as the output delimiter"
- help "display this help and exit"
- version "output version information and exit"
- )
+ _cut_args=(
+ bytes "select only these bytes"
+ characters "select only these characters"
+ delimiter "use DELIM instead of TAB for field delimiter"
+ fields "select only these fields and lines without the delimiter character"
+ n "(ignored)"
+ complement "complement the set of selected bytes, characters or fields"
+ only-delimited "do not print lines not containing delimiters"
+ output-delimiter "use STRING as the output delimiter"
+ help "display this help and exit"
+ version "output version information and exit"
+ )
;;
esac
_arguments \
- '(--bytes -b)'{--bytes=,-b+}'['$_cut_args[bytes]']:list' \
- '(--characters -c)'{--characters=,-c+}'['$_cut_args[characters]']:list' \
- '(--delimiter -d)'{--delimiter=,-d+}'['$_cut_args[delimiter]']:delimeter' \
- '(--fields -f)'{--fields=,-f+}'['$_cut_args[fields]']:list' \
- '-n['$_cut_args[n]']' \
- '--complement['$_cut_args[complement]']' \
- '(--only-delimited -s)'{--only-delimited,-s}'['$_cut_args[only-delimited]']' \
- '--output-delimiter=['$_cut_args[output-delimiter]']:delimeter' \
- '--help['$_cut_args[help]']' \
- '--version['$_cut_args[version]']' \
- '*:file:_files'
+ '(--bytes -b)'{--bytes=,-b+}'['$_cut_args[bytes]']:list' \
+ '(--characters -c)'{--characters=,-c+}'['$_cut_args[characters]']:list' \
+ '(--delimiter -d)'{--delimiter=,-d+}'['$_cut_args[delimiter]']:delimiter' \
+ '(--fields -f)'{--fields=,-f+}'['$_cut_args[fields]']:list' \
+ '-n['$_cut_args[n]']' \
+ '--complement['$_cut_args[complement]']' \
+ '(--only-delimited -s)'{--only-delimited,-s}'['$_cut_args[only-delimited]']' \
+ '--output-delimiter=['$_cut_args[output-delimiter]']:delimiter' \
+ '(- *)--help['$_cut_args[help]']' \
+ '(- *)--version['$_cut_args[version]']' \
+ '*:file:_files'
else
_arguments \
'-b[list specifies byte positions]:list:' \
'-c[list specifies character positions]:list:' \
- '-d[use alternate delimeter]:delimeter:' \
+ '-d[use alternate delimiter]:delimiter' \
'-f[list specifies fields]:list:' \
'-n[do not split multi-byte characters]' \
- '-s[suppress lines with no delimeters]' \
+ '-s[suppress lines with no delimiters]' \
'*:file:_files'
fi
diff --git a/Completion/Unix/Command/_devtodo b/Completion/Unix/Command/_devtodo
index 06fc675fc..2800f4a31 100644
--- a/Completion/Unix/Command/_devtodo
+++ b/Completion/Unix/Command/_devtodo
@@ -8,9 +8,11 @@ typeset -i i
typeset expl
for ((i=2; i <= $#words; i++)) {
- if [[ $words[$i] == '--database' ]] {
+ if [[ $words[$i] == '--database' ]]; then
todo_opts+=(--database ${~words[$((++i))]})
- }
+ elif [[ $words[$i] == '--sort' ]]; then
+ todo_opts+=(--sort ${words[$((++i))]})
+ fi
}
priorities=(verylow low medium high veryhigh)
diff --git a/Completion/Unix/Command/_django b/Completion/Unix/Command/_django
index 30a46d23b..ac20409eb 100644
--- a/Completion/Unix/Command/_django
+++ b/Completion/Unix/Command/_django
@@ -59,7 +59,7 @@ case $state in
)
for cmd in $(./manage.py --help 2>&1 >/dev/null | \
- awk -vdrop=1 '{ if (!drop) print substr($0, 3) } /^Available subcommands/ { drop=0 }')
+ awk -v drop=1 '{ if (!drop) print substr($0, 3) } /^Available subcommands/ { drop=0 }')
do
if ! echo $subcommands | grep -qs "${cmd}:"
then
diff --git a/Completion/Unix/Command/_du b/Completion/Unix/Command/_du
index 9974d72e9..9ae6e9cb3 100644
--- a/Completion/Unix/Command/_du
+++ b/Completion/Unix/Command/_du
@@ -47,6 +47,24 @@ if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then
return ret
+elif [[ "$OSTYPE" == darwin* ]]; then
+ _arguments -s -A "-*" \
+ '(-H -L -P)-H[follow symlinks on the command line]' \
+ '(-H -L -P)-L[follow all symlinks]' \
+ '(-H -L -P)-P[do not follow symlinks (default)]' \
+ '*-I+[ignore files/directories matching specified mask]:mask' \
+ '(-a -s -d)-a[display entry also for files (not just directories) in file hierarchy]' \
+ '(-a -s -d)-d+[display entry for directories up to specified depth]:depth' \
+ '(-a -s -d)-s[display entry only for files/directories specified on the command line]' \
+ '(-h -k -m -g)-h[human readable output]' \
+ '(-h -k -m -g)-k[use block size of 1K-byte]' \
+ '(-h -k -m -g)-m[use block size of 1M-byte]' \
+ '(-h -k -m -g)-g[use block size of 1G-byte]' \
+ '-c[display grand total]' \
+ '-r[notify about unreadable files/directories]' \
+ '-x[exclude directories on different file systems]' \
+ '*:file:_files'
+
else
# based on $OSTYPE = solaris2.8
local xdev='[skip directories on different filesystems]'
diff --git a/Completion/Unix/Command/_etags b/Completion/Unix/Command/_etags
new file mode 100644
index 000000000..d1644fded
--- /dev/null
+++ b/Completion/Unix/Command/_etags
@@ -0,0 +1,63 @@
+#compdef etags
+
+integer ret=1
+local context state line expl
+typeset -A opt_args
+
+_arguments \
+ '(-a --append)'{-a,--append}'[append tag entries]' \
+ '--packages-only[only generate tags for Ada packages]' \
+ '--declarations[C etc.: tags for function declarations]' \
+ '(-D --no-defines)'{-D,--no-defines}'[No tags for preprocessor definitions]' \
+ {-i-,--include=}'[Tag file should include another]:tag file:_files' \
+ {-l-,--language=}'[Specify language]:language:->lang' \
+ '--no-globals[No tag entries for global variables]' \
+ '--no-members[No tag entries for structure members]' \
+ {-r-,--regex=}'[Specify regular expression]:regular expression:->regex' \
+ {-R,--no-regex}'[No regular expressions for tags]' \
+ '(-I --ignore-indentation)'{-I,--ignore-indentation}'[Closing brace in first col may not be start of func]' \
+ '(-o --output)'{-o-,--output=}'[Specify output file]:file:_files' \
+ '--parse-stdin=[Specify file name for stdin]:file name:_files' \
+ '(-V --version)'{-V,--version}'[Output version]' \
+ '(-h --help)'{-h,--help}'[Output help]' \
+ '*:file to tag:_files' \
+ && ret=0
+
+case $state in
+ (lang)
+ local -a langs
+ langs=(${${${${(f)"$(etags --help)"}:#^ [^[:blank:]]##[[:blank:]]##([[:alnum:].]*|)}# }%%[[:blank:]]*})
+ _wanted languages expl language compadd -a langs && ret=0
+ ;;
+
+ (regex)
+ if compset -P @; then
+ _files && ret=0
+ elif [[ -n $PREFIX ]]; then
+ local sep=$PREFIX[1]
+ [[ $sep = [\\*?#] ]] && sep="\\$sep"
+ local -a match mbegin mend
+ if compset -P "$sep*$sep*$sep"; then
+ local mods=smi
+ mods=${mods//[${PREFIX}]}
+ if [[ -n $mods ]]; then
+ compset -P '*'
+ local -a modarr
+ [[ $mods = *i* ]] && modarr+=("i:ignore case")
+ [[ $mods = *m* ]] && modarr+=("m:allow multi-line matches")
+ [[ $mods = *s* ]] && modarr+=("s:multi-line, dot matches newline")
+ _describe -t modifiers modifier modarr && ret=0
+ fi
+ elif compset -P "$sep*$sep"; then
+ _message "tagname" && ret=0
+ else
+ compset -P "$sep"
+ _message "tag regexp" && ret=0
+ fi
+ else
+ _message "regexp separator or @ for file" && ret=0
+ fi
+ ;;
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 2b6a36956..119a705f6 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -64,8 +64,9 @@ _git-add () {
'(-i --interactive : -)'{-i,--interactive}'[add contents interactively to index]' \
'(-p --patch)'{-p,--patch}'[like -i but go directly into patch mode for specified files]' \
'(-e --edit)'{-e,--edit}'[open diff against index in editor]' \
- '(-u --update -A --all)'{-u,--update}'[update only files git already knows about]' \
- '(-A --all -u --update)'{-A,--all}'[act as both add . and add -u]' \
+ '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)'{-A,--all,--no-ignore-removal}'[add, modify, and remove index entries to match the working tree]' \
+ '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)'{--no-all,--ignore-removal}'[like "--all" but ignore removals]' \
+ '(-A --all --no-ignore-removal -u --update --no-all --ignore-removal)'{-u,--update}'[update the index just where it already has an entry matching <pathspec>]' \
'(-N --intent-to-add)'{-N,--intent-to-add}'[record only that path will be added later]' \
'--refresh[do not add files, but refresh their stat() info in index]' \
'--ignore-errors[continue adding if an error occurs]' \
@@ -104,6 +105,7 @@ _git-am () {
_arguments -S \
'(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \
'(-k --keep)'{-k,--keep}'[pass -k to git mailinfo]' \
+ '--keep-non-patch[pass -b to git mailinfo]' \
'( --no-keep-cr)--keep-cr[pass --keep-cr to git mailsplit]' \
'(--keep-cr )--no-keep-cr[do not pass --keep-cr to git mailsplit]' \
'(-c --scissors --no-scissors)'{-c,--scissors}'[strip everything before a scissors line]' \
@@ -277,12 +279,13 @@ _git-bisect () {
(( $+functions[_git-branch] )) ||
_git-branch () {
- declare l c m d
+ declare l c m d e
- l='--color --no-color -r -a -v --verbose --abbrev --no-abbrev'
- c='-l -f --force -t --track --no-track --set-upstream --contains --merged --no-merged'
- m='-m -M'
- d='-d -D'
+ l='--color --no-color -r -a -v --verbose --abbrev --no-abbrev --list'
+ c='-l -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --merged --no-merged'
+ m='-m --move -M'
+ d='-d --delete -D'
+ e='--edit-description'
declare -a dependent_creation_args
if (( words[(I)-r] == 0 )); then
@@ -312,27 +315,33 @@ _git-branch () {
fi
_arguments -w -S -s \
- "($c $m $d --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \
- "($c $m $d : --color)--no-color[turn off branch coloring]" \
- "($c $m -a)-r[list or delete only remote-tracking branches]" \
- "($c $m $d : -r)-a[list both remote-tracking branches and local branches]" \
- "($c $m $d : -v --verbose)"{-v,--verbose}'[show SHA1 and commit subject line for each head]' \
- "($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \
- "($c $m $d :)--no-abbrev[do not abbreviate sha1s]" \
- "($l $m $d)-l[create the branch's reflog]" \
- "($l $m $d -f --force)"{-f,--force}"[force the creation of a new branch]" \
- "($l $m $d -t --track)"{-t,--track}"[set up configuration so that pull merges from the start point]" \
- "($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \
- "($l $m $d)--set-upstream[set up configuration so that pull merges]" \
- "($l $m $d)--contains=[only list branches which contain the specified commit]: :__git_committishs" \
- "($l $m $d)--merged=[only list branches which are fully contained by HEAD]: :__git_committishs" \
- "($l $m $d)--no-merged=[do not list branches which are fully contained by HEAD]: :__git_committishs" \
+ "($c $m $d $e --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \
+ "($c $m $d $e : --color)--no-color[turn off branch coloring]" \
+ "($c $m $d $e --no-column)"'--column=[display tag listing in columns]:column.branch option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \
+ "($c $m $d $e --column)"'--no-column[do not display in columns]' \
+ "($c $m $d $e )*--list[list only branches matching glob]:pattern" \
+ "($c $m $e -a)-r[list or delete only remote-tracking branches]" \
+ "($c $m $d $e: -r)-a[list both remote-tracking branches and local branches]" \
+ "($c $m $d $e : -v -vv --verbose)"{-v,-vv--verbose}'[show SHA1 and commit subject line for each head]' \
+ "($c $m $d $e :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \
+ "($c $m $d $e :)--no-abbrev[do not abbreviate sha1s]" \
+ "($l $m $d $e)-l[create the branch's reflog]" \
+ "($l $m $d $e -f --force)"{-f,--force}"[force the creation of a new branch]" \
+ "($l $m $d $e -t --track)"{-t,--track}"[set up configuration so that pull merges from the start point]" \
+ "($l $m $d $e)--no-track[override the branch.autosetupmerge configuration variable]" \
+ "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)"{-u,--set-upstream-to=}"[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names" \
+ "($l $m $d $e -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \
+ "($l $m $d $e)--contains=[only list branches which contain the specified commit]: :__git_committishs" \
+ "($l $m $d $e)--merged=[only list branches which are fully contained by HEAD]: :__git_committishs" \
+ "($l $m $d $e)--no-merged=[do not list branches which are fully contained by HEAD]: :__git_committishs" \
+ "($c $l $m $d)--edit-description[edit branch description]" \
$dependent_creation_args \
- "($l $c $d -M)-m[rename a branch and the corresponding reflog]" \
- "($l $c $d -m)-M[rename a branch even if the new branch-name already exists]" \
+ "($l $c $d $m $e)"{-m,--move}"[rename a branch and the corresponding reflog]" \
+ "($l $c $d $m $e)-M[rename a branch even if the new branch-name already exists]" \
$dependent_modification_args \
- "($l $c $m -D)-d[delete a fully merged branch]" \
- "($l $c $m -d)-D[delete a branch]" \
+ "($l $c $m $d $e)"{-d,--delete}"[delete a fully merged branch]" \
+ "($l $c $m $d $e)-D[delete a branch]" \
+ {-q,--quiet}"[be more quiet]" \
$dependent_deletion_args
}
@@ -390,6 +399,23 @@ _git-bundle () {
return ret
}
+(( $+functions[_git-check-ignore] )) ||
+_git-check-ignore () {
+ _arguments \
+ '(-q --quiet)'{-q,--quiet}'[do not output anything, just set exit status]' \
+ '(-v --verbose)'{-v,--verbose}'[output details about the matching pattern (if any) for each pathname]' \
+ '--stdin[read file names from stdin instead of from the command-line]' \
+ '-z[make output format machine-parseable]' \
+ '(-n --non-matching)'{-n,--non-matching}'[show given paths which do not match any pattern]' \
+ '*:: :->file' && ret=0
+}
+
+(( $+functions[_git-check-mailmap] )) ||
+_git-check-mailmap () {
+ _arguments \
+ '--stdin[read contacts from stdin after those given on the command line]'
+}
+
(( $+functions[_git-checkout] )) ||
_git-checkout () {
# TODO: __git_tree_ishs is just stupid. It should be giving us a list of tags
@@ -414,6 +440,7 @@ _git-checkout () {
'(--patch)--no-track[override the branch.autosetupmerge configuration variable]' \
$new_branch_reflog_opt \
'(-b -B -t --track --patch)--orphan[create a new orphan branch based at given commit]: :__git_branch_names' \
+ '--ignore-skip-worktree-bits[ignores patterns and adds back any files in <paths>]' \
'(-q --quiet -f --force -m --merge --conflict --patch)'{-m,--merge}'[3way merge current branch, working tree and new branch]' \
'(-q --quiet -f --force -m --merge --patch)--conflict[same as --merge, using given merge style]:style:(merge diff3)' \
'(-)'{-p,--patch}'[interactively select hunks in diff between given tree-ish and working tree]' \
@@ -430,22 +457,27 @@ _git-checkout () {
if (( CURRENT == 1 )) && [[ -z $opt_args[(I)--] ]]; then
# TODO: Allow A...B
local branch_arg='branches::__git_revisions' \
+ remote_branch_noprefix_arg='remote branches::__git_remote_branch_names_noprefix' \
tree_ish_arg='tree-ishs::__git_tree_ishs' \
file_arg='modified-files::__git_modified_files'
if [[ -n ${opt_args[(I)-b|-B|--orphan]} ]]; then
+ remote_branch_noprefix_arg=
tree_ish_arg=
file_arg=
elif [[ -n $opt_args[(I)--track] ]]; then
branch_arg='remote-branches::__git_remote_branch_names'
+ remote_branch_noprefix_arg=
tree_ish_arg=
file_arg=
elif [[ -n ${opt_args[(I)--ours|--theirs|-m|--conflict|--patch]} ]]; then
branch_arg=
+ remote_branch_noprefix_arg=
fi
_alternative \
$branch_arg \
+ $remote_branch_noprefix_arg \
$tree_ish_arg \
$file_arg && ret=0
elif [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan]} ]]; then
@@ -464,11 +496,18 @@ _git-checkout () {
(( $+functions[_git-cherry-pick] )) ||
_git-cherry-pick () {
_arguments \
+ '(- :)--quit[end revert or cherry-pick sequence]' \
+ '(- :)--continue[resume revert or cherry-pick sequence]' \
+ '(- :)--abort[cancel revert or cherry-pick sequence]' \
+ '--allow-empty-message[allow replaying a commit with an empty message]' \
+ '--keep-redundant-commits[keep cherry-picked commits that will become empty]' \
'(-e --edit --ff)'{-e,--edit}'[edit commit before committing the revert]' \
'(--ff)-x[append information about what commit was cherry-picked]' \
'(-m --mainline)'{-m,--mainline}'[specify mainline when cherry-picking a merge commit]:parent number' \
'(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actually commit]' \
'(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
+ '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \
+ '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \
'(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \
': :__git_revisions'
}
@@ -486,6 +525,7 @@ _git-clean () {
_arguments -w -C -S -s \
'-d[also remove untracked directories]' \
'(-f --force)'{-f,--force}'[required when clean.requireForce is true (default)]' \
+ '(-i --interactive)'{-i,--interactive}'[show what would be done and clean files interactively]' \
'(-n --dry-run)'{-n,--dry-run}'[only show what would and what would not be removed]' \
'(-q --quiet)'{-q,--quiet}'[only report errors]' \
'*'{-e,--exclude=}'[skip files matching specified pattern]:pattern' \
@@ -543,7 +583,8 @@ _git-clone () {
# TODO: Argument to -b should complete branch names in the repository being
# cloned.
_arguments -w -C -S -s \
- '(-l --local)'{-l,--local}'[clone locally, hardlink refs and objects if possible]' \
+ '(-l --local --no-local)'{-l,--local}'[clone locally, hardlink refs and objects if possible]' \
+ '(-l --local --no-local)--no-local[override --local, as if file:/// URL was given]' \
'--no-hardlinks[copy files instead of hardlinking when doing a local clone]' \
'(-s --shared)'{-s,--shared}'[share the objects with the source repository (warning: see man page)]' \
'--reference[reference repository]:repository:_directories' \
@@ -557,7 +598,9 @@ _git-clone () {
'(-b --branch)'{-b,--branch}'[point HEAD to the given branch]: :__git_guard_branch-name' \
'(-u --upload-pack)'{-u,--upload-pack=}'[specify path to git-upload-pack on remote side]:remote path' \
'--template=[directory to use as a template for the object database]: :_directories' \
+ '*'{-c,--config}'[<key>=<value> set a configuration variable in the newly created repository]' \
'--depth[create a shallow clone, given number of revisions deep]: :__git_guard_number depth' \
+ '--single-branch[clone only history leading up to the main branch or the one specified by -b]' \
'--recursive[initialize all contained submodules]' \
': :->repository' \
': :_directories' && ret=0
@@ -575,6 +618,18 @@ _git-clone () {
return ret
}
+(( $+functions[_git-column] )) ||
+_git-column () {
+ _arguments -w -S -s \
+ '--command=[look up layout mode using config vars column.<name> and column.ui]' \
+ '--mode=[specify layout mode. See configuration variable column.ui for option syntax]' \
+ '--raw-mode=[same as --mode but take mode encoded as a number]' \
+ '--width=[specify the terminal width]' \
+ '--indent=[string to be printed at the beginning of each line]' \
+ '--nl[string to be printed at the end of each line, including newline character]' \
+ '--padding[the number of spaces between columns. One space by default]'
+}
+
(( $+functions[_git-commit] )) ||
_git-commit () {
local amend_opt='--amend[amend the tip of the current branch]'
@@ -587,25 +642,29 @@ _git-commit () {
reset_author_opt='(--author)--reset-author[make committer the author of the commit]'
fi
- # TODO: --null is an undocumented alias.
# TODO: --interactive isn’t explicitly listed in the documentation.
_arguments -w -S -s \
'(-a --all --interactive -o --only -i --include *)'{-a,--all}'[stage all modified and deleted paths]' \
+ '--fixup=[construct a commit message for use with rebase --autosquash]:' \
+ '--squash=[construct a commit message for use with rebase --autosquash]:' \
$reset_author_opt \
'( --porcelain --dry-run)--short[output dry run in short format]' \
'(--short --dry-run)--porcelain[output dry run in porcelain-ready format]' \
'(--short --porcelain --dry-run -z --null)'{-z,--null}'[separate dry run entry output with NUL]' \
+ '--patch[use the interactive patch selection interface to chose which changes to commit]' \
'(--reset-author)--author[override the author name used in the commit]:author name' \
'--date=[override the author date used in the commit]:date' \
'(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
'(-n --no-verify)'{-n,--no-verify}'[do not look for suspicious lines the commit introduces]' \
'--allow-empty[allow recording an empty commit]' \
'--allow-empty-message[allow recording a commit with an empty message]' \
- '--cleanup=[specify how the commit message should be cleaned up]:mode:((verbatim\:"don'\''t change the commit message at all"
+ '--cleanup=[specify how the commit message should be cleaned up]:mode:((verbatim\:"do not change the commit message at all"
whitespace\:"remove leading and trailing whitespace lines"
strip\:"remove both whitespace and commentary lines"
default\:"act as '\''strip'\'' if the message is to be edited and as '\''whitespace'\'' otherwise"))' \
- '(-e --edit)'{-e,--edit}'[edit the commit message before committing]' \
+ '(-e --edit --no-edit)'{-e,--edit}'[edit the commit message before committing]' \
+ '(-e --edit --no-edit)--no-edit[do not edit the commit message before committing]' \
+ '--no-post-rewrite[bypass the post-rewrite hook]' \
'(-a --all --interactive -o --only -i --include)'{-i,--include}'[update the given files and commit the whole index]' \
'(-a --all --interactive -o --only -i --include)'{-o,--only}'[commit only the given files]' \
'(-u --untracked-files)'{-u-,--untracked-files=}'[show files in untracked directories]::mode:((no\:"show no untracked files"
@@ -616,6 +675,7 @@ _git-commit () {
'--dry-run[only show list of paths that are to be commited or not, and any untracked]' \
'( --no-status)--status[include the output of git status in the commit message template]' \
'(--status )--no-status[do not include the output of git status in the commit message template]' \
+ '(-S --gpg-sign)'{-S-,--gpg-sign=}'[GPG-sign the commit]::key id' \
'(-a --all --interactive -o --only -i --include *)--interactive[interactively update paths in the index file]' \
'*: :__git_ignore_line_inside_arguments __git_changed_files' \
- '(message)' \
@@ -641,6 +701,7 @@ _git-describe () {
'(--abbrev)--long[always show full format, even for exact matches]' \
'--match=[only consider tags matching glob pattern]:pattern' \
'--always[show uniquely abbreviated commit object as fallback]' \
+ '--first-parent[follow only the first parent of merge commits]' \
'*: :__git_committishs'
}
@@ -788,14 +849,18 @@ _git-format-patch () {
'(--thread )--no-thread[do not thread messages]' \
'--in-reply-to=[make the first mail a reply to the given message]:message id' \
'--ignore-if-in-upstream[do not include a patch that matches a commit in the given range]' \
+ '(-v --reroll-count)'{-v,--reroll-count=}'[mark the series as the <n>-th iteration of the topic]: :__git_guard_number iteration' \
'(-k --keep-subject)--subject-prefix=[use the given prefix instead of \[PATCH\]]:prefix' \
'*--to=[add To: header to email headers]: :_email_addresses' \
'*--cc=[add Cc: header to email headers]: :_email_addresses' \
+ '--from=[add From: header to email headers]: :_email_addresses' \
'*--add-header=[add an arbitrary header to email headers]:header' \
'--cover-letter[generate a cover letter template]' \
+ '--notes=[append notes for the commit after the three-dash line]:: :__git_notes_refs' \
'( --no-signature)--signature=[add a signature]:signature' \
'(--signature )--no-signature[do not add a signature]' \
'--suffix=[use the given suffix for filenames]:filename suffix' \
+ '--quiet[suppress the output of the names of generated files]' \
'--no-binary[do not output contents of changes in binary files, only note that they differ]' \
'--root[treat the revision argument as a range]' \
': :->commit-or-commit-range' && ret=0
@@ -842,19 +907,23 @@ _git-grep () {
_arguments -C -A '-*' \
'(-O --open-files-in-pager --no-index)--cached[search blobs registered in index file instead of working tree]' \
'(--cached)--no-index[search files in current directory, not just treacked files]' \
+ '(--exclude-standard)--no-exclude-standard[also search in ignored files]' \
+ '(--no-exclude-standard)--exclude-standard[exclude files standard ignore mechanisms]' \
+ '--untracked[search in untracked files]' \
'(-a --text)'{-a,--text}'[process binary files as if they were text]' \
'(-i --ignore-case)'{-i,--ignore-case}'[ignore case when matching]' \
'-I[do not match pattern in binary files]' \
- '--max-depth=[descend at most given levels of directories]:__git_guard_number depth' \
+ '--max-depth=[descend at most given levels of directories]: :__git_guard_number depth' \
'(-w --word-regexp)'{-w,--word-regexp}'[match only whole words]' \
'(-v --invert-match)'{-v,--invert-match}'[select non-matching lines]' \
'( -H)-h[supress output of filenames]' \
'(-h )-H[show filenames]' \
'--full-name[output paths relative to the project top directory]' \
- '(-E --extended-regexp -G --basic-regexp)'{-E,--extended-regexp}'[use POSIX extended regexes]' \
- '(-E --extended-regexp -G --basic-regexp)'{-G,--basic-regexp}'[use POSIX basic regexes]' \
- '(-F --fixed-strings)'{-F,--fixed-strings}'[do not interpret pattern as a regex]' \
- '-n[prefix the line number to matching lines]' \
+ '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-E,--extended-regexp}'[use POSIX extended regexes]' \
+ '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-G,--basic-regexp}'[use POSIX basic regexes]' \
+ '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-P,--perl-regexp}'[use perl-compatible regexes]' \
+ '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-F,--fixed-strings}'[do not interpret pattern as a regex]' \
+ '(-n --line-number)'{-n,--line-number}'[prefix the line number to matching lines]' \
'(-l --files-with-matches -L --files-without-match --name-only)'{-l,--files-with-matches,--name-only}'[show only names of matching files]' \
'(-l --files-with-matches -L --files-without-match)'{-L,--files-without-match}'[show only names of non-matching files]' \
'(--cached -O --open-files-in-pager)'{-O,--open-files-in-pager}'=-[open matching files in pager]::_path_commands' \
@@ -862,10 +931,13 @@ _git-grep () {
'(-c --count)'{-c,--count}'[show number of matching lines in files]' \
'( --no-color)--color=-[color matches]:: :__git_color_whens' \
'(--color )---no-color[do not color matches]' \
- '-A[show trailing context]: :__git_guard_number lines' \
- '-B[show leading context]: :__git_guard_number lines' \
- '-C[show context]: :__git_guard_number lines' \
+ '--break[prefix the line number to matching lines]' \
+ '--heading[show the filename above the matches]' \
+ '(-A --after-context)'{-A,--after-context=}'[show <num> trailing lines, and separate groups of matches]: :__git_guard_number lines' \
+ '(-B --before-context)'{-B,--before-context=}'[show <num> leading lines, and separate groups of matches]: :__git_guard_number lines' \
+ '(-A --after-context -B --before-context -C --context)'{-C,--context=}'[show <num> leading and trailing lines, and separate groups of matches]: :__git_guard_number lines' \
'(-p --show-function)'{-p,--show-function}'[show preceding line containing function name of match]' \
+ '(-W --function-context)'{-W,--function-context}'[show whole function where a match was found]' \
'(1)*-f[read patterns from given file]:pattern file:_files' \
'(1)*-e[use the given pattern for matching]:pattern' \
$pattern_operators \
@@ -979,6 +1051,7 @@ _git-init () {
'--bare[create a bare repository]' \
'--template=[directory to use as a template for the object database]: :_directories' \
'--shared=[share repository amongst several users]:: :__git_repository_permissions' \
+ '--separate-git-dir=[create git dir elsewhere and link it using the gitdir mechanism]:: :_directories' \
':: :_directories'
}
@@ -996,6 +1069,7 @@ _git-log () {
$log_options \
$revision_options \
$diff_options \
+ '-L+[trace the evolution of a line range or regex within a file]:range' \
'(-)--[start file arguments]' \
'*:: :->commit-range-or-file' && ret=0
@@ -1039,6 +1113,7 @@ _git-merge () {
'-m[set the commit message to be used for the merge commit]:merge message' \
'( --no-rerere-autoupdate)--rerere-autoupdate[allow the rerere mechanism to update the index]' \
'(--rerere-autoupdate )--no-rerere-autoupdate[do not allow the rerere mechanism to update the index]' \
+ '--abort[restore the original branch and abort the merge operation]' \
'*: :__git_commits'
}
@@ -1085,6 +1160,7 @@ _git-notes () {
copy:'copy notes from one object to another'
append:'append notes to a given object'
edit:'edit notes for a given object'
+ merge:'merge the given notes ref into the current ref'
show:'show notes for a given object'
remove:'remove notes for a given object'
prune:'remove all notes for non-existing/unreachable objects')
@@ -1119,6 +1195,15 @@ _git-notes () {
': :__git_commits' \
': :__git_commits' && ret=0
;;
+ (merge)
+ _arguments -w -S -s \
+ '(-s --strategy)--abort[abort an in-progress notes merge]' \
+ '(-s --strategy)--commit[finalize an in-progress notes merge]' \
+ {-q,--quiet}'[be quiet]' \
+ {-v,--verbose}'[be more verbose]' \
+ '(--abort --commit)'{-s,--strategy=}'[resolve conflicts using the given strategy]' \
+ ': :__git_notes_refs' && ret=0
+ ;;
(append)
_arguments -w -S -s \
'*'{-m,--message=}'[use given note message]:message' \
@@ -1160,20 +1245,25 @@ _git-push () {
# later on to match the remote end.
_arguments -w -S -s \
'--all[push all refs under refs/heads/]' \
+ '--prune[remove remote branches that do not have a local counterpart]' \
'--mirror[push all refs under refs/heads/ and refs/tags/ and delete non-existing refs]' \
'(-n --dry-run)'{-n,--dry-run}'[do everything except actually send the updates]' \
'--porcelain[produce machine-readable output]' \
'--delete[delete all listed refs from the remote repository]' \
'--tags[all tags under refs/tags are pushed]' \
+ '--follow-tags[also push missing annotated tags reachable from the pushed refs]' \
'(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[path to git-receive-pack on remote]:remote git-receive-pack:_files' \
'(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]' \
'(:)--repo=[default repository to use]:repository:__git_any_repositories' \
- '(-u --set-upstream)'{-u,--set-upstream}'[add upstream reference for each branch that is up to date or pushed]' \
+ '(-u --set-upstream-to)'{-u,--set-upstream-to}'[add upstream reference for each branch that is up to date or pushed]' \
'( --no-thin)--thin[try to minimize number of objects to be sent]' \
'(--thin )--no-thin[do not try to minimize number of objects to be sent]' \
'(-q --quiet -v --verbose --progress)'{-q,--quiet}'[suppress all output]' \
'(-q --quiet -v --verbose)'{-v,--verbose}'[output additional information]' \
'(-q --quiet)--progress[output progress information]' \
+ '(--verify)--no-verify[bybass the pre-push hook]' \
+ '--recurse-submodules=[submodule handling]:submodule handling:((check\:"refuse pushing of supermodule if submodule commit cannot be found on the remote"
+ on-demand\:"push all changed submodules"))' \
':: :__git_any_repositories' \
'*: :__git_ref_specs'
}
@@ -1182,7 +1272,7 @@ _git-push () {
_git-rebase () {
local -a autosquash_opts
- if (( words[(I)--interactive] )); then
+ if (( words[(I)-i|--interactive] )); then
autosquash_opts=(
'( --no-autosquash)--autosquash[check for auto-squash boundaries]'
'(--autosquash )--no-autosquash[do not check for auto-squash boundaries]')
@@ -1191,6 +1281,7 @@ _git-rebase () {
_arguments -A '-*' \
'(- :)--continue[continue after resolving merge conflict]' \
'(- :)--abort[abort current rebase]' \
+ '--keep-empty[keep empty commits in the result]' \
'(- :)--skip[skip the current patch]' \
'(-m --merge)'{-m,--merge}'[use merging strategies to rebase]' \
'*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \
@@ -1204,7 +1295,9 @@ _git-rebase () {
'(-i --interactive)--whitespace=-[detect a new or modified line that has whitespace errors]: :__git_apply_whitespace_strategies' \
'(-i --interactive)--committer-date-is-author-date[use author date as committer date]' \
'(-i --interactive --ignore-whitespace --whitespace --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \
+ '--edit-todo[edit interactive instruction sheet in an editor]' \
'(-p --preserve-merges --interactive)'{-p,--preserve-merges}'[try to recreate merges instead of ignoring them]' \
+ {-x,--exec}'[with -i\: append "exec <cmd>" after each line]:command' \
'(1)--root[rebase all reachable commits]' \
$autosquash_opts \
'--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \
@@ -1246,9 +1339,12 @@ _git-reset () {
(( $+functions[_git-revert] )) ||
_git-revert () {
_arguments -w -S -s \
+ '(- :)--quit[end revert or cherry-pick sequence]' \
+ '(- :)--continue[resume revert or cherry-pick sequence]' \
+ '(- :)--abort[cancel revert or cherry-pick sequence]' \
'(-e --edit --no-edit)'{-e,--edit}'[edit the commit before committing the revert]' \
+ '(-e --edit --no-edit)--no-edit[do not edit the commit message before committing the revert]' \
'(-m --mainline)'{-m+,--mainline=}'[pick which parent is mainline]:parent number' \
- '(-e --edit)--no-edit[do not edit the commit message]' \
'(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]' \
'(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
': :__git_commits'
@@ -1270,11 +1366,7 @@ _git-rm () {
case $state in
(file)
- if [[ -n ${opt_args[(I)--cached]} ]]; then
- __git_changed-in-index_files && ret=0
- else
- __git_cached_files && ret=0
- fi
+ __git_cached_files && ret=0
;;
esac
@@ -1298,7 +1390,8 @@ _git-shortlog () {
'(-e --email)'{-e,--email}'[show email addres of each author]' \
'-w-[linewrap the output]:: :->wrap' \
$revision_options \
- '*: :__git_commits' && ret=0
+ '(-)--[start file arguments]' \
+ '*:: :->commit-range-or-file' && ret=0
case $state in
(wrap)
@@ -1314,6 +1407,30 @@ _git-shortlog () {
__git_guard_number 'line width'
fi
;;
+ (commit-range-or-file)
+ case $CURRENT in
+ (1)
+ if [[ -n ${opt_args[(I)--]} ]]; then
+ __git_cached_files && ret=0
+ else
+ _alternative \
+ 'commit-ranges::__git_commit_ranges' \
+ 'cached-files::__git_cached_files' && ret=0
+ fi
+ ;;
+ (*)
+ # TODO: Write a wrapper function that checks whether we have a
+ # committish range or comittish and calls __git_tree_files
+ # appropriately.
+ if __git_is_committish_range $line[1]; then
+ __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0
+ elif __git_is_committish $line[1]; then
+ __git_tree_files ${PREFIX:-.} $line[1] && ret=0
+ else
+ __git_cached_files && ret=0
+ fi
+ ;;
+ esac
esac
return ret
@@ -1324,9 +1441,10 @@ _git-show () {
local curcontext=$curcontext state line ret=1
typeset -A opt_args
- local -a log_options revision_options
+ local -a log_options revision_options diff_options
__git_setup_log_options
__git_setup_revision_options
+ __git_setup_diff_options
_arguments -w -C -s \
$log_options \
@@ -1382,6 +1500,7 @@ _git-stash () {
'( --no-keep-index)--keep-index[all changes already added to the index are left intact]' \
'(--keep-index )--no-keep-index[all changes already added to the index are undone]' \
'(-q --quiet)'{-q,--quiet}'[suppress all output]' \
+ '(-u --include-untracked)'{-u,--include-untracked}'[include untracked files]' \
'::message' && ret=0
;;
(list)
@@ -1449,7 +1568,10 @@ _git-status () {
normal\:"show untracked files and directories" \
all\:"also show untracked files in untracked directories (default)"))' \
'--ignore-submodules[ignore changes to submodules]:: :__git_ignore_submodules_whens' \
+ '--ignored[show ignored files as well]' \
'(--porcelain)-z[use NUL termination on output]' \
+ '(--no-column)--column=-[display in columns]::column.status option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \
+ '(--column)--no-column[do not display in columns]' \
'*: :__git_ignore_line_inside_arguments _files'
}
@@ -1458,7 +1580,7 @@ _git-submodule () {
local curcontext=$curcontext state line ret=1
declare -A opt_args
- _arguments -C -A '-*' \
+ _arguments -C \
'(-q --quiet)'{-q,--quiet}'[suppress all output]' \
': :->command' \
'*:: :->option-or-argument' && ret=0
@@ -1471,6 +1593,7 @@ _git-submodule () {
add:'add given repository as a submodule'
status:'show the status of a submodule'
init:'initialize a submodule'
+ deinit:'unregister a submodule'
update:'update a submodule'
summary:'show commit summary between given commit and working tree/index'
foreach:'evaluate shell command in each checked-out submodule'
@@ -1489,6 +1612,7 @@ _git-submodule () {
'(-q --quiet)'{-q,--quiet}'[suppress all output]' \
'(-b --branch)'{-b,--branch}'[branch of repository to add as submodule]' \
'(-f --force)'{-f,--force}'[allow adding an otherwise ignored submodule path]' \
+ '--name[use given name instead of defaulting to its path]:name' \
'--reference=[remote repository to clone]: :__git_any_repositories' \
': :__git_any_repositories' \
':: :_directories' && ret=0
@@ -1505,6 +1629,11 @@ _git-submodule () {
'(-q --quiet)'{-q,--quiet}'[suppress all output]' \
'*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0
;;
+ (deinit)
+ _arguments -S \
+ '(-f --force)'{-f,--force}'[remove submodule worktree even if local modifications are present]' \
+ '*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0
+ ;;
(update)
# TODO: --init not properly documented.
_arguments -S \
@@ -1514,6 +1643,7 @@ _git-submodule () {
'--rebase[rebase current branch onto commit recorded in superproject]' \
'--reference=[remote repository to clone]: :__git_any_repositories' \
'--recursive[traverse submodules recursively]' \
+ '--force[discard local changes by checking out the current up-to-date version]' \
'--init[initialize uninitialized submodules]' \
'*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0
;;
@@ -1547,6 +1677,7 @@ _git-submodule () {
;;
(sync)
_arguments -S \
+ '--recursive[traverse submodules recursively]' \
'(-q --quiet)'{-q,--quiet}'[suppress all output]' \
'*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0
;;
@@ -1572,10 +1703,11 @@ _git-tag () {
_arguments -A '-*' \
- creation \
- '( -s -u)-a[create an unsigned, annotated tag]' \
- '(-a -u)-s[create an signed and annotated tag]' \
- '(-a -s )-u[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \
+ '( -s -u --local-user)-a[create an unsigned, annotated tag]' \
+ '(-a -u --local-user)-s[create an signed and annotated tag]' \
+ '(-a -s)'{-u,--local-user}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \
'-f[replace existing tag]' \
+ '--cleanup=[cleanup message]:mode:((verbatim\:"no cleanup" whitespace\:"remove leading and trailing whitespace" strip\:"remove leading and trailing whitespace and comments"))' \
$message_opts \
': :__git_tags' \
':: :__git_commits' \
@@ -1585,7 +1717,10 @@ _git-tag () {
- listing \
'-n+[limit line output of annotation]: :__git_guard_number "limit"' \
'-l[list tags matching pattern]' \
+ '(--no-column)--column=-[display tag listing in columns]::column.tag option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \
+ '(--column)--no-column[do not display in columns]' \
'--contains=[only list tags which contain the specified commit]: :__git_commits' \
+ '--points-at=[only list tags of the given object]: :__git_commits' \
'::pattern' \
- verification \
'-v[verifies gpg signutare of tags]' \
@@ -1630,7 +1765,6 @@ _git-config () {
value_arg=': :->value'
fi
- # TODO --local is undocumented.
_arguments -w -C -S -s \
'( --system --local -f --file)--global[use user-global config file]' \
'(--global --local -f --file)--system[use system-wide config file]' \
@@ -1657,26 +1791,47 @@ _git-config () {
'(2)--get-regexp[like "--get-all", but interpret "name" as a regular expression]' \
'(2 3 --bool --int --bool-or-int --path -z --null)--get-colorbool[check if color should be used]: :->gettable-colorbool-option' \
'(2 3 --bool --int --bool-or-int --path -z --null)--get-color[find color setting]: :->gettable-color-option' \
- '(-e --edit --bool --int --bool-or-int --path -z --null)'{-e,--edit}'[open config file for editing]' && ret=0
+ '(-e --edit --bool --int --bool-or-int --path -z --null)'{-e,--edit}'[open config file for editing]' \
+ '(--no-includes)'--includes'[respect "include.*" directives in config files when looking up values]' \
+ '(--includes)'--no-includes'[do not respect "include.*" directives]' && ret=0
# TODO: Most all _path_commands should be able to take arguments and so on.
# How do we deal with that and how do we quote the whole argument to git
# config?
- # TODO: Add merge.*.(name|driver|recursive) and diff.*.(command|funcname)
+ # TODO: Add support for merge.*. (merge driver), diff.*. (diff driver), and filter.*. (filter driver) options
# (see gitattributes(5)).
# TODO: .path options should take absolute paths.
declare -a git_options_static
git_options_static=(
advice.pushNonFastForward:'show advice when git push refuses non-fast-forward refs::->bool:true'
+ advice.pushUpdateRejected:'combined setting for advice.push*::->bool:true'
+ advice.pushNonFFCurrent:'show advice when git push fails due to a non-fast-forward update to the current branch::->bool:true'
+ advice.pushNonFFDefault:'show advice to set push.default to "upstream" or "current" after running git-push::->bool:true'
+ advice.pushNonFFMatching:'show advice when running git-push and pushed matching refs explicitly::->bool:true'
+ advice.pushAlreadyExists:'show advice when git-push rejects an update that does not qualify for fast-forwarding::->bool:true'
+ advice.pushFetchFirst:'show advice when git-push rejects an update that tries to overwrite a remote ref that points at unknown object::->bool:true'
+ advice.pushNeedsForce:'show advice when git-push rejects an update that tries to overwrite a remote ref that points a non-commitish::->bool:true'
advice.statusHints:'show advice in output of git status::->bool:true'
+ advice.statusUoption:'show advice to consider using the "-u" option to git-status when it takes more than 2 seconds::->bool:true'
advice.commitBeforeMerge:'show advice when git merge refuses to merge::->bool:true'
advice.resolveConflict:'show advice when conflict prevents operation from being performed::->bool:true'
advice.implicitIdentity:'show advice when identity is guessed from system settings::->bool:true'
advice.detachedHead:'show advice when entering detached-HEAD state::->bool:true'
+ advice.amWorkDir:'show the location of the patch file when git-am fails to apply it::->bool:true'
blame.blankboundary:'show blank SHA-1 for boundary commits::->bool:false'
blame.showroot:'show root commits as normal commits::->bool:false'
blame.date:'date format to use in output::__git_date_formats:iso'
+ 'branch.*.description:branch description:branch description:->string'
+ cvsexportcommit.cvsdir:'the default location of the CVS checkout to use for the export:cvs export dir:_directories'
+ column.ui:'specify whether supported commands should output in columns.::->column:never'
+ column.branch:'specify whether to output branch listing in git branch in columns::->column:never'
+ column.clean:'specify the layout when listing items in git clean -i::->column:never'
+ column.status:'specify whether to output untracked files in git status in columns::->column:never'
+ column.tag:'specify whether to output tag listing in git tag in columns::->column:never'
core.fileMode:'track changes to the executable bit of files::->bool:true'
+ core.attributesfile:'look into this file for attributes in addition to .gitattributes:additional attributes file:_files'
+ core.abbrev:'set the length object names are abbreviated to:length:->int:7'
+ core.commentchar:'comment character when using an editor::->string'
core.ignoreCygwinFSTricks:'use Cygwin stat()/lstat()::->bool:true'
core.ignorecase:'use workarounds for non-case-sensitive filesystems::->bool:false'
core.trustctime:'trust inode change time::->bool:true'
@@ -1698,6 +1853,7 @@ _git-config () {
core.loosecompression:'level of compression to apply to non-pack files::->compression:1'
core.packedGitWindowSize:'size of mappings of pack files:pack window size:->bytes'
core.packedGitLimit:'maximum number of bytes to map from pack files:maximum pack file map size:->bytes'
+ core.precomposeunicode:'revert the unicode decomposition of filenames done by Mac OS::->bool:false'
core.deltaBaseCacheLimit:'maximum size of cache for base objects:maximum base objects cache size:->bytes:16m'
core.bigFileThreshold:'maximum size of files to compress:maximum compress size:->bytes:512m'
core.excludesfile:'additional file to use for exclusion:excludes file:_files'
@@ -1708,9 +1864,17 @@ _git-config () {
core.fsyncobjectfiles:'fsync() when writing object files::->bool:false'
core.preloadindex:'use parallel index preload for operations like git diff::->bool:false'
core.createObject:'take steps to prevent overwriting existing objects::->core.createObject:link'
+ core.checkstat:'determine which stat fields to match between the index and work tree::->core.checkstat:default'
core.notesRef:'show notes in given refs:refs:->string:refs/notes/commits'
core.sparseCheckout:'use sparse checkout::->bool:false'
+ credential.helper:'external helper to be called when a username or password credential is needed::_path_commands'
+ credential.useHttpPath:'consider the "path" component of an http or https URL to be important::->bool:false'
+ credential.username:'If no username is set use this username by default:default username:->string'
+ 'credential.*.helper:external helper to be called when a username or password credential is needed::_path_commands'
+ 'credential.*.useHttpPath:consider the "path" component of an http or https URL to be important::->bool:false'
+ 'credential.*.username:if no username is set use this username by default:default username:->string'
add.ignore-errors:'ignore indexing errors when adding files::->bool:false'
+ add.ignoreErrors:'ignore indexing errors when adding files::->bool:false'
am.keepcr:'keep CR characters when splitting mails::->bool:false'
apply.ignorewhitespace:'ignore whitespace changes::->apply.ignorewhitespace:no'
apply.whitespace:'default value for the --whitespace option::->apply.whitespace:error'
@@ -1719,6 +1883,7 @@ _git-config () {
'branch.*.remote:what remote git fetch and git push should fetch form/push to::__git_remotes'
'branch.*.merge:default refspec to be marked for merging::__git_ref_specs'
'branch.*.mergeoptions:default options for merging::->branch.mergeoptions'
+ 'branch.*.pushremote:what remote git push should push to::__git_remotes'
'branch.*.rebase:rebase on top of fetched branch::->bool:false'
'browser.*.cmd:browser command to use:browser:_path_commands'
'browser.*.path:path to use for the browser:absolute browser path:_files -g "*(*)"'
@@ -1727,6 +1892,7 @@ _git-config () {
color.branch.current:'color of the current branch::->color'
color.branch.local:'color of a local branch::->color'
color.branch.remote:'color of a remote branch::->color'
+ color.branch.upstream:'color of upstream branches::->color'
color.branch.plain:'color of other branches::->color'
color.diff:'color output of git diff::->color-bool'
color.diff.plain:'color of context text::->color'
@@ -1758,6 +1924,7 @@ _git-config () {
color.pager:'feed colored output to pager::->bool:true'
color.showbranch:'color output of git show-branch::->color-bool'
color.status:'color output of git status::->color-bool'
+ color.status.branch:'color of the current branch::->color'
color.status.header:'color of header text::->color'
color.status.added:'color of added, but not yet committed, files::->color'
color.status.updated:'color of updated, but not yet committed, files::->color'
@@ -1765,24 +1932,41 @@ _git-config () {
color.status.untracked:'color of files not currently being tracked::->color'
color.status.nobranch:'color of no-branch warning::->color'
color.ui:'color output of capable git commands::->color-bool'
+ commit.cleanup:'default --cleanup option::->commit.cleanup:default'
commit.status:'include status information in commit message template::->bool:true'
commit.template:'template file for commit messages:template:_files'
+ 'diff.*.binary:make the diff driver treat files as binary::->bool:false'
+ 'diff.*.cachetextconv:make the diff driver cache the text conversion outputs::->bool:false'
+ 'diff.*.command:custom diff driver command::_path_commands'
+ 'diff.*.textconv:command to generate the text-converted version of a file::_path_commands'
+ 'diff.*.wordregex:regular expression that the diff driver should use to split words in a line:regular expression:->string'
+ 'diff.*.xfuncname:regular expression that the diff driver should use to recognize the hunk header:regular expression:->string'
+ diff.algorithm:'default diff algorithm::->diff.algorithm:default'
diff.autorefreshindex:'run git update-index --refresh before git diff::->bool:true'
+ diff.context:'default number of context lines::->int:3'
+ diff.dirstat:'comma separated list of --dirstat parameters specifying default behaviour:comma-separated list:->string:changes,noncumulative,3'
diff.external:'command to generate diff with:diff command:_path_commands'
diff.mnemonicprefix:'use mnemonic source and destination prefixes::->bool:false'
diff.noprefix:'strip source and destination prefixes::->bool:false'
diff.renameLimit:'number of files to consider when detecting copy/renames:rename limit:->int'
diff.renames:'try to detect renames::->diff.renames:true'
diff.ignoreSubmodules:'ignore submodules::->bool:false'
- diff.suppressBlankEmpty:'inbihit printing space before empty output lines::->bool:false'
+ diff.statGraphWidth:'width of the graph part in --stat output:width:->int'
+ diff.submodule:'output format for submodule differences::->diff.submodule:short'
+ diff.suppressBlankEmpty:'inhibit printing space before empty output lines::->bool:false'
diff.tool:'diff tool to use::__git_difftools'
'difftool.*.cmd:command to invoke for the diff tool::_path_commands'
'difftool.*.path:path to use for the diff tool:absolute diff tool path:_files -g "*(*)"'
difftool.prompt:'prompt before each invocation of the diff tool::->bool:true'
- diff.wordRegex:'regex used to determine what a word is when performing word-by-word diff:regex:->string'
+ diff.wordRegex:'regex used to determine what a word is when performing word-by-word diff:regular expression:->string'
diff.guitool:'diff tool with gui to use::__git_difftools'
fetch.unpackLimit:'maximum number of objects to unpack when fetching:unpack limit:->int'
+ fetch.recurseSubmodules:'recurse into submodules (as needed) when fetching::->fetch.recurseSubmodules:on-demand'
+ fetch.fsckObjects:'check all fetched objects::->bool:false'
+ 'filter.*.clean:command which is used to convert the content of a worktree file to a blob upon checkin::_path_commands'
+ 'filter.*.smudge:command which is used to convert the content of a blob object to a worktree file upon checkout::_path_commands'
format.attach:'use multipart/mixed attachments::->bool:false'
+ format.coverLetter:'control whether to generate a cover-letter when format-patch is invoked::->bool:false'
format.numbered:'use sequence numbers in patch subjects::->format.numbered:auto'
format.headers:'additional email headers to include in email patches:headers:->string'
format.to:'additional email recipients of patches::->string'
@@ -1795,7 +1979,7 @@ _git-config () {
format.signoff:'enable --signoff by default::->bool:false'
'gc.*.reflogexpire:grace period for git reflog expire::->days:90'
'gc.*.reflogexpireunreachable:grace period for git reflog expire for unreachable entries::->days:30'
- gc.aggressiveWindow:'window size used in delta compression algorithm:->int:250'
+ gc.aggressiveWindow:'window size used in delta compression algorithm::->int:250'
gc.auto:'minimum limit for packing loose objects with --auto::->int:6700'
gc.autopacklimit:'minimum limit for packing packs with --auto::->int:50'
gc.packrefs:'allow git gc to run git pack-refs::->gc.packrefs:true'
@@ -1822,8 +2006,9 @@ _git-config () {
'gitcvs.*.dbTableNamePrefix:database table name prefix:prefix:->string'
gitcvs.usecrlfattr:'use end-of-line conversion attributes::->bool:false'
gitcvs.allbinary:'treat all files from CVS as binary::->bool:false'
- gui.commitmsgwidth:'width of commit message window:width:->int:75'
- gui.diffcontext:'number of context lines used in diff window:context:->int:5'
+ gpg.program:'use program instead of "gpg" found on $PATH when making or verifying a PGP signature::_path_commands'
+ gui.commitmsgwidth:'width of commit message window:width::->int:75'
+ gui.diffcontext:'number of context lines used in diff window:context::->int:5'
gui.encoding:'encoding to use for displaying file contents::->encoding'
gui.matchtrackingbranch:'create branches that track remote branches::->bool:false'
gui.newbranchtemplate:'suggested name for new branches:template:->string'
@@ -1833,6 +2018,16 @@ _git-config () {
gui.fastcopyblame:'try harder during blame detection::->bool:false'
gui.copyblamethreshold:'threshold to use in blame location detection:threshold:->string'
gui.blamehistoryctx:'specify radius of history context in days for selected commit::->days'
+ 'guitool.*.argprompt:prompt for arguments:argument prompt:->string'
+ 'guitool.*.cmd:shell command line to execute::_path_commands'
+ 'guitool.*.confirm:show a confirmation dialog::->bool:false'
+ 'guitool.*.needsfile:require that a diff is selected for command to be available::->bool:false'
+ 'guitool.*.noconsole:suppress command output::->bool:false'
+ 'guitool.*.norescan:skip rescanning for changes to the working directory::->bool:false'
+ 'guitool.*.revprompt:request a single valid revision from the user, and set the "REVISION" environment variable::->string'
+ 'guitool.*.prompt:prompt to display:prompt:->string'
+ 'guitool.*.revunmerged:show only unmerged branches in revprompt::->bool:false'
+ 'guitool.*.title:title of prompt dialog:prompt title:->string'
guitool.cmd:'shell command line to execute::_path_commands'
guitool.needsfile:'require that a diff is selected for command to be available::->bool:false'
guitool.noconsole:'suppress command output::->bool:false'
@@ -1843,7 +2038,14 @@ _git-config () {
guitool.revunmerged:'show only unmerged branches in revprompt::->bool:false'
guitool.title:'title of prompt dialog:prompt title:->string'
guitool.prompt:'prompt to display:prompt:->string'
+ grep.extendedRegexp:'enable --extended-regexp option by default (ignored when grep.patternType is set)::->bool:false'
+ grep.lineNumber:'enable -n option by default::->bool:false'
+ grep.patternType:'default matching pattern type::->grep.patternType:default'
help.browser:'browser used to display help in web format::__git_browsers'
+ http.cookiefile:'file containing cookie lines which should be used in the Git http session::_files'
+ help.htmlpath:'location of HTML help::->help.htmlpath'
+ http.lowSpeedLimit:'limit controlling when to abort an HTTP transfer:speed limit:->int'
+ http.lowSpeedTime:'limit controlling when to abort an HTTP transfer:time limit (seconds):->int'
help.format:'default help format used by git help::->help.format'
help.autocorrect:'execute corrected mistyped commands::->bool:false'
http.proxy:'HTTP proxy to use:proxy:_urls'
@@ -1853,8 +2055,9 @@ _git-config () {
http.sslCertPasswordProtected:'prompt for a password for the SSL certificate::->bool:false'
http.sslCAInfo:'file containing CA certificates to verify against for HTTPS:CA certificates file:_files'
http.sslCAPath:'directory containing files with CA certificates to verify against for HTTPS:CA certificates directory:_directories'
- http.maxRequests:'how many HTTP requests to launch in parallel:maximum number of requests:->int:5'
- http.minSessions:'number of curl sessions to keep across requests:mininmum number of sessions:->int:1'
+ http.sslTry:'attempt to use AUTH SSL/TLS and encrypted data transfers when connecting via regular FTP protocol::->bool:false'
+ http.maxRequests:'how many HTTP requests to launch in parallel:maximum number of requests::->int:5'
+ http.minSessions:'number of curl sessions to keep across requests:minimum number of sessions::->int:1'
http.postBuffer:'maximum size of buffer used by smart HTTP transport when POSTing:maximum POST buffer size:->bytes:1m'
http.lowSpeedLimit:'lower limit for HTTP transfer-speed:low transfer-speed limit:->int'
http.lowSpeedTime:'duration for http.lowSpeedLimit:time:->int'
@@ -1882,16 +2085,22 @@ _git-config () {
instaweb.modulepath:'module path for the Apache HTTP-daemon for instaweb:module directory:_directories'
instaweb.port:'port to bind HTTP daemon to for instaweb::_ports'
interactive.singlekey:'accept one-letter input without Enter::->bool:false'
+ log.abbrevCommit:'make git-log, git-show, and git-whatchanged assume --abbrev-commit::->bool:false'
log.date:'default date-time mode::__git_date_formats'
log.decorate:'type of ref names to show::__git_log_decorate_formats'
+ log.mailmap:'make git-log, git-show, and git-whatchanged assume --use-mailmap:->bool:false'
log.showroot:'show initial commit as a diff against an empty tree::->bool:true'
mailinfo.scissors:'remove everything in body before a scissors line::->bool:false'
+ mailmap.blob:'like mailmap.file, but consider the value as a reference to a blob in the repository:blob reference:->string'
mailmap.file:'augmenting mailmap file:mailmap file:_files'
man.viewer:'man viewer to use for help in man format::__git_man_viewers'
'man.*.cmd:the command to invoke the specified man viewer:man command:_path_commands'
'man.*.path:path to use for the man viewer:absolute man tool path:_files -g "*(*)"'
+ merge.branchdesc:'populate the log message with the branch description text as well::->bool:false'
merge.conflictstyle:'style used for conflicted hunks::->merge.conflictstyle:merge'
- merge.log:'include summaries of merged commits in new merge commit messsages::->bool:false'
+ merge.defaultToUpstream:'merge the upstream branches configured for the current branch by default::->bool:false'
+ merge.ff:'allow fast-forward merges::->merge.ff:true'
+ merge.log:'include summaries of merged commits in new merge commit messages::->bool:false'
merge.renameLimit:'number of files to consider when detecting copy/renames during merge:limit:->int'
merge.renormalize:'use canonical representation of files during merge::->bool:false'
merge.stat:'print the diffstat between ORIG_HEAD and merge at end of merge::->bool:true'
@@ -1911,28 +2120,31 @@ _git-config () {
notes.rewrite.rebase:'copy notes from original to rewritten commit when running git rebase::->bool:true'
notes.rewriteMode:'what to do when target commit already has a not when rewriting::->notes.rewriteMode'
notes.rewriteRef:'refname to use when rewriting::->refname'
- pack.window:'size of window:window size:->int:10'
- pack.depth:'maximum delta depth:maximum delta depth:->int:50'
+ pack.window:'size of window:window size::->int:10'
+ pack.depth:'maximum delta depth:maximum delta depth::->int:50'
pack.windowMemory:'window size limit:maximum window size:->bytes:0'
pack.compression:'compression level::->compression:-1'
pack.deltaCacheSize:'maximum amount of memory for caching deltas:maximum delta cache size:->bytes:256m'
- pack.deltaCacheLimit:'maximum size of deltas:maximum delta size:->int:1000'
+ pack.deltaCacheLimit:'maximum size of deltas:maximum delta size::->int:1000'
pack.threads:'number of threads to use for searching for best delta matches:number of threads:->int'
pack.indexVersion:'default pack index version:index version:->string'
pack.packSizeLimit:'maximum size of packs:maximum size of packs:->bytes'
pull.octopus:'default merge strategy to use when pulling multiple branches::__git_merge_strategies'
+ pull.rebase:'rebase branches on top of the fetched branch, instead of merging::->bool:false'
pull.twohead:'default merge strategy to use when pulling a single branch::__git_merge_strategies'
- push.default:'action git push should take if no refspec is given::->push.default'
+ push.default:'action git push should take if no refspec is given::->push.default:matching'
rebase.stat:'show a diffstat of what changed upstream since last rebase::->bool:false'
rebase.autosquash:'autosquash by default::->bool:false'
receive.autogc:'run git gc --auto after receiving data::->bool:true'
receive.fsckObjects:'check all received objects::->bool:true'
+ receive.hiderefs:'string(s) receive-pack uses to decide which refs to omit from its initial advertisement:hidden refs:->string'
receive.unpackLimit:'maximum number of objects received for unpacking into loose objects:unpack limit:->int'
receive.denyDeletes:'deny a ref update that deletes a ref::->bool:false'
receive.denyDeleteCurrent:'deny a ref update that deletes currently checked out branch::->bool:false'
receive.denyCurrentBranch:'deny a ref update of currently checked out branch::->receive.denyCurrentBranch'
receive.denyNonFastForwards:'deny a ref update that is not a fast-forward::->bool:false'
receive.updateserverinfo:'run git update-server-info after receiving data::->bool:false'
+ 'remote.pushdefault:URL of a remote repository to pushto::__git_any_repositories'
'remote.*.url:URL of a remote repository::__git_any_repositories'
'remote.*.pushurl:push URL of a remote repository::__git_any_repositories'
'remote.*.proxy:URL of proxy to use for a remote repository::_urls'
@@ -1948,17 +2160,20 @@ _git-config () {
repack.usedeltabaseoffset:'use delta-base offsets::->bool:true'
rerere.autoupdate:'update index after resolution::->bool:false'
rerere.enabled:'record resolved conflicts::->bool'
+ sendemail.identity:'default identity::__git_sendemail_identities'
sendemail.smtpencryption:'encryption method to use::->sendemail.smtpencryption'
sendemail.aliasesfile:'file containing email aliases:email aliases file:_files'
sendemail.aliasfiletype:'format of aliasesfile::->sendemail.aliasfiletype'
+ sendemail.annotate:'review and edit each patch you are about to send::->bool:false'
sendemail.bcc:'value of Bcc\: header::_email_addresses'
sendemail.cc:'value of Cc\: header::_email_addresses'
sendemail.cccmd:'command to generate Cc\: header with:Cc\: command:_path_commands'
+ sendemail.toccmd:'command to generate To\: header with:To\: command:_path_commands'
sendemail.chainreplyto:'send each email as a reply to the previous one::->bool:false'
sendemail.confirm:'type of confirmation required before sending::->sendemail.confirm:auto'
sendemail.envelopesender:'envelope sender to send emails as::_email_addresses'
sendemail.from:'sender email address::_email_addresses'
- sendemail.multiedit:'edit all files at once::->bool:false'
+ sendemail.multiedit:'edit all files at once::->bool:true'
sendemail.signedoffbycc:'add Signed-off-by\: or Cc\: lines to Cc\: header::->bool:true'
sendemail.smtppass:'password to use for SMTP-AUTH:password:->string'
sendemail.suppresscc:'rules for suppressing Cc\:::->sendemail.suppresscc'
@@ -1966,15 +2181,18 @@ _git-config () {
sendemail.to:'value of To\: header::_email_addresses'
sendemail.smtpdomain:'FQDN to use for HELO/EHLO commands to SMTP server:smtp domain:_domains'
sendemail.smtpserver:'SMTP server to connect to:smtp host:_hosts'
+ sendemail.smtpserveroption:'specifies the outgoing SMTP server option to use:SMTP server option:->string'
sendemail.smtpserverport:'port to connect to SMTP server on:smtp port:_ports'
sendemail.smtpuser:'user to use for SMTP-AUTH:smtp user:_users'
sendemail.thread:'set In-Reply-To\: and References\: headers::->bool:true'
sendemail.validate:'perform sanity checks on patches::->bool:true'
'sendemail.*.aliasesfile:file containing email aliases::_files'
'sendemail.*.aliasfiletype:format of aliasesfile::->sendemail.aliasfiletype'
+ 'sendemail.*.annotate:review and edit each patch you are about to send::bool->false'
'sendemail.*.bcc:value of Bcc\: header::_email_addresses'
'sendemail.*.cc:value of Cc\: header::_email_addresses'
'sendemail.*.cccmd:command to generate Cc\: header with:Cc\: command:_path_commands'
+ 'sendemail.*.tocmd:command to generate To\: header with:To\: command:_path_commands'
'sendemail.*.chainreplyto:send each email as a reply to the previous one::->bool:false'
'sendemail.*.confirm:type of confirmation required before sending::->sendemail.confirm:auto'
'sendemail.*.envelopesender:envelope sender to send emails as::_email_addresses'
@@ -1987,15 +2205,21 @@ _git-config () {
'sendemail.*.to:value of To\: header::_email_addresses'
'sendemail.*.smtpdomain:FQDN to use for HELO/EHLO commands to SMTP server:smtp domain:_domains'
'sendemail.*.smtpserver:SMTP server to connect to:smtp host:_hosts'
+ 'sendemail.*.smtpserveroption:specifies the outgoing SMTP server option to use:SMTP server option:->string'
'sendemail.*.smtpserverport:port to connect to SMTP server on:smtp port:_ports'
'sendemail.*.smtpuser:user to use for SMTP-AUTH:smtp user:_users'
'sendemail.*.thread:set In-Reply-To\: and References\: headers::->bool:true'
'sendemail.*.validate:perform sanity checks on patches::->bool:true'
sendemail.assume8bitEncoding:'encoding to use for non-ASCII messages::__git_encodings'
+ sequence.editor:'text editor used by git rebase -i::_path_commands'
showbranch.default:'default set of branches for git show-branch::->branch'
status.relativePaths:'show paths relative to current directory::->bool:false'
status.showUntrackedFiles:'show untracked files::->status.showUntrackedFiles:normal'
status.submodulesummary:'include submodule summary::->bool:false'
+ status.branch:'show branch and tracking info in short format::->bool:false'
+ status.short:'use short format by default::->bool:false'
+ 'submodule.*.branch:remote branch name for a submodule:branch name:->string'
+ 'submodule.*.fetchRecurseSubmodules:fetch commits of submodules::->bool'
'submodule.*.path:path within project:submodule directory:_directories -qS \:'
'submodule.*.url:URL to update from::__git_any_repositories'
'submodule.*.update:update strategy to use::->submodule.update'
@@ -2009,6 +2233,7 @@ _git-config () {
svn.followparent:'follow parent commit::->bool:true'
svn.authorsFile:'default authors file:authors file:_files'
svn.quiet:'produce less output::->bool:false'
+ 'svn-remote.*.automkdirs:attempt to recreate empty directories that are in the Subversion repository::->bool:true'
'svn-remote.*.noMetadata:disable git-svn-id: lines at end of commits::->bool:false'
'svn-remote.*.useSvmProps:use remappings of URLs and UUIDs from mirrors::->bool:false'
'svn-remote.*.useSvnsyncProps:use remappings of URLs and UUIDs for the svnsync command::->bool:false'
@@ -2017,10 +2242,17 @@ _git-config () {
'svn-remote.*.ignore-paths:regular expression of paths to not check out:regular expression:->string'
'svn-remote.*.url:URL to connect to::_urls'
'svn-remote.*.fetch:fetch specification::__git_ref_specs'
+ 'svn-remote.*.pushurl:URL to push to::_urls'
'svn-remote.*.branches:branch mappings:branch mapping:->string'
'svn-remote.*.tags:tag mappings:tag mapping:->string'
+ 'tar.*.command:specify a shell command through which the tar output generated by git archive should be piped::_path_commands'
+ 'tar.*.remote:enable <format> for use by remote clients via git-upload-archive::->bool'
tar.umask:'umask to apply::->umask'
- transfer.unpackLimit:'default value for fetch.unpackLimit and receive.unpackLimit:unpack limit:->int:100'
+ transfer.unpackLimit:'default value for fetch.unpackLimit and receive.unpackLimit:unpack limit::->int:100'
+ transfer.fsckObjects:'check all objects::->bool:false'
+ transfer.hiderefs:'string(s) to decide which refs to omit from initial advertisements:hidden refs:->string'
+ uploadpack.hiderefs:'string(s) upload-pack uses to decide which refs to omit from its initial advertisement:hidden refs:->string'
+ uploadpack.allowtipsha1inwant:'allow upload-pack to accept a fetch request that asks for an object at the tip of a hidden ref::->bool:false'
'url.*.insteadOf:string to start URLs with:prefix:->string'
'url.*.pushInsteadOf:string to start URLs to push to with:prefix:->string'
user.email:'email address used for commits::_email_addresses'
@@ -2061,10 +2293,13 @@ _git-config () {
'color.grep.:git-grep-specific color option'
'color.interactive.:interaction-specific color option'
'color.status.:git-status-specific color option'
+ 'credential.*.:${${line[1]#credential.}%.*}-specific option'
+ 'filter.*.:${${line[1]#filter.}%.*} driver option'
+ 'diff.*.:${${line[1]#diff.}%.*} driver option'
'difftool.*.:${${line[1]#difftool.}%.*}-specific option'
'gc.*.:${${line[1]#gc.}%.*}-specific gc option'
'gitcvs.*.:gitcvs ${${line[1]#gitcvs.}%.*}-specific option'
- 'guitool.*.:${${line[1]#gc.}%.*}-specific option'
+ 'guitool.*.:${${line[1]#guitool.}%.*}-specific option'
'man.*.:${${line[1]#man.}%.*}-specific man option'
'merge.*.:${${line[1]#merge.}%.*}-specific merge option'
'mergetool.*.:${${line[1]#mergetool.}%.*}-specific option'
@@ -2110,6 +2345,9 @@ _git-config () {
(browser.)
__git_browsers -S . && ret=0
;;
+ (credential.)
+ _urls && ret=0
+ ;;
(difftool.)
__git_difftools -S . && ret=0
;;
@@ -2157,6 +2395,7 @@ _git-config () {
sections=(
advice:'options controlling advice'
core:'options controlling git core'
+ credential:'credential options'
add:'git add options'
alias:'command aliases'
am:'git am options'
@@ -2165,12 +2404,14 @@ _git-config () {
browser:'browser options'
clean:'git clean options'
color:'color options'
+ column:'column options'
commit:'git commit options'
diff:'diff options'
difftool:'difftools'
fetch:'git fetch options'
format:'format options'
gc:'git gc options'
+ gpg:'gpg options'
gitcvs:'git-cvs options'
gui:'git gui options'
guitool:'git gui tool options'
@@ -2204,6 +2445,7 @@ _git-config () {
submodule:'git submodule options'
tar:'git tar-tree options'
transfer:'options controlling transfers'
+ uploadpack:'git upload-pack options'
url:'URL prefixes'
user:'options controlling user identity'
web:'web options'
@@ -2330,6 +2572,22 @@ _git-config () {
always:"always $parts[2]" \
{auto,true,yes,on}:$parts[2] && ret=0
;;
+ (column)
+ __git_config_values -- "$current" "$parts[5]" \
+ always:'always show in columns' \
+ never:'never show in columns' \
+ auto:'show in columns if the output is to the terminal' \
+ column:'fill columns before rows (implies "always")' \
+ row:'fill rows before columns (implies "akways")' \
+ plain:'show in one column (implies "always")' && ret=0
+ ;;
+ (commit.cleanup)
+ __git_config_values -- "$current" "$parts[5]" \
+ strip:'remove both whitespace and commentary lines' \
+ whitespace:'remove leading and trailing whitespace lines' \
+ verbatim:'no not change the commit message at all' \
+ default:'act as '\''strip'\'' if the message is to be edited and as '\''whitespace'\'' otherwise' && ret=0
+ ;;
(compression)
__git_compression_levels && ret=0
;;
@@ -2337,6 +2595,11 @@ _git-config () {
__git_config_booleans "$current" "$parts[5]" "$parts[2]" \
input:'convert CRLFs on input only' && ret=0
;;
+ (core.checkstat)
+ __git_config_values -- "$current" "$parts[5]" \
+ default:'check all fields' \
+ minimal:'check fewer fields' && ret=0
+ ;;
(core.createObject)
__git_config_values -- "$current" "$parts[5]" \
rename:'rename source objects' \
@@ -2378,10 +2641,23 @@ _git-config () {
__git_guard_number 'number of days'
fi
;;
+ (diff.algorithm)
+ __git_config_values -- "$current" "$parts[5]" \
+ default:'basic greedy diff algorithm' \
+ myers:'basic greedy diff algorithm' \
+ minimal:'spend extra time to make sure the smallest possible diff is produced' \
+ patience:'generate diffs with patience algorithm' \
+ histogram:'generate diffs with histogram algorithm' && ret=0
+ ;;
(diff.renames)
__git_config_booleans "$current" "$parts[5]" "$parts[2]" \
{copies,copy}:'try to detect both renames and copies' && ret=0
;;
+ (diff.submodule)
+ __git_config_values -- "$current" "$parts[5]" \
+ short:'show pairs of commit name' \
+ log:'list commits like git submodule does' && ret=0
+ ;;
(encoding)
__git_encodings && ret=0
;;
@@ -2391,6 +2667,10 @@ _git-config () {
crlf:'use CR+LF' \
native:'use line ending of platform' && ret=0
;;
+ (fetch.recurseSubmodules)
+ __git_config_booleans "$current" "$parts[5]" "$parts[2]" \
+ on-demand:'only when submodule reference in superproject is updated' && ret=0
+ ;;
(format.numbered)
__git_config_booleans "$current" "$parts[5]" "$parts[2]" \
auto:'use sequence numbers if more than one patch' && ret=0
@@ -2411,12 +2691,25 @@ _git-config () {
SQLite:'use the SQLite database driver' \
Pg:'use the Pg database driver' && ret=0
;;
+ (grep.patternType)
+ __git_config_values -- "$current" "$parts[5]" \
+ basic:'use --basic-regexp' \
+ default:'use default' \
+ extended:'use --extended-regexp' \
+ fixed:'use --fixed-strings' \
+ perl:'use --perl-regexp' && ret=0
+ ;;
(help.format)
__git_config_values -- "$current" "$parts[5]" \
man:'use man' \
info:'use info' \
{web,html}:'use HTML' && ret=0
;;
+ (help.htmlpath)
+ _alternative \
+ 'path::_files -/' \
+ 'url::_urls' && ret=0
+ ;;
(imap.authMethod)
__git_config_values -- "$current" "$parts[5]" \
CRAM-MD5:'use CRAM-MD5' && ret=0
@@ -2435,11 +2728,15 @@ _git-config () {
merge:'use standard merge style' \
diff3:'use diff3 style' && ret=0
;;
+ (merge.ff)
+ __git_config_booleans "$current" "$parts[5]" "$parts[2]" \
+ only:'only allow fast-forward merges (equivalent to --ff-only)' && ret=0
+ ;;
(merge.verbosity)
__git_config_values -t verbosity-levels -l 'verbosity level' -- "$current" "$parts[5]" \
- 0:'only final error message if conflicts were detected'
- 1:'conflicts'
- 2:'conflicts and file changes'
+ 0:'only final error message if conflicts were detected' \
+ 1:'conflicts' \
+ 2:'conflicts and file changes' \
5:'debugging information' && ret=0
;;
(notes.rewriteMode)
@@ -2455,7 +2752,8 @@ _git-config () {
__git_config_values -- "$current" "$parts[5]" \
nothing:'do not push anything' \
matching:'push all matching branches' \
- tracking:'push current branch to its upstream branch' \
+ upstream:'push current branch to its upstream branch' \
+ simple:'like upstream, but only if local and remote names are the same' \
current:'push current branch to branch of same name' && ret=0
;;
(receive.denyCurrentBranch)
@@ -2513,7 +2811,7 @@ _git-config () {
(umask)
_alternative \
'values:value:(user)' \
- 'umasks::__git_guard_number umask' && ret=0
+ 'umasks: :__git_guard_number umask' && ret=0
;;
esac
;;
@@ -2548,7 +2846,9 @@ _git-fast-export () {
'-C-[detect copies as well as renames with given scope]: :__git_guard_number size' \
'--export-marks=[dump internal marks table when complete]: :_files' \
'--import-marks=[load marks before processing input]: :_files' \
+ '--import-marks-if-exists=[silently skip if files does not exist]: :_files' \
'--fake-missing-tagger=[fake a tagger when tags lack them]' \
+ '--use-done-feature[start with a "feature done" stanza, and terminate with a "done" command]' \
'--no-data[do not output blocb objects, instead referring to them via their SHA-1 hash]' \
'--full-tree[output full tree for each commit]' \
'*: :__git_commit_ranges'
@@ -2557,9 +2857,11 @@ _git-fast-export () {
(( $+functions[_git-fast-import] )) ||
_git-fast-import () {
_arguments -S -A '-*' \
+ '--cat-blob-fd=-[write responses to cat-blob and ls queries to <fd> instead of stdout]:file descriptor' \
'--date-format=-[type of dates used in input]:format:((raw\:"native Git format"
rfc2822\:"standard email format from RFC 2822"
now\:"use current time and timezone"' \
+ '--done[terminate with error if there is no "done" command at the end of the stream]' \
'--force[force updating modified existing branches]' \
'--max-pack-size=-[maximum size of each packfile]: :__git_guard_bytes' \
'--big-file-threshold=-[maximum size of blob to create deltas for]: :__git_guard_bytes' \
@@ -2601,6 +2903,7 @@ _git-mergetool () {
# TODO: Only complete files with merge conflicts.
_arguments -S -A '-*' \
'(-t --tool)'{-t,--tool=}'[merge resolution program to use]: :__git_mergetools' \
+ '--tool-help[print a list of merge tools that may be used with "--tool"]' \
'(-y --no-prompt --prompt)'{-y,--no-prompt}'[do not prompt before invocation of merge resolution program]' \
'(-y --no-prompt)--prompt[prompt before invocation of merge resolution program]' \
'*:conflicted file:_files'
@@ -2668,7 +2971,7 @@ _git-reflog () {
'--expire-unreachable=-[prune entries older than given time and unreachable]: :__git_datetimes' \
'--all[prune all refs]' \
'--updateref[update ref with SHA-1 of top reflog entry after expiring or deleting]' \
- '--rewrite[adjust reflog entries to ensure old SHA-1 points to new SHA-1 of previous entry after expring or deleting]' \
+ '--rewrite[adjust reflog entries to ensure old SHA-1 points to new SHA-1 of previous entry after expiring or deleting]' \
'--verbose[output additional information]' && ret=0
;;
(delete)
@@ -2676,7 +2979,7 @@ _git-reflog () {
_arguments -C -S \
'(-n --dry-run)'{-n,--dry-run}'[undocumented]' \
'--updateref[update ref with SHA-1 of top reflog entry after expiring or deleting]' \
- '--rewrite[adjust reflog entries to ensure old SHA-1 points to new SHA-1 of previous entry after expring or deleting]' \
+ '--rewrite[adjust reflog entries to ensure old SHA-1 points to new SHA-1 of previous entry after expiring or deleting]' \
'*:: :->reflog-entry' && ret=0
case $state in
@@ -2700,10 +3003,9 @@ _git-reflog () {
(( $+functions[_git-relink] )) ||
_git-relink () {
- # TODO: --help is undocumented.
_arguments \
'--safe[stop if two objects with the same hash exist but have different sizes]' \
- '--help[display help]' \
+ '(-)'{-h,--help}'[display usage information]' \
': :_directories' \
': :_directories' \
'*: :_directories'
@@ -2856,31 +3158,33 @@ _git-blame () {
'-l[show long rev]' \
'-t[show raw timestamp]' \
'-S[use revs from revs-file]:revs-file:_files' \
- '--reverse[walk histor forward instead of backward]' \
+ '--reverse[walk history forward instead of backward]' \
'(-p --porcelain)'{-p,--porcelain}'[show results designed for machine processing]' \
+ '--line-porcelain[show results designed for machine processing but show commit information for every line]' \
'--incremental[show results incrementally for machine processing]' \
'--contents[annotate against the given file if no rev is specified]: :_files' \
'(-h --help)'{-h,--help}'[show help message]' \
'-c[use same output format as git annotate]' \
'--score-debug[output debugging information relating to -C and -M line movement]' \
+ '(-e --show-email)'{-e,--show-email}'[show the author email instead of the author name]' \
'(-f --show-name)'{-f,--show-name}'[show the filename of the original commit]' \
'(-n --show-number)'{-n,--show-number}'[show the line number in the original commit]' \
'-s[suppress author name and timestamp]' \
'-w[ignore whitespace when finding lines]' \
$revision_options \
- ': :__git_cached_files' \
- ':: :__git_revisions' && ret=0
+ ':: :__git_revisions' \
+ ': :__git_cached_files' && ret=0
case $state in
(line-range)
if compset -P '([[:digit:]]#|/[^/]#(\\?[^/]#)#/),'; then
_alternative \
- 'line-numbers::__git_guard_number "line number"' \
+ 'line-numbers: :__git_guard_number "line number"' \
'regexes::_guard "(/[^/]#(\\?[^/]#)#(/|)|)" regex' \
'offsets::_guard "([+-][[:digit:]]#|)" "line offset"' && ret=0
else
_alternative \
- 'line-numbers::__git_guard_number "line number"' \
+ 'line-numbers: :__git_guard_number "line number"' \
'regexes::_guard "(/[^/]#(\\?[^/]#)#(/|)|)" regex' && ret=0
fi
;;
@@ -2903,17 +3207,22 @@ _git-cherry () {
(( $+functions[_git-count-objects] )) ||
_git-count-objects () {
_arguments \
- '(-v --verbose)'{-v,--verbose}'[also report number of in-pack objects and objects that can be removed]'
+ '(-v --verbose)'{-v,--verbose}'[also report number of in-pack objects and objects that can be removed]' \
+ {-H,--human-readable}'[Print sizes in human readable format]'
}
(( $+functions[_git-difftool] )) ||
_git-difftool () {
# TODO: Is this fine, or do we need to modify the context or similar?
_git-diff \
+ '--dir-diff[diff a whole tree by prepare a temporary copy]' \
'(-y --no-prompt --prompt)'{-y,--no-prompt}'[do not prompt before invocation of diff tool]' \
'(-y --no-prompt)--prompt[prompt before invocation of diff tool]' \
'(-t --tool -x --extcmd)'{-t,--tool=-}'[merge resolution program to use]: :__git_difftools' \
'(-t --tool -x --extcmd)'{-x,--extcmd=-}'[custom diff command to use]: :_path_commands' \
+ '--tool-help[print a list of diff tools that may be used with --tool]' \
+ '(--symlinks)--no-symlinks[make copies of instead of symlinks to the working tree]' \
+ '(---no-symlinks)--symlinks[make symlinks to instead of copies of the working tree]' \
'(-g --gui)'{-g,--gui}'[use diff.guitool instead of diff.tool]'
}
@@ -2922,6 +3231,8 @@ _git-fsck () {
# TODO: -v is undocumented.
_arguments -w -S -s \
'--unreachable[show objects that are unreferenced in the object database]' \
+ '(--dangling --no-dangling)--dangling[print dangling objects (default)]' \
+ '(--dangling --no-dangling)--no-dangling[do not print dangling objects]' \
'--root[show root nodes]' \
'--tags[show tags]' \
'--cache[consider objects recorded in the index as head nodes for reachability traces]' \
@@ -2941,10 +3252,11 @@ _git-get-tar-commit-id () {
(( $+functions[_git-help] )) ||
_git-help () {
_arguments -w -S -s \
- '( -i --info -m --man -w --web)'{-a,--all}'[show all available commands]' \
- '(-a --all -m --man -w --web)'{-i,--info}'[show all available commands]' \
- '(-a --all -i --info -w --web)'{-m,--man}'[show all available commands]' \
- '(-a --all -i --info -m --man )'{-w,--web}'[show all available commands]' \
+ '( -g --guides -i --info -m --man -w --web)'{-a,--all}'[show all available commands]' \
+ '(-a --all -g --guides -m --man -w --web)'{-i,--info}'[show all available commands]' \
+ '(-a --all -g --guides -i --info -w --web)'{-m,--man}'[show all available commands]' \
+ '(-a --all -g --guides -i --info -m --man )'{-w,--web}'[show all available commands]' \
+ '(-g --guides)'{-g,--guides}'[prints a list of useful guides on the standard output]' \
': :_git_commands'
}
@@ -3005,7 +3317,8 @@ _git-rerere () {
'clear[reset metadata used by rerere]' \
'forget[resets metadata used by rerere for specific conflict]: :__git_cached_files' \
'diff[output diffs for the current state of the resolution]' \
- 'status[like diff, but only output filesames]' \
+ 'status[print paths with conflicts whose merge resolution rerere will record]' \
+ 'remaining[print paths with conflicts that have not been autoresolved by rerere]' \
'gc[prune old records of conflicted merges]' && ret=0
;;
esac
@@ -3063,6 +3376,7 @@ _git-rev-parse () {
'( --symbolic-full-name)--symbolic[output in a format as true to input as possible]' \
'(--symbolic )--symbolic-full-name[same as --symbolic, but omit non-ref inputs]' \
'--abbrev-ref=-[a non-ambiguous short name of object]::mode:(strict loose)' \
+ '--disambiguate=-[show every object whose name begins with the given prefix]:prefix' \
'--all[show all refs found in refs/]' \
'--branches=-[show branch refs found in refs/heads/]::shell glob pattern' \
'--tags=-[show tag refs found in refs/tags/]::shell glob pattern' \
@@ -3078,6 +3392,7 @@ _git-rev-parse () {
'(--revs-only --no-revs --flags --no-flags --verify)--short=-[show only shorter unique name]:: :__git_guard_number length' \
'(--since --after)'{--since=-,--after=-}'[show --max-age= parameter corresponding given date string]:datestring' \
'(--until --before)'{--until=-,--before=-}'[show --min-age= parameter corresponding given date string]:datestring' \
+ '--resolve-git-dir[check if <path> is a valid repository or gitfile and print location]:git dir:_files -/' \
'*: :__git_objects' && ret=0
fi
@@ -3105,7 +3420,7 @@ _git-show-branch () {
'(--no-name )--sha1-name[name commits with unique prefix of object names]' \
'--topics[show only commits that are NOT on the first branch given]' \
'( --no-color)--color[color status sign of commits]:: :__git_color_whens' \
- '(--color )--no-color[do not color statis sign of commits]' \
+ '(--color )--no-color[do not color status sign of commits]' \
'*: :__git_revisions' \
- reflogs \
'(-g --reflog)'{-g,--reflog=}'[show reflog entries for given ref]:: :->limit-and-base' \
@@ -3115,7 +3430,7 @@ _git-show-branch () {
(limit-and-base)
if compset -P '[[:digit:]]##,'; then
_alternative \
- 'counts::__git_guard_number count' \
+ 'counts: :__git_guard_number count' \
'dates::__git_datetimes' && ret=0
else
__git_guard_number limit
@@ -3128,9 +3443,8 @@ _git-show-branch () {
(( $+functions[_git-verify-tag] )) ||
_git-verify-tag () {
- # TODO: -v and --verbose are undocumented.
_arguments -w -S -s \
- '(-v --verbose)'{-v,--verbose}'[output additional information]' \
+ '(-v --verbose)'{-v,--verbose}'[print the contents of the tag object before validating it]' \
'*: :__git_tags'
}
@@ -3257,14 +3571,18 @@ _git-send-email () {
'--subject=[specify the initial subject of the email thread]:subject' \
'--to=[specify the primary recipient of the emails]: :_email_addresses' \
'--8bit-encoding=[encoding to use for non-ASCII messages]: :__git_encodings' \
+ '--compose-encoding=[encoding to use for compose messages]: :__git_encodings' \
'--envelope-sender[specify the envelope sender used to send the emails]: :_email_addresses' \
'--smtp-encryption=[specify encryption method to use]: :__git_sendemail_smtpencryption_values' \
'--smtp-domain=[specify FQDN used in HELO/EHLO]: :_domains' \
'--smtp-pass=[specify password to use for SMTP-AUTH]::password' \
'--smtp-server=[specify SMTP server to connect to]:smtp server:_hosts' \
'--smtp-server-port=[specify port to connect to SMTP server on]:smtp port:_ports' \
+ '--smtp-server-option=[specify the outgoing SMTP server option to use]:SMPT server option' \
'--smtp-user=[specify user to use for SMTP-AUTH]:smtp user:_users' \
+ '--smtp-debug=[enable or disable debug output]:smtp debug:((0\:"disable" 1\:"enable"))' \
'--cc-cmd=[specify command to generate Cc\: header with]:Cc\: command:_path_commands' \
+ '--to-cmd=[specify command to generate To\: header with]:To\: command:_path_commands' \
'( --no-chain-reply-to)--chain-reply-to[send each email as a reply to previous one]' \
'(--chain-reply-to )--no-chain-reply-to[send all emails after first as replies to first one]' \
'--identity=[specify configuration identity]: :__git_sendemail_identities' \
@@ -3282,7 +3600,7 @@ _git-send-email () {
'--quiet[be less verbose]' \
'( --no-validate)--validate[perform sanity checks on patches]' \
'(--validate )--validate[do not perform sanity checks on patches]' \
- '--force[send emails even if safetiy checks would prevent it]' \
+ '--force[send emails even if safety checks would prevent it]' \
'*: :_files'
}
@@ -3558,8 +3876,6 @@ _git-apply () {
'--unidiff-zero[disable unified-diff-context check]' \
'--apply[apply patches that would otherwise not be applied]' \
'--no-add[ignore additions made by the patch]' \
- '*--exclude=[skip files matching specified pattern]:pattern' \
- '*--include=[include files matching specified pattern]:pattern' \
'--inaccurate-eof[work around missing-new-line-at-EOF bugs]' \
'(-v --verbose)'{-v,--verbose}'[display progress on stderr]' \
'--recount[do not trust line counts in hunk headers]' \
@@ -3749,9 +4065,10 @@ _git-prune-packed () {
(( $+functions[_git-read-tree] )) ||
_git-read-tree () {
- local trivial_opt= aggressive_opt=
+ local trivial_opt= aggressive_opt= dryrun_opt=
if (( words[(I)-m] )); then
+ dryrun_opt='--dry-run[report if a merge would fail without touching the index or the working tree]'
trivial_opt='--trivial[restrict three-way merge to only happen if no file-level merging is required]'
aggressive_opt='--aggressive[try harder to resolve merge conflicts]'
fi
@@ -3775,12 +4092,14 @@ _git-read-tree () {
'(-m --prefix)--reset[perform a merge, not just a read, ignoring unmerged entries]' \
'(-m --reset 2 3)--prefix=-[read the contents of specified tree-ish under specified directory]:prefix:_directories -r ""' \
$ui_opts \
+ $dryrun_opt \
'-v[display progress on standard error]' \
$trivial_opt \
$aggressive_opt \
$exclude_per_directory_opt \
'--index-output=[write index in the named file instead of $GIT_INDEX_FILE]: :_files' \
'--no-sparse-checkout[display sparse checkout support]' \
+ '--empty[instead of reading tree object(s) into the index, just empty it]' \
'1:first tree-ish to be read/merged:__git_tree_ishs' \
'2::second tree-ish to be read/merged:__git_tree_ishs' \
'3::third tree-ish to be read/merged:__git_tree_ishs'
@@ -3789,8 +4108,10 @@ _git-read-tree () {
(( $+functions[_git-symbolic-ref] )) ||
_git-symbolic-ref () {
_arguments -w -S -s \
+ '(-d --delete)'{-d,--delete}'[delete symbolic ref]' \
'(-q --quiet)'{-q,--quiet}'[do not issue error if specified name is not a symbolic ref]' \
- '-m[update reflog for specified name with specied reason]:reason for update' \
+ '--short[shorten the ref name (eg. refs/heads/master -> master)]' \
+ '-m[update reflog for specified name with specified reason]:reason for update' \
':symbolic reference:__git_heads' \
':: :__git_references'
}
@@ -3845,7 +4166,7 @@ _git-update-index () {
(( $+functions[_git-update-ref] )) ||
_git-update-ref () {
_arguments -w -S -s \
- '-m[update reflog for specified name with specied reason]:reason for update' \
+ '-m[update reflog for specified name with specified reason]:reason for update' \
'(:)-d[delete given reference after verifying its value]:symbolic reference:__git_revisions:old reference:__git_revisions' \
'--no-deref[overwrite ref itself, not what it points to]' \
':symbolic reference:__git_revisions' \
@@ -3871,8 +4192,8 @@ _git-cat-file () {
'(- 1)-e[exit with zero status if object exists]' \
'(- 1)-p[pretty-print given object]' \
'(- 1)--textconv[show content as transformed by a textconv filter]' \
- '(- :)--batch[print SHA1, type, size, and contents of each object provided on stdin]' \
- '(- :)--batch-check[print SHA1, type, and size of each object provided on stdin]' \
+ '(- :)--batch=-[print SHA1, type, size and contents (or in <format>) of objects given on stdin]:format' \
+ '(- :)--batch-check=-[print SHA1, type and size (or in <format>) of objects given on stdin]:format' \
'(-):object type:(blob commit tag tree)' \
': :__git_objects'
}
@@ -4015,6 +4336,8 @@ _git-ls-remote () {
'(-h --heads)'{-h,--heads}'[show only refs under refs/heads]' \
'(-t --tags)'{-t,--tags}'[show only refs under refs/tags]' \
'(-u --upload-pack)'{-u,--upload-pack=-}'[specify path to git-upload-pack on remote side]:remote path' \
+ '--exit-code[exit with status 2 when no matching refs are found in the remote repository]' \
+ '--get-url[expand the URL of the given repository taking into account any "url.<base>.insteadOf" config setting]' \
': :__git_any_repositories' \
'*: :__git_references'
}
@@ -4051,6 +4374,7 @@ _git-merge-base () {
_arguments -w -S -s \
'(-a --all)'{-a,--all}'[display all common ancestors]' \
'--octopus[compute best common ancestors of all supplied commits]' \
+ '--is-ancestor[tell if A is ancestor of B (by exit status)]' \
'(-)--independent[display minimal subset of supplied commits with same ancestors]' \
': :__git_commits' \
'*: :__git_commits'
@@ -4092,7 +4416,7 @@ _git-rev-list () {
'--timestamp[print raw commit timestamp]' \
'( --bisect-vars --bisect-all)--bisect[show only middlemost commit object]' \
'(--bisect)--bisect-vars[same as --bisect, displaying shell-evalable code]' \
- '(--bisect)--bisect-all[display all commit objects beteen included and excluded commits]' \
+ '(--bisect)--bisect-all[display all commit objects between included and excluded commits]' \
'*:: :->commit-or-path' && ret=0
case $state in
@@ -4122,7 +4446,7 @@ _git-show-ref () {
- list \
'(-h --head)'{-h,--head}'[show HEAD reference]' \
'--tags[show only refs/tags]' \
- '--heads[show only refs/heads]' \
+ '--heads[show only HEAD and refs under refs/heads]' \
'(-d --dereference)'{-d,--dereference}'[dereference tags into object IDs as well]' \
'(-s --hash)'{-s+,--hash=-}'[only show the SHA-1 hash, not the reference name]:: :__git_guard_number length' \
'--verify[enable stricter reference checking]' \
@@ -4167,6 +4491,7 @@ _git-daemon () {
# TODO: --interpolated-path should complete %H, %CH, %IP, %P, and %D.
_arguments -S \
'--strict-paths[match paths exactly]' \
+ '--access-hook=-[allow an external tool to accept or decline service]:path:_directories' \
'--base-path=-[remap all the path requests as relative to the given path]:path:_directories' \
'--base-path-relaxed[allow lookup of base path witout prefix]' \
'--interpolated-path=-[dynamically construct alternate paths]:path:_directories' \
@@ -4189,6 +4514,8 @@ _git-daemon () {
'--disable=-[disable site-wide service]: :__git_daemon_service' \
'--allow-override[allow overriding site-wide service]: :__git_daemon_service' \
'--forbid-override[forbid overriding site-wide service]: :__git_daemon_service' \
+ '(--no-informative-errors)--informative-errors[report more verbose errors to the client]' \
+ '(--informative-errors)--no-informative-errors[report all errors as "access denied" to the client]' \
'*:repository:_directories'
}
@@ -4355,7 +4682,9 @@ _git-check-attr () {
fi
_arguments -C \
+ {-a,--all}'[list all attributes that are associated with the specified paths]' \
'--stdin[read file names from stdin instead of from command line]' \
+ '--cached[consider .gitattributes in the index only, ignoring the working tree.]' \
$z_opt \
'(-)--[interpret preceding arguments as attributes and following arguments as path names]' \
'*:: :->attribute-or-file' && ret=0
@@ -4391,7 +4720,10 @@ _git-check-attr () {
_git-check-ref-format () {
_arguments \
'-h[display usage information]' \
- '--print[display canonicalized name of hypothetical reference of given name]' \
+ '(--no-allow-onelevel)--allow-onelevel[accept one-level refnames]' \
+ '(--allow-onelevel)--no-allow-onelevel[do not accept one-level refnames]' \
+ '--refspec-pattern[interpret <refname> as a reference name pattern for a refspec]' \
+ '--normalize[Normalize refname by removing leading slashes]' \
'--branch[expand previous branch syntax]' \
': :__git_references'
}
@@ -4446,7 +4778,8 @@ _git-patch-id () {
(( $+functions[_git-stripspace] )) ||
_git-stripspace () {
_arguments \
- '(-s --strip-comments)'{-s,--strip-comments}'[also strip lines starting with #]'
+ '(-s --strip-comments)'{-s,--strip-comments}'[also strip lines starting with #]' \
+ '(-c --comment-lines)'{-c,--comment-lines}'[prepend comment character and blank to each line]'
}
# INTERNAL GIT COMPLETION FUNCTIONS
@@ -4576,7 +4909,7 @@ _git_commands () {
notes:'add or inspect object notes'
pull:'fetch from and merge with another repository or local branch'
push:'update remote refs along with associated objects'
- rebase:'fasforward-port local commits to the updated upstream head'
+ rebase:'forward-port local commits to the updated upstream head'
reset:'reset current HEAD to specified state'
revert:'revert existing commits'
rm:'remove files from the working tree and from the index'
@@ -4592,7 +4925,7 @@ _git_commands () {
config:'get and set repository or global options'
fast-export:'data exporter'
fast-import:'import information into git directly'
- filter-branch:'rewrite branchers'
+ filter-branch:'rewrite branches'
mergetool:'run merge conflict resolution tools to resolve merge conflicts'
pack-refs:'pack heads and tags for efficient repository access'
prune:'prune all unreachable objects from the object database'
@@ -4692,6 +5025,8 @@ _git_commands () {
local -a plumbing_internal_helper_commands
plumbing_internal_helper_commands=(
check-attr:'display gitattributes information'
+ check-ignore:'debug gitignore/exclude files'
+ check-mailmap:'show canonical names and email addresses of contacts'
check-ref-format:'ensure that a reference name is well formed'
fmt-merge-msg:'produce merge commit message'
mailinfo:'extract patch and authorship from a single email message'
@@ -4757,7 +5092,13 @@ __git_aliases () {
(( $+functions[__git_extract_aliases] )) ||
__git_extract_aliases () {
- aliases=(${^${${(0)"$(_call_program aliases "git config -z --get-regexp '^alias.'")"}#alias.}/$'\n'/:alias for \'}\')
+ local -a tmp
+ tmp=(${${(0)"$(_call_program aliases "git config -z --get-regexp '^alias.'")"}#alias.})
+ if (( ${#tmp} > 0 )); then
+ aliases=(${^tmp/$'\n'/:alias for \'}\')
+ else
+ aliases=()
+ fi
}
(( $+functions[__git_date_formats] )) ||
@@ -4863,7 +5204,7 @@ __git_ignore_submodules_whens () {
whens=(
none:'submodule is dirty when it contains untracked or modified files'
- untracked:'submodule is dirty when it contains untracket files'
+ untracked:'submodule is dirty when it contains untracked files'
dirty:'ignore all changes to submodules, showing only changes to commits stored in superproject'
all:'ignore all changes to submodules (default)')
@@ -5070,6 +5411,17 @@ __git_remote_branch_names () {
_wanted remote-branch-names expl 'remote branch name' compadd $* - $branch_names
}
+(( $+functions[__git_remote_branch_names_noprefix] )) ||
+__git_remote_branch_names_noprefix () {
+ local expl
+ declare -a heads
+
+ branch_names=(${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}##*/}:#HEAD})
+ __git_command_successful $pipestatus || return 1
+
+ _wanted remote-branch-names-noprefix expl 'remote branch name' compadd $* - $branch_names
+}
+
(( $+functions[__git_commits] )) ||
__git_commits () {
# TODO: deal with things that __git_heads and __git_tags has in common (i.e.,
@@ -5267,15 +5619,6 @@ __git_remote_references () {
__git_references
}
-(( $+functions[__git_note_references] )) ||
-__git_local_references () {
- local references expl
-
- references=(${${(M)${${(f)"$(_call_program references git ls-remote ./. 2>/dev/null)"}#*$'\t'}:#refs/notes/*}#refs/notes/})
- __git_command_successful $pipestatus || return 1
-
- _wanted references expl reference compadd - $references
-}
(( $+functions[__git_notes_refs] )) ||
__git_notes_refs () {
local expl
@@ -5339,7 +5682,7 @@ __git_files () {
# TODO: --directory should probably be added to $opts when --others is given.
local pref=$gitcdup$gitprefix$PREFIX
- files=(${(0)"$(_call_program files git ls-files -z --exclude-standard $opts -- ${pref:+$pref\*} 2>/dev/null)"})
+ files=(${(0)"$(_call_program files git ls-files -z --exclude-standard $opts -- ${pref:+$pref\\\*} 2>/dev/null)"})
__git_command_successful $pipestatus || return
# _wanted $tag expl $description _files -g '{'${(j:,:)files}'}' $compadd_opts -
@@ -5559,19 +5902,29 @@ __git_setup_log_options () {
'(- *)-h[display help]'
'( --no-decorate)--decorate=-[print out ref names of any commits that are shown]: :__git_log_decorate_formats'
'(--decorate )--no-decorate[do not print out ref names of any commits that are shown]'
+ '( --no-follow)--follow[follow renames]'
+ '(--follow )--no-follow[do not follow renames]'
'--source[show which ref each commit is reached from]')
}
(( $+functions[__git_setup_diff_options] )) ||
__git_setup_diff_options () {
- local diff_types='(-p -u --patch -U --unified --raw --patch-with-raw --stat --numstat --shortstat --dirstat --dirstat-by-file --summary --patch-with-stat --name-only --name-status --cumulative)'
+ local diff_types='(-p -u --patch -U --unified --raw --patch-with-raw --stat --numstat --shortstat --dirstat --dirstat-by-file --summary --patch-with-stat --name-only --name-status --cumulative -s --no-patch)'
diff_options=(
$diff_types{-p,-u,--patch}'[generate diff in patch format]'
$diff_types{-U,--unified=}'[generate diff with given lines of context]: :__git_guard_number lines'
$diff_types'--raw[generate default raw diff output]'
$diff_types'--patch-with-raw[generate patch but also keep the default raw diff output]'
- '--patience[generate diffs with patience algorithm]'
+ $diff_types{-s,--no-patch}'[suppress diff output]'
+ '(--minimal --patience --histogram --diff-algorithm)--minimal[spend extra time to make sure the smallest possible diff is producedm]'
+ '(--minimal --patience --histogram --diff-algorithm)--patience[generate diffs with patience algorithm]'
+ '(--minimal --patience --histogram --diff-algorithm)--histogram[generate diffs with histogram algorithm]'
+ '(--minimal --patience --histogram --diff-algorithm)--diff-algorithm=[choose a diff algorithm]:diff algorithm:((default\:"basic greedy diff algorithm"
+ myers\:"basic greedy diff algorithm"
+ minimal\:"spend extra time to make sure the smallest possible diff is produced"
+ patience\:"generate diffs with patience algorithm"
+ histogram\:"generate diffs with histogram algorithm"))'
$diff_types'--stat=-[generate diffstat instead of patch]:: :__git_guard_diff-stat-width'
$diff_types'--numstat[generate more machine-friendly diffstat]'
$diff_types'--shortstat[generate summary diffstat]'
@@ -5583,7 +5936,7 @@ __git_setup_diff_options () {
$diff_types'--name-only[show only names of changed files]'
$diff_types'--name-status[show only names and status of changed files]'
'--submodule=-[select output format for submodule differences]::format:((short\:"show pairs of commit names"
- log\:"list commits like git submodule does (default)"))'
+ log\:"list commits like git submodule does"))'
'( --no-color --color-words)--color=-[show colored diff]:: :__git_color_whens'
'(--color --color-words)--no-color[turn off colored diff]'
'--word-diff=-[show word diff]::mode:((color\:"highlight changed words using color"
@@ -5597,16 +5950,15 @@ __git_setup_diff_options () {
'--full-index[show full object name of pre- and post-image blob]'
'(--full-index)--binary[in addition to --full-index, output binary diffs for git-apply]'
'--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length'
- # TODO: --break-rewrites is undocumented.
'(-B --break-rewrites)'{-B-,--break-rewrites=-}'[break complete rewrite changes into pairs of given size]:: :__git_guard_number size'
- # TODO: --detect-renames is undocumented.
- '(-M --detect-renames)'{-M-,--detect-renames=-}'[detect renames with given scope]:: :__git_guard_number size'
- # TODO: --detect-copies is undocumented.
- '(-C --detect-copies)'{-C-,--detect-copies=-}'[detect copies as well as renames with given scope]:: :__git_guard_number size'
+ '(-M --find-renames)'{-M-,--find-renames=-}'[Detect renames with given scope]:: :__git_guard_number size'
+ '(-C --find-copies)'{-C-,--find-copies=-}'[detect copies as well as renames with given scope]:: :__git_guard_number size'
'--find-copies-harder[try harder to find copies]'
+ '(-D --irreversible-delete)'{-D,--irreversible-delete}'[omit the preimage for deletes]'
'-l-[limit number of rename/copy targets to run]: :__git_guard_number'
'--diff-filter=-[select certain kinds of files for diff]: :_guard "[ACDMRTUXB*]#" kinds'
- '-S-[look for differences that contain the given string]:string'
+ '-S-[look for differences that add or remove the given string]:string'
+ '-G-[look for differences whose added or removed line matches the given regex]:pattern'
'--pickaxe-all[when -S finds a change, show all changes in that changeset]'
'--pickaxe-regex[treat argument of -S as regular expression]'
'-O-[output patch in the order of glob-pattern lines in given file]: :_files'
@@ -5616,11 +5968,14 @@ __git_setup_diff_options () {
'--ignore-space-at-eol[ignore changes in whitespace at end of line]'
'(-b --ignore-space-change -w --ignore-all-space)'{-b,--ignore-space-change}'[ignore changes in amount of white space]'
'(-b --ignore-space-change -w --ignore-all-space)'{-w,--ignore-all-space}'[ignore white space when comparing lines]'
+ '--ignore-blank-lines[do not show hunks that add or remove blank lines]'
'--inter-hunk-context=[combine hunks closer than n lines]:n'
'--exit-code[report exit code 1 if differences, 0 otherwise]'
'(--exit-code)--quiet[disable all output]'
'( --no-ext-diff)--ext-diff[allow external diff helper to be executed]'
'(--ext-diff )--no-ext-diff[disallow external diff helper to be executed]'
+ '(--textconv --no-textconv)--textconv[allow external text conversion filters to be run when comparing binary files]'
+ '(--textconv --no-textconv)--no-textconv[do not allow external text conversion filters to be run when comparing binary files]'
'--ignore-submodules[ignore changes to submodules]:: :__git_ignore_submodules_whens'
'(--no-prefix)--src-prefix=[use given prefix for source]:prefix'
'(--no-prefix)--dst-prefix=[use given prefix for destination]:prefix'
@@ -5631,18 +5986,7 @@ __git_setup_diff_options () {
'(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-3,--theirs}'[diff against "their branch" version]'
'(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)-0[omit diff output for unmerged entries]'
'(-0 -1 -2 -3 --base --ours --theirs -c --cc --no-index)'{-c,--cc}'[compare "our branch", "their branch" and working tree files]'
- '-q[remain silent even on nonexisting files]'
-
- # TODO: --cumulative is undocumented.
- '--cumulative[undocumented]'
- # TODO: --follow is undocumented.
- '--follow[undocumented]'
- # TODO: --textconv is undocumented.
- '--textconv[undocumented]'
- # TODO: --no-textconv is undocumented.
- '--no-textconv[undocumented]'
- # TODO: -G is undocumented.
- '-G[undocumented]'
+
# TODO: --output is undocumented.
'--output[undocumented]:undocumented')
}
@@ -5664,13 +6008,15 @@ __git_setup_revision_options () {
email\:"use email headers like From and Subject"
raw\:"the raw commits"
format\:"specify own format"))'
- '--abbrev-commit[show only partial prefixes of commit object names]'
+ '(--abbrev-commit --no-abbrev-commit)--abbrev-commit[show only partial prefixes of commit object names]'
+ '(--abbrev-commit --no-abbrev-commit)--no-abbrev-commit[show the full 40-byte hexadecimal commit object name]'
+ '(--abbrev --no-abbrev)--abbrev=[set minimum SHA1 display-length (for use with --abbrev-commit)]: :__git_guard_number length'
+ '(--abbrev --no-abbrev)--no-abbrev[show the full 40-byte hexadecimal commit object name]'
'--oneline[shorthand for --pretty=oneline --abbrev-commit]'
'--encoding=-[output log messages in given encoding]:: :__git_encodings'
- '(--no-notes --show-notes --standard-notes --no-standard-notes)--no-notes[do not show notes that annotate commit]'
- '(--no-notes --show-notes --standard-notes --no-standard-notes)--show-notes[do not show notes that annotate commit]:: :__git_note_references'
- '(--no-notes --show-notes --standard-notes --no-standard-notes)--no-standard-notes[enable populating notes ref list from core.notesRef and notes.displayRef]'
- '(--no-notes --show-notes --standard-notes --no-standard-notes)--no-standard-notes[disable populating notes ref list from core.notesRef and notes.displayRef]'
+ '(--no-notes --notes)--no-notes[do not show notes that annotate commit]'
+ '(--no-notes )*--notes=[show notes that annotate commit, with optional ref argument show this notes ref instead of the default notes ref(s)]:: :__git_notes_refs'
+ '--show-signature[validate GPG signature of commit]'
'( --date)--relative-date[show dates relative to current time]'
'(--relative-date )--date=-[format of date output]: :__git_date_formats'
'--parents[display parents of commit]'
@@ -5694,6 +6040,10 @@ __git_setup_revision_options () {
'--remove-empty[stop when given path disappears from tree]'
'--merges[display only merge commits]'
'--no-merges[do not display commits with more than one parent]'
+ '(--min-parents --no-min-parents)--min-parents=-[show only commits having at least <n> commits]: :__git_guard_number "minimum number of parents"'
+ '(--min-parents --no-min-parents)--no-min-parents[reset limit]'
+ '(--max-parents --no-max-parents)--max-parents=-[show only commits having at most <n> commits]: :__git_guard_number "maximum number of parents"'
+ '(--max-parents --no-max-parents)--no-max-parents[reset limit]'
'--first-parent[follow only first parent from merge commits]'
'*--not[reverses meaning of ^ prefix for revisions that follow]'
'--all[show all commits from refs]'
@@ -5702,8 +6052,8 @@ __git_setup_revision_options () {
'--remotes=[-show all commits from refs/remotes]::pattern'
'--glob=[show all commits from refs matching glob]:pattern'
'--stdin[read commit objects from standard input]'
- '--cherry-pick[omit any same-change commits]'
'(-g --walk-reflogs --reverse)'{-g,--walk-reflogs}'[walk reflog entries from most recent to oldest]'
+ '--grep-reflog=[limit commits to ones whose reflog message matches the given pattern (with -g, --walk-reflogs)]:pattern'
'--merge[after a failed merge, show refs that touch files having a conflict]'
'--boundary[output uninteresting commits at boundary]'
'--simplify-by-decoration[show only commits that are referenced by a ref]'
@@ -5712,28 +6062,28 @@ __git_setup_revision_options () {
'(--full-history --dense --simplify-merges --ancestry-path)--sparse[when paths are given, display only commits that changes any of them]'
'(--full-history --dense --sparse --ancestry-path)--simplify-merges[milder version of --full-history]'
'(--full-history --dense --sparse --simplify-merges )--ancestry-path[only display commits that exists directly on ancestry chains]'
- '( --date-order)--topo-order[display commits in topological order]'
- '(--topo-order )--date-order[display commits in date order]'
+ '( --date-order --author-date-order)--topo-order[display commits in topological order]'
+ '(--topo-order --author-date-order)--date-order[display commits in date order]'
+ '(--topo-order --date-order )--author-date-order[display commits in auhor date order]'
'(-g --walk-reflogs)--reverse[display commits in reverse order]'
'( --objects-edge)--objects[display object ids of objects referenced by listed commits]'
'(--objects )--objects-edge[display object ids of objects referenced by listed and excluded commits]'
'( --do-walk)--no-walk[only display given revs, do not traverse their ancestors]'
'(--no-walk )--do-walk[only display given revs, traversing their ancestors]'
+ '( --cherry-pick)--cherry-mark[like --cherry-pick but mark equivalent commits instead of omitting them]'
+ '(--cherry-pick )--cherry-pick[omit any commit that introduces the same change as another commit on "the other side" of a symmetric range]'
+ '( --right-only)--left-only[list only commits on the left side of a symmetric range]'
+ '(--left-only )--right-only[list only commits on the right side of a symmetric range]'
+ '(--left-only --right-only --cherry-pick --cherry-mark)--cherry[synonym for --right-only --cherry-mark --no-merges]'
+ '(-c --cc )--full-diff[show full commit diffs when using log -p, not only those affecting the given path]'
+ '--log-size[print log message size in bytes before the message]'
+ '--use-mailmap[use mailmap file to map author and committer names and email]'
- # TODO: --reflog is undocumented.
'--reflog[show all commits from reflogs]'
- # TODO: --default is undocumented.
'--default[use argument as default revision]:default revision:__git_revisions'
- # TODO: --full-diff is undocumented.
- '(-c --cc )--full-diff[undocumented]'
- # TODO: --abrev is undocumented.
- '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length'
- # TODO: --no-abbrev is undocumented.
- '--no-abbrev[undocumented]'
# TODO: --early-output is undocumented.
'--early-output=-[undocumented]::undocumented'
- # TODO: --log-size is undocumented.
- '--log-size[undocumented]')
+ )
if (( words[(I)--objects(|-edge)] )); then
revision_options+=('--unpacked[print object IDs not in packs]')
@@ -5745,6 +6095,8 @@ __git_setup_merge_options () {
merge_options=(
'( --no-commit)--commit[perform the merge and commit the result]'
'(--commit )--no-commit[perform the merge but do not commit the result]'
+ '( --no-edit)--edit[open an editor to change the commit message]'
+ '(--edit )--no-edit[do not open an editor to change the commit message]'
'( --no-ff)--ff[do not generate a merge commit if the merge resolved as a fast-forward]'
'(--ff )--no-ff[generate a merge commit even if the merge resolved as a fast-forward]'
'( --no-log)--log[fill in one-line descriptions of the commits being merged in the log message]'
@@ -5756,6 +6108,8 @@ __git_setup_merge_options () {
'--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]'
+ '(--verify-signatures)--no-verify-signatures[verify the commits being merged or abort]'
+ '(--no-verify-signatures)--verify-signatures[do not verify the commits being merged]'
'(-q --quiet -v --verbose)'{-q,--quiet}'[suppress all output]'
'(-q --quiet -v --verbose)'{-v,--verbose}'[output additional information]')
}
@@ -5766,6 +6120,7 @@ __git_setup_fetch_options () {
'(: *)--all[fetch all remotes]'
'(-a --append)'{-a,--append}'[append ref names and object names of fetched refs to "$GIT_DIR/FETCH_HEAD"]'
'--depth=[deepen the history of a shallow repository by the given number of commits]: :__git_guard_number depth'
+ '--unshallow[convert a shallow clone to a complete one]'
'--dry-run[show what would be done, without making any changes]'
'(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]'
'(-k --keep)'{-k,--keep}'[keep downloaded pack]'
@@ -5774,6 +6129,13 @@ __git_setup_fetch_options () {
'(--no-tags -t --tags)'{-t,--tags}'[fetch remote tags]'
'(-u --update-head-ok)'{-u,--update-head-ok}'[allow updates of current branch head]'
'--upload-pack=[specify path to git-upload-pack on remote side]:remote path'
+ '(--no-recurse-submodules --recurse-submodules)--recurse-submodules=-[specify when to fetch commits of submodules]::recursive fetching mode:((no\:"disable recursion"
+ yes\:"always recurse"
+ on-demand\:"only when submodule reference in superproject is updated"))'
+ '(--no-recurse-submodules --recurse-submodules)--no-recurse-submodules[disable recursive fetching of submodules]'
+ '(--no-recurse-submodules)--recurse-submodules-default=-[provide internal temporary non-negative value for "--recurse-submodules"]::recursive fetching mode:((yes\:"always recurse"
+ on-demand\:"only when submodule reference in superproject is updated"))'
+ '--submodule-prefix=-[prepend <path> to paths printed in informative messages]:submodule prefix path:_files -/'
'(-q --quiet -v --verbose --progress)'{-q,--quiet}'[suppress all output]'
'(-q --quiet -v --verbose)'{-v,--verbose}'[output additional information]'
'(-q --quiet)--progress[output progress information]')
@@ -5787,7 +6149,10 @@ __git_setup_apply_options () {
'-C-[ensure at least N lines of context match before and after each change]: :_guard "[[\:digit\:]]#" "number of lines of context"'
'--reject[apply hunks that apply and leave rejected hunks in .rej files]'
'(--ignore-space-change --ignore-whitespace)'{--ignore-space-change,--ignore-whitespace}'[ignore changes in whitespace in context lines]'
- '--directory=[root to prepend to all filenames]:root:_directories')
+ '--directory=[root to prepend to all filenames]:root:_directories'
+ '*--exclude=[skip files matching specified pattern]:pattern'
+ '*--include=[include files matching specified pattern]:pattern'
+ )
}
# Git Config Helpers
@@ -5879,7 +6244,7 @@ __git_config_values () {
default=$2
shift 2
values=($*)
- [[ -n $current ]] && values[(r)$(__git_pattern_escape $default):*]+=' (current)'
+ [[ -n $current ]] && values[(r)$(__git_pattern_escape $current):*]+=' (current)'
values[(r)$(__git_pattern_escape $default):*]+=' (default)'
_describe -t ${opts[-t]:-values} ${opts[-l]:-value} values
@@ -5896,6 +6261,8 @@ __git_browsers () {
builtinbrowsers=(
firefox
iceweasel
+ google-chrome
+ chromium
konquerer
w3m
links
@@ -6039,9 +6406,10 @@ __git_sendemail_suppresscc_values () {
author:'avoid including patch author' \
self:'avoid including sender' \
cc:'avoid including anyone mentioned in Cc lines except for self' \
- bodycc:'avoid including anyone mentiond in Cc lines in patch body except for self' \
- sob:'avoid including anyone mentiond in Signed-off-by lines except for self' \
+ bodycc:'avoid including anyone mentioned in Cc lines in patch body except for self' \
+ sob:'avoid including anyone mentioned in Signed-off-by lines except for self' \
cccmd:'avoid running --cc-cmd' \
+ tocmd:'avoid running --to-cmd' \
body:'equivalent to sob + bodycc' \
all:'avoid all auto Cc values'
}
@@ -6102,13 +6470,17 @@ _git() {
'(- :)--help[display help message]' \
'-c[pass configuration parameter to command]:parameter' \
'--exec-path=-[path containing core git-programs]:: :_directories' \
- '--html-path[display path to HTML documentation and exit]' \
+ '(: -)--man-path[print the manpath for the man pages for this version of Git and exit]' \
+ '(: -)--info-path[print the path where the info files are installed and exit]' \
+ '(: -)--html-path[display path to HTML documentation and exit]' \
'(-p --paginate)'{-p,--paginate}'[pipe output into $PAGER]' \
'--no-pager[do not pipe git output into a pager]' \
'--git-dir=-[path to repository]: :_directories' \
'--work-tree=-[path to working tree]: :_directories' \
+ '--namespace=-[set the Git namespace]: :_directories' \
'--bare[use $PWD as repository]' \
'--no-replace-objects[do not use replacement refs to replace git objects]' \
+ '--literal-pathspecs[treat pathspecs literally, rather than as glob patterns]' \
'(-): :->command' \
'(-)*:: :->option-or-argument' && return
diff --git a/Completion/Unix/Command/_gradle b/Completion/Unix/Command/_gradle
index bc5aed0cd..9a75daefb 100644
--- a/Completion/Unix/Command/_gradle
+++ b/Completion/Unix/Command/_gradle
@@ -24,7 +24,7 @@ zstyle -a ":completion:*:*:$service:*" tag-order tag_order || \
zstyle -T ":completion:*:*:$service:*" gradle-inspect || gradle_inspect=no
_arguments -C \
- '(-)'{-\?,-h,--help}'[Shows this help message.]' \
+ '(-)'{-\?,-h,--help}'[Shows a 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)' \
@@ -45,12 +45,17 @@ _arguments -C \
'--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' \
+ '--parallel[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
+ '--parallel-threads[Build projects in parallel, using the specified number of executor threads.]' \
'--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.]' \
+ '--recompile-scripts[Force build script recompiling.]' \
+ '--refresh[Refresh the state of resources of the type(s) specified.]:refresh policy:(dependencies)' \
+ '--refresh-dependencies[Refresh the state of dependencies.]' \
+ '--rerun-tasks[Ignore previously cached task results.]' \
'(-S --full-stacktrace)'{-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
+ '(-s --stacktrace)'{-S,--full-stacktrace}'[Print out the full (very verbose) 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.]' \
@@ -58,7 +63,7 @@ _arguments -C \
'*:task:->task' \
&& ret=0
-if [[ -n $state ]]; then
+if [[ $words[CURRENT] != -* ]]; 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.
@@ -102,7 +107,8 @@ if [[ -n $state ]]; then
fi
else
_describe 'built-in tasks' '(
- "dependencies:Displays the dependencies of root project."
+ "dependencies:Displays all dependencies declared in root project."
+ "dependencyInsight:Displays the insight into a specific dependency in root project."
"help:Displays a help message."
"projects:Displays the sub-projects of root project."
"properties:Displays the properties of root project."
diff --git a/Completion/Unix/Command/_graphicsmagick b/Completion/Unix/Command/_graphicsmagick
index 03b0106a3..d18ffbc7f 100644
--- a/Completion/Unix/Command/_graphicsmagick
+++ b/Completion/Unix/Command/_graphicsmagick
@@ -3,7 +3,7 @@
local state line expl formats curcontext="$curcontext"
typeset -A opt_args
-formats=jpg:jpeg:tiff:miff:ras:bmp:cgm:dcx:ps:eps:fig:fits:fpx:gif:mpeg:pbm:pgm:ppm:pcd:pcl:pdf:pcx:png:rad:rgb:rgba:rle:sgi:html:shtml:tga:ttf:uil:xwd:xbm:xpm:yuv
+formats=jpg:jpeg:tiff:miff:ras:bmp:cgm:dcx:ps:eps:fig:fits:fpx:gif:mpeg:pbm:pgm:ppm:pcd:pcl:pdf:pcx:png:rad:rgb:rgba:rle:sgi:html:shtml:tga:ttf:uil:xcf:xwd:xbm:xpm:yuv
if (( $# )); then
_files "$@" -g "*.(#i)(${~formats//:/|})(-.)"
diff --git a/Completion/Unix/Command/_gzip b/Completion/Unix/Command/_gzip
index 5c88fac39..a90f23273 100644
--- a/Completion/Unix/Command/_gzip
+++ b/Completion/Unix/Command/_gzip
@@ -82,7 +82,11 @@ files)
_files "$expl[@]" -g '^*.(([tT]|)[gG]|)[zZ](-.)' && return
else
_description files expl 'compressed file'
- _files "$expl[@]" -g '*.(([tT]|)[gG]|)[zZ](-.)' && return
+ if (( $+opt_args[-f] )); then
+ _files "$expl[@]" && return
+ else
+ _files "$expl[@]" -g '*.(([tT]|)[gG]|)[zZ](-.)' && return
+ fi
fi
fi
;;
diff --git a/Completion/Unix/Command/_imagemagick b/Completion/Unix/Command/_imagemagick
index 56d530326..5876adc47 100644
--- a/Completion/Unix/Command/_imagemagick
+++ b/Completion/Unix/Command/_imagemagick
@@ -11,7 +11,7 @@ typeset -A opt_args
#
# and certainly many other things...
-formats=jpg:jpeg:tiff:miff:ras:bmp:cgm:dcx:ps:eps:fig:fits:fpx:gif:mpeg:pbm:pgm:ppm:pcd:pcl:pdf:pcx:png:rad:rgb:rgba:rle:sgi:html:shtml:tga:ttf:uil:xwd:xbm:xpm:yuv
+formats=jpg:jpeg:tiff:miff:ras:bmp:cgm:dcx:ps:eps:fig:fits:fpx:gif:mpeg:pbm:pgm:ppm:pcd:pcl:pdf:pcx:png:rad:rgb:rgba:rle:sgi:html:shtml:tga:ttf:uil:xcf:xwd:xbm:xpm:yuv
if (( $# )); then
_files "$@" -g "*.(#i)(${~formats//:/|})(-.)"
diff --git a/Completion/Unix/Command/_java b/Completion/Unix/Command/_java
index f6565bc64..7b1dce18f 100644
--- a/Completion/Unix/Command/_java
+++ b/Completion/Unix/Command/_java
@@ -229,7 +229,7 @@ keytool)
'-keypass[password for private key]:password for private key:' \
'-validity[valid days]:number of days:' \
'-storetype[keystore type]:store type:' \
- '-keystore[keystore location]:keystore location:' \
+ '-keystore[keystore location]:keystore location:_files' \
'-storepass[password for keystore]:password:' \
'-v[verbose mode]' \
- import \
@@ -240,7 +240,7 @@ keytool)
'-noprompt[disable interaction with the user]' \
'-trustcacerts[use cacerts]' \
'-storetype[keystore type]:store type:' \
- '-keystore[keystore location]:keystore location:' \
+ '-keystore[keystore location]:keystore location:_files' \
'-storepass[password for keystore]:password:' \
'-v[verbose mode]' \
- selfcert \
@@ -251,14 +251,14 @@ keytool)
'-validity[valid days]:number of days:' \
'-keypass[password for private key]:password for private key:' \
'-storetype[keystore type]:store type:' \
- '-keystore[keystore location]:keystore location:' \
+ '-keystore[keystore location]:keystore location:_files' \
'-storepass[password for keystore]:password:' \
'-v[verbose mode]' \
- identitydb \
'-identitydb[command to read identity database]' \
'-file[specify identity database file]:identity database file:_files' \
'-storetype[keystore type]:store type:' \
- '-keystore[keystore location]:keystore location:' \
+ '-keystore[keystore location]:keystore location:_files' \
'-storepass[password for keystore]:password:' \
'-v[verbose mode]' \
- certreq \
@@ -268,7 +268,7 @@ keytool)
'-file[specify certificate signing request file]:certificate signing request file:_files' \
'-keypass[password for private key]:password for private key:' \
'-storetype[keystore type]:store type:' \
- '-keystore[keystore location]:keystore location:' \
+ '-keystore[keystore location]:keystore location:_files' \
'-storepass[password for keystore]:password:' \
'-v[verbose mode]' \
- export \
@@ -277,14 +277,14 @@ keytool)
'-file[specify certificate file]:certificate file:_files' \
'-rfc[make certificate format printable as RFC 1421]' \
'-storetype[keystore type]:store type:' \
- '-keystore[keystore location]:keystore location:' \
+ '-keystore[keystore location]:keystore location:_files' \
'-storepass[password for keystore]:password:' \
'-v[verbose mode]' \
- list \
'-list[command to print keystore entry]' \
'-alias[alias]:alias:' \
'-storetype[keystore type]:store type:' \
- '-keystore[keystore location]:keystore location:' \
+ '-keystore[keystore location]:keystore location:_files' \
'-storepass[password for keystore]:password:' \
'(-rfc)-v[make certificate format human-readable]' \
'(-v)-rfc[make certificate format printable as RFC 1421]' \
@@ -299,14 +299,14 @@ keytool)
'-keypass[password for private key]:password for private key:' \
'-new[password for private key of new entry]:password for private key of new entry:' \
'-storetype[keystore type]:store type:' \
- '-keystore[keystore location]:keystore location:' \
+ '-keystore[keystore location]:keystore location:_files' \
'-storepass[password for keystore]:password:' \
'-v[verbose mode]' \
- storepasswd \
'-storepasswd[command to change password for keystore]' \
'-new[new password]:new password:' \
'-storetype[keystore type]:store type:' \
- '-keystore[keystore location]:keystore location:' \
+ '-keystore[keystore location]:keystore location:_files' \
'-storepass[password for keystore]:password:' \
'-v[verbose mode]' \
- keypasswd \
@@ -315,14 +315,14 @@ keytool)
'-keypass[old password for private key]:old password for private key:' \
'-new[nwe password for private key]:new password for private key:' \
'-storetype[keystore type]:store type:' \
- '-keystore[keystore location]:keystore location:' \
+ '-keystore[keystore location]:keystore location:_files' \
'-storepass[password for keystore]:password:' \
'-v[verbose mode]' \
- delete \
'-delete[command to delete entry]' \
'-alias[alias]:alias:' \
'-storetype[keystore type]:store type:' \
- '-keystore[keystore location]:keystore location:' \
+ '-keystore[keystore location]:keystore location:_files' \
'-storepass[password for keystore]:password:' \
'-v[verbose mode]' \
- help \
@@ -331,7 +331,7 @@ keytool)
jarsigner)
_arguments \
- '-keystore[specify URL for keystore location]:URL for keystore location:' \
+ '-keystore[keystore location]:keystore location:_files' \
'-storetype[specify keystore type]:store type:' \
'-storepass[specify password for keystore]:password:' \
'-keypass[specify password for private key]:password:' \
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index 53e2e1b3e..e5a513f64 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -1,4 +1,4 @@
-#compdef make gmake pmake dmake
+#compdef make gmake pmake dmake freebsd-make bmake
# TODO: Based on targets given on the command line, show only variables that
# are used in those targets and their dependencies.
@@ -59,7 +59,7 @@ _make-expandVars() {
}
_make-parseMakefile () {
- local input var val target dep TAB=$'\t' dir=$1 tmp
+ local input var val target dep TAB=$'\t' dir=$1 tmp IFS=
while read input
do
@@ -148,7 +148,9 @@ _make-findBasedir () {
_make() {
local prev="$words[CURRENT-1]" file expl tmp is_gnu dir incl match
- local -A TARGETS VARIABLES
+ local context state state_descr line
+ local -a option_specs
+ local -A TARGETS VARIABLES opt_args
local ret=1
_pick_variant -r is_gnu gnu=GNU unix -v -f
@@ -156,21 +158,77 @@ _make() {
if [[ $is_gnu == gnu ]]
then
incl="(-|)include"
+ option_specs=(
+ '(-B --always-make)'{-B,--always-make}'[unconditionally make all targets]'
+ '*'{-C,--directory=}'[change directory first]:change to directory:->dir'
+ '-d[print lots of debug information]'
+ '--debug=-[print various types of debug information]:debug options:->debug'
+ '(-e --environment-overrides)'{-e,--environment-overrides}'[environment variables override makefiles]'
+ '--eval=-[evaluate STRING as a makefile statement]:STRING'
+ '(-f --file --makefile)'{-f,--file=,--makefile=}'[read FILE as a makefile]:makefile:->file'
+ '(- *)'{-h,--help}'[print help message and exit]'
+ '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors from recipes]'
+ '*'{-I,--include-dir=}'[search DIRECTORY for included makefiles]:search path for included makefile:->dir'
+ '(-j --jobs)'{-j,--jobs=}'[allow N jobs at once; infinite jobs with no arg]:number of jobs'
+ '(-k --keep-going)'{-k,--keep-going}"[keep going when some targets can't be made]"
+ '(-l --load-average --max-load)'{-l,--load-average=,--max-load}"[don't start multiple jobs unless load is below N]:load"
+ '(-L --check-symlik-times)'{-L,--check-symlink-times}'[use the latest mtime between symlinks and target]'
+ '(-n --just-print --dry-run --recon)'{-n,--just-print,--dry-run,--recon}"[don't actually run any recipe; just print them]"
+ '*'{-o,--old-file=,--assume-old=}"[consider FILE to be very old and don't remake it]:file not to remake:->file"
+ '(-p --print-data-base)'{-p,--print-data-base}'[print makes internal database]'
+ '(-q --question)'{-q,--question}'[run no recipe; exit status says if up to date]'
+ '(-r --no-builtin-rules)'{-r,--no-builtin-rules}'[disable the built-in implicit rules]'
+ '(-R --no-builtin-variables)'{-R,--no-builtin-variables}'[disable the built-in variable settings]'
+ '(-s --silent --quiet)'{-s,--silent,--quiet}"[don't echo recipes]"
+ '(-S --no-keep-going --stop)'{-S,--no-keep-going,--stop}'[turns off -k]'
+ '(-t --touch)'{-t,--touch}'[touch targets instead of remaking them]'
+ '(- *)'{-v,--version}'[print the version number of make and exit]'
+ '(-w --print-directory)'{-w,--print-directory}'[print the current directory]'
+ '--no-print-directory[turn off -w, even if it was turned on implicitly]'
+ '*'{-W,--what-if=,--new-file=,--assume-new=}'[consider FILE to be infinitely new]:file to treat as modified:->file'
+ '--warn-undefined-variables[warn when an undefined variable is referenced]'
+ '--warn-undefined-functions[warn when an undefined user function is called]'
+ )
else
+ # Basic make options only.
incl=.include
+ option_specs=(
+ '-C[change directory first]:directory:->dir'
+ '-I[include directory for makefiles]:directory:->dir'
+ '-f[specify makefile]:makefile:->file'
+ '-o[specify file not to remake]:file not to remake:->file'
+ '-W[pretend file was modified]:file to treat as modified:->file'
+ )
fi
- if [[ "$prev" == -[CI] ]]
- then
- _files -W ${(q)$(_make-findBasedir ${words[1,CURRENT-1]})} -/ && ret=0
- elif [[ "$prev" == -[foW] ]]
- then
- _files -W ${(q)$(_make-findBasedir $words)} && ret=0
- else
- file="$words[(I)-f]"
- if (( file ))
+ _arguments -s $option_specs \
+ '*:make target:->target' && ret=0
+
+ case $state in
+ (dir)
+ _description directories expl "$state_descr"
+ _files "$expl[@]" -W ${(q)$(_make-findBasedir ${words[1,CURRENT-1]})} -/ && ret=0
+ ;;
+
+ (file)
+ _description files expl "$state_descr"
+ _files "$expl[@]" -W ${(q)$(_make-findBasedir $words)} && ret=0
+ ;;
+
+ (debug)
+ _values -s , 'debug options' \
+ '(b v i j m)a[all debugging output]' \
+ 'b[basic debugging output]' \
+ '(b)v[one level above basic]' \
+ '(b)i[describe implicit rule searches (implies b)]' \
+ 'j[show details on invocation of subcommands]' \
+ 'm[enable debugging while remaking makefiles]' && ret=0
+ ;;
+
+ (target)
+ file=${(v)opt_args[(I)(-f|--file|--makefile)]}
+ if [[ -n $file ]]
then
- file=${~words[file+1]}
[[ $file == [^/]* ]] && file=${(q)$(_make-findBasedir $words)}/$file
[[ -r $file ]] || file=
else
@@ -222,7 +280,7 @@ _make() {
compadd -S '=' -- ${(k)VARIABLES} && ret=0
done
fi
- fi
+ esac
return ret
}
diff --git a/Completion/Unix/Command/_osc b/Completion/Unix/Command/_osc
deleted file mode 100644
index a18890f5e..000000000
--- a/Completion/Unix/Command/_osc
+++ /dev/null
@@ -1,149 +0,0 @@
-#compdef osc
-#
-# Copyright (C) 2009,2010 Holger Macht <holger@homac.de>
-#
-# This file is released under the GPLv2.
-#
-# Based on the zsh guide from http://zsh.dotsrc.org/Guide/zshguide06.html
-#
-# Toggle verbose completions: zstyle ':completion:*:osc:*' verbose no
-# zstyle ':completion:*:osc-subcommand:*' verbose no
-#
-# Use the variables $ZSH_OSC_BUILD_TARGETS_EXTRA and $ZSH_OSC_PROJECTS_EXTRA to
-# extend the list of possible completions in your ~/.zshrc like that:
-# export OSC_PROJECTS_EXTRA="Base:System Base:shells"
-#
-# version 0.2
-#
-
-OSC_BUILD_TARGETS="openSUSE_11.2 openSUSE_11.3 openSUSE_11.4 openSUSE_12.1 openSUSE_Tumbleweed openSUSE_Factory SLE_11_SP1"
-OSC_PROJECTS="openSUSE:Factory openSUSE:Tumbleweed openSUSE:12.1 openSUSE:11.4 openSUSE:11.2 openSUSE:11.3"
-
-# user defined variables $OSC_BUILD_TARGETS_EXTRA and
-# $OSC_PROJECTS_EXTRA can add to the project/build target list
-OSC_BUILD_TARGETS="$OSC_BUILD_TARGETS $ZSH_OSC_BUILD_TARGETS_EXTRA"
-OSC_PROJECTS="$OSC_PROJECTS $ZSH_OSC_PROJECTS_EXTRA"
-
-# Main dispatcher
-
-_osc() {
- if (( CURRENT > 2 )) && [[ ${words[2]} != "help" ]]; then
- # Remember the subcommand name
- local cmd=${words[2]}
- # Set the context for the subcommand.
- curcontext="${curcontext%:*:*}:osc-subcommand"
- # Narrow the range of words we are looking at to exclude `osc'
- (( CURRENT-- ))
- shift words
- # Run the completion for the subcommand
- if [ "$cmd" = "submitreq" -o "$cmd" = "sr" ]; then
- _osc_cmd_submitreq
- elif [ "$cmd" = "getbinaries" ]; then
- _osc_cmd_getbinaries
- elif [ "$cmd" = "checkout" -o "$cmd" = "co" -o "$cmd" = "branch" ]; then
- _osc_cmd_checkout
- elif [ "$cmd" = "buildlog" -o "$cmd" = "buildinfo" -o "$cmd" = "bl" ]; then
- _osc_cmd_buildlog
- else
- _osc_cmd_do $cmd
- fi
- else
- local hline
- local -a cmdlist
- local tag=0
- _call_program help-commands osc help | while read -A hline; do
- # start parsing with "commands:"
- [[ $hline[1] = "commands:" ]] && tag=1
- # stop parsing at the line starting with "For"
- [[ $hline[1] = "For" ]] && tag=0
- [[ $tag = 0 ]] && continue
- # all commands have to start with lower case letters
- [[ $hline[1] =~ ^[A-Z] ]] && continue
- (( ${#hline} < 2 )) && continue
-
- # ${hline[1]%,} truncates the last ','
- cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
- done
- _describe -t osc-commands 'osc command' cmdlist
- fi
-}
-
-_osc_cmd_getbinaries() {
- _arguments \
- '1:PROJECT:( `echo $OSC_PROJECTS` )' \
- '2:PACKAGE:(PACKAGE)' \
- '3:REPOSITORY:( `echo $OSC_BUILD_TARGETS` )' \
- '4:ARCHITECTURE:(i586 x86_64)'
-}
-
-_osc_cmd_checkout() {
- _arguments \
- '1:PROJECT:( `echo $OSC_PROJECTS` )' \
- '2:PACKAGE:(PACKAGE)'
-}
-
-_osc_cmd_buildlog() {
- _arguments \
- '1:REPOSITORY:( `echo $OSC_BUILD_TARGETS` )' \
- '2:ARCHITECTURE:(i586 x86_64)'
-}
-
-_osc_cmd_submitreq() {
- local hline
- local -a cmdlist
- local tag=0
- _call_program help-commands osc help $cmd | while read -A hline; do
- # start parsing from "usage:"
- [[ $hline[1] = "usage:" ]] && tag=1
- [[ $tag = 0 ]] && continue
-
- if [[ $hline[1] =~ ^osc ]]; then
- shift hline; shift hline
- elif ! [[ $hline[1] =~ ^- ]]; then
- # Option has to start with a '-' or 'osc submitrequest'
- continue
- fi
-
- (( ${#hline} < 2 )) && continue
-
- cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
-
- done
-
- _describe -t osc-commands 'osc command' cmdlist
-}
-
-
-_osc_cmd_do() {
- local hline
- local -a cmdlist
- local tag=0
-
- # only start completion if theres some '-' on the line
- if ! [ "$words[2]" = "-" ]; then
- _complete
- return
- fi
-
- _call_program help-commands osc help $cmd | while read -A hline; do
- # start parsing from "Options:"
- [[ $hline[1] = "Options:" ]] && tag=1
- [[ $tag = 0 ]] && continue
- # Option has to start with a '-'
- [[ $hline[1] =~ ^- ]] || continue
- (( ${#hline} < 2 )) && continue
-
- cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
- done
-
- if [ -n "$cmdlist" ]; then
- _describe -t osc-commands 'osc command' cmdlist
- else
- _complete
- fi
-}
-
-# Code to make sure _osc is run when we load it
-_osc "$@"
-
-
diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce
index d2943472c..bcfe5229a 100644
--- a/Completion/Unix/Command/_perforce
+++ b/Completion/Unix/Command/_perforce
@@ -1401,16 +1401,18 @@ _perforce_jobs() {
if [[ $argv[-2] = -e ]]; then
ajobview=(-e "${(q)argv[-1]}")
argv=("${(@)argv[1,-3]}")
- else
- zstyle -s ":completion:${curcontext}:jobs" jobview jobview &&
- ajobview=(-e $jobview)
+ elif zstyle -s ":completion:${curcontext}:jobs" jobview jobview; then
+ ajobview=(-e "'$jobview'")
+ elif [[ -n $PREFIX ]]; then
+ # Extra quotes for the benefit of _call_program which does an "eval".
+ ajobview=(-e "'job=$PREFIX\\*$SUFFIX'")
fi
if [[ ${NUMERIC:-0} -lt 0 && -z $compstate[insert] ]]; then
# Not inserting (i.e. just listing) and given a negative
# prefix argument. Instead of listing possible completions,
# show the full description for the job which is on the line at
# the moment.
- _message -r "$(_perforce_call_p4 jobs jobs -e \"Job=\$PREFIX\$SUFFIX\" -l 2>/dev/null)"
+ _message -r "$(_perforce_call_p4 jobs jobs -e \"'Job=\$PREFIX\$SUFFIX'\" -l 2>/dev/null)"
return 0
elif [[ ${NUMERIC:-0} -gt 0 ]]; then
max=$NUMERIC
diff --git a/Completion/Unix/Command/_prove b/Completion/Unix/Command/_prove
new file mode 100644
index 000000000..75e83c360
--- /dev/null
+++ b/Completion/Unix/Command/_prove
@@ -0,0 +1,51 @@
+#compdef prove
+#
+# prove(1) of TAP::Harness v3.25. Consider also:
+#
+# zstyle ':completion:*:*:prove:*' file-patterns '*.t:test\ files *(-/):directories'
+
+_arguments \
+ '(- *)'{-h,--help}'[display help and exit]' \
+ '(- *)'{-H,--man}'[display longer help and exit]' \
+ '(- *)--version[display version and exit]' \
+ '(--quiet -q -Q --QUIET)'{-v,--verbose}'[print all test lines]' \
+ {-l,--lib}'[add lib to path]' \
+ {-b,--blib}'[add blib to path]' \
+ '(--reverse)'{-s,--shuffle}'[run tests in random order]' \
+ '(--nocolor)'{-c,--color}'[colored test output]' \
+ '(--color -c)--nocolor[do not color test output]' \
+ '(--nocount)--count[show x/y test count when not verbose]' \
+ '(--count)--nocount[disable x/y test count]' \
+ {-D,--dry}'[dry run]' \
+ '--ext=[set extension for tests]:extension:' \
+ {-f,--failures}'[show failed tests]' \
+ {-o,--comments}'[show comments]' \
+ '--ignore-exit[ignore exit status from test scripts]' \
+ {-m,--merge}'[merge STDERR with STDOUT]' \
+ {-r,--recurse}'[recurse into directories]' \
+ '(-s --shuffle)--reverse[run tests in reverse order]' \
+ '(-v --verbose)'{-q,--quiet}'[suppress some test output]' \
+ '(-v --verbose)'{-Q,--QUIET}'[only print summary results]' \
+ {-p,--parse}'[show full list of TAP parse errors]' \
+ '--directives[only show results for which TODO or SKIP set]' \
+ '--timer[print elapsed time]' \
+ '--trap[trap ctrl-c and print summary on interrupt]' \
+ '--normalize[normalize TAP output in verbose mode]' \
+ '-T[enable tainting checks]' \
+ '-t[enable tainting warnings]' \
+ '-W[enable fatal warnings]' \
+ '-w[enable warnings]' \
+ '--norc[do not process .proverc]' \
+ '*-I=[library paths to include]:libdir:_directories' \
+ '*-P=[load plugin]:plugin:' \
+ '*-M=[load a module]:module:_perl_m_opt' \
+ {-e,--exec}'[interpreter to run the tests]:program: _command_names '{-e,--exec}':*::program arguments: _normal' \
+ '--harness=[define test harness]:harness:' \
+ '--formatter=[result formatter]:formatter:' \
+ '--source=[load or configure a SourceHandler]:source:' \
+ {-a,--archive}'[store output in archive file]:file:_files' \
+ {-j,--jobs}'[run N jobs in parallel]:jobs:' \
+ '*--state=[control persistent state]:state:' \
+ '--rc=[custom rcfile]:file:_files' \
+ '*:file or directory:_files' \
+ && return 0
diff --git a/Completion/Unix/Command/_psutils b/Completion/Unix/Command/_psutils
index b2e713e6d..1dafb46c3 100644
--- a/Completion/Unix/Command/_psutils
+++ b/Completion/Unix/Command/_psutils
@@ -13,16 +13,16 @@ epsffit)
':lower left y:' \
':upper right x:' \
':upper right y:' \
- ':input file:_ps' \
- ':output file:_ps'
+ ':input file:_postscript' \
+ ':output file:_postscript'
;;
psbook)
_arguments \
'-q[quiet mode]' \
'-v[print version]' \
'-s-[signature size]:signature size:' \
- ':input file:_ps' \
- ':output file:_ps'
+ ':input file:_postscript' \
+ ':output file:_postscript'
;;
psnup)
_arguments \
@@ -47,8 +47,8 @@ psnup)
'(-2 -4 -n)-8[8 logical pages on a sheet]' \
'(-2 -4 -8 )-n[n-up]:pages on a sheet:' \
'-t-[layout tolerance]:layout tolerance:' \
- ':input file:_ps' \
- ':output file:_ps'
+ ':input file:_postscript' \
+ ':output file:_postscript'
;;
psresize)
_arguments \
@@ -60,8 +60,8 @@ psresize)
'(-P)-W-[input page width]:input paper width:' \
'(-P)-H-[input page height]:input paper height:' \
'(-W -H)-P-[input page paper]:input paper paper:(a3 a4 a5 b5 letter legal 10x14)' \
- ':input file:_ps' \
- ':output file:_ps'
+ ':input file:_postscript' \
+ ':output file:_postscript'
;;
psselect)
_arguments \
@@ -71,8 +71,8 @@ psselect)
'-o[select odd pages]' \
'-r[reverse order]' \
'-p-[pages]:pages:' \
- ':input file:_ps' \
- ':output file:_ps'
+ ':input file:_postscript' \
+ ':output file:_postscript'
;;
pstops)
_arguments \
@@ -84,28 +84,28 @@ pstops)
'(-p)-h-[page height]:paper height:' \
'(-w -h)-p-[page size]:paper size:(a3 a4 a5 b5 letter legal 10x14)' \
':[modulo\:][-]pageno[L][R][U][@scale][(xoff,yoff)][+|,]...:' \
- ':input file:_ps' \
- ':output file:_ps'
+ ':input file:_postscript' \
+ ':output file:_postscript'
;;
extractres)
_arguments \
'-m[merge]' \
- ':input file:_ps'
+ ':input file:_postscript'
;;
fixmacps)
_arguments \
'-d[directory]:directory:_files -/' \
'-n[name]:name:' \
- ':input file:_ps'
+ ':input file:_postscript'
;;
psmerge)
_arguments \
- '-o-[output file]:output file:_ps' \
+ '-o-[output file]:output file:_postscript' \
'-t[thorough]' \
- '*:input file:_ps'
+ '*:input file:_postscript'
;;
fixdlsrps|fixfmps|fixpsditps|fixpspps|fixscribeps|fixtpps|fixwfwps|fixwpps|fixwwps|includeres)
- _ps
+ _postscript
;;
getafm)
_arguments \
diff --git a/Completion/Unix/Command/_qemu b/Completion/Unix/Command/_qemu
index db4b3a445..8ba7140a1 100644
--- a/Completion/Unix/Command/_qemu
+++ b/Completion/Unix/Command/_qemu
@@ -1,8 +1,8 @@
-#compdef qemu
+#compdef -P qemu(|-system-*)
_qemu_log_items () {
local -a opts hline
- qemu -d \? | while read -A hline; do
+ $service -d \? | while read -A hline; do
[[ $hline[1] = Log ]] && continue
opts=($opts "${hline[1]}[${hline[2,-1]}]")
done
@@ -11,7 +11,7 @@ _qemu_log_items () {
local _qemu_machines
-_qemu_machines=(${${${(f)"$(qemu -M \?)"}[2,-1]}%% *})
+_qemu_machines=(${${${(f)"$($service -M \?)"}[2,-1]}%% *})
_arguments \
'-'{fda,fdb,hda,hdb,hdc,hdd,cdrom}':disk image:_files' \
diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync
index f24a06e47..a531d7df6 100644
--- a/Completion/Unix/Command/_rsync
+++ b/Completion/Unix/Command/_rsync
@@ -74,7 +74,7 @@ _rsync() {
_arguments -s \
'*'{-v,--verbose}'[increase verbosity]' \
{--no-v,--no-verbose}'[turn off --verbose]' \
- '--bwlimit=[limit I/O bandwidth]:KBytes per second' \
+ '--bwlimit=[limit I/O bandwidth]:KBytes (etc.) per second' \
'--port=[specify alternate port number]:port:(873)' \
'--address=[bind to the specified address]:bind address:_bind_addresses' \
'(-T --temp-dir)'{-T,--temp-dir=}'[create temporary files in specified directory]:directory:_directories' \
@@ -137,6 +137,7 @@ _rsync() {
'(-t --times)'{-t,--times}'[preserve times]' \
{--no-t,--no-times}'[turn off --times]' \
'(-O --omit-dir-times)'{-O,--omit-dir-times}'[omit directories when preserving times]' \
+ '(-J --omit-link-times)'{-J,--omit-link-times}'[omit symlinks when preserving times]' \
'--chmod[change destination permissions]:mods' \
'(-S --sparse)'{-S,--sparse}'[handle sparse files efficiently]' \
'(-n --dry-run)'{-n,--dry-run}'[show what would have been transferred]' \
@@ -210,6 +211,16 @@ _rsync() {
'(--only-write-batch)--write-batch=[write a batched update to the specified file]:file:_files' \
'(--write-batch)--only-write-batch=[like --write-batch but w/o updating destination]:file:_files' \
'--protocol=[force an older protocol version to be used]:number' \
+ '--info=[fine-grained informational verbosity]:comma-separated list' \
+ '--debug=[fine-grained debug verbosity]:comma-separated list' \
+ '--munge-links[munge symlinks to make them safer, but unusable]' \
+ '--ignore-missing-args[ignore missing source args without error]' \
+ '--delete-missing-args[delete missing source args from destination]' \
+ '(--usermap --chown)--usermap=[custom username mapping]:comma-separated mappings' \
+ '(--groupmap --chown)--groupmap=[custom groupname mapping]:comma-separated mappings' \
+ '(--usermap --groupmap --chown)--chown=[simple username/groupname mapping]:user and/or group' \
+ '*'{-M=,--remote-option=}'[send option to the remote side only]:option string' \
+ '--preallocate[preallocate the full length of new files]' \
'--iconv=[request charset conversion of filenames]:number' \
'--read-batch=[read a batched update from the specified file]:file:_files'
}
diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed
index 99bd5e82a..476575205 100644
--- a/Completion/Unix/Command/_sed
+++ b/Completion/Unix/Command/_sed
@@ -12,8 +12,10 @@ args=(
if _pick_variant gnu=GNU unix --version; then
args+=(
+ '--follow-symlinks[follow symlinks when processing in place]'
'(-i --in-place)'{-i-,--in-place=-}'[edit files in place]::suffix for backup'
'(-l --line-length)'{-l,--line-length=-}'[specify line-wrap length for the l command]'
+ '(-r)--posix[disable GNU extensions]'
'(-r --regexp-extended)'{-r,--regexp-extended}'[use extended regular expressions]'
'(-s --separate)'{-s,--separate}'[consider files separately instead of as a combined stream]'
'(-u --unbuffered)'{-u,--unbuffered}'[disable data buffering]'
diff --git a/Completion/Unix/Command/_sh b/Completion/Unix/Command/_sh
index 7258e4260..104c7576c 100644
--- a/Completion/Unix/Command/_sh
+++ b/Completion/Unix/Command/_sh
@@ -5,10 +5,7 @@ if [[ $service == zsh ]]; then
if [[ ${words[CURRENT-1]} == -o ]]; then
_options
# no other possibilities
- return 0
- fi
- if _arguments -S -s -- '*:'; then
- return 0
+ return
fi
fi
@@ -25,3 +22,9 @@ else
fi
_default
fi
+
+local ret=$?
+
+[[ $service == zsh ]] && _arguments -S -s -- '*:' && ret=0
+
+return ret
diff --git a/Completion/Unix/Command/_sort b/Completion/Unix/Command/_sort
index 1ea5a6e40..ff36b9b3d 100644
--- a/Completion/Unix/Command/_sort
+++ b/Completion/Unix/Command/_sort
@@ -1,31 +1,37 @@
#compdef sort
-# zsh completions for GNU sort version 5.97
-# limitation: --key does not work exactly right
-local arguments
+local ordering='(-d --dictionary-order -g --general-numeric-sort -M --month-sort -h --human-numeric-sort -n --numeric-sort --sort -V --version-sort --help --version)'
-arguments=(
- '(-b --ignore-leading-blanks)'{-b,--ignore-leading-blanks}'[ignore leading blanks]'
- '(-d --dictionary-order)'{-d,--dictionary-order}'[consider only blanks and alphanumeric characters]'
- '(-f --ignore-case)'{-f,--ignore-case}'[fold lower case to upper case characters]'
- '(-g --general-numeric-sort)'{-g,--general-numeric-sort}'[compare according to general numeric value]'
- '(-i --ignore-nonprinting)'{-i,--ignore-nonprinting}'[consider only printable characters]'
- '(-M --month-sort)'{-M,--month-sort}"[compare (unknown) < 'JAN' < ... < 'DEC']"
- '(-n --numeric-sort)'{-n,--numeric-sort}'[compare according to string numerical value]'
- '(-r --reverse)'{-r,--reverse}'[reverse the result of comparisons]'
- '(-c --check)'{-c,--check}'[check whether input is sorted; do not sort]'
- '(-k --key)'{-k+,--key=}'[start a key at POS1, end it as POS2 (origin 1)]:key:'
- '(-m --merge)'{-m,--merge}'[merge already sorted files; do not sort]'
- '(-o --output)'{-o+,--output=}'[write result to FILE instead of standard output]:filename:_files'
- '(-s --stable)'{-s+,--stable=}'[stabilize sort by disabling last-resort comparison]'
- '(-S --buffer-size)'{-S+,--buffer-size=}'[use SIZE for main memory buffer]:size:'
- '(-t --field-separator)'{-t+,--field-separator=}'[use SEP instead of non-blank to blank transition]:separator:'
- '(-T --temporary-directory)'{-T+,--temporary-directory=}'[use DIR for temporaries, not $TMPDIR or /tmp; multiple options specify multiple directories]:directory'
- '(-u --unique)'{-u,--unique}'[with -c, check for strict ordering; without -c, output only the first of an equal run]'
- '(-z --zero-terminated)'{-z,--zero-terminated}'[end lines with 0 byte, not newline]'
- --help'[display help and exit]'
- --version'[output version information and exit]'
- '*:filename:_files'
- )
-
-_arguments -s $arguments
+_arguments -s -S \
+ '(-b --ignore-leading-blanks)'{-b,--ignore-leading-blanks}'[ignore leading blanks]' \
+ "$ordering"{-d,--dictionary-order}'[consider only blanks and alphanumeric characters]' \
+ '(-f --ignore-case)'{-f,--ignore-case}'[fold lower case to upper case characters]' \
+ "$ordering"{-g,--general-numeric-sort}'[compare according to general numeric value]' \
+ '(-i --ignore-nonprinting)'{-i,--ignore-nonprinting}'[consider only printable characters]' \
+ "$ordering"{-M,--month-sort}"[compare (unknown) < 'JAN' < ... < 'DEC']" \
+ "$ordering"{-h,--human-numeric-sort}'[compare human readable numbers (e.g., 2K 1G)]' \
+ "$ordering"{-n,--numeric-sort}'[compare according to string numerical value]' \
+ "$ordering"{-R,--random-sort}'[sort by random hash of keys]' \
+ '--random-source=[get random bytes from file]:file:_files' \
+ '(-r --reverse)'{-r,--reverse}'[reverse the result of comparisons]' \
+ "$ordering--sort=[sort according to ordering]:ordering:(general-numeric human-numeric month numeric random version)" \
+ "$ordering"{-V,--version-sort}'[sort version numbers]' \
+ '--batch-size=[maximum inputs to merge]:number' \
+ '(-c --check -C)'{-c,-C}'[check whether input is sorted; do not sort]' \
+ '(-c --check -C)--check=-[check whether input is sorted; do not sort]::bad line handling:(diagnose-first silent quiet)' \
+ '--compress-program=[specify program to compress temporary files with]:program:(gzip bzip2 lzop xz)' \
+ '--debug[annotate the of the line used to sort]' \
+ '--files0-from=[read input files from file]:file:_files' \
+ '(-k --key)'{-k+,--key=}'[start a key at POS1, end it as POS2 (origin 1)]:key' \
+ '(-m --merge)'{-m,--merge}'[merge already sorted files; do not sort]' \
+ '(-o --output)'{-o+,--output=}'[write result to file instead of standard output]:output file:_files' \
+ '(-s --stable)'{-s,--stable}'[preserve original order of lines with the same key]' \
+ '(-S --buffer-size)'{-S+,--buffer-size=}'[specify size for main memory buffer]:size' \
+ '(-t --field-separator)'{-t+,--field-separator=}'[specify field separator instead of non-blank to blank transition]:separator' \
+ \*{-T+,--temporary-directory=}'[specify directory for temporary files]:directory:_directories' \
+ '(-u --unique)'{-u,--unique}'[with -c, check for strict ordering; without -c, output only the first of an equal run]' \
+ '--parallel=[set number of sorts run concurrently]:number' \
+ '(-z --zero-terminated)'{-z,--zero-terminated}'[end lines with 0 byte, not newline]' \
+ '(- *)--help[display help and exit]' \
+ '(- *)--version[output version information and exit]' \
+ '*:file:_files'
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 7e85e2bb6..3e499b8d0 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -519,7 +519,7 @@ _ssh () {
fi
;;
file)
- if compset -P '*:'; then
+ if compset -P '[^./][^/]#:'; then
_remote_files -- ssh ${(kv)~opt_args[(I)-[FP1246]]/-P/-p} && ret=0
elif compset -P '*@'; then
suf=( -S '' )
diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index 11d0b69e4..597f2325c 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -20,7 +20,7 @@ _svn () {
typeset -gHA _svn_cmds
if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then
_svn_cmds=(
- ${=${(f)${${"$(LC_ALL=C _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
+ ${=${(f)${${"$(_comp_locale; _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
)
_store_cache svn-cmds _svn_cmds
fi
@@ -41,14 +41,14 @@ _svn () {
if _cache_invalid svn-${cmd}-usage || \
! _retrieve_cache svn-${cmd}-usage;
then
- usage=${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] }
+ usage=${${(M)${(f)"$(_comp_locale; _call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] }
_store_cache svn-${cmd}-usage usage
fi
if _cache_invalid svn-${cmd}-usage || \
! _retrieve_cache svn-${cmd}-args;
then
args=(
- ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]}
+ ${=${${${(M)${(f)"$(_comp_locale; _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]}
)
while (( idx=$args[(I)*--c(l|hangelist):arg:] )); do
args[(I)*--c(l|hangelist):arg:]=( \*{--cl,--changelist}':change list:_svn_changelists' )
@@ -157,7 +157,7 @@ _svnadmin () {
if [[ -n $state ]] && (( ! $+_svnadmin_cmds )); then
typeset -gHA _svnadmin_cmds
_svnadmin_cmds=(
- ${=${(f)${${"$(LC_ALL=C _call_program commands svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([-a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
+ ${=${(f)${${"$(_comp_locale; _call_program commands svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([-a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
)
fi
@@ -172,9 +172,9 @@ _svnadmin () {
if (( $#cmd )); then
curcontext="${curcontext%:*:*}:svnadmin-${cmd}:"
- usage=${${(M)${(f)"$(LC_ALL=C _call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd }
+ usage=${${(M)${(f)"$(_comp_locale; _call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd }
args=(
- ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svnadmin help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
+ ${=${${${(M)${(f)"$(_comp_locale; _call_program options svnadmin help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}
)
if [[ $usage == *REPOS_PATH* ]]; then
args+=( ":path:_files -/" )
@@ -319,7 +319,7 @@ _svn_props() {
_svn_changelists() {
local cls
- cls=( ${${${(M)${(f)"$(LC_ALL=C _call_program changelists svn status 2>/dev/null)"}:#--- Changelist*}%??}##*\'} )
+ cls=( ${${${(M)${(f)"$(_comp_locale; _call_program changelists svn status 2>/dev/null)"}:#--- Changelist*}%??}##*\'} )
compadd "$@" -a cls && return 0
}
diff --git a/Completion/Unix/Command/_systemd b/Completion/Unix/Command/_systemd
index c9fc38a5e..1aae4688b 100644
--- a/Completion/Unix/Command/_systemd
+++ b/Completion/Unix/Command/_systemd
@@ -121,11 +121,14 @@ _hosts_or_user_at_host()
"rescue:Enter system rescue mode"
"emergency:Enter system emergency mode"
"halt:Shut down and halt the system"
- "suspend:Suspend 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"
+ "switch-root:Change to a different root file system"
+ "suspend:Suspend the system"
+ "hibernate:Hibernate the system"
+ "hibernate-sleep:Hibernate and suspend the system"
)
if (( CURRENT == 1 )); then
@@ -331,6 +334,13 @@ done
(( $+functions[_systemctl_link] )) || _systemctl_link() { _files }
+(( $+functions[_systemctl_switch-root] )) || _systemctl_switch-root()
+{
+ if (( CURRENT == 2 )); then
+ _directories
+ fi
+}
+
# no systemctl completion for:
# [STANDALONE]='daemon-reexec daemon-reload default dot dump
# emergency exit halt kexec list-jobs list-units
diff --git a/Completion/Unix/Command/_twisted b/Completion/Unix/Command/_twisted
index b3b242729..70cb89ecd 100644
--- a/Completion/Unix/Command/_twisted
+++ b/Completion/Unix/Command/_twisted
@@ -1,86 +1,33 @@
-#compdef trial conch mktap cftp tapconvert twistd ckeygen lore pyhtmlizer websetroot tap2deb tkmktap tkconch manhole tap2rpm
-
-# Copyright (c) 2005 Eric Mangold
-# Maintainer: Eric Mangold <teratorn@twistedmatrix.com>
-
-# This file is meant to be in your zsh function path. i.e. in one of those
-# directories listed in your $fpath variable.
+#compdef twistd trial conch cftp tapconvert ckeygen lore pyhtmlizer tap2deb tkconch manhole tap2rpm
#
-# e.g. /usr/local/share/zsh/site-functions/
+# This is the ZSH completion file for Twisted commands. It calls the current
+# command-line with the special "--_shell-completion" option which is handled
+# by twisted.python.usage. t.p.usage then generates zsh code on stdout to
+# handle the completions for this particular command-line.
#
-# It is responsible for passing completion control to the correct
-# completion function for the version of Twisted that is
-# currently in use.
+# 3rd parties that wish to provide zsh completion for commands that
+# use t.p.usage may copy this file and change the first line to reference
+# the name(s) of their command(s).
#
-# Goals:
-#
-# We want to detect any changes to PYTHONPATH since the last time we ran.
-# That way we can re-locate the completion functions so that we are sure
-# to be completing for the right version of Twisted.
-
-local dir old_fpath python_code run shebang
-
-function debug () {
- echo $@ >> /tmp/twisted_stub_debug
-}
-
-#debug "START _twisted_stub"
-
-function load_twisted_completions() {
- [[ -z $commands[twistd] ]] && echo 'ERROR: test command "twistd" not found in path' && return 1
- shebang=$(head -1 $commands[twistd])
- [[ $shebang != \#\!* ]] && echo 'ERROR: invalid shebang line for test script "twistd"' && return 1
- PYTHON=$shebang[3,-1] # strip #! off the shebang
- PYTHON=${PYTHON# *} # remove any spaces between #! and command
-
- #debug PYTHON $PYTHON:q
- python_code='
-import twisted, os.path
-dir = os.path.dirname(twisted.__file__)
-print os.path.join(dir, "python", "zsh")
-'
- dir=$(${=PYTHON} -c "$python_code")
- #debug "Trying to load twisted functions from $dir:q"
- if [[ -r $dir/_twistd ]]; then
- old_fpath=($fpath)
- fpath=( $dir $fpath )
- autoload +X _trial _conch _mktap _cftp _tapconvert _twistd _ckeygen
- autoload +X _lore _pyhtmlizer _websetroot _tap2deb _tkmktap _tkconch
- autoload +X _manhole _tap2rpm
- fpath=($old_fpath)
- else
- echo 'ERROR: Cannot find twisted completion function files in $dir:q'
- return 1
- fi
-}
-
-function twisted_run () {
- # run completion function for current command
- # the :t modifier strips off any leading pathname components
- eval _$words[1]:t
-}
-
-function twisted_save_load_run () {
- # save PYTHONPATH, load twisted completions, and run the completion
- # function for the current command
- load_twisted_completions && twisted_run && PYTHONPATH_last=$PYTHONPATH
-}
-
-
-if [[ -n $PYTHONPATH_last ]]; then
- #debug "PYTHONPATH_last is set to $PYTHONPATH_last"
- #check if it's the same as the last time we ran
- if [[ $PYTHONPATH == $PYTHONPATH_last ]]; then
- #debug "PYTHONPATH == PYTHONPATH_last"
- # it's the same, which means we've already loaded completion
- # functions and nothing has changed.
- twisted_run
- else
- twisted_save_load_run
- fi
+# This file is included in the official Zsh distribution as
+# Completion/Unix/Command/_twisted
+
+# redirect stderr to /dev/null otherwise deprecation warnings may get puked all
+# over the user's terminal if completing options for a deprecated command.
+# Redirect stderr to a file to debug errors.
+local cmd output
+cmd=("$words[@]" --_shell-completion zsh:$CURRENT)
+output=$("$cmd[@]" 2>/dev/null)
+
+if [[ $output == "#compdef "* ]]; then
+ # Looks like we got a valid completion function - so eval it to produce
+ # the completion matches.
+ eval $output
else
- twisted_save_load_run
+ echo "\nCompletion error running command:" ${(qqq)cmd}
+ echo -n "If output below is unhelpful you may need to edit this file and "
+ echo "redirect stderr to a file."
+ echo "Expected completion function, but instead got:"
+ echo $output
+ return 1
fi
-
-#debug "END _twisted_stub"
-#
diff --git a/Completion/Unix/Command/_vcsh b/Completion/Unix/Command/_vcsh
index 89588e4b2..47dbd9e69 100644
--- a/Completion/Unix/Command/_vcsh
+++ b/Completion/Unix/Command/_vcsh
@@ -1,18 +1,135 @@
#compdef vcsh
-_arguments \
- ':subcommand:((
- clone\:"clone from repo"
- help\:"display help"
- delete\:"delete repo"
- enter\:"Enter repo; spawn new \$SHELL"
- init\:"init & clone from repo"
- list\:"list all repos"
- list-tracked\:"list all files tracked by vcsh"
- list-tracked-by\:"list files tracked by a repo"
- rename\:"rename repo"
- run\:"run command on repo"
- setup\:"set up repo with recommended settings"
- write-gitignore\:"write .gitignore.d/foo via git ls-files"
- \<REPO\>\:"Run git command directly"
- ))'
+function __vcsh_repositories () {
+ local expl
+ local -a repos
+ repos=( ${(f)"$(command vcsh list)"} )
+ _describe -t repos 'repositories' repos
+}
+
+function __vcsh_not_implemented_yet () {
+ _message "Subcommand completion '${1#*-}': not implemented yet"
+}
+
+function _vcsh-clone () {
+ __vcsh_not_implemented_yet "$0" #TODO
+}
+
+function _vcsh-delete () {
+ (( CURRENT == 2 )) && __vcsh_repositories
+}
+
+function _vcsh-enter () {
+ (( CURRENT == 2 )) && __vcsh_repositories
+}
+
+function _vcsh-help () {
+ _nothing
+}
+
+function _vcsh-init () {
+ _nothing
+}
+
+function _vcsh-list () {
+ _nothing
+}
+
+function _vcsh-list-tracked () {
+ _nothing
+}
+
+function _vcsh-list-tracked-by () {
+ (( CURRENT == 2 )) && __vcsh_repositories
+}
+
+function _vcsh-pull () {
+ _nothing
+}
+
+function _vcsh-push () {
+ _nothing
+}
+
+function _vcsh-rename () {
+ (( CURRENT == 2 )) && __vcsh_repositories
+ (( CURRENT == 3 )) && _message "new repository name"
+ (( CURRENT > 3 )) && _nothing
+}
+
+function _vcsh-run () {
+ (( CURRENT == 2 )) && __vcsh_repositories
+ if (( CURRENT >= 3 )); then
+ words=( "${(@)words[3,-1]}" )
+ (( CURRENT -= 2 ))
+ _complete
+ fi
+}
+
+function _vcsh-upgrade () {
+ (( CURRENT == 2 )) && __vcsh_repositories
+}
+
+function _vcsh-version () {
+ _nothing
+}
+
+function _vcsh-which () {
+ _files
+}
+
+function _vcsh-write-gitignore () {
+ (( CURRENT == 2 )) && __vcsh_repositories
+}
+
+function _vcsh () {
+ local curcontext="${curcontext}"
+ local state vcshcommand
+ local -a args subcommands
+
+ subcommands=(
+ "clone:clone an existing repository"
+ "delete:delete an existing repository"
+ "enter:enter repository; spawn new <\$SHELL>"
+ "help:display help"
+ "init:initialize an empty repository"
+ "list:list all local vcsh repositories"
+ "list-tracked:list all files tracked by vcsh"
+ "list-tracked-by:list files tracked by a repository"
+ "pull:pull from all vcsh remotes"
+ "rename:rename a repository"
+ "run:run command with <\$GIT_DIR> and <\$GIT_WORK_TREE> set"
+ "upgrade:upgrade repository to currently recommended settings"
+ "version:print version information"
+ "which:find <substring> in name of any tracked file"
+ "write-gitignore:write .gitignore.d/<repo> via git ls-files"
+ )
+
+ args=(
+ '-c[source <file> prior to other configuration files]:config files:_path_files'
+ '-d[enable debug mode]'
+ '-v[enable verbose mode]'
+ '*:: :->subcommand_or_options_or_repo'
+ )
+
+ _arguments -C ${args} && return
+
+ if [[ ${state} == "subcommand_or_options_or_repo" ]]; then
+ if (( CURRENT == 1 )); then
+ _describe -t subcommands 'vcsh sub-commands' subcommands
+ __vcsh_repositories
+ else
+ vcshcommand="${words[1]}"
+ if ! (( ${+functions[_vcsh-$vcshcommand]} )); then
+ # There is no handler function, so this is probably the name
+ # of a repository. Act accordingly.
+ _dispatch git git
+ else
+ curcontext="${curcontext%:*:*}:vcsh-${vcshcommand}:"
+ _call_function ret _vcsh-${vcshcommand}
+ fi
+ fi
+ fi
+}
+
+_vcsh "$@"
diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget
index 51d640d62..f709a0830 100644
--- a/Completion/Unix/Command/_wget
+++ b/Completion/Unix/Command/_wget
@@ -17,13 +17,14 @@ _arguments -C -s \
'(--input-file -i)'{--input-file=,-i+}'[specify input file]:file containing URLs:_files' \
'(--force-html -F)'{--force-html,-F}'[treat input file as html]' \
'(--base -B)'{--base=,-B+}'[prepend URL to relative links]:base URL:_urls' \
+ '--config=[specify config file]:config file:_files' \
'(--tries -t)'{--tries=,-t+}'[set number of retries]:number of retries' \
'--retry-connrefused[retry even if connection is refused]' \
'(--output-document -O)'{--output-document=,-O+}'[specify file to write documents to]:output file:_files' \
'(--continue -c)'{--continue,-c}'[continue getting an existing file]' \
- '--content-disposition[honor the Content-Disposition header when choosing local file names]' \
'--progress=[set progress gauge type]:gauge type:->gauge' \
'(--timestamping -N)'{--timestamping,-N}'[retrieve only files newer than existing]' \
+ "--no-use-server-timestamps[don't set the local file's timestamp by the one on the server]" \
'(--server-response -S)'{--server-response,-S}'[print server response]' \
"--spider[don't download anything]" \
'(--timeout -T)'{--timeout=,-T+}'[set all timeout values]:timeout (seconds)' \
@@ -40,11 +41,16 @@ _arguments -C -s \
'--limit-rate=[specify limit to download rate]:download rate limit' \
'--no-dns-cache[disable caching DNS lookups]' \
'--restrict-file-names=[restrict chars in file names to ones OS allows]:OS:->restrict' \
+ '--ignore-case[ignore case when matching files/directories]' \
'(-4 --inet4-only -6 --inet6-only)'{-4,--inet4-only}'[connect only to IPv4 addresses]' \
'(-4 --inet4-only -6 --inet6-only)'{-6,--inet6-only}'[connect only to IPv6 addresses]' \
'--prefer-family[connect first to addresses of specified family]:address family:(IPv6 IPv4 none)' \
'(--http-user --ftp-user)--user[set both ftp and http user]:user' \
'(--http-password --ftp-password)--password[set both ftp and http password]:password' \
+ '--no-iri[turn off IRI support]' \
+ '--local-encoding=[specify local encoding for IRIs]:encoding' \
+ '--remote-encoding=[specify default remote encoding]:encoding' \
+ '--unlink[remove file before clobber]' \
'(--force-directories -x)'{--force-directories,-x}'[force creation of directories]' \
'--protocol-directories[use protocol name in directories]' \
'(--directory-prefix -P)'{--directory-prefix=,-P+}'[specify prefix to save files to]:prefix:_files -/' \
@@ -52,7 +58,8 @@ _arguments -C -s \
'(--user)--http-user=:user' \
'(--password)--http-password=:password' \
'--no-cache[disallow server-cached data]' \
- '(--html-extension -E)'{--html-extension,-E}'[save all HTML documents with a .html extension]' \
+ '--default-page=[specify default page name, normally index.html]' \
+ '(--adjust-extension -E)'{--adjust-extension,-E}'[save all HTML/CSS documents with proper extensions]' \
"--ignore-length[ignore \`Content-Length' header field]" \
'*--header=:string' \
'--proxy-user=:user' \
@@ -61,12 +68,14 @@ _arguments -C -s \
'--save-headers[save http headers]' \
'(--user-agent -U)'{--user-agent=,-U+}'[specify user agent to identify as]:user-agent' \
'--no-http-keep-alive[disable HTTP keep-alive]' \
- '--no-cookies=[turn cookies off]' \
+ '--no-cookies[turn cookies off]' \
'--load-cookies=[specify file to load cookies from]:cookie file:_files' \
'--save-cookies=[specify file to save cookies to]:cookie file:_files' \
'--keep-session-cookies[load and save session cookies]' \
'--post-data=[use the POST method with specified data]:data to send' \
'--post-file=[use the POST method; sending contents of a file]:file:_files' \
+ '--content-disposition[honor the Content-Disposition header when choosing local file names]' \
+ "--auth-no-challenge[send basic HTTP authentication without first waiting for server's challenge]" \
'--secure-protocol=[choose secure protocol]:protocol:(SSLv2 SSLv3 TLSv1)' \
"--no-check-certificate=[don't check the server certificate]" \
'--certificate=[specify client certificate]:client certificate file:_files' \
@@ -89,7 +98,7 @@ _arguments -C -s \
'--delete-after' \
'(--convert-links -k)'{--convert-links,-k}'[convert links to be relative]' \
'(--backup-converted -K)'{--backup-converted,-K}'[backup files before conversion]' \
- '(--mirror -m -r -N -l)'{--mirror,-m}'[mirror (-r -N -l inf -nr)]' \
+ '(--mirror -m -r -N -l)'{--mirror,-m}'[mirror (-r -N -l inf --no-remove-listing)]' \
'(--page-requisites -p)'{--page-requisites,-p}'[get all images needed to display page]' \
'--strict-comments[turn on strict (SGML) handling of HTML comments]' \
'(--accept -A)'{--accept=,-A+}'[specify accepted extensions]:extensions' \
@@ -102,9 +111,10 @@ _arguments -C -s \
'(--span-hosts -H)'{--span-hosts,-H}'[span hosts]' \
'(--relative -L)'{--relative,-L}'[follow relative links only]' \
'(--include-directories -I)'{--include-directories=,-I+}'[include directories]:allowed directories' \
+ '--trust-server-names' \
'(--exclude-directories -X)'{--exclude-directories=,-X+}'[exclude directories]:excluded directories' \
+ '(-np --no-parent)'{-np,--no-parent}"[don't ascend to parent directory]" \
'--no-host-lookup' \
- '--no-parent' \
'--no-verbose' \
'--no-clobber' \
'--no-directories' \
diff --git a/Completion/Unix/Command/_xmlsoft b/Completion/Unix/Command/_xmlsoft
index ed5bfe7f7..67ba6c001 100644
--- a/Completion/Unix/Command/_xmlsoft
+++ b/Completion/Unix/Command/_xmlsoft
@@ -66,13 +66,14 @@ case $service in
'--recover[output what was parsable on broken XML documents]' \
'--huge[remove any internal arbitrary parser limits]' \
'--noent[substitute entity references by their value]' \
+ '--noenc[ignore any encoding specified inside the document]' \
"(--output -o)--noout[don't output the result tree]" \
'--path[provide a set of paths for resources]:paths:_files -/' \
'--load-trace[print trace of all external entites loaded]' \
'--nonet[refuse to fetch DTDs or entities over network]' \
+ '--nocompact[do not generate compact text nodes]' \
'--htmlout[output results as HTML]' \
'--nowrap[do not put HTML doc wrapper]' \
- '--nocompact[do not generate compact text nodes]' \
'--valid[validate the document in addition to std well-formed check]' \
'(--dtdvalid --relaxng --schema)--postvalid[do a posteriori validation, i.e after parsing]' \
'(--postvalid --relaxng --schema --dtdvalidfpi)--dtdvalid[do a posteriori validation against a given DTD]:DTD:_webbrowser' \
@@ -84,27 +85,28 @@ case $service in
'--compress[turn on gzip compression of output]' \
'--html[use the HTML parser]' \
'--xmlout[use the XML serializer when using --html]' \
+ '--nodefdtd[do not default HTML doctype]' \
'--push[use the push mode of the parser]' \
'--memory[parse from memory]' \
- '--maxmem[imits memory allocation]:bytes' \
+ '--maxmem[limit memory allocation]:bytes' \
'--nowarning[do not emit warnings from parser/validator]' \
'--noblanks[drop (ignorable?) blanks spaces]' \
'--nocdata[replace cdata section with text nodes]' \
'--format[reformat/reindent the input]' \
'--encode[output in the given encoding]:encoding:(${encoding[@]})' \
'--dropdtd[remove the DOCTYPE of the input docs]' \
+ "--pretty[pretty-print in a particular style]:style:((0\:don't\ pretty\ print 1\:reformat 2\:add\ whitespace))" \
'--c14n[save in W3C canonical format]' \
'--c14n11[save in W3C canonical format v1.1 (with comments)]' \
'--exc-c14n[save in W3C exclusive canonical format]' \
'--nsclean[remove redundant namespace declarations]' \
- '--testIO[test user I/O support]' \
'(--nocatalogs)--catalogs[use SGML catalogs]' \
'(--catalogs)--nocatalogs[deactivate all catalogs]' \
'--auto[generate a small doc on the fly]' \
'(--noxincludenode)--xinclude[do XInclude processing]' \
'(--xinclude)--noxincludenode[do XInclude processing but do not generate XInclude nodes]' \
- '--loaddtd[fetch external DTD]' \
'--nofixup-base-uris[do not fixup xml:base uris]' \
+ '--loaddtd[fetch external DTD]' \
'--dtdattr[loaddtd + populate the tree with inherited attributes]' \
'--stream[use the streaming interface to process very large files]' \
'--walker[create a reader and walk though the resulting doc]' \
@@ -116,7 +118,7 @@ case $service in
'--sax1[use the old SAX1 interfaces for processing]' \
'--sax[do not build a tree but work just at the SAX level]' \
'--oldxml10[use XML-1.0 parsing rules before the 5th edition]' \
- '--xpath[evaluate the XPath expression, inply --noout]:XPath expression:' \
+ '(--noout)--xpath[evaluate the XPath expression, implies --noout]:XPath expression' \
'*:XML file:_webbrowser' && return
;;
*XML_CATALOG_FILES*)
@@ -125,7 +127,7 @@ case $service in
_urls
return
fi
-
+
compset -S ':*'
_alternative \
'files:catalog file:_files' \
@@ -134,5 +136,3 @@ case $service in
esac
return 1
-
-
diff --git a/Completion/Unix/Type/.distfiles b/Completion/Unix/Type/.distfiles
index a817695f4..ea0baa7c7 100644
--- a/Completion/Unix/Type/.distfiles
+++ b/Completion/Unix/Type/.distfiles
@@ -34,8 +34,8 @@ _perl_basepods
_perl_modules
_pids
_ports
+_postscript
_printers
-_ps
_ps1234
_pspdf
_remote_files
diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files
index 0a2715814..0f6fcd6ff 100644
--- a/Completion/Unix/Type/_files
+++ b/Completion/Unix/Type/_files
@@ -8,7 +8,7 @@ zparseopts -a opts \
type="${(@j::M)${(@)tmp#-}#?}"
if (( $tmp[(I)-g*] )); then
- glob="${${${${(@M)tmp:#-g*}#-g}##[[:blank:]]#}%%[[:blank:]]#}"
+ glob="${${${(@)${(@M)tmp:#-g*}#-g}##[[:blank:]]#}%%[[:blank:]]#}"
[[ "$glob" = *[^\\][[:blank:]]* ]] &&
glob="{${glob//(#b)([^\\])[[:blank:]]##/${match[1]},}}"
diff --git a/Completion/Unix/Type/_java_class b/Completion/Unix/Type/_java_class
index 020128823..0e30e550c 100644
--- a/Completion/Unix/Type/_java_class
+++ b/Completion/Unix/Type/_java_class
@@ -15,7 +15,7 @@ classpath="${${classpath[2]:-${CLASSPATH:-.}}//\\:/:}"
for i in "${(s.:.)classpath}"; do
[[ -z $i ]] && i=.
if [[ -f $i ]] && [[ "$i" == *.(jar|zip|war|ear) ]]; then
- c+=( ${${${(M)$(_call_program jar_classes jar -tf $i)##*.class}%%.class}:gs#/#.#} )
+ c+=( ${${${(M)$(_call_program jar_classes jar -tf $i 2>/dev/null)##*.class}%%.class}:gs#/#.#} )
elif [[ -d $i ]]; then
c+=( $i/**/*.class(.:r:s/.class//:s#$i/##:gs#/#.#) )
fi
diff --git a/Completion/Unix/Type/_ps b/Completion/Unix/Type/_postscript
index 792a39b89..792a39b89 100644
--- a/Completion/Unix/Type/_ps
+++ b/Completion/Unix/Type/_postscript
diff --git a/Completion/Unix/Type/_terminals b/Completion/Unix/Type/_terminals
index 59f8d4d87..04ece1167 100644
--- a/Completion/Unix/Type/_terminals
+++ b/Completion/Unix/Type/_terminals
@@ -2,7 +2,7 @@
local desc expl
-desc=( $TERMINFO ~/.terminfo $TERMINFO_DIRS /usr/{,share/}{,lib/}terminfo )
+desc=( $TERMINFO ~/.terminfo $TERMINFO_DIRS /usr/{,share/}{,lib/}terminfo /{etc,lib}/terminfo )
_wanted terminals expl 'terminal name' \
compadd "$@" - $desc/*/*(N:t)
diff --git a/Completion/X/Command/_mplayer b/Completion/X/Command/_mplayer
index 81669fc1c..eaf6e84bc 100644
--- a/Completion/X/Command/_mplayer
+++ b/Completion/X/Command/_mplayer
@@ -114,8 +114,8 @@ case "$state" in
mfiles)
_tags files urls
while _tags; do
- _requested files expl 'video file' _files -g \
- "*.(#i)(asf|asx|avi|flac|flv|m1v|m2p|m2v|m4v|mjpg|mka|mkv|mov|mp3|mp4|mpe|mpeg|mpg|ogg|ogm|qt|rm|vob|wav|webm|wma|wmv)(-.)" && ret=0
+ _requested files expl 'media file' _files -g \
+ "*.(#i)(asf|asx|avi|flac|flv|m1v|m2p|m2v|m4v|mjpg|mka|mkv|mov|mp3|mp4|mpe|mpeg|mpg|ogg|ogm|ogv|qt|rm|ts|vob|wav|webm|wma|wmv)(-.)" && ret=0
if _requested urls; then
while _next_label urls expl URL; do
_urls "$expl[@]" && ret=0
diff --git a/Completion/X/Command/_xrandr b/Completion/X/Command/_xrandr
index 2e51d0d23..9d9323c69 100644
--- a/Completion/X/Command/_xrandr
+++ b/Completion/X/Command/_xrandr
@@ -1,13 +1,9 @@
#compdef xrandr
-local context state line
-typeset -A opt_args
-local outputs modes expl
-# User configurable. TODO -- styles?
-outputs=(LVDS1 TV1 VGA1)
-modes=(1280x800 1024x768 800x600 640x480)
+local curcontext="$curcontext" state line expl
+typeset -A opt_args
-_arguments \
+_arguments -C \
'(-d -display)'{-d,-display}':X display:_x_display' \
'-help[display help]' \
'(-o --orientation)'{-o,--orientation}':rotation:(normal inverted left right 0 1 2 3)' \
@@ -25,18 +21,18 @@ _arguments \
'--fb:size:' \
'--fbmm:size:' \
'--dpi:dpi:' \
- "*--output:output to reconfigure:($outputs)" \
+ "*--output:output to reconfigure:->outputs" \
'*--auto' \
- "*--mode:mode:($modes)" \
+ "*--mode:mode:->modes" \
'*--preferred' \
'*--pos:position:' \
'*--reflect:axes:(normal x y xy)' \
'*--rotate:rotation:(normal inverted left right)' \
- "*--left-of:relative position to:($outputs)" \
- "*--right-of:relative position to:($outputs)" \
- "*--above:relative position to:($outputs)" \
- "*--below:relative position to:($outputs)" \
- "*--same-as:relative position to:($outputs)" \
+ "*--left-of:relative position to:->outputs" \
+ "*--right-of:relative position to:->outputs" \
+ "*--above:relative position to:->outputs" \
+ "*--below:relative position to:->outputs" \
+ "*--same-as:relative position to:->outputs" \
'*--set:property:(Backlight scaling\ mode):value:->value' \
'*--scale:output scaling:' \
'*--transform:transformation matrix:' \
@@ -48,15 +44,25 @@ _arguments \
'--noprimary' \
'*--newmode:name: :clock MHz: :hdisp: :hsync-start: :hsync-end: :htotal: :vdisp: :vsync-start: :vsync-end: :vtotal:' \
'*--rmmode:Mode name:' \
- "*--addmode:output:($outputs):name:" \
- "*--delmode:output:($outputs):name:" \
+ "*--addmode:output:->outputs:name" \
+ "*--delmode:output:->outputs:name" \
&& return 0
-if [[ $state == value ]]; then
+case $state in
+ value)
case $words[CURRENT-1] in
- (scaling* mode)
- _description value expl "output property 'scaling mode'"
- compadd "$@" "$expl[@]" None Full Center Full\ aspect && return 0
- ;;
+ (scaling* mode)
+ _description value expl "output property 'scaling mode'"
+ compadd "$@" "$expl[@]" None Full Center Full\ aspect && return 0
+ ;;
esac
-fi
+ ;;
+ outputs)
+ _wanted outputs expl output compadd \
+ ${(uo)${(M)${(f)"$(_call_program outputs xrandr)"}:#* connected*}%% *} && return 0
+ ;;
+ modes)
+ _wanted modes expl mode compadd \
+ ${(Mun)$(_call_program modes xrandr):#[0-9]##x[0-9]##} && return 0
+ ;;
+esac
diff --git a/Completion/Zsh/Command/_cd b/Completion/Zsh/Command/_cd
index 476947f60..a5d328fc5 100644
--- a/Completion/Zsh/Command/_cd
+++ b/Completion/Zsh/Command/_cd
@@ -51,6 +51,18 @@ else
_directory_stack && ret=0
fi
+ local -a tmpWpath
+ if [[ $PREFIX = (|*/)../* ]]; then
+ local tmpprefix
+ # Use cd in a subshell to properly [not] resolve symlinks
+ tmpprefix=$(cd ${PREFIX%/*} >&/dev/null && print $PWD)
+ if [[ -n $tmpprefix ]]; then
+ tmpWpath=(-W $tmpprefix)
+ IPREFIX=${IPREFIX}${PREFIX%/*}/
+ PREFIX=${PREFIX##*/}
+ fi
+ fi
+
if [[ $PREFIX != (\~|/|./|../)* ]]; then
local tmpcdpath alt
@@ -88,7 +100,7 @@ else
# already handled by _command_names (see _autocd)
[[ CURRENT -ne 1 || ( -z "$path[(r).]" && $PREFIX != */* ) ]] &&
- alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files -/" "$alt[@]" )
+ alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files $tmpWpath -/" "$alt[@]" )
if [[ CURRENT -eq argstart && noopts -eq 0 && $PREFIX = -* ]] &&
zstyle -t ":completion:${curcontext}:options" complete-options; then
@@ -100,7 +112,7 @@ else
return ret
fi
[[ CURRENT -ne 1 ]] && _wanted directories expl directory \
- _path_files -/ && ret=0
+ _path_files $tmpWpath -/ && ret=0
return ret
fi
diff --git a/Completion/Zsh/Command/_disable b/Completion/Zsh/Command/_disable
index 3b627fb5f..52b82a6e9 100644
--- a/Completion/Zsh/Command/_disable
+++ b/Completion/Zsh/Command/_disable
@@ -1,9 +1,16 @@
#compdef disable
+local -a ali_arr sali_arr func_arr
+
+ali_arr=(${(k)aliases} ${(k)galiases})
+sali_arr=(${(k)saliases})
+func_arr=(${(k)functions})
+
_arguments -C -s -A "-*" -S \
- "(-f -r -s)-a[act on regular or global aliases]:*:regular or global aliases:(${(k)aliases} ${(k)galiases})" \
- "(-a -r -s)-f[act on functions]:*:functions:(${(k)functions})" \
- "(-a -f -s)-r[act on reserved words]:*:reserved-words:compadd -k reswords" \
- "(-a -f -r)-s[act on suffix aliases]:*:suffix aliases:(${(k)saliases})" \
+ "(-f -r -s -p)-a[act on regular or global aliases]:*:regular or global aliases:compadd -k ali_arr" \
+ "(-a -r -s -p)-f[act on functions]:*:functions:compadd -k func_arr" \
+ "(-a -f -s -p)-r[act on reserved words]:*:reserved-words:compadd -k reswords" \
+ "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:compadd -k sali_arr" \
+ "(-a -f -r -s)-p[act on pattern characters]:*:pattern characters:compadd -k patchars" \
'-m[treat arguments as patterns]' \
"*:builtin command:(${(k)builtins})"
diff --git a/Completion/Zsh/Command/_enable b/Completion/Zsh/Command/_enable
index c5f8b2c43..9410651b7 100644
--- a/Completion/Zsh/Command/_enable
+++ b/Completion/Zsh/Command/_enable
@@ -1,8 +1,16 @@
#compdef enable
+local -a ali_arr sali_arr func_arr
+
+ali_arr=(${(k)dis_aliases} ${(k)dis_galiases})
+sali_arr=(${(k)dis_saliases})
+func_arr=(${(k)dis_functions})
+
_arguments -C -s -A "-*" -S \
- "(-f -r)-a[act on aliases]:*:aliases:(${(k)dis_aliases})" \
- "(-a -r)-f[act on functions]:*:functions:(${(k)dis_functions})" \
- "(-a -f)-r[act on reserved words]:*:reserved-words:compadd -k dis_reswords" \
+ "(-f -r -s -p)-a[act on regular or global aliases]:*:aliases:compadd -k ali_arr" \
+ "(-a -r -s -p)-f[act on functions]:*:functions:compadd -k func_arr" \
+ "(-a -f -s -p)-r[act on reserved words]:*:reserved-words:compadd -k dis_reswords" \
+ "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:compadd -k sali_arr" \
+ "(-a -f -r -s)-p[act on pattern characters]:*:pattern characters:compadd -k dis_patchars" \
'-m[treat arguments as patterns]' \
"*:builtin command:(${(k)dis_builtins})"
diff --git a/Completion/Zsh/Command/_fc b/Completion/Zsh/Command/_fc
index bcbb4928e..2af5980c2 100644
--- a/Completion/Zsh/Command/_fc
+++ b/Completion/Zsh/Command/_fc
@@ -3,17 +3,21 @@
local fc_common fc_hist fc_r
fc_common=(
- '(-A -R -W -I)-r[reverse order of the commands]'
- '(-A -R -W -I -e)-n[suppress line numbers]'
- '(-A -R -W -I)*::commands:_command_names -e' )
+ '(-A -R -W -I -p -P)-r[reverse order of the commands]'
+ '(-A -R -W -I -e -p -P)-n[suppress line numbers]'
+ '(-A -R -W -I -p -P)*::commands:_command_names -e' )
fc_hist=(
- '(-A -R -W -I)-m[treat first argument as a pattern]'
- '(-A -R -W -I -e -f -E -i)-d[print time-stamps]'
- '(-A -R -W -I -e -d -E -i)-f[mm/dd/yyyy format time-stamps]'
- '(-A -R -W -I -e -d -f -i)-E[dd.mm.yyyy format time-stamps]'
- '(-A -R -W -I -e -d -f -E)-i[yyyy-mm-dd format time-stamps]'
- '(-A -R -W -I -e)-D[print elapsed times]' )
+ '(-A -R -W -I -p -p)-m[treat first argument as a pattern]'
+ '(-A -R -W -I -e -f -E -i -t -p -P)-d[print time-stamps]'
+ '(-A -R -W -I -e -d -E -i -t -p -P)-f[mm/dd/yyyy format time-stamps]'
+ '(-A -R -W -I -e -d -f -i -t -p -P)-E[dd.mm.yyyy format time-stamps]'
+ '(-A -R -W -I -e -d -f -E -t -p -P)-i[yyyy-mm-dd format time-stamps]'
+ '(-A -R -W -I -e -d -f -E -i -p -P)-t[print time-stamps in specified format]:date format'
+ '(-A -R -W -I -e -p -P)-D[print elapsed times]'
+ '(- *)-p[push current history to stack]:history file:_files:history size: :saved history size'
+ '(- *)-P[pop history from stack]'
+)
fc_r='(-A -R -W -I -e)-l[list resulting commands on stdout]'
@@ -26,11 +30,11 @@ case $service in
;;
*)
_arguments -s -S \
- '(-A -R -W -I -l -n -d -f -E -i -D)-e[specify editor to invoke]:editor to invoke:_command_names -e' \
- '(-l -m -e -r -n -d -f -E -i -D -A -W *)-R[read history from file]:history file:_files' \
- '(-l -m -e -r -n -d -f -E -i -D -R -W *)-A[append history to file]:history file:_files' \
- '(-l -m -e -r -n -d -f -E -i -D -R -A *)-W[write history to file]:history file:_files' \
- '(-l -m -e -r -n -d -f -E -i -D -A -W *)-I[read/write new events only]:history file:_files' \
+ '(-A -R -W -I -l -n -d -f -E -i -D -p -P)-e[specify editor to invoke]:editor to invoke:_command_names -e' \
+ '(-l -m -e -r -n -d -f -E -i -D -A -W -p -P *)-R[read history from file]:history file:_files' \
+ '(-l -m -e -r -n -d -f -E -i -D -R -W -p -P *)-A[append history to file]:history file:_files' \
+ '(-l -m -e -r -n -d -f -E -i -D -R -A -p -P *)-W[write history to file]:history file:_files' \
+ '(-l -m -e -r -n -d -f -E -i -D -A -W -p -P *)-I[read/write new events only]:history file:_files' \
"$fc_common[@]" "$fc_hist[@]" "$fc_r" && return 0
;;
esac
diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset
index d44783d64..0920e3fb5 100644
--- a/Completion/Zsh/Command/_typeset
+++ b/Completion/Zsh/Command/_typeset
@@ -12,7 +12,9 @@ allargs=(
F "($fopts -A -E -L -R -T -U -Z -a -i -m)-F[floating point, use fixed point decimal on output]"
L "($fopts -A -E -F -i)-L+[left justify and remove leading blanks from value]:width"
R "($fopts -A -E -F -i)-R+[right justify and fill with leading blanks]:width"
- T "($fopts -A -E -F -a -g -h -i -l -m -t)-T[tie scalar to array]"
+ T "($fopts -A -E -F -a -g -h -i -l -m -t)-T[tie scalar to array or trace function]"
+ Tf "($popts -t)-T[trace execution of this function only]"
+ Tp "($fopts -A -E -F -a -g -h -i -l -m -t)-T[tie scalar to array]"
U '(-A -E -F -i)-U[keep array values unique and suppress alias expansion for functions]'
Uf '-U[suppress alias expansion for functions]'
Up '(-E -F -i)-+U[keep array values unique]'
@@ -49,7 +51,7 @@ case ${service} in
;;
float) use="EFHghlprtux";;
functions)
- use="Ukmtuz"
+ use="UkmTtuz"
func=f
;;
integer)
@@ -64,6 +66,12 @@ esac
[[ -z "${words[(r)-*[aA]*]}" ]] || func=p
[[ -z "${words[(r)-*f*]}" ]] || func=f
+# This function uses whacky features of _arguments which means we
+# need to look for options to the command beforehand.
+local onopts offopts
+onopts=${(j..)${${words[1,CURRENT-1]:#^-*}##-}}
+offopts=${(j..)${${words[1,CURRENT-1]:#^+*}##+}}
+
for ((i=1;i<=$#use;++i)); do
args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[Uut]]:+$func}]} )
done
@@ -81,6 +89,22 @@ if [[ "$state" = vars_eq ]]; then
funckeys=(${(k)functions})
args=(${args:|funckeys})
_wanted functions expl 'shell function' compadd -a args
+ elif [[ -n $onopts$offopts ]]; then
+ if [[ -n $offopts ]]; then
+ args=(${(f)"$(functions +$offopts)"})
+ else
+ args=(${(k)functions})
+ fi
+ if [[ -n $onopts ]]; then
+ local -a funckeys
+ funckeys=(${(f)"$(functions +$onopts)"})
+ args=(${args:|funckeys})
+ fi
+ if zstyle -t ":completion:${curcontext}:functions" prefix-needed &&
+ [[ $PREFIX != [_.]* ]]; then
+ args=(${args:#_*})
+ fi
+ _wanted functions expl 'shell functions' compadd -a args
else
_functions
fi
diff --git a/Completion/Zsh/Context/_math b/Completion/Zsh/Context/_math
index 278189ebe..f82f1c0fb 100644
--- a/Completion/Zsh/Context/_math
+++ b/Completion/Zsh/Context/_math
@@ -9,4 +9,6 @@ if [[ "$SUFFIX" = *[^a-zA-Z0-9_]* ]]; then
SUFFIX="${SUFFIX%%[^a-zA-Z0-9_]*}"
fi
-_parameters -g '(integer|float)*' || _parameters
+_alternative 'math-parameters:math parameter: _math_params' \
+ 'user-math-functions:user math function: _user_math_func' \
+ 'module-math-functions:math function from zsh/mathfunc: _module_math_func'
diff --git a/Completion/Zsh/Context/_zcalc_line b/Completion/Zsh/Context/_zcalc_line
index 76e5b4b25..50fb8c17c 100644
--- a/Completion/Zsh/Context/_zcalc_line
+++ b/Completion/Zsh/Context/_zcalc_line
@@ -13,7 +13,7 @@ _zcalc_line_escapes() {
"eng:engineering (power of 1000) output format"
"raw:raw output format"
"local:make variables local"
- "function:define math function"
+ "function:define math function (also \:func or \:f)"
)
cmds=("\:"${^cmds})
_describe -t command-escapes "command escapes" cmds -Q
diff --git a/Completion/Zsh/Type/.distfiles b/Completion/Zsh/Type/.distfiles
index 74a4e101d..4011353a0 100644
--- a/Completion/Zsh/Type/.distfiles
+++ b/Completion/Zsh/Type/.distfiles
@@ -15,10 +15,13 @@ _jobs
_jobs_bg
_jobs_fg
_limits
+_math_params
+_module_math_func
_options
_options_set
_options_unset
_parameters
_suffix_alias_files
+_user_math_func
_vars
'
diff --git a/Completion/Zsh/Type/_math_params b/Completion/Zsh/Type/_math_params
new file mode 100644
index 000000000..8a4b9e1b6
--- /dev/null
+++ b/Completion/Zsh/Type/_math_params
@@ -0,0 +1,3 @@
+#autoload
+
+_parameters -g '(integer|float)*' || _parameters
diff --git a/Completion/Zsh/Type/_module_math_func b/Completion/Zsh/Type/_module_math_func
new file mode 100644
index 000000000..4df8d9714
--- /dev/null
+++ b/Completion/Zsh/Type/_module_math_func
@@ -0,0 +1,9 @@
+#autoload
+
+local expl
+local -a funcs
+
+funcs=(${${${(f)"$(zmodload -Fl zsh/mathfunc 2>/dev/null)"}:#^+f:*}##+f:})
+
+_wanted module-math-functions expl 'math function from zsh/mathfunc' \
+ compadd -S '(' "$@" -a funcs
diff --git a/Completion/Zsh/Type/_user_math_func b/Completion/Zsh/Type/_user_math_func
new file mode 100644
index 000000000..16774f70b
--- /dev/null
+++ b/Completion/Zsh/Type/_user_math_func
@@ -0,0 +1,9 @@
+#autoload
+
+local expl
+local -a funcs
+
+funcs=(${${${(f)"$(functions -M)"}##functions -M }%% *})
+
+_wanted user-math-functions expl 'user math function' \
+ compadd -S '(' "$@" -a funcs
diff --git a/Completion/bashcompinit b/Completion/bashcompinit
index 6cc3be580..902fa88a8 100644
--- a/Completion/bashcompinit
+++ b/Completion/bashcompinit
@@ -3,9 +3,9 @@
_bash_complete() {
local ret=1
local -a suf matches
- local COMP_POINT COMP_CWORD
+ local -x COMP_POINT COMP_CWORD
local -a COMP_WORDS COMPREPLY BASH_VERSINFO
- local COMP_LINE="$words"
+ local -x COMP_LINE="$words"
local -A savejobstates savejobtexts
(( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX ))
diff --git a/Completion/compaudit b/Completion/compaudit
index 72e0b62ba..75742a0fb 100644
--- a/Completion/compaudit
+++ b/Completion/compaudit
@@ -82,18 +82,45 @@ fi
[[ $_i_fail == use ]] && return 0
+# We will always allow files to be owned by root and the owner of the
+# present process.
+local _i_owners="u0u${EUID}"
+
+# Places we will look for a link to the executable
+local -a _i_exes
+_i_exes=(
+ /proc/$$/exe
+ /proc/$$/object/a.out
+ )
+local _i_exe
+
+# If we can find out who owns the executable, we will allow files to
+# be owned by that user, too. The argument is that if you don't trust
+# the owner of the executable, it's way too late to worry about it now...
+for _i_exe in $_i_exes; do
+ if [[ -e $_i_exe ]] ;then
+ if zmodload -F zsh/stat b:zstat 2>/dev/null; then
+ local -A _i_stathash
+ if zstat -H _i_stathash /proc/$$/exe &&
+ [[ $_i_stathash[uid] -ne 0 ]]; then
+ _i_owners+="u${_i_stathash[uid]}"
+ fi
+ fi
+ break
+ fi
+done
+
# We search for:
-# - world/group-writable directories in fpath not owned by root and the user
+# - world/group-writable directories in fpath not owned by $_i_owners
# - parent-directories of directories in fpath that are world/group-writable
-# and not owned by root and the user (that would allow someone to put a
+# and not owned by $_i_owners (that would allow someone to put a
# digest file for one of the directories into the parent directory)
-# - digest files for one of the directories in fpath not owned by root and
-# the user
-# - and for files in directories from fpath not owned by root and the user
+# - digest files for one of the directories in fpath not owned by $_i_owners
+# - and for files in directories from fpath not owned by $_i_owners
# (including zwc files)
-_i_wdirs=( ${^fpath}(N-f:g+w:,-f:o+w:,-^u0u${EUID})
- ${^fpath:h}(N-f:g+w:,-f:o+w:,-^u0u${EUID}) )
+_i_wdirs=( ${^fpath}(N-f:g+w:,-f:o+w:,-^${_i_owners})
+ ${^fpath:h}(N-f:g+w:,-f:o+w:,-^${_i_owners}) )
# RedHat Linux "per-user groups" check. This is tricky, because it's very
# difficult to tell whether the sysadmin has put someone else into your
@@ -111,7 +138,7 @@ if (( $#_i_wdirs )); then
if [[ $GROUP == $LOGNAME && ( -z $GROUPMEM || $GROUPMEM == $LOGNAME ) ]]
then
- _i_wdirs=( ${^_i_wdirs}(N-f:g+w:^g:${GROUP}:,-f:o+w:,-^u0u${EUID}) )
+ _i_wdirs=( ${^_i_wdirs}(N-f:g+w:^g:${GROUP}:,-f:o+w:,-^${_i_owners}) )
fi
fi
@@ -122,8 +149,8 @@ then
_i_wdirs=( ${_i_wdirs:#/usr/local/*} ${^_i_ulwdirs}(Nf:g+ws:^g:staff:,f:o+w:,^u0) )
fi
-_i_wdirs=( $_i_wdirs ${^fpath}.zwc^([^_]*|*~)(N-^u0u${EUID}) )
-_i_wfiles=( ${^fpath}/^([^_]*|*~)(N-^u0u${EUID}) )
+_i_wdirs=( $_i_wdirs ${^fpath}.zwc^([^_]*|*~)(N-^${_i_owners}) )
+_i_wfiles=( ${^fpath}/^([^_]*|*~)(N-^${_i_owners}) )
case "${#_i_wdirs}:${#_i_wfiles}" in
(0:0) _i_q= ;;
diff --git a/Completion/compinit b/Completion/compinit
index 7b8a34619..f9d2c574c 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -163,8 +163,9 @@ _comp_options=(
typeset -g _comp_setup='local -A _comp_caller_options;
_comp_caller_options=(${(kv)options[@]});
- setopt localoptions localtraps ${_comp_options[@]};
+ setopt localoptions localtraps localpatterns ${_comp_options[@]};
local IFS=$'\'\ \\t\\r\\n\\0\''
+ enable -p \| \~ \( \? \* \[ \< \^ \#
exec </dev/null;
trap - ZERR
local -a reply
diff --git a/Completion/openSUSE/Command/_osc b/Completion/openSUSE/Command/_osc
index a18890f5e..97263da7d 100644
--- a/Completion/openSUSE/Command/_osc
+++ b/Completion/openSUSE/Command/_osc
@@ -16,8 +16,8 @@
# version 0.2
#
-OSC_BUILD_TARGETS="openSUSE_11.2 openSUSE_11.3 openSUSE_11.4 openSUSE_12.1 openSUSE_Tumbleweed openSUSE_Factory SLE_11_SP1"
-OSC_PROJECTS="openSUSE:Factory openSUSE:Tumbleweed openSUSE:12.1 openSUSE:11.4 openSUSE:11.2 openSUSE:11.3"
+OSC_BUILD_TARGETS="openSUSE_12.1 openSUSE_12.2 openSUSE_12.3 openSUSE_Tumbleweed openSUSE_Factory SLE_11_SP2"
+OSC_PROJECTS="openSUSE:Factory openSUSE:Tumbleweed openSUSE:12.3 openSUSE:12.2 openSUSE:12.1"
# user defined variables $OSC_BUILD_TARGETS_EXTRA and
# $OSC_PROJECTS_EXTRA can add to the project/build target list
diff --git a/Completion/openSUSE/Command/_zypper b/Completion/openSUSE/Command/_zypper
index 03818eaa5..4f2477a41 100644
--- a/Completion/openSUSE/Command/_zypper
+++ b/Completion/openSUSE/Command/_zypper
@@ -28,11 +28,10 @@ _zypper() {
local hline
local -a cmdlist
local tag=0
- _call_program help-commands zypper help | while read -A hline; do
+ _call_program help-commands LANG=C zypper help | sed -e ':a;N;$!ba;s/\n\t\t\t\t/ /g' | while read -A hline; do
# start parsing with "Global Options:"
[[ $hline =~ "^Global Options:" ]] && tag=1
[[ $tag = 0 ]] && continue
- [[ $hline[1] =~ ^\t\t\t\t ]] && continue
# all commands have to start with lower case letters
[[ $hline[1] =~ ^[A-Z] ]] && continue
(( ${#hline} < 2 )) && continue
@@ -51,7 +50,7 @@ _zypper_cmd_do() {
local hline
local -a cmdlist
local tag=0
- _call_program help-commands zypper help $cmd | while read -A hline; do
+ _call_program help-commands LANG=C zypper help $cmd | while read -A hline; do
# start parsing from "Options:"
[[ $hline =~ "^Command options:" ]] && tag=1
[[ $tag = 0 ]] && continue
diff --git a/Config/version.mk b/Config/version.mk
index eca41f444..351a29602 100644
--- a/Config/version.mk
+++ b/Config/version.mk
@@ -27,5 +27,5 @@
# This must also serve as a shell script, so do not add spaces around the
# `=' signs.
-VERSION=5.0.2
-VERSION_DATE='December 21, 2012'
+VERSION=5.0.2-test-1
+VERSION_DATE='November 6, 2013'
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index f3a7f6a97..b23ce3083 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -28,6 +28,40 @@ See ifzman(the section `Zle Builtins' in zmanref(zshzle))\
ifnzman(noderef(Zle Builtins)).
)\
)\
+
+Some shell builtin commands take options as described in individual
+entries; these are often referred to in the list below as `tt(flags)' to
+avoid confusion with shell options, which may also have an effect on the
+behaviour of builtin commands. In this introductory section,
+`tt(option)' always has the meaning of an option to a command that should
+be familiar to most command line users.
+
+Typically, options are single letters preceded by a hyphen (tt(-)).
+Options that take an argument accept it either immediately following the
+option letter or after white space, for example `tt(print -C3 *)' or
+`tt(print -C 3 *)' are equivalent. Arguments to options are not the
+same as arguments to the command; the documentation indicates which is
+which. Options that do not take an argument may be combined in a single
+word, for example `tt(print -ca *)' and `tt(print -c -a *)' are
+equivalent.
+
+Some shell builtin commands also take options that begin with `tt(+)'
+instead of `tt(-)'. The list below makes clear which commands these
+are.
+
+Options (together with their individual arguments, if any) must appear
+in a group before any non-option arguments; once the first non-option
+argument has been found, option processing is terminated.
+
+All builtin commands other than precommand modifiers, even those that
+have no options, can be given the argument `tt(--)' to terminate option
+processing. This indicates that the following words are non-option
+arguments, but is otherwise ignored. This is useful in cases where
+arguments to the command may begin with `tt(-)'. For historical
+reasons, most builtin commands also recognize a single `tt(-)' in a
+separate word for this purpose; note that this is less standard and
+use of `tt(--) is recommended.
+
startitem()
prefix(-)
findex(.)
@@ -68,7 +102,7 @@ to be checked for alias expansion. If the tt(-g) flag is present,
define a global alias; global aliases are expanded even if they do not
occur in command position.
-If the tt(-s) flags is present, define a suffix alias: if the command
+If the tt(-s) flag is present, define a suffix alias: if the command
word on a command line is in the form `var(text)tt(.)var(name)', where
var(text) is any non-empty string, it is replaced by the text
`var(value) var(text)tt(.)var(name)'. Note that var(name) is treated as
@@ -277,7 +311,9 @@ item(tt(-c))(
clear the directory stack.
)
item(tt(-l))(
-print directory names in full instead of using of using tt(~) expressions.
+print directory names in full instead of using of using tt(~) expressions (\
+ifzman(see em(Dynamic) and em(Static named directories) in zmanref(zshexpn))\
+ifnzman(noderef(Filename Expansion))).
)
item(tt(-p))(
print directory entries one per line.
@@ -291,8 +327,8 @@ enditem()
findex(disable)
cindex(disabling commands)
cindex(commands, disabling)
-item(tt(disable) [ tt(-afmrs) ] var(name) ...)(
-Temporarily disable the var(name)d hash table elements. The default
+item(tt(disable) [ tt(-afmprs) ] var(name) ...)(
+Temporarily disable the var(name)d hash table elements or patterns. The default
is to disable builtin commands. This allows you to use an external
command with the same name as a builtin command. The tt(-a) option
causes tt(disable) to act on regular or global aliases. The tt(-s)
@@ -305,6 +341,80 @@ quoted to prevent them from undergoing filename expansion), and all hash
table elements from the corresponding hash table matching these patterns
are disabled. Disabled objects can be enabled with the tt(enable)
command.
+
+With the option tt(-p), var(name) ... refer to elements of the
+shell's pattern syntax as described in noderef(Filename Generation).
+Certain elements can be disabled separately, as given below.
+
+Note that patterns
+not allowed by the current settings for the options tt(EXTENDED_GLOB),
+tt(KSH_GLOB) and tt(SH_GLOB) are never enabled, regardless of the
+setting here. For example, if tt(EXTENDED_GLOB) is not active,
+the pattern tt(^) is ineffective even if `tt(disable -p "^")' has
+not been issued. The list below indicates any option settings
+that restrict the use of the pattern. It should be noted that
+setting tt(SH_GLOB) has a wider effect then merely disabling patterns
+as certain expressions, in particular those involving parentheses,
+are parsed differently.
+
+The following patterns may be disabled; all
+the strings need quoting on the command line to prevent them from
+being interpreted immediately as patterns and the patterns are
+shown below in single quotes as a reminder.
+startitem()
+item(tt('?'))(
+The pattern character tt(?) wherever it occurs, including when preceding
+a parenthesis with tt(KSH_GLOB).
+)
+item(tt('*'))(
+The pattern character tt(*) wherever it occurs, including recursive
+globbing and when preceding a parenthesis with tt(KSH_GLOB).
+)
+item('LSQUARE()')(
+Character classes.
+)
+item(tt('<') (tt(NO_SH_GLOB)))(
+Numeric ranges.
+)
+item(tt('|') (tt(NO_SH_GLOB)))(
+Alternation in grouped patterns, case statements, or KSH_GLOB
+parenthesised expressions.
+)
+item(tt('LPAR()') (tt(NO_SH_GLOB)))(
+Grouping using single parentheses. Disabling this does not disable the
+use of parentheses for tt(KSH_GLOB) where they are introduced by a
+special character, nor for glob qualifiers (use `tt(setopt
+NO_BARE_GLOB_QUAL)' to disable glob qualifiers that use parentheses
+only).
+)
+item(tt('~') (tt(EXTENDED_GLOB)))(
+Exclusion in the form var(A)tt(~)var(B).
+)
+item(tt('^') (tt(EXTENDED_GLOB)))(
+Exclusion in the form var(A)tt(^)var(B).
+)
+item(tt('#') (tt(EXTENDED_GLOB)))(
+The pattern character tt(#) wherever it occurs, both for
+repetition of a previous pattern and for indicating globbing flags.
+)
+item(tt('?LPAR()') (tt(KSH_GLOB)))(
+The grouping form tt(?LPAR())var(...)tt(RPAR()). Note this is also
+disabled if tt('?') is disabled.
+)
+item(tt('*LPAR()') (tt(KSH_GLOB)))(
+The grouping form tt(*LPAR())var(...)tt(RPAR()). Note this is also
+disabled if tt('*') is disabled.
+)
+item(tt('PLUS()LPAR()') (tt(KSH_GLOB)))(
+The grouping form tt(PLUS()LPAR())var(...)tt(RPAR()).
+)
+item(tt('!LPAR()') (tt(KSH_GLOB)))(
+The grouping form tt(!LPAR())var(...)tt(RPAR()).
+)
+item(tt('@LPAR()') (tt(KSH_GLOB)))(
+The grouping form tt(@LPAR())var(...)tt(RPAR()).
+)
+enditem()
)
findex(disown)
cindex(jobs, disowning)
@@ -376,7 +486,9 @@ the section COMPATIBILITY in zmanref(zsh)
ifnzman(\
noderef(Compatibility)
)\
-.
+. In addition to setting shell options, the command also restores
+the pristine state of pattern enables, as if all patterns had been
+enabled using tt(enable -p).
If the tt(emulate) command occurs inside a function that has been
marked for execution tracing with tt(functions -t) then the tt(xtrace)
@@ -390,9 +502,11 @@ 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) 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
+the options tt(LOCAL_OPTIONS), tt(LOCAL_PATTERNS) and tt(LOCAL_TRAPS)
+will be set as
+well, causing the effects of the tt(emulate) command and any tt(setopt),
+tt(disable -p) or tt(enable -p), 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) switch is mutually exclusive with the
use of tt(-c) in var(flags).
@@ -414,7 +528,8 @@ 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) switch, if present) and all
-options are set before entry to the function, and restored after exit.
+options are set (and pattern disables cleared)
+before entry to the function, and the state is 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
within another function with the same sticky emulation, entry and exit
@@ -471,7 +586,7 @@ endsitem()
findex(enable)
cindex(enabling commands)
cindex(commands, enabling)
-item(tt(enable) [ tt(-afmrs) ] var(name) ...)(
+item(tt(enable) [ tt(-afmprs) ] var(name) ...)(
Enable the var(name)d hash table elements, presumably disabled
earlier with tt(disable). The default is to enable builtin commands.
The tt(-a) option causes tt(enable) to act on regular or global aliases.
@@ -483,6 +598,13 @@ printed. With the tt(-m) flag the arguments are taken as patterns
(should be quoted) and all hash table elements from the corresponding
hash table matching these patterns are enabled. Enabled objects can be
disabled with the tt(disable) builtin command.
+
+tt(enable -p) reenables patterns disabled with tt(disable -p). Note
+that it does not override globbing options; for example, `tt(enable -p
+"~")' does not cause the pattern character tt(~) to be active unless
+the tt(EXTENDED_GLOB) option is also set. To enable all possible
+patterns (so that they may be invidually disabled with tt(disable -p)),
+use `tt(setopt EXTENDED_GLOB KSH_GLOB NO_SH_GLOB)'.
)
findex(eval)
cindex(evaluating arguments as commands)
@@ -507,6 +629,11 @@ is specified, use the exit status from the last command executed.
pindex(IGNORE_EOF, use of)
An EOF condition will also cause the shell to exit, unless
the tt(IGNORE_EOF) option is set.
+
+See notes at the end of
+ifzman(the section JOBS in in zmanref(zshmisc))\
+ifnzman(noderef(Jobs & Signals)) for some possibly unexpected interactions
+of the tt(exit) command with jobs.
)
findex(export)
item(tt(export) [ var(name)[tt(=)var(value)] ... ])(
@@ -876,15 +1003,19 @@ sitem(tt(cputime))(Maximum CPU seconds per process.)
sitem(tt(datasize))(Maximum data size (including stack) for each process.)
sitem(tt(descriptors))(Maximum value for a file descriptor.)
sitem(tt(filesize))(Largest single file allowed.)
+sitem(tt(kqueues))(Maximum number of kqueues allocated.)
sitem(tt(maxproc))(Maximum number of processes.)
sitem(tt(maxpthreads))(Maximum number of threads per process.)
sitem(tt(memorylocked))(Maximum amount of memory locked in RAM.)
sitem(tt(memoryuse))(Maximum resident set size.)
sitem(tt(msgqueue))(Maximum number of bytes in POSIX message queues.)
+sitem(tt(posixlocks))(Maximum number of POSIX locks per user.)
+sitem(tt(pseudoterminals))(Maximum number of pseudo-terminals.)
sitem(tt(resident))(Maximum resident set size.)
sitem(tt(sigpending))(Maximum number of pending signals.)
sitem(tt(sockbufsize))(Maximum size of all socket buffers.)
sitem(tt(stacksize))(Maximum stack size for each process.)
+sitem(tt(swapsize))(Maximum amount of swap used.)
sitem(tt(vmemorysize))(Maximum amount of virtual memory.)
endsitem()
@@ -1766,7 +1897,7 @@ enditem()
findex(ulimit)
cindex(resource limits)
cindex(limits, resource)
-item(tt(ulimit) [ [ tt(-SHacdfilmnpqrstvx) | tt(-N) var(resource) [ var(limit) ] ... ])(
+item(tt(ulimit) [ [ tt(-SHacdfiklmnpqsTtvwx) | tt(-N) var(resource) [ var(limit) ] ... ])(
Set or display resource limits of the shell and the processes started by
the shell. The value of var(limit) can be a number in the unit specified
below or one of the values `tt(unlimited)', which removes the limit on the
@@ -1797,16 +1928,19 @@ sitem(tt(-c))(512-byte blocks on the size of core dumps.)
sitem(tt(-d))(Kilobytes on the size of the data segment.)
sitem(tt(-f))(512-byte blocks on the size of files written.)
sitem(tt(-i))(The number of pending signals.)
+sitem(tt(-k))(The number of kqueues allocated.)
sitem(tt(-l))(Kilobytes on the size of locked-in memory.)
sitem(tt(-m))(Kilobytes on the size of physical memory.)
sitem(tt(-n))(open file descriptors.)
+sitem(tt(-p))(The number of pseudo-terminals.)
sitem(tt(-q))(Bytes in POSIX message queues.)
sitem(tt(-s))(Kilobytes on the size of the stack.)
+sitem(tt(-T))(The number of simultaneous threads available to the user.)
sitem(tt(-t))(CPU seconds to be used.)
-sitem(tt(-r))(The number of simultaneous threads available to the user.)
sitem(tt(-u))(The number of processes available to the user.)
sitem(tt(-v))(Kilobytes on the size of virtual memory. On some systems this
refers to the limit called `address space'.)
+sitem(tt(-w))(Kilobytes on the size of swapped out memory.)
sitem(tt(-x))(The number of locks on files.)
endsitem()
diff --git a/Doc/Zsh/calsys.yo b/Doc/Zsh/calsys.yo
index 259eb23b3..7dc51ab11 100644
--- a/Doc/Zsh/calsys.yo
+++ b/Doc/Zsh/calsys.yo
@@ -651,16 +651,29 @@ date specification must be quoted to ensure tt(age) receives the correct
arguments, hence the use of the additional colon to separate the date and
time.
-example(AGEREF1=2006/10/04:10:15
+example(AGEREF=2006/10/04:10:15
AGEREF2=2006/10/04:10:45
print *+LPAR()PLUS()age+RPAR())
This shows the same example before using another form of argument
-passing. The dates and times in the parameters tt(AGEREF1) and tt(AGEREF2)
+passing. The dates and times in the parameters tt(AGEREF) and tt(AGEREF2)
stay in effect until unset, but will be overridden if any argument is
passed as an explicit argument to age. Any explicit argument
causes both parameters to be ignored.
+Instead of an explicit date and time, it's possible to use the
+modification time of a file as the date and time for either argument
+by introducing the file name with a colon:
+
+example(print *+LPAR()e-age :file1-+RPAR())
+
+matches all files created on the same day (24 hours starting from
+midnight) as tt(file1).
+
+example(print *+LPAR()e-age :file1 :file2-+RPAR())
+
+matches all files modified no earlier than tt(file1) and
+no later than tt(file2); precision here is to the nearest second.
texinode(Calendar Styles)(Calendar Utility Functions)(Calendar System User Functions)(Calendar Function System)
sect(Styles)
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 2991c1f4a..d42ad9779 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -3470,14 +3470,26 @@ Like tt(_tags) this function supports the tt(-C) option to give a
different name for the argument context field.
)
findex(_arguments)
-item(tt(_arguments) [ tt(-nswWACRS) ] [ tt(-O) var(name) ] [ tt(-M) var(matchspec) ] [ tt(:) ] var(spec) ...)(
-This function can be used to give a complete specification for
-completion for a command whose arguments follow standard UNIX option and
-argument conventions. The following forms specify individual sets of
-options and arguments; to avoid ambiguity, these may be separated from the
-options to tt(_arguments) itself by a single colon. Options to
-tt(_arguments) itself must be in separate words, i.e. tt(-s -w), not
-tt(-sw).
+xitem(tt(_arguments) [ tt(-nswWCRS) ] [ tt(-A) var(pat) ] [ tt(-O) var(name) ] [ tt(-M) var(matchspec) ] [ tt(:) ] var(spec)...)
+item(tt(_arguments) [ var(opts)... ] tt(-)tt(-) [ -i var(pats) ] [ tt(-s) var(pair) ] [ var(helpspec)... ])(
+This function can be used to give a complete specification for completion
+for a command whose arguments follow standard UNIX option and argument
+conventions. Options to tt(_arguments) itself must be in separate words,
+i.e. tt(-s -w), not tt(-sw).
+
+When calling tt(_arguments), all var(spec)s that describe options of the
+analyzed command line must precede all var(spec)s that describe non-option
+(aka "normal") arguments of the analyzed line. To avoid ambiguity, all
+options to tt(_arguments) itself may be separated from the var(spec) forms
+by a single colon.
+
+The tt(-s -w -W -A) and tt(-S) options describe how parsing of the command
+line should proceed, and are discussed in context below. The `tt(-)tt(-)'
+form is used to intuit var(spec) forms from the help output of the command
+being analyzed, and is described in detail below. The var(opts) for the
+`tt(-)tt(-)' form are otherwise the same options as the first form. Note
+that `tt(-s)' following `tt(-)tt(-)' has a distinct meaning from `tt(-s)'
+preceding `tt(-)tt(-)', and both may appear.
With the option tt(-n), tt(_arguments) sets the parameter tt(NORMARG)
to the position of the first normal argument in the tt($words) array,
@@ -3486,6 +3498,17 @@ has not been reached, tt(NORMARG) is set to tt(-1). The caller
should declare `tt(integer NORMARG)' if the tt(-n) option is passed;
otherwise the parameter is not used.
+The option `tt(-M) var(matchspec)' sets a match specification to use to
+completion option names and values. The default var(matchspec) is:
+
+example(tt(r:|[_-]=* r:|=*))
+
+This allows partial word completion after `tt(_)' and `tt(-)', for example
+`-f-b' can be completed to `tt(-foo-bar)'.
+
+Each of the following forms is a var(spec) describing individual sets of
+options or arguments on the command line being analyzed.
+
startitem()
xitem(var(n)tt(:)var(message)tt(:)var(action))
item(var(n)tt(::)var(message)tt(:)var(action))(
@@ -3530,10 +3553,10 @@ suitable for standard GNU options.
The combination of tt(-s) with tt(-w) allows single-letter options to be
combined in a single word even if one or more of the options take
-arguments. For example, if tt(-a) takes an argument, with no
-tt(-s) `tt(-ab)' is considered as a single (unhandled) option; with
-tt(-s) tt(-ab) is an option with the argument `tt(b)'; with both tt(-s)
-and tt(-w), tt(-ab) may be the option tt(-a) and the option tt(-b) with
+arguments. For example, if tt(-x) takes an argument, with no
+tt(-s) `tt(-xy)' is considered as a single (unhandled) option; with
+tt(-s) tt(-xy) is an option with the argument `tt(y)'; with both tt(-s)
+and tt(-w), tt(-xy) may be the option tt(-x) and the option tt(-y) with
arguments still to come.
The option tt(-W) takes this a stage further: it is possible to
@@ -3603,6 +3626,23 @@ enditem()
It is possible for options with a literal `PLUS()' or `tt(=)' to
appear, but that character must be quoted, for example `tt(-\+)'.
+The options tt(-S) and tt(-A) are available to simplify the specifications
+for commands with standard option parsing. With tt(-S), no option will be
+completed after a `tt(-)tt(-)' appearing on its own on the line; this
+argument will otherwise be ignored; hence in the line
+
+example(foobar -x -- -y)
+
+the `tt(-x)' is considered an option but the `tt(-y)' is considered an
+argument, while the `tt(-)tt(-)' is considered to be neither.
+
+With tt(-A), no options will be completed after the first non-option
+argument on the line. The tt(-A) must be followed by a pattern matching
+all strings which are not to be taken as arguments. For example, to make
+tt(_arguments) stop completing options after the first normal argument, but
+ignoring all strings starting with a hyphen even if they are not described
+by one of the var(optspec)s, the form is `tt(-A "-*")'.
+
Each var(optarg) following an var(optspec) must take one of the
following forms:
@@ -3676,6 +3716,11 @@ form below, the var(action) will be executed by calling the
tt(_all_labels) function to process all tag labels. No special handling
of tags is needed unless a function call introduces a new one.
+The option `tt(-O) var(name)' specifies the name of an array whose elements
+will be passed as arguments to functions called to execute var(action)s.
+For example, this can be used to pass the same set of options for the
+tt(compadd) builtin to all var(action)s.
+
The forms for var(action) are as follows.
startitem()
@@ -3804,6 +3849,18 @@ Furthermore, during the evaluation of the var(action) the context name in
the tt(curcontext) parameter is altered to append the same string that is
stored in the tt(context) parameter.
+The option tt(-C) tells tt(_arguments) to modify the tt(curcontext)
+parameter for an action of the form `tt(->)var(state)'. This is the
+standard parameter used to keep track of the current context. Here it
+(and not the tt(context) array) should be made local to the calling
+function to avoid passing back the modified value and should be
+initialised to the current value at the start of the function:
+
+example(local curcontext="$curcontext")
+
+This is useful where it is not possible for multiple states to be valid
+together.
+
It is possible to specify multiple sets of options and
arguments with the sets separated by single hyphens. The specifications
before the first hyphen (if any) are shared by all the remaining sets.
@@ -3850,47 +3907,6 @@ A useful alternative is often an option specification with rest-arguments
(as in `tt(-foo:*:...)'); here the option tt(-foo) swallows up all
remaining arguments as described by the var(optarg) definitions.
-The options tt(-S) and tt(-A) are available to simplify the specifications
-for commands with standard option parsing. With tt(-S), no option will be
-completed after a `tt(-)tt(-)' appearing on its own on the line; this
-argument will otherwise be ignored; hence in the line
-
-example(foobar -a -- -b)
-
-the `tt(-a)' is considered an option but the `tt(-b)' is considered an
-argument, while the `tt(-)tt(-)' is considered to be neither.
-
-With tt(-A), no options will be completed after the first non-option
-argument on the line. The tt(-A) must be followed by a pattern matching
-all strings which are not to be taken as arguments. For example, to make
-tt(_arguments) stop completing options after the first normal argument, but
-ignoring all strings starting with a hyphen even if they are not described
-by one of the var(optspec)s, the form is `tt(-A "-*")'.
-
-The option `tt(-O) var(name)' specifies the name of an array whose elements
-will be passed as arguments to functions called to execute var(actions).
-For example, this can be used to pass the same set of options for the
-tt(compadd) builtin to all var(action)s.
-
-The option `tt(-M) var(spec)' sets a match specification to use to
-completion option names and values. It must appear before the first
-argument specification. The default is `tt(r:|[_-]=* r:|=*)': this allows
-partial word completion after `tt(_)' and `tt(-)', for example `-f-b'
-can be completed to `tt(-foo-bar)'.
-
-The option tt(-C) tells tt(_arguments) to modify
-the tt(curcontext) parameter for an action of the form
-`tt(->)var(state)'. This is the standard parameter used to keep track of
-the current context. Here it (and not the tt(context) array) should be
-made local to the calling function
-to avoid passing back the modified value and should be initialised to the
-current value at the start of the function:
-
-example(local curcontext="$curcontext")
-
-This is useful where it is not possible for multiple states to be valid
-together.
-
The option `tt(-)tt(-)' allows tt(_arguments) to work out the names of long
options that support the `tt(-)tt(-help)' option which is standard in many
GNU commands. The command word is called with the argument
@@ -3901,11 +3917,16 @@ the behaviour of the command is unspecified.
In addition to options, `tt(_arguments -)tt(-)' will try to deduce the
types of arguments available for options when the form
`tt(-)tt(-)var(opt)=var(val)' is valid. It is also possible to provide
-hints by examining the help text of the command and adding specifiers of
-the form `var(pattern)tt(:)var(message)tt(:)var(action)'; note that normal
-tt(_arguments) specifiers are not used. The var(pattern) is matched
+hints by examining the help text of the command and adding var(helpspec) of
+the form `var(pattern)tt(:)var(message)tt(:)var(action)'; note that other
+tt(_arguments) var(spec) forms are not used. The var(pattern) is matched
against the help text for an option, and if it matches the var(message) and
-var(action) are used as for other argument specifiers. For example:
+var(action) are used as for other argument specifiers. The special case
+of `tt(*:)' means both var(message) and var(action) are empty, which has
+the effect of causing options having no description in the help output to
+be ordered in listings ahead of options that have a description.
+
+For example:
example(_arguments -- '*\*:toggle:(yes no)' \
'*=FILE*:file:_files' \
@@ -3947,12 +3968,23 @@ will cause completion to ignore the options
useful with GNU tt(configure)).
The `tt(_arguments -)tt(-)' form can also be followed by the option `tt(-s)
-var(pair)' to describe option aliases. Each var(pair) consists of a
-pattern and a replacement. For example, some tt(configure)-scripts
-describe options only as `tt(-)tt(-enable-foo)', but also accept
+var(pair)' to describe option aliases. The var(pair) consists of a list
+of alternating patterns and corresponding replacements, enclosed in parens
+and quoted so that it forms a single argument word in the tt(_arguments)
+call.
+
+For example, some tt(configure)-script help output describes options only
+as `tt(-)tt(-enable-foo)', but the script also accepts the negated form
`tt(-)tt(-disable-foo)'. To allow completion of the second form:
-example(_arguments -- -s "LPAR()#-tt(-enable- -)tt(-disable-RPAR()"))
+example(tt(_arguments -- -s "LPAR()#-)tt(-enable- -)tt(-disable-RPAR()"))
+
+Finally, note that tt(_arguments) generally expects to be the primary
+function handling any completion for which it is used. It may have side
+effects which change the treatment of any matches added by other functions
+called after it. To combine tt(_arguments) with other functions, those
+functions should be called either before tt(_arguments), as an var(action)
+within a var(spec), or in handlers for `tt(->)var(state)' actions.
Here is a more general example of the use of tt(_arguments):
@@ -4251,11 +4283,14 @@ which already contains an expanded description.
The tt(-12VJ) options and the var(group) are passed to tt(compadd) and
hence determine the group the message string is added to.
-The second form gives a description for completions with the tag
-var(tag) to be shown even if there are no matches for that tag. The tag
-can be omitted and if so the tag is taken from the parameter
-tt($curtag); this is maintained by the completion system and so is
-usually correct.
+The second tt(-e) form gives a description for completions with the tag
+var(tag) to be shown even if there are no matches for that tag. This form
+is called by tt(_arguments) in the event that there is no action for an
+option specification. The tag can be omitted and if so the tag is taken
+from the parameter tt($curtag); this is maintained by the completion
+system and so is usually correct. Note that if there are no matches at
+the time this function is called, tt(compstate[insert]) is cleared, so
+additional matches generated later are not inserted on the command line.
)
findex(_multi_parts)
item(tt(_multi_parts) var(sep) var(array))(
@@ -4414,8 +4449,7 @@ tt(ambiguous), tt(special-dirs), tt(list-suffixes) and tt(file-sort)
described above.
)
findex(_pick_variant)
-xitem(tt(_pick_variant) [ tt(-b) var(builtin-label) ] [ tt(-c)
-var(command) ] [ tt(-r) var(name) ])
+xitem(tt(_pick_variant) [ tt(-b) var(builtin-label) ] [ tt(-c) var(command) ] [ tt(-r) var(name) ])
item( var(label)tt(=)var(pattern) ... var(label) [ var(args) ... ])(
This function is used to resolve situations where a single command name
requires more than one type of handling, either because it
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 8dbc095fd..9d3fc7562 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -619,7 +619,7 @@ To load tt(vcs_info):
example(autoload -Uz vcs_info)
It can be used in any existing prompt, because it does not require any
-tt($psvar) entries to be left available.
+specific tt($psvar) entries to be available.
subsect(Quickstart)
@@ -2477,15 +2477,22 @@ See the function tt(modify-current-argument), described below, for
an example of how to call this function.
)
tindex(modify-current-argument)
-item(tt(modify-current-argument) var(expr-using-)tt($ARG))(
+item(tt(modify-current-argument) [ var(expr-using-)tt($ARG) | var(func) ])(
This function provides a simple method of allowing user-defined widgets
to modify the command line argument under the cursor (or immediately to the
-left of the cursor if the cursor is between arguments). The argument
-should be an expression which when evaluated operates on the shell
+left of the cursor if the cursor is between arguments).
+
+The argument can be an expression which when evaluated operates on the shell
parameter tt(ARG), which will have been set to the command line argument
under the cursor. The expression should be suitably quoted to prevent
it being evaluated too early.
+Alternatively, if the argument does not contain the string tt(ARG), it
+is assumed to be a shell function, to which the current command line
+argument is passed as the only argument. The function should set the
+variable tt(REPLY) to the new value for the command line argument.
+If the function returns non-zero status, so does the calling function.
+
For example, a user-defined widget containing the following code
converts the characters in the argument under the cursor into all upper
case:
@@ -2497,6 +2504,18 @@ or one of the styles of quotes), and replaces it with single quoting
throughout:
example(modify-current-argument '${(qq)${(Q)ARG}}')
+
+The following performs directory expansion on the command line
+argument and replaces it by the absolute path:
+
+example(expand-dir+LPAR()RPAR() {
+ REPLY=${~1}
+ REPLY=${REPLY:a}
+}
+modify-current-argument expand-dir)
+
+In practice the function tt(expand-dir) would probably not be defined
+within the widget where tt(modify-current-argument) is called.
)
enditem()
@@ -2842,6 +2861,14 @@ question is run using the tt(eval) builtin instead of by starting a new
tt(sh) process. This is more efficient, but may not work in the occasional
cases where the mailcap handler uses strict POSIX syntax.
)
+kindex(disown, MIME style)
+item(tt(disown))(
+If this boolean style is true, mailcap handlers started in the
+background will be disowned, i.e. not subject to job control within
+the parent shell. Such handlers nearly always produce their own
+windows, so the only likely harmful side effect of setting the style is
+that it becomes harder to kill jobs from within the shell.
+)
kindex(execute-as-is, MIME style)
item(tt(execute-as-is))(
This style gives a list of patterns to be matched against files
@@ -2854,6 +2881,28 @@ hence executable files are executed directly and not passed to a
handler, and the option tt(AUTO_CD) may be used to change to directories
that happen to have MIME suffixes.
)
+kindex(execute-never, MIME style)
+item(tt(execute-never))(
+This style is useful in combination with tt(execute-as-is). It is
+set to an array of patterns corresponding to full paths to files that
+should never be treated as executable, even if the file passed to
+the MIME handler matches tt(execute-as-is). This is useful for file
+systems that don't handle execute permission or that contain executables
+from another operating system. For example, if tt(/mnt/windows) is a
+Windows mount, then
+
+example(zstyle ':mime:*' execute-never '/mnt/windows/*')
+
+will ensure that any files found in that area will be executed as MIME
+types even if they are executable. As this example shows, the complete
+file name is matched against the pattern, regardless of how the file
+was passed to the handler. The file is resolved to a full path using
+the tt(:A) modifier described in
+ifzman(the subsection Modifers in zmanref(zshexpn))\
+ifnzman(noderef(Modifiers)));
+this means that symbolic links are resolved where possible, so that
+links into other file systems behave in the correct fashion.
+)
kindex(file-path, MIME style)
item(tt(file-path))(
Used if the style tt(find-file-in-path) is true for the same context.
@@ -3127,6 +3176,13 @@ the history of previous calculations, is available; the history is saved in
the file tt(~/.zcalc_history). To exit, enter a blank line or type `tt(:q)'
on its own (`tt(q)' is allowed for historical compatibility).
+A line ending with a single backslash is treated in the same fashion
+as it is in command line editing: the backslash is removed, the
+function prompts for more input (the prompt is preceded by `tt(...)'
+to indicate this), and the lines are combined into one to get the final
+result. In addition, if the input so far contains more open than
+close parentheses tt(zcalc) will prompt for more input.
+
If arguments are given to tt(zcalc) on start up, they are used to prime the
first few positional parameters. A visual indication of this is given when
the calculator starts.
@@ -3139,6 +3195,10 @@ The output base can be initialised by passing the option `tt(-#)var(base)',
for example `tt(zcalc -#16)' (the `tt(#)' may have to be quoted, depending
on the globbing options set).
+If the option `tt(-f)' is set, all numbers are treated as floating
+point, hence for example the expression `tt(3/4)' evaluates to 0.75
+rather than 0. Options must appear in separate words.
+
The prompt is configurable via the parameter tt(ZCALCPROMPT), which
undergoes standard prompt expansion. The index of the current entry is
stored locally in the first element of the array tt(psvar), which can be
@@ -3191,11 +3251,13 @@ scope.
)
item(tt(:function) var(name) [ var(body) ])(
Define a mathematical function or (with no var(body)) delete it.
+tt(:function) may be abbreviated to tt(:func) or simply tt(:f).
+The var(name) may contain the same characters as a shell function name.
The function is defined using tt(zmathfuncdef), see below.
Note that tt(zcalc) takes care of all quoting. Hence for example:
-example(function cube $1 * $1 * $1)
+example(:f cube $1 * $1 * $1)
defines a function to cube the sole argument.
)
@@ -3586,7 +3648,7 @@ ifzman(above)\
ifnzman((noderef(Utilities))).
)
findex(zmv)
-item(tt(zmv) [ tt(-finqQsvwW) ] [ -C | -L | -M | -p var(program) ] [ -o var(optstring) ] var(srcpat) var(dest) )(
+item(tt(zmv) [ tt(-finqQsvwW) ] [ -C | -L | -M | -[pP] var(program) ] [ -o var(optstring) ] var(srcpat) var(dest) )(
Move (usually, rename) files matching the pattern var(srcpat) to
corresponding files having names of the form given by var(dest), where
var(srcpat) contains parentheses surrounding patterns which will be
@@ -3631,7 +3693,13 @@ sitem(tt(-p) var(program))(Call var(program) instead of tt(cp), tt(ln) or
tt(mv). Whatever it does, it should at least understand the form
ifzman(`var(program) tt(-)tt(-) var(oldname) var(newname)')\
ifnzman(example(var(program) tt(-)tt(-) var(oldname) var(newname)))
-where var(oldname) and var(newname) are filenames generated by tt(zmv).)
+where var(oldname) and var(newname) are filenames generated by tt(zmv).
+var(program) will be split into words, so might be e.g. the name
+of an archive tool plus a copy or rename subcommand.)
+sitem(tt(-P) var(program))(As tt(-p) var(program), except that
+var(program) does not accept a following tt(-)tt(-) to indicate the
+end of options. In this case filenames must already be in a sane
+form for the program in question.)
sitem(tt(-o) var(optstring))(The var(optstring) is split into words and
passed down verbatim to the tt(cp), tt(ln) or tt(mv) command called to
perform the work. It should probably begin with a `tt(-)'.)
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index da68b4ff7..5ba3e21af 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -57,6 +57,7 @@ cindex(expansion, history)
History expansion allows you to use words from previous command
lines in the command line you are typing. This simplifies spelling
corrections and the repetition of complicated commands or arguments.
+
vindex(HISTSIZE, use of)
Immediately before execution, each command is saved in the history list,
the size of which is controlled by the tt(HISTSIZE) parameter. The one
@@ -748,6 +749,8 @@ If var(spec) is one of the above substitutions, substitute
the length in characters of the result instead of
the result itself. If var(spec) is an array expression,
substitute the number of elements of the result.
+This has the side-effect that joining is skipped even in quoted
+forms, which may affect other sub-expressions in var(spec).
Note that `tt(^)', `tt(=)', and `tt(~)', below, must appear
to the left of `tt(#)' when these forms are combined.
)
@@ -870,11 +873,12 @@ item(tt(A))(
Create an array parameter with `tt(${)...tt(=)...tt(})',
`tt(${)...tt(:=)...tt(})' or `tt(${)...tt(::=)...tt(})'.
If this flag is repeated (as in `tt(AA)'), create an associative
-array parameter. Assignment is made before sorting or padding.
-The var(name) part may be a subscripted range for ordinary
-arrays; the var(word) part em(must) be converted to an array, for
-example by using `tt(${(AA)=)var(name)tt(=)...tt(})' to activate
-field splitting, when creating an associative array.
+array parameter. Assignment is made before sorting or padding;
+if field splitting is active, the var(word) part is split before
+assignment. The var(name) part may be a subscripted range for
+ordinary arrays; the var(word) part em(must) be converted to
+an array, for example by using `tt(${(AA)=)var(name)tt(=)...tt(})'
+to activate field splitting, when creating an associative array.
)
item(tt(a))(
Sort in array index order; when combined with `tt(O)' sort in reverse
@@ -884,7 +888,9 @@ order.
)
item(tt(c))(
With tt(${#)var(name)tt(}), count the total number of characters in an array,
-as if the elements were concatenated with spaces between them.
+as if the elements were concatenated with spaces between them. This is not
+a true join of the array, so other expressions used with this flag may have
+an effect on the elements of the array before it is counted.
)
item(tt(C))(
Capitalize the resulting words. `Words' in this case refers to sequences
@@ -1308,7 +1314,8 @@ subscripts apply to the scalar or array value yielded by the previous
subscript. Thus if tt(var) is an array, tt(${var[1][2]}) is the second
character of the first word, but tt(${var[2,4][2]}) is the entire third
word (the second word of the range of words two through four of the
-original array). Any number of subscripts may appear.
+original array). Any number of subscripts may appear. Flags such as
+tt((k)) and tt((v)) which alter the result of subscripting are applied.
)
item(tt(4.) em(Parameter name replacement))(
The effect of any tt((P)) flag, which treats the value so far as a
@@ -1316,11 +1323,12 @@ parameter name and replaces it with the corresponding value, is applied.
)
item(tt(5.) em(Double-quoted joining))(
If the value after this process is an array, and the substitution
-appears in double quotes, and no tt((@)) flag is present at the current
-level, the words of the value are joined with the first character of the
-parameter tt($IFS), by default a space, between each word (single word
-arrays are not modified). If the tt((j)) flag is present, that is used for
-joining instead of tt($IFS).
+appears in double quotes, and neither an tt((@)) flag nor a tt(#)
+length operator is present at the current level, then words of the
+value are joined with the first character of the parameter tt($IFS),
+by default a space, between each word (single word arrays are not
+modified). If the tt((j)) flag is present, that is used for joining
+instead of tt($IFS).
)
item(tt(6.) em(Nested subscripting))(
Any remaining subscripts (i.e. of a nested substitution) are evaluated at
@@ -1700,14 +1708,14 @@ Note that trailing slashes will be removed from the path to the directory
It is also possible to define directory names using the tt(-d) option to the
tt(hash) builtin.
-In certain circumstances (in prompts, for instance), when the shell
-prints a path, the path is checked to see if it has a named
-directory as its prefix. If so, then the prefix portion
-is replaced with a `tt(~)' followed by the name of the directory.
-The shortest way of referring to the directory is used,
-with ties broken in favour of using a named directory,
-except when the directory is tt(/) itself. The parameters tt($PWD) and
-tt($OLDPWD) are never abbreviated in this fashion.
+When the shell prints a path (e.g. when expanding tt(%~) in prompts or when
+printing the directory stack), the path is checked to see if it has a named
+directory as its prefix. If so, then the prefix portion is replaced with a
+`tt(~)' followed by the name of the directory.
+The shorter of the two ways of referring to the directory is used,
+i.e. either the directory name or the full path; the name is used
+if they are the same length.
+The parameters tt($PWD) and tt($OLDPWD) are never abbreviated in this fashion.
subsect(`=' expansion)
@@ -1949,10 +1957,12 @@ item(tt(@LPAR())...tt(RPAR()))(
Match the pattern in the parentheses. (Like `tt(LPAR())...tt(RPAR())'.)
)
item(tt(*LPAR())...tt(RPAR()))(
-Match any number of occurrences. (Like `tt(LPAR())...tt(RPAR()#)'.)
+Match any number of occurrences. (Like `tt(LPAR())...tt(RPAR()#)',
+except that recursive directory searching is not supported.)
)
item(tt(PLUS()LPAR())...tt(RPAR()))(
-Match at least one occurrence. (Like `tt(LPAR())...tt(RPAR()##)'.)
+Match at least one occurrence. (Like `tt(LPAR())...tt(RPAR()##)',
+except that recursive directory searching is not supported..)
)
item(tt(?LPAR())...tt(RPAR()))(
Match zero or one occurrence. (Like `tt(LPAR()|)...tt(RPAR())'.)
diff --git a/Doc/Zsh/func.yo b/Doc/Zsh/func.yo
index 7c391f80d..6e9cfeee9 100644
--- a/Doc/Zsh/func.yo
+++ b/Doc/Zsh/func.yo
@@ -264,9 +264,16 @@ Executed when a history line has been read interactively, but
before it is executed. The sole argument is the complete history
line (so that any terminating newline will still be present).
-If any of the hook functions return a non-zero value the history
-line will not be saved, although it lingers in the history until the
-next line is executed allow you to reuse or edit it immediately.
+If any of the hook functions returns status 1 (or any non-zero value
+other than 2, though this is not guaranteed for future versions of the
+shell) the history line will not be saved, although it lingers in the
+history until the next line is executed, allowing you to reuse or edit
+it immediately.
+
+If any of the hook functions returns status 2 the history line
+will be saved on the internal history list, but not written to
+the history file. In case of a conflict, the first non-zero status
+value is taken.
A hook function may call `tt(fc -p) var(...)' to switch the history
context so that the history is saved in a different file from the
@@ -274,10 +281,13 @@ that in the global tt(HISTFILE) parameter. This is handled specially:
the history context is automatically restored after the processing
of the history line is finished.
-The following example function first adds the history line to the normal
-history with the newline stripped, which is usually the correct behaviour.
-Then it switches the history context so that the line will
-be written to a history file in the current directory.
+The following example function works with one of the options
+tt(INC_APPEND_HISTORY) or tt(SHARE_HISTORY) set, in order that the line
+is written out immediately after the history entry is added. It first
+adds the history line to the normal history with the newline stripped,
+which is usually the correct behaviour. Then it switches the history
+context so that the line will be written to a history file in the
+current directory.
example(zshaddhistory+LPAR()RPAR() {
print -sr -- ${1%%$'\n'}
diff --git a/Doc/Zsh/jobs.yo b/Doc/Zsh/jobs.yo
index 3baf77f20..d9395010a 100644
--- a/Doc/Zsh/jobs.yo
+++ b/Doc/Zsh/jobs.yo
@@ -115,3 +115,18 @@ The shell itself always ignores the tt(QUIT) signal.
Otherwise, signals have the values
inherited by the shell from its parent
(but see the tt(TRAP)var(NAL) special functions in noderef(Functions)).
+
+cindex(exiting shell, and asynchronous jobs)
+cindex(asynchronous jobs, and exiting shell)
+cindex(jobs, asynchronous, and exiting shell)
+Certain jobs are run asynchronously by the shell other than those
+explicitly put into the background; even in cases where the shell
+would usually wait for such jobs, an explicit tt(exit) command
+or exit due to the option tt(ERR_EXIT) will cause the shell to
+exit without waiting. Examples of such asynchronous jobs are
+process substitution, see
+ifzman(the section PROCESS SUBSTITUTION in the zmanref(zshexpn) manual page)\
+ifnzman(noderef(Process Substitution)), and the handler processes for
+multios, see
+ifzman(the section MULTIOS in the zmanref(zshmisc) manual page)\
+ifnzman(the section Multios in noderef(Redirection)).
diff --git a/Doc/Zsh/mod_curses.yo b/Doc/Zsh/mod_curses.yo
index d3f8ad22e..7ad772adb 100644
--- a/Doc/Zsh/mod_curses.yo
+++ b/Doc/Zsh/mod_curses.yo
@@ -84,11 +84,11 @@ The subcommand tt(position) writes various positions associated with
var(targetwin) into the array named var(array).
These are, in order:
startsitem()
-sitem()(The y and x coordinates of the cursor relative to the top left
+sitem(-)(The y and x coordinates of the cursor relative to the top left
of var(targetwin))
-sitem()(The y and x coordinates of the top left of var(targetwin) on the
+sitem(-)(The y and x coordinates of the top left of var(targetwin) on the
screen)
-sitem()(The size of var(targetwin) in y and x dimensions.)
+sitem(-)(The size of var(targetwin) in y and x dimensions.)
endsitem()
Outputting characters and strings are achieved by tt(char) and tt(string)
diff --git a/Doc/Zsh/mod_mapfile.yo b/Doc/Zsh/mod_mapfile.yo
index 98114aea2..96e056816 100644
--- a/Doc/Zsh/mod_mapfile.yo
+++ b/Doc/Zsh/mod_mapfile.yo
@@ -28,9 +28,12 @@ referenced may not be written or deleted.
A file may conveniently be read into an array as one line per element
with the form
-`var(array)tt(=LPAR()"${(f)mapfile[)var(filename)tt(]}"RPAR())'.
-The double quotes are necessary to prevent empty lines from being
-removed.
+`var(array)tt(=LPAR()"${(f@)mapfile[)var(filename)tt(]}"RPAR())'.
+The double quotes and the `tt(@)' are necessary to prevent empty lines
+from being removed. Note that if the file ends with a newline,
+the shell will split on the final newline, generating an additional
+empty field; this can be suppressed by using
+`var(array)tt(=LPAR()"${(f@)${mapfile[)var(filename)tt(]%$'\n'}}"RPAR())'.
)
enditem()
diff --git a/Doc/Zsh/mod_mathfunc.yo b/Doc/Zsh/mod_mathfunc.yo
index dda4f36fd..5239da5f8 100644
--- a/Doc/Zsh/mod_mathfunc.yo
+++ b/Doc/Zsh/mod_mathfunc.yo
@@ -33,7 +33,7 @@ returns an integer.
The function tt(signgam) takes no arguments, and returns an integer, which
is the C variable of the same name, as described in manref(gamma)(3). Note
that it is therefore only useful immediately after a call to tt(gamma) or
-tt(lgamma). Note also that `tt(signgam+LPAR()RPAR)' and `tt(signgam)' are
+tt(lgamma). Note also that `tt(signgam+LPAR()RPAR())' and `tt(signgam)' are
distinct expressions.
The following functions take two floating point arguments: tt(copysign),
diff --git a/Doc/Zsh/mod_parameter.yo b/Doc/Zsh/mod_parameter.yo
index 5948d74f2..32d4796f7 100644
--- a/Doc/Zsh/mod_parameter.yo
+++ b/Doc/Zsh/mod_parameter.yo
@@ -57,6 +57,14 @@ vindex(dis_reswords)
item(tt(dis_reswords))(
Like tt(reswords) but for disabled reserved words.
)
+vindex(patchars)
+item(tt(patchars))(
+This array contains the enabled pattern characters.
+)
+vindex(dis_patchars)
+item(tt(dis_patchars))(
+Like tt(patchars) but for disabled pattern characters.
+)
vindex(aliases)
item(tt(aliases))(
This maps the names of the regular aliases currently enabled to their
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 6c8d423cb..3c6ea63b8 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -485,6 +485,17 @@ Treat the `tt(#)', `tt(~)' and `tt(^)' characters as part of patterns
for filename generation, etc. (An initial unquoted `tt(~)'
always produces named directory expansion.)
)
+pindex(FORCE_FLOAT)
+pindex(NO_FORCE_FLOAT)
+pindex(FORCEFLOAT)
+pindex(NOFORCEFLOAT)
+cindex(floating point, forcing use of)
+cindex(forcing use of floating point)
+item(tt(FORCE_FLOAT))(
+Constants in arithmetic evaluation will be treated as floating point
+even without the use of a decimal point. Integers in any base
+will be converted.
+)
pindex(GLOB)
pindex(NO_GLOB)
pindex(NOGLOB)
@@ -1229,6 +1240,7 @@ pindex(NOPRINTEXITVALUE)
cindex(exit status, printing)
item(tt(PRINT_EXIT_VALUE) (tt(-1)))(
Print the exit value of programs with non-zero exit status.
+This is only available at the command line in interactive shells.
)
pindex(RC_QUOTES)
pindex(NO_RC_QUOTES)
@@ -1541,6 +1553,11 @@ the trap. If the option tt(DEBUG_BEFORE_CMD) is set,
as it is by default, and the option tt(ERR_EXIT) is found to have been set
on exit, then the command for which the tt(DEBUG) trap is being executed is
skipped. The option is restored after the trap exits.
+
+Exiting due to tt(ERR_EXIT) has certain interactions with asynchronous
+jobs noted in
+ifzman(the section JOBS in in zmanref(zshmisc))\
+ifnzman(noderef(Jobs & Signals)).
)
pindex(ERR_RETURN)
pindex(NO_ERR_RETURN)
@@ -1606,6 +1623,19 @@ A shell function can also guarantee itself a known shell configuration
with a formulation like `tt(emulate -L zsh)'; the tt(-L) activates
tt(LOCAL_OPTIONS).
)
+pindex(LOCAL_PATTERNS)
+pindex(NO_LOCAL_PATTERNS)
+pindex(LOCALPATTERNS)
+pindex(NOLOCALPATTERNS)
+item(tt(LOCAL_PATTERNS))(
+If this option is set at the point of return from a shell function,
+the state of pattern disables, as set with the builtin command
+`tt(disable -p)', is restored to what it was when the function was
+entered. The behaviour of this option is similar to the effect
+of tt(LOCAL_OPTIONS) on options; hence `tt(emulate -L sh)' (or
+indeed any other emulation with the tt(-L) option) activates
+tt(LOCAL_PATTERNS).
+)
pindex(LOCAL_TRAPS)
pindex(NO_LOCAL_TRAPS)
pindex(LOCALTRAPS)
@@ -1658,6 +1688,20 @@ Sequences of digits indicating a numeric base such as the `tt(08)'
component in `tt(08#77)' are always interpreted as decimal, regardless
of leading zeroes.
)
+pindex(PIPE_FAIL)
+pindex(NO_PIPE_FAIL)
+pindex(PIPEFAIL)
+pindex(NOPIPEFAIL)
+cindex(exit status from pipeline)
+cindex(status, on exit from pipeline)
+cindex(pipeline, exit status from)
+item(tt(PIPE_FAIL))(
+By default, when a pipeline exits the exit status recorded by the shell
+and returned by the shell variable tt($?) reflects that of the
+rightmost element of a pipeline. If this option is set, the exit status
+instead reflects the status of the rightmost element of the pipeline
+that was non-zero, or zero if all elements exited with zero status.
+)
pindex(SOURCE_TRACE)
pindex(NO_SOURCE_TRACE)
pindex(SOURCETRACE)
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index b7b7750ff..9d951bb38 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -431,9 +431,15 @@ of a shell function, shell script, or the shell itself; see
noderef(Invocation), and also noderef(Functions).
The parameter var(n), where var(n) is a number,
is the var(n)th positional parameter.
+The parameter `tt($0)' is a special case, see
+noderef(Parameters Set By The Shell).
+
The parameters tt(*), tt(@) and tt(argv) are
arrays containing all the positional parameters;
thus `tt($argv[)var(n)tt(])', etc., is equivalent to simply `tt($)var(n)'.
+Note that the options tt(KSH_ARRAYS) or tt(KSH_ZERO_SUBSCRIPT) apply
+to these arrays as well, so with either of those options set,
+`tt(${argv[0]})' is equivalent to `tt($1)' and so on.
Positional parameters may be changed after the shell or function starts by
using the tt(set) builtin, by assigning to the tt(argv) array, or by direct
@@ -967,6 +973,16 @@ item(tt(HISTFILE))(
The file to save the history in when an interactive shell exits.
If unset, the history is not saved.
)
+vindex(HISTORY_IGNORE)
+item(tt(HISTORY_IGNORE))(
+If set, is treated as a pattern at the time history files are written.
+Any potential history entry that matches the pattern is skipped. For
+example, if the value is `tt(fc *)' then commands that invoke the
+interactive history editor are never written to the history file (compare
+the tt(HIST_NO_STORE) option or the tt(zshaddhistory) hook, either of
+which would prevent such commands from being added to the interactive
+history at all).
+)
vindex(HISTSIZE)
item(tt(HISTSIZE) <S>)(
The maximum number of events stored in the internal history list.
@@ -1215,7 +1231,7 @@ In sh or ksh emulation, the default is `tt(PLUS() )'.
vindex(psvar)
vindex(PSVAR)
item(tt(psvar) <S> <Z> (tt(PSVAR) <S>))(
-An array (colon-separated list) whose first nine values can be used in
+An array (colon-separated list) whose elements can be used in
tt(PROMPT) strings. Setting tt(psvar) also sets tt(PSVAR), and
vice versa.
)
diff --git a/Doc/Zsh/prompt.yo b/Doc/Zsh/prompt.yo
index 8d7979546..eab15d29d 100644
--- a/Doc/Zsh/prompt.yo
+++ b/Doc/Zsh/prompt.yo
@@ -100,10 +100,13 @@ directory to show; zero means the whole path. A negative integer
specifies leading components, i.e. tt(%-1d) specifies the first component.
)
item(tt(%~))(
-As tt(%d) and tt(%/), but if the current working directory has a named
+As tt(%d) and tt(%/), but if the current working directory starts with
+tt($HOME), that part is replaced by a `tt(~)'. Furthermore, if it has a named
directory as its prefix, that part is replaced by a `tt(~)' followed by
-the name of the directory. If it starts with tt($HOME), that part is
-replaced by a `tt(~)'.
+the name of the directory, but only if the result is shorter than
+the full path;
+ifzman(see em(Dynamic) and em(Static named directories) in zmanref(zshexpn))\
+ifnzman(noderef(Filename Expansion)).
)
xitem(tt(%h))
item(tt(%!))(
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index 3e8c25a90..614924bfb 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -308,6 +308,7 @@ cindex(parameters, editing)
cindex(editing parameters)
xitem(tt(vared) [ tt(-Aache) ] [ tt(-p) var(prompt) ] [ tt(-r) var(rprompt) ])
xitem( [ tt(-M) var(main-keymap) ] [ tt(-m) var(vicmd-keymap) ])
+xitem( [ tt(-i) var(init-widget) ] [ tt(-f) var(finish-widget) ])
item( [ tt(-t) var(tty) ] var(name))(
The value of the parameter var(name) is loaded into the edit
buffer, and the line editor is invoked. When the editor exits,
@@ -343,6 +344,10 @@ to override tt(viins) and tt(vicmd). For emacs-style editing, only tt(-M)
is normally needed but the tt(-m) option may still be used. On exit, the
previous keymaps will be restored.
+tt(Vared) calls the usual `tt(zle-line-init)' and `tt(zle-line-finish)'
+hooks before and after it takes control. Using the tt(-i) and tt(-f)
+options, it is possible to replace these with other custom widgets.
+
If `tt(-t) var(tty)' is given, var(tty) is the name of a terminal device
to be used instead of the default tt(/dev/tty). If var(tty) does not
refer to a terminal an error is reported.
diff --git a/Doc/zmacros.yo b/Doc/zmacros.yo
index 19506d222..aed5bd8a7 100644
--- a/Doc/zmacros.yo
+++ b/Doc/zmacros.yo
@@ -33,6 +33,7 @@ DEFINEMACRO(RQUOTE)(0)(CHAR(39))
DEFINEMACRO(LPAR)(0)(CHAR(40))
DEFINEMACRO(RPAR)(0)(CHAR(41))
DEFINEMACRO(PLUS)(0)(CHAR(43))
+DEFINEMACRO(LSQUARE)(0)(CHAR(91))
DEFINEMACRO(DASH)(0)(ifztexi(--)ifnztexi(-))
diff --git a/Doc/ztexi.yo b/Doc/ztexi.yo
index ed0236bde..e58ff3902 100644
--- a/Doc/ztexi.yo
+++ b/Doc/ztexi.yo
@@ -71,7 +71,7 @@ def(texinfo)(2)(\
NOTRANS(@ifinfo)+NL()\
NOTRANS(@dircategory Utilities)+NL()\
NOTRANS(@direntry)+NL()\
- NOTRANS( * ZSH: (zsh). The Z Shell Manual.)+NL()\
+ NOTRANS(* ZSH: (zsh). The Z Shell Manual.)+NL()\
NOTRANS(@end direntry)+NL()\
NOTRANS(@end ifinfo)+NL()\
)
@@ -193,8 +193,8 @@ def(startlist)(0)(\
startitem()\
)
def(endlist)(0)(\
- NOTRANS(@item)+NL()\
- enditem()\
+ enditem()+NL()\
+ NOTRANS(@sp 1)\
)
def(list)(1)(\
item(ARG1)()\
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index ed46571d0..4e04e73ea 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -301,7 +301,7 @@ sect(On what machines will it run?)
sect(What's the latest version?)
- Zsh 5.0.2 is the latest production version. For details of all the
+ Zsh 5.0.3 is the latest production version. For details of all the
changes, see the NEWS file in the source distribution.
A beta of the next version is sometimes available. Development of zsh is
diff --git a/Etc/zsh-development-guide b/Etc/zsh-development-guide
index e7d73852f..37364e118 100644
--- a/Etc/zsh-development-guide
+++ b/Etc/zsh-development-guide
@@ -57,35 +57,80 @@ Patches
Git Workflow
------------
+
+Zsh has migrated from CVS to git for version control. Thus far, we have
+avoided further changes to our workflow.
* To allow changesets to be cross-referenced between the mailing list
archives and version control history, commit messages should start with
the mailing list sequence number. This number is generated by the list
- server and inserted as an X-Seq: header field in the e-mail. To add
- the number, you can use "git commit --amend" to change the commit.
+ server and inserted as an X-Seq: header field in the e-mail.
+ * An entry in the ChangeLog file should be added manually before pushing
+ a commit to the master repository. Don't create a separate change for
+ this: amend the existing commit in your local repository.
+
* Do not merge your private feature branches onto the master branch: a
linear history without merge commits is simpler to follow (and to
- bisect). Both "git cherry-pick" and "git merge --ff-only" can be used
- bring changes over to another branch without a merge commit.
-
- * It is often useful to regularly check in changes while prototyping a
- solution on a private branch. When finished, it is better to deliver a
- clean history. For small changes, use "git merge --squash" to get a
- single changeset for the feature. Where a change can be logically
- divided into separate changesets use "git rebase -i master" from the
- feature branch and squash your many intermediate steps into
- appropriate changesets that each do something meaningful. Post each
- changeset separately to the mailing list.
-
- * Before pushing your changes to the main zsh repository, you can use
- "git pull --rebase" to fetch any new updates from the server and
- rebase your changes on top of them. You can also use "git rebase
- master" from your feature branches.
-
- * Patches can be prepared for the mailing list with "git format-patch
- origin/master". To apply patches from a mailing list message, you can
- use "git am".
+ bisect).
+
+Use of Git
+----------
+
+Micro Git Tutorial:
+
+ % $VISUAL file1.c file2.c new-file3.c
+ % git add new-file3.c
+ % git commit -a
+ % git push
+
+ "git commit -a" automatically finds files which are tracked and have
+ been modified, but doesn't pick up new files; "git add" adds a file to
+ the index to be part of the next commit, and can be used for new files
+ or for existing files (commit -a is a shortcut for the latter)
+
+ "git push" assumes that you're on the master branch and the repository
+ was created by cloning it from some place, with default options.
+
+Using a Local Feature Branch:
+
+ % git checkout -b feature_foo
+ % $VISUAL path/to/files ...
+ % git commit -a
+ [ generate single patch for changes ]
+ % git diff master
+ [ do mailing-list stuff here ]
+ [ Switch back to master: ]
+ % git checkout master
+ [ and get the most recent changes: ]
+ % git pull
+ [ make the branch content now be relative to *new* master tip ]
+ % git checkout feature_foo
+ % git rebase master
+ [ then bring in your changes: ]
+ % git checkout master
+ % git merge --squash feature_foo
+ % $VISUAL ChangeLog
+ % git add ChangeLog
+ % git commit --amend
+ % git push
+ [ cleanup ]
+ % git branch -d feature_foo
+
+ The above assumes you want all your changes on the feature branch to be
+ seen as a single change publicly. The normal git way to generate patches
+ is to use git format-patch which produces separate patches already
+ prepared for e-mailing. If you want to keep changes separate, don't use
+ the --squash option to git merge. In this case, it can be wise to use
+ --ff-only which ensures that you don't get a merge commit by only doing
+ the merge if the master can be trivially moved forward. An alternative is
+ to use git cherry-pick to pick out individual changes.
+
+Git further reading:
+ * git help tutorial
+ * git help tutorial-2
+ * git help gitcore-tutorial
+ * http://www-cs-students.stanford.edu/~blynn/gitmagic/
Testing
-------
@@ -901,66 +946,3 @@ The following parameters are currently used:
distribution, but that need to be present in the git tree. This
variable is not used by the zsh build process and is present for
the convenience of external checks.
-
-
-Use of Git
-----------
-
-zsh has migrated from CVS to git for version control. We have so far
-kept our workflow unchanged; to wit:
-
- 1. change is developed and posted to the zsh-workers mailing list
- 2. the zsh-workers list management software adds an X-Seq: header
- 3. an entry is added to ChangeLog with details, including the X-Seq:
- header.
- [Open Question: should the first 6 or so characters of the commit
- fingerprint be included, so: "* 12345/deadbeef: frobbed the baz" ?]
- 4. this is committed to git as a second commit
- 5. this is pushed to the master server
-
-Micro Git Tutorial:
-
- % $VISUAL file1.c file2.c new-file3.c
- % git add new-file3.c
- % git commit -a
- % git push
-
- "git commit -a" automatically finds files which are tracked and have
- been modified, but doesn't pick up new files; "git add" adds a file to
- the index to be part of the next commit, and can be used for new files
- or for existing files (commit -a is a shortcut for the latter)
-
- "git push" assumes that you're on the master branch and the repository
- was created by cloning it from some place, with default options.
-
-Feature branch work:
-
- % git checkout -b feature_foo
- % $VISUAL path/to/files ...
- % git commit -a
- [lather, rinse, repeat]
- % git push origin feature_foo
- [ do mailing-list stuff here ]
- [ Switch back to master: ]
- % git checkout master
- [ and get the most recent changes: ]
- % git pull
- [ make the branch content now be relative to *new* master tip ]
- % git checkout feature_foo
- % git rebase master
- [ then bring in your changes: ]
- % git checkout master
- % git merge --ff-only feature_foo
- % $VISUAL ChangeLog
- % git commit -i ChangeLog
- % git push
- [ Cleanup: ]
- % git branch -d feature_foo
- % git push origin :feature_foo
-
-Git further reading:
- * git help tutorial
- * git help tutorial-2
- * git help gitcore-tutorial
- * http://www-cs-students.stanford.edu/~blynn/gitmagic/
-
diff --git a/Functions/Calendar/age b/Functions/Calendar/age
index 8f6278fa2..17cf4d13e 100644
--- a/Functions/Calendar/age
+++ b/Functions/Calendar/age
@@ -18,7 +18,7 @@
# are allowed, but whitespace must be quoted to ensure age receives
# the correct arguments.
#
-# AGEREF1=2006/10/04:10:15
+# AGEREF=2006/10/04:10:15
# AGEREF2=2006/10/04:10:45
# print *(+age)
#
@@ -33,21 +33,27 @@ zmodload -i zsh/parameter
autoload -Uz calendar_scandate
+local timefmt
local -a vals tmp
[[ -e $REPLY ]] || return 1
-zstat -A vals +mtime $REPLY || return 1
+zstat -A vals +mtime -- $REPLY || return 1
if (( $# >= 1 )); then
if [[ $1 = :* ]]; then
- zstat -A tmp -F "%Y/%m/%d" +mtime ${1[2,-1]} || return 1
+ if (( $# > 1 )); then
+ timefmt="%Y/%m/%d:%H:%M:%S"
+ else
+ timefmt="%Y/%m/%d"
+ fi
+ zstat -A tmp -F $timefmt +mtime -- ${1#:} || return 1
local AGEREF=$tmp[1]
else
local AGEREF=$1
fi
# if 1 argument given, never use globally defined AGEREF2
if [[ $2 = :* ]]; then
- zstat -A tmp -F "%Y/%m/%d" +mtime ${2[2,-1]} || return 1
+ zstat -A tmp -F "%Y/%m/%d:%H:%M:%S" +mtime -- ${2#:} || return 1
local AGEREF2=$tmp[1]
else
local AGEREF2=$2
diff --git a/Functions/MIME/zsh-mime-handler b/Functions/MIME/zsh-mime-handler
index abaf0b6e3..24e5184fc 100644
--- a/Functions/MIME/zsh-mime-handler
+++ b/Functions/MIME/zsh-mime-handler
@@ -74,21 +74,25 @@ if [[ $suffix != *.* ]]; then
fi
suffix=${suffix#*.}
-local handler flags no_sh no_bg arg
+local handler flags no_sh no_bg arg bg_flag="&"
integer i
-local -a exec_asis hand_nonex
+local -a exec_asis hand_nonex exec_never
# Set to a list of patterns which are ignored and executed as they are,
# despite being called for interpretation by the mime handler.
# Defaults to executable files, which ensures that they are executed as
# they are, even if they have a suffix.
zsh-mime-contexts -a $suffix execute-as-is exec_asis || exec_asis=('*(*)' '*(/)')
+zsh-mime-contexts -a $suffix execute-never exec_never
# Set to a list of patterns for which the handler will be used even
# if the file doesn't exist on the disk.
zsh-mime-contexts -a $suffix handle-nonexistent hand_nonex ||
hand_nonex=('[[:alpha:]]#:/*')
+# Set to true if the job should be disowned.
+zsh-mime-contexts -t $suffix disown && bg_flag="&!"
+
local pattern
local -a files
@@ -122,6 +126,9 @@ fi
for pattern in $exec_asis; do
files=(${dirpref}${~pattern})
if [[ -n ${files[(r)$1]} ]]; then
+ for pattern in $exec_never; do
+ [[ ${1:A} = ${~pattern} ]] && break 2
+ done
if (( list )); then
for (( i = 1; i <= $#; i++ )); do
(( i == 1 )) || print -n " "
@@ -309,8 +316,8 @@ else
# Otherwise it's equivalent to removing the eval and all the quotes,
# including the (q) flags.
if [[ -n $stdin ]]; then
- eval cat ${(q)argv} "|" ${(q)execargs} "&"
+ eval cat ${(q)argv} "|" ${(q)execargs} $bg_flag
else
- eval ${(q)execargs} "&"
+ eval ${(q)execargs} $bg_flag
fi
fi
diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help
index 6a9abb3cf..c817b67d6 100644
--- a/Functions/Misc/run-help
+++ b/Functions/Misc/run-help
@@ -56,6 +56,10 @@ do
[[ -n $noalias && $what = *" is an alias "* ]] && continue
builtin print -r $what
case $what in
+ (*( is an alias for (noglob|nocorrect))*)
+ [[ ${what[(w)7]:t} != ${what[(w)1]} ]] &&
+ run_help_orig_cmd=${what[(w)1]} run-help ${what[(w)7]:t}
+ ;;
(*( is an alias)*)
[[ ${what[(w)6]:t} != ${what[(w)1]} ]] &&
run_help_orig_cmd=${what[(w)1]} run-help ${what[(w)6]:t}
diff --git a/Functions/Misc/zcalc b/Functions/Misc/zcalc
index 2d0cf5d40..e9dcc78b9 100644
--- a/Functions/Misc/zcalc
+++ b/Functions/Misc/zcalc
@@ -114,7 +114,7 @@ float PI E
(( PI = 4 * atan(1), E = exp(1) ))
# Process command line
-while [[ -n $1 && $1 = -(|[#-]*) ]]; do
+while [[ -n $1 && $1 = -(|[#-]*|f) ]]; do
optlist=${1[2,-1]}
shift
[[ $optlist = (|-) ]] && break
@@ -139,6 +139,9 @@ while [[ -n $1 && $1 = -(|[#-]*) ]]; do
fi
defbase="[#${arg}]"
;;
+ (f) # Force floating point operation
+ setopt forcefloat
+ ;;
esac
done
done
@@ -152,7 +155,25 @@ for (( num = 1; num <= $#; num++ )); do
done
psvar[1]=$num
-while vared -cehp "${ZCALCPROMPT}" line; do
+local prev_line cont_prompt
+while vared -cehp "${cont_prompt}${ZCALCPROMPT}" line; do
+ if [[ $line = (|*[^\\])('\\')#'\' ]]; then
+ prev_line+=$line[1,-2]
+ cont_prompt="..."
+ line=
+ continue
+ fi
+ line="$prev_line$line"
+ prev_line=
+ cont_prompt=
+ # Test whether there are as many open as close
+ # parentheses in the line so far.
+ if [[ ${#line//[^\(]} -gt ${#line//[^\)]} ]]; then
+ prev_line+=$line
+ cont_prompt="..."
+ line=
+ continue
+ fi
[[ -z $line ]] && break
# special cases
# Set default base if `[#16]' or `[##16]' etc. on its own.
@@ -165,6 +186,7 @@ while vared -cehp "${ZCALCPROMPT}" line; do
defbase=$match[1]
fi
print -s -- $line
+ print -- $(( ${defbase} ans ))
line=
continue
else
@@ -220,7 +242,7 @@ while vared -cehp "${ZCALCPROMPT}" line; do
continue
;;
- ((:|)function[[:blank:]]##(#b)([^[:blank:]]##)(|[[:blank:]]##([^[:blank:]]*)))
+ ((function|:f(unc(tion|)|))[[:blank:]]##(#b)([^[:blank:]]##)(|[[:blank:]]##([^[:blank:]]*)))
zmathfuncdef $match[1] $match[3]
line=
continue
diff --git a/Functions/Misc/zmv b/Functions/Misc/zmv
index 4ba664e6d..269fe5ba5 100644
--- a/Functions/Misc/zmv
+++ b/Functions/Misc/zmv
@@ -93,7 +93,11 @@
# -p <program>
# Call <program> instead of cp, ln or mv. Whatever it does, it should
# at least understand the form '<program> -- <oldname> <newname>',
-# where <oldname> and <newname> are filenames generated.
+# where <oldname> and <newname> are filenames generated. <program>
+# will be split into words.
+# -P <program>
+# As -p, but the program doesn't understand the "--" convention.
+# In this case the file names must already be sane.
# -w Pick out wildcard parts of the pattern, as described above, and
# implicitly add parentheses for referring to them.
# -W Just like -w, with the addition of turning wildcards in the
@@ -123,14 +127,16 @@ setopt extendedglob
local f g args match mbegin mend files action myname tmpf opt exec
local opt_f opt_i opt_n opt_q opt_Q opt_s opt_M opt_C opt_L
-local opt_o opt_p opt_v opt_w opt_W MATCH MBEGIN MEND
+local opt_o opt_p opt_P opt_v opt_w opt_W MATCH MBEGIN MEND
local pat repl errstr fpat hasglobqual opat
typeset -A from to
integer stat
+local dashes=--
+
myname=${(%):-%N}
-while getopts ":o:p:MCLfinqQsvwW" opt; do
+while getopts ":o:p:P:MCLfinqQsvwW" opt; do
if [[ $opt = "?" ]]; then
print -r -- "$myname: unrecognized option: -$OPTARG" >&2
return 1
@@ -144,6 +150,7 @@ done
[[ -n $opt_C ]] && action=cp
[[ -n $opt_L ]] && action=ln
[[ -n $opt_p ]] && action=$opt_p
+[[ -n $opt_P ]] && action=$opt_P dashes=
if [[ -z $action ]]; then
action=$myname[-2,-1]
@@ -278,7 +285,7 @@ fi
for f in $files; do
[[ -z $to[$f] ]] && continue
- exec=($action ${=opt_o} $opt_s -- $f $to[$f])
+ exec=(${=action} ${=opt_o} $opt_s $dashes $f $to[$f])
[[ -n $opt_i$opt_n$opt_v ]] && print -r -- ${(q-)exec}
if [[ -n $opt_i ]]; then
read -q 'opt?Execute? ' || continue
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index e40571a0e..c44be398e 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -5,10 +5,10 @@
setopt localoptions extendedglob NO_shwordsplit
local gitdir gitbase gitbranch gitaction gitunstaged gitstaged gitsha1
local stgitpatch stgitunapplied
-local -xA hook_com
+local -A hook_com
VCS_INFO_git_getaction () {
- local gitaction='' gitdir=$1
+ local gitdir=$1
local tmp
for tmp in "${gitdir}/rebase-apply" \
@@ -22,7 +22,6 @@ VCS_INFO_git_getaction () {
else
gitaction="am/rebase"
fi
- printf '%s' ${gitaction}
return 0
fi
done
@@ -30,7 +29,7 @@ VCS_INFO_git_getaction () {
for tmp in "${gitdir}/rebase-merge/interactive" \
"${gitdir}/.dotest-merge/interactive" ; do
if [[ -f "${tmp}" ]] ; then
- printf '%s' "rebase-i"
+ gitaction="rebase-i"
return 0
fi
done
@@ -38,25 +37,35 @@ VCS_INFO_git_getaction () {
for tmp in "${gitdir}/rebase-merge" \
"${gitdir}/.dotest-merge" ; do
if [[ -d "${tmp}" ]] ; then
- printf '%s' "rebase-m"
+ gitaction="rebase-m"
return 0
fi
done
if [[ -f "${gitdir}/MERGE_HEAD" ]] ; then
- printf '%s' "merge"
+ gitaction="merge"
return 0
fi
if [[ -f "${gitdir}/BISECT_LOG" ]] ; then
- printf '%s' "bisect"
+ gitaction="bisect"
return 0
fi
+
+ if [[ -f "${gitdir}/CHERRY_PICK_HEAD" ]] ; then
+ if [[ -d "${gitdir}/sequencer" ]] ; then
+ gitaction=cherry-seq
+ else
+ gitaction=cherry
+ fi
+ return 0
+ fi
+
return 1
}
VCS_INFO_git_getbranch () {
- local gitbranch gitdir=$1 tmp actiondir
+ local gitdir=$1 tmp actiondir
local gitsymref="${vcs_comm[cmd]} symbolic-ref HEAD"
actiondir=''
@@ -95,12 +104,11 @@ VCS_INFO_git_getbranch () {
fi
fi
- printf '%s' "${gitbranch}"
return 0
}
gitdir=${vcs_comm[gitdir]}
-gitbranch="$(VCS_INFO_git_getbranch ${gitdir})"
+VCS_INFO_git_getbranch ${gitdir}
if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then
gitsha1=$(${vcs_comm[cmd]} rev-parse --quiet --verify HEAD)
else
@@ -123,12 +131,14 @@ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" && \
fi
VCS_INFO_adjust
-gitaction="$(VCS_INFO_git_getaction ${gitdir})"
+VCS_INFO_git_getaction ${gitdir}
gitbase=${PWD%/${$( ${vcs_comm[cmd]} rev-parse --show-prefix )%/##}}
rrn=${gitbase:t}
local patchdir=${gitdir}/patches/${gitbranch}
-if [[ -d $patchdir ]] ; then
+if [[ -d $patchdir ]] && [[ -f $patchdir/applied ]] \
+ && [[ -f $patchdir/unapplied ]]
+then
local -a stgit_applied stgit_unapplied stgit_all
stgit_applied=(${(f)"$(< "${patchdir}/applied")"})
diff --git a/Functions/Zle/down-line-or-beginning-search b/Functions/Zle/down-line-or-beginning-search
index fbd2c3341..4c713f197 100644
--- a/Functions/Zle/down-line-or-beginning-search
+++ b/Functions/Zle/down-line-or-beginning-search
@@ -3,6 +3,8 @@
emulate -L zsh
+typeset -g __searching __savecursor
+
if [[ ${+NUMERIC} -eq 0 &&
( $LASTWIDGET = $__searching || $RBUFFER != *$'\n'* ) ]]
then
diff --git a/Functions/Zle/keeper b/Functions/Zle/keeper
index c29b22d6f..a40125771 100644
--- a/Functions/Zle/keeper
+++ b/Functions/Zle/keeper
@@ -4,6 +4,9 @@
# Shell Corner column on UnixReview.com in January 2005 at the URL
# <http://www.unixreview.com/documents/s=9513/ur0501a/ur0501a.htm>
#
+# Article still available on the Wayback Machine:
+# <http://web.archive.org/web/20050207041146/http://www.unixreview.com/documents/s=9513/ur0501a/ur0501a.htm>
+#
# A few minor edits have been made to those functions for this file. Key
# bindings are commented out to avoid clashes with any existing bindings.
##
@@ -69,17 +72,21 @@ zstyle ':completion:expand-kept-result:*' completer _insert_kept
# "_insert_kept".
_expand_word_and_keep() {
- function compadd() {
- local -A args
- zparseopts -E -A args J:
- if [[ $args[-J] == all-expansions ]]
- then
- builtin compadd -A kept "$@"
- kept=( ${(Q)${(z)kept}} )
- fi
- builtin compadd "$@"
+ {
+ function compadd {
+ local -A args
+ zparseopts -E -A args J:
+ if [[ $args[-J] == all-expansions ]]
+ then
+ builtin compadd -A kept "$@"
+ kept=( ${(Q)${(z)kept}} )
+ fi
+ builtin compadd "$@"
+ }
+ _expand_word
+ } always {
+ unfunction compadd
}
- { _expand_word } always { unfunction compadd }
}
zle -C _expand_word complete-word _expand_word_and_keep
diff --git a/Functions/Zle/modify-current-argument b/Functions/Zle/modify-current-argument
index 92851d600..941eb80af 100644
--- a/Functions/Zle/modify-current-argument
+++ b/Functions/Zle/modify-current-argument
@@ -14,24 +14,27 @@
setopt localoptions noksharrays multibyte
local -a reply
-integer REPLY REPLY2 fromend endoffset
+integer posword poschar fromend endoffset
+local REPLY REPLY2
autoload -Uz split-shell-arguments
split-shell-arguments
+(( posword = REPLY, poschar = REPLY2 ))
+
# Can't do this unless there's some text under or left of us.
-(( REPLY < 2 )) && return 1
+(( posword < 2 )) && return 1
# Get the index of the word we want.
-if (( REPLY & 1 )); then
+if (( posword & 1 )); then
# Odd position; need previous word.
- (( REPLY-- ))
+ (( posword-- ))
# Pretend position was just after the end of it.
- (( REPLY2 = ${#reply[REPLY]} + 1 ))
+ (( poschar = ${#reply[posword]} + 1 ))
fi
# Work out offset from end of string
-(( fromend = $REPLY2 - ${#reply[REPLY]} - 1 ))
+(( fromend = $poschar - ${#reply[posword]} - 1 ))
if (( fromend >= -1 )); then
# Cursor is near the end of the word, we'll try to keep it there.
endoffset=1
@@ -39,11 +42,17 @@ fi
# Length of all characters before current.
# Force use of character (not index) counting and join without IFS.
-integer wordoff="${(cj..)#reply[1,REPLY-1]}"
+integer wordoff="${(cj..)#reply[1,posword-1]}"
-# Replacement for current word. This could do anything to ${reply[REPLY]}.
-local ARG="${reply[REPLY]}" repl
-eval repl=\"$1\"
+# Replacement for current word. This could do anything to ${reply[posword]}.
+local ARG="${reply[posword]}" repl
+if [[ $1 != *ARG* ]]; then
+ REPLY=
+ $1 $ARG || return 1
+ repl=$REPLY
+else
+ eval repl=\"$1\"
+fi
if (( !endoffset )) && [[ ${repl[fromend,-1]} = ${ARG[fromend,-1]} ]]; then
# If the part of the string from here to the end hasn't changed,
@@ -54,8 +63,8 @@ fi
# New line: all words before and after current word, with
# no additional spaces since we've already got the whitespace
# and the replacement word in the middle.
-local left="${(j..)reply[1,REPLY-1]}${repl}"
-local right="${(j..)reply[REPLY+1,-1]}"
+local left="${(j..)reply[1,posword-1]}${repl}"
+local right="${(j..)reply[posword+1,-1]}"
if [[ endoffset -ne 0 && ${#repl} -ne 0 ]]; then
# Place cursor relative to end.
@@ -71,5 +80,5 @@ else
integer repmax=$(( ${#repl} + 1 ))
# Remember CURSOR starts from offset 0 for some reason, so
# subtract 1 from positions.
- (( CURSOR = wordoff + (REPLY2 > repmax ? repmax : REPLY2) - 1 ))
+ (( CURSOR = wordoff + (poschar > repmax ? repmax : poschar) - 1 ))
fi
diff --git a/Functions/Zle/up-line-or-beginning-search b/Functions/Zle/up-line-or-beginning-search
index 5348e7ad3..bdc39335a 100644
--- a/Functions/Zle/up-line-or-beginning-search
+++ b/Functions/Zle/up-line-or-beginning-search
@@ -3,6 +3,8 @@
emulate -L zsh
+typeset -g __searching __savecursor
+
if [[ $LBUFFER == *$'\n'* ]]; then
zle .up-line-or-history
__searching=''
diff --git a/LICENCE b/LICENCE
index 6e2f11401..fc87fe780 100644
--- a/LICENCE
+++ b/LICENCE
@@ -1,3 +1,15 @@
+Unless otherwise noted in the header of specific files, files in this
+distribution have the licence shown below.
+
+However, note that certain shell functions are licensed under versions
+of the GNU Public Licence. Anyone distributing the shell as a binary
+including those files needs to take account of this. Search shell
+functions for "Copyright" for specific copyright information.
+None of the core functions are affected by this, so those files
+may simply be omitted.
+
+--
+
The Z Shell is copyright (c) 1992-2009 Paul Falstad, Richard Coleman,
Zoltán Hidvégi, Andrew Main, Peter Stephenson, Sven Wischnowsky, and
others. All rights reserved. Individual authors, whether or not
diff --git a/Makefile.in b/Makefile.in
index 5fb736f2c..197276c42 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -160,6 +160,7 @@ targz-src: $(DISTNAME).tar.gz
$(DISTNAME).tar.gz: FORCE
@$(sdir_top)/Util/mkdisttree.sh $(DISTNAME) $(sdir_top) $(dir_top) SRC \
$(MAKE) $(MAKEDEFS)
+ echo '#define ZSH_PATCHLEVEL "'`cd $(sdir_top) && git describe --tags --long`'"' >$(DISTNAME)/Src/patchlevel.h.release
tar cf - $(DISTNAME) | gzip -9 > $@
rm -rf $(DISTNAME)
diff --git a/NEWS b/NEWS
index 1f131a205..84c5f7b1f 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,21 @@ similar to "functions -t" except that tracing is turned off for any
functions called from the specified one(s) that don't also have the -t
or -T flag.
+The option FORCE_FLOAT has been added to force all arithmetic constants
+to be treated as floating point. This is most useful locally within
+functions or scripts performing floating point calculations.
+
+Individual pattern characters can be disabled. For example, to allow '^'
+to be an ordinary character even if the option EXTENDED_GLOB is set, use
+"disable -p '^'".
+
+The variable editing builtin vared can be given custom editing widgets
+for initialisation and finishing.
+
+Hooks for adding history (the function zshaddhistory and the
+array zshaddhistory_functions) can return status 2 to indicate that
+history is to be saved internally within the shell but not written.
+
In file completion, the recursive-files style can be set to an array of
patterns to match against "$PWD/". In any matched location, it is
possibly to complete files in arbitrarily deep subdirectories without
@@ -27,6 +42,11 @@ The _user_expand completer now allows expansion functions in the
user-expand files to return a string in REPLY that will be used to name
the set of expansions returned.
+The parameter HISTORY_IGNORE may be set to a pattern which matches
+lines in the internal history that are to be omitted from the history
+file at file write time. This differs from history changes made in
+the zshaddhistory hook or by the HIST_IGNORE_* options, all of which
+take effect immediately on the internal history list itself.
Changes between 4.2 and 5.0.0
-----------------------------
diff --git a/README b/README
index b0ce8fa9f..c2fbf746d 100644
--- a/README
+++ b/README
@@ -5,9 +5,8 @@ THE Z SHELL (ZSH)
Version
-------
-This is version 5.0.2 of the shell. This is a stable release.
-There are minor new features as well as bug fixes since 5.0.0 and
-one bug fix since the short-lived 5.0.1.
+This is version 5.0.3 of the shell. This is a stable release.
+There are minor new features as well as bug fixes since 5.0.2.
Installing Zsh
--------------
@@ -28,6 +27,17 @@ Zsh is a shell with lots of features. For a list of some of these, see the
file FEATURES, and for the latest changes see NEWS. For more
details, see the documentation.
+Incompatibilities between 5.0.2 and 5.0.3
+-----------------------------------------
+
+The "zshaddhistory" hook mechanism documented in the zshmisc manual page
+has been upgraded so that a hook returning status 2 causes a history
+line to be saved on the internal history list but not written to the
+history file. Previously any non-zero status return would cause
+the line not to be saved on the history at all. It is recommended
+to use status 1 for this (indeed most shell users would naturally do
+so).
+
Incompatibilities between 5.0.0 and 5.0.2
-----------------------------------------
@@ -355,7 +365,7 @@ mention this in your message if you want a response.
If you would like to contribute to the development and maintenance of zsh,
then you should join the zsh-workers mailing list (check the META-FAQ
for info on this). You should also read the "zsh-development-guide"
-located in the subdirectory Util.
+located in the subdirectory Etc.
Contributors
------------
diff --git a/Src/Builtins/rlimits.awk b/Src/Builtins/rlimits.awk
index bf914814d..fe2d0e931 100644
--- a/Src/Builtins/rlimits.awk
+++ b/Src/Builtins/rlimits.awk
@@ -42,7 +42,7 @@ BEGIN {limidx = 0}
if (limnam == "MEMLOCK") { msg[limnum] = "Mmemorylocked" }
if (limnam == "NOFILE") { msg[limnum] = "Ndescriptors" }
if (limnam == "NPROC") { msg[limnum] = "Nmaxproc" }
- if (limnam == "NTHR") { msg[limnum] = "Nmaxthr" }
+ if (limnam == "NTHR") { msg[limnum] = "Nmaxpthreads" }
if (limnam == "OFILE") { msg[limnum] = "Ndescriptors" }
if (limnam == "PTHREAD") { msg[limnum] = "Nmaxpthreads" }
if (limnam == "RSS") { msg[limnum] = "Mresident" }
@@ -55,6 +55,10 @@ BEGIN {limidx = 0}
if (limnam == "NICE") { msg[limnum] = "Nnice" }
if (limnam == "RTPRIO") { msg[limnum] = "Nrt_priority" }
if (limnam == "RTTIME") { msg[limnum] = "Urt_time" }
+ if (limnam == "POSIXLOCKS") { msg[limnum] = "Nposixlocks" }
+ if (limnam == "NPTS") { msg[limnum] = "Npseudoterminals" }
+ if (limnam == "SWAP") { msg[limnum] = "Mswapsize" }
+ if (limnam == "KQUEUES") { msg[limnum] = "Nkqueues" }
}
}
}
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index eedfa969c..fd4c94aaa 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -32,6 +32,14 @@
#if defined(HAVE_GETRLIMIT) && defined(RLIM_INFINITY)
+#ifdef RLIMIT_POSIXLOCKS
+# define RLIMIT_LOCKS RLIMIT_POSIXLOCKS
+#endif
+
+#ifdef RLIMIT_NTHR
+# define RLIMIT_PTHREAD RLIMIT_NTHR
+#endif
+
enum {
ZLIMTYPE_MEMORY,
ZLIMTYPE_NUMBER,
@@ -314,12 +322,6 @@ printulimit(char *nam, int lim, int hard, int head)
printf("-u: processes ");
break;
# endif /* HAVE_RLIMIT_NPROC */
-# ifdef HAVE_RLIMIT_NTHR
- case RLIMIT_NTHR:
- if (head)
- printf("-r: threads ");
- break;
-#endif /* HAVE_RLIMIT_NTHR */
# if defined(HAVE_RLIMIT_VMEM) && (!defined(HAVE_RLIMIT_RSS) || !defined(RLIMIT_VMEM_IS_RSS))
case RLIMIT_VMEM:
if (head)
@@ -371,7 +373,7 @@ printulimit(char *nam, int lim, int hard, int head)
# ifdef HAVE_RLIMIT_PTHREAD
case RLIMIT_PTHREAD:
if (head)
- printf("-N %2d: threads per process ", RLIMIT_PTHREAD);
+ printf("-T: threads per process ");
break;
# endif /* HAVE_RLIMIT_PTHREAD */
# ifdef HAVE_RLIMIT_NICE
@@ -386,6 +388,26 @@ printulimit(char *nam, int lim, int hard, int head)
printf("-r: max rt priority ");
break;
# endif /* HAVE_RLIMIT_RTPRIO */
+# ifdef HAVE_RLIMIT_NPTS
+ case RLIMIT_NPTS:
+ if (head)
+ printf("-p: pseudo-terminals ");
+ break;
+# endif /* HAVE_RLIMIT_NPTS */
+# ifdef HAVE_RLIMIT_SWAP
+ case RLIMIT_SWAP:
+ if (head)
+ printf("-w: swap size (kbytes) ");
+ if (limit != RLIM_INFINITY)
+ limit /= 1024;
+ break;
+# endif /* HAVE_RLIMIT_SWAP */
+# ifdef HAVE_RLIMIT_KQUEUES
+ case RLIMIT_KQUEUES:
+ if (head)
+ printf("-k: kqueues ");
+ break;
+# endif /* HAVE_RLIMIT_KQUEUES */
default:
if (head)
printf("-N %2d: ", lim);
@@ -800,11 +822,6 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
res = RLIMIT_NOFILE;
break;
# endif /* HAVE_RLIMIT_NOFILE */
-# ifdef HAVE_RLIMIT_NTHR
- case 'r':
- res = RLIMIT_NTHR;
- break;
-# endif /* HAVE_RLIMIT_NTHR */
# ifdef HAVE_RLIMIT_NPROC
case 'u':
res = RLIMIT_NPROC;
@@ -844,6 +861,21 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
res = RLIMIT_RTPRIO;
break;
# endif
+# ifdef HAVE_RLIMIT_NPTS
+ case 'p':
+ res = RLIMIT_NPTS;
+ break;
+# endif
+# ifdef HAVE_RLIMIT_SWAP
+ case 'w':
+ res = RLIMIT_SWAP;
+ break;
+# endif
+# ifdef HAVE_RLIMIT_KQUEUES
+ case 'k':
+ res = RLIMIT_KQUEUES;
+ break;
+# endif
default:
/* unrecognised limit */
zwarnnam(name, "bad option: -%c", *options);
diff --git a/Src/Modules/mathfunc.c b/Src/Modules/mathfunc.c
index 04483b555..efadd86ff 100644
--- a/Src/Modules/mathfunc.c
+++ b/Src/Modules/mathfunc.c
@@ -340,7 +340,16 @@ math_func(char *name, int argc, mnumber *argv, int id)
break;
case MF_GAMMA:
+#ifdef HAVE_TGAMMA
+ retd = tgamma(argd);
+#else
+#ifdef HAVE_SIGNGAM
+ retd = lgamma(argd);
+ retd = signgam*exp(retd);
+#else /*XXX assume gamma(x) returns Gamma(x), not log(|Gamma(x)|) */
retd = gamma(argd);
+#endif
+#endif
break;
case MF_HYPOT:
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index a029c9cb4..22148f991 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -759,6 +759,38 @@ disreswordsgetfn(UNUSED(Param pm))
return getreswords(DISABLED);
}
+/* Functions for the patchars special parameter. */
+
+/**/
+static char **
+getpatchars(int dis)
+{
+ int i;
+ char **ret, **p;
+
+ p = ret = (char **) zhalloc(ZPC_COUNT * sizeof(char *));
+
+ for (i = 0; i < ZPC_COUNT; i++)
+ if (zpc_strings[i] && !dis == !zpc_disables[i])
+ *p++ = dupstring(zpc_strings[i]);
+
+ *p = NULL;
+
+ return ret;
+}
+
+static char **
+patcharsgetfn(UNUSED(Param pm))
+{
+ return getpatchars(0);
+}
+
+static char **
+dispatcharsgetfn(UNUSED(Param pm))
+{
+ return getpatchars(1);
+}
+
/* Functions for the options special parameter. */
/**/
@@ -2018,6 +2050,10 @@ static const struct gsu_array reswords_gsu =
{ reswordsgetfn, arrsetfn, stdunsetfn };
static const struct gsu_array disreswords_gsu =
{ disreswordsgetfn, arrsetfn, stdunsetfn };
+static const struct gsu_array patchars_gsu =
+{ patcharsgetfn, arrsetfn, stdunsetfn };
+static const struct gsu_array dispatchars_gsu =
+{ dispatcharsgetfn, arrsetfn, stdunsetfn };
static const struct gsu_array dirs_gsu =
{ dirsgetfn, dirssetfn, stdunsetfn };
static const struct gsu_array historywords_gsu =
@@ -2038,6 +2074,8 @@ static struct paramdef partab[] = {
&pmdisfunctions_gsu, getpmdisfunction, scanpmdisfunctions),
SPECIALPMDEF("dis_galiases", 0,
&pmdisgaliases_gsu, getpmdisgalias, scanpmdisgaliases),
+ SPECIALPMDEF("dis_patchars", PM_ARRAY|PM_READONLY,
+ &dispatchars_gsu, NULL, NULL),
SPECIALPMDEF("dis_reswords", PM_ARRAY|PM_READONLY,
&disreswords_gsu, NULL, NULL),
SPECIALPMDEF("dis_saliases", 0,
@@ -2072,6 +2110,8 @@ static struct paramdef partab[] = {
&pmoptions_gsu, getpmoption, scanpmoptions),
SPECIALPMDEF("parameters", PM_READONLY,
NULL, getpmparameter, scanpmparameters),
+ SPECIALPMDEF("patchars", PM_ARRAY|PM_READONLY,
+ &patchars_gsu, NULL, NULL),
SPECIALPMDEF("reswords", PM_ARRAY|PM_READONLY,
&reswords_gsu, NULL, NULL),
SPECIALPMDEF("saliases", 0,
diff --git a/Src/Modules/parameter.mdd b/Src/Modules/parameter.mdd
index eb48d5f2a..a91a5dc09 100644
--- a/Src/Modules/parameter.mdd
+++ b/Src/Modules/parameter.mdd
@@ -2,6 +2,6 @@ name=zsh/parameter
link=either
load=yes
-autofeatures="p:parameters p:commands p:functions p:dis_functions p:funcfiletrace p:funcsourcetrace p:funcstack p:functrace p:builtins p:dis_builtins p:reswords p:dis_reswords p:options p:modules p:dirstack p:history p:historywords p:jobtexts p:jobdirs p:jobstates p:nameddirs p:userdirs p:aliases p:dis_aliases p:galiases p:dis_galiases p:saliases p:dis_saliases"
+autofeatures="p:parameters p:commands p:functions p:dis_functions p:funcfiletrace p:funcsourcetrace p:funcstack p:functrace p:builtins p:dis_builtins p:reswords p:dis_reswords p:patchars p:dis_patchars p:options p:modules p:dirstack p:history p:historywords p:jobtexts p:jobdirs p:jobstates p:nameddirs p:userdirs p:aliases p:dis_aliases p:galiases p:dis_galiases p:saliases p:dis_saliases"
objects="parameter.o"
diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c
index a3e95bb59..edae0841e 100644
--- a/Src/Modules/stat.c
+++ b/Src/Modules/stat.c
@@ -339,7 +339,7 @@ statprint(struct stat *sbuf, char *outbuf, char *fname, int iwhich, int flags)
* -H hash: as for -A array, but returns a hash with the keys being those
* from stat -l
* -F fmt: specify a $TIME-like format for printing times; the default
- * is the (CTIME-like) "%a %b %e %k:%M:%S". This option implies
+ * is the (CTIME-like) "%a %b %e %k:%M:%S %Z %Y". This option implies
* -s as it is not useful for numerical times.
*
* +type selects just element type of stat buffer (-l gives list):
@@ -361,7 +361,7 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func))
struct stat statbuf;
int found = 0, nargs;
- timefmt = "%a %b %e %k:%M:%S";
+ timefmt = "%a %b %e %k:%M:%S %Z %Y";
for (; *args && (**args == '+' || **args == '-'); args++) {
char *arg = *args+1;
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 25ec7dfea..fca0cc172 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -293,8 +293,8 @@ static int
newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
{
Ptycmd p;
- int master, slave, pid, oineval = ineval;
- char *oscriptname = scriptname;
+ int master, slave, pid, oineval = ineval, ret;
+ char *oscriptname = scriptname, syncch;
Eprog prog;
/* code borrowed from bin_eval() */
@@ -344,6 +344,8 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
if (get_pty(0, &slave))
exit(1);
+ SHTTY = slave;
+ attachtty(mypid);
#ifdef TIOCGWINSZ
/* Set the window size before associating with the terminal *
* so that we don't get hit with a SIGWINCH. I'm paranoid. */
@@ -396,8 +398,23 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
setsparam("TTY", ztrdup(ttystrname));
opts[INTERACTIVE] = 0;
+
+ syncch = 0;
+ do {
+ ret = write(1, &syncch, 1);
+ } while (ret != 1 && (
+#ifdef EWOULDBLOCK
+ errno == EWOULDBLOCK ||
+#else
+#ifdef EAGAIN
+ errno == EAGAIN ||
+#endif
+#endif
+ errno == EINTR));
+
execode(prog, 1, 0, "zpty");
stopmsg = 2;
+ mypid = 0; /* trick to ensure we _exit() */
zexit(lastval, 0);
}
master = movefd(master);
@@ -430,6 +447,18 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
scriptname = oscriptname;
ineval = oineval;
+ do {
+ ret = read(master, &syncch, 1);
+ } while (ret != 1 && (
+#ifdef EWOULDBLOCK
+ errno == EWOULDBLOCK ||
+#else
+#ifdef EAGAIN
+ errno == EAGAIN ||
+#endif
+#endif
+ errno == EINTR));
+
return 0;
}
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 39d41bdb5..5c5628a8d 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -826,7 +826,6 @@ callcompfunc(char *s, char *fn)
sfcontext = SFC_CWIDGET;
NEWHEAPS(compheap) {
LinkList largs = NULL;
- int olv = lastval;
if (*cfargs) {
char **p = cfargs;
@@ -836,9 +835,7 @@ callcompfunc(char *s, char *fn)
while (*p)
addlinknode(largs, dupstring(*p++));
}
- doshfunc(shfunc, largs, 0);
- cfret = lastval;
- lastval = olv;
+ cfret = doshfunc(shfunc, largs, 1);
} OLDHEAPS;
sfcontext = osc;
endparamscope();
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index 0143370c7..ab1857c0a 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -398,7 +398,6 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
if (cl)
return 1;
else {
- freecompctl(cc);
cclist = COMP_REMOVE;
return 0;
}
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index cd508d0ac..f5e6ba195 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -465,6 +465,7 @@ cd_init(char *nam, char *hide, char *mlen, char *sep,
cd_state.showd = disp;
cd_state.maxg = cd_state.groups = cd_state.descs = 0;
cd_state.maxmlen = atoi(mlen);
+ cd_state.premaxw = 0;
itmp = zterm_columns - cd_state.swidth - 4;
if (cd_state.maxmlen > itmp)
cd_state.maxmlen = itmp;
@@ -643,35 +644,43 @@ cd_get(char **params)
p += str->len;
memset(p, ' ', (l = (cd_state.premaxw - str->width + CM_SPACE)));
p += l;
- strcpy(p, cd_state.sep);
- p += cd_state.slen;
- /*
- * copy a character at once until no more screen width
- * is available. Leave 1 character at the end of screen
- * as safety margin
- */
remw = zterm_columns - cd_state.premaxw -
cd_state.swidth - 3;
- d = str->desc;
- w = MB_METASTRWIDTH(d);
- if (w <= remw)
- strcpy(p, d);
- else {
- pp = p;
- while (remw > 0 && *d) {
- l = MB_METACHARLEN(d);
- memcpy(pp, d, l);
- pp[l] = '\0';
- w = MB_METASTRWIDTH(pp);
- if (w > remw) {
- *pp = '\0';
- break;
- }
+ while (remw < 0 && zterm_columns) {
+ /* line wrapped, use remainder of the extra line */
+ remw += zterm_columns;
+ }
+ if (cd_state.slen < remw) {
+ strcpy(p, cd_state.sep);
+ p += cd_state.slen;
+ remw -= cd_state.slen;
- pp += l;
- d += l;
- remw -= w;
+ /*
+ * copy a character at once until no more screen
+ * width is available. Leave 1 character at the
+ * end of screen as safety margin
+ */
+ d = str->desc;
+ w = MB_METASTRWIDTH(d);
+ if (w <= remw)
+ strcpy(p, d);
+ else {
+ pp = p;
+ while (remw > 0 && *d) {
+ l = MB_METACHARLEN(d);
+ memcpy(pp, d, l);
+ pp[l] = '\0';
+ w = MB_METASTRWIDTH(pp);
+ if (w > remw) {
+ *pp = '\0';
+ break;
+ }
+
+ pp += l;
+ d += l;
+ remw -= w;
+ }
}
}
@@ -1608,7 +1617,7 @@ get_cadef(char *nam, char **args)
return *p;
} else if (!min || !*p || (*p)->lastt < (*min)->lastt)
min = p;
- if (i)
+ if (i > 0)
min = p;
if ((new = parse_cadef(nam, args))) {
freecadef(*min);
@@ -2992,7 +3001,7 @@ get_cvdef(char *nam, char **args)
return *p;
} else if (!min || !*p || (*p)->lastt < (*min)->lastt)
min = p;
- if (i)
+ if (i > 0)
min = p;
if ((new = parse_cvdef(nam, args))) {
freecvdef(*min);
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index e1a575bdb..5798e74b4 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -567,7 +567,9 @@ raw_getbyte(long do_keytmout, char *cptr)
gettyinfo(&ti);
ti.tio.c_cc[VMIN] = 0;
settyinfo(&ti);
+ winch_unblock();
ret = read(SHTTY, cptr, 1);
+ winch_block();
ti.tio.c_cc[VMIN] = 1;
settyinfo(&ti);
if (ret > 0)
@@ -597,7 +599,9 @@ raw_getbyte(long do_keytmout, char *cptr)
else
poll_timeout = -1;
+ winch_unblock();
selret = poll(fds, errtry ? 1 : nfds, poll_timeout);
+ winch_block();
# else
int fdmax = SHTTY;
struct timeval *tvptr;
@@ -622,8 +626,10 @@ raw_getbyte(long do_keytmout, char *cptr)
else
tvptr = NULL;
+ winch_unblock();
selret = select(fdmax+1, (SELECT_ARG_2_T) & foofd,
NULL, NULL, tvptr);
+ winch_block();
# endif
/*
* Make sure a user interrupt gets passed on straight away.
@@ -788,7 +794,9 @@ raw_getbyte(long do_keytmout, char *cptr)
# else
ioctl(SHTTY, TCSETA, &ti.tio);
# endif
+ winch_unblock();
ret = read(SHTTY, cptr, 1);
+ winch_block();
# ifdef HAVE_TERMIOS_H
tcsetattr(SHTTY, TCSANOW, &shttyinfo.tio);
# else
@@ -799,7 +807,9 @@ raw_getbyte(long do_keytmout, char *cptr)
#endif
}
+ winch_unblock();
ret = read(SHTTY, cptr, 1);
+ winch_block();
return ret;
}
@@ -1105,7 +1115,7 @@ zlecore(void)
/**/
char *
-zleread(char **lp, char **rp, int flags, int context)
+zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
{
char *s;
int old_errno = errno;
@@ -1178,6 +1188,13 @@ zleread(char **lp, char **rp, int flags, int context)
viinsbegin = 0;
statusline = NULL;
selectkeymap("main", 1);
+ /*
+ * If main is linked to the viins keymap, we need to register
+ * explicitly that we're now in vi insert mode as there's
+ * no user operation to indicate this.
+ */
+ if (openkeymap("main") == openkeymap("viins"))
+ viinsert(NULL);
selectlocalmap(NULL);
fixsuffix();
if ((s = getlinknode(bufstack))) {
@@ -1223,7 +1240,9 @@ zleread(char **lp, char **rp, int flags, int context)
unqueue_signals(); /* Should now be safe to acknowledge SIGWINCH */
- zlecallhook("zle-line-init", NULL);
+ zlecallhook(init, NULL);
+
+ zrefresh();
zlecore();
@@ -1231,7 +1250,7 @@ zleread(char **lp, char **rp, int flags, int context)
setsparam("ZLE_LINE_ABORTED", zlegetline(NULL, NULL));
if (done && !exit_pending && !errflag)
- zlecallhook("zle-line-finish", NULL);
+ zlecallhook(finish, NULL);
statusline = NULL;
invalidatelist();
@@ -1471,7 +1490,7 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
Param pm = 0;
int ifl;
int type = PM_SCALAR, obreaks = breaks, haso = 0, oSHTTY = 0;
- char *p1, *p2, *main_keymapname, *vicmd_keymapname;
+ char *p1, *p2, *main_keymapname, *vicmd_keymapname, *init, *finish;
Keymap main_keymapsave = NULL, vicmd_keymapsave = NULL;
FILE *oshout = NULL;
@@ -1499,6 +1518,8 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
p2 = OPT_ARG_SAFE(ops,'r');
main_keymapname = OPT_ARG_SAFE(ops,'M');
vicmd_keymapname = OPT_ARG_SAFE(ops,'m');
+ init = OPT_ARG_SAFE(ops,'i');
+ finish = OPT_ARG_SAFE(ops,'f');
if (type != PM_SCALAR && !OPT_ISSET(ops,'c')) {
zwarnnam(name, "-%s ignored", type == PM_ARRAY ? "a" : "A");
@@ -1600,6 +1621,7 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
haso = 1;
}
+
/* edit the parameter value */
zpushnode(bufstack, s);
@@ -1615,7 +1637,10 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
if (OPT_ISSET(ops,'h'))
hbegin(2);
isfirstln = OPT_ISSET(ops,'e');
- t = zleread(&p1, &p2, OPT_ISSET(ops,'h') ? ZLRF_HISTORY : 0, ZLCON_VARED);
+
+ t = zleread(&p1, &p2, OPT_ISSET(ops,'h') ? ZLRF_HISTORY : 0, ZLCON_VARED,
+ init ? init : "zle-line-init",
+ finish ? finish : "zle-line-finish");
if (OPT_ISSET(ops,'h'))
hend(NULL);
isfirstln = ifl;
@@ -1880,7 +1905,8 @@ zle_main_entry(int cmd, va_list ap)
flags = va_arg(ap, int);
context = va_arg(ap, int);
- return zleread(lp, rp, flags, context);
+ return zleread(lp, rp, flags, context,
+ "zle-line-init", "zle-line-finish");
}
case ZLE_CMD_ADD_TO_LINE:
@@ -1915,6 +1941,13 @@ zle_main_entry(int cmd, va_list ap)
break;
}
+ case ZLE_CMD_SET_HIST_LINE:
+ {
+ histline = va_arg(ap, zlong);
+
+ break;
+ }
+
default:
#ifdef DEBUG
dputs("Bad command %d in zle_main_entry", cmd);
@@ -1926,7 +1959,7 @@ zle_main_entry(int cmd, va_list ap)
static struct builtin bintab[] = {
BUILTIN("bindkey", 0, bin_bindkey, 0, -1, 0, "evaM:ldDANmrsLRp", NULL),
- BUILTIN("vared", 0, bin_vared, 1, 1, 0, "aAcehM:m:p:r:t:", NULL),
+ BUILTIN("vared", 0, bin_vared, 1, 1, 0, "aAcef:hi:M:m:p:r:t:", NULL),
BUILTIN("zle", 0, bin_zle, 0, -1, 0, "aAcCDFgGIKlLmMNrRTU", NULL),
};
diff --git a/Src/Zle/zle_move.c b/Src/Zle/zle_move.c
index d5f464c2c..7312b3f20 100644
--- a/Src/Zle/zle_move.c
+++ b/Src/Zle/zle_move.c
@@ -30,7 +30,7 @@
#include "zle.mdh"
#include "zle_move.pro"
-static int vimarkcs[26], vimarkline[26];
+static int vimarkcs[27], vimarkline[27];
#ifdef MULTIBYTE_SUPPORT
/*
@@ -825,11 +825,17 @@ int
vigotomark(UNUSED(char **args))
{
ZLE_INT_T ch;
+ int oldcs = zlecs;
+ int oldline = histline;
ch = getfullchar(0);
- if (ch < ZWC('a') || ch > ZWC('z'))
- return 1;
- ch -= ZWC('a');
+ if (ch == ZWC('\'') || ch == ZWC('`'))
+ ch = 26;
+ else {
+ if (ch < ZWC('a') || ch > ZWC('z'))
+ return 1;
+ ch -= ZWC('a');
+ }
if (!vimarkline[ch])
return 1;
if (curhist != vimarkline[ch] && !zle_goto_hist(vimarkline[ch], 0, 0)) {
@@ -837,6 +843,8 @@ vigotomark(UNUSED(char **args))
return 1;
}
zlecs = vimarkcs[ch];
+ vimarkcs[26] = oldcs;
+ vimarkline[26] = oldline;
if (zlecs > zlell)
zlecs = zlell;
return 0;
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 78a9fa490..e30e0b1aa 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1095,6 +1095,7 @@ get_comp_string(void)
* the command word is not at index zero in the array.
*/
int redirpos;
+ int noword;
char *s = NULL, *tmp, *p, *tt = NULL, rdop[20];
char *linptr, *u;
@@ -1165,7 +1166,7 @@ get_comp_string(void)
* and whatnot. */
do {
- qsub = 0;
+ qsub = noword = 0;
lincmd = ((incmdpos && !ins && !incond) ||
(oins == 2 && wordpos == 2) ||
@@ -1239,6 +1240,19 @@ get_comp_string(void)
* leave the loop. */
if (tt)
break;
+ if (ins < 2) {
+ /*
+ * Don't add this as a word, because we're about to start
+ * a new command line: pretend there's no string here.
+ * We don't dare do this if we're using one of the
+ * *really* gross hacks with ins to get later words
+ * to look like command words, because we don't
+ * understand how they work. Quite possibly we
+ * should be using a mechanism like the one here rather
+ * than the ins thing.
+ */
+ noword = 1;
+ }
/* Otherwise reset the variables we are collecting data in. */
wordpos = cp = rd = ins = redirpos = 0;
tt0 = NULLTOK;
@@ -1253,6 +1267,14 @@ get_comp_string(void)
/* If everything before is a redirection, don't reset the index */
if (wordpos != redirpos)
wordpos = redirpos = 0;
+ } else if (tok == SEPER) {
+ /*
+ * A following DOLOOP should cause us to reset to the start
+ * of the command line. For some reason we only recognise
+ * DOLOOP for this purpose (above) if ins is set. Why?
+ * Don't ask pointless questions.
+ */
+ ins = 1;
}
if (!lexflags && tt0 == NULLTOK) {
/* This is done when the lexer reached the word the cursor is on. */
@@ -1322,7 +1344,7 @@ get_comp_string(void)
else if (tok == DAMPER)
tokstr = "&&";
}
- if (!tokstr)
+ if (!tokstr || noword)
continue;
/* Hack to allow completion after `repeat n do'. */
if (oins == 2 && !wordpos && !strcmp(tokstr, "do"))
@@ -2114,8 +2136,8 @@ inststrlen(char *str, int move, int len)
return 0;
if (len == -1)
len = strlen(str);
- spaceinline(len);
if (zlemetaline != NULL) {
+ spaceinline(len);
strncpy(zlemetaline + zlemetacs, str, len);
if (move)
zlemetacs += len;
@@ -2126,6 +2148,7 @@ inststrlen(char *str, int move, int len)
instr = ztrduppfx(str, len);
zlestr = stringaszleline(instr, 0, &zlelen, NULL, NULL);
+ spaceinline(zlelen);
ZS_strncpy(zleline + zlecs, zlestr, zlelen);
free(zlestr);
zsfree(instr);
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index d0e7b5542..b84d253bb 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -145,6 +145,7 @@ zlecharasstring(ZLE_CHAR_T inchar, char *buf)
ptr2--;
}
*ptr = Meta;
+ ptr[1] ^= 32;
ret++;
}
diff --git a/Src/builtin.c b/Src/builtin.c
index 90fe1a6c5..c3f0169c7 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -55,11 +55,11 @@ static struct builtin builtins[] =
BUILTIN("continue", BINF_PSPECIAL, bin_break, 0, 1, BIN_CONTINUE, NULL, NULL),
BUILTIN("declare", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%afghi:%klmprtuxz", NULL),
BUILTIN("dirs", 0, bin_dirs, 0, -1, 0, "clpv", NULL),
- BUILTIN("disable", 0, bin_enable, 0, -1, BIN_DISABLE, "afmrs", NULL),
+ BUILTIN("disable", 0, bin_enable, 0, -1, BIN_DISABLE, "afmprs", 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, -1, 0, "LR", NULL),
- BUILTIN("enable", 0, bin_enable, 0, -1, BIN_ENABLE, "afmrs", NULL),
+ BUILTIN("enable", 0, bin_enable, 0, -1, BIN_ENABLE, "afmprs", NULL),
BUILTIN("eval", BINF_PSPECIAL, bin_eval, 0, -1, BIN_EVAL, NULL, NULL),
BUILTIN("exit", BINF_PSPECIAL, bin_break, 0, 1, BIN_EXIT, NULL, NULL),
BUILTIN("export", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, BIN_EXPORT, "E:%F:%HL:%R:%TUZ:%afhi:%lprtu", "xg"),
@@ -467,7 +467,9 @@ bin_enable(char *name, char **argv, Options ops, int func)
int match = 0, returnval = 0;
/* Find out which hash table we are working with. */
- if (OPT_ISSET(ops,'f'))
+ if (OPT_ISSET(ops,'p')) {
+ return pat_enables(name, argv, func == BIN_ENABLE);
+ } else if (OPT_ISSET(ops,'f'))
ht = shfunctab;
else if (OPT_ISSET(ops,'r'))
ht = reswdtab;
@@ -937,11 +939,16 @@ cd_do_chdir(char *cnam, char *dest, int hard)
* DOS style names with drives in them
*/
static char buf[PATH_MAX];
+#ifdef HAVE_CYGWIN_CONV_PATH
+ cygwin_conv_path(CCP_WIN_A_TO_POSIX | CCP_RELATIVE, dest, buf,
+ PATH_MAX);
+#else
#ifndef _SYS_CYGWIN_H
void cygwin_conv_to_posix_path(const char *, char *);
#endif
cygwin_conv_to_posix_path(dest, buf);
+#endif
dest = buf;
#endif
nocdpath = dest[0] == '.' &&
@@ -1118,7 +1125,8 @@ cd_try_chdir(char *pfix, char *dest, int hard)
* argument to cd relatively. This is useful if the cwd
* or a parent directory is renamed in the interim.
*/
- if (lchdir(buf, NULL, hard) && lchdir(dest, NULL, hard)) {
+ if (lchdir(buf, NULL, hard) &&
+ (pfix || *dest == '/' || lchdir(dest, NULL, hard))) {
free(buf);
return NULL;
}
@@ -2470,7 +2478,7 @@ bin_typeset(char *name, char **argv, Options ops, int func)
setsparam(asg0.name, ztrdup(asg0.value));
return 0;
} else {
- zerrnam(name, "can't tie already tied scalar: %s",
+ zwarnnam(name, "can't tie already tied scalar: %s",
asg0.name);
}
return 1;
@@ -2680,7 +2688,7 @@ bin_functions(char *name, char **argv, Options ops, int func)
Patprog pprog;
Shfunc shf;
int i, returnval = 0;
- int on = 0, off = 0, pflags = 0;
+ int on = 0, off = 0, pflags = 0, roff;
/* Do we have any flags defined? */
if (OPT_PLUS(ops,'u'))
@@ -2699,16 +2707,21 @@ bin_functions(char *name, char **argv, Options ops, int func)
on |= PM_TAGGED_LOCAL;
else if (OPT_PLUS(ops,'T'))
off |= PM_TAGGED_LOCAL;
+ roff = off;
if (OPT_MINUS(ops,'z')) {
on |= PM_ZSHSTORED;
off |= PM_KSHSTORED;
- } else if (OPT_PLUS(ops,'z'))
+ } else if (OPT_PLUS(ops,'z')) {
off |= PM_ZSHSTORED;
+ roff |= PM_ZSHSTORED;
+ }
if (OPT_MINUS(ops,'k')) {
on |= PM_KSHSTORED;
off |= PM_ZSHSTORED;
- } else if (OPT_PLUS(ops,'k'))
+ } else if (OPT_PLUS(ops,'k')) {
off |= PM_KSHSTORED;
+ roff |= PM_KSHSTORED;
+ }
if ((off & PM_UNDEFINED) || (OPT_ISSET(ops,'k') && OPT_ISSET(ops,'z')) ||
(OPT_MINUS(ops,'X') && (OPT_ISSET(ops,'m') || *argv || !scriptname))) {
@@ -2716,7 +2729,7 @@ bin_functions(char *name, char **argv, Options ops, int func)
return 1;
}
- if (OPT_PLUS(ops,'f') || OPT_ISSET(ops,'+'))
+ if (OPT_PLUS(ops,'f') || roff || OPT_ISSET(ops,'+'))
pflags |= PRINT_NAMEONLY;
if (OPT_MINUS(ops,'M') || OPT_PLUS(ops,'M')) {
@@ -3785,11 +3798,11 @@ bin_print(char *name, char **args, Options ops, int func)
/* -u and -p -- output to other than standard output */
if (OPT_HASARG(ops,'u') || OPT_ISSET(ops,'p')) {
- int fd;
+ int fdarg, fd;
if (OPT_ISSET(ops, 'p')) {
- fd = coprocout;
- if (fd < 0) {
+ fdarg = coprocout;
+ if (fdarg < 0) {
zwarnnam(name, "-p: no coprocess");
return 1;
}
@@ -3797,13 +3810,13 @@ bin_print(char *name, char **args, Options ops, int func)
char *argptr = OPT_ARG(ops,'u'), *eptr;
/* Handle undocumented feature that -up worked */
if (!strcmp(argptr, "p")) {
- fd = coprocout;
- if (fd < 0) {
+ fdarg= coprocout;
+ if (fdarg < 0) {
zwarnnam(name, "-p: no coprocess");
return 1;
}
} else {
- fd = (int)zstrtol(argptr, &eptr, 10);
+ fdarg = (int)zstrtol(argptr, &eptr, 10);
if (*eptr) {
zwarnnam(name, "number expected after -%c: %s", 'u',
argptr);
@@ -3812,8 +3825,8 @@ bin_print(char *name, char **args, Options ops, int func)
}
}
- if ((fd = dup(fd)) < 0) {
- zwarnnam(name, "bad file number: %d", fd);
+ if ((fd = dup(fdarg)) < 0) {
+ zwarnnam(name, "bad file number: %d", fdarg);
return 1;
}
if ((fout = fdopen(fd, "w")) == 0) {
@@ -5015,6 +5028,7 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func))
int opt_R = OPT_ISSET(ops, 'R');
int saveemulation, savehackchar;
int ret = 1, new_emulation;
+ unsigned int savepatterns;
char saveopts[OPT_SIZE], new_opts[OPT_SIZE];
char *cmd = 0;
const char *shname = *argv;
@@ -5056,7 +5070,8 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func))
if (!argv[1]) {
emulate(shname, OPT_ISSET(ops,'R'), &emulation, opts);
if (OPT_ISSET(ops,'L'))
- opts[LOCALOPTIONS] = opts[LOCALTRAPS] = 1;
+ opts[LOCALOPTIONS] = opts[LOCALTRAPS] = opts[LOCALPATTERNS] = 1;
+ clearpatterndisables();
return 0;
}
@@ -5077,6 +5092,13 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func))
goto restore;
}
+ savepatterns = savepatterndisables();
+ /*
+ * All emulations start with an empty set of pattern disables,
+ * hence no special "sticky" behaviour is required.
+ */
+ clearpatterndisables();
+
saveemulation = emulation;
emulation = new_emulation;
memcpy(opts, new_opts, sizeof(opts));
@@ -5126,6 +5148,7 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func))
sticky = save_sticky;
emulation = saveemulation;
memcpy(opts, saveopts, sizeof(opts));
+ restorepatterndisables(savepatterns);
restore:
keyboardhackchar = savehackchar;
inittyptab(); /* restore banghist */
@@ -5490,6 +5513,8 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
eof = 2;
else
eof = (bptr - buf != 1 || (buf[0] != 'y' && buf[0] != 'Y'));
+ buf[0] = eof ? 'n' : 'y';
+ bptr = buf + 1;
}
if (OPT_ISSET(ops,'e') || OPT_ISSET(ops,'E'))
fwrite(buf, bptr - buf, 1, stdout);
@@ -5667,7 +5692,7 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
zputs(buf, stdout);
putchar('\n');
}
- if (!OPT_ISSET(ops,'e') && (*buf || first)) {
+ if (!OPT_ISSET(ops,'e') && (*buf || first || gotnl)) {
if (OPT_ISSET(ops,'A')) {
addlinknode(readll, buf);
al++;
@@ -5970,7 +5995,7 @@ bin_test(char *name, char **argv, UNUSED(Options ops), int func)
char **s;
Eprog prog;
struct estate state;
- int nargs;
+ int nargs, sense = 0, ret;
/* if "test" was invoked as "[", it needs a matching "]" *
* which is subsequently ignored */
@@ -5989,7 +6014,7 @@ bin_test(char *name, char **argv, UNUSED(Options ops), int func)
/*
* Implement some XSI extensions to POSIX here.
* See
- * http://www.opengroup.org/onlinepubs/009695399/utilities/test.html.
+ * http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
*/
nargs = arrlen(argv);
if (nargs == 3 || nargs == 4)
@@ -5998,6 +6023,10 @@ bin_test(char *name, char **argv, UNUSED(Options ops), int func)
argv[nargs-1] = NULL;
argv++;
}
+ if (nargs == 4 && !strcmp("!", argv[0])) {
+ sense = 1;
+ argv++;
+ }
}
lexsave();
@@ -6032,8 +6061,11 @@ bin_test(char *name, char **argv, UNUSED(Options ops), int func)
state.pc = prog->prog;
state.strs = prog->strs;
+ ret = evalcond(&state, name);
+ if (ret < 2 && sense)
+ ret = ! ret;
- return evalcond(&state, name);
+ return ret;
}
/* display a time, provided in units of 1/60s, as minutes and seconds */
diff --git a/Src/exec.c b/Src/exec.c
index 1ecbc3967..df915e152 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -448,10 +448,13 @@ zexecve(char *pth, char **argv, char **newenvp)
else
sprintf(buf + 2, "%s/%s", pwd, pth);
zputenv(buf);
+#ifndef FD_CLOEXEC
closedumps();
+#endif
if (newenvp == NULL)
newenvp = environ;
+ winch_unblock();
execve(pth, argv, newenvp);
/* If the execve returns (which in general shouldn't happen), *
@@ -486,6 +489,7 @@ zexecve(char *pth, char **argv, char **newenvp)
(pprog = pathprog(ptr2, NULL))) {
argv[-2] = ptr2;
argv[-1] = ptr + 1;
+ winch_unblock();
execve(pprog, argv - 2, newenvp);
}
zerr("%s: bad interpreter: %s: %e", pth, ptr2,
@@ -494,13 +498,16 @@ zexecve(char *pth, char **argv, char **newenvp)
*ptr = '\0';
argv[-2] = ptr2;
argv[-1] = ptr + 1;
+ winch_unblock();
execve(ptr2, argv - 2, newenvp);
} else {
argv[-1] = ptr2;
+ winch_unblock();
execve(ptr2, argv - 1, newenvp);
}
} else if (eno == ENOEXEC) {
argv[-1] = "sh";
+ winch_unblock();
execve("/bin/sh", argv - 1, newenvp);
}
} else if (eno == ENOEXEC) {
@@ -509,6 +516,7 @@ zexecve(char *pth, char **argv, char **newenvp)
break;
if (t0 == ct) {
argv[-1] = "sh";
+ winch_unblock();
execve("/bin/sh", argv - 1, newenvp);
}
}
@@ -1019,6 +1027,11 @@ execstring(char *s, int dont_change_job, int exiting, char *context)
Eprog prog;
pushheap();
+ if (isset(VERBOSE)) {
+ zputs(s, stderr);
+ fputc('\n', stderr);
+ fflush(stderr);
+ }
if ((prog = parse_string(s, 0)))
execode(prog, dont_change_job, exiting, context);
popheap();
@@ -1079,6 +1092,9 @@ execsimple(Estate state)
if (errflag)
return (lastval = 1);
+ if (!isset(EXECOPT))
+ return lastval = 0;
+
/* In evaluated traps, don't modify the line number. */
if (!IN_EVAL_TRAP() && !ineval && code)
lineno = code - 1;
@@ -1645,8 +1661,6 @@ execpline(Estate state, wordcode slcode, int how, int last1)
return lastval;
}
-static int subsh_close = -1;
-
/* execute pipeline. This function assumes the `pline' is not NULL. */
/**/
@@ -1723,7 +1737,7 @@ execpline2(Estate state, wordcode pcode,
}
} else {
/* otherwise just do the pipeline normally. */
- subsh_close = pipes[0];
+ addfilelist(NULL, pipes[0]);
execcmd(state, input, pipes[1], how, 0);
}
zclose(pipes[1]);
@@ -1736,8 +1750,6 @@ execpline2(Estate state, wordcode pcode,
execpline2(state, *state->pc++, how, pipes[0], output, last1);
list_pipe = old_list_pipe;
cmdpop();
- zclose(pipes[0]);
- subsh_close = -1;
}
}
@@ -1841,9 +1853,22 @@ quote_tokenized_output(char *str, FILE *file)
case '*':
case '?':
case '$':
+ case ' ':
putc('\\', file);
break;
+ case '\t':
+ fputs("$'\\t'", file);
+ continue;
+
+ case '\n':
+ fputs("$'\\n'", file);
+ continue;
+
+ case '\r':
+ fputs("$'\\r'", file);
+ continue;
+
case '=':
if (s == str)
putc('\\', file);
@@ -1885,7 +1910,14 @@ checkclobberparam(struct redir *f)
return 0;
}
- if (!isset(CLOBBER) && (fd = (int)getintvalue(v)) &&
+ /*
+ * We can't clobber the value in the parameter if it's
+ * already an opened file descriptor --- that means it's a decimal
+ * integer corresponding to an opened file descriptor,
+ * not merely an expression that evaluates to a file descriptor.
+ */
+ if (!isset(CLOBBER) && (s = getstrvalue(v)) &&
+ (fd = (int)zstrtol(s, &s, 10)) >= 0 && !*s &&
fd <= max_zsh_fd && fdtable[fd] == FDT_EXTERNAL) {
zwarn("can't clobber parameter %s containing file descriptor %d",
f->varid, fd);
@@ -1935,7 +1967,7 @@ clobber_open(struct redir *f)
/**/
static void
-closemn(struct multio **mfds, int fd)
+closemn(struct multio **mfds, int fd, int type)
{
if (fd >= 0 && mfds[fd] && mfds[fd]->ct >= 2) {
struct multio *mn = mfds[fd];
@@ -1994,7 +2026,7 @@ closemn(struct multio **mfds, int fd)
}
}
_exit(0);
- } else if (fd >= 0)
+ } else if (fd >= 0 && type == REDIR_CLOSE)
mfds[fd] = NULL;
}
@@ -2147,8 +2179,6 @@ addfd(int forked, int *save, struct multio **mfds, int fd1, int fd2, int rflag,
mfds[fd1]->fds[mfds[fd1]->ct++] = fdN;
}
}
- if (subsh_close >= 0 && fdtable[subsh_close] == FDT_UNUSED)
- subsh_close = -1;
}
/**/
@@ -2847,9 +2877,6 @@ execcmd(Estate state, int input, int output, int how, int last1)
close(synch[1]);
read_loop(synch[0], &dummy, 1);
close(synch[0]);
-#ifdef PATH_DEV_FD
- closem(FDT_PROC_SUBST);
-#endif
if (how & Z_ASYNC) {
lastpid = (zlong) pid;
/* indicate it's possible to set status for lastpid */
@@ -3066,7 +3093,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
}
}
if (fn->fd1 < 10)
- closemn(mfds, fn->fd1);
+ closemn(mfds, fn->fd1, REDIR_CLOSE);
if (!closed && zclose(fn->fd1) < 0) {
zwarn("failed to close file descriptor %d: %e",
fn->fd1, errno);
@@ -3075,7 +3102,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
case REDIR_MERGEIN:
case REDIR_MERGEOUT:
if (fn->fd2 < 10)
- closemn(mfds, fn->fd2);
+ closemn(mfds, fn->fd2, fn->type);
if (!checkclobberparam(fn))
fil = -1;
else if (fn->fd2 > 9 &&
@@ -3096,7 +3123,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
int fd = fn->fd2;
if(fd == -2)
fd = (fn->type == REDIR_MERGEOUT) ? coprocout : coprocin;
- fil = dup(fd);
+ fil = movefd(dup(fd));
}
if (fil == -1) {
char fdstr[4];
@@ -3124,7 +3151,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
else
fil = clobber_open(fn);
if(fil != -1 && IS_ERROR_REDIR(fn->type))
- dfil = dup(fil);
+ dfil = movefd(dup(fil));
else
dfil = 0;
if (fil == -1 || dfil == -1) {
@@ -3154,7 +3181,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
* spawning tee/cat processes as necessary. */
for (i = 0; i < 10; i++)
if (mfds[i] && mfds[i]->ct >= 2)
- closemn(mfds, i);
+ closemn(mfds, i, REDIR_CLOSE);
if (nullexec) {
if (nullexec == 1) {
@@ -3233,33 +3260,12 @@ execcmd(Estate state, int input, int output, int how, int last1)
if (is_shfunc) {
/* It's a shell function */
-
-#ifdef PATH_DEV_FD
- int i;
-
- for (i = 10; i <= max_zsh_fd; i++)
- if (fdtable[i] >= FDT_PROC_SUBST)
- fdtable[i]++;
-#endif
- if (subsh_close >= 0)
- zclose(subsh_close);
- subsh_close = -1;
-
execshfunc((Shfunc) hn, args);
-#ifdef PATH_DEV_FD
- for (i = 10; i <= max_zsh_fd; i++)
- if (fdtable[i] >= FDT_PROC_SUBST)
- if (--(fdtable[i]) <= FDT_PROC_SUBST)
- zclose(i);
-#endif
} else {
/* It's a builtin */
if (forked)
closem(FDT_INTERNAL);
lastval = execbuiltin(args, (Builtin) hn);
-#ifdef PATH_DEV_FD
- closem(FDT_PROC_SUBST);
-#endif
fflush(stdout);
if (save[1] == -2) {
if (ferror(stdout)) {
@@ -3329,9 +3335,6 @@ execcmd(Estate state, int input, int output, int how, int last1)
DPUTS(varspc,
"BUG: assignment before complex command");
list_pipe = 0;
- if (subsh_close >= 0)
- zclose(subsh_close);
- subsh_close = -1;
/* If we're forked (and we should be), no need to return */
DPUTS(last1 != 1 && !forked, "BUG: not exiting?");
DPUTS(type != WC_SUBSH, "Not sure what we're doing.");
@@ -3874,9 +3877,7 @@ getoutputfile(char *cmd, char **eptr)
untokenize(s);
}
- if (!jobtab[thisjob].filelist)
- jobtab[thisjob].filelist = znewlinklist();
- zaddlinknode(jobtab[thisjob].filelist, nam);
+ addfilelist(nam, 0);
if (!s)
child_block();
@@ -3962,9 +3963,7 @@ getproc(char *cmd, char **eptr)
return NULL;
if (!(prog = parsecmd(cmd, eptr)))
return NULL;
- if (!jobtab[thisjob].filelist)
- jobtab[thisjob].filelist = znewlinklist();
- zaddlinknode(jobtab[thisjob].filelist, ztrdup(pnam));
+ addfilelist(pnam, 0);
if ((pid = zfork(&bgtime))) {
if (pid == -1)
@@ -3982,7 +3981,7 @@ getproc(char *cmd, char **eptr)
entersubsh(ESUB_ASYNC|ESUB_PGRP);
redup(fd, out);
#else /* PATH_DEV_FD */
- int pipes[2];
+ int pipes[2], fd;
if (thisjob == -1)
return NULL;
@@ -3999,7 +3998,9 @@ getproc(char *cmd, char **eptr)
zclose(pipes[!out]);
return NULL;
}
- fdtable[pipes[!out]] = FDT_PROC_SUBST;
+ fd = pipes[!out];
+ fdtable[fd] = FDT_PROC_SUBST;
+ addfilelist(NULL, fd);
if (!out)
{
addproc(pid, NULL, 1, &bgtime);
@@ -4614,6 +4615,7 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
}
starttrapscope();
+ startpatternscope();
pptab = pparams;
if (!(flags & PM_UNDEFINED))
@@ -4661,6 +4663,8 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
offptr++)
opts[*offptr] = 0;
}
+ /* All emulations start with pattern disables clear */
+ clearpatterndisables();
} else
restore_sticky = 0;
@@ -4761,6 +4765,8 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
scriptname = oldscriptname;
oflags = ooflags;
+ endpatternscope(); /* before restoring old LOCALPATTERNS */
+
if (restore_sticky) {
/*
* If we switched to an emulation environment just for
@@ -5070,7 +5076,6 @@ execsave(void)
es->trapisfunc = trapisfunc;
es->traplocallevel = traplocallevel;
es->noerrs = noerrs;
- es->subsh_close = subsh_close;
es->underscore = ztrdup(zunderscore);
es->next = exstack;
exstack = es;
@@ -5081,30 +5086,33 @@ execsave(void)
void
execrestore(void)
{
- struct execstack *en;
+ struct execstack *en = exstack;
DPUTS(!exstack, "BUG: execrestore() without execsave()");
- list_pipe_pid = exstack->list_pipe_pid;
- nowait = exstack->nowait;
- pline_level = exstack->pline_level;
- list_pipe_child = exstack->list_pipe_child;
- list_pipe_job = exstack->list_pipe_job;
- strcpy(list_pipe_text, exstack->list_pipe_text);
- lastval = exstack->lastval;
- noeval = exstack->noeval;
- badcshglob = exstack->badcshglob;
- cmdoutpid = exstack->cmdoutpid;
- cmdoutval = exstack->cmdoutval;
- use_cmdoutval = exstack->use_cmdoutval;
- trap_return = exstack->trap_return;
- trap_state = exstack->trap_state;
- trapisfunc = exstack->trapisfunc;
- traplocallevel = exstack->traplocallevel;
- noerrs = exstack->noerrs;
- subsh_close = exstack->subsh_close;
- setunderscore(exstack->underscore);
- zsfree(exstack->underscore);
- en = exstack->next;
- free(exstack);
- exstack = en;
+
+ queue_signals();
+ exstack = exstack->next;
+
+ list_pipe_pid = en->list_pipe_pid;
+ nowait = en->nowait;
+ pline_level = en->pline_level;
+ list_pipe_child = en->list_pipe_child;
+ list_pipe_job = en->list_pipe_job;
+ strcpy(list_pipe_text, en->list_pipe_text);
+ lastval = en->lastval;
+ noeval = en->noeval;
+ badcshglob = en->badcshglob;
+ cmdoutpid = en->cmdoutpid;
+ cmdoutval = en->cmdoutval;
+ use_cmdoutval = en->use_cmdoutval;
+ trap_return = en->trap_return;
+ trap_state = en->trap_state;
+ trapisfunc = en->trapisfunc;
+ traplocallevel = en->traplocallevel;
+ noerrs = en->noerrs;
+ setunderscore(en->underscore);
+ zsfree(en->underscore);
+ free(en);
+
+ unqueue_signals();
}
diff --git a/Src/glob.c b/Src/glob.c
index ca2ffaf51..e0d0cf68e 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -445,41 +445,6 @@ insert(char *s, int checked)
unqueue_signals();
}
-/* Check to see if str is eligible for filename generation. */
-
-/**/
-mod_export int
-haswilds(char *str)
-{
- /* `[' and `]' are legal even if bad patterns are usually not. */
- if ((*str == Inbrack || *str == Outbrack) && !str[1])
- return 0;
-
- /* If % is immediately followed by ?, then that ? is *
- * not treated as a wildcard. This is so you don't have *
- * to escape job references such as %?foo. */
- if (str[0] == '%' && str[1] == Quest)
- str[1] = '?';
-
- for (; *str; str++) {
- switch (*str) {
- case Inpar:
- case Bar:
- case Star:
- case Inbrack:
- case Inang:
- case Quest:
- return 1;
- case Pound:
- case Hat:
- if (isset(EXTENDEDGLOB))
- return 1;
- break;
- }
- }
- return 0;
-}
-
/* Do the globbing: scanner is called recursively *
* with successive bits of the path until we've *
* tried all of it. */
@@ -708,8 +673,9 @@ parsecomplist(char *instr)
}
/* Parse repeated directories such as (dir/)# and (dir/)## */
- if (*(str = instr) == Inpar && !skipparens(Inpar, Outpar, (char **)&str) &&
- *str == Pound && isset(EXTENDEDGLOB) && str[-2] == '/') {
+ if (*(str = instr) == zpc_special[ZPC_INPAR] &&
+ !skipparens(Inpar, Outpar, (char **)&str) &&
+ *str == zpc_special[ZPC_HASH] && str[-2] == '/') {
instr++;
if (!(p1 = patcompile(instr, compflags, &instr)))
return NULL;
@@ -761,9 +727,9 @@ parsepat(char *str)
* Check for initial globbing flags, so that they don't form
* a bogus path component.
*/
- if ((*str == Inpar && str[1] == Pound && isset(EXTENDEDGLOB)) ||
- (isset(KSHGLOB) && *str == '@' && str[1] == Inpar &&
- str[2] == Pound)) {
+ if ((*str == zpc_special[ZPC_INPAR] && str[1] == zpc_special[ZPC_HASH]) ||
+ (*str == zpc_special[ZPC_KSH_AT] && str[1] == Inpar &&
+ str[2] == zpc_special[ZPC_HASH])) {
str += (*str == Inpar) ? 2 : 3;
if (!patgetglobflags(&str, &assert, &ignore))
return NULL;
@@ -1146,7 +1112,8 @@ zglob(LinkList list, LinkNode np, int nountok)
gf_pre_words = NULL;
/* Check for qualifiers */
- while (!nobareglob || isset(EXTENDEDGLOB)) {
+ while (!nobareglob ||
+ (isset(EXTENDEDGLOB) && !zpc_disables[ZPC_HASH])) {
struct qual *newquals;
char *s;
int sense, paren;
@@ -1192,10 +1159,11 @@ zglob(LinkList list, LinkNode np, int nountok)
case Outpar:
paren++; /*FALLTHROUGH*/
case Bar:
- nobareglob = 1;
+ if (!zpc_disables[ZPC_BAR])
+ nobareglob = 1;
break;
case Tilde:
- if (isset(EXTENDEDGLOB))
+ if (isset(EXTENDEDGLOB) && !zpc_disables[ZPC_TILDE])
nobareglob = 1;
break;
case Inpar:
@@ -1205,7 +1173,7 @@ zglob(LinkList list, LinkNode np, int nountok)
}
if (*s != Inpar)
break;
- if (isset(EXTENDEDGLOB) && s[1] == Pound) {
+ if (isset(EXTENDEDGLOB) && !zpc_disables[ZPC_HASH] && s[1] == Pound) {
if (s[2] == 'q') {
*s = 0;
s += 2;
@@ -1644,7 +1612,8 @@ zglob(LinkList list, LinkNode np, int nountok)
break;
}
default:
- zerr("unknown file attribute");
+ untokenize(--s);
+ zerr("unknown file attribute: %c", *s);
restore_globstate(saved);
return;
}
diff --git a/Src/hist.c b/Src/hist.c
index 561e2acd5..1845bd8ad 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -76,6 +76,9 @@ mod_export int excs, exlast;
* and a temporary history entry is inserted while the user is editing.
* If the resulting line was not added to the list, a flag is set so
* that curhist will be decremented in hbegin().
+ *
+ * Note curhist is passed to zle on variable length argument list:
+ * type must match that retrieved in zle_main_entry.
*/
/**/
@@ -518,6 +521,12 @@ histsubchar(int c)
}
c = ingetc();
}
+ if (ptr == buf &&
+ (c == '}' || c == ';' || c == '\'' || c == '"' || c == '`')) {
+ /* Neither event nor word designator, no expansion */
+ safeinungetc(c);
+ return bangchar;
+ }
*ptr = 0;
if (!*buf) {
if (c != '%') {
@@ -868,6 +877,8 @@ unlinkcurline(void)
mod_export void
hbegin(int dohist)
{
+ char *hf;
+
isfirstln = isfirstch = 1;
errflag = histdone = 0;
if (!dohist)
@@ -921,13 +932,35 @@ hbegin(int dohist)
defev = addhistnum(curhist, -1, HIST_FOREIGN);
} else
histactive = HA_ACTIVE | HA_NOINC;
+
+ hf = getsparam("HISTFILE");
+ /*
+ * For INCAPPENDHISTORY, when interactive, save the history here
+ * as it gives a better estimate of the times of commands.
+ *
+ * If SHAREHISTORY is also set continue to do so in the
+ * standard place, because that's safer about reading and
+ * rewriting history atomically.
+ *
+ * The histsave_stack_pos test won't usually fail here.
+ * We need to test the opposite for the hend() case because we
+ * need to save in the history file we've switched to, but then
+ * we pop immediately after that so the variable becomes zero.
+ * We will already have saved the line and restored the history
+ * so that (correctly) nothing happens here. But it shows
+ * I thought about it.
+ */
+ if (isset(INCAPPENDHISTORY) && !isset(SHAREHISTORY) &&
+ !(histactive & HA_NOINC) && !strin && histsave_stack_pos == 0)
+ savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST);
}
/**/
void
histreduceblanks(void)
{
- int i, len, pos, needblank, spacecount = 0;
+ int i, len, pos, needblank, spacecount = 0, trunc_ok;
+ char *lastptr, *ptr;
if (isset(HISTIGNORESPACE))
while (chline[spacecount] == ' ') spacecount++;
@@ -939,17 +972,41 @@ histreduceblanks(void)
if (chline[len] == '\0')
return;
+ /* Remember where the delimited words end */
+ if (chwordpos)
+ lastptr = chline + chwords[chwordpos-1];
+ else
+ lastptr = chline;
+
for (i = 0, pos = spacecount; i < chwordpos; i += 2) {
len = chwords[i+1] - chwords[i];
needblank = (i < chwordpos-2 && chwords[i+2] > chwords[i+1]);
if (pos != chwords[i]) {
- memcpy(chline + pos, chline + chwords[i], len + needblank);
+ memmove(chline + pos, chline + chwords[i], len + needblank);
chwords[i] = pos;
chwords[i+1] = chwords[i] + len;
}
pos += len + needblank;
}
- chline[pos] = '\0';
+
+ /*
+ * A terminating comment isn't recorded as a word.
+ * Only truncate the line if just whitespace remains.
+ */
+ trunc_ok = 1;
+ for (ptr = lastptr; *ptr; ptr++) {
+ if (!inblank(*ptr)) {
+ trunc_ok = 0;
+ break;
+ }
+ }
+ if (trunc_ok) {
+ chline[pos] = '\0';
+ } else {
+ ptr = chline + pos;
+ while ((*ptr++ = *lastptr++))
+ ;
+ }
}
/**/
@@ -1169,7 +1226,15 @@ mod_export int
hend(Eprog prog)
{
LinkList hookargs = newlinklist();
- int flag, save = 1, hookret, stack_pos = histsave_stack_pos;
+ int flag, hookret, stack_pos = histsave_stack_pos;
+ /*
+ * save:
+ * 0: don't save
+ * 1: save normally
+ * -1: save temporarily, delete after next line
+ * -2: save internally but mark for not writing
+ */
+ int save = 1;
char *hf;
DPUTS(stophist != 2 && !(inbufflags & INP_ALIAS) && !chline,
@@ -1222,7 +1287,11 @@ hend(Eprog prog)
}
if (chwordpos <= 2)
save = 0;
- else if (hookret || should_ignore_line(prog))
+ else if (should_ignore_line(prog))
+ save = -1;
+ else if (hookret == 2)
+ save = -2;
+ else if (hookret)
save = -1;
}
if (flag & (HISTFLAG_DONE | HISTFLAG_RECALL)) {
@@ -1268,7 +1337,12 @@ hend(Eprog prog)
if (isset(HISTREDUCEBLANKS))
histreduceblanks();
}
- newflags = save > 0? 0 : HIST_TMPSTORE;
+ if (save == -1)
+ newflags = HIST_TMPSTORE;
+ else if (save == -2)
+ newflags = HIST_NOWRITE;
+ else
+ newflags = 0;
if ((isset(HISTIGNOREDUPS) || isset(HISTIGNOREALLDUPS)) && save > 0
&& hist_ring && histstrcmp(chline, hist_ring->node.nam) == 0) {
/* This history entry compares the same as the previous.
@@ -1300,7 +1374,11 @@ hend(Eprog prog)
chline = hptr = NULL;
chwords = NULL;
histactive = 0;
- if (isset(SHAREHISTORY)? histfileIsLocked() : isset(INCAPPENDHISTORY))
+ /*
+ * For normal INCAPPENDHISTORY case and reasoning, see hbegin().
+ */
+ if (isset(SHAREHISTORY) ? histfileIsLocked() :
+ (isset(INCAPPENDHISTORY) && histsave_stack_pos != 0))
savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST);
unlockhistfile(hf); /* It's OK to call this even if we aren't locked */
/*
@@ -2389,6 +2467,9 @@ readhistfile(char *fn, int err, int readflags)
zerr("can't read history file %s", fn);
unlockhistfile(fn);
+
+ if (zleactive)
+ zleentry(ZLE_CMD_SET_HIST_LINE, curhist);
}
#ifdef HAVE_FCNTL_H
@@ -2519,14 +2600,29 @@ savehistfile(char *fn, int err, int writeflags)
}
}
if (out) {
+ char *history_ignore;
+ Patprog histpat = NULL;
+
+ pushheap();
+
+ if ((history_ignore = getsparam("HISTORY_IGNORE")) != NULL) {
+ tokenize(history_ignore = dupstring(history_ignore));
+ remnulargs(history_ignore);
+ histpat = patcompile(history_ignore, 0, NULL);
+ }
+
ret = 0;
for (; he && he->histnum <= xcurhist; he = down_histent(he)) {
if ((writeflags & HFILE_SKIPDUPS && he->node.flags & HIST_DUP)
|| (writeflags & HFILE_SKIPFOREIGN && he->node.flags & HIST_FOREIGN)
|| he->node.flags & HIST_TMPSTORE)
continue;
+ if (histpat &&
+ pattry(histpat, metafy(he->node.nam, -1, META_HEAPDUP))) {
+ continue;
+ }
if (writeflags & HFILE_SKIPOLD) {
- if (he->node.flags & HIST_OLD)
+ if (he->node.flags & (HIST_OLD|HIST_NOWRITE))
continue;
he->node.flags |= HIST_OLD;
if (writeflags & HFILE_USE_OPTIONS)
@@ -2604,6 +2700,8 @@ savehistfile(char *fn, int err, int writeflags)
histactive = remember_histactive;
}
}
+
+ popheap();
} else
ret = -1;
@@ -3314,6 +3412,8 @@ pushhiststack(char *hf, zlong hs, zlong shs, int level)
}
hist_ring = NULL;
curhist = histlinect = 0;
+ if (zleactive)
+ zleentry(ZLE_CMD_SET_HIST_LINE, curhist);
histsiz = hs;
savehistsiz = shs;
inithist(); /* sets histtab */
@@ -3353,6 +3453,8 @@ pophiststack(void)
histtab = h->histtab;
hist_ring = h->hist_ring;
curhist = h->curhist;
+ if (zleactive)
+ zleentry(ZLE_CMD_SET_HIST_LINE, curhist);
histlinect = h->histlinect;
histsiz = h->histsiz;
savehistsiz = h->savehistsiz;
diff --git a/Src/init.c b/Src/init.c
index 8467a739c..7032ff8ae 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -281,9 +281,10 @@ parseargs(char **argv, char **runscript)
/**/
static void
-parseopts_insert(LinkList optlist, void *ptr)
+parseopts_insert(LinkList optlist, void *base, int optno)
{
LinkNode node;
+ void *ptr = base + (optno < 0 ? -optno : optno);
for (node = firstnode(optlist); node; incnode(node)) {
if (ptr < getdata(node)) {
@@ -390,7 +391,7 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
if (dosetopt(optno, action, !nam, new_opts) && nam) {
WARN_OPTION("can't change option: %s", *argv);
} else if (optlist) {
- parseopts_insert(optlist, new_opts+optno);
+ parseopts_insert(optlist, new_opts, optno);
}
}
break;
@@ -415,7 +416,7 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
if (dosetopt(optno, action, !nam, new_opts) && nam) {
WARN_OPTION("can't change option: -%c", **argv);
} else if (optlist) {
- parseopts_insert(optlist, new_opts+optno);
+ parseopts_insert(optlist, new_opts, optno);
}
}
}
@@ -1113,6 +1114,7 @@ init_signals(void)
install_handler(SIGCHLD);
#ifdef SIGWINCH
install_handler(SIGWINCH);
+ winch_block(); /* See utils.c:preprompt() */
#endif
if (interact) {
install_handler(SIGALRM);
@@ -1582,6 +1584,7 @@ zsh_main(UNUSED(int argc), char **argv)
fdtable_size = zopenmax();
fdtable = zshcalloc(fdtable_size*sizeof(*fdtable));
+ fdtable[0] = fdtable[1] = fdtable[2] = FDT_EXTERNAL;
createoptiontable();
emulate(zsh_name, 1, &emulation, opts); /* initialises most options */
diff --git a/Src/input.c b/Src/input.c
index 5cff22da4..4ac7e6ec8 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -142,12 +142,14 @@ shingetline(void)
char *p;
p = buf;
+ winch_unblock();
for (;;) {
do {
errno = 0;
c = fgetc(bshin);
} while (c < 0 && errno == EINTR);
if (c < 0 || c == '\n') {
+ winch_block();
if (c == '\n')
*p++ = '\n';
if (p > buf) {
@@ -163,11 +165,13 @@ shingetline(void)
} else
*p++ = c;
if (p >= buf + BUFSIZ - 1) {
+ winch_block();
line = zrealloc(line, ll + (p - buf) + 1);
memcpy(line + ll, buf, p - buf);
ll += p - buf;
line[ll] = '\0';
p = buf;
+ winch_unblock();
}
}
}
diff --git a/Src/jobs.c b/Src/jobs.c
index 0dbb10b4f..371b8eb32 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -376,6 +376,36 @@ check_cursh_sig(int sig)
}
}
+/**/
+void
+storepipestats(Job jn, int inforeground, int fixlastval)
+{
+ int i, pipefail = 0, jpipestats[MAX_PIPESTATS];
+ Process p;
+
+ for (p = jn->procs, i = 0; p && i < MAX_PIPESTATS; p = p->next, i++) {
+ jpipestats[i] = ((WIFSIGNALED(p->status)) ?
+ 0200 | WTERMSIG(p->status) :
+ WEXITSTATUS(p->status));
+ if (jpipestats[i])
+ pipefail = jpipestats[i];
+ }
+ if (inforeground) {
+ memcpy(pipestats, jpipestats, sizeof(int)*i);
+ if ((jn->stat & STAT_CURSH) && i < MAX_PIPESTATS)
+ pipestats[i++] = lastval;
+ numpipestats = i;
+ }
+
+ if (fixlastval) {
+ if (jn->stat & STAT_CURSH) {
+ if (!lastval && isset(PIPEFAIL))
+ lastval = pipefail;
+ } else if (isset(PIPEFAIL))
+ lastval = pipefail;
+ }
+}
+
/* Update status of job, possibly printing it */
/**/
@@ -507,17 +537,13 @@ update_job(Job jn)
return;
jn->stat |= (somestopped) ? STAT_CHANGED | STAT_STOPPED :
STAT_CHANGED | STAT_DONE;
- if (job == thisjob && (jn->stat & STAT_DONE)) {
- int i;
- Process p;
-
- for (p = jn->procs, i = 0; p && i < MAX_PIPESTATS; p = p->next, i++)
- pipestats[i] = ((WIFSIGNALED(p->status)) ?
- 0200 | WTERMSIG(p->status) :
- WEXITSTATUS(p->status));
- if ((jn->stat & STAT_CURSH) && i < MAX_PIPESTATS)
- pipestats[i++] = lastval;
- numpipestats = i;
+ if (jn->stat & STAT_DONE) {
+ /* This may be redundant with printjob() but note that inforeground
+ * is true here for STAT_CURSH jobs even when job != thisjob, most
+ * likely because thisjob = -1 from exec.c:execsimple() trickery.
+ * However, if we reset lastval here we break it for printjob().
+ */
+ storepipestats(jn, inforeground, 0);
}
if (!inforeground &&
(jn->stat & (STAT_SUBJOB | STAT_DONE)) == (STAT_SUBJOB | STAT_DONE)) {
@@ -915,10 +941,13 @@ printjob(Job jn, int lng, int synch)
int doneprint = 0, skip_print = 0;
FILE *fout = (synch == 2 || !shout) ? stdout : shout;
- if (oldjobtab != NULL)
+ if (synch > 1 && oldjobtab != NULL)
job = jn - oldjobtab;
else
job = jn - jobtab;
+ DPUTS3(job < 0 || job > (oldjobtab && synch > 1 ? oldmaxjob : maxjob),
+ "bogus job number, jn = %L, jobtab = %L, oldjobtab = %L",
+ (long)jn, (long)jobtab, (long)oldjobtab);
if (jn->stat & STAT_NOPRINT) {
skip_print = 1;
@@ -968,6 +997,9 @@ printjob(Job jn, int lng, int synch)
if (skip_print) {
if (jn->stat & STAT_DONE) {
+ /* This looks silly, but see update_job() */
+ if (synch <= 1)
+ storepipestats(jn, job == thisjob, job == thisjob);
if (should_report_time(jn))
dumptime(jn);
deletejob(jn, 0);
@@ -1083,9 +1115,9 @@ printjob(Job jn, int lng, int synch)
fflush(fout);
}
-/* print "(pwd now: foo)" messages: with (lng & 4) we are printing
- * the directory where the job is running, otherwise the current directory
- */
+ /* print "(pwd now: foo)" messages: with (lng & 4) we are printing
+ * the directory where the job is running, otherwise the current directory
+ */
if ((lng & 4) || (interact && job == thisjob &&
jn->pwd && strcmp(jn->pwd, pwd))) {
@@ -1095,9 +1127,13 @@ printjob(Job jn, int lng, int synch)
fprintf(fout, ")\n");
fflush(fout);
}
-/* delete job if done */
+
+ /* delete job if done */
if (jn->stat & STAT_DONE) {
+ /* This looks silly, but see update_job() */
+ if (synch <= 1)
+ storepipestats(jn, job == thisjob, job == thisjob);
if (should_report_time(jn))
dumptime(jn);
deletejob(jn, 0);
@@ -1113,16 +1149,48 @@ printjob(Job jn, int lng, int synch)
return doneprint;
}
+/* Add a file to be deleted or fd to be closed to the current job */
+
+/**/
+void
+addfilelist(const char *name, int fd)
+{
+ Jobfile jf = (Jobfile)zalloc(sizeof(struct jobfile));
+ LinkList ll = jobtab[thisjob].filelist;
+
+ if (!ll)
+ ll = jobtab[thisjob].filelist = znewlinklist();
+ if (name)
+ {
+ jf->u.name = ztrdup(name);
+ jf->is_fd = 0;
+ }
+ else
+ {
+ jf->u.fd = fd;
+ jf->is_fd = 1;
+ }
+ zaddlinknode(ll, jf);
+}
+
+/* Finished with list of files for a job */
+
/**/
void
deletefilelist(LinkList file_list, int disowning)
{
- char *s;
+ Jobfile jf;
if (file_list) {
- while ((s = (char *)getlinknode(file_list))) {
- if (!disowning)
- unlink(s);
- zsfree(s);
+ while ((jf = (Jobfile)getlinknode(file_list))) {
+ if (jf->is_fd) {
+ if (!disowning)
+ zclose(jf->u.fd);
+ } else {
+ if (!disowning)
+ unlink(jf->u.name);
+ zsfree(jf->u.name);
+ }
+ zfree(jf, sizeof(*jf));
}
zfree(file_list, sizeof(struct linklist));
}
@@ -1336,6 +1404,31 @@ zwaitjob(int job, int wait_cmd)
jn->stat |= STAT_LOCKED;
if (jn->stat & STAT_CHANGED)
printjob(jn, !!isset(LONGLISTJOBS), 1);
+ if (jn->filelist) {
+ /*
+ * The main shell is finished with any file descriptors used
+ * for process substitution associated with this job: close
+ * them to indicate to listeners there's no more input.
+ *
+ * Note we can't safely delete temporary files yet as these
+ * are directly visible to other processes. However,
+ * we can't deadlock on the fact that those still exist, so
+ * that's not a problem.
+ */
+ LinkNode node = firstnode(jn->filelist);
+ while (node) {
+ Jobfile jf = (Jobfile)getdata(node);
+ if (jf->is_fd) {
+ LinkNode next = nextnode(node);
+ (void)remnode(jn->filelist, node);
+ zclose(jf->u.fd);
+ zfree(jf, sizeof(*jf));
+ node = next;
+ } else {
+ incnode(node);
+ }
+ }
+ }
while (!errflag && jn->stat &&
!(jn->stat & STAT_DONE) &&
!(interact && (jn->stat & STAT_STOPPED))) {
@@ -2522,6 +2615,8 @@ acquire_pgrp(void)
while ((ttpgrp = gettygrp()) != -1 && ttpgrp != mypgrp) {
mypgrp = GETPGRP();
if (mypgrp == mypid) {
+ if (!interact)
+ break; /* attachtty() will be a no-op, give up */
signal_setmask(oldset);
attachtty(mypgrp); /* Might generate SIGT* */
signal_block(blockset);
diff --git a/Src/lex.c b/Src/lex.c
index ac87e5ec8..d0f845020 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -778,6 +778,7 @@ gettok(void)
bptr = tokstr = (char *)hcalloc(bsiz = 32);
add(c);
}
+ hwend();
while ((c = ingetc()) != '\n' && !lexstop) {
hwaddc(c);
addtoline(c);
diff --git a/Src/math.c b/Src/math.c
index e90d6a59a..eae283d19 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -362,8 +362,9 @@ mathevall(char *s, enum prec_type prec_tp, char **ep)
if (mlevel >= MAX_MLEVEL) {
xyyval.type = MN_INTEGER;
xyyval.u.l = 0;
+ *ep = s;
- zerr("math recursion limit exceeded");
+ zerr("math recursion limit exceeded: %s", *ep);
return xyyval;
}
@@ -456,6 +457,11 @@ lexconstant(void)
yyval.u.l = zstrtol_underscore(ptr, &ptr, 0, 1);
/* Should we set lastbase here? */
lastbase = 16;
+ if (isset(FORCEFLOAT))
+ {
+ yyval.type = MN_FLOAT;
+ yyval.u.d = (double)yyval.u.l;
+ }
return NUM;
}
else if (isset(OCTALZEROES))
@@ -475,6 +481,11 @@ lexconstant(void)
{
yyval.u.l = zstrtol_underscore(ptr, &ptr, 0, 1);
lastbase = 8;
+ if (isset(FORCEFLOAT))
+ {
+ yyval.type = MN_FLOAT;
+ yyval.u.d = (double)yyval.u.l;
+ }
return NUM;
}
nptr = ptr2;
@@ -537,6 +548,11 @@ lexconstant(void)
lastbase = yyval.u.l;
yyval.u.l = zstrtol_underscore(ptr, &ptr, lastbase, 1);
}
+ if (isset(FORCEFLOAT))
+ {
+ yyval.type = MN_FLOAT;
+ yyval.u.d = (double)yyval.u.l;
+ }
}
return NUM;
}
@@ -1443,7 +1459,8 @@ mathparse(int pc)
case QUEST:
if (stack[sp].val.type == MN_UNSET)
stack[sp].val = getmathparam(stack + sp);
- q = (stack[sp].val.type == MN_FLOAT) ? (zlong)stack[sp].val.u.d :
+ q = (stack[sp].val.type == MN_FLOAT) ?
+ (stack[sp].val.u.d == 0 ? 0 : 1) :
stack[sp].val.u.l;
if (!q)
diff --git a/Src/options.c b/Src/options.c
index b36bd9944..ce73d9901 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -131,6 +131,7 @@ static struct optname optns[] = {
{{NULL, "extendedhistory", OPT_CSH}, EXTENDEDHISTORY},
{{NULL, "evallineno", OPT_EMULATE|OPT_ZSH}, EVALLINENO},
{{NULL, "flowcontrol", OPT_ALL}, FLOWCONTROL},
+{{NULL, "forcefloat", 0}, FORCEFLOAT},
{{NULL, "functionargzero", OPT_EMULATE|OPT_NONBOURNE},FUNCTIONARGZERO},
{{NULL, "glob", OPT_EMULATE|OPT_ALL}, GLOBOPT},
{{NULL, "globalexport", OPT_EMULATE|OPT_ZSH}, GLOBALEXPORT},
@@ -178,6 +179,7 @@ static struct optname optns[] = {
{{NULL, "listrowsfirst", 0}, LISTROWSFIRST},
{{NULL, "listtypes", OPT_ALL}, LISTTYPES},
{{NULL, "localoptions", OPT_EMULATE|OPT_KSH}, LOCALOPTIONS},
+{{NULL, "localpatterns", OPT_EMULATE}, LOCALPATTERNS},
{{NULL, "localtraps", OPT_EMULATE|OPT_KSH}, LOCALTRAPS},
{{NULL, "login", OPT_SPECIAL}, LOGINSHELL},
{{NULL, "longlistjobs", 0}, LONGLISTJOBS},
@@ -203,6 +205,7 @@ static struct optname optns[] = {
{{NULL, "overstrike", 0}, OVERSTRIKE},
{{NULL, "pathdirs", OPT_EMULATE}, PATHDIRS},
{{NULL, "pathscript", OPT_EMULATE|OPT_BOURNE}, PATHSCRIPT},
+{{NULL, "pipefail", OPT_EMULATE}, PIPEFAIL},
{{NULL, "posixaliases", OPT_EMULATE|OPT_BOURNE}, POSIXALIASES},
{{NULL, "posixbuiltins", OPT_EMULATE|OPT_BOURNE}, POSIXBUILTINS},
{{NULL, "posixcd", OPT_EMULATE|OPT_BOURNE}, POSIXCD},
diff --git a/Src/params.c b/Src/params.c
index 8649178ef..d6711e4fa 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -4667,10 +4667,12 @@ startparamscope(void)
mod_export void
endparamscope(void)
{
+ queue_signals();
locallevel--;
/* This pops anything from a higher locallevel */
saveandpophiststack(0, HFILE_USE_OPTIONS);
scanhashtable(paramtab, 0, 0, 0, scanendscope, 0);
+ unqueue_signals();
}
/**/
diff --git a/Src/parse.c b/Src/parse.c
index 753080d70..f0d0855d3 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2088,9 +2088,17 @@ par_cond_2(void)
}
}
if (tok == BANG) {
- condlex();
- ecadd(WCB_COND(COND_NOT, 0));
- return par_cond_2();
+ /*
+ * In "test" compatibility mode, "! -a ..." and "! -o ..."
+ * are treated as "[string] [and] ..." and "[string] [or] ...".
+ */
+ if (!(condlex == testlex && *testargs &&
+ (!strcmp(*testargs, "-a") || !strcmp(*testargs, "-o"))))
+ {
+ condlex();
+ ecadd(WCB_COND(COND_NOT, 0));
+ return par_cond_2();
+ }
}
if (tok == INPAR) {
int r;
@@ -3171,6 +3179,9 @@ load_dump_file(char *dump, struct stat *sbuf, int other, int len)
d->dev = sbuf->st_dev;
d->ino = sbuf->st_ino;
d->fd = fd;
+#ifdef FD_CLOEXEC
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
+#endif
d->map = addr + (other ? (len - off) / sizeof(wordcode) : 0);
d->addr = addr;
d->len = len;
@@ -3415,6 +3426,16 @@ incrdumpcount(FuncDump f)
f->count++;
}
+/**/
+static void
+freedump(FuncDump f)
+{
+ munmap((void *) f->addr, f->len);
+ zclose(f->fd);
+ zsfree(f->filename);
+ zfree(f, sizeof(*f));
+}
+
/* Decrement the reference counter for a dump file. If zero, unmap the file. */
/**/
@@ -3431,23 +3452,23 @@ decrdumpcount(FuncDump f)
q->next = p->next;
else
dumps = p->next;
- munmap((void *) f->addr, f->len);
- zclose(f->fd);
- zsfree(f->filename);
- zfree(f, sizeof(*f));
+ freedump(f);
}
}
}
+#ifndef FD_CLOEXEC
/**/
mod_export void
closedumps(void)
{
- FuncDump p;
-
- for (p = dumps; p; p = p->next)
- zclose(p->fd);
+ while (dumps) {
+ FuncDump p = dumps->next;
+ freedump(dumps);
+ dumps = p;
+ }
}
+#endif
#else
@@ -3461,11 +3482,13 @@ decrdumpcount(FuncDump f)
{
}
+#ifndef FD_CLOEXEC
/**/
mod_export void
closedumps(void)
{
}
+#endif
#endif
diff --git a/Src/pattern.c b/Src/pattern.c
index 53ada0f8d..a7ef12573 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -225,34 +225,50 @@ typedef unsigned long zrange_t;
#endif
/*
- * Characters which terminate a pattern segment. We actually use
- * a pointer patendseg which skips the first character if we are not
- * parsing a file pattern.
- * Note that the size of this and the next array are hard-wired
- * via the definitions.
+ * Array of characters corresponding to zpc_chars enum, which it must match.
*/
+static const char zpc_chars[ZPC_COUNT] = {
+ '/', '\0', Bar, Outpar, Tilde, Inpar, Quest, Star, Inbrack, Inang,
+ Hat, Pound, Bnullkeep, Quest, Star, '+', '!', '@'
+};
-static char endseg[] = {
- '/', /* file only */
- '\0', Bar, Outpar, /* all patterns */
- Tilde /* extended glob only */
+/*
+ * Corresponding strings used in enable/disable -p.
+ * NULL means no way of turning this on or off.
+ */
+/**/
+mod_export const char *zpc_strings[ZPC_COUNT] = {
+ NULL, NULL, "|", NULL, "~", "(", "?", "*", "[", "<",
+ "^", "#", NULL, "?(", "*(", "+(", "!(", "@("
};
-#define PATENDSEGLEN_NORM 4
-#define PATENDSEGLEN_EXT 5
+/*
+ * Corresponding array of pattern disables as set by the user
+ * using "disable -p".
+ */
+/**/
+mod_export char zpc_disables[ZPC_COUNT];
-/* Characters which terminate a simple string */
+/*
+ * Stack of saved (compressed) zpc_disables for function scope.
+ */
-static char endstr[] = {
- '/', /* file only */
- '\0', Bar, Outpar, Quest, Star, Inbrack, Inpar, Inang, Bnullkeep,
- /* all patterns */
- Tilde, Hat, Pound /* extended glob only */
-};
+static struct zpc_disables_save *zpc_disables_stack;
-#define PATENDSTRLEN_NORM 10
-#define PATENDSTRLEN_EXT 13
+/*
+ * Characters which terminate a simple string (ZPC_COUNT) or
+ * an entire pattern segment (the first ZPC_SEG_COUNT).
+ * Each entry is either the corresponding character in zpc_chars
+ * or Marker which is guaranteed not to match a character in a
+ * pattern we are compiling.
+ *
+ * The complete list indicates characters that are special, so e.g.
+ * (testchar == special[ZPC_TILDE]) succeeds only if testchar is a Tilde
+ * *and* Tilde is currently special.
+ */
+/**/
+char zpc_special[ZPC_COUNT];
/* Default size for pattern buffer */
#define P_DEF_ALLOC 256
@@ -264,10 +280,6 @@ static char *patcode; /* point of code emission */
static long patsize; /* size of code */
static char *patout; /* start of code emission string */
static long patalloc; /* size allocated for same */
-static char *patendseg; /* characters ending segment */
-static int patendseglen; /* length of same */
-static char *patendstr; /* characters ending plain string */
-static int patendstrlen; /* length of sameo */
/* Flags used in both compilation and execution */
static int patflags; /* flags passed down to patcompile */
@@ -417,12 +429,68 @@ static long rn_offs;
(P_OP(p) == P_BACK) ? \
((p)-rn_offs) : ((p)+rn_offs) : NULL)
+/*
+ * Set up zpc_special with characters that end a string segment.
+ * "Marker" cannot occur in the pattern we are compiling so
+ * is used to mark "invalid".
+ */
+static void
+patcompcharsset(void)
+{
+ char *spp, *disp;
+ int i;
+
+ /* Initialise enabled special characters */
+ memcpy(zpc_special, zpc_chars, ZPC_COUNT);
+ /* Apply user disables from disable -p */
+ for (i = 0, spp = zpc_special, disp = zpc_disables;
+ i < ZPC_COUNT;
+ i++, spp++, disp++) {
+ if (*disp)
+ *spp = Marker;
+ }
+
+ if (!isset(EXTENDEDGLOB)) {
+ /* Extended glob characters are not active */
+ zpc_special[ZPC_TILDE] = zpc_special[ZPC_HAT] =
+ zpc_special[ZPC_HASH] = Marker;
+ }
+ if (!isset(KSHGLOB)) {
+ /*
+ * Ksh glob characters are not active.
+ * * and ? are shared with normal globbing, but for their
+ * use here we are looking for a following Inpar.
+ */
+ zpc_special[ZPC_KSH_QUEST] = zpc_special[ZPC_KSH_STAR] =
+ zpc_special[ZPC_KSH_PLUS] = zpc_special[ZPC_KSH_BANG] =
+ zpc_special[ZPC_KSH_AT] = Marker;
+ }
+ /*
+ * Note that if we are using KSHGLOB, then we test for a following
+ * Inpar, not zpc_special[ZPC_INPAR]: the latter makes an Inpar on
+ * its own active. The zpc_special[ZPC_KSH_*] followed by any old Inpar
+ * discriminate ksh globbing.
+ */
+ if (isset(SHGLOB)) {
+ /*
+ * Grouping and numeric ranges are not valid.
+ * We do allow alternation, however; it's needed for
+ * "case". This may not be entirely consistent.
+ *
+ * Don't disable Outpar: we may need to match the end of KSHGLOB
+ * parentheses and it would be difficult to tell them apart.
+ */
+ zpc_special[ZPC_INPAR] = zpc_special[ZPC_INANG] = Marker;
+ }
+}
+
/* Called before parsing a set of file matchs to initialize flags */
/**/
void
patcompstart(void)
{
+ patcompcharsset();
if (isset(CASEGLOB))
patglobflags = 0;
else
@@ -469,16 +537,9 @@ patcompile(char *exp, int inflags, char **endexp)
patnpar = 1;
patflags = inflags & ~(PAT_PURES|PAT_HAS_EXCLUDP);
- patendseg = endseg;
- patendseglen = isset(EXTENDEDGLOB) ? PATENDSEGLEN_EXT : PATENDSEGLEN_NORM;
- patendstr = endstr;
- patendstrlen = isset(EXTENDEDGLOB) ? PATENDSTRLEN_EXT : PATENDSTRLEN_NORM;
-
if (!(patflags & PAT_FILE)) {
- patendseg++;
- patendstr++;
- patendseglen--;
- patendstrlen--;
+ patcompcharsset();
+ zpc_special[ZPC_SLASH] = Marker;
remnulargs(patparse);
if (isset(MULTIBYTE))
patglobflags = GF_MULTIBYTE;
@@ -687,7 +748,7 @@ patcompswitch(int paren, int *flagp)
starter = 0;
br = patnode(P_BRANCH);
- if (!patcompbranch(&flags))
+ if (!patcompbranch(&flags, paren))
return 0;
if (patglobflags != (int)savglobflags)
gfchanged++;
@@ -698,11 +759,11 @@ patcompswitch(int paren, int *flagp)
*flagp |= flags & (P_HSTART|P_PURESTR);
- while (*patparse == Bar ||
- (isset(EXTENDEDGLOB) && *patparse == Tilde &&
+ while (*patparse == zpc_chars[ZPC_BAR] ||
+ (*patparse == zpc_special[ZPC_TILDE] &&
(patparse[1] == '/' ||
- !memchr(patendseg, patparse[1], patendseglen)))) {
- int tilde = *patparse++ == Tilde;
+ !memchr(zpc_special, patparse[1], ZPC_SEG_COUNT)))) {
+ int tilde = *patparse++ == zpc_special[ZPC_TILDE];
long gfnode = 0, newbr;
*flagp &= ~P_PURESTR;
@@ -739,12 +800,9 @@ patcompswitch(int paren, int *flagp)
up.p = NULL;
patadd((char *)&up, 0, sizeof(up), 0);
/* / is not treated as special if we are at top level */
- if (!paren && *patendseg == '/') {
+ if (!paren && zpc_special[ZPC_SLASH] == '/') {
tilde++;
- patendseg++;
- patendseglen--;
- patendstr++;
- patendstrlen--;
+ zpc_special[ZPC_SLASH] = Marker;
}
} else {
excsync = 0;
@@ -781,13 +839,10 @@ patcompswitch(int paren, int *flagp)
patglobflags = (int)savglobflags;
}
}
- newbr = patcompbranch(&flags);
+ newbr = patcompbranch(&flags, paren);
if (tilde == 2) {
/* restore special treatment of / */
- patendseg--;
- patendseglen++;
- patendstr--;
- patendstrlen++;
+ zpc_special[ZPC_SLASH] = '/';
}
if (!newbr)
return 0;
@@ -847,7 +902,7 @@ patcompswitch(int paren, int *flagp)
/**/
static long
-patcompbranch(int *flagp)
+patcompbranch(int *flagp, int paren)
{
long chain, latest = 0, starter;
int flags = 0;
@@ -855,14 +910,13 @@ patcompbranch(int *flagp)
*flagp = P_PURESTR;
starter = chain = 0;
- while (!memchr(patendseg, *patparse, patendseglen) ||
- (*patparse == Tilde && patparse[1] != '/' &&
- memchr(patendseg, patparse[1], patendseglen))) {
- if (isset(EXTENDEDGLOB) &&
- ((!isset(SHGLOB) &&
- (*patparse == Inpar && patparse[1] == Pound)) ||
- (isset(KSHGLOB) && *patparse == '@' && patparse[1] == Inpar &&
- patparse[2] == Pound))) {
+ while (!memchr(zpc_special, *patparse, ZPC_SEG_COUNT) ||
+ (*patparse == zpc_special[ZPC_TILDE] && patparse[1] != '/' &&
+ memchr(zpc_special, patparse[1], ZPC_SEG_COUNT))) {
+ if ((*patparse == zpc_special[ZPC_INPAR] &&
+ patparse[1] == zpc_special[ZPC_HASH]) ||
+ (*patparse == zpc_special[ZPC_KSH_AT] && patparse[1] == Inpar &&
+ patparse[2] == zpc_special[ZPC_HASH])) {
/* Globbing flags. */
char *pp1 = patparse;
int oldglobflags = patglobflags, ignore;
@@ -910,7 +964,7 @@ patcompbranch(int *flagp)
break;
else
continue;
- } else if (isset(EXTENDEDGLOB) && *patparse == Hat) {
+ } else if (*patparse == zpc_special[ZPC_HAT]) {
/*
* ^pat: anything but pat. For proper backtracking,
* etc., we turn this into (*~pat), except without the
@@ -919,7 +973,7 @@ patcompbranch(int *flagp)
patparse++;
latest = patcompnot(0, &flags);
} else
- latest = patcomppiece(&flags);
+ latest = patcomppiece(&flags, paren);
if (!latest)
return 0;
if (!starter)
@@ -1167,11 +1221,11 @@ pattern_range_to_string(char *rangestr, char *outstr)
/**/
static long
-patcomppiece(int *flagp)
+patcomppiece(int *flagp, int paren)
{
long starter = 0, next, op, opnd;
int flags, flags2, kshchar, len, ch, patch, nmeta;
- int pound, count;
+ int hash, count;
union upat up;
char *nptr, *str0, *ptr, *patprev;
zrange_t from, to;
@@ -1185,25 +1239,39 @@ patcomppiece(int *flagp)
* the string doesn't introduce a ksh-like parenthesized expression.
*/
kshchar = '\0';
- if (isset(KSHGLOB) && *patparse && patparse[1] == Inpar) {
- if (strchr("?*+!@", *patparse))
- kshchar = STOUC(*patparse);
- else if (*patparse == Star || *patparse == Quest)
- kshchar = STOUC(ztokens[*patparse - Pound]);
+ if (*patparse && patparse[1] == Inpar) {
+ if (*patparse == zpc_special[ZPC_KSH_PLUS])
+ kshchar = STOUC('+');
+ else if (*patparse == zpc_special[ZPC_KSH_BANG])
+ kshchar = STOUC('!');
+ else if (*patparse == zpc_special[ZPC_KSH_AT])
+ kshchar = STOUC('@');
+ else if (*patparse == zpc_special[ZPC_KSH_STAR])
+ kshchar = STOUC('*');
+ else if (*patparse == zpc_special[ZPC_KSH_QUEST])
+ kshchar = STOUC('?');
}
/*
- * End of string (or no string at all) if ksh-type parentheses,
- * or special character, unless that character is a tilde and
- * the character following is an end-of-segment character. Thus
- * tildes are not special if there is nothing following to
- * be excluded.
+ * If '(' is disabled as a pattern char, allow ')' as
+ * an ordinary string character if there are no parentheses to
+ * close. Don't allow it otherwise, it changes the syntax.
*/
- if (kshchar || (memchr(patendstr, *patparse, patendstrlen) &&
- (*patparse != Tilde ||
- patparse[1] == '/' ||
- !memchr(patendseg, patparse[1], patendseglen))))
- break;
+ if (zpc_special[ZPC_INPAR] != Marker || *patparse != Outpar ||
+ paren) {
+ /*
+ * End of string (or no string at all) if ksh-type parentheses,
+ * or special character, unless that character is a tilde and
+ * the character following is an end-of-segment character. Thus
+ * tildes are not special if there is nothing following to
+ * be excluded.
+ */
+ if (kshchar || (memchr(zpc_special, *patparse, ZPC_COUNT) &&
+ (*patparse != zpc_special[ZPC_TILDE] ||
+ patparse[1] == '/' ||
+ !memchr(zpc_special, patparse[1], ZPC_SEG_COUNT))))
+ break;
+ }
/* Remember the previous character for backtracking */
patprev = patparse;
@@ -1227,10 +1295,14 @@ patcomppiece(int *flagp)
* If we have more than one character, a following hash
* or (#c...) only applies to the last, so backtrack one character.
*/
- if (isset(EXTENDEDGLOB) &&
- (*patparse == Pound ||
- (*patparse == Inpar && patparse[1] == Pound &&
- patparse[2] == 'c')) && morelen)
+ if ((*patparse == zpc_special[ZPC_HASH] ||
+ (*patparse == zpc_special[ZPC_INPAR] &&
+ patparse[1] == zpc_special[ZPC_HASH] &&
+ patparse[2] == 'c') ||
+ (*patparse == zpc_special[ZPC_KSH_AT] &&
+ patparse[1] == Inpar &&
+ patparse[2] == zpc_special[ZPC_HASH] &&
+ patparse[3] == 'c')) && morelen)
patparse = patprev;
/*
* If len is 1, we can't have an active # following, so doesn't
@@ -1306,15 +1378,21 @@ patcomppiece(int *flagp)
METACHARINC(patparse);
switch(patch) {
case Quest:
+ DPUTS(zpc_special[ZPC_QUEST] == Marker,
+ "Treating '?' as pattern character although disabled");
flags |= P_SIMPLE;
starter = patnode(P_ANY);
break;
case Star:
+ DPUTS(zpc_special[ZPC_STAR] == Marker,
+ "Treating '*' as pattern character although disabled");
/* kshchar is used as a sign that we can't have #'s. */
kshchar = -1;
starter = patnode(P_STAR);
break;
case Inbrack:
+ DPUTS(zpc_special[ZPC_INBRACK] == Marker,
+ "Treating '[' as pattern character although disabled");
flags |= P_SIMPLE;
if (*patparse == Hat || *patparse == '^' || *patparse == '!') {
patparse++;
@@ -1368,9 +1446,10 @@ patcomppiece(int *flagp)
patadd(NULL, 0, 1, 0);
break;
case Inpar:
- /* is this how to treat parentheses in SHGLOB? */
- if (isset(SHGLOB) && !kshchar)
- return 0;
+ DPUTS(!kshchar && zpc_special[ZPC_INPAR] == Marker,
+ "Treating '(' as pattern character although disabled");
+ DPUTS(isset(SHGLOB) && !kshchar,
+ "Treating bare '(' as pattern character with SHGLOB");
if (kshchar == '!') {
/* This is nasty, we should really either handle all
* kshglobbing below or here. But most of the
@@ -1393,6 +1472,9 @@ patcomppiece(int *flagp)
break;
case Inang:
/* Numeric glob */
+ DPUTS(zpc_special[ZPC_INANG] == Marker,
+ "Treating '<' as pattern character although disabled");
+ DPUTS(isset(SHGLOB), "Treating <..> as numeric range with SHGLOB");
len = 0; /* beginning present 1, end present 2 */
if (idigit(*patparse)) {
from = (zrange_t) zstrtol((char *)patparse,
@@ -1435,6 +1517,8 @@ patcomppiece(int *flagp)
*/
break;
case Pound:
+ DPUTS(zpc_special[ZPC_HASH] == Marker,
+ "Treating '#' as pattern character although disabled");
DPUTS(!isset(EXTENDEDGLOB), "BUG: # not treated as string");
/*
* A hash here is an error; it should follow something
@@ -1447,7 +1531,7 @@ patcomppiece(int *flagp)
* Marker for restoring a backslash in output:
* does not match a character.
*/
- next = patcomppiece(flagp);
+ next = patcomppiece(flagp, paren);
/*
* Can't match a pure string since we need to do this
* as multiple chunks.
@@ -1465,16 +1549,21 @@ patcomppiece(int *flagp)
}
count = 0;
- if (!(pound = (*patparse == Pound && isset(EXTENDEDGLOB))) &&
- !(count = (isset(EXTENDEDGLOB) && *patparse == Inpar &&
- patparse[1] == Pound && patparse[2] == 'c')) &&
+ if (!(hash = (*patparse == zpc_special[ZPC_HASH])) &&
+ !(count = ((*patparse == zpc_special[ZPC_INPAR] &&
+ patparse[1] == zpc_special[ZPC_HASH] &&
+ patparse[2] == 'c') ||
+ (*patparse == zpc_special[ZPC_KSH_AT] &&
+ patparse[1] == Inpar &&
+ patparse[2] == zpc_special[ZPC_HASH] &&
+ patparse[3] == 'c'))) &&
(kshchar <= 0 || kshchar == '@' || kshchar == '!')) {
*flagp = flags;
return starter;
}
/* too much at once doesn't currently work */
- if (kshchar && pound)
+ if (kshchar && (hash || count))
return 0;
if (kshchar == '*') {
@@ -1490,7 +1579,7 @@ patcomppiece(int *flagp)
op = P_COUNT;
patparse += 3;
*flagp = P_HSTART;
- } else if (*++patparse == Pound) {
+ } else if (*++patparse == zpc_special[ZPC_HASH]) {
op = P_TWOHASH;
patparse++;
*flagp = P_HSTART;
@@ -1600,7 +1689,7 @@ patcomppiece(int *flagp)
pattail(starter, next);
patoptail(starter, next);
}
- if (*patparse == Pound)
+ if (*patparse == zpc_special[ZPC_HASH])
return 0;
return starter;
@@ -1629,7 +1718,7 @@ patcompnot(int paren, int *flagsp)
pattail(starter, excl = patnode(P_EXCLUDE));
up.p = NULL;
patadd((char *)&up, 0, sizeof(up), 0);
- if (!(br = (paren ? patcompswitch(1, &dummy) : patcompbranch(&dummy))))
+ if (!(br = (paren ? patcompswitch(1, &dummy) : patcompbranch(&dummy, 0))))
return 0;
pattail(br, patnode(P_EXCEND));
n = patnode(P_NOTHING); /* just so much easier */
@@ -3753,3 +3842,212 @@ freepatprog(Patprog prog)
if (prog && prog != dummy_patprog1 && prog != dummy_patprog2)
zfree(prog, prog->size);
}
+
+/* Disable or reenable a pattern character */
+
+/**/
+int
+pat_enables(const char *cmd, char **patp, int enable)
+{
+ int ret = 0;
+ const char **stringp;
+ char *disp;
+
+ if (!*patp) {
+ int done = 0;
+ for (stringp = zpc_strings, disp = zpc_disables;
+ stringp < zpc_strings + ZPC_COUNT;
+ stringp++, disp++) {
+ if (!*stringp)
+ continue;
+ if (enable ? *disp : !*disp)
+ continue;
+ if (done)
+ putc(' ', stdout);
+ printf("'%s'", *stringp);
+ done = 1;
+ }
+ if (done)
+ putc('\n', stdout);
+ return 0;
+ }
+
+ for (; *patp; patp++) {
+ for (stringp = zpc_strings, disp = zpc_disables;
+ stringp < zpc_strings + ZPC_COUNT;
+ stringp++, disp++) {
+ if (*stringp && !strcmp(*stringp, *patp)) {
+ *disp = (char)!enable;
+ break;
+ }
+ }
+ if (stringp == zpc_strings + ZPC_COUNT) {
+ zerrnam(cmd, "invalid pattern: %s", *patp);
+ ret = 1;
+ }
+ }
+
+ return ret;
+}
+
+/*
+ * Save the current state of pattern disables, returning the saved value.
+ */
+
+/**/
+unsigned int
+savepatterndisables(void)
+{
+ unsigned int disables, bit;
+ char *disp;
+
+ disables = 0;
+ for (bit = 1, disp = zpc_disables;
+ disp < zpc_disables + ZPC_COUNT;
+ bit <<= 1, disp++) {
+ if (*disp)
+ disables |= bit;
+ }
+ return disables;
+}
+
+/*
+ * Function scope saving pattern enables.
+ */
+
+/**/
+void
+startpatternscope(void)
+{
+ Zpc_disables_save newdis;
+
+ newdis = (Zpc_disables_save)zalloc(sizeof(*newdis));
+ newdis->next = zpc_disables_stack;
+ newdis->disables = savepatterndisables();
+
+ zpc_disables_stack = newdis;
+}
+
+/*
+ * Restore completely the state of pattern disables.
+ */
+
+/**/
+void
+restorepatterndisables(unsigned int disables)
+{
+ char *disp;
+ unsigned int bit;
+
+ for (bit = 1, disp = zpc_disables;
+ disp < zpc_disables + ZPC_COUNT;
+ bit <<= 1, disp++) {
+ if (disables & bit)
+ *disp = 1;
+ else
+ *disp = 0;
+ }
+}
+
+/*
+ * Function scope to restore pattern enables if localpatterns is turned on.
+ */
+
+/**/
+void
+endpatternscope(void)
+{
+ Zpc_disables_save olddis;
+
+ olddis = zpc_disables_stack;
+ zpc_disables_stack = olddis->next;
+
+ if (isset(LOCALPATTERNS))
+ restorepatterndisables(olddis->disables);
+
+ zfree(olddis, sizeof(*olddis));
+}
+
+/* Reinitialise pattern disables */
+
+/**/
+void
+clearpatterndisables(void)
+{
+ memset(zpc_disables, 0, ZPC_COUNT);
+}
+
+
+/* Check to see if str is eligible for filename generation. */
+
+/**/
+mod_export int
+haswilds(char *str)
+{
+ char *start;
+
+ /* `[' and `]' are legal even if bad patterns are usually not. */
+ if ((*str == Inbrack || *str == Outbrack) && !str[1])
+ return 0;
+
+ /* If % is immediately followed by ?, then that ? is *
+ * not treated as a wildcard. This is so you don't have *
+ * to escape job references such as %?foo. */
+ if (str[0] == '%' && str[1] == Quest)
+ str[1] = '?';
+
+ /*
+ * Note that at this point zpc_special has not been set up.
+ */
+ start = str;
+ for (; *str; str++) {
+ switch (*str) {
+ case Inpar:
+ if ((!isset(SHGLOB) && !zpc_disables[ZPC_INPAR]) ||
+ (str > start && isset(KSHGLOB) &&
+ ((str[-1] == Quest && !zpc_disables[ZPC_KSH_QUEST]) ||
+ (str[-1] == Star && !zpc_disables[ZPC_KSH_STAR]) ||
+ (str[-1] == '+' && !zpc_disables[ZPC_KSH_PLUS]) ||
+ (str[-1] == '!' && !zpc_disables[ZPC_KSH_BANG]) ||
+ (str[-1] == '@' && !zpc_disables[ZPC_KSH_AT]))))
+ return 1;
+ break;
+
+ case Bar:
+ if (!zpc_disables[ZPC_BAR])
+ return 1;
+ break;
+
+ case Star:
+ if (!zpc_disables[ZPC_STAR])
+ return 1;
+ break;
+
+ case Inbrack:
+ if (!zpc_disables[ZPC_INBRACK])
+ return 1;
+ break;
+
+ case Inang:
+ if (!zpc_disables[ZPC_INANG])
+ return 1;
+ break;
+
+ case Quest:
+ if (!zpc_disables[ZPC_QUEST])
+ return 1;
+ break;
+
+ case Pound:
+ if (isset(EXTENDEDGLOB) && !zpc_disables[ZPC_HASH])
+ return 1;
+ break;
+
+ case Hat:
+ if (isset(EXTENDEDGLOB) && !zpc_disables[ZPC_HAT])
+ return 1;
+ break;
+ }
+ }
+ return 0;
+}
diff --git a/Src/prompt.c b/Src/prompt.c
index e51ce2451..95a7d4969 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -232,6 +232,33 @@ promptexpand(char *s, int ns, char *rs, char *Rs, unsigned int *txtchangep)
return new_vars.buf;
}
+/* Parse the argument for %F and %K */
+static int
+parsecolorchar(int arg, int is_fg)
+{
+ if (bv->fm[1] == '{') {
+ char *ep;
+ bv->fm += 2; /* skip over F{ */
+ if ((ep = strchr(bv->fm, '}'))) {
+ char oc = *ep, *col, *coll;
+ *ep = '\0';
+ /* expand the contents of the argument so you can use
+ * %v for example */
+ coll = col = promptexpand(bv->fm, 0, NULL, NULL, NULL);
+ *ep = oc;
+ arg = match_colour((const char **)&coll, is_fg, 0);
+ free(col);
+ bv->fm = ep;
+ } else {
+ arg = match_colour((const char **)&bv->fm, is_fg, 0);
+ if (*bv->fm != '}')
+ bv->fm--;
+ }
+ } else
+ arg = match_colour(NULL, 1, arg);
+ return arg;
+}
+
/* Perform %- and !-expansion as required on a section of the prompt. The *
* section is ended by an instance of endchar. If doprint is 0, the valid *
* % sequences are merely skipped over, and nothing is stored. */
@@ -494,13 +521,7 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
tsetcap(TCUNDERLINEEND, TSC_PROMPT|TSC_DIRTY);
break;
case 'F':
- if (bv->fm[1] == '{') {
- bv->fm += 2;
- arg = match_colour((const char **)&bv->fm, 1, 0);
- if (*bv->fm != '}')
- bv->fm--;
- } else
- arg = match_colour(NULL, 1, arg);
+ arg = parsecolorchar(arg, 1);
if (arg >= 0 && !(arg & TXTNOFGCOLOUR)) {
txtchangeset(txtchangep, arg & TXT_ATTR_FG_ON_MASK,
TXTNOFGCOLOUR);
@@ -515,13 +536,7 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
set_colour_attribute(TXTNOFGCOLOUR, COL_SEQ_FG, TSC_PROMPT);
break;
case 'K':
- if (bv->fm[1] == '{') {
- bv->fm += 2;
- arg = match_colour((const char **)&bv->fm, 0, 0);
- if (*bv->fm != '}')
- bv->fm--;
- } else
- arg = match_colour(NULL, 0, arg);
+ arg = parsecolorchar(arg, 0);
if (arg >= 0 && !(arg & TXTNOBGCOLOUR)) {
txtchangeset(txtchangep, arg & TXT_ATTR_BG_ON_MASK,
TXTNOBGCOLOUR);
diff --git a/Src/signals.c b/Src/signals.c
index 046ee6a4a..c8f5fbcca 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -185,7 +185,7 @@ noholdintr(void)
* only the given signal */
/**/
-sigset_t
+mod_export sigset_t
signal_mask(int sig)
{
sigset_t set;
@@ -202,7 +202,8 @@ signal_mask(int sig)
/**/
#ifndef BSD_SIGNALS
-sigset_t
+/**/
+mod_export sigset_t
signal_block(sigset_t set)
{
sigset_t oset;
@@ -245,7 +246,8 @@ signal_block(sigset_t set)
/* Unblock the signals in the given signal *
* set. Return the old signal set. */
-sigset_t
+/**/
+mod_export sigset_t
signal_unblock(sigset_t set)
{
sigset_t oset;
diff --git a/Src/signals.h b/Src/signals.h
index 9541a1a02..d68096891 100644
--- a/Src/signals.h
+++ b/Src/signals.h
@@ -59,6 +59,14 @@
#define child_block() signal_block(sigchld_mask)
#define child_unblock() signal_unblock(sigchld_mask)
+#ifdef SIGWINCH
+# define winch_block() signal_block(signal_mask(SIGWINCH))
+# define winch_unblock() signal_unblock(signal_mask(SIGWINCH))
+#else
+# define winch_block() 0
+# define winch_unblock() 0
+#endif
+
/* ignore a signal */
#define signal_ignore(S) signal(S, SIG_IGN)
diff --git a/Src/subst.c b/Src/subst.c
index 974a8456d..a4df2567f 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -3707,6 +3707,11 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
char *y;
x = val;
+ if (!x) {
+ /* Shouldn't have got here with a NULL string. */
+ DPUTS(1, "value is NULL in paramsubst");
+ return NULL;
+ }
if (prenum || postnum)
x = dopadding(x, prenum, postnum, preone, postone,
premul, postmul
@@ -4021,7 +4026,10 @@ modify(char **str, char **ptr)
all = tmp;
t = e;
}
- *str = all;
+ if (!all)
+ *str = dupstring("");
+ else
+ *str = all;
} else {
switch (c) {
diff --git a/Src/utils.c b/Src/utils.c
index 26e2a5c2c..d1d9406c2 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1287,9 +1287,17 @@ void
preprompt(void)
{
static time_t lastperiodic;
+ time_t currentmailcheck;
LinkNode ln;
- int period = getiparam("PERIOD");
- int mailcheck = getiparam("MAILCHECK");
+ zlong period = getiparam("PERIOD");
+ zlong mailcheck = getiparam("MAILCHECK");
+
+ /*
+ * Handle any pending window size changes before we compute prompts,
+ * then block them again to avoid interrupts during prompt display.
+ */
+ winch_unblock();
+ winch_block();
if (isset(PROMPTSP) && isset(PROMPTCR) && !use_exit_printed && shout) {
/* The PROMPT_SP heuristic will move the prompt down to a new line
@@ -1330,7 +1338,7 @@ preprompt(void)
/* If 1) the parameter PERIOD exists, 2) a hook function for *
* "periodic" exists, 3) it's been greater than PERIOD since we *
* executed any such hook, then execute it now. */
- if (period && (time(NULL) > lastperiodic + period) &&
+ if (period && ((zlong)time(NULL) > (zlong)lastperiodic + period) &&
!callhookfunc("periodic", NULL, 1, NULL))
lastperiodic = time(NULL);
if (errflag)
@@ -1348,7 +1356,9 @@ preprompt(void)
return;
/* Check mail */
- if (mailcheck && (int) difftime(time(NULL), lastmailcheck) > mailcheck) {
+ currentmailcheck = time(NULL);
+ if (mailcheck &&
+ (zlong) difftime(currentmailcheck, lastmailcheck) > mailcheck) {
char *mailfile;
if (mailpath && *mailpath && **mailpath)
@@ -1364,7 +1374,7 @@ preprompt(void)
}
unqueue_signals();
}
- lastmailcheck = time(NULL);
+ lastmailcheck = currentmailcheck;
}
if (prepromptfns) {
@@ -1424,7 +1434,7 @@ checkmailpath(char **s)
}
} else if (shout) {
if (st.st_size && st.st_atime <= st.st_mtime &&
- st.st_mtime > lastmailcheck) {
+ st.st_mtime >= lastmailcheck) {
if (!u) {
fprintf(shout, "You have new mail.\n");
fflush(shout);
diff --git a/Src/zsh.h b/Src/zsh.h
index 207ef1836..a935d23ad 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -179,7 +179,11 @@ struct mathfunc {
* Take care to update the use of IMETA appropriately when adding
* tokens here.
*/
-/* Marker used in paramsubst for rc_expand_param */
+/*
+ * Marker used in paramsubst for rc_expand_param.
+ * Also used in pattern character arrays as guaranteed not to
+ * mark a character in a string.
+ */
#define Marker ((char) 0xa0)
/* chars that need to be quoted if meant literally */
@@ -370,9 +374,8 @@ enum {
#ifdef PATH_DEV_FD
/*
* Entry used by a process substition.
- * The value will be incremented on entering a function and
- * decremented on exit; we don't close entries greater than
- * FDT_PROC_SUBST except when closing everything.
+ * This marker is not tested internally as we associated the file
+ * descriptor with a job for closing.
*/
#define FDT_PROC_SUBST 6
#endif
@@ -418,6 +421,7 @@ typedef struct heap *Heap;
typedef struct heapstack *Heapstack;
typedef struct histent *Histent;
typedef struct hookdef *Hookdef;
+typedef struct jobfile *Jobfile;
typedef struct job *Job;
typedef struct linkedmod *Linkedmod;
typedef struct linknode *LinkNode;
@@ -874,6 +878,18 @@ struct eccstr {
/* Definitions for job table and job control */
/********************************************/
+/* Entry in filelist linked list in job table */
+
+struct jobfile {
+ /* Record to be deleted or closed */
+ union {
+ char *name; /* Name of file to delete */
+ int fd; /* File descriptor to close */
+ } u;
+ /* Discriminant */
+ int is_fd;
+};
+
/* entry in the job table */
struct job {
@@ -885,6 +901,7 @@ struct job {
struct process *procs; /* list of processes */
struct process *auxprocs; /* auxiliary processes e.g multios */
LinkList filelist; /* list of files to delete when done */
+ /* elements are struct jobfile */
int stty_in_env; /* if STTY=... is present */
struct ttyinfo *ty; /* the modes specified by STTY */
};
@@ -960,7 +977,6 @@ struct execstack {
int trapisfunc;
int traplocallevel;
int noerrs;
- int subsh_close;
char *underscore;
};
@@ -1375,6 +1391,55 @@ struct patprog {
#define PAT_HAS_EXCLUDP 0x0800 /* (internal): top-level path1~path2. */
#define PAT_LCMATCHUC 0x1000 /* equivalent to setting (#l) */
+/**
+ * Indexes into the array of active pattern characters.
+ * This must match the array zpc_chars in pattern.c.
+ */
+enum zpc_chars {
+ /*
+ * These characters both terminate a pattern segment and
+ * a pure string segment.
+ */
+ ZPC_SLASH, /* / active as file separator */
+ ZPC_NULL, /* \0 as string terminator */
+ ZPC_BAR, /* | for "or" */
+ ZPC_OUTPAR, /* ) for grouping */
+ ZPC_TILDE, /* ~ for exclusion (extended glob) */
+ ZPC_SEG_COUNT, /* No. of the above characters */
+ /*
+ * These characters terminate a pure string segment.
+ */
+ ZPC_INPAR = ZPC_SEG_COUNT, /* ( for grouping */
+ ZPC_QUEST, /* ? as wildcard */
+ ZPC_STAR, /* * as wildcard */
+ ZPC_INBRACK, /* [ for character class */
+ ZPC_INANG, /* < for numeric glob */
+ ZPC_HAT, /* ^ for exclusion (extended glob) */
+ ZPC_HASH, /* # for repetition (extended glob) */
+ ZPC_BNULLKEEP, /* Special backslashed null not removed */
+ ZPC_KSH_QUEST, /* ? for ?(...) in KSH_GLOB */
+ ZPC_KSH_STAR, /* * for *(...) in KSH_GLOB */
+ ZPC_KSH_PLUS, /* + for +(...) in KSH_GLOB */
+ ZPC_KSH_BANG, /* ! for !(...) in KSH_GLOB */
+ ZPC_KSH_AT, /* @ for @(...) in KSH_GLOB */
+ ZPC_COUNT /* Number of special chararacters */
+};
+
+/*
+ * Structure to save disables special characters for function scope.
+ */
+struct zpc_disables_save {
+ struct zpc_disables_save *next;
+ /*
+ * Bit vector of ZPC_COUNT disabled characters.
+ * We'll live dangerously and assumed ZPC_COUNT is no greater
+ * than the number of bits an an unsigned int.
+ */
+ unsigned int disables;
+};
+
+typedef struct zpc_disables_save *Zpc_disables_save;
+
/*
* Special match types used in character classes. These
* are represented as tokens, with Meta added. The character
@@ -1829,6 +1894,7 @@ struct histent {
#define HIST_DUP 0x00000008 /* Command duplicates a later line */
#define HIST_FOREIGN 0x00000010 /* Command came from another shell */
#define HIST_TMPSTORE 0x00000020 /* Kill when user enters another cmd */
+#define HIST_NOWRITE 0x00000040 /* Keep internally but don't write */
#define GETHIST_UPWARD (-1)
#define GETHIST_DOWNWARD 1
@@ -1988,6 +2054,7 @@ enum {
EXTENDEDHISTORY,
EVALLINENO,
FLOWCONTROL,
+ FORCEFLOAT,
FUNCTIONARGZERO,
GLOBOPT,
GLOBALEXPORT,
@@ -2035,6 +2102,7 @@ enum {
LISTROWSFIRST,
LISTTYPES,
LOCALOPTIONS,
+ LOCALPATTERNS,
LOCALTRAPS,
LOGINSHELL,
LONGLISTJOBS,
@@ -2054,6 +2122,7 @@ enum {
OVERSTRIKE,
PATHDIRS,
PATHSCRIPT,
+ PIPEFAIL,
POSIXALIASES,
POSIXBUILTINS,
POSIXCD,
@@ -2689,7 +2758,8 @@ enum {
ZLE_CMD_RESET_PROMPT,
ZLE_CMD_REFRESH,
ZLE_CMD_SET_KEYMAP,
- ZLE_CMD_GET_KEY
+ ZLE_CMD_GET_KEY,
+ ZLE_CMD_SET_HIST_LINE
};
/***************************************/
diff --git a/Src/zsh.mdd b/Src/zsh.mdd
index 6e9077676..4bc884b3d 100644
--- a/Src/zsh.mdd
+++ b/Src/zsh.mdd
@@ -39,10 +39,14 @@ params.o: patchlevel.h
version.h: $(sdir_top)/Config/version.mk zshcurses.h zshterm.h
echo '#define ZSH_VERSION "'$(VERSION)'"' > $@
-patchlevel.h: $(sdir_top)/ChangeLog
- sed -ne \
- 's/^\* *\$$''Revision: \(.*\) ''\$$/#define ZSH_PATCHLEVEL "\1"/p' \
- $(sdir_top)/ChangeLog >patchlevel.h
+patchlevel.h: FORCE
+ @if [ -f $(sdir)/$@.release ]; then \
+ cp -f $(sdir)/$@.release $@; \
+ else \
+ echo '#define ZSH_PATCHLEVEL "'`cd $(sdir) && git describe --tags --long`'"' > $@.tmp; \
+ cmp $@ $@.tmp && rm -f $@.tmp || mv $@.tmp $@; \
+ fi
+FORCE:
zshcurses.h: ../config.h
@if test x$(ZSH_CURSES_H) != x; then \
diff --git a/Src/zsh_system.h b/Src/zsh_system.h
index f38533023..e68fd62f9 100644
--- a/Src/zsh_system.h
+++ b/Src/zsh_system.h
@@ -773,7 +773,7 @@ extern short ospeed;
# define IS_DIRSEP(c) ((c) == '/')
#endif
-#if defined(__GNUC__) && !defined(__APPLE__)
+#if defined(__GNUC__) && (!defined(__APPLE__) || defined(__clang__))
/* Does the OS X port of gcc still gag on __attribute__? */
#define UNUSED(x) x __attribute__((__unused__))
#else
diff --git a/Test/.distfiles b/Test/.distfiles
index 689b69587..1c0102818 100644
--- a/Test/.distfiles
+++ b/Test/.distfiles
@@ -40,6 +40,8 @@ V04features.ztst
V05styles.ztst
V06parameter.ztst
V07pcre.ztst
+V08zpty.ztst
+X02zlevi.ztst
Y01completion.ztst
Y02compmatch.ztst
Y03arguments.ztst
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
index b8086e724..7ad02db3b 100644
--- a/Test/A04redirect.ztst
+++ b/Test/A04redirect.ztst
@@ -328,6 +328,17 @@
1q:NO_CLOBBER prevents overwriting parameter with allocated fd
?(eval):4: can't clobber parameter myfd containing file descriptor $myfd
+ (setopt noclobber
+ exec {myfd}>logfile2b
+ print First open >&$myfd
+ rm -f logfile2b # prevent normal file no_clobberation
+ myotherfd="${myfd}+0"
+ exec {myotherfd}>logfile2b
+ print Overwritten >&$myotherfd)
+ cat logfile2b
+0:NO_CLOBBER doesn't complain about any other expression
+>Overwritten
+
(exec {myfd}>logfile4
echo $myfd
exec {myfd}>&-
diff --git a/Test/A05execution.ztst b/Test/A05execution.ztst
index b4fb8739a..ba7e02cd5 100644
--- a/Test/A05execution.ztst
+++ b/Test/A05execution.ztst
@@ -178,3 +178,27 @@
kill $!
0:Status reset by starting a backgrounded command
>0
+
+ setopt MONITOR
+ [[ -o MONITOR ]] || print -u $ZTST_fd 'Unable to change MONITOR option'
+ repeat 2048; do (return 2 |
+ return 1 |
+ while true; do
+ false
+ break
+ done;
+ print "${pipestatus[@]}")
+ ZTST_hashmark
+ done | sort | uniq -c | sed 's/^ *//'
+0:Check whether `$pipestatus[]' behaves.
+>2048 2 1 0
+F:This test checks for a bug in `$pipestatus[]' handling. If it breaks then
+F:the bug is still there or it reappeared. See workers-29973 for details.
+
+ setopt MONITOR
+ externFunc() { awk >/dev/null 2>&1; true; }
+ false | true | false | true | externFunc
+ echo $pipestatus
+0:Check $pipestatus with a known difficult case
+>1 0 1 0 0
+F:This similar test was triggering a reproducible failure with pipestatus.
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
index 02d1519a4..71c8a1969 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -243,3 +243,18 @@
>6000000
>5000
>255
+
+ # Force floating point.
+ for expr in "3/4" "0x100/0x200" "0x30/0x10"; do
+ print $(( $expr ))
+ setopt force_float
+ print $(( $expr ))
+ unsetopt force_float
+ done
+0:Forcing floating point constant evaluation, or not.
+>0
+>0.75
+>0
+>0.5
+>3
+>3.
diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
index 494261ee3..94fca8b68 100644
--- a/Test/C02cond.ztst
+++ b/Test/C02cond.ztst
@@ -324,6 +324,31 @@ F:Failures in these cases do not indicate a problem in the shell.
> fi
>}
+ weirdies=(
+ '! -a !'
+ '! -o !'
+ '! -a'
+ '! -o'
+ '! -a ! -a !'
+ '! = !'
+ '! !'
+ '= -a o'
+ '! = -a o')
+ for w in $weirdies; do
+ eval test $w
+ print $?
+ done
+0:test compatability weirdness: treat ! as a string sometimes
+>0
+>0
+>1
+>0
+>0
+>0
+>1
+>0
+>1
+
%clean
# This works around a bug in rm -f in some versions of Cygwin
chmod 644 unmodish
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 0aea26183..d6ab73304 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -433,3 +433,61 @@
print glob.tmp/dir5/N<->(N)
0:Numeric glob is not usurped by process substitution.
>glob.tmp/dir5/N123
+
+ tpd() {
+ [[ $1 = $~2 ]]
+ print -r "$1, $2: $?"
+ }
+ test_pattern_disables() {
+ emulate -L zsh
+ tpd 'forthcoming' 'f*g'
+ disable -p '*'
+ tpd 'forthcoming' 'f*g'
+ tpd 'f*g' 'f*g'
+ tpd '[frog]' '[frog]'
+ tpd '[frog]' '\[[f]rog\]'
+ disable -p '['
+ tpd '[frog]' '[frog]'
+ tpd '[frog]' '\[[f]rog\]'
+ setopt extendedglob
+ tpd 'foo' '^bar'
+ disable -p '^'
+ tpd 'foo' '^bar'
+ tpd '^bar' '^bar'
+ tpd 'rumble' '(rumble|bluster)'
+ tpd '(thunder)' '(thunder)'
+ disable -p '('
+ tpd 'rumble' '(rumble|bluster)'
+ tpd '(thunder)' '(thunder)'
+ setopt kshglob
+ tpd 'scramble' '@(panic|frenzy|scramble)'
+ tpd '@(scrimf)' '@(scrimf)'
+ disable -p '@('
+ tpd 'scramble' '@(panic|frenzy|scramble)'
+ tpd '@(scrimf)' '@(scrimf)'
+ disable -p
+ }
+ test_pattern_disables
+ print Nothing should be disabled.
+ disable -p
+0:disable -p
+>forthcoming, f*g: 0
+>forthcoming, f*g: 1
+>f*g, f*g: 0
+>[frog], [frog]: 1
+>[frog], \[[f]rog\]: 0
+>[frog], [frog]: 0
+>[frog], \[[f]rog\]: 1
+>foo, ^bar: 0
+>foo, ^bar: 1
+>^bar, ^bar: 0
+>rumble, (rumble|bluster): 0
+>(thunder), (thunder): 1
+>rumble, (rumble|bluster): 1
+>(thunder), (thunder): 0
+>scramble, @(panic|frenzy|scramble): 0
+>@(scrimf), @(scrimf): 1
+>scramble, @(panic|frenzy|scramble): 1
+>@(scrimf), @(scrimf): 0
+>'(' '*' '[' '^' '@('
+>Nothing should be disabled.
diff --git a/Test/D03procsubst.ztst b/Test/D03procsubst.ztst
index 88fa902bb..c763f6e0f 100644
--- a/Test/D03procsubst.ztst
+++ b/Test/D03procsubst.ztst
@@ -107,3 +107,11 @@
>third: This becomes argument three
>fourth: and this argument four
+ () {
+ # Make sure we don't close the file descriptor too early
+ eval 'print "Execute a complicated command first" | sed s/command/order/'
+ cat $1
+ } <(echo This line was brought to you by the letters F and D)
+0:Process substitution as anonymous function argument
+>Execute a complicated order first
+>This line was brought to you by the letters F and D
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 01f841218..bea945971 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1544,3 +1544,10 @@
0:Regression test for shwordsplit with null or unset IFS and quoted array
>abc
>a b c
+
+ foo=
+ print ${foo:wq}
+ print ${:wq}
+0:Empty parameter shouldn't cause modifiers to crash the shell
+>
+>
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index bcb34c352..e00eb0e9c 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -1096,3 +1096,18 @@
0:IGNORE_CLOSE_BRACES option
>this is OK
>6
+
+ (setopt pipefail
+ true | true | true
+ print $?
+ true | false | true
+ print $?
+ exit 2 | false | true
+ print $?
+ false | exit 2 | true
+ print $?)
+0:PIPE_FAIL option
+>0
+>1
+>1
+>2
diff --git a/Test/E02xtrace.ztst b/Test/E02xtrace.ztst
index 2420aebd7..093a587bd 100644
--- a/Test/E02xtrace.ztst
+++ b/Test/E02xtrace.ztst
@@ -118,3 +118,12 @@
?+./fnfile:5> :
?+./fnfile:6> fn
?+./fnfile:3> print This is fn.
+
+ set -x
+ [[ 'f o' = 'f x'* || 'b r' != 'z o' && 'squashy sound' < 'squishy sound' ]]
+ [[ -e nonexistentfile || ( -z '' && -t 3 ) ]]
+ set +x
+0:Trace for conditions
+?+(eval):2> [[ 'f o' == f\ x* || 'b r' != z\ o && 'squashy sound' < 'squishy sound' ]]
+?+(eval):3> [[ -e nonexistentfile || -z '' && -t 3 ]]
+?+(eval):4> set +x
diff --git a/Test/V01zmodload.ztst b/Test/V01zmodload.ztst
index ea908e952..3580bacea 100644
--- a/Test/V01zmodload.ztst
+++ b/Test/V01zmodload.ztst
@@ -183,6 +183,7 @@
>p:dis_builtins
>p:dis_functions
>p:dis_galiases
+>p:dis_patchars
>p:dis_reswords
>p:dis_saliases
>p:funcfiletrace
@@ -200,6 +201,7 @@
>p:nameddirs
>p:options
>p:parameters
+>p:patchars
>p:reswords
>p:saliases
>p:userdirs
diff --git a/Test/V03mathfunc.ztst b/Test/V03mathfunc.ztst
index 069059da4..ab383db43 100644
--- a/Test/V03mathfunc.ztst
+++ b/Test/V03mathfunc.ztst
@@ -136,3 +136,9 @@ F:This test fails if your math library doesn't have erand48().
done
(( ok ))
0:Test random number generator distributions are not grossly broken
+
+ float -F 5 g l
+ (( g = gamma(2), l = lgamma(2) ))
+ print $g, $l
+0:Test Gamma function gamma and lgamma
+>1.00000, 0.00000
diff --git a/Test/V08zpty.ztst b/Test/V08zpty.ztst
new file mode 100644
index 000000000..5b08fc281
--- /dev/null
+++ b/Test/V08zpty.ztst
@@ -0,0 +1,28 @@
+# zpty is required by tests of interactive modes of the shell itself.
+# This tests some extra things.
+
+%prep
+
+ if ! zmodload zsh/zpty 2>/dev/null
+ then
+ ZTST_unimplemented="the zsh/zpty module is not available"
+ return 0
+ fi
+
+%test
+
+ zpty cat cat
+ zpty -w cat a line of text
+ var=
+ zpty -r cat var && print -r -- ${var%%$'\r\n'}
+ zpty -d cat
+0:zpty with a process that does not set up the terminal: internal write
+>a line of text
+
+ zpty cat cat
+ print a line of text | zpty -w cat
+ var=
+ zpty -r cat var && print -r -- ${var%%$'\r\n'}
+ zpty -d cat
+0:zpty with a process that does not set up the terminal: write via stdin
+>a line of text
diff --git a/Test/X02zlevi.ztst b/Test/X02zlevi.ztst
new file mode 100644
index 000000000..d4a125f21
--- /dev/null
+++ b/Test/X02zlevi.ztst
@@ -0,0 +1,20 @@
+# Tests of the vi mode of ZLE
+
+%prep
+ if ( zmodload -i zsh/zpty ) >/dev/null 2>&1; then
+ . $ZTST_srcdir/comptest
+ comptestinit -v -z $ZTST_testdir/../Src/zsh
+ else
+ ZTST_unimplemented="the zsh/zpty module is not available"
+ fi
+
+%test
+
+ zletest $'one two\ebmt3|`tx``'
+0:setting mark and returning to original position
+>BUFFER: one wo
+>CURSOR: 2
+
+%clean
+
+ zmodload -ui zsh/zpty
diff --git a/Test/comptest b/Test/comptest
index 14938a7cd..5577209da 100644
--- a/Test/comptest
+++ b/Test/comptest
@@ -8,10 +8,12 @@ comptestinit () {
zmodload -i zsh/zpty || return $?
comptest_zsh=${ZSH:-zsh}
+ comptest_keymap=e
- while getopts z: opt; do
+ while getopts vz: opt; do
case $opt in
z) comptest_zsh="$OPTARG";;
+ v) comptest_keymap="v";;
esac
done
(( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
@@ -30,11 +32,11 @@ comptestinit () {
"export ZDOTDIR=$ZTST_testdir" \
"module_path=( $module_path )" \
"fpath=( $fpath )" \
+"bindkey -$comptest_keymap" \
'LISTMAX=10000000
TERM=vt100
stty columns 80 rows 24
setopt zle
-bindkey -e
autoload -U compinit
compinit -u
zstyle ":completion:*:default" list-colors "no=<NO>" "fi=<FI>" "di=<DI>" "ln=<LN>" "pi=<PI>" "so=<SO>" "bd=<BD>" "cd=<CD>" "ex=<EX>" "mi=<MI>" "tc=<TC>" "sp=<SP>" "lc=<LC>" "ec=<EC>\n" "rc=<RC>"
@@ -60,18 +62,29 @@ list-choices-with-report () {
zle clear-screen
zle -R
}
-finish () {
+comp-finish () {
print "<WIDGET><finish>"
zle kill-whole-line
zle clear-screen
zle -R
}
+zle-finish () {
+ print -lr "<WIDGET><finish>" "BUFFER: $BUFFER" "CURSOR: $CURSOR"
+ (( region_active )) && print -lr "MARK: $MARK"
+ zle -K main
+ zle kill-whole-line
+ zle clear-screen
+ zle -R
+}
zle -N expand-or-complete-with-report
zle -N list-choices-with-report
-zle -N finish
+zle -N comp-finish
+zle -N zle-finish
bindkey "^I" expand-or-complete-with-report
bindkey "^D" list-choices-with-report
-bindkey "^Z" finish
+bindkey "^Z" comp-finish
+bindkey "^M" zle-finish
+bindkey -a "^M" zle-finish
'
}
@@ -120,3 +133,13 @@ comptest () {
done
done
}
+
+zletest () {
+ input="$*"
+ zpty -n -w zsh "$input"$'\C-M'
+ zpty -r -m zsh log "*<WIDGET><finish>*<PROMPT>*" || {
+ print "failed to invoke finish widget."
+ return 1
+ }
+ print -lr "${(@)${(ps:\r\n:)log##*<WIDGET><finish>}[1,-2]}"
+}
diff --git a/configure.ac b/configure.ac
index 5528597ba..32872be5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1222,7 +1222,7 @@ AC_CHECK_FUNCS(strftime strptime mktime timelocal \
getrlimit getrusage \
setlocale \
uname \
- signgam \
+ signgam tgamma \
putenv getenv setenv unsetenv xw\
brk sbrk \
pathconf sysconf \
@@ -1237,7 +1237,8 @@ AC_CHECK_FUNCS(strftime strptime mktime timelocal \
regcomp regexec regerror regfree \
gdbm_open getxattr \
realpath canonicalize_file_name \
- symlink getcwd)
+ symlink getcwd \
+ cygwin_conv_path)
AC_FUNC_STRCOLL
if test x$enable_cap = xyes; then
@@ -1811,6 +1812,10 @@ zsh_LIMIT_PRESENT(RLIMIT_SIGPENDING)
zsh_LIMIT_PRESENT(RLIMIT_MSGQUEUE)
zsh_LIMIT_PRESENT(RLIMIT_NICE)
zsh_LIMIT_PRESENT(RLIMIT_RTPRIO)
+zsh_LIMIT_PRESENT(RLIMIT_POSIXLOCKS)
+zsh_LIMIT_PRESENT(RLIMIT_NPTS)
+zsh_LIMIT_PRESENT(RLIMIT_SWAP)
+zsh_LIMIT_PRESENT(RLIMIT_KQUEUES)
AH_TEMPLATE([RLIMIT_VMEM_IS_RSS],
[Define to 1 if RLIMIT_VMEM and RLIMIT_RSS both exist and are equal.])