summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2018-12-24 04:40:22 +0100
committerAxel Beckert <abe@deuxchevaux.org>2018-12-24 04:40:22 +0100
commitbf8b7f713a5b04a191f4596fb86bbbfca0a855ce (patch)
treeb647a8dc990c8c845b8a8eca7bf92fbbf17e1fb5
parent06946d431a4426c6e5dffec1d7edb17c1dbd467c (diff)
parent9dbde9e9c7d22ee0d301e4a2fecf97906d1ddce9 (diff)
downloadzsh-bf8b7f713a5b04a191f4596fb86bbbfca0a855ce.tar.gz
zsh-bf8b7f713a5b04a191f4596fb86bbbfca0a855ce.zip
New upstream release candidate 5.6.2-test-2
Merge branch 'upstream' at 'zsh-5.6.2-test-2' into branch debian
-rw-r--r--ChangeLog496
-rw-r--r--Completion/BSD/Command/_cu4
-rw-r--r--Completion/BSD/Command/_fstat2
-rw-r--r--Completion/BSD/Command/_powerd20
-rw-r--r--Completion/BSD/Command/_vmctl59
-rw-r--r--Completion/BSD/Type/_file_flags6
-rw-r--r--Completion/Base/Completer/_expand14
-rw-r--r--Completion/Darwin/Command/_xcode-select10
-rw-r--r--Completion/Linux/Command/_btrfs248
-rw-r--r--Completion/Linux/Command/_ethtool12
-rw-r--r--Completion/Linux/Command/_iptables6
-rw-r--r--Completion/Linux/Command/_losetup3
-rw-r--r--Completion/Linux/Command/_lsblk1
-rw-r--r--Completion/Linux/Command/_valgrind232
-rw-r--r--Completion/Unix/Command/_ack17
-rw-r--r--Completion/Unix/Command/_adb17
-rw-r--r--Completion/Unix/Command/_ansible27
-rw-r--r--Completion/Unix/Command/_asciidoctor42
-rw-r--r--Completion/Unix/Command/_asciinema59
-rw-r--r--Completion/Unix/Command/_awk2
-rw-r--r--Completion/Unix/Command/_cat8
-rw-r--r--Completion/Unix/Command/_chown2
-rw-r--r--Completion/Unix/Command/_column1
-rw-r--r--Completion/Unix/Command/_df6
-rw-r--r--Completion/Unix/Command/_dhclient1
-rw-r--r--Completion/Unix/Command/_diff36
-rw-r--r--Completion/Unix/Command/_dig4
-rw-r--r--Completion/Unix/Command/_dmidecode7
-rw-r--r--Completion/Unix/Command/_ed2
-rw-r--r--Completion/Unix/Command/_env8
-rw-r--r--Completion/Unix/Command/_gcc2
-rw-r--r--Completion/Unix/Command/_git135
-rw-r--r--Completion/Unix/Command/_grep6
-rw-r--r--Completion/Unix/Command/_host23
-rw-r--r--Completion/Unix/Command/_init_d26
-rw-r--r--Completion/Unix/Command/_jq9
-rw-r--r--Completion/Unix/Command/_links145
-rw-r--r--Completion/Unix/Command/_lp2
-rw-r--r--Completion/Unix/Command/_ls2
-rw-r--r--Completion/Unix/Command/_luarocks97
-rw-r--r--Completion/Unix/Command/_mkdir4
-rw-r--r--Completion/Unix/Command/_mkfifo20
-rw-r--r--Completion/Unix/Command/_mknod45
-rw-r--r--Completion/Unix/Command/_mktemp4
-rw-r--r--Completion/Unix/Command/_mpc11
-rw-r--r--Completion/Unix/Command/_npm9
-rw-r--r--Completion/Unix/Command/_od2
-rw-r--r--Completion/Unix/Command/_pax2
-rw-r--r--Completion/Unix/Command/_ping27
-rw-r--r--Completion/Unix/Command/_rar4
-rw-r--r--Completion/Unix/Command/_rm2
-rw-r--r--Completion/Unix/Command/_samba1
-rw-r--r--Completion/Unix/Command/_script6
-rw-r--r--Completion/Unix/Command/_shred19
-rw-r--r--Completion/Unix/Command/_sort14
-rw-r--r--Completion/Unix/Command/_ssh3
-rw-r--r--Completion/Unix/Command/_strip37
-rw-r--r--Completion/Unix/Command/_subversion2
-rw-r--r--Completion/Unix/Command/_sysctl88
-rw-r--r--Completion/Unix/Command/_tail9
-rw-r--r--Completion/Unix/Command/_tmux7
-rw-r--r--Completion/Unix/Command/_toilet2
-rw-r--r--Completion/Unix/Command/_tty18
-rw-r--r--Completion/Unix/Command/_visudo12
-rw-r--r--Completion/Unix/Command/_watch43
-rw-r--r--Completion/Unix/Command/_xxd2
-rw-r--r--Completion/Unix/Command/_zcat2
-rw-r--r--Completion/Unix/Type/_file_systems3
-rw-r--r--Completion/Unix/Type/_files8
-rw-r--r--Completion/Unix/Type/_hosts2
-rw-r--r--Completion/X/Command/_setxkbmap10
-rw-r--r--Completion/X/Command/_zathura9
-rw-r--r--Completion/Zsh/Command/_compadd6
-rw-r--r--Completion/Zsh/Command/_strftime6
-rw-r--r--Completion/Zsh/Context/_brace_parameter2
-rw-r--r--Completion/Zsh/Type/_module_math_func13
-rw-r--r--Config/version.mk4
-rw-r--r--Doc/Makefile.in15
-rw-r--r--Doc/Zsh/builtins.yo37
-rw-r--r--Doc/Zsh/compsys.yo6
-rw-r--r--Doc/Zsh/contrib.yo2
-rw-r--r--Doc/Zsh/expn.yo13
-rw-r--r--Doc/Zsh/grammar.yo9
-rw-r--r--Doc/Zsh/mod_datetime.yo8
-rw-r--r--Doc/Zsh/mod_nearcolor.yo36
-rw-r--r--Doc/Zsh/mod_zpty.yo3
-rw-r--r--Doc/Zsh/redirect.yo14
-rw-r--r--Doc/Zsh/zle.yo20
-rw-r--r--Etc/FAQ.yo33
-rw-r--r--Functions/Misc/add-zle-hook-widget12
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_p42
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr3
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git74
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_svn11
-rw-r--r--Functions/VCS_Info/VCS_INFO_quilt7
-rw-r--r--Functions/VCS_Info/VCS_INFO_set-patch-format2
-rw-r--r--Functions/Zle/edit-command-line2
-rw-r--r--Functions/Zle/select-bracketed4
-rw-r--r--NEWS9
-rw-r--r--README21
-rw-r--r--Src/Modules/clone.c3
-rw-r--r--Src/Modules/datetime.c64
-rw-r--r--Src/Modules/db_gdbm.c2
-rw-r--r--Src/Modules/nearcolor.c210
-rw-r--r--Src/Modules/nearcolor.mdd5
-rw-r--r--Src/Modules/parameter.c44
-rw-r--r--Src/Modules/stat.c4
-rw-r--r--Src/Zle/compcore.c4
-rw-r--r--Src/Zle/complist.c9
-rw-r--r--Src/Zle/computil.c4
-rw-r--r--Src/Zle/zle.h4
-rw-r--r--Src/Zle/zle_refresh.c31
-rw-r--r--Src/Zle/zle_tricky.c9
-rw-r--r--Src/builtin.c207
-rw-r--r--Src/exec.c70
-rw-r--r--Src/hashtable.h1
-rw-r--r--Src/init.c9
-rw-r--r--Src/input.c2
-rw-r--r--Src/jobs.c131
-rw-r--r--Src/lex.c9
-rw-r--r--Src/module.c2
-rw-r--r--Src/params.c165
-rw-r--r--Src/prompt.c137
-rw-r--r--Src/signals.c27
-rw-r--r--Src/subst.c6
-rw-r--r--Src/utils.c28
-rw-r--r--Src/zsh.h82
-rw-r--r--Src/zsh_system.h4
-rw-r--r--Test/A01grammar.ztst10
-rw-r--r--Test/B02typeset.ztst288
-rw-r--r--Test/C03traps.ztst19
-rw-r--r--Test/D04parameter.ztst7
-rw-r--r--Test/V07pcre.ztst5
-rw-r--r--Test/V09datetime.ztst29
134 files changed, 3368 insertions, 833 deletions
diff --git a/ChangeLog b/ChangeLog
index 4fd97cea8..3cebb5b09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,501 @@
+2018-12-19 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * unposted: Config/version.mk, Etc/FAQ.yo, README: update for
+ 5.6.2-test-2.
+
+2018-12-19 Peter Stephenson <p.stephenson@samsung.com>
+
+ * unposted c.f. 43913: Functions/Zle/edit-command-line: emulate
+ -L zsh to avoid bad effects with globsubst.
+
+2018-12-17 dana <dana@dana.is>
+
+ * 43897: Completion/Darwin/Command/_xcode-select,
+ Completion/Unix/Command/_asciidoctor,
+ Completion/Unix/Command/_asciinema,
+ Completion/Unix/Command/_host, Completion/Unix/Command/_mkfifo,
+ Completion/Unix/Command/_mknod, Completion/Unix/Command/_shred,
+ Completion/Unix/Command/_tail, Completion/Unix/Command/_tty,
+ Completion/Unix/Command/_visudo, Completion/Unix/Type/_hosts:
+ Add/update various completion functions
+
+ * 43895: Completion/Unix/Command/_watch: Complete for
+ procps/-ng watch
+
+2018-12-17 Joey Pabalinas <joeypabalinas@gmail.com>
+
+ * 43904 (plus tweak): Doc/Zsh/grammar.yo: zshmisc(1): document
+ term being optional if `in word' is omitted
+
+2018-12-14 dana <dana@dana.is>
+
+ * unposted: Completion/Unix/Command/_dig: Fix _arguments syntax
+ error
+
+2018-12-13 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 43879: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: Fix fatal error in VCS_INFO_git_getbranch in
+ corner case
+
+2018-12-09 dana <dana@dana.is>
+
+ * 43871: Completion/Unix/Type/_files: Support `-F '(pat ...)'` as
+ with _path_files
+
+2018-12-04 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 43860, 43861: Completion/Unix/Type/_files: complete globbing
+ flags at start of word.
+
+2018-11-29 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 43854: Src/lex.c: set tok to LEXERR on generic parser error so
+ this gets picked up by main loop.
+
+2018-11-21 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 43837 (test from Daniel): Src/subst.c, Test/D04parameter.ztst:
+ Nested substitution didn't remove Nularg from empty string,
+ giving bogus character.
+
+2018-11-19 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 43829: Src/Modules/nearcolor.c: use double instead of float
+
+2018-11-16 dana <dana@dana.is>
+
+ * Daniel O'Connor: 43830: Completion/BSD/Command/_cu: Complete
+ /dev/cu.* (used by macOS)
+
+2018-11-15 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * unposted: Completion/Unix/Command/_zcat: support macOS
+
+ * Ivan Tkachenko: 43823: Src/Modules/stat.c: remove unnecessary
+ metafy() in stattimeprint()
+
+2018-11-14 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 43620: Doc/Zsh/expn.yo: more care documenting command
+ substituion including $(<...).
+
+2018-11-13 dana <dana@dana.is>
+
+ * 43809: Completion/Unix/Command/_npm: Suppress npm update checks
+ during completion
+
+ * unposted (cf. 43800): Completion/Zsh/Command/_strftime: Update
+ strftime completion for nanoseconds change
+
+ * 43800: Doc/Zsh/mod_datetime.yo, Src/Modules/datetime.c,
+ Test/V09datetime.ztst: Add nanosecond support to strftime built-in
+
+2018-11-12 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 43819: Completion/Unix/Command/_adb: expand adb completion to
+ also cover options to adb backup
+
+ * 43818: Completion/Zsh/Type/_module_math_func: complete math
+ functions for other modules besides zsh/mathfunc
+
+ * 43816: Completion/Linux/Command/_valgrind,
+ Completion/BSD/Command/_vmctl, Completion/Linux/Command/_ethtool,
+ Completion/Linux/Command/_losetup, Completion/Linux/Command/_lsblk,
+ Completion/Unix/Command/_ansible, Completion/Unix/Command/_column,
+ Completion/Unix/Command/_dhclient, Completion/Unix/Command/_links,
+ Completion/Unix/Command/_dmidecode, Completion/Unix/Command/_jq,
+ Completion/Unix/Command/_luarocks, Completion/Unix/Command/_mpc,
+ Completion/Unix/Command/_samba, Completion/Unix/Command/_script,
+ Completion/Unix/Command/_ssh, Completion/Unix/Command/_tmux:
+ various completion option updates
+
+ * 43817: Completion/Linux/Command/_btrfs: update options in
+ completion through to btrfs 4.17.1
+
+ * 43813: Completion/BSD/Command/_powerd: add units, default
+ values and allow option arguments in the same word as the option
+
+ * 43812: Completion/Unix/Command/_gcc: allow repeats of
+ the -Wsuggest-attribute option
+
+2018-11-09 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 43790: Kamil: Src/utils.c: failed mailstat could leak memory.
+
+ * 43789: Kamil: Src/module.c: possible use after free handling
+ math functions from module.
+
+ * 43792: Kamil: Src/exec.c: file descriptor could leak on fork error.
+
+ * 43793: Kamil: Src/Zle/computil.c: could overrun buffer by 1 byte.
+
+ * 43791: Kamil: Src/Modules/clone.c: file descriptor was closed twice.
+
+2018-11-08 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 43779 (tweaked): Joey Pabalinas: Functions/Zle/select-bracketed:
+ add parentheses to fix expression with cprecedences option set
+
+ * 43805: Src/Modules/nearcolor.c, Src/prompt.c: make nearcolor
+ module use the default colour rather than black as a fallback
+
+ * 43804: Src/prompt.c: also need to be able to turn colour
+ attributes back into hex triples for region_highlight variable
+
+ * unposted: Src/Modules/nearcolor.c: add usual copyright header
+
+ * 43784: Completion/Zsh/Command/_compadd: clarify descriptions on
+ options related to match sorting
+
+ * unposted (c.f. Bart: 43739):
+ Completion/Zsh/Context/_brace_parameter: use a correct
+ description for the @ parameter expansion flag
+
+2018-11-07 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 43788: Doc/Zsh/mod_zpty.yo: make it clear -n option to
+ zpty -w is irrelevant if no string argument.
+
+2018-11-07 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 43761: Completion/BSD/Type/_file_flags,
+ Completion/Unix/Command/_mktemp, Completion/Unix/Command/_script,
+ Completion/Unix/Command/_strip, Completion/Unix/Type/_file_systems:
+ add or update support for darwin
+
+2018-11-05 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 43760: Doc/Makefile.in, Doc/Zsh/mod_nearcolor.yo,
+ Doc/Zsh/zle.yo, NEWS: add documentation for true colour
+ changes and nearcolor module
+
+ * 43759: Src/Modules/nearcolor.c, Src/Zle/complist.c,
+ Src/Zle/zle.h, Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c,
+ Src/prompt.c, Src/zsh.h, Src/zsh_system.h: add support for
+ true colour terminals
+
+ * 43747: Src/Modules/nearcolor.c, Src/Modules/nearcolor.mdd,
+ Src/init.c, Src/prompt.c, Src/zsh.h: new module to map
+ colours from hex triplets to the nearest matching colour
+
+2018-11-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 43752: Completion/Base/Completer/_expand: Fix quoting if
+ globbing failed / was not tried for expression on command line.
+
+2018-11-02 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 43748: Completion/Unix/Command/_ack: fix for ack 3beta
+
+ * github #29: Wieland Hoffmann: Completion/Unix/Command/_git:
+ Add completion support for Gits --color-moved option and
+ color settings
+
+2018-10-31 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 43746: Completion/Unix/Command/_ping: update for BSD and
+ Darwin
+
+ * 43744: Completion/Unix/Command/_sysctl: add support for
+ procps-ng (Linux) and NetBSD, with several other updates
+
+2018-10-24 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 43726: Test/A01grammar.ztst: Add tests for semicolon in the
+ middle of a sublist not terminating it.
+
+2018-10-24 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 43723: Completion/Unix/Command/_mkdir: fix for builtin
+ mkdir, and add support for darwin
+
+ * 43722: Completion/Unix/Command/_ed,
+ Completion/Unix/Command/_env, Completion/Unix/Command/_sort:
+ use the same completions as freebsd for darwin.
+
+ * 43721: Completion/Unix/Command/_diff3: detect GNU variant
+ correctly
+
+2018-10-24 dana <dana@dana.is>
+
+ * 43718: Completion/BSD/Command/_fstat,
+ Completion/Unix/Command/_awk, Completion/Unix/Command/_cat,
+ Completion/Unix/Command/_chown, Completion/Unix/Command/_df,
+ Completion/Unix/Command/_grep, Completion/Unix/Command/_ls,
+ Completion/Unix/Command/_od, Completion/Unix/Command/_pax,
+ Completion/Unix/Command/_rar, Completion/Unix/Command/_rm,
+ Completion/Unix/Command/_xxd: Use singular group descriptions
+
+2018-10-23 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Marcin Mielniczuk: 43714: Completion/Unix/Command/_lp: lp
+ fit-to-page option.
+
+ * Sebastian: 43695: Src/lex.c: minor but simple optimisation
+ to reuse existing string lengths.
+
+2018-10-22 dana <dana@dana.is>
+
+ * 43713: Completion/Unix/Command/_init_d: Improve completion of
+ service commands
+
+2018-10-17 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 43694: Doc/Zsh/redirect.yo: More detail on how multio file
+ opening differs from cat.
+
+2018-10-17 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 43697: Completion/X/Command/_zathura: match uppercase
+ filename extensions
+
+ * 43698: Completion/Unix/Command/_git: update options for 2.19
+
+2018-10-16 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 43692: Doc/Makefile.in: Generate man pages in the build dir,
+ rather than the source dir.
+
+2018-10-15 dana <dana@dana.is>
+
+ * 43672: Doc/Zsh/redirect.yo: Document result of redirecting
+ from a non-existent file
+
+2018-10-14 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Src/utils.c: internals: Document sepjoin().
+
+ * 43685: Functions/Misc/add-zle-hook-widget: Support running
+ under NO_UNSET ('set -u').
+
+2018-10-12 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 43674: Src/zsh.h, Config/version.mk: Split more parameter and
+ function flags to avoid using sign bit; bump version because of
+ wordcode incompatibility.
+
+2018-10-10 dana <dana@dana.is>
+
+ * 43602: Doc/Zsh/compsys.yo: Clarify behaviour of `compdef -p`
+
+2018-10-10 Peter Stephenson <p.stephenson@samsung.com>
+
+ * unposted: Test/C03traps.ztst: Another couple of tests for
+ other code paths.
+
+ * 43669: Src/builtin.c, Src/init.c, Test/C03traps.ztst: ensure
+ explicit exit status is used rather than implicit.
+
+2018-10-09 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 43660: Src/builtin.c, Src/exec.c, Src/init.c,
+ Test/C03traps.ztst: extend 43653 for implicit exit and combine
+ logic with pending exit status from exits within functions.
+
+ * 43656: Src/builtin.c: special tied parameters don't have
+ tieddata.
+
+ * unposted: Test/C03traps.ztst: addition to previous test
+ suggested by Mikael.
+
+ * 43653: Src/builtin.c, Test/C03traps.ztst: explicit exit from
+ EXIT trap overrides previous status.
+
+2018-10-08 a-wing <1@233.email>
+
+ * 43623: Completion/Linux/Command/_iptables: Fix Completion
+ iptables -t raw security
+
+2018-10-08 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 43620 (tweaked): Doc/Zsh/contrib.yo,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_git,
+ Functions/VCS_Info/VCS_INFO_set-patch-format, README: vcs_info
+ git: Reverse the order patches are passed to gen-unapplied-string
+ in.
+
+ * 43617: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: During a non-interactive rebase of a detached head,
+ computer the %b expando correctly.
+
+ * 43619: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: In non-interactive rebases, always set
+ $hook_com[git_patches_applied] to a string of the form 'foo bar',
+ never just 'foo'.
+
+ * 43618: Functions/VCS_Info/Backends/VCS_INFO_detect_p4,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_git,
+ Functions/VCS_Info/VCS_INFO_quilt: vcs_info: Don't redefine
+ helper functions on every execution of the autoloadable outer
+ function.
+
+2018-10-08 Peter Stephenson <p.stephenson@samsung.com>
+
+ * unposted: tweak to Doc/Zsh/builtins.yo to put close
+ parenthesis on new line for help files script.
+
+ * Stephane: 43616: Doc/Zsh/builtins.yo, Src/Modules/db_gdbm.c,
+ Src/Modules/parameter.c, Src/builtin.c, Src/hashtable.h,
+ Src/params.c, Src/subst.c, Src/zsh.h, Test/B02typeset.ztst:
+ Fixes and improvements to tied variables and interaction
+ with typeset -p.
+
+2018-10-07 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 43587: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: In 'git rebase -i', when computing subjects
+ of applied-patches, handle an edge case where the subject is
+ not available.
+
+ * 43588: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: Make sure applied-patches is of the form "$hash
+ $subject" --- that is, has a space and a non-empty second
+ argument --- even with future 'git rebase -i' verbs.
+
+ * 43586: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: Reformat to minimise next diff. No functional
+ change.
+
+ * 43585: Functions/VCS_Info/Backends/VCS_INFO_get_data_svn:
+ vcs_info svn: Recognize working copies in need of an upgrade.
+
+2018-10-03 Peter Stephenson <p.stephenson@samsung.com>
+
+ * unposted: Etc/FAQ.yo: minor typos.
+
+ * 43589: Src/jobs.c: Show subjob status instead of superjob any
+ time it still has processes.
+
+2018-10-02 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ Indicate which use-case each branch handles.
+
+ * unposted: Doc/Zsh/contrib.yo: Fix typo
+
+2018-09-30 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 43531: Src/Zle/compcore.c: Completion: Fix some false
+ positives in the logic for "are these two candidates completions
+ equivalent".
+
+2018-09-28 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 43570: Src/jobs.c: Start documenting jobs.c, in particular
+ superjobs.
+
+2018-09-27 Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
+
+ * 43563: Doc/Zsh/zle.yo: zshzle: Clarify sentence in
+ introduction.
+
+2018-09-26 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 43564: Better output concerning stopped subjob.
+
+ * 43542 (tweaked): Etc/FAQ.yo: further update about which output.
+
+2018-09-25 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 43528: Doc/Zsh/builtins.yo: zshbuiltins(1): Document 'which''s
+ "not found is not an error" behaviour.
+
+2018-09-25 Oliver Freyermuth <o.freyermuth@xxxxxxxxxxxxxx>
+
+ * 43554 (tweaked): Completion/X/Command/_zathura: Fix zathura
+ completion ignoring multiple plugin directories.
+
+2018-09-25 Oliver Freyermuth <o.freyermuth@googlemail.com>
+
+ * 43544: Completion/X/Command/_zathura: Fix zathura filename
+ completion derived from *.so plugin name.
+
+2018-09-25 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 43489: Src/exec.c: Add error checking on a new write() call.
+
+2018-09-25 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 43543: Src/jobs.c: Improvements to 43535: attempt to keep
+ STAT_STOPPED correct for superjob, also wait for subjob before
+ superjob.
+
+2018-09-25 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Test/B02typeset.ztst: Add a test for 43536.
+
+2018-09-25 Peter Stephenson <p.stephenson@samsung.com>
+
+ * Stephane: 43536: "typeset -p" should show presence of -U
+ option.
+
+2018-09-24 dana <dana@dana.is>
+
+ * Takeshi Banse: users/23642: Completion/Unix/Type/_files: Revert
+ change from workers/42984
+
+2018-09-24 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 43535: Src/jobs.c, Src/signals.c: fixes for bg / fg handling
+ of superjobs. Be more consistent about marking jobs running;
+ always send SIGCONT when putting superjob / subjob combination
+ into foreground; wait for both superjob and subjob when waiting
+ for superjob.
+
+2018-09-24 Daniel Shahaf <danielsh@apache.org>
+
+ * 43493: Test/V07pcre.ztst: Have V07pcre fail if PCRE was enabled
+ by configure (config.modules) but failed to load for any reason.
+
+2018-09-24 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 43527, tweaked: Etc/FAQ.yo: describe "which" output
+ behaviour.
+
+2018-09-23 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * gitlab !2: Noam Barnea: Completion/Unix/Command/_toilet:
+ detect .flf files as well as .tlf ones
+
+2018-09-21 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 43511: Src/input.c: alias entry on input stack wasn't
+ initialised if not expanding alias or using history.
+
+2018-09-19 Maximilian Bosch <maximilian@mbosch.me>
+
+ * 43502: Completion/X/Command/_setxkbmap: Search XDG_DATA_DIRS
+ in _setxkbmap completion
+
+2018-09-18 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 43464: Completion/Linux/Command/_valgrind: complete options
+ for the drd tool and update them for helgrind
+
+2018-09-17 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: ChangeLog: Fix typo, s/43464/43474/.
+
+2018-09-16 dana <dana@dana.is>
+
+ * unposted: Doc/Zsh/builtins.yo: Fix trivial formatting error
+
+2018-09-16 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 43474: Src/exec.c, Src/jobs.c, Src/signals.c, Src/utils.c:
+ Remember the last process group to attach to the terminal, not
+ just the set of running processes which did. Don't
+ record process groups for ESUB_ASYNC subshells.
+
2018-09-14 Daniel Shahaf <d.s@daniel.shahaf.name>
+ * unposted: Completion/Unix/Command/_subversion: _svn: Allow
+ hyphens in command name aliases.
+
+ * unposted: Config/version.mk: Post-release version bump.
+
* 43457: Config/version.mk, Etc/FAQ.yo, NEWS, README: Release
5.6.2
diff --git a/Completion/BSD/Command/_cu b/Completion/BSD/Command/_cu
index 1fe08601f..df38d6ed7 100644
--- a/Completion/BSD/Command/_cu
+++ b/Completion/BSD/Command/_cu
@@ -32,7 +32,7 @@ case $variant in
'(-E --escape)'{-E+,--escape=}'[specify escape character]:escape character [~]'
'(-a -p --port)'{-a+,-p+,--port=}'[specify the port]:port'
'(-c --phone -n --prompt)'{-c+,--phone=}'[specify phone number to call]:phone number'
- '(1 -l -z --system)--line=[specify line to use]:line:(/dev/(cuaU#<->|ttyS<->|tty.*)(N%c))'
+ '(1 -l -z --system)--line=[specify line to use]:line:(/dev/(cuaU#<->|ttyS<->|tty.*|cu.*)(N%c))'
)
;|
taylor)
@@ -63,5 +63,5 @@ esac
_arguments -s $args \
'(--speed)-s+[set line speed for the connection]:line speed [9600]:_baudrates' \
- '(1 --line -z --system)-l+[specify line to use]:line:(/dev/(cuaU#<->|ttyS<->|tty.*)(N%c))' \
+ '(1 --line -z --system)-l+[specify line to use]:line:(/dev/(cuaU#<->|ttyS<->|tty.*|cu.*)(N%c))' \
'1: :_guard "^-*" system'
diff --git a/Completion/BSD/Command/_fstat b/Completion/BSD/Command/_fstat
index 5487e6c0f..153378441 100644
--- a/Completion/BSD/Command/_fstat
+++ b/Completion/BSD/Command/_fstat
@@ -9,4 +9,4 @@ _arguments -s \
'-p+[report all files open by the specified process]:process id:_pids' \
'-u+[report all files open by the specified user]:user:_users' \
'-v[verbose mode]' \
-'*:files:_files'
+'*: :_files'
diff --git a/Completion/BSD/Command/_powerd b/Completion/BSD/Command/_powerd
index 05c03ab15..c64abb5bc 100644
--- a/Completion/BSD/Command/_powerd
+++ b/Completion/BSD/Command/_powerd
@@ -3,13 +3,13 @@
local powerd_mode
powerd_mode=(minimum maximum adaptative)
_arguments -s \
- "-a[mode to use while on AC power]:mode:($powerd_mode)" \
- "-b[mode to use while on battery power]:mode:($powerd_mode)" \
- '-i[CPU idle percent level when begin to degrade performance]:percent:' \
- '-m[minimum frequency to throttle down to]:frequency (MHz)' \
- '-M[maximum frequency to throttle up to]:frequency (MHz)' \
- "-n[mode to use normally when the AC line state is unknown]:mode:($powerd_mode)" \
- '-p[polling interval (in milliseconds) for AC line state and system idle levels]:interval:' \
- '-P[alternative pidfile]:pidfile:_files' \
- '-r[CPU idle percent level where to increase performance]:percent:' \
- '-v[verbose mode]'
+ "-a+[mode to use while on AC power]:mode:($powerd_mode)" \
+ "-b+[mode to use while on battery power]:mode:($powerd_mode)" \
+ '-i+[CPU idle percent level when begin to degrade performance]:percent [75]' \
+ '-m+[minimum frequency to throttle down to]:frequency (MHz)' \
+ '-M+[maximum frequency to throttle up to]:frequency (MHz)' \
+ "-n+[mode to use normally when the AC line state is unknown]:mode:($powerd_mode)" \
+ '-p+[polling interval for AC line state and system idle levels]:interval (ms) [250]:' \
+ '-P+[alternative pidfile]:pidfile:_files' \
+ '-r+[CPU idle percent level where to increase performance]:percent' \
+ '-v[verbose mode]'
diff --git a/Completion/BSD/Command/_vmctl b/Completion/BSD/Command/_vmctl
index 4e66c2383..66d9081b0 100644
--- a/Completion/BSD/Command/_vmctl
+++ b/Completion/BSD/Command/_vmctl
@@ -1,16 +1,18 @@
#compdef vmctl
-local context line state state_descr
-local -a subcommands vmctl_status
-local -A opt_args
+local -a subcommands alts
-_vm_name() {
- compadd "$@" - ${${${(@f)"$(_call_program vmctl_status vmctl status)"}[2,-1]}##* }
+_vm_names() {
+ local expl
+ _description virtual-machines expl 'virtual machine'
+ compadd "$@" "$expl[@]" - ${${${(@f)"$(_call_program virtual-machines vmctl status)"}[2,-1]}##* }
}
-_vm_switch() {
+_vm_switches() {
+ local expl
+ _description virtual-switches expl 'virtual switch'
[[ -r /etc/vm.conf ]] &&
- compadd "$@" - ${${${(M)${(f)"$(</etc/vm.conf)"}:#switch *}##switch ##\"#}%%\"# *}
+ compadd "$@" "$expl[@]" - ${${${(M)${(f)"$(</etc/vm.conf)"}:#switch *}##switch ##\"#}%%\"# *}
}
subcommands=(
@@ -26,22 +28,30 @@ subcommands=(
{show,status}:'list VMs running or just the specified id'
start:'start a VM'
stop:'stop a VM'
- unpause:'unpause a VM'
+ unpause:'resume a VM'
)
if (( CURRENT == 2 )); then
_describe subcommand subcommands
else
+ local curcontext="${curcontext%:*}-${words[2]}:"
shift words; (( CURRENT-- ))
case $words[1] in
- console|pause|send|show|status|stop|unpause)
- _arguments ':id:_vm_name'
+ console|pause|send|show|status|unpause)
+ _vm_names
;;
create)
- _arguments \
- ':path:_files' \
- ': :(-s)' \
- ':disk size in megabytes: '
+ if (( CURRENT == 2 )); then
+ compset -P '(raw|qcow2):' || alts=(
+ 'prefixes:prefix:compadd -S: raw qcow2'
+ )
+ _alternative 'files:path:_files' $alts
+ else
+ shift words; (( CURRENT-- ))
+ _arguments \
+ '-s+[specify size]:size' \
+ '-b+[specify base disk]:base image:_files'
+ fi
;;
load)
_arguments ':configuration file:_files'
@@ -61,7 +71,7 @@ else
;;
start)
if (( CURRENT == 2 )); then
- _vm_name
+ _vm_names
else
shift words; (( CURRENT-- ))
_arguments -s \
@@ -71,9 +81,22 @@ else
'-i+[number of network interfaces]:number: ' \
'-L[add a local network interface]' \
'-m+[memory size in megabytes]:megabytes: ' \
- '-n+[specify switch to attach]:switch:_vm_switch' \
- '-r+[ISO image file for virtual CD-ROM]:ISO image:_files'
+ '-n+[specify switch to attach]: :_vm_switches' \
+ '-r+[ISO image file for virtual CD-ROM]:ISO image:_files' \
+ '-t+[use existing VM as a template]: :_vm_names'
fi
- ;;
+ ;;
+ stop)
+ if (( CURRENT == 2 )); then
+ _alternative \
+ 'all:all:(-a)' \
+ 'virtual-machines: :_vm_names'
+ else
+ shift words; (( CURRENT-- ))
+ _arguments \
+ '-f[forcefully stop without attempting a graceful shutdown]' \
+ '-w[wait until the VM has been terminated]'
+ fi
+ ;;
esac
fi
diff --git a/Completion/BSD/Type/_file_flags b/Completion/BSD/Type/_file_flags
index 95044121c..202a46c4a 100644
--- a/Completion/BSD/Type/_file_flags
+++ b/Completion/BSD/Type/_file_flags
@@ -7,6 +7,7 @@ local -a context line state state_descr copts=( "${@}" ) flags flag_descs
local -A val_args
flag_descs+=(
+ nodump nodump
uappnd 'user append-only'
uchg 'user immutable'
)
@@ -14,7 +15,6 @@ flag_descs+=(
if (( su )); then
flag_descs+=(
arch archived
- nodump nodump
sappnd 'system append-only'
schg 'system immutable'
)
@@ -36,12 +36,12 @@ if [[ $OSTYPE = (darwin|dragonfly|freebsd|netbsd)* ]]; then
if [[ $OSTYPE = dragonfly* ]]; then
flag_descs+=(
- cache XXX
+ cache cache
nouhistory 'user nohistory'
)
(( su )) && flag_descs+=(
- noscache XXX
+ noscache noscache
noshistory 'system nohistory'
)
fi
diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand
index ee3681bad..f4909826a 100644
--- a/Completion/Base/Completer/_expand
+++ b/Completion/Base/Completer/_expand
@@ -103,9 +103,19 @@ subd=("$exp[@]")
# Now try globbing.
-[[ "$force" = *g* ]] || zstyle -T ":completion:${curcontext}:" glob &&
- eval 'exp=( ${~exp//(#b)\\([ \"'"\'"'
+# We need to come out of this with consistent quoting, by hook or by crook.
+integer done_quote
+local orig_exp=$exp
+if [[ "$force" = *g* ]] || zstyle -T ":completion:${curcontext}:" glob; then
+ eval 'exp=( ${~exp//(#b)\\([ \"'"\'"'
+])/$match[1]} ); exp=( ${(q)exp} )' 2>/dev/null && done_quote=1
+fi
+# If the globbing failed, or we didn't try globbing, we'll do
+# it again without the "~" so globbing is simply omitted.
+if (( ! done_quote )); then
+ eval 'exp=( ${orig_exp//(#b)\\([ \"'"\'"'
])/$match[1]} ); exp=( ${(q)exp} )' 2>/dev/null
+fi
### Don't remember why we once used this instead of the (q) above.
# eval 'exp=( ${~exp} ); exp=( ${exp//(#b)([][()|*?^#~<>\\=])/\\${match[1]}} )' 2>/dev/null
diff --git a/Completion/Darwin/Command/_xcode-select b/Completion/Darwin/Command/_xcode-select
new file mode 100644
index 000000000..a24b1a6f2
--- /dev/null
+++ b/Completion/Darwin/Command/_xcode-select
@@ -0,0 +1,10 @@
+#compdef xcode-select
+
+# No -s, no -o+ form options
+_arguments : \
+ '(-)'{-h,--help}'[display help information]' \
+ '(-)'{-v,--version}'[display version information]' \
+ '(-)--install[install command-line developer tools]' \
+ '(-)'{-p,--print-path}'[display path of active developer directory]' \
+ '(-)'{-r,--reset}'[reset to default developer directory]' \
+ '(-)'{-s,--switch}'[specify path of active developer directory]:developer directory:_files -/'
diff --git a/Completion/Linux/Command/_btrfs b/Completion/Linux/Command/_btrfs
index 33b5c76f9..3ecebe62a 100644
--- a/Completion/Linux/Command/_btrfs
+++ b/Completion/Linux/Command/_btrfs
@@ -1,27 +1,25 @@
#compdef btrfs
-# based on Btrfs v3.12+20131125
local curcontext="$curcontext" curstate state line expl grp cmd cont shift ret=1
local -a cmds_1 cmds_2 cmds_3 cmds_4 cmds_5 cmds_6 cmds_7 cmds_8 cmds_9 cmds_10
local -a groups args
-groups=( subvolume filesystem device scrub balance inspect-internal
+groups=( subvolume filesystem device scrub balance inspect-internal property
quota qgroup replace rescue check restore send receive
help version )
-cmds_1=( create delete list snapshot get-default set-default find-new show help )
-cmds_2=( df show sync defragment resize label balance help )
-cmds_3=( add delete ready scan stats help )
+cmds_1=( create delete list snapshot get-default set-default find-new show sync help )
+cmds_2=( df du show sync defragment resize label usage help )
+cmds_3=( add delete remove ready scan stats usage help )
cmds_4=( start cancel resume status help )
cmds_5=( start pause cancel resume status )
-cmds_6=( inode-resolve logical-resolve subvolid-resolve rootid help )
-cmds_7=( enable disable rescan help )
-cmds_8=( assign remove create destroy show limit help )
-cmds_9=( start status cancel help )
-cmds_10=( chunk-recover super-recover )
+cmds_6=( dump-{super,tree} {inode,logical,subvolid}-resolve min-dev-size rootid tree-stats help )
+cmds_7=( get set list )
+cmds_8=( enable disable rescan help )
+cmds_9=( assign remove create destroy show limit help )
+cmds_10=( start status cancel help )
+cmds_11=( chunk-recover fix-device-size super-recover zero-log )
-[[ $words[2] = h(|e(|l(|p))) ]] && args=( '--full[display detailed help]' )
-
-_arguments -C "$args[@]" \
+_arguments -C -A "-*" "$args[@]" \
'(- *)--help[print help information]' \
'(- *)--version[print version information]' \
'(--version)1: :->groups' \
@@ -37,10 +35,10 @@ while (( $#state )); do
;;
cmds)
grp=${groups[(i)$words[2]*]}
- (( grp && grp <= 14 )) || return 1
+ (( grp && grp <= 16 )) || return 1
cont=${groups[grp]}
curcontext="${curcontext%:*:*}:$service-${cont}:"
- if (( grp <= 10 )); then
+ if (( grp <= 11 )); then
_wanted commands expl command compadd -a cmds_$grp && ret=0
continue
fi
@@ -48,9 +46,9 @@ while (( $#state )); do
args)
if [[ $curstate != cmds ]]; then
grp=${groups[(i)$words[1]*]}
- (( grp && grp <= 15 )) || return 1
+ (( grp && grp <= 16 )) || return 1
cont=${groups[grp]}
- if (( grp <= 10 )); then
+ if (( grp <= 11 )); then
local group=cmds_$grp
local cmd=${${(P)group}[(i)$words[2]*]}
(( cmd )) || return 1
@@ -62,18 +60,20 @@ while (( $#state )); do
fi
args=( '(-)--help[print help information]' )
case ${cont} in
- filesystem:balance)
- if (( CURRENT == 3 )); then
- state+=cmds
- else
- shift words
- (( CURRENT-- ))
- state+=args
- fi
- continue
+ subvolume:create)
+ args+=(
+ '*-i[add the newly created subvolume to a qgroup]:qgroup'
+ '1:destination:->mounts'
+ )
+ ;;
+ subvolume:delete)
+ args+=(
+ '(-c --commit-after -C --commit-each)'{-c,--commit-after}'[wait for transaction commit at the end of the operation]'
+ '(-c --commit-after -C --commit-each)'{-C,--commit-each}'[wait for transaction commit after deleting each subvolume]'
+ '(-v --verbose)'{-v,--verbose}'[verbose output of operations]'
+ '1:subvolume:_files -/'
+ )
;;
- subvolume:create) args+=( '1:destination:->mounts' );;
- subvolume:delete) args+=( '1:subvolume:_files -/' );;
subvolume:snapshot)
args+=(
'-r[readonly snapshot]'
@@ -91,53 +91,100 @@ while (( $#state )); do
'-o[include only subvolumes below the path]'
'-u[include UUID of subvolume]'
'-q[include parent UUID of subvolume]'
+ '-R[include the uuid of the received snapshots]'
'-t[print results as a table]'
'-s[list only snapshot subvolumes]'
'-r[list only readonly subvolumes]'
+ '-d[list deleted subvolumes that are not yet cleaned]'
'-G[subvolume generation is more or less than]:gen: _guard "(|+|-)[0-9]#"'
'-C[subvolume ogeneration is more or less than]:ogen: _guard "(|+|-)[0-9]#"'
- '--sort=-[list in order]:sort:_values -s "," sort rootid gen ogen path'
+ '--sort=-[list in order]:order:_sequence compadd - rootid gen ogen path'
'1:path:->mounts'
)
;;
subvolume:set-default) args+=( '1:id:_guard "[0-9]#" id' '2:path:->mounts' );;
- subvolume:get-default) args+=( '1:path:_files -/' );;
+ subvolume:show)
+ args+=(
+ '(-r --rootid)'{-r,--rootid}'[rootid of the subvolume]'
+ '(-u --uuid)'{-u,--uuid}'[uuid of the subvolume]'
+ '1:subvolume path:_directories'
+ )
+ ;;
+ subvolume:sync) args+=( '-s[sleep between checks]:delay (seconds) [1]' );;
subvolume:find-new) args+=( '1:subvol:_files -/' '2:lastgen: _message "last gen"' );;
+ (device|filesystem|qgroup):(df|du|show|usage))
+ args+=(
+ '--iec[use 1024 as a base]'
+ '--si[use 1000 as a base]'
+ )
+ ;|
+ (device|filesystem):(df|usage))
+ args+=(
+ '(-b --raw)'{-b,--raw}'[output raw numbers in bytes]'
+ '(-h --human-readable -H)'{-h,--human-readable}'[output human friendly numbers, base 1024]'
+ '(-h --human-readable -H)-H[output human friendly numbers, base 1000]'
+ '(-k --kbytes)'{-k,--kbytes}'[show sizes in KiB, or kB with --si]'
+ '(-m --mbytes)'{-m,--mbytes}'[show sizes in MiB, or MB with --si]'
+ '(-g --gbytes)'{-g,--gbytes}'[show sizes in GiB, or GB with --si]'
+ '(-t --tbytes)'{-t,--tbytes}'[show sizes in TiB, or TB with --si]'
+ )
+ ;|
+ (filesystem|qgroup):(du|show))
+ args+=(
+ '--raw[output raw numbers in bytes]'
+ '--human-readable[output human friendly numbers, base 1024]'
+ '--kbytes[show sizes in KiB, or kB with --si]'
+ '--mbytes[show sizes in MiB, or MB with --si]'
+ '--gbytes[show sizes in GiB, or GB with --si]'
+ '--tbytes[show sizes in TiB, or TB with --si]'
+ )
+ ;|
filesystem:resize) args+=( '1:size:_guard "(|+|-)[0-9]#[GKM]"' '2:path:->mounts' );;
filesystem:defragment)
args+=(
'-v[verbose]'
- '-c[compress files while defragmenting]'
+ '-r[defragment files recursively]'
+ '-c+[compress files while defragmenting]::compression algorithm:(zlib lzo zstd)'
'-r[defragment files recursively]'
'-f[flush after defragmenting]'
'-s[start position]:byte position'
'-l[defragment limited number of bytes]:length (bytes)'
- '-t[defragment only files over a certain size]:minimum size (bytes)'
+ '-t[defragment only files over a certain size]:minimum size (bytes) [32M]'
'*:file:_files'
)
;;
- filesystem:label) args+=( '1:device:_files -g "*(d)"' '2:label' );;
+ filesystem:du) args+=( '(-s --summarize)'{-s,--summarize}'[display only a total for each argument]' );;
+ filesystem:label) args+=( '1:device:_files -g "*(-%)"' '2:new label' );;
filesystem:show)
args+=(
'(1 -)'{-d,--all-devices}'[scan all devices in /dev]'
'(1 -)'{-m,--mounted}'[show only mounted filesystems]'
+ '--raw[output raw numbers in bytes]'
+ '--human-readable[output human friendly numbers, base 1024]'
'1: :_guard "^-*" uuid or label'
)
;;
- device:(add|delete))
+ filesystem:usage) args+=( '-T[show data in tabular format]' );;
+ device:(add|delete|ready|remove))
args+=(
- '1:device:_files -g "*(d)"'
+ '1:device:_files -g "*(-%)"'
'2:path:->mounts'
)
[[ ${${(P)group}[cmd]} == add ]] &&
args+=(
- {-K,--nodiscard}'[do not perform discard]'
+ {-K,--nodiscard}"[don't perform discard]"
{-f,--force}'[force overwrite of existing filesystem]'
)
;;
- device:scan) args+=( '(1 -)--all-devices[scan all devices in /dev]' '1:device:_files -g "*(d)"' );;
- device:stats) args+=( "1:device or mountpoint:_files -g '*(d,/)'" '-z[reset stats when done]' );;
- device:ready) args+=( '1:device: _files -g "*(d)"' );;
+ device:scan) args+=( '(1 -)'{-d,--all-devices}'[scan all devices in /dev]' '1:device:_files -g "*(-%)"' );;
+ device:stats)
+ args+=(
+ '(-c --check)'{-c,--check}'[return non-zero if any stat counter is not zero]'
+ '(-z --reset)'{-z,--reset}'[reset stats when done]'
+ "1:device or mountpoint:_files -g '*(-%,/)'"
+ )
+ ;;
+ device:ready) args+=( '1:device: _files -g "*(-%)"' );;
scrub:(start|resume))
args+=(
"-B[don't background and print statistics at end]"
@@ -149,10 +196,18 @@ while (( $#state )); do
'-n[set ioprio classdata]:classdata:(0 1 2 3 4 5 6 7)'
'1:path or device:_files'
)
- [[ ${${(P)group}[cmd]} == start ]] && args+=( '-R[raw print mode]' )
+ [[ ${${(P)group}[cmd]} == start ]] && args+=(
+ '-f[force starting new scrub even if a scrub is already running]'
+ )
+ ;;
+ scrub:cancel) args+=( '1: : _guard "^-*" "path or device"' );;
+ scrub:status)
+ args+=(
+ '-d[separate statistics for each device]'
+ '-R[print raw stats]'
+ '1:path or device:_files'
+ )
;;
- scrub:cancel) args+=( '1:path or device' );;
- scrub:status) args+=( '-d[separate statistics for each device]' '1:path or device:_files' );;
balance:start)
args+=(
'(-m -s)-d+[act on data chunks]:filter:->filters'
@@ -160,11 +215,21 @@ while (( $#state )); do
'(-d -m)-s+[act on system chunks (only under -f)]:filters:->filters'
'-v[verbose mode]'
'-f[force reducing of metadata integrity]'
+ "--full-balance[don't print warning and don't delay start]"
+ '(--background --bg)'{--background,--bg}'[run balance operation asynchronously in the background]'
'1:path:_files -/'
)
;;
balance:status) args+=( '-v[verbose mode]' '1:path:_files -/' );;
balance:(pause|cancel|resume)) args+=( '1:path:_files -/' );;
+ property:set) args+=( '3:value' );&
+ property:get) args+=( '2:property:(ro label compression)' );&
+ property:list)
+ args+=(
+ '-t[specify object type]:object type:(subvol filesystem inode device)'
+ '1:object'
+ )
+ ;;
quota:(enable|disable)) args+=( '1:path:_files -/' );;
quota:rescan)
args+=(
@@ -174,7 +239,10 @@ while (( $#state )); do
)
;;
qgroup:(assign|remove)) args+=( '1:source path:_files -/'
- '2:destination path:_files -/' '3:path:_files -/' );;
+ '2:destination path:_files -/' '3:path:_files -/' );|
+ qgroup:assign) args+=( \!--rescan
+ "--no-rescan[don't do a rescan, even if the assignment will make the quotas inconsitent]" )
+ ;;
qgroup:(create|destroy)) args+=( '1:qgroupid:' '2:path:_files -/' );;
qgroup:show)
args+=(
@@ -182,10 +250,11 @@ while (( $#state )); do
'-c[print child qgroup id]'
'-r[print max referenced size of qgroup]'
'-e[print max exclusive size of qgroup]'
- '-F[list impacted qgroups\(include ancestral qgroups\)]'
- '-f[list impacted qgroups\(exclude ancestral qgroups\)]'
+ '-F[list impacted qgroups \(include ancestral qgroups\)]'
+ '-f[list impacted qgroups \(exclude ancestral qgroups\)]'
'--sort=-[sort qgroups]:sort:_values -s , sort \
qgroupid rfer excl max_rfer max_excl'
+ '--sync[do filesystem sync before getting information]'
'1:path:_files -/'
)
;;
@@ -193,68 +262,106 @@ while (( $#state )); do
args+=(
'-c[limit amount of data after compression]'
'-e[limit space exclusively to qgroup]'
- ':size or none: _message "size or none"'
+ ': :_guard "^-*" "size or none"'
':qgroup id or path:_files -/'
':path:_files -/'
)
;;
replace:start)
args+=(
- '-r[read from <srcdev> only]:srcdev:_files'
+ '-r[read from specified source device only]:srcdev:_files'
'-f[force overwriting of target]'
- '-B[do not background]'
+ "-B[don't background]"
':srcdev or devid:_files'
':target:_files'
':path:->mounts'
)
;;
- replace:status) args+=( '-1[print once]' ':path:->mounts' );;
+ replace:status) args+=( '-1[print once rather than continuously]' ':path:->mounts' );;
replace:cancel) args+=( ':path:->mounts' );;
+ inspect*:dump-tree)
+ args+=(
+ '(-e --extents)'{-e,--extents}'[print only extent info: extent and device trees]'
+ '(-d --device)'{-d,--device}'[print only device info: tree root, chunk and device trees]'
+ '(-r --roots)'{-r,--roots}'[print only short root node info]'
+ '(-R --backups)'{-R,--backups}'[same as --roots plus print backup root info]'
+ '(-u --uuid)'{-u,--uuid}'[print only the uuid tree]'
+ '(-b --block)'{-b,--block}'[print info from the specified block only]:block'
+ '(-t --tree)'{-t,--tree}'[print only tree with the given id (string or number)]:tree id'
+ '--follow[use with -b, to show all children tree blocks of the block]'
+ )
+ ;;
+ inspect*:dump-super)
+ args+=( \!-s:byte\ number '!-i:super:(0 1 2)'
+ '(-f --full)'{-f,--full}'[print full superblock information, backup roots etc.]'
+ '(-a --all)'{-a,--all}'[print information about all superblocks]'
+ '(-s --super)'{-s,--super}'[specify which copy to print out]:super:(0 1 2)'
+ '(-F --force)'{-F,--force}'[attempt to dump superblocks with bad magic]'
+ '--bytenr[specify alternate superblock offset]:offset'
+ )
+ ;;
inspect*:inode*) args+=( '-v[verbose mode]' '1:inode:_files' '2:path:_files -/' );;
inspect*:subvol*) args+=( '-v[verbose mode]' '1:subvolid:_guard "[0-9]#" subvolume id' '2:path:_files -/' );;
inspect*:logical*)
args+=(
'-v[verbose mode]'
'-P[skip the path resolving and print the inodes instead]'
- '-s[buffer size]:buffer size:'
+ '-s[specify buffer size]:buffer size [4096]'
'1:logical address:_files'
'2:filesystem path:_files -/'
)
;;
+ inspect*:min*) args+=( '--id[specify the device id to query]:device id [1]' );;
inspect*:rootid) args+=( '1:path:_files -/' );;
+ inspect*:tree*) args+=( '-b[print raw numbers in bytes]' );;
rescue:(chunk|super)-recover)
args+=(
'-y[assume yes to every question]'
'-v[verbose mode]'
+ '1:device:_files'
)
- [[ ${${(P)group}[cmd]} == chunk-recover ]] && args+=('-h[display help]')
+ [[ ${${(P)group}[cmd]} == chunk-recover ]] && args+=('(-)-h[display help]')
;;
subvolume:get-default) ;&
*:sync) ;&
*:df) args+=( '1:path:->mounts' );;
check)
- args+=(
- {-s,--support}'[specify superblock]:superblock'
+ args+=( \!--readonly
+ '(-s --super)'{-s,--super}'[specify superblock]:superblock'
+ '(-b --backup)'{-b,--backup}'[use the backup root copy]'
+ '(-r --tree-root)'{-r,--tree-root}'[use specified byte number for the tree root]:byte number'
+ '--chunk-root[ use the given offset for the chunk tree root]:byte offset'
'--repair[try to repair the filesystem]'
+ '--force[skip mount checks, repair is not possible]'
+ '--mode[select memory/IO trade-off]:mode:(original lowmem)'
'--init-csum-tree[create a new CRC tree]'
'--init-extent-tree[create a new extent tree]'
+ '--clear-space-cache[clear space cache for v1 or v2]:version:(v1 v2)'
+ '--check-data-csum[verify checkums of data blocks]'
+ '(-Q --qgroup-report)'{-Q,--qgroup-report}'[verify qgroup accounting and compare against filesystem accounting]'
+ '(-E --subvol-extents)'{-E,--subvol-extents}'[show extent state for the given subvolume]:subvolume id'
+ '(-p --progress)'{-p,--progress}'[indicate progress at various checking phases]'
'1:path:_files -/'
)
;;
restore)
args+=(
- '-s[get snapshots]'
- '-x[get extended attributes]'
- '-v[verbose]'
- '-i[ignore errors]'
- '-o[overwrite]'
- '-t[tree location]:tree'
- '-f[filesystem location]:filesystem'
- '-u[super mirror]:mirror'
- '-r[root objectid]:objectid'
- '-d[find dir]'
- '-l[list tree roots]'
- '--path-regex[restore matching filenames]:regex'
+ '(-s --snapshots)'{-s,--snapshots}'[get snapshots]'
+ '(-x --xattr)'{-x,--xattr}'[restore extended attributes]'
+ '(-m --metadata)'{-m,--metadata}'[restore owner, mode and times]'
+ '(-S --symlink)'{-S,--symlink}'[restore symbolic links]'
+ '(-v --verbose)'{-v,--verbose}'[be verbose and output what is restored]'
+ '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors]'
+ '(-o --overwrite)'{-o,--overwrite}'[overwrite directories and files]'
+ '-t[specify tree location]:tree root'
+ '-f[specify filesystem location]:byte offset'
+ '(-u --super)'{-u,--super}'[use specified superblock mirror]:mirror:(0 1 2)'
+ '(-r --root)'{-r,--root}'[specify root objectid]:root id'
+ '-d[find directory]'
+ '(-l --list-roots)'{-l,--list-roots}'[list tree roots]'
+ '(-D --dry-run)'{-D,--dry-run}'[dry run (only list files that would be recovered)]'
+ '--path-regex[restore only filenames matching regex]:regex'
+ '-c[ignore case (--path-regex only)]'
'1:device:_files -/'
'2:path:_files -/'
)
@@ -262,9 +369,13 @@ while (( $#state )); do
send)
args+=(
'*-v[verbose mode]'
+ '-e[if sending multiple subvolumes at once, use the new format]'
'-p[send incremental stream]:parent:_files -/'
'*-c[use snapshot as clone source]:clone:_files -/'
- '-f[output file]:file:_files'
+ '-f[specify output file]:file:_files'
+ '--no-data[send in NO_FILE_DATA mode]'
+ '(-v --verbose)'{-v,--verbose}'[enable verbose output]'
+ '(-q --quiet)'{-q,--quiet}'[suppress all messages except errors]'
'1:subvolume:_files -/'
)
;;
@@ -273,9 +384,14 @@ while (( $#state )); do
'*-v[verbose mode]'
'-f[input file]:file: _files'
'-e[terminate after <end cmd>]'
+ '(-C --chroot)'{-C,--chroot}'[confine the process to destination path using chroot(1)]'
+ '(-E --max-errors)'{-E,--max-errors}'[terminate as soon as specified number of errors occur]:errors [1]'
+ '(--dump)-m[specify root mount point of the destination filesystem]:mount point:_directories'
+ '(-m)--dump[dump stream metadata, one line per operation]'
'1:mount:->mounts'
)
;;
+ h(|e(|l(|p)))) args+=( '--full[display detailed help]' );;
*) args+=( '*: :_default' );; # fallback for unknown subcommands
esac
if ! (( shift )); then
diff --git a/Completion/Linux/Command/_ethtool b/Completion/Linux/Command/_ethtool
index 84f2837a8..33b7681dc 100644
--- a/Completion/Linux/Command/_ethtool
+++ b/Completion/Linux/Command/_ethtool
@@ -106,6 +106,7 @@ if [[ -n $state ]]; then
'(d)a[wake on ARP]' \
'(d)g[wake on MagicPacket(tm)]' \
'(d)s[enable SecureOn(tm) password for MagicPacket(tm)]' \
+ '(d)f[wake on filter(s)]' \
'(p u m b a g s)d[disable (wake on nothing)]'
;;
sopass)
@@ -138,9 +139,6 @@ if [[ -n $state ]]; then
flags)
_message -e masks mask
;;
- encoding)
- _wanted encodings expl encoding compadd auto off rs baser
- ;;
context)
_message -e contexts 'RSS context'
;;
@@ -255,7 +253,7 @@ if [[ -n $state ]]; then
hkey hfunc delete
;;
-f|--flash)
- if (( CURRENT = 4 )); then
+ if (( CURRENT == 4 )); then
_files
else
_message -e regions region
@@ -291,7 +289,11 @@ if [[ -n $state ]]; then
{mgmt,irq,dma,filter,offload,mac,phy,ram,ap}{,-shared}
;;
--set-fec)
- _wanted options expl tunable compadd -F line - encoding
+ if (( CURRENT == 4 )); then
+ _wanted options expl tunable compadd - encoding
+ else
+ _wanted encodings expl encoding compadd -F line auto off rs baser
+ fi
;;
esac
;;
diff --git a/Completion/Linux/Command/_iptables b/Completion/Linux/Command/_iptables
index 447d7c932..ae8d66ea4 100644
--- a/Completion/Linux/Command/_iptables
+++ b/Completion/Linux/Command/_iptables
@@ -7,7 +7,7 @@ case $service in
iptables-save | ip6tables-save)
_arguments -s \
{-c,--counters}'[include values of packet and byte counters in output]' \
- {-t,--table}'[specify table]:table:(filter nat mangle)'
+ {-t,--table}'[specify table]:table:(filter nat mangle raw security)'
return
;;
iptables-restore | ip6tables-restore)
@@ -89,7 +89,7 @@ esac
local i=1
typeset -U args
while
- (( i=words[(ib.i.)-m|--match]+1 ))
+ (( i=words[(ib.i.)-m|--match]+1 ))
(( i<CURRENT )); do
case ${words[i]}; in
ah) args+=( '--ahspi[match SPIs in AH header]:*^!:spi' ) ;;
@@ -158,7 +158,7 @@ done
_arguments -C -s \
'(-)'{-h,--help}'[print program information]' \
'(-)'{-V,--version}'[print version information]' \
- '(-h --help -V --version)'{-t,--table}'[specify table]:table:(filter nat mangle)' \
+ '(-h --help -V --version)'{-t,--table}'[specify table]:table:(filter nat mangle raw security)' \
"($rcmds $cmds)"{-A,--append}'[append rules to end of specified chain]:chain:->chains' \
"($rcmds $cmds -c --set-counters)"{-D,--delete}'[delete rules from specified chain]:chain:->chains::rule number:->rulenums' \
"($rcmds $cmds)"{-I,--insert}'[insert rules before specified rule number]:chain:->chains::rule number:->rulenums' \
diff --git a/Completion/Linux/Command/_losetup b/Completion/Linux/Command/_losetup
index 9cfaaf5bf..d826e8d51 100644
--- a/Completion/Linux/Command/_losetup
+++ b/Completion/Linux/Command/_losetup
@@ -18,7 +18,8 @@ _arguments -s -S \
- 'info' \
'(-v --verbose)'{-v,--verbose}'[verbose mode]' \
'(-o --offset -a --all)'{-a,--all}'[show the status of all loop devices]' \
- '(-O --output)'{-O+,--output=}'[specify columns to be printed with --list]:column:_sequence -s , compadd - name autoclear back-file back-ino back-maj\:min maj\:min offset partscan ro sizelimit dio log-sec' \
+ '(-O --output --output-all)'{-O+,--output=}'[specify columns to be printed with --list]:column:_sequence -s , compadd - name autoclear back-file back-ino back-maj\:min maj\:min offset partscan ro sizelimit dio log-sec' \
+ '(-O --output)--output-all[output all columns]' \
'(-J --json --raw -O --output -n --noheadings)'{-J,--json}'[use JSON --list output format]' \
'(-l --list)'{-l,--list}'[list currently used loop devices]' \
'(-J --json)--raw[raw output format]' \
diff --git a/Completion/Linux/Command/_lsblk b/Completion/Linux/Command/_lsblk
index f37305445..1a3687c45 100644
--- a/Completion/Linux/Command/_lsblk
+++ b/Completion/Linux/Command/_lsblk
@@ -15,6 +15,7 @@ _arguments -C -s -S \
'(H -p --paths)'{-p,--paths}'[print complete device path]' \
'(H -s --inverse)'{-s,--inverse}'[reverse dependency order]' \
'(H -x --sort)'{-x+,--sort=}'[sort output by specified column]:column:->columns' \
+ '(H)--sysroot=[use specified directory as system root]:directory:_directories' \
'*:device:_files -g "*(-%b)" -P / -W /' \
+ fields \
'(H -D --discard -o --output -O --output-all)'{-D,--discard}'[output discard capabilities]' \
diff --git a/Completion/Linux/Command/_valgrind b/Completion/Linux/Command/_valgrind
index 1ae228c94..21b7d88c7 100644
--- a/Completion/Linux/Command/_valgrind
+++ b/Completion/Linux/Command/_valgrind
@@ -1,11 +1,11 @@
#compdef valgrind -value-,VALGRIND_OPTS,-default-
local curcontext="$curcontext" state line
-local -a cmd common common_{mem_null,read_varinfo}
-local -a args args_{addrcheck,memcheck,cachegrind,helgrind,lackey,massif,none}
+local -a cmd common_{own_malloc,read_varinfo,report_errors,partial}
+local -a args args_{addrcheck,drd,memcheck,cachegrind,helgrind,lackey,massif,none,exp_{bbv,dhat,sgcheck}}
cmd=(
- '1:command name:_command_names -e'
+ '1: : _command_names -e'
'*::args :_normal'
)
@@ -16,28 +16,96 @@ if [[ $service = *_OPTS* ]]; then
cmd=()
fi
-common=(
- '--alignment=-[set minimum alignment of allocations]:number'
+common_own_malloc=(
+ '--alignment=-[set minimum alignment of heap allocations]:number [16]'
+ '--redzone-size=-[set minimum size of redzones added before/after heap blocks]:size (bytes) [16]'
+ '--xtree-memory=-[profile heap memory in an xtree [none]:(none allocs full)'
+ '--xtree-memory-file=-[specify xtree memory report file]:file [xtmemory.kcg.%p]:_files'
)
common_read_varinfo=(
'--read-var-info=-[read DWARF3 debug info]:enable:(yes no)'
)
-common_mem_null=(
+common_report_errors=(
'--xml=-[output everything in XML]:enable:(yes no)'
+ '--xml-fd=-[send XML output to file descriptor]:file descriptor:_file_descriptors'
+ '--xml-file=-[send XML output to specified file]:file:_files'
+ '--xml-socket=-[send XML output to specified socket]:socket:_hosts'
'--xml-user-comment=-[copy specified string verbatim to XML output]:string'
+ '--demangle=-[automatically demangle C++ names]:enable:(yes no)' \
+ '--num-callers=-[specify no of callers to show in stack traces]:number' \
+ '--error-limit=-[stop showing new errors if too many]:enable:(yes no)' \
+ '--exit-on-first-error=-[exit on the first error]:enable:(yes no)' \
+ '--error-exitcode=-[exit code to return if errors found]:exit code' \
+ '--error-markers=-[add lines with begin/end markers before/after]:markers (begin,end)' \
+ '--keep-debuginfo=-[keep symbols etc for unloaded code]:enable:(yes no)' \
+ '--show-below-main=-[continue stack traces below main()]:enable [no]:(yes no)' \
+ '--default-suppression=-[load default suppressions]:enable [yes]:(yes no)' \
+ '--suppressions=-[suppress errors described in specified file]:file:_files' \
+ '--gen-suppressions=-[print suppressions for errors detected]:enable:(yes no)' \
+ '--input-fd=-[specify file descriptor for input]:file descriptor:_file_descriptors' \
+ '--max-stackframe=-[assume stack switch for SP changes larger than specified size]:size (bytes)' \
+ "--main-stacksize=-[set size of main thread's stack]:size (bytes)" \
)
+[[ $OSTYPE = darwin* ]] && common_report_errors+=(
+ '--dsymutil=-[run dsymutil on Mac OS X when helpful]:enable [yes]:(yes no)'
+)
+
+common_partial='--partial-loads-ok=-:enable:(yes no)'
args_addrcheck=(
- $common
+ $common_own_malloc
$common_mem_null
- '--partial-loads-ok=-:enable:(yes no)'
- '--freelist-vol=-[volume of freed blocks queue]:blocks'
- '--leak-check=-[search for memory leaks at exit]:enable:(yes no)'
- '--leak-resolution=-[how much bt merging in leak check]:level:(low med high)'
- '--show-reachable=-[show reachable blocks in leak check]:enable:(yes no)'
- '--workaround-gcc296-bugs=-:enable:(yes no)'
+ '--leak-check=-[search for memory leaks at exit]:enable [summary]:(no summary full)'
+ '--leak-resolution=-[specify differentiation of leak stack traces]:level [high]:(low med high)'
+ '(--show-reachable --show-possibly-lost)--show-leak-kinds=-[specify leak kinds to show]:leak kind [definite,possible]:_sequence compadd - definite indirect possible reachable'
+ '--errors-for-leak-kinds=-[specify which leak kinds are errors]:leak kind [definite,possible]:_sequence compadd - definite indirect possible reachable all none'
+ '--leak-check-heuristics=-[specify heuristics to use for during leak searches]:heuristic:_sequence compadd - stdstring length64 newarray multipleinheritance all none'
+ '(--show-leak-kinds)--show-reachable=-[show reachable blocks in leak check]:enable:(yes no)'
+ '(--show-leak-kinds)--show-possibly-lost=-:enable:(yes no)'
+ '--xtree-leak=-[output leak result in xtree format]:enable [no]:(yes no)'
+ '--xtree-leak-file=-[specify xtree leak report file]:file [xtleak.kcg.%p]:_files'
+ '--undef-value-errors=-[check for undefined value errors]:enable [yes]:(yes no)'
+ '--track-origins=-[show origins of undefined values]:enable [no]:(yes no)'
+ $common_partial
+ '--expensive-definedness-checks=-[use extra-precise definedness tracking]:enable [auto]:(no auto yes)'
+ '--freelist-vol=-[specify volume of freed blocks queue]:blocks [20000000]'
+ '--freelist-big-blocks=-[release first blocks larger than specified size]:size [1000000]'
+ '--workaround-gcc296-bugs=-:enable [no]:(yes no)'
+ '--ignore-ranges=-[assume given addresses are OK]:address ranges'
+ "--ignore-range-below-sp=-[don't report errors for accesses at the given offsets below SP]:offsets"
+ "--malloc-fill=-[fill malloc'd areas with given value]:value (hex)"
+ "--free-fill=-[fill free'd areas with given value]:value (hex)"
+ "--keep-stacktraces=-[control which stack traces to keep for malloc'd/free'd areas]:stack traces [alloc-and-free]:(alloc free alloc-and-free alloc-then-free none)"
+ "--show-mismatched-frees=-[show frees that don't match the allocator]:enable [yes]:(yes no)"
+)
+
+args_drd=(
+ $common_own_malloc
+ $common_read_varinfo
+ '--check-stack-var=-[detect data races on stack variables]:enable [no]:(yes no)'
+ '--exclusive-threshold=-[print an error if any mutex or writer lock is held longer than specified time]:time (ms)'
+ '--first-race-only=-[report only the first detected data race]:enable [no]:(yes no)'
+ '--free-is-write=-[report races between accessing memory and freeing memory]:enable [no]:(yes no)'
+ '--join-list-vol=-[specify how many joined threads to retain memory access information for]:number of threads [10]'
+ '--report-signal-unlocked=-[report calls to pthread_cond_signal etc where the mutex is not locked]:enable [yes]:(yes no)'
+ '--segment-merging=-[control segment merging]:enable [yes]:(yes no)'
+ '--segment-merging-interval=-[perform segment merging only after the specified number of new segments have been created]:number of segments [10]'
+ '--shared-threshold=-[print an error if a reader lock is held longer than the specified time]:time (ms)'
+ '--show-confl-seg=-[show conflicting segments in race reports]:enable [yes]:(yes no)'
+ '--show-stack-usage=-[print stack usage at thread exit time]:enable [no]:(yes no)'
+ '--ignore-thread-creation=-[control whether all activities during thread creation should be ignored]:enable [no]:(yes no)'
+ '*--ptrace-addr=-[trace all load and store activity for specified address even after free]:address'
+ '*--trace-addr=-[trace all load and store activity for specified address]:address'
+ '--trace-alloc=-[trace all memory allocations and deallocations]:enable [no]:(yes no)'
+ '--trace-barrier=-[trace all barrier activity]:enable [no]:(yes no)'
+ '--trace-cond=-[trace all condition variable activity]:enable [no]:(yes no)'
+ '--trace-fork-join=-[trace all thread creation and all thread termination events]:enable [no]:(yes no)'
+ '--trace-hb=-[trace execution of the ANNOTATE_HAPPENS_BEFORE(), ANNOTATE_HAPPENS_AFTER() and ANNOTATE_HAPPENS_DONE() client requests]:enable [no]:(yes no)'
+ '--trace-mutex=-[trace all mutex activity]:enable [no]:(yes no)'
+ '--trace-rwlock=-[trace all reader-writer lock activity]:enable [no]:(yes no)'
+ '--trace-semaphore=-[trace all semaphore activity]:enable [no]:(yes no)'
)
args_memcheck=(
@@ -48,66 +116,130 @@ args_memcheck=(
args_cachegrind=(
'--I1=-[set I1 cache manually]:size,assoc,line_size'
'--D1=-[set D1 cache manually]:size,assoc,line_size'
- '--L2=-[set L2 cache manually]:size,assoc,line_size'
+ '--LL=-[set LL cache manually]:size,assoc,line_size'
+ '--cache-sim=-[collect cache stats]:enable [yes]:(yes no)'
+ '--branch-sim=-[collect branch prediction stats]:enable [no]:(yes no)'
+ '--cachegrind-out-file=-[specify output file name]:file name [cachegrind.out.%p]:_files'
)
args_helgrind=(
- $common
+ $common_own_malloc
$common_read_varinfo
- '--private-stacks=-[assume thread stacks are used privately]:enable:(yes no)'
- '--show-last-access=-[show location of last word access on error]:locations:(no some all)'
+ '--free-is-write=-[treat heap frees as writes]:enable [no]:(yes no)'
+ '--track-lockorders=-[show lock ordering errors]:enable [yes]:(no yes)'
+ '--history-level=-[specify amount of history to show for data races]:level [full]:((
+ full\:show\ both\ stack\ traces\ for\ a\ data\ race\ \(slow\)
+ approx\:full\ trace\ for\ one\ thread,\ approx\ for\ the\ other\ \(faster\)
+ none\:only\ show\ trace\ for\ one\ thread\ in\ a\ race\ \(fastest\)
+ ))'
+ '--delta-stacktrace=-[derive a stacktrace from the previous stacktrace]:enable:(yes no)'
+ '--conflict-cache-size=-[specify size of full history cache]:size [2000000]'
+ '--check-stack-refs=-[race-check reads and writes on the main stack and thread stacks]:enable [yes]:(no yes)'
+ '--ignore-thread-creation=-[ignore activities during thread creation]:enable [no]:(yes no)'
)
args_lackey=(
- '--fnname=-[count calls to specified name]:name'
- '--detailed-counts=-[count loads, stores and alu ops]:enable:(yes no)'
+ '--basic-counts=-[count instructions, jumps, etc.]:enable [yes]:(yes no)'
+ '--detailed-counts=-[count loads, stores and alu ops]:enable [no]:(yes no)'
+ '--trace-mem=-[trace all loads and stores]:enable [no]:(yes no)'
+ '--trace-superblocks=-[trace all superblock entries]:enable [no]:(yes no)'
+ '--fnname=-[count calls to specified name]:name [main]'
)
args_massif=(
- $common
- '--heap=-[profile heap blocks]:enable:(yes no)'
- '--heap-admin=-[specify average admin bytes per heap block]:bytes'
- '--stacks=-[enable profile stacks]:enable:(yes no)'
- '--depth=-[depth of contexts]:depth'
- '--alloc-fn=-[specify alloc function]:function'
- '--format=-[specify format of textual output]:format:(text html)'
+ $common_own_malloc
+ '--heap=-[profile heap blocks]:enable [yes]:(yes no)'
+ '--heap-admin=-[specify average admin bytes per heap block]:size (bytes) [8]'
+ '--stacks=-[profile stacks]:enable [no]:(yes no)'
+ '--pages-as-heap=-[profile memory at the page level]:enable [no]:(yes no)'
+ '--depth=-[depth of contexts]:depth [30]'
+ '*--alloc-fn=-[specify alloc function]:function'
+ '*--ignore-fn=-[ignore heap allocations within specified function]:function'
+ '--threshold=-[specify significance threshold]:threshold (percentage) [1.0]'
+ '--peak-inaccuracy=-[specify maximum peak inaccuracy]:inaccuracy (percentage) [1.0]'
+ "--time-unit=-[specify time unit]:unit [i]:((
+ i\:instructions\ executed
+ ms\:milliseconds
+ b\:heap\ bytes\ alloc\'d/dealloc\'d
+ ))"
+ '--detailed-freq=-[every Nth snapshot should be detailed]:snapshot interval [10]'
+ '--max-snapshots=-[specofy maximum number of snapshots recorded]:maximum [100]'
+ '--massif-out-file=-[specify output file name]:filename [massif.out.%p]:_files'
+)
+
+args_exp_bbv=(
+ '--bb-out-file=-[specify filename for BBV info]:filename:_files'
+ '--pc-out-file=-[specify filename for BB addresses and function names]:filename:_files'
+ '--interval-size=-[specify interval size]:size (instructions) [100000000]'
+ '--instr-count-only=-[only print total instruction count]:enable:(yes no)'
+)
+
+args_exp_dhat=(
+ '--show-top-n=-[show specified number of the top alloc points]:number [10]'
+ '--sort-by=-[sort the allocation points by specified metric]:metric [max-bytes-live]:((
+ max-bytes-live\:maximum\ live\ bytes
+ tot-bytes-allocd\:bytes\ allocated\ in\ total\ \(turnover\)
+ max-blocks-live\:maximum\ live\ blocks
+ tot-blocks-allocd\:blocks\ allocated\ in\ total\ \(turnover\)
+ ))'
+)
+
+args_exp_sgcheck=(
+ $common_partial
+ '--enable-sg-checks=-[enable stack & global array checking]:enable [yes]:(yes no)'
)
args_none=(
$common_mem_null
)
-args="args_${${words[(r)--tool=*]#*=}:-memcheck}"
+args="args_${${${words[(r)--tool=*]#*=}/-/_}:-memcheck}"
_arguments -C ${(P)args} $cmd \
- '--tool=-[specify valgrind tool]:valgrind tool:->tools' \
+ '(--version)--tool=-[specify valgrind tool]:valgrind tool:->tools' \
'(-h --help)'{-h,--help}'[show help information]' \
'--help-debug[show help info including debugging options]' \
- '--version[show version]' \
+ '(-)--version[show version]' \
'(-q --quiet)'{-q,--quiet}'[run silently; only print error msgs]' \
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
'--trace-children=-[valgrind-ise child processes]:enable:(yes no)' \
+ '--trace-children-skip=-[specify a list of executables not to trace into]:executables' \
+ '--trace-children-skip-by-arg=-[specify a list of executables matched by argv not to trace into]:executables' \
+ '--child-silent-after-fork=-[omit child output between fork & exec]:enable:(yes no)' \
+ '--vgdb=-[activate gdbserver]:enable [yes]:(yes no full)' \
+ '--vgdb-error=-[invoke gdbserver after specified number of errors]:errors [999999999]:errors' \
+ '--vgdb-stop-at=-[invoke gdbserver for given events]:event:_sequence compadd - startup exit valgrindabexit all none' \
'--track-fds=-[track open file descriptors]:enable:(yes no)' \
'--time-stamp=-[add timestamps to log messages]:enable:(yes no)' \
'--log-fd=-[log messages to specified file descriptor]:file descriptor:_file_descriptors' \
'--log-file=-[log messages to specified file with pid appended]:file:_files' \
- '--log-file-exactly=-[log messages to specified file]:file:_files' \
- '--log-file-qualifier=-[log messages to filename given by specified environment variable]:variable:_parameters -g "*scalar*"' \
'--log-socket=-[log messages to socket]:ipaddr\:port' \
- '--run-libc-freeres=-[free up glibc memory at exit]:enable:(yes no)' \
- '--sim-hints=-[enable hint]:hint:(lax-ioctls enable-outer)' \
- '--show-emwarns=-[show warnings about emulation limits]:enable:(yes no)' \
- '--kernel-variant=-[handle non-standard kernel variants]:kernel variant:_values -s , kernel\ variant bproc' \
- '--demangle=-[automatically demangle C++ names]:enable:(yes no)' \
- '--num-callers=-[specify no of callers to show in stack traces]:number' \
- '--error-limit=-[stop showing new errors if too many]:enable:(yes no)' \
- '--show-below-main=-[continue stack traces below main()]:enable:(yes no)' \
- '--suppressions=-[suppress errors described in specified file]:file:_files' \
- '--gen-suppressions=-[print suppressions for errors detected]:enable:(yes no)' \
- '--db-attach=-[start debugger when errors detected]:enable:(yes no)' \
- '--db-command=-[specify command to start debugger]:command:_command_names -e' \
- '--input-fd=-[specify file descriptor for input]:file descriptor:_file_descriptors' \
- '--max-stackframe=-[assume stack switch for SP changes larger than specified number of bytes]:bytes' \
+ '*--fullpath-after=-[show full source paths in call stacks]::prefix to remove from paths:_directories' \
+ '--extra-debuginfo-path=-[specify absolute path to search for additional debug symbols]:path:_directories' \
+ '--debuginfo-server=-[specify server to query for debug symbols]:server:_hosts' \
+ "--allow-mismatched-debuginfo=-[accept debuginfo objects that don't match the main object]:enable [no]:(yes no)" \
+ '--smc-check=-[check for self-modifying code]:checks [all-non-file]:(none stack all all-non-file)' \
+ '--read-inline-info=-[read debug info about inlined functions to improve stack traces]:enable:(yes no)' \
+ '--vgdb-poll=-[specify gdbserver poll max]:basic blocks [5000]' \
+ '--vgdb-shadow-registers=-[let gdb see the shadow registers]:enable [yes]:(yes no)' \
+ '--vgdb-prefix=-[specify prefix for bgdb FIFOs]:prefix:_files' \
+ '--run-libc-freeres=-[free up glibc memory at exit]:enable [yes]:(yes no)' \
+ '--run-cxx-freeres=-[free up libstdc++ memory at exit]:enable [yes]:(yes no)' \
+ '--sim-hints=-[activate unusual sim behaviours]:hint [none]:_sequence compadd - lax-ioctls lax-doors fuse-compatible enable-outer no-inner-prefix no-nptl-pthread-stackcache fallback-llsc none' \
+ '--fair-sched=-[schedule threads fairly on multicore systems]:enable [no]:(yes no try)' \
+ '--kernel-variant=-[handle non-standard kernel variants]:kernel variant:_sequence compadd - bproc android-no-hw-tls android-gpu-sgx5xx android-gpu-adreno3xx' \
+ '--merge-recursive-frames=-[merge frames between identical program counters in specified max frames]:frames [0]' \
+ '--num-transtab-sectors=-[specify size of translated code cache]:size (sectors) [32]' \
+ '--avg-transtab-entry-size=-[specify average size of a translated basic block]:size (bytes)' \
+ '--aspace-minaddr=-[avoid mapping memory below address]:address (0xPP) [guessed]' \
+ "--valgrind-stacksize=-[specify size of valgrind (host) thread's stack]:size (bytes) [1048576]" \
+ '--show-emwarns=-[show warnings about emulation limits]:enable [no]:(yes no)' \
+ '*--require-text-symbol=-[abort run if the specified shared object lacks specified symbol]:\:soname pattern\:symbol pattern' \
+ '*--soname-synonyms=-[specify patterns to map sonames to replacements]:soname=replacement' \
+ '--sigill-diagnostics=-[warn about illegal instructions]:enable [yes]:(yes no)' \
+ '--unw-stack-scan-thresh=-[enable stack-scan unwind if fewer than specified number of good frames found]:frames' \
+ '--resync-filter=-[attempt to avoid expensive address-space-resync operations]:enable:(yes no verbose)' \
+ '--max-threads=-[specify maximum number of threads that valgrind can handle]:threads [500]' \
&& return
typeset -a tools
@@ -118,12 +250,10 @@ if [[ -n "$state" ]]; then
# Basically uses debug output to find out the directory where the tools are
# present and lists all executables in that directory.
# Hope the program provides a neater interface some day!
- () {
- setopt localoptions histsubstpattern
- tools=( ${${${(M)${(f)"$(_call_program tools valgrind --tool=something -d 2>&1)"}:#*launcher launching *something*}##*launcher launching }%%something*}*~*.*(*:t:s/-*//) )
- typeset -U tools
- }
- _wanted tools exl 'valgrind tool' compadd $tools && return
+ tools=( ${${${${(M)${(f)"$(_call_program tools $words[1] --tool=something -d 2>&1)"}:#*launcher launching *something*}##*launcher launching }%%something*}:-${commands[valgrind]:h:h}/lib/valgrind/}*~*.*(*:t) )
+ tools=( ${tools%-*-*} )
+ typeset -U tools
+ _wanted tools exl 'valgrind tool' compadd -a tools && return
fi
return 1
diff --git a/Completion/Unix/Command/_ack b/Completion/Unix/Command/_ack
index 626e54e0f..e83a9330e 100644
--- a/Completion/Unix/Command/_ack
+++ b/Completion/Unix/Command/_ack
@@ -21,17 +21,18 @@ zstyle -s ":completion:${curcontext}:" cache-policy update_policy
typeset -ga _ack_raw_types
if _cache_invalid ack-types || ! _retrieve_cache ack-types; then
- (( ${+commands[${words[1]}]} )) && _ack_raw_types=(
- ${(S)${(S)${(f)${${"$(_call_program file-types $words[1] --help=types)"}#*--\[no\]}}%; first line matches \/*\/}#*no\]} )
+ _ack_raw_types=(
+ ${(S)${(S)${(f)${${"$(_call_program file-types $words[1] --help-types)"}#*--\[no\]}}%; ?irst line matches \/*\/}#*no\]} )
[[ $#_ack_raw_types -gt 0 ]] && _store_cache ack-types _ack_raw_types
fi
(( $#words > 2 )) && ign='!'
_arguments -C -s -S \
- '(-i --ignore-case --smart-case --no-smart-case --nosmart-case --lines)'{-i,--ignore-case}'[match case-insensitively]' \
- '(-i --ignore-case --no-smart-case --nosmart-case --lines)--smart-case[case-insensitive match unless pattern includes uppercase]' \
- '(-i --ignore-case --smart-case --no-smart-case --nosmart-case --lines)'{--no-smart-case,--nosmart-case}'[disable --smart-case option]' \
+ '(-i --ignore-case -I -S --smart-case --no-smart-case --nosmart-case --lines)'{-i,--ignore-case}'[match case-insensitively]' \
+ '(-i --ignore-case -I -S --no-smart-case --nosmart-case --lines)'{-S,--smart-case}'[case-insensitive match unless pattern includes uppercase]' \
+ '(-i --ignore-case -I -S --smart-case --no-smart-case --nosmart-case --lines)'{--no-smart-case,--nosmart-case}'[disable --smart-case option]' \
+ '(-i --ignore-case -S --smart-case --no-smart-case --nosmart-case --lines)-I[turn on case-sensitivity in pattern]' \
'(-v --invert-match)'{-v,--invert-match}'[select non-matching lines]' \
'(-w --word-regexp)'{-w,--word-regexp}'[force pattern to match only whole words]' \
'(-Q --literal)'{-Q,--literal}'[use literal strings]' \
@@ -59,10 +60,12 @@ _arguments -C -s -S \
'(--nobreak --break)'{--nobreak,--break}'[print a break between results from different files, default on]' \
'(--nogroup)--group[group matches by file name]' \
"(--group)--nogroup[don't group matches by file name]" \
+ '--proximate=[separate match output with blank lines unless they are adjacent]::proximity (lines)' \
'(--nocolor --nocolour)--colo'{,u}'r[enable color highlighting of output]' \
- '(--color --colour --color-filename --color-match --color-lineno)--nocolo'{,u}'r[suppress the color]' \
+ '(--color --colour --color-filename --color-match --color-colno --color-lineno)--nocolo'{,u}'r[suppress the color]' \
'(--nocolor --nocolour --color --colour)--color-filename=[sets the color to be used for filenames]:color:->colors' \
'(--nocolor --nocolour --color --colour)--color-match=[sets the color to be used for matches]:color:->colors' \
+ '(--nocolor --nocolour --color --colour)--color-colno=[specify color for column numbers]:color:->colors' \
'(--nocolor --nocolour --color --colour)--color-lineno=[specify color for line numbers]:color:->colors' \
'--flush[flush output on every line]' \
'(1)-f[only print the files that would be searched, without actually doing any searching]' \
@@ -92,6 +95,8 @@ _arguments -C -s -S \
'(--filter --nofilter)--filter[treat standard input as pipe]' \
'(--filter --nofilter)--nofilter[treat standard input as tty]' \
"${ign}(- 1 *)--man[display the manual page]" \
+ "${ign}(- 1 *)--faq[display the frequently asked questions]" \
+ "${ign}(- 1 *)--cookbook[display a list of tips and tricks for using ack]" \
"${ign}(- 1 *)--version[display version and copyright information]" \
"${ign}(- 1 *)--bar[consult Admiral Ackbar]" \
"${ign}(- 1 *)--thpppt[bill the cat]" \
diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb
index 776a03cbc..75a447dfc 100644
--- a/Completion/Unix/Command/_adb
+++ b/Completion/Unix/Command/_adb
@@ -112,6 +112,9 @@ _adb_dispatch_command () {
(*:adb-shell:)
(( $+functions[_adb_dispatch_shell] )) && _adb_dispatch_shell
;;
+ (*:adb-backup:)
+ (( $+functions[_adb_dispatch_backup] )) && _adb_dispatch_backup
+ ;;
(*:adb-connect:|*:adb-disconnect:)
(( $+functions[_adb_dispatch_connection_handling] )) && _adb_dispatch_connection_handling
;;
@@ -191,6 +194,18 @@ _adb_dispatch_shell () {
esac
}
+(( $+functions[_adb_dispatch_backup] )) ||
+_adb_dispatch_backup() {
+ _arguments \
+ '-f[specify backup file]:backup file:_files' \
+ '-apk[backup .apk files]' '!(-apk)-noapk' \
+ '-obb[backup .obb files]' '!(-obb)-noobb' \
+ '-shared[backup shared storage]' '!(-shared)-noshared' \
+ '-all[backup all installed apps]' \
+ '-nosystem[include system apps when backing up all apps]' '!(-nosystem)-system' \
+ '*:package name:_adb_installed_packages'
+}
+
(( $+functions[_adb_pm_list] )) ||
_adb_pm_list () {
case ${words[4]} in
@@ -298,7 +313,7 @@ _adb_package_manager_handler () {
(getInstallLocation)
;;
(*)
- _wanted pm_argument expl 'pm argument' compadd list path install unistall enable disable setInstallLocation getInstallLocation
+ _wanted pm_argument expl 'pm argument' compadd list path install uninstall enable disable setInstallLocation getInstallLocation
;;
esac
}
diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible
index 330ef66b7..89a4998b7 100644
--- a/Completion/Unix/Command/_ansible
+++ b/Completion/Unix/Command/_ansible
@@ -1,6 +1,6 @@
#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault
-local curcontext="$curcontext" plug plugvar ret=1
+local curcontext="$curcontext" plug plugvar ign ret=1
local -a args state line
local -A opt_args
@@ -30,7 +30,7 @@ case $service in
'(-D --diff)'{-D,--diff}'[show differences when changing small files and templates]'
'(-b --become)'{-b,--become}'[escalate privileges on remote system]'
'(-f --forks)'{-f+,--forks=}'[specify number of parallel processes to use]:processes [5]'
- '--become-method=[specify privilege escalation method to use]:method [sudo]:(sesu sudo su pbrun pfexec doas dzdo ksu runas pmrun enable)'
+ '--become-method=[specify privilege escalation method to use]:method [sudo]:(sudo su pbrun pfexec doas dzdo ksu runas pmrun enable machinectl)'
'--become-user=[specify remote user for running operations]:user:_users'
"--syntax-check[perform a syntax check on the playbook, but don't execute it]"
'!(-R --su-user -U --sudo-user)'{-R,-U,--su-user,--sudo-user}':user [root]:_users'
@@ -102,6 +102,7 @@ case $service in
;;
ansible-doc)
args+=(
+ '!(-l --list -F --list_files -s --snippet)'{-j,--json} # "internal testing only"
'(-l --list -F --list_files -s --snippet)'{-l,--list}'[list available plugins]'
'(-l --list -F --list_files -s --snippet)'{-F,--list_files}'[show plugin names and their source files without summaries]'
'(-l --list -F --list_files -s --snippet)'{-s,--snippet}'[show playbook snippet for specified plugins]'
@@ -143,6 +144,7 @@ case $service in
ansible-pull)
args+=(
"--check[don't make any changes]"
+ '--diff[show the differences in changed files]'
'(-d --directory)'{-d+,--directory=}'[specify directory to checkout repository to]:directory:_directories'
'--full[do a full instead of a shallow clone]'
'(-m --module-name)'{-m+,--module-name=}'[specify repository module used for checking out repository]:module:(git subversion hg bzr)'
@@ -167,9 +169,10 @@ case $service in
;;
esac
+(( $#words > 2 )) && ign='!'
_arguments -s -S -C $args \
- '(- :)--version[display version information]' \
- '(- :)'{-h,--help}'[display usage information]' \
+ "${ign}(- :)--version[display version information]" \
+ "${ign}(- :)"{-h,--help}'[display usage information]' \
\*{-v,--verbose}"[verbose mode (repeat to increase)]" && ret=0
plug=${(v)opt_args[(i)-(t|-type)]:-module}
@@ -220,11 +223,18 @@ case $state in
fi
;;
galaxy)
+ ign=''
curcontext="${curcontext%:*}-${line[1]}:"
- args=()
+ (( $#words > 2 )) && ign='!'
+ args=(
+ "${ign}(-)"{-h,--help}'[display usage information]'
+ '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]'
+ '(-s --server)'{-s+,--server=}'[specify API server destination]:server:_hosts'
+ {-v,--verbose}'[verbose mode]'
+ )
case $line[1] in
info|search|list|remove|install)
- args=( '(-p --roles-path)'{-p,--roles-path}'[specify location of roles]:path:_directories' )
+ args+=( '(-p --roles-path)'{-p,--roles-path}'[specify location of roles]:path:_directories' )
;|
info|init)
args+=( "--offline[don't query the galaxy API]" )
@@ -241,22 +251,23 @@ case $state in
)
;;
setup)
- args=(
+ args+=(
'--list[list integrations]'
'--remove=[remove integration]:integration id'
)
;;
init)
args+=(
- '--container-enabled[initialize the skeleton role with default contents for a Container Enabled role]'
'--init-path=[specify path in which the skeleton role will be created]:path:_directories'
'--role-skeleton=[specify path to a role skeleton that the new role should be based upon]'
+ '--type=[initialize using an alternate role type]:role type:(container apb network)'
)
;;
install)
args+=(
'(-n --no-deps)'{-n,--no-deps}"[don’t download roles listed as dependencies]"
'(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors and continue with the next specified role]'
+ '(-g --keep-scm-meta)'{-g,--keep-scm-meta}'[use tar instead of the scm archive option when packaging the role]'
'(-r --role-file)'{-r+,--role-file=}'[specify file containing a list of roles to be imported]:file:_files'
)
;;
diff --git a/Completion/Unix/Command/_asciidoctor b/Completion/Unix/Command/_asciidoctor
new file mode 100644
index 000000000..3839c7ed3
--- /dev/null
+++ b/Completion/Unix/Command/_asciidoctor
@@ -0,0 +1,42 @@
+#compdef asciidoctor
+
+# Notes:
+# - We don't offer -v for verbose, even though that works in some cases
+# - @todo We don't complete arguments to -E and -r. Unclear how they work.
+# Should we offer gem names from `gem list`...?
+
+_arguments -s -S : \
+ '(: * -)'{-h+,--help=}'[display help information]::help topic:((
+ manpage\:"dump man page"
+ ))' \
+ '(: * -)'{-V,--version}'[display version information]' \
+ '(-q -v --quiet --verbose)'{-q,--quiet}'[reduce output verbosity]' \
+ '(-q -v --quiet --verbose)'{-v,--verbose}'[increase output verbosity]' \
+ '*'{-a+,--attribute=}'[set/unset specified document attribute]:document attribute' \
+ '(-b --backend)'{-b+,--backend=}'[specify backend output format]:backend:(
+ docbook docbook45 docbook5 html html5 manpage
+ )' \
+ '(-B --base-dir)'{-B+,--base-dir=}'[specify document base directory]:base directory:_files -/' \
+ '(-d --doctype)'{-d+,--doctype=}'[specify document type]:document type:(
+ article book inline manpage
+ )' \
+ '(-D --destination-dir)'{-D+,--destination-dir=}'[specify destination directory]:destination directory:_files -/' \
+ '(-e --eruby)'{-e+,--eruby=}'[specify eRuby implementation]:eRuby implementation:(erb erubis)' \
+ '(-E --template-engine)'{-E+,--template-engine=}'[specify template engine]:template engine' \
+ '--failure-level=[specify minimum logging level to trigger non-zero exit]:failure logging level [FATAL]:(
+ WARNING ERROR FATAL
+ )' \
+ '*'{-I+,--load-path=}'[add specified directory to load path]:extension directory:_files -/' \
+ '(-n --section-numbers)'{-n,--section-numbers}'[auto-number section titles]' \
+ '(-o --out-file)'{-o+,--out-file=}'[specify output file]:output file:_files' \
+ '(-R --source-directory)'{-R+,--source-dir=}'[specify source directory]:source directory:_files -/' \
+ '*'{-r+,--require=}'[require specified library]:Ruby library' \
+ '(-s --no-header-footer)'{-s,--no-header-footer}'[suppress document header/footer]' \
+ '(-S --safe --safe-mode)'{-S+,--safe-mode=}'[specify safe-mode level]:safe-mode level [unsafe]:(
+ unsafe safe server secure
+ )' \
+ '(-S --safe-mode)--safe[set safe-mode level to safe]' \
+ '(-t --timings)'{-t,--timings}'[display timing information]' \
+ '*'{-T+,--template-dir=}'[specify template directory]:template directory:_files -/' \
+ '--trace[include backtrace information on errors]' \
+ '*:source file:_files'
diff --git a/Completion/Unix/Command/_asciinema b/Completion/Unix/Command/_asciinema
new file mode 100644
index 000000000..8e94f0d1e
--- /dev/null
+++ b/Completion/Unix/Command/_asciinema
@@ -0,0 +1,59 @@
+#compdef asciinema
+
+local ret=1
+local -a context line state state_descr help
+local -A opt_args
+
+help=( '(: * -)'{-h,--help}'[display help information]' )
+
+_arguments -A '-*' \
+ $help \
+ '(: * -)--version[display version information]' \
+ '1:command:((
+ auth\:"link install ID with asciinema.org account"
+ cat\:"dump full output of recorded session"
+ play\:"play back recorded session"
+ rec\:"record session"
+ upload\:"upload recorded session"
+ ))' \
+ '*:: :->next' \
+&& ret=0
+
+[[ $state == next ]] &&
+case $words[1] in
+ auth)
+ _arguments -s -S : $help && ret=0
+ ;;
+ cat|upload)
+ _arguments -s -S : $help '1::recording file:_files' && ret=0
+ ;;
+ play)
+ _arguments -s -S : \
+ $help \
+ '(-i --idle-time-limit)'{-i+,--idle-time-limit=}'[specify max idle time]:max idle time (seconds)' \
+ '(-s --speed)'{-s+,--speed=}'[specify playback speed]:speed factor' \
+ '1: :->files-urls' \
+ && ret=0
+ [[ $state == files-urls ]] &&
+ _alternative 'files:recording file:_files' 'urls: :_urls' &&
+ ret=0
+ ;;
+ rec)
+ _arguments -s -S : \
+ $help \
+ '(--overwrite)--append[append to existing recording]' \
+ '(-c --command)'{-c+,--command=}'[specify command to record]: :_path_commands' \
+ '(-e --env)'{-e+,--env=}'[specify environment variables to capture]:environment variable:_sequence _parameters -g "*export*"' \
+ '(-i --idle-time-limit)'{-i+,--idle-time-limit=}'[specify max idle time]:max idle time (seconds)' \
+ '(-q -y --quiet --yes)'{-q,--quiet}'[suppress notices/warnings (implies -y)]' \
+ '--raw[save raw stdout output, without timing or other metadata]' \
+ '--stdin[enable stdin (keyboard) recording]' \
+ '(-t --title)'{-t+,--title=}'[specify title of recording]:title' \
+ '(--append)--overwrite[overwrite existing recording]' \
+ '(-y --yes)'{-y,--yes}'[bypass confirmation prompts]' \
+ '1::recording file:_files' \
+ && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_awk b/Completion/Unix/Command/_awk
index 4063743e5..b23ecdf9d 100644
--- a/Completion/Unix/Command/_awk
+++ b/Completion/Unix/Command/_awk
@@ -21,7 +21,7 @@ args=(
'*'{-v+,--assign}'[assign values to variables]:assignment:'
'(1)*'{-f+,--file}'[read program file]:program file:->script'
'1: :_guard "^-*" "program text"'
- '*:input files:_files'
+ '*:input file:_files'
)
case $variant in
diff --git a/Completion/Unix/Command/_cat b/Completion/Unix/Command/_cat
index e383f8c6b..c78dc4cd9 100644
--- a/Completion/Unix/Command/_cat
+++ b/Completion/Unix/Command/_cat
@@ -16,7 +16,7 @@ if _pick_variant gnu=GNU unix --version; then
'(-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'
+ '*: :_files'
)
elif [[ "$OSTYPE" == (*bsd|dragonfly|darwin)* ]]; then
@@ -29,7 +29,7 @@ elif [[ "$OSTYPE" == (*bsd|dragonfly|darwin)* ]]; then
'(-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'
+ '*: :_files'
)
[[ $OSTYPE = (free|net)bsd* ]] && args+=(
'-l[set a lock on the stdout file descriptor]'
@@ -48,14 +48,14 @@ elif [[ $OSTYPE = solaris* ]]; then
'-v[display non-printing chars as ^X or M-a]'
'-e[display $ at the end of each line (requires -v)]'
'-t[display tab as ^I and formfeeds and ^L (requires -v)]'
- '*:files:_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'
+ '*: :_files'
)
fi
diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown
index 2c63a399a..a97a0e0bf 100644
--- a/Completion/Unix/Command/_chown
+++ b/Completion/Unix/Command/_chown
@@ -40,7 +40,7 @@ else
fi
(( $+words[(r)--reference*] )) || args+=( '(--reference)1: :->owner' )
-_arguments -C -s "$args[@]" '*:files:->files' && ret=0
+_arguments -C -s "$args[@]" '*: :->files' && ret=0
case $state in
owner)
diff --git a/Completion/Unix/Command/_column b/Completion/Unix/Command/_column
index cb67fef37..a81684dba 100644
--- a/Completion/Unix/Command/_column
+++ b/Completion/Unix/Command/_column
@@ -9,6 +9,7 @@ case $OSTYPE in
linux-gnu)
args=(
'(info json -c --output-width)'{-c+,--output-width=}'[format output to fit display of specified width]:width'
+ '(info)'{-L,--table-empty-lines}"[don't ignore empty lines]"
+ fill
'(info table text json -x --fillrows)'{-x,--fillrows}'[fill rows before filling columns]'
+ table
diff --git a/Completion/Unix/Command/_df b/Completion/Unix/Command/_df
index a31145cd4..21abff105 100644
--- a/Completion/Unix/Command/_df
+++ b/Completion/Unix/Command/_df
@@ -19,7 +19,7 @@ if _pick_variant gnu=GNU unix --version; then
'!-v'
'(- : *)--help[display help and exit]'
'(- : *)--version[output version information and exit]'
- '*:files:_umountable'
+ '*: :_umountable'
- '(format)'
{-B+,--block-size=}'[specify block size]:size (bytes)'
'-k[like --block-size=1K]'
@@ -36,7 +36,7 @@ elif [[ "$OSTYPE" == (darwin|dragonfly|freebsd|netbsd*|openbsd)* ]]; then
'(-G -i -P)-i[include inode usage statistics (default)]'
'-l[only display locally-mounted file systems]'
'-n[use previously obtained statistics]'
- '*:files:_umountable'
+ '*: :_umountable'
)
spec='[only display file systems of specified types]:file system type:->fslist'
case "$OSTYPE" in
@@ -93,7 +93,7 @@ else
'-k[use 1024-byte blocks]'
'-P[POSIX compliant output]'
'-t[include total allocated-space figures in the output]'
- '*:files:_umountable'
+ '*: :_umountable'
)
fi
diff --git a/Completion/Unix/Command/_dhclient b/Completion/Unix/Command/_dhclient
index beaab5e2d..ee309e1fd 100644
--- a/Completion/Unix/Command/_dhclient
+++ b/Completion/Unix/Command/_dhclient
@@ -22,6 +22,7 @@ case $OSTYPE in
'-i+[ignore values provided by leases for specified options]:options'
'-L+[specify file to write option data too]:file:_files'
"-n[don't configure any interfaces]"
+ '-r[release the current lease back to the server it came from]'
'-v[verbose log messages]'
)
;;
diff --git a/Completion/Unix/Command/_diff3 b/Completion/Unix/Command/_diff3
index 524507ce0..8c59d701b 100644
--- a/Completion/Unix/Command/_diff3
+++ b/Completion/Unix/Command/_diff3
@@ -3,7 +3,7 @@
local -a args ed
local ign
-if _pick_variant gnu=GNU unix; then
+if _pick_variant gnu=GNU unix --version; then
ed=(
'(-m --merge -A --show-all)'{-e,--ed}'[output ed script for incorporating changes]'
'(-m --merge -A --show-all)'{-E,--show-overlap}'[like -e, but bracket conflicts]'
@@ -21,8 +21,8 @@ if _pick_variant gnu=GNU unix; then
'(-T --initial-tab)'{-T,--initial-tab}'[make tabs line up by prepending a tab]'
'--diff-program=[specify program to compare files]: : _command_names -e'
\*{-L+,--label=}'[use specified label instead of file name]:label'
- "$ign(-)--help[display usage information]"
- "$ign(-)"{-v,--version}'[display version information]'
+ "$ign(- :)--help[display usage information]"
+ "$ign(- :)"{-v,--version}'[display version information]'
)
else
args=( -A "-*" )
diff --git a/Completion/Unix/Command/_dig b/Completion/Unix/Command/_dig
index 18e9a0dbd..d37f18643 100644
--- a/Completion/Unix/Command/_dig
+++ b/Completion/Unix/Command/_dig
@@ -69,7 +69,7 @@ local -a alts args
_arguments -s -C $args \
'(- *)-h[display help information]' \
'(- *)-v[display version information]' \
- '*-c+[specify class]:class:compadd -M "m:{a-z}={A-Z}" - IN CS CH HS' \
+ '*-c+[specify class]:class:compadd -M "m\:{a-z}={A-Z}" - IN CS CH HS' \
'*-b+[specify source IP]:IP' \
'*-f+[batch mode, read arguments from file]:file:_files' \
'*-m[enable memory usage debugging]' \
@@ -88,7 +88,7 @@ if [[ -n $state ]]; then
_wanted hosts expl 'DNS server' _hosts && ret=0;
else
case $#line in
- <3->) alts+=( 'classes:query class:compadd -M "m:{a-z}={A-Z}" - IN CS CH HS' ) ;&
+ <3->) alts+=( 'classes:query class:compadd -M "m\:{a-z}={A-Z}" - IN CS CH HS' ) ;&
2) alts+=( 'types:query type:_dns_types' ) ;;
esac
_alternative 'hosts:host:_hosts' $alts && ret=0
diff --git a/Completion/Unix/Command/_dmidecode b/Completion/Unix/Command/_dmidecode
index eb273586f..047b74f6d 100644
--- a/Completion/Unix/Command/_dmidecode
+++ b/Completion/Unix/Command/_dmidecode
@@ -4,10 +4,11 @@ _arguments -s \
'(-d --dev-mem --from-dump)'{-d+,--dev-mem=}'[read memory from specified file]:memory device [/dev/mem]:_files' \
'(-)'{-h,--help}'[display usage information]' \
'(-q --quiet -u --dump)'{-q,--quiet}'[be less verbose]' \
- '(--type -u --dump --dump-bin -s --string)'{-s+,--string=}':DMI string:(bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency)' \
- '(-s --string --dump-bin)*'{-t+,--type=}'[only display entries of specified type]:entry type:(bios system baseboard chassis processor memory cache connector slot)' \
+ '(-t --type -H --handle -u --dump --dump-bin -s --string)'{-s+,--string=}'[only display value of specified DMI string]:DMI string:(bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency)' \
+ '(-s --string -H --handle --dump-bin)*'{-t+,--type=}'[only display entries of specified type]:entry type:(bios system baseboard chassis processor memory cache connector slot)' \
+ '(-s --string -t --type -H --handle --dump-bin)'{-H,--handle=}'[only display the entry of specified handle]:handle' \
'(-q --quiet -u --dump -s --string)'{-u,--dump}"[don't decode entries]" \
- '--dump-bin=[dump DMI data to a binary file]:file:_files' \
+ '(-s --string -t --type -H --handle)--dump-bin=[dump DMI data to a binary file]:file:_files' \
'(-d --dev-mem)--from-dump=[read DMI data from a binary file]:file:_files' \
"--no-sysfs[don't attempt to read DMI data from sysfs files]" \
'--oem-string=[only display the value of the specified OEM string]:OEM string number' \
diff --git a/Completion/Unix/Command/_ed b/Completion/Unix/Command/_ed
index 50d2710fc..6ca9ceace 100644
--- a/Completion/Unix/Command/_ed
+++ b/Completion/Unix/Command/_ed
@@ -19,7 +19,7 @@ if _pick_variant gnu=GNU unix --version; then
else
args=(-A '-*' ${args:#*\)--*})
case $OSTYPE in
- dragonfly*|freebsd*|netbsd*|solaris*)
+ dragonfly*|freebsd*|darwin*|netbsd*|solaris*)
args+=(
'-x[prompt for an encryption key]'
)
diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env
index 99fc513d7..932a7fc89 100644
--- a/Completion/Unix/Command/_env
+++ b/Completion/Unix/Command/_env
@@ -16,11 +16,11 @@ case $variant in
"${ign}(- *)--version[display version information]"
)
;;
- freebsd*)
+ freebsd*|darwin*)
args=(
- '(-i)*-u[remove variable from the environment]:env var to remove:_parameters -g "*export*"'
- '-P[specify alternate executable search PATH]:path:_dir_list'
- '-S[perform word splitting]'
+ '(-i)*-u+[remove variable from the environment]:env var to remove:_parameters -g "*export*"'
+ '-P+[specify alternate executable search PATH]:path:_dir_list'
+ '-S+[perform word splitting]:string to split'
'*-v[verbose output]'
)
;&
diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
index 5b97b8c30..9de0b79b1 100644
--- a/Completion/Unix/Command/_gcc
+++ b/Completion/Unix/Command/_gcc
@@ -646,7 +646,7 @@ args+=(
'-Wstrict-selector-match[Warn if type signatures of candidate methods do not match exactly]'
'-Wstringop-overflow[Warn about buffer overflow in string manipulation functions like memcpy and strcpy. Same as -Wstringop-overflow=]'
'-Wsubobject-linkage[Warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage]'
- '-Wsuggest-attribute=-[Warn about functions which might be candidates for __attribute__((const))]:const:(pure const noreturn format)'
+ '*-Wsuggest-attribute=-[warn about functions that might be candidates for attributes]:attribute:(pure const noreturn format)'
'-Wsuggest-final-methods[Warn about C++ virtual methods where adding final keyword would improve code quality]'
'-Wsuggest-final-types[Warn about C++ polymorphic types where adding final keyword would improve code quality]'
'-Wsuggest-override[Suggest that the override keyword be used when the declaration of a virtual function overrides another]'
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 195a7f6dc..093464625 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -295,7 +295,7 @@ _git-branch () {
declare l c m d e
l='--color --no-color -r --remotes -a -v --verbose --abbrev --no-abbrev --list --points-at --sort'
- c='-l --create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --no-contains --merged --no-merged'
+ c='--create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --no-contains --merged --no-merged'
m='-c --copy -C -m --move -M --edit-description'
d='-d --delete -D'
@@ -337,7 +337,7 @@ _git-branch () {
"($c $m $d : -v -vv --verbose)"{-v,-vv,--verbose}'[show SHA1 and commit subject line for each head]' \
"($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \
"($c $m $d :)--no-abbrev[don't abbreviate sha1s]" \
- "($l $m $d)"{-l,--create-reflog}"[create the branch's reflog]" \
+ "($l $m $d)--create-reflog[create the branch's reflog]" \
"($l $m $d -f --force)"{-f,--force}'[force the creation of a new branch]' \
"($l $m $d -t --track)"{-t,--track}'[setup configuration so that pull merges from the start point]' \
"($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \
@@ -872,6 +872,7 @@ _git-fetch () {
'(--all -m --multiple)'{-m,--multiple}'[fetch from multiple remotes]' \
'(-P --prune-tags)'{-P,--prune-tags}'[prune local tags no longer on remote and clobber changed tags]' \
\*{-o+,--server-option=}'[send specified string to the server when using protocol version 2]:option' \
+ '--negotiation-tip=[only report refs reachable from specified object to the server]:commit:__git_commits' \
'--filter=[object filtering]:filter:_git_rev-list_filters' \
'*:: :->repository-or-group-or-refspec' && ret=0
@@ -992,35 +993,37 @@ _git-grep () {
'--untracked[search also in untracked files]' \
'(-a --text)'{-a,--text}'[process binary files as if they were text]' \
'(--textconv --no-textconv)--textconv[honor textconv filter settings]' \
- '(--textconv --no-textconv)--no-textconv[do not honor textconv filter settings]' \
+ "(--textconv --no-textconv)--no-textconv[don't honor textconv filter settings]" \
'(-i --ignore-case)'{-i,--ignore-case}'[ignore case when matching]' \
- '-I[do not match pattern in binary files]' \
+ "-I[don't match pattern in binary files]" \
'--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]' \
+ '(-H)-h[suppress output of filenames]' \
+ '(-h -c --count)-H[show filenames]' \
'--full-name[output paths relative to the project top directory]' \
- '(-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)'{-E,--extended-regexp}'[use extended regular expressions]' \
+ '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-G,--basic-regexp}'[use basic regular expressions]' \
'(-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]' \
+ '(-E --extended-regexp -G --basic-regexp -P --perl-regexp -F --fixed-strings)'{-F,--fixed-strings}'[use literal strings]' \
'(-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]:pager:_cmdstring' \
+ '(-c --count)--column[show column number of first match]' \
+ '(-c --count -l --files-with-matches --name-only -L --files-without-match -o --only-matching)'{-l,--files-with-matches,--name-only}'[show only names of matching files]' \
+ '(-c --count -l --files-with-matches --name-only -L --files-without-match -o --only-matching)'{-L,--files-without-match}'[show only names of non-matching files]' \
+ '(-c --count -o --only-matching -n --line-number --color --no-color --cached --heading -O --open-files-in-pager)'{-O,--open-files-in-pager=}'-[open matching files in pager]::pager:_cmdstring' \
'(-z --null)'{-z,--null}'[output \0 after filenames]' \
- '(-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]' \
- '--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' \
+ '(-c --count -l --files-with-matches --name-only -L --files-without-match -o --only-matching)'{--only-matching,-o}'[show only matching part of line]' \
+ '(-h -c --count -l --files-with-matches --name-only -L --files-without-match -o --only-matching --color --break --heading -p --show-function -W --function-context)'{-c,--count}'[show number of matching lines in files]' \
+ '(--no-color -O --open-files-in-pager)--color=-[color matches]:: :__git_color_whens' \
+ "(--color -O --open-files-in-pager)--no-color[don't color matches]" \
+ '(-c --count -O --open-files-in-pager)--break[print an empty line between matches from different files]' \
+ '(-c --count -O --open-files-in-pager)--heading[show the filename above the matches]' \
+ '(-A --after-context)'{-A+,--after-context=}'[specify lines of trailing context]: :__git_guard_number lines' \
+ '(-B --before-context)'{-B+,--before-context=}'[specify lines of leading context]: :__git_guard_number lines' \
+ '(-A --after-context -B --before-context -C --context)'{-C+,--context=}'[specify lines of context]: :__git_guard_number lines' \
'--threads=[use specified number of threads]:number of threads' \
- '(-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]' \
+ '(-c --count -p --show-function)'{-p,--show-function}'[show preceding line containing function name of match]' \
+ '(-c --count -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 \
@@ -1210,7 +1213,8 @@ _git-merge () {
_arguments -S -s \
$merge_options \
- '-m+[set the commit message to be used for the merge commit]:merge message' \
+ \*{-m+,--message=}'[set the commit message to be used for the merge commit]:merge message' \
+ \*{-F+,--file=}'[read commit message from a file]:file' \
'(--edit --no-edit)-e[open an editor to change the commit 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]' \
@@ -1348,10 +1352,13 @@ _git-pull () {
_arguments \
$merge_options \
- '(-r --rebase --no-rebase)'{-r=-,--rebase=-}'[perform a rebase after fetching]::rebase after fetching:((true\:"rebase after fetching"
- false\:"merge after fetching"
- preserve\:"rebase and preserve merges"
- interactive\:"allow list of commits to be edited"))' \
+ '(-r --rebase --no-rebase)'{-r=-,--rebase=-}'[perform a rebase after fetching]::rebase after fetching:((
+ true\:"rebase after fetching"
+ false\:"merge after fetching"
+ merges\:"try to rebase merges instead of skipping them"
+ preserve\:"rebase and preserve merges"
+ interactive\:"allow list of commits to be edited"
+ ))' \
'(-r --rebase )--no-rebase[do not perform a rebase after fetching]' \
'--autostash[automatically stash/stash pop before and after rebase]' \
$fetch_options \
@@ -1423,6 +1430,20 @@ _git-push () {
return ret
}
+(( $+functions[_git-range-diff] )) ||
+_git-range-diff () {
+ local -a diff_options
+ __git_setup_diff_options
+
+ _arguments -s \
+ '--creation-factor=[specify weighting for creation]:weighting (percent)' \
+ '--no-dual-color[use simple diff colors]' \
+ $diff_options \
+ '1:range 1:__git_commit_ranges' \
+ '2:range 2:__git_commit_ranges' \
+ '3:revision 2:__git_commits'
+}
+
(( $+functions[_git-rebase] )) ||
_git-rebase () {
local -a autosquash_opts
@@ -1457,6 +1478,7 @@ _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]' \
+ '(-r --rebase-merges)'{-r-,--rebase-merges=-}'[try to rebase merges instead of skipping them]::option:(rebase-cousins no-rebase-cousins)' \
'(-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:_command_names -e' \
'(-k --keep-empty)'{-k,--keep-empty}'[keep empty commits in the result]' \
@@ -2325,7 +2347,15 @@ __git_config_option-or-value () {
color.diff.frag:'color of hunk headers::->color'
color.diff.func:'color of function in hunk header::->color'
color.diff.old:'color of removed lines::->color'
+ color.diff.oldMoved:'color of lines removed by a move::->color'
+ color.diff.oldMovedAlternative:'alternative color of lines removed by a move::->color'
+ color.diff.oldMovedAlternativeDimmed:'dimmed alternative color of lines removed by a move::->color'
+ color.diff.oldMovedDimmed:'dimmed color of lines removed by a move::->color'
color.diff.new:'color of added lines::->color'
+ color.diff.newMoved:'color of lines added by a move::->color'
+ color.diff.newMovedAlternative:'alternative color of lines added by a move::->color'
+ color.diff.newMovedAlternativeDimmed:'dimmed alternative color of lines added by a move::->color'
+ color.diff.newMovedDimmed:'dimmed color of lines added by a move::->color'
color.diff.commit:'color of commit headers::->color'
color.diff.whitespace:'color of whitespace errors::->color'
color.decorate.branch:'color of branches::->color'
@@ -2589,9 +2619,13 @@ __git_config_option-or-value () {
pull.rebase:'rebase branches on top of the fetched branch, instead of merging::->pull.rebase: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:simple'
+ push.followTags:'enable --follow-tags option by default::->bool:false'
+ push.gpgSign:'GPG-sign pushes::->bool:false'
+ push.recurseSubmodules:'ensure all submodule commits are available on a remote-tracking branch'
rebase.stat:'show a diffstat of what changed upstream since last rebase::->bool:false'
- rebase.autosquash:'autosquash by default::->bool:false'
- rebase.autostash:'autostash by default::->bool:false'
+ rebase.autoSquash:'autosquash by default::->bool:false'
+ rebase.autoStash:'autostash by default::->bool:false'
+ rebase.missingCommitsCheck:'print a warning if some commits are removed'
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'
@@ -2718,8 +2752,12 @@ __git_config_option-or-value () {
'url.*.pushInsteadOf:string to start URLs to push to with:prefix:->string'
user.email:'email address used for commits::_email_addresses -c'
user.name:'full name used for commits:name:->string'
+ user.useConfigOnly:'avoid guessing defaults for user.email and user.name:->bool:true'
user.signingkey:'default GPG key to use when creating signed tags::__git_gpg_secret_keys'
- web.browser:'web browser to use::__git_browsers')
+ versionsort.suffix:'specify sort order of suffixes applied to tags:suffix'
+ web.browser:'web browser to use::__git_browsers'
+ worktree.guessRemote:'with add, if branch matches remote track it::->bool:true'
+ )
declare -a git_present_options # 'present' is an adjective
git_present_options=(
@@ -2962,8 +3000,11 @@ __git_config_option-or-value () {
url:'URL prefixes'
user:'options controlling user identity'
web:'web options'
+ versionsort:'tag sorting options'
+ worktree:'git worktree options'
svn:'git svn options'
- svn-remote:'git svn remotes')
+ svn-remote:'git svn remotes'
+ )
() {
local i
for i in ${(u)git_present_options%%.*}; do
@@ -3689,7 +3730,8 @@ _git-repack () {
'--depth=[maximum delta depth]:maximum delta depth' \
'--threads=[limit maximum number of threads]:threads' \
'--max-pack-size=-[maximum size of each output packfile]: : __git_guard_bytes "maximum pack size"' \
- '--pack-kept-objects[repack objects in packs marked with .keep]'
+ '--pack-kept-objects[repack objects in packs marked with .keep]' \
+ '--keep-pack=[ignore named pack]:pack'
}
(( $+functions[_git-replace] )) ||
@@ -3835,11 +3877,12 @@ _git-get-tar-commit-id () {
(( $+functions[_git-help] )) ||
_git-help () {
_arguments -S -s \
- '( -g --guides -i --info -m --man -w --web)'{-a,--all}'[show all available commands]' \
- '(-a --all -g --guides -m --man -w --web)'{-i,--info}'[display manual for the command in info format]' \
- '(-a --all -g --guides -i --info -w --web)'{-m,--man}'[display manual for the command in man format]' \
- '(-a --all -g --guides -i --info -m --man )'{-w,--web}'[display manual for the command in HTML format]' \
- '(-g --guides)'{-g,--guides}'[prints a list of useful guides on the standard output]' \
+ '(-c --config -i --info -m --man -w --web)'{-a,--all}'[show all available commands]' \
+ '(-)'{-c,--config}'[print all configuration variable names]' \
+ '(-a --all -g --guides -c --config -m --man -w --web)'{-i,--info}'[display manual for the command in info format]' \
+ '(-a --all -g --guides -c --config -i --info -w --web)'{-m,--man}'[display manual for the command in man format]' \
+ '(-a --all -g --guides -c --config -i --info -m --man)'{-w,--web}'[display manual for the command in HTML format]' \
+ '(-g --guides -c --config -i --info -m --man -w --web)'{-g,--guides}'[prints a list of useful guides on the standard output]' \
'(-v --verbose)'{-v,--verbose}'[print command descriptions]' \
': : _alternative commands:command:_git_commands "guides:git guides:(attributes glossary ignore modules revisions tutorial workflows)"'
}
@@ -4886,6 +4929,7 @@ _git-cat-file () {
'(--batch)--batch-check=-[print SHA1, type and size (or in specified format)]::format' \
'--follow-symlinks[follow in-tree symlinks (used with --batch or --batch-check)]' \
'--batch-all-objects[show all objects with --batch or --batch-check]' \
+ "--unordered[don't order --batch-all-objects output]" \
'--buffer[disable flushing of output after each object]'
}
@@ -5698,6 +5742,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'
+ range-diff:'compare two commit ranges'
rebase:'forward-port local commits to the updated upstream head'
reset:'reset current HEAD to specified state'
revert:'revert existing commits'
@@ -7110,16 +7155,22 @@ __git_setup_diff_options () {
$exclusive_diff_options'--name-only[show only names of changed files]'
$exclusive_diff_options'--name-status[show only names and status of changed files]'
'--submodule=-[select output format for submodule differences]::format:((short\:"show pairs of commit names"
- log\:"list commits like git submodule does"
- diff\:"show differences"))'
- '( --no-color --color-words)--color=-[show colored diff]:: :__git_color_whens'
- '(--color --color-words)--no-color[turn off colored diff]'
+ log\:"list commits like git submodule does"
+ diff\:"show differences"))'
+ '( --no-color --color-words --color-moved)--color=-[show colored diff]:: :__git_color_whens'
+ '(--color --color-words --color-moved)--no-color[turn off colored diff]'
'--word-diff=-[show word diff]::mode:((color\:"highlight changed words using color"
plain\:"wrap deletions and insertions with markers"
porcelain\:"use special line-based format for scripts"
none\:"disable word diff"))'
'--word-diff-regex=-[specify what constitutes a word]:word regex'
- '(--color --no-color )--color-words=-[show colored-word diff]::word regex'
+ '(--color --no-color )--color-words=-[show colored-word diff]::word regex'
+ '(--color --no-color )--color-moved=-[color moved lines differently]::mode:((no\:"do not highlith moved lines"
+ default\:"like zebra"
+ plain\:"highlight moved lines with color"
+ blocks\:"greedily detect blocks of moved text of at least 20 characters"
+ zebra\:"like blocks, with alternating colors between different blocks"
+ dimmed-zebra\:"like zebra, uninteresting parts are dimmed"))'
'--no-renames[turn off rename detection]'
$exclusive_diff_options'--check[warn if changes introduce trailing whitespace or space/tab indents]'
'--full-index[show full object name of pre- and post-image blob]'
diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep
index 3bc8d3fe0..d3e1b1a6e 100644
--- a/Completion/Unix/Command/_grep
+++ b/Completion/Unix/Command/_grep
@@ -10,11 +10,11 @@ if [[ $service = *GREP_OPT* ]]; then
else
arguments=( '(-e --regexp -f --file)1: :_guard "^-*" pattern' )
if [[ $service = z* ]]; then
- arguments+=( '*:files:_files -g "*.gz(-.)"' )
+ arguments+=( '*: :_files -g "*.gz(-.)"' )
elif [[ $service = bz* ]]; then
- arguments+=( '*:files:_files -g "*.bz2(-.)"' )
+ arguments+=( '*: :_files -g "*.bz2(-.)"' )
else
- arguments+=( '*:files:_files' )
+ arguments+=( '*: :_files' )
fi
command="$words[1]"
fi
diff --git a/Completion/Unix/Command/_host b/Completion/Unix/Command/_host
new file mode 100644
index 000000000..e1174d46c
--- /dev/null
+++ b/Completion/Unix/Command/_host
@@ -0,0 +1,23 @@
+#compdef host
+
+# Note: This command is closely related to (and shares some options with) dig
+_arguments -s -S -A '-*' : \
+ '(: * -)-V[display version information]' \
+ '(-6)-4[use IPv4 only]' \
+ '(-4)-6[use IPv6 only]' \
+ '(-v -t)-a[query for all record types or (with -l) list all zone records]' \
+ '(-d -v)'{-d,-v}'[increase output verbosity]' \
+ '-c+[specify query class]:query class:compadd -M "m\:{a-z}={A-Z}" - CH CS HS IN' \
+ '-C[check SOA consistency]' \
+ '-l[list zone records]' \
+ '-N+[specify number of dots required to consider host name absolute]:number of dots' \
+ '-r[query non-recursively (clear RD bit)]' \
+ '-R+[specify number of retries for UDP queries]:number of retries [1]' \
+ '-s[do not try next name server after SERVFAIL]' \
+ '-t+[specify query type]: :_dns_types' \
+ '-T[query via TCP]' \
+ '*-m+[specify memory-usage debug flag]:debug flag:(record usage trace)' \
+ '(-W)-w[disable query timeout (wait forever)]' \
+ '(-w)-W+[specify query timeout]:query timeout (seconds) [5 (UDP), 10 (TCP)]' \
+ '1: :_hosts' \
+ '2::DNS server:_hosts'
diff --git a/Completion/Unix/Command/_init_d b/Completion/Unix/Command/_init_d
index 03af2dc9b..cdc373297 100644
--- a/Completion/Unix/Command/_init_d
+++ b/Completion/Unix/Command/_init_d
@@ -80,15 +80,29 @@ else
(( $+functions[_init_d_get_cmds] )) ||
_init_d_get_cmds() {
local what magic cmds
+ local -a tmp
- # If the file starts with `#!' we hope that this is a shell script
- # and get lines looking like <space>foo|bar) with the words in $what.
+ [[ -x $script ]] || return 1
- what='(st(art|op|atus)|(force-|)re(start|load)|debug_(up|down)|dump(|_stats)|add|delete|clean|list)'
+ # If the file starts with `#!' we hope that this is a shell script
+ # and get lines looking like <space>foo|bar) with the words in $what. Note
+ # that we'll fail to match if any of the alternate patterns in the case
+ # clause are not enumerated (e.g., `start|stop|custom)` won't match)
+ tmp=(
+ status add delete clean list
+ load save show check {config,}test
+ standalone master graceful
+ debug debug{_,-}{up,down} dump{,{_,-}stats}
+ {force-,graceful-,try-,}{start,stop,restart,reload}
+ {start,stop}-htcacheclean
+ )
+ what="((['\"]|)(${(j<|>)tmp})(['\"]|))"
- [[ -x $script ]] || return 1
- read -u0 -k2 magic < $script && [[ $magic = '#!' ]] &&
- cmds=( ${${(j:|:s:|:)${(M)${(f)"$(< $script)"}:#[[:blank:]]#(\'|)${~what}([[:blank:]]#\|[[:blank:]]#${~what})#(\'|)\)}}//[^-a-z_]} )
+ read -u0 -k2 magic < $script && [[ $magic = '#!' ]] && {
+ cmds=( ${(f)"$(< $script)"} )
+ cmds=( ${(M)cmds:#[[:blank:]]#${~what}([[:blank:]]#\|[[:blank:]]#${~what})#[[:blank:]]#\)} )
+ cmds=( ${${(j:|:s:|:)cmds}//[^-a-z_]} )
+ }
# This would be the pattern to use every line of the form <space>foo).
# Some people say this might match too many lines...
diff --git a/Completion/Unix/Command/_jq b/Completion/Unix/Command/_jq
index 4ff05dab4..b8e41dd66 100644
--- a/Completion/Unix/Command/_jq
+++ b/Completion/Unix/Command/_jq
@@ -27,8 +27,11 @@ _arguments -S -s : \
'(-f --from-file)'{-f,--from-file}'[read filter from file]:_files' \
'-L+[prepend a directory to the module search path]:_directories' \
'(-e --exit-status)'{-e,--exit-status}'[report "false" and "null" results via exit code]' \
- '*--arg[pre-set a variable to a string]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (string): ' \
- '*--argjson[pre-set a variable to an object]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (JSON): ' \
- '*--slurpfile[pre-set a variable to contents of a file]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (filename of file containing JSON):_files' \
+ '*--arg[pre-set a variable to a string]:variable name: :value (string)' \
+ '*--argjson[pre-set a variable to an object]:variable name: :value (JSON)' \
+ '*--slurpfile[pre-set a variable to an array of JSON texts read from a file]:variable name: :file:_files' \
+ '*--rawfile[pre-set a variable to the contents of a file]:variable name: :file:_files' \
+ '--args[remaining arguments are string arguments, not files]' \
+ '--jsonargs[remaining arguments are JSON arguments, not files]' \
"1: :_guard '|[^-]' filter" \
"*: :_files"
diff --git a/Completion/Unix/Command/_links b/Completion/Unix/Command/_links
index 34bb64560..8bb9fee1c 100644
--- a/Completion/Unix/Command/_links
+++ b/Completion/Unix/Command/_links
@@ -1,30 +1,121 @@
-#compdef links
+#compdef links links2
-local curcontext="$curcontext" state line ret=1
+local curcontext="$curcontext" state line ign ret=1
typeset -A opt_args
+(( $#words > 2 )) && ign='!'
_arguments -C \
- '(-help)-anonymous[restrict links so that it can run on an anonymous account]' \
- '(-help)-assume-codepage[specify default codepage to use]:codepage' \
- '(-help)-async-dns[asynchronous DNS resolver]:bool:((0\:on 1\:off))' \
- '(-help)-download-dir[default download directory]:_files -/' \
- '(-help)-driver[graphics driver to use]:graphics driver:->graphics_drivers' \
- '(-help)-dump[dump the page as pure text]' \
- '(-help)-format-cache-size[number of formatted document pages cached]:pages' \
- '(-help)-ftp-proxy[specify ftp proxy server]:proxy:->proxies' \
- '(-help)-g[run in graphics mode rather than plain text mode]' \
- '-help[prints the help screen]' \
- '(-help)-http-proxy[specify web proxy server]:proxy:->proxies' \
- '(-help)-image-cache-size[image cache memory]:memory (kilobytes)' \
- '(-help)-max-connections[maximum number of concurrent connections]:connections' \
- '(-help)-max-connections-to-host[maximum number of concurrent connection to a given host]:connections' \
- '(-help)-memory-cache-size[cache memory]:kilobytes' \
- '(-help)-no-connect[runs links as a separate instance]' \
- '(-help)-receive-timeout[timeout on receive]:timeout (seconds)' \
- '(-help)-retries[number of retries]:retries' \
- '(-help)-source[dump the source page]' \
- '(-help)-unrestartable-receive-timeout[timeout on non restartable connections]:timeout (seconds)' \
- '(-help)-version[prints the links version number and exit]' \
+ "${ign}-help[prints the help screen]" \
+ "${ign}(- :)-version[prints the links version number and exit]" \
+ "${ign}(- 1)-lookup[do hostname lookup]:hostname:_hosts" \
+ '-g[run in graphics mode rather than plain text mode]' '!-no-g' \
+ '-driver[graphics driver to use]:graphics driver:->graphics_drivers' \
+ '-mode[specify graphics mode]:graphics mode' \
+ '-display[specify X display]:display:_x_display' \
+ '-force-html[treat files with unknown type as html rather than text]' \
+ '-source[dump the source page]' \
+ '-dump[dump the page as pure text]' \
+ '-width[specify screen width for formatting with -dump]:width' \
+ '-codepage[convert output to specified character set with -dump]:codepage' \
+ '-anonymous[restrict links so that it can run on an anonymous account]' \
+ '-no-connect[runs links as a separate instance]' \
+ '-download-dir[default download directory]:_files -/' \
+ '-language[set user interface language]:language' \
+ '-max-connections[specify maximum number of concurrent connections]:connections [10]' \
+ '-max-connections-to-host[maximum number of concurrent connection to a given host]:connections [2]' \
+ '-retries[number of retries]:retries [3]' \
+ '-receive-timeout[timeout on receive]:timeout (seconds) [120]' \
+ '-unrestartable-receive-timeout[timeout on non-restartable connections]:timeout (seconds) [600]' \
+ '-timeout-when-trying-multiple-addresses[specify timeout for connection when trying multiple addresses]:timeout (seconds)' \
+ '-bind-address[use a specific local IP address]:IP address' \
+ '-bind-address-ipv6[use a specific local IPv6 address]:IPv6 address' \
+ "-no-libevent[don't use libevent library]" \
+ "-no-openmp[don't use OpenMP]" \
+ '-async-dns[asynchronous DNS resolver]:enable:((1\:on 0\:off))' \
+ '-download-utime[set time of downloaded files to last modification time reported by server]:enable:((1\:on 0\:off))' \
+ '-format-cache-size[number of formatted document pages cached]:pages [5]' \
+ '-memory-cache-size[cache memory]:size (bytes) [1048576]' \
+ '-image-cache-size[image cache memory]:size (bytes) [1048576]' \
+ '-font-cache-size[specify font cache size]:size (bytes) [2097152]' \
+ "-aggressive-cache[cache everything regardless of server's caching recomendations]:enable [1]:((1\\:on 0\\:off))" \
+ '-address-preference[specify IP version preference]:preference:((
+ 0\:system\ default
+ 1\:prefer\ IPv4
+ 2\:prefer\ IPv6
+ 3\:use\ only\ IPv4
+ 4\:use\ only\ IPv6
+ ))' \
+ '-http-proxy[specify web proxy server]:proxy:->proxies' \
+ '-ftp-proxy[specify ftp proxy server]:proxy:->proxies' \
+ '-https-proxy[specify https web proxy server]:proxy:->proxies' \
+ '-socks-proxy[specify socks4a proxy server]:proxy:->sproxies' \
+ '-append-text-to-dns-lookups[append text to dns lookups; useful for specifying fixed tor exit node]:text' \
+ '-no-proxy-domains[use no proxy for specified domains]:domain list' \
+ '-only-proxies[only initiate connections via proxy]:enable:((0\:off 1\:on))' \
+ '-ssl.certificates[specify handling of invalid signatures]:handling:((0\:ignore 1\:warn 2\:reject))' \
+ '-ssl.builtin-certificates[specify certificates to use]:certificates:((0\:system 1\:builtin))' \
+ '-ssl.client-cert-key[specify user private key for client certificate authentication]:PEM file:_files' \
+ '-ssl.client-cert-crt[specify user certificate for client certificate authentication]:PEM file:_files' \
+ '-ssl.client-cert-password[specify password for the user private key]:password' \
+ '-http-bugs.http10[specify HTTP version]:protocol [0]:((1\:force\ only\ HTTP\ 1.0 0\:use\ both\ HTTP\ 1.0\ and\ 1.1))' \
+ '-http-bugs.allow-blacklist[use list of servers with broken HTTP/1.1 support]:allow [1]:(1 0)' \
+ '-http-bugs.bug-no-accept-charset[specify sending of Accept-Charset field of HTTP header]:send [0]:(1 0)' \
+ '-http-bugs.no-compression[advertise HTTP compression support]:advertise compression [0]:((0\:yes 1\:no))' \
+ '-http-bugs.retry-internal-errors[retry on internal server errors (50x)]:retry [0]:((1\:yes 0\:no))' \
+ '-http.fake-firefox[fake Firefox in the HTTP header]:enable [0]:((0\:no 1\:yes))' \
+ '-http.do-not-track[send do not track request in the HTTP header]:enable [0]:(1 0)' \
+ "-http.referer[control sending of referer URL in requests]:referer [4]:((
+ 0\:don\'t\ send 1\:'send requested URL' 2\:'fake referer' 3\:'send real'
+ 4\:'send real only to the same server'
+ ))" \
+ '-http.fake-user-agent[specify fake user agent value]:string' \
+ '-http.extra-header[specify extra string added to HTTP header]:string' \
+ '-ftp.anonymous-password[specify password for anonymous ftp access]:password' \
+ '-ftp.use-passive[use ftp PASV command to bypass firewalls]:enable;(0 1)' \
+ '-ftp.use-eprt-epsv[use EPRT and EPSV commands instead of PORT and PASV]:enable:(0 1)' \
+ '-ftp.set-iptos[set IP type-of-service to high throughput on ftp connections]:enable:(0 1)' \
+ '-smb.allow-hyperlinks-to-smb[allow hyperlinks to SMB protocol]:enable:(0 1)' \
+ '-menu-font-size[specify size of font in menu]:size' \
+ '-menu-background-color[specify menu background color in graphics mode]:color (0xRRGGBB)' \
+ '-menu-foreground-color[specify menu foreground color in graphics mode]:color (0xRRGGBB)' \
+ '-scroll-bar-area-color[set colour of scroll bar area]:colour (0xRRGGBB)' \
+ '-scroll-bar-bar-color[set colour of scroll bar]:colour (0xRRGGBB)' \
+ '-scroll-bar-frame-color[set colour of scroll bar frame]:colour (0xRRGGBB)' \
+ '-bookmarks-file[specify file to store bookmarks]:file:_files' \
+ '-bookmarks-codepage[specify character set of bookmarks file]:character set' \
+ '-save-url-history[save URL history on exit]:enable:(0 1)' \
+ '-display-red-gamma[specify red gamma of display]:gamma [2.2]' \
+ '-display-green-gamma[specify green gamma of display]:gamma [2.2]' \
+ '-display-blue-gamma[specify blue gamma of display]:gamma [2.2]' \
+ '-user-gamma[specify additional gamma]:gamma [1]' \
+ '-bfu-aspect[display aspect ration]' \
+ '-dither-letters[do letter dithering]:enable:(0 1)' \
+ '-display-optimize[optimize for display type]:display:((0\:CRT 1\:LCD\ RGB 2\:LCD\ BGR))' \
+ '-gamma-correction[specify type of gamma correction]:gamma correction:((0\:8-bit 1\:16-bit 2\:auto\ detect))' \
+ '-overwrite-instead-of-scroll[overwrite the screen instead of scrolling it]:enable:(0 1)' \
+ '-html-assume-codepage[specify codepage to use if unspecified by server]:codepage' \
+ '-html-hard-assume[always use character set from -html-assume-codepage]:enable:(0 1)' \
+ '-html-tables[render tables]:enable:(0 1)' \
+ '-html-frames[render frames]:enable:(0 1)' \
+ '-html-images[display links to unnamed images as \[IMG\]]:enable:(0 1)' \
+ '-html-image-names[display filename of an image]:enable:(0 1)' \
+ '-html-display-images[display images in graphics mode]:enable:(0 1)' \
+ '-html-image-scale[sScale images in graphics mode]:scaling (percent)' \
+ '-html-bare-image-autoscale[autoscale images displayed on full screen]:enable:(0 1)' \
+ '-html-numbered-links[number links in text mode allowing quick selection]:enable:(0 1)' \
+ '-html-table-order[set ordering to walk tables]:ordering:((0\:rows 1\:columns))' \
+ '-html-auto-refresh[process refresh or display link]:refresh:(1 0)' \
+ '-html-target-in-new-window[allow opening new windows from html]' \
+ '-html-margin[specify margin]:margin (spaces)' \
+ '-html-user-font-size[specify font size in graphics mode]:size' \
+ '-html-t-text-color[specify text color in text mode]:color (0..15)' \
+ '-html-t-link-color[specify link color in text mode]:color (0..15)' \
+ '-html-t-background-color[specify background color in text mode]:color (0..15)' \
+ '-html-t-ignore-document-color[ignore colors from HTML in text mode]:ignore:(0 1)' \
+ '-html-g-text-color[specify text color in graphics mode]:color (0xRRGGBB)' \
+ '-html-g-link-color[specify link color in graphics mode]:color (0xRRGGBB)' \
+ '-html-g-background-color[specify background color in graphics mode]:color (0xRRGGBB)' \
+ '-html-g-ignore-document-color[ignore colors from HTML in graphics mode]:ignore:(0 1)' \
':URL:->html' && ret=0
case $state in
@@ -33,9 +124,15 @@ case $state in
;;
graphics_drivers)
local -a vals
- vals=( ${=${${${(f)"$(_call_program links-graphics-drivers links -driver help 2>&1)"}[-1]}//','/''}} )
+ vals=( ${=${${${(f)"$(_call_program links-graphics-drivers $words[1] -driver help 2>&1)"}[-1]}//','/''}} )
_describe -t links-graphics-drivers 'graphics driver' vals && ret=0
;;
+ sproxies)
+ if ! compset -P '*@'; then
+ _message -e users 'user id'
+ return
+ fi
+ ;&
proxies)
local suf=-S:
if compset -P '*:'; then
diff --git a/Completion/Unix/Command/_lp b/Completion/Unix/Command/_lp
index 63fbab78a..8c7ba7a8a 100644
--- a/Completion/Unix/Command/_lp
+++ b/Completion/Unix/Command/_lp
@@ -30,7 +30,7 @@ _lp_job_options()
lopts_with_args=( media orientation-requested sides number-up scaling cpi lpi
page-{bottom,left,right,top} page-ranges )
- lopts_no_args=(fitplot landscape)
+ lopts_no_args=(fitplot fit-to-page landscape)
if [[ $service == 'lpadmin' ]]; then
# Extra options from lpadmin man page.
diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls
index ea96de6ff..cedea1de9 100644
--- a/Completion/Unix/Command/_ls
+++ b/Completion/Unix/Command/_ls
@@ -37,7 +37,7 @@ if ! _pick_variant gnu=gnu unix --help; then
'(-B -b -w -q)-q[hide control chars]'
- '*:files:_files'
+ '*: :_files'
)
if [[ "$OSTYPE" = (netbsd*|dragonfly*|freebsd*|openbsd*|darwin*) ]]; then
arguments+=(
diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks
index 363cedc8d..30bda1a9a 100644
--- a/Completion/Unix/Command/_luarocks
+++ b/Completion/Unix/Command/_luarocks
@@ -9,6 +9,7 @@ __luarocks_command(){
doc:'show documentation for an installed rock'
download:'download a specific rock file from a rocks server'
help:'help on commands'
+ init:'initialize a directory for a Lua project using LuaRocks'
install:'install a rock'
lint:'check syntax of a rockspec'
list:'list currently installed rocks'
@@ -20,13 +21,27 @@ __luarocks_command(){
remove:'uninstall a rock'
search:'query the LuaRocks servers'
show:'show information about an installed rock'
+ test:'run the test suite in the current directory'
unpack:'unpack the contents of a rock'
upload:'upload a rockspec to the public rocks repository'
+ which:'indicate which file corresponds to a given module name'
write_rockspec:'write a template for a rockspec file'
)
_describe -t commands 'command' commands "$@"
}
+
local option_deps_modes='--deps-mode=[specify how to handle dependencies]:mode:__luarocks_deps_modes'
+
+local rockspec_options=(
+ '--license=[specify a license string]:license (e.g. "MIT/X11" or "GNU GPL v3")'
+ '--summary=[a short one-line description summary]:summary:{_message -e "short summary of the rock"}'
+ '--detailed=[a longer description string]:detailed_text:{_message -e "detailed description of the rock"}'
+ '--homepage=[project homepage]:URL:_urls'
+ '--lua-versions=[specify supported Lua versions]:lua version:_sequence compadd - 5.{1,2,3,4}'
+ '--rockspec-format=[rockspec format version, such as "1.0" or "1.1"]:VER: '
+ '--lib=[comma separated list of C library files to link to]:library files'
+)
+
(( $+functions[__luarocks_deps_modes] )) ||
__luarocks_deps_modes(){
local modes=(
@@ -78,10 +93,7 @@ __luarocks_rock_version(){
i=$(( i + 1 ))
done
}
-(( $+functions[__luarocks_lua_versions] )) ||
-__luarocks_lua_versions(){
- _values -s , 5.3 5.2 5.1
-}
+
(( $+functions[___luarocks_manually_store_cache_configs_paths] )) ||
___luarocks_manually_store_cache_configs_paths(){
user_config_path="$(_call_program user_config_path luarocks config --user-config)"
@@ -397,6 +409,15 @@ _luarocks_download(){
_luarocks_help(){
_arguments '1: :__luarocks_command'
}
+
+(( $+functions[_luarocks_init] )) ||
+_luarocks_init(){
+ _arguments $rockspec_options \
+ '--reset[regenerate files if they already exist]' \
+ '1: :_guard "^-*" "name"'\
+ '2: :_guard "^-*" "version"'
+}
+
# arguments:
# - must: .rockspec file / external rock
# - optional: version
@@ -453,11 +474,11 @@ _luarocks_pack(){
# arguments:
# NOTE: receives only options
local path_command_options=(
- '--bin[adds the system path to the output]'
- '--append[appends the paths to the existing paths]'
- '--lr-path[exports the Lua path (not formatted as shell command)]'
- '--lr-cpath[exports the Lua cpath (not formatted as shell command)]'
- '--lr-bin[exports the system path (not formatted as shell command)]'
+ "--no-bin[don't export the PATH variable]"
+ '--append[append the paths to the existing paths]'
+ '--lr-path[export the Lua path (not formatted as shell command)]'
+ '--lr-cpath[export the Lua cpath (not formatted as shell command)]'
+ '--lr-bin[export the system path (not formatted as shell command)]'
)
(( $+functions[_luarocks_path] )) ||
_luarocks_path(){
@@ -495,13 +516,14 @@ _luarocks_remove(){
local search_command_options=(
'--source[return only rockspecs and source rocks]'
'--binary[return only pure Lua and binary rocks (rocks that can be used with the "install" command without requiring a C toolchain)]'
- '--all[list all contents of the server that are suitable to this platform, do not filter by name]'
+ "--all[list all contents of the server that are suitable for this platform, don't filter by name]"
+ '--porcelain[produce machine readable output]'
)
(( $+functions[_luarocks_search] )) ||
_luarocks_search(){
_arguments \
"${search_command_options[@]}" \
- '*:SEARCH QUERY:'
+ '*: :_guard "^--*" "search query"'
}
# arguments:
# - must: installed rock
@@ -509,6 +531,8 @@ local show_command_options=(
'--home[home page of project]'
'--modules[all modules provided by this package as used by require()]'
'--deps[packages this package depends on]'
+ '--build-deps[show build-only dependencies for package]'
+ '--test-deps[show dependencies for testing package]'
'--rockspec[the full path of the rockspec file]'
'--mversion[the package version]'
'--rock-tree[local tree where rock is installed]'
@@ -520,6 +544,16 @@ _luarocks_show(){
"${show_command_options[@]}" \
"1: :{__luarocks_rock 'installed' "${opt_args[--tree]}"}"
}
+
+(( $+functions[_luarocks_test] )) ||
+_luarocks_test(){
+ _arguments $option_deps_modes \
+ '--test-type=[specify the test suite type manually]:test suite type' \
+ '--reset[regenerate files if they already exist]' \
+ '1:rockspec:__luarocks_rock' \
+ '*:arg'
+}
+
# arguments:
# - must: rockpack file / external rock
# - optional: version (only when chossing external rock)
@@ -535,8 +569,9 @@ _luarocks_unpack(){
# arguments:
# - must: rockspec file
local upload_command_options=(
- '--skip-pack[do not pack and send source rock]'
- '--api-key=[give it an API key]:KEY:{_message "api key"}'
+ "--skip-pack[don't pack and send source rock]"
+ '(--temp-key)--api-key=[use and save specified API key]:api key'
+ '(--api-key)--temp-key=[use specified temporary API key in this invocation only]:api key'
'--force[replace existing rockspec if the same revision of a module already exists]'
)
(( $+functions[_luarocks_upload] )) ||
@@ -545,26 +580,18 @@ _luarocks_upload(){
"${upload_command_options[@]}" \
'1: :{__luarocks_rock "rockspec"}'
}
-# arguments:
-# - optional: name
-# - optional: version
-# - optional: URL / PATH
-# receives as an argument a name and a version with optionally a URL/PATH
-local write_rockspec_command_options=(
- '--output=[write the rockspec with the given filename]:FILE:_files'
- '--license=[specify a license string]:license (e.g. "MIT/X11" or "GNU GPL v3")'
- '--summary=[a short one-line description summary]:summary:{_message -e "short summary of the rock"}'
- '--detailed=[a longer description string]:detailed_text:{_message -e "detailed description of the rock"}'
- '--homepage=[project homepage]:URL:_urls'
- '--lua-version=[supported Lua versions]:LUA_VER:__luarocks_lua_versions'
- '--rockspec-format=[rockspec format version, such as "1.0" or "1.1"]:VER: '
- '--tag=[tag to use. Will attempt to extract version number from it]:tag:__git_tag'
- '--lib=[comma separated list of C library files to link to]:library files'
-)
+
+(( $+functions[_luarocks_which] )) ||
+_luarocks_which(){
+ _message -e modules 'module name'
+}
+
(( $+functions[_luarocks_write_rockspec] )) ||
_luarocks_write_rockspec(){
_arguments -A "-*" \
- "${write_rockspec_command_options[@]}" \
+ "${rockspec_options[@]}" \
+ '--output=[write the rockspec with the given file]:file:_files' \
+ '--tag=[specify tag to use. Will attempt to extract version number from it]:tag:__git_tag' \
'1:: :{_message "new rock name"}' \
'2:: :{__luarocks_rock_version "new_rock"}' \
'3:: :_urls'
@@ -572,13 +599,15 @@ _luarocks_write_rockspec(){
# The real thing
_arguments -C \
- '(--server --only-server)--server=[fetch rocks/rockspecs from this server]:HOST:_hosts' \
- '(--server --only-server)--only-server=[fetch rocks/rockspecs from this server only]:HOST:_hosts' \
+ '--dev[enable the sub-repositories in rocks servers]' \
+ '(--server --only-server)--server=[fetch rocks/rockspecs from specified server]:host:_hosts' \
+ '(--server --only-server)--only-server=[fetch rocks/rockspecs from specified server only]:host:_hosts' \
'--only-sources=[restrict downloads to paths matching the given URL]:URL:_urls' \
- '--tree=[which tree to operate on]:TREE:{_files -/}' \
+ '--lua-dir=[specify location of lua installation]:path:_directories' \
+ '--tree=[specify which tree to operate on]:tree:_directories' \
'--local[use the tree in the user'"'"'s home directory]' \
'--verbose[display verbose output of commands executed]' \
- '--timeout=[timeout on network operations]:SECONDS:{_message "timeout (seconds)"}' \
+ '--timeout=[specify timeout for network operations]:timeout (seconds)' \
'1: :__luarocks_command' \
'*::arg:->args'
diff --git a/Completion/Unix/Command/_mkdir b/Completion/Unix/Command/_mkdir
index 53536b01d..e4308c304 100644
--- a/Completion/Unix/Command/_mkdir
+++ b/Completion/Unix/Command/_mkdir
@@ -26,7 +26,7 @@ fi
# Now $variant is set.
case $variant in
- gnu|freebsd*|dragonfly*)
+ gnu|freebsd*|dragonfly*|darwin*)
args+=(
'(-v --verbose)'{-v,--verbose}'[print message for each created directory]'
)
@@ -42,8 +42,6 @@ case $variant in
'(- :)--version[display version information]'
)
;;
- zsh) # remove all options
- ;;
*) # non-GNU: remove long options
args=( ${${${args:#(|*\))--*}//--[^ )]#/}/\( #\)/} )
;;
diff --git a/Completion/Unix/Command/_mkfifo b/Completion/Unix/Command/_mkfifo
new file mode 100644
index 000000000..4f1d8c87e
--- /dev/null
+++ b/Completion/Unix/Command/_mkfifo
@@ -0,0 +1,20 @@
+#compdef mkfifo gmkfifo
+
+local -a aopts args
+
+if _pick_variant gnu='Free Soft' unix --version; then
+ args=(
+ '(: * -)--help[display help information]'
+ '(: * -)--version[display version information]'
+ '(-m --mode)'{-m+,--mode=}'[specify file mode]: :_file_modes'
+ )
+ [[ $OSTYPE == linux* ]] && args+=(
+ '(--context)-Z[set SELinux security context to default]'
+ '(-Z)--context=-[like -Z, or specify SELinux security context]:SELinux security context'
+ )
+else
+ aopts=( -A '-*' )
+ args=( '-m+[specify file mode]: :_file_modes' )
+fi
+
+_arguments -s -S $aopts : '*:FIFO:_files' $args
diff --git a/Completion/Unix/Command/_mknod b/Completion/Unix/Command/_mknod
new file mode 100644
index 000000000..902f49b9f
--- /dev/null
+++ b/Completion/Unix/Command/_mknod
@@ -0,0 +1,45 @@
+#compdef mknod gmknod
+
+# - @todo Major/minor device numbers could be completed using /proc/devices on
+# Linux and e.g. `stat -f %Hr /dev/*` on BSD/Darwin
+# - @todo Device numbers should not be completed given p or w types
+
+local -a aopts args
+
+if _pick_variant gnu='Free Soft' $OSTYPE --version; then
+ args=(
+ '(: * -)--help[display help information]'
+ '(: * -)--version[display version information]'
+ '(-m --mode)'{-m+,--mode=}'[specify file mode]: :_file_modes'
+ '1:special file:_files'
+ '2:special file type:((
+ b\:"block (buffered) special file"
+ {c,u}\:"character (unbuffered) special file"
+ p\:FIFO
+ ))'
+ '3:major device number'
+ '4:minor device number'
+ )
+ [[ $OSTYPE == linux* ]] && args+=(
+ '(--context)-Z[set SELinux security context to default]'
+ '(-Z)--context=-[like -Z, or specify SELinux security context]:SELinux security context'
+ )
+else
+ aopts=( -A '-*' )
+ args=(
+ '-F+[specify device-number format]:device-number format:(
+ native 386bsd 4bsd bsdos freebsd hpux isc linux netbsd osf1 sco solaris
+ sunos svr3 svr4 ultrix
+ )'
+ '1:special file:_files'
+ '2:special file type:((
+ b\:"block-type device"
+ c\:"character-type device"
+ w\:"whiteout node"
+ ))'
+ '3:major device number'
+ '4:minor device number'
+ )
+fi
+
+_arguments -s -S $aopts : $args
diff --git a/Completion/Unix/Command/_mktemp b/Completion/Unix/Command/_mktemp
index 4b5bf99f7..03fc89e36 100644
--- a/Completion/Unix/Command/_mktemp
+++ b/Completion/Unix/Command/_mktemp
@@ -30,9 +30,9 @@ fi
args=( ${args:#((#s)|*\))(\*|)-t*} )
args+=( '-t[generate template relative to temp dir]' )
# Dragonfly, FreeBSD, and Darwin take an argument to -t and support any number
- # of template files
+ # of template files. These OSes do not have -p and -V.
else
- args=( ${args:#((#s)|*\))(1:*|(\*|)-t*)} )
+ args=( ${args:#((#s)|*\))(1:*|(\*|)-[ptV]*)} )
args+=(
'-t[generate template relative to temp dir using specified prefix]:template prefix'
'*: :_guard "^-*" "template name"'
diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc
index 4f200c69e..0f292ab4c 100644
--- a/Completion/Unix/Command/_mpc
+++ b/Completion/Unix/Command/_mpc
@@ -55,6 +55,7 @@ _mpc_command() {
playlist:"print the current playlist"
prev:"play the previous song in the current playlist"
prio:"change song priorities in the queue"
+ queued:"show the next queued song"
random:"toggle random mode, or specify state"
repeat:"toggle repeat mode, or specify state"
single:"toggle single mode, or specify state"
@@ -69,6 +70,7 @@ _mpc_command() {
findadd:"find songs and add them to the current playlist"
list:"list all tags of given type"
seek:"seek to the position specified in percent"
+ seekthrough:"seek by an amount of time within the song and playlist"
shuffle:"shuffle the current playlist"
stats:"display statistics about MPD"
stop:"stop the currently playing playlists"
@@ -82,6 +84,8 @@ _mpc_command() {
waitmessage:"wait for at least one message on the specified channel"
subscribe:"subscribe to the specified channel and continuously receive messages"
sticker:"sticker management"
+ mount:"list mounts or add a new mount"
+ unmount:"remove a mount"
)
if (( CURRENT == 1 )); then
@@ -209,7 +213,11 @@ _mpc_play() {
}
_mpc_seek() {
- _message "floating point percent value"
+ _message -e position 'position ([+-][HH:MM:SS]|<0-100>%%)'
+}
+
+_mpc_seekthrough() {
+ _message -e position 'position ([+-][HH:MM:SS])'
}
_mpc_enable() {
@@ -349,6 +357,7 @@ _arguments -C \
'(-p --port)'{-p,--port=}'[connect to server port]:port' \
'(-f --format)'{-f,--format=}'[specify the format of song display]:format string:->formats' \
'(-w --wait)'{-w,--wait}'[wait for operation to finish (e.g. database update)]' \
+ '(-r --range)'{-r,--range=}'[operate on a range (e.g. when loading a playlist)]:<start>\:<end>' \
'*::mpc command:_mpc_command' && ret=0
if [[ $state = formats ]]; then
diff --git a/Completion/Unix/Command/_npm b/Completion/Unix/Command/_npm
index f5493a321..c05f61c51 100644
--- a/Completion/Unix/Command/_npm
+++ b/Completion/Unix/Command/_npm
@@ -2,8 +2,13 @@
# Node Package Manager completion, letting npm do all the completion work
-if type npm > /dev/null; then
- eval "$(npm completion)"
+if (( $+commands[npm] )); then
+ eval "$(NPM_CONFIG_UPDATE_NOTIFIER=false npm completion)"
+ # Monkey-patch their function to prevent update checks
+ functions[_npm_completion]="
+ local -x NPM_CONFIG_UPDATE_NOTIFIER=false;
+ ${functions[_npm_completion]}
+ "
_npm_completion "$@"
fi
diff --git a/Completion/Unix/Command/_od b/Completion/Unix/Command/_od
index aba400660..046018131 100644
--- a/Completion/Unix/Command/_od
+++ b/Completion/Unix/Command/_od
@@ -61,7 +61,7 @@ else
esac
fi
-_arguments -C -s -S : "$args[@]" '*:files:_files' && return 0
+_arguments -C -s -S : "$args[@]" '*: :_files' && return 0
case "$state" in
(format)
diff --git a/Completion/Unix/Command/_pax b/Completion/Unix/Command/_pax
index 7ebaa6aa5..0ae58423c 100644
--- a/Completion/Unix/Command/_pax
+++ b/Completion/Unix/Command/_pax
@@ -44,4 +44,4 @@ _arguments -s \
'-X[do not descend into directories that have a different device ID]' \
'-Y[ignore older files by ctime after file name mods]' \
'-Z[ignore older files after file name mods]' \
- '*:files:_files'
+ '*: :_files'
diff --git a/Completion/Unix/Command/_ping b/Completion/Unix/Command/_ping
index 2efe545c6..78fd33d92 100644
--- a/Completion/Unix/Command/_ping
+++ b/Completion/Unix/Command/_ping
@@ -37,7 +37,7 @@ case ${variant}:${${service#ping}:-4} in
iputils:*|((free|net)bsd|darwin|dragonfly)*:4)
args+=( '-a[audible bell for each packet]' )
;|
- iputils:*|(net|open)bsd*:4)
+ iputils:*|netbsd*:4|openbsd*)
args+=( '-w+[specify timeout after which ping exits]:deadline (seconds)' )
;|
iputils:*|openbsd*:4|solaris*)
@@ -58,10 +58,7 @@ case ${variant}:${${service#ping}:-4} in
args+=( "-D[set the don't fragment bit]" )
;|
((free|net)bsd|darwin|dragonfly)*:4)
- args+=(
- '-Q[somewhat quiet]'
- '-T+[set IP Time to Live for outgoing packets]:ttl'
- )
+ args+=( '-Q[somewhat quiet]')
;|
freebsd*:6|darwin*:6|solaris*|netbsd*)
args+=(
@@ -84,7 +81,7 @@ case ${variant}:${${service#ping}:-4} in
(*bsd|darwin)*:6)
args+=( '*-m[suppress fragmenting of packets into the minimum IPv6 MTU]' )
;|
- freebsd*|darwin*|dragonfly*|netbsd*:6)
+ freebsd*|darwin*|netbsd*:6)
args+=( '-P+[specify IPsec policy to be used for the probe]:policy' )
;|
solaris2.<11->)
@@ -101,17 +98,19 @@ case ${variant}:${${service#ping}:-4} in
'-h+[specify size increment for ICMP payload for sweeping pings]:size [1]'
'-M+[use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO]:ICMP:(mask time)'
'-m+[set IP Time to Live for outgoing packets]:ttl'
+ '-T+[set IP Time to Live for multicasted packets]:ttl'
'-t+[specify timeout after which ping exits]:deadline (seconds)'
'-W+[specify time to wait for a response]:wait time (ms)'
'-z+[specify type of service]:type of service'
)
- ;;
+ ;|
(freebsd|darwin)*:6)
args+=(
+ '-D[disable IPv6 fragmentation]'
'-R[audible bell for no packet]'
'-r[audible bell for each packet]'
)
- ;;
+ ;|
freebsd*:6)
args+=(
'-x+[specify time to wait for a response]:wait time (ms)'
@@ -124,24 +123,30 @@ case ${variant}:${${service#ping}:-4} in
'-E+[specify IPsec policy to be used for the probe]:policy'
'-h+[specify target host]:host:_hosts'
'-P+[use a pseudo-random sequence for the data]'
+ '-T+[set IP Time to Live for outgoing packets]:ttl'
'-t+[specify type of service]:type of service'
)
;;
(dragonfly|netbsd)*:6)
args+=( '-R[inject reachability confirmation hint for target host/first hop]' )
- ;|
+ ;;
darwin*:4)
- args+=( '-b+[bind the socket to specified interface for sending]:interface:_net_interfaces' )
+ args+=( '-b+[bind the socket to specified interface for sending]:interface:_net_interfaces')
;|
darwin*:6)
args+=(
'-B+[bind the socket to specified interface for sending]:interface:_net_interfaces'
- '-C[prohibit socket from using cellular network interface]'
+ '-G+[specify max,min,increment size for ICMP payload for sweeping pings]:max,min,incr (defalt min=0 incr=1)'
+ '-z+[specify traffic class]:traffic class'
)
;|
darwin*)
args+=(
+ '-C[prohibit socket from using cellular network interface]'
+ '-K+[specify network service type for sending ICMP packets]:serviece type:(BK_SYS BK BE RV AV RD OAM VI SIG VO)'
'-k+[specify traffic class to use for sending ICMP packets]:traffic class [CTL]:(BK_SYS BK BE RD OAM AV RV VI VO CTL)'
+ '--apple-connect[connects the socket to the destination address]'
+ '--apple-time[prints the time a packet was received]'
)
;;
openbsd*:4)
diff --git a/Completion/Unix/Command/_rar b/Completion/Unix/Command/_rar
index 906e236fd..68982be60 100644
--- a/Completion/Unix/Command/_rar
+++ b/Completion/Unix/Command/_rar
@@ -58,7 +58,7 @@ case $service in
'-n+:file to include:_files' \
'-n@+:file of files to include:_files' \
"$common[@]" \
- '*:RAR files:_files -g \*.rar\(-.\)'
+ '*:RAR file:_files -g \*.rar\(-.\)'
fi
;;
rar)
@@ -126,7 +126,7 @@ case $service in
'-w+[assign work directory]:work directory:_files -/' \
"$common[@]" \
'-z+[read archive comment from file]:comment file:_files' \
- '*:files:_files'
+ '*: :_files'
fi
;;
esac
diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm
index 912b5eadf..aa24a3fd6 100644
--- a/Completion/Unix/Command/_rm
+++ b/Completion/Unix/Command/_rm
@@ -5,7 +5,7 @@ args=(
'(-f --force)'{-f,--force}'[ignore nonexistent files, never prompt]'
'(-I --interactive)-i[prompt before every removal]'
'(-r -R --recursive)'{-r,-R,--recursive}'[remove directories and their contents recursively]'
- '*::files:->file'
+ '*:: :->file'
)
if _pick_variant gnu=gnu unix --help; then
opts+=(-S)
diff --git a/Completion/Unix/Command/_samba b/Completion/Unix/Command/_samba
index 9a2fea9d6..775543794 100644
--- a/Completion/Unix/Command/_samba
+++ b/Completion/Unix/Command/_samba
@@ -55,6 +55,7 @@ case $service in
'(-t --timeout)'{-t+,--timeout=}'[change the per-operation timeout]:timeout (seconds)'
'(2 -p --port)'{-p+,--port=}'[specify tcp port]:tcp port'
'(-g --grepable)'{-g,--grepable}'[produce grepable output]'
+ '(-q --quiet)'{-q,--quiet}'[suppress help message]'
'(-B --browse)'{-B,--browse}'[browse SMB servers using DNS]'
'(2 -d --debuglevel)'{-d+,--debuglevel=}'[specify debug level]:debug level:(0 1 2 3 4 5 6 7 8 9 10)'
'(2 -O --socket-options)'{-O+,--socket-options=}'[specify socket options]:socket options'
diff --git a/Completion/Unix/Command/_script b/Completion/Unix/Command/_script
index dfe57a796..436c9661b 100644
--- a/Completion/Unix/Command/_script
+++ b/Completion/Unix/Command/_script
@@ -24,6 +24,7 @@ case $OSTYPE in
"(-e --return $hlp)"{-e,--return}'[return exit status of the child process]'
"(-f --flush $hlp)"{-f,--flush}'[flush output after each write]'
"($hlp)--force[use output file even when it is a link]"
+ '(-o --output-limit)'{-o+,--output-limit=}'[terminate if output files exceed specified size]:size (bytes)'
"(-q --quiet $hlp)"{-q,--quiet}'[be quiet]'
"(-t --timing $hlp)"{-t-,--timing=-}'[output timing data]::timing file:_files'
'(- 1)'{-h,--help}'[display help information]'
@@ -35,7 +36,7 @@ case $OSTYPE in
'-q[be quiet: suppress display of starting and ending lines]'
)
;|
- netbsd*|freebsd*)
+ darwin*|netbsd*|freebsd*)
args+=(
'(-a -r -k)-d[suppress sleeps when playing back a session]'
'(-a -r -k -t)-p[play back a recorded session]'
@@ -62,6 +63,9 @@ case $OSTYPE in
'*:::arguments: _normal'
)
;|
+ darwin*|freebsd*)
+ args+=( '-F[send output to specified named pipe]:fifo:_files -g "*(p)"' )
+ ;|
*)
args+=(
'(-p -d)-a[append output]'
diff --git a/Completion/Unix/Command/_shred b/Completion/Unix/Command/_shred
new file mode 100644
index 000000000..ce583bee4
--- /dev/null
+++ b/Completion/Unix/Command/_shred
@@ -0,0 +1,19 @@
+#compdef shred gshred
+
+_arguments -s -S : \
+ '(: * -)--help[display help information]' \
+ '(: * -)--version[display version information]' \
+ '(-f --force)'{-f,--force}'[bypass lack of write permissions]' \
+ '(-n --iterations)'{-n+,--iterations=}'[specify number of overwrites]:overwrites [3]' \
+ '--random-source=[get random bytes from specified file]:random source file:_files' \
+ '(-s --size)'{-s+,--size=}'[shred specified number of bytes]:bytes' \
+ '(--remove)-u[deallocate and remove file after overwriting]' \
+ '(-u)--remove=-[like -u, or specify how to remove]::how to remove [wipesync]:((
+ unlink\:"use standard unlink call"
+ wipe\:"like unlink, but obfuscate bytes in name first"
+ wipesync\:"like wipe, but sync each obfuscated byte to disk"
+ ))' \
+ '(-v --verbose)'{-v,--verbose}'[display progress]' \
+ '(-x --exact)'{-x,--exact}'[do not round file sizes up to nearest block]' \
+ '(-z --zero)'{-z,--zero}'[add final overwrite with zeros]' \
+ '*: :_files'
diff --git a/Completion/Unix/Command/_sort b/Completion/Unix/Command/_sort
index dfd43ce55..a463cf4c0 100644
--- a/Completion/Unix/Command/_sort
+++ b/Completion/Unix/Command/_sort
@@ -16,27 +16,27 @@ args=(
'(-r --reverse)'{-r,--reverse}'[reverse the result of comparisons]'
'(-b --ignore-leading-blanks)'{-b,--ignore-leading-blanks}'[ignore leading blanks]'
'(-t --field-separator)'{-t+,--field-separator=}'[specify field separator instead of non-blank to blank transition]:separator'
- '(-k --key)'{-k+,--key=}'[specified start and end fields for key]:key field'
+ \*{-k+,--key=}'[specified start and end fields for key]:key field'
)
_pick_variant -r variant gnu=GNU $OSTYPE --version
case $variant in
- dragonfly*|netbsd*|openbsd*|freebsd*|gnu)
+ dragonfly*|netbsd*|openbsd*|freebsd*|darwin*|gnu)
args+=(
'(-s --stable)'{-s,--stable}'[preserve original order of lines with the same key]'
)
;|
- netbsd*|openbsd*|freebsd*|gnu|solaris2.<11->)
+ netbsd*|openbsd*|freebsd*|darwin*|gnu|solaris2.<11->)
args+=(
"(-c --check -C)-C[check whether input is sorted silently; don't sort]"
)
;|
- openbsd*|freebsd*|gnu)
+ openbsd*|freebsd*|darwin*|gnu)
args+=(
'(-z --zero-terminated)'{-z,--zero-terminated}'[end lines with 0 byte, not newline]'
)
;|
- freebsd*|gnu)
+ freebsd*|darwin*|gnu)
args+=(
"(-c --check -C)--check=-[check whether input is sorted; don't sort]::bad line handling:(diagnose-first silent quiet)"
"$ordering"{-g,--general-numeric-sort}'[compare according to general numeric value]'
@@ -49,7 +49,7 @@ case $variant in
'--random-source=[get random bytes from file]:file:_files'
'--batch-size=[maximum inputs to merge]:number'
'--compress-program=[specify program to compress temporary files with]:program:(gzip bzip2 lzop xz)'
- '--debug[annotate the of the line used to sort]'
+ '--debug[annotate the part of the line used to sort]'
'(*)--files0-from=[read input files from file]:file:_files'
'(-S --buffer-size)'{-S+,--buffer-size=}'[specify size for main memory buffer]:size'
'(- *)--help[display help and exit]'
@@ -71,7 +71,7 @@ case $variant in
gnu)
args+=( '--parallel=[set number of sorts run concurrently]:number' )
;;
- freebsd*)
+ freebsd*|darwin*)
args+=( --radixsort --mergesort --qsort --heapsort --mmap )
;;
*) args=( "${(@)args:#(|\(*\))(|\*)--*}" ) ;;
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 9c827d655..d1bd8f04b 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -56,7 +56,7 @@ _ssh () {
'(-v)*-q[quiet operation]' \
'*-R+[specify remote port forwarding]:remote port forwarding:->forward' \
'-S+[specify location of control socket for connection sharing]:path to control socket:_files' \
- '-Q+[query parameters]:parameter type:((cipher\:"supported symmetric ciphers" cipher-auth\:"supported symmetric ciphers that support authenticated encryption" mac\:"supported message integrity codes" kex\:"key exchange algorithms" key\:"key types" protocol-version\:"supported SSH protocol versions"))' \
+ '-Q+[query parameters]:query option:((cipher\:"supported symmetric ciphers" cipher-auth\:"supported symmetric ciphers that support authenticated encryption" mac\:"supported message integrity codes" kex\:"key exchange algorithms" key\:"key types" key-cert\:"certificate key types" key-plain\:"non-certificate key types" protocol-version\:"supported SSH protocol versions" sig\:"supported signature algorithms" help\:"show supported queries"))' \
'-s[invoke subsystem]' \
'(-t)-T[disable pseudo-tty allocation]' \
'(-T)-t[force pseudo-tty allocation]' \
@@ -452,6 +452,7 @@ _ssh () {
CanonicalizeHostname \
CanonicalizeMaxDots \
CanonicalizePermittedCNAMEs \
+ CASignatureAlgorithms \
CertificateFile \
ChallengeResponseAuthentication \
CheckHostIP \
diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip
index 630140c64..e7f3418d7 100644
--- a/Completion/Unix/Command/_strip
+++ b/Completion/Unix/Command/_strip
@@ -42,10 +42,39 @@ if _pick_variant gnu=GNU solaris --version; then
'(-)'{-V,--version}'[display version information and exit]'
'(-v --verbose)'{-v,--verbose}'[list all object files modified or members of archives]')
else
- args=(
- '-l[strip line information only]'
- '-V[display version information on stderr and exit]'
- '-x[do not strip the symbol table]')
+ case $OSTYPE in
+ solaris*)
+ args=(
+ '-l[strip line information only]'
+ '-V[display version information on stderr and exit]'
+ '-x[do not strip the symbol table]')
+ ;;
+ darwin*)
+ local -a arch
+ arch=( ${(z)${${"$(_call_program architectures
+ strings -arch - 2>&1)"}#*flags are: }%%$'\n'*} all )
+ args=(
+ '-u[save all undefined symbols]'
+ '-r[save all symbols referenced dynamically]'
+ '-s[save global symbols listed in the specified file]:file:_files'
+ '-R[remove global symbols listed in the specified file]:file:_files'
+ '-i[ignore symbols listed in -s/-R file but are not in the object files]'
+ '-d[save debug symbols in files listed in the specified file]:file:_file'
+ '-A[save all global absolute symbols and Objective-C class symbols]'
+ '-n[save all N_SECT global symbols]'
+ '-S[remove debug symbols]'
+ '-X[remove local symbols whose names begin with L]'
+ '-T[remove Swift symbols]'
+ '-N[remove all nlist symbols and string tables from binaries used by dyld]'
+ '-x[remove all local symbols]'
+ '-c[remove section contents of dynamic library to create stub library]'
+ '-o[write the result to specified file]:output file:_files'
+ '-no_uuid[remove only LC_UUID load command]'
+ '-no_split_info[remove LC_SEGMENT_SPLIT_INFO load command]'
+ '-no_code_signature_warning[not warn when code signature would be invalid in the output]'
+ '-arch[specify the architecture]:architecture:( $arch )' )
+ ;;
+ esac
fi
_arguments \
diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index d30f2e657..a066b0728 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -34,7 +34,7 @@ _svn () {
typeset -gHA _svn_cmds
if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then
_svn_cmds=(
- ${=${(f)${${"$(_call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z-]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
+ ${=${(f)${${"$(_call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z-]##)[[:space:]]#(\([a-z, ?-]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:}
)
if (( $? == 0 )); then
_store_cache svn-cmds _svn_cmds
diff --git a/Completion/Unix/Command/_sysctl b/Completion/Unix/Command/_sysctl
index c5bb26eb0..2bdcc71f5 100644
--- a/Completion/Unix/Command/_sysctl
+++ b/Completion/Unix/Command/_sysctl
@@ -1,20 +1,50 @@
#compdef sysctl
-local -a args
+local -a args sysctlvars
case $OSTYPE in
+ linux*)
+ args=(
+ {-e,--ignore}'[ignore errors about unknown keys]'
+ '(-n -N --names)'{-N,--names}'[show only variable names]'
+ '(-N -n --values)'{-n,--values}'[show only variable values]'
+ '(-)'{-w,--write}'[write mode]'
+ '(-A -a -w --system *)'{-p,--load=}'[specify file to load sysctl settings from]:file (can be regexp):_files'
+ {-q,--quiet}'[do not display names and values when setting variables]'
+ '(-e --ignore -w --write -A -a --all *)'{-A,-a,--all}'[display all variables]'
+ )
+ if _pick_variant ng=procps-ng procps --version; then
+ args+=(
+ '--deprecated[include deprecated parameters in --all listing]'
+ {-b,--binary}'[print value without new line]'
+ '(-p --load)--system[load settings from all system config files]'
+ {-r+,--pattern=}'[only apply to variables matching specified pattern]:extended regexp'
+ )
+ else
+ args=( ${args:#((#s)|*\))(\*|)--*} ) # remove long options
+ fi
+ _arguments -S -A "-*" : $args \
+ '(- :)'{-h,--help}'[display help text and exit]' \
+ '(- :)'{-V,--version}'[display version info and exit]' \
+ '*:sysctl variable:_files -W /proc/sys'
+ ;;
+ freebsd<11->.*)
+ args+=(
+ '-B[specify buffer size for reading]:buffer size'
+ '-t[display type of variable]'
+ )
+ ;|
freebsd<10->.*)
args+=(
'-f+[specify file of name/value pairs to process first]:file:_files'
- '-T[display only variables that are setable via loader]'
+ '-T[display only variables that are settable via loader]'
'-W[display only writable variables that are not statistical]'
)
;|
- dragonfly*|freebsd*)
- args+=( "-i[silently exit if variable doesn't exist]" )
+ darwin*|freebsd*)
+ args+=( '-h[format output for human readability]' )
;|
- freebsd*)
- local -a sysctlvars
+ darwin*|dragonfly*|freebsd*)
sysctlvars=( $(_call_program sysctl-variables sysctl -aN) )
_arguments -s -S -A "-*" $args \
'(-a -o *)-A[equivalent to -o -a (for compatibility)]' \
@@ -22,43 +52,41 @@ case $OSTYPE in
'-b[binary output]' \
'-d[print the description of the variable instead of its value]' \
'(-N -n)-e[separate name and value with =]' \
- '-h[format output for human readability]' \
+ "-i[silently exit if variable doesn't exist]" \
'(-n)-N[show only variable names]' \
'(-N)-n[show only variable values]' \
'(-x)-o[show opaques as well (values suppressed)]' \
'-q[suppress some warnings]' \
'(* -o)-X[equivalent to -x -a (for compatibility)]' \
'(-o)-x[show opaques as well (entire values)]' \
- '(-a)*:sysctl variable:_multi_parts -i . sysctlvars'
- ;;
- darwin*|dragonfly*)
- : ${(A)_cache_sysctlvars:=${${$(sysctl -A 2>/dev/null):#[^a-z]*}%%:*}}
- _arguments -s -A "-*" $args \
- '(-w -X *)-a[list all]' \
- '(-w -X *)-A[show all opaques (values suppressed)]' \
- '(-w)-b[binary output]' \
- '(-w)-n[show only variable values]' \
- '(-a -A -b -n -X)-w[write mode]' \
- '(-a -A -w *)-X[show all opaques (entire values)]' \
- '(-a -A -X)*:sysctl variable:_multi_parts ${words[(r)-w]:+-S=} -i . _cache_sysctlvars'
- ;;
- linux*)
- _arguments -A "-*" \
- '-n[show only variable values]' \
- '(-n -p -a -A)-w[write mode]' \
- '(-n -w -a -A *)-p[specify file to load sysctl settings from]:file:_files' \
- '(-n -w -p -A *)-a[list all]' \
- '(-n -w -p -a *)-A[list all in table form]' \
- '(-n -p -a -A)*:sysctl variable:_files -W /proc/sys'
+ '*:sysctl variable:_multi_parts -i -S = -q . sysctlvars'
;;
openbsd*)
- : ${(A)_cache_sysctlvars:=${${${(f)"$(sysctl -a 2>/dev/null)"}%%=*}:# *}}
+ sysctlvars=( ${${${(f)"$(_call_program sysctl-variables
+ sysctl -a 2>/dev/null)"}%%=*}:# *} )
_arguments -S -s -A "-*" \
'(-A -q *)-a[list all string and integer variables]' \
'(-a -q *)-A[list all known variables]' \
'-n[show only values]' \
'(-a -A)-q[suppress all output when setting a variable]' \
- '(-a -A)*:sysctl variable:_multi_parts -i -S = -q . _cache_sysctlvars'
+ '*:sysctl variable:_multi_parts -i -S = -q . sysctlvars'
+ ;;
+ netbsd*)
+ sysctlvars=( ${${${(f)"$(_call_program sysctl-variables
+ sysctl -a 2>/dev/null)"}%% =*}%%:*} )
+ _arguments -S -s -A "-*" : \
+ '(-a -f -M -q -w)-A[list all known variables]' \
+ '(-A -f -M -q -w *)-a[list all string and integer variables]' \
+ '(-M -w -x)-d[print the description of the variable instead of its value]' \
+ '(-f -M -w)-e[separate name and value with =]' \
+ '(-a -A -w *)-f[read variable from specified file]:file:_files' \
+ '(-a -A -d -r -x -w)-M[print entire MIB instead of just value]' \
+ '-n[show only variable values]' \
+ '(-A -a -M)-q[silently ignore nonexistent variables]' \
+ '(-M -x)-r[binary output]' \
+ '(-a -A -d -e -f -M -r)-w[write mode]' \
+ '(-d -M -r)*-x[hex output. -xx for hexdupm-like output]' \
+ '*:sysctl variable:_multi_parts ${words[(r)-w]:+-S=} -i . sysctlvars'
;;
*)
_default
diff --git a/Completion/Unix/Command/_tail b/Completion/Unix/Command/_tail
index 599503ab5..3bfbe37ca 100644
--- a/Completion/Unix/Command/_tail
+++ b/Completion/Unix/Command/_tail
@@ -38,10 +38,13 @@ else
)
;|
(freebsd*|darwin*|dragonfly*|netbsd*)
- args+=( '(-f -r)-F[implies -f, but also detect file rename]' )
+ args+=(
+ '(-f -r)-F[implies -f, but also detect file rename]'
+ '(-v)-q[never output headers giving file names]'
+ )
;|
- (freebsd*|darwin*|dragonfly*)
- args+=( '-q[suppress the headers when displaying multiple files]' )
+ (netbsd*)
+ args+=( '(-q)-v[always output headers giving file names]' )
;;
esac
fi
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index ae3446a08..0e8fe2223 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -304,7 +304,7 @@ _tmux-display-message() {
_arguments -s -S \
'-c+[specify target client]:client:__tmux-clients' \
'-p[print message to stdout]' \
- '-t+[specify target client]:client:__tmux-clients' \
+ '-t+[specify target pane]:pane:__tmux-panes' \
'-F+[specify output format]:format:__tmux-formats' \
':message'
}
@@ -809,8 +809,9 @@ _tmux-set-window-option() {
_tmux-set-hook() {
[[ -n ${tmux_describe} ]] && print "set a hook to a command" && return
_arguments -s \
- '-g[add hook to global list]' \
- '-u[unset a hook]' \
+ '(-R)-g[add hook to global list]' \
+ '(-g -u)-R[run hook immediately]' \
+ '(-R)-u[unset a hook]' \
'-t+[specify target session]:session:__tmux-sessions' \
':hook name:_tmux_hooks' \
'*:::command:= _tmux'
diff --git a/Completion/Unix/Command/_toilet b/Completion/Unix/Command/_toilet
index 2c2b8682a..a8867769b 100644
--- a/Completion/Unix/Command/_toilet
+++ b/Completion/Unix/Command/_toilet
@@ -6,7 +6,7 @@ typeset -A opt_args
fontdir=$(_call_program path toilet -I2 2>/dev/null)
_arguments \
- '(-f --font)'{-f,--font}'[specify font]:font:_files -W ${~opt_args[-d]\:-$fontdir} -g \*tlf\*\(-.\:r\)' \
+ '(-f --font)'{-f,--font}'[specify font]:font:_files -W ${~opt_args[-d]\:-$fontdir} -g \*\[ft\]lf\*\(-.\:r\)' \
'(-d --directory)'{-d,--directory}'[specify font directory]:font directory:_files -/' \
'(-t --termwidth -w --width)'{-w,--width}'[set output width]:width:' \
'(-t --termwidth -w --width)'{-t,--termwidth}'[adapt to terminal width]' \
diff --git a/Completion/Unix/Command/_tty b/Completion/Unix/Command/_tty
new file mode 100644
index 000000000..838975098
--- /dev/null
+++ b/Completion/Unix/Command/_tty
@@ -0,0 +1,18 @@
+#compdef tty gtty
+
+local -a args
+
+if _pick_variant gnu='Free Soft' unix --version; then
+ args=(
+ '(-)--help[display help information]'
+ '(-)--version[display version information]'
+ '(-s --quiet --silent)'{-s,--quiet,--silent}'[suppress normal output]'
+ )
+else
+ args=( '-s[suppress normal output]' )
+ [[ $OSTYPE == solaris* ]] && args+=(
+ "-l[display terminal's synchronous line number]"
+ )
+fi
+
+_arguments -s -S : $args
diff --git a/Completion/Unix/Command/_visudo b/Completion/Unix/Command/_visudo
new file mode 100644
index 000000000..2cb6d85a5
--- /dev/null
+++ b/Completion/Unix/Command/_visudo
@@ -0,0 +1,12 @@
+#compdef visudo
+
+_arguments -s -S : \
+ '(: * -)'{-h,--help}'[display help information]' \
+ '(: * -)'{-V,--version}'[display version information]' \
+ '(-f --file)'{-f+,--file=}'[specify sudoers file]:sudoers file:_files' \
+ + c \
+ '(x -c --check)'{-c,--check}'[check sudoers file for errors only]' \
+ '(-q --quiet)'{-q,--quiet}'[suppress error messages (with -c)]' \
+ '(x -s --strict)'{-s,--strict}'[enable strict checking]' \
+ + '(x)' \
+ '(c)'{-x+,--export=}'[export sudoers file to specified JSON output file]:JSON output file:_files'
diff --git a/Completion/Unix/Command/_watch b/Completion/Unix/Command/_watch
index a8d29403f..fff3d56f6 100644
--- a/Completion/Unix/Command/_watch
+++ b/Completion/Unix/Command/_watch
@@ -1,9 +1,42 @@
#compdef watch
-# watch(1) has completely different semantics on freebsd compared to linux, hence:
-case $OSTYPE in
- (freebsd*|dragonfly*) _watch-snoop "$@";;
- (*) _default;;
+local variant ret=1
+local -a context line state state_descr
+local -A opt_args
+
+_pick_variant -r variant procps=procps $OSTYPE --version
+
+case $variant in
+ (procps)
+ _arguments -s -S -A '-*' : \
+ '(: * -)'{-h,--help}'[display help information]' \
+ '(: * -)'{-v,--version}'[display version information]' \
+ '(-b --beep)'{-b,--beep}'[beep on non-zero command exit]' \
+ '(-c --color)'{-c,--color}'[interpret ANSI color/style sequences]' \
+ '(-d --differences)'{-d-,--differences=-}'[highlight changes between updates]::how to highlight:(permanent)' \
+ '(-e --errexit)'{-e,--errexit}'[freeze updates on non-zero command exit]' \
+ '(-g --chgexit)'{-g,--chgexit}'[exit on command output change]' \
+ '(-n --interval)'{-n+,--interval=}'[specify update interval]:update interval (seconds) [2]' \
+ '(-p --precise)'{-p,--precise}'[run command at precise intervals]' \
+ '(-t --no-title)'{-t,--no-title}'[disable header]' \
+ '(-x --exec)'{-x,--exec}'[pass command to exec(2) instead of `sh -c`]' \
+ '(-)*::: :->cmd' \
+ && ret=0
+
+ [[ $state == cmd ]] &&
+ if
+ (( CURRENT == 1 )) &&
+ [[ $words[1] == (\"|\'|\$\')* ]] &&
+ [[ -z $opt_args[(i)(-x|--exec)] ]]
+ then
+ _cmdstring && ret=0
+ else
+ _normal && ret=0
+ fi
+ ;;
+ # watch(1) has completely different semantics on freebsd compared to linux, hence:
+ (freebsd*|dragonfly*) _watch-snoop "$@" && ret=0 ;;
+ (*) _default && ret=0 ;;
esac
-# NOTREACHED
+return ret
diff --git a/Completion/Unix/Command/_xxd b/Completion/Unix/Command/_xxd
index 0034be519..3a8efd664 100644
--- a/Completion/Unix/Command/_xxd
+++ b/Completion/Unix/Command/_xxd
@@ -41,7 +41,7 @@ arguments=(
{-o+,-offset}'[add specified offset to displayed file position]:offset'
{-s,-skip,-seek}'[specify file offset to dump from]: :_guard "[0-9]#" "file offset to dump from (absolute or relative)"'
- ':files:_files'
+ ': :_files'
)
_arguments -S $arguments
diff --git a/Completion/Unix/Command/_zcat b/Completion/Unix/Command/_zcat
index cf927507b..baa7bd791 100644
--- a/Completion/Unix/Command/_zcat
+++ b/Completion/Unix/Command/_zcat
@@ -1,6 +1,6 @@
#compdef zcat
-if _pick_variant gz='(GNU|NetBSD)' unix --license; then
+if _pick_variant gz='(GNU|NetBSD|Apple)' unix --license; then
_gzip "$@"
else
_compress "$@"
diff --git a/Completion/Unix/Type/_file_systems b/Completion/Unix/Type/_file_systems
index 2d903d471..1e47ff7b1 100644
--- a/Completion/Unix/Type/_file_systems
+++ b/Completion/Unix/Type/_file_systems
@@ -27,8 +27,7 @@ case $OSTYPE in
reiserfs xfs zfs )
;;
darwin*)
- fss=( afp cd9660 cddafs devfs fdesc hfs lfs msdos nfs
- ntfs smbfs synthfs udf ufs volfs webdav )
+ fss=( autofs /sbin/mount_*(#qN-*:s./sbin/mount_.) )
;;
*)
# default for all other systems
diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files
index 5df22ea46..467ed747c 100644
--- a/Completion/Unix/Type/_files
+++ b/Completion/Unix/Type/_files
@@ -17,6 +17,10 @@ if _have_glob_qual $PREFIX; then
_globquals && ret=0
fi
return ret
+elif [[ $_comp_caller_options[extendedglob] == on && $PREFIX = \(\#[^\)]# ]] && compset -P '\(\#'; then
+ # Globbing flags can start at beginning of word, even though
+ # glob qualifiers can't.
+ _globflags && return
fi
local opts tmp glob pat pats expl tag i def descr end ign tried
@@ -42,6 +46,8 @@ if (( tmp )); then
ignvars=($=opts[tmp+1])
if [[ $ignvars = _comp_ignore ]]; then
ign=( $_comp_ignore )
+ elif [[ $ignvars = \(* ]]; then
+ ign=( ${=ignvars[2,-2]} )
else
ign=()
for ignvar in $ignvars; do
@@ -121,7 +127,7 @@ for def in "$pats[@]"; do
done
fi
else
- _path_files -g "$pat" "$opts[@]" "$expl[@]" && ret=0
+ _path_files "$expl[@]" -g "$pat" "$opts[@]" && ret=0
fi
done
(( ret )) || break
diff --git a/Completion/Unix/Type/_hosts b/Completion/Unix/Type/_hosts
index d9e1090a4..4057fee10 100644
--- a/Completion/Unix/Type/_hosts
+++ b/Completion/Unix/Type/_hosts
@@ -1,4 +1,4 @@
-#compdef ftp rwho rup xping traceroute host aaaa zone mx ns soa txt
+#compdef ftp rwho rup xping traceroute aaaa zone mx ns soa txt
# avoid calling variable "hosts", it's an obvious candidate for use in
# zstyle -e '*' hosts 'reply=($hosts)'
diff --git a/Completion/X/Command/_setxkbmap b/Completion/X/Command/_setxkbmap
index f7310ecdd..486268ed7 100644
--- a/Completion/X/Command/_setxkbmap
+++ b/Completion/X/Command/_setxkbmap
@@ -9,10 +9,12 @@ _setxkbmap() {
setopt extendedglob
# xkb files may be in different places depending on system
- local dir sourcedir
- for dir in /usr/lib/X11/xkb /usr/share/X11/xkb; do
- if [ -d $dir ] ; then
- sourcedir=$dir
+ local dir sourcedir fullname
+ local -a searchdirs=(${XDG_DATA_HOME:-~/.local/share} ${(s.:.)XDG_DATA_DIRS:-/usr/lib:/usr/share:/usr/local/lib:/usr/local/share})
+ for dir in $searchdirs; do
+ fullname="$dir/X11/xkb"
+ if [ -d $fullname ] ; then
+ sourcedir=$fullname
break
fi
done
diff --git a/Completion/X/Command/_zathura b/Completion/X/Command/_zathura
index 141cadf63..ebd229909 100644
--- a/Completion/X/Command/_zathura
+++ b/Completion/X/Command/_zathura
@@ -8,11 +8,10 @@ _zathura_files(){
${(Qv)opt_args[(i)-p|--plugins-dir]}(#qN) \
{/usr/local,/usr,}/lib/zathura(#qN)
do
- plugins_files=( $plugins_dir/*.so )
- (( $#plugins_files )) && break
+ plugins_files+=( $plugins_dir/*.so(N) )
done
if [[ -z "${plugins_files}" ]]; then
- _files -g "*.pdf(-.)"
+ _files -g "(#i)*.pdf(-.)"
return
fi
local -a supported_filetypes
@@ -25,10 +24,10 @@ _zathura_files(){
elif [[ $pf =~ "poppler" ]]; then
supported_filetypes+="pdf"
else
- supported_filetypes+="${${pf%.so}#${plugins_dir}/lib}"
+ supported_filetypes+="${pf:t:r}"
fi
done
- _files -g "*.(${(j.|.)supported_filetypes})(-.)"
+ _files -g "(#i)*.(${(j.|.)${(@u)supported_filetypes}})(-.)"
}
_arguments -s -S \
diff --git a/Completion/Zsh/Command/_compadd b/Completion/Zsh/Command/_compadd
index a7036d027..e709e400e 100644
--- a/Completion/Zsh/Command/_compadd
+++ b/Completion/Zsh/Command/_compadd
@@ -14,9 +14,9 @@ _arguments -C -s -S -A "-*" \
'(-a)-k[matches are keys of specified associative arrays]' \
'-d+[specify display strings]:array:_parameters -g "*array*"' \
'-l[list display strings one per line, not in columns]' \
- '-o[order matches by display string not by match string]' \
- '(-1 -E)-J+[specify match group]:group' \
- '-V+[specify unsorted match group]:group' \
+ '-o[order matches by match string not by display string]' \
+ '(-1 -E)-J+[specify match group which will be sorted]:group' \
+ '-V+[specify pre-ordered match group]:group' \
'(-J -E)-1[remove only consecutive duplicates from group]' \
'-2[preserve all duplicates]' \
'(-x)-X[specify explanation]:explanation' \
diff --git a/Completion/Zsh/Command/_strftime b/Completion/Zsh/Command/_strftime
index 24ff7dc3e..0849f1c85 100644
--- a/Completion/Zsh/Command/_strftime
+++ b/Completion/Zsh/Command/_strftime
@@ -4,9 +4,11 @@ local ret=1 expl
_arguments -S -A '-*' -s \
'-q[run quietly]' \
- '-r[reverse lookup using strptime]' \
+ '(3)-r[reverse lookup using strptime]' \
'-s+[assign result to parameter]:param:_parameters' \
'1:format: _date_formats zsh' \
- '2:epoch time (or date string with -r)' && ret=0
+ '2:epoch time (or date string with -r)' \
+ '3:nanoseconds' \
+&& ret=0
return ret
diff --git a/Completion/Zsh/Context/_brace_parameter b/Completion/Zsh/Context/_brace_parameter
index 4ba588cc0..5b70ab0ca 100644
--- a/Completion/Zsh/Context/_brace_parameter
+++ b/Completion/Zsh/Context/_brace_parameter
@@ -140,7 +140,7 @@ if [[ $PREFIX = *'${('[^\)]# ]]; then
fi
flags+=(
"#:evaluate as numeric expression"
- "@:double-quoted splitting of scalars"
+ "@:prevent double-quoted joining of arrays"
"A:assign as an array parameter"
"a:sort in array index order (with O to reverse)"
"b:backslash quote pattern characters only"
diff --git a/Completion/Zsh/Type/_module_math_func b/Completion/Zsh/Type/_module_math_func
index 6be9c006a..5044bdf4c 100644
--- a/Completion/Zsh/Type/_module_math_func
+++ b/Completion/Zsh/Type/_module_math_func
@@ -1,9 +1,12 @@
#autoload
-local expl
-local -a funcs
+local mod
+local -a funcs alts
+local -a modules=( example mathfunc system )
-funcs=(${${${(f)"$(zmodload -Fl zsh/mathfunc 2>/dev/null)"}:#^+f:*}##+f:})
+for mod in $modules; do
+ funcs=( ${${${(f)"$(zmodload -Fl zsh/$mod 2>/dev/null)"}:#^+f:*}##+f:} )
+ alts+=( "module-math-functions.${mod}:math function from zsh/${mod}:compadd -S '(' $funcs" )
+done
-_wanted module-math-functions expl 'math function from zsh/mathfunc' \
- compadd -S '(' -q "$@" -a funcs
+_alternative $alts
diff --git a/Config/version.mk b/Config/version.mk
index 33ce37195..099b9bb58 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.6.2
-VERSION_DATE='September 14, 2018'
+VERSION=5.6.2-test-2
+VERSION_DATE='December 19, 2018'
diff --git a/Doc/Makefile.in b/Doc/Makefile.in
index 9dea79252..5a6a705ff 100644
--- a/Doc/Makefile.in
+++ b/Doc/Makefile.in
@@ -63,7 +63,8 @@ Zsh/mod_compctl.yo Zsh/mod_complete.yo Zsh/mod_complist.yo \
Zsh/mod_computil.yo Zsh/mod_curses.yo \
Zsh/mod_datetime.yo Zsh/mod_db_gdbm.yo Zsh/mod_deltochar.yo \
Zsh/mod_example.yo Zsh/mod_files.yo Zsh/mod_langinfo.yo \
-Zsh/mod_mapfile.yo Zsh/mod_mathfunc.yo Zsh/mod_newuser.yo \
+Zsh/mod_mapfile.yo Zsh/mod_mathfunc.yo \
+Zsh/mod_nearcolor.yo Zsh/mod_newuser.yo \
Zsh/mod_parameter.yo Zsh/mod_pcre.yo Zsh/mod_private.yo \
Zsh/mod_regex.yo Zsh/mod_sched.yo Zsh/mod_socket.yo \
Zsh/mod_stat.yo Zsh/mod_system.yo Zsh/mod_tcp.yo \
@@ -142,7 +143,7 @@ zsh.info: $(sdir)/zsh.texi
.yo.1:
@case $@ in \
*/*) target=$@ ;; \
- *) target=$(sdir)/$@ ;; \
+ *) target=$@ ;; \
esac; \
case '$(YODL)' in :*) touch $$target ;; *) \
echo $(YODL) -o $$target -I$(sdir):. -w zman.yo version.yo $< ; \
@@ -176,9 +177,9 @@ zsh_toc.html: $(sdir)/zsh.texi texi2html.conf
--init-file texi2html.conf $(sdir)/zsh.texi
zshall.1: zsh.yo
- @case $@ in \
+ case $@ in \
*/*) target=$@ ;; \
- *) target=$(sdir)/$@ ;; \
+ *) target=$@ ;; \
esac; \
case '$(YODL)' in :*) touch $$target ;; *) \
echo $(YODL) -o $$target -I$(sdir) -DZSHALL -w zman.yo version.yo zsh.yo; \
@@ -203,7 +204,7 @@ runhelp: help.txt
help.txt: zshbuiltins.1
@-rm -f $@ help/*
perl $(sdir_top)/Util/helpfiles \
- $(sdir)/zshbuiltins.1 help help.txt \
+ zshbuiltins.1 help help.txt \
|| rm -f help.txt help/*
$(MAN): zmacros.yo zman.yo
@@ -328,8 +329,8 @@ uninstall: uninstall.man uninstall.runhelp
install.man: man
${SHELL} $(sdir_top)/mkinstalldirs $(DESTDIR)$(mandir)/man1
for file in $(MAN); do \
- test -s $(sdir)/$$file || exit 1; \
- $(INSTALL_DATA) $(sdir)/$$file $(DESTDIR)$(mandir)/man1/`echo $$file | sed 's|zsh|$(tzsh)|'` || exit 1; \
+ test -s $$file || exit 1; \
+ $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man1/`echo $$file | sed 's|zsh|$(tzsh)|'` || exit 1; \
done
.PHONY: install.man
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index f460e48a5..fd29ca3a5 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -1332,7 +1332,7 @@ If any of `tt(-m)', `tt(-o)' or `tt(-O)' are used in combination with
case of `tt(-m)') then nothing is printed.
)
findex(printf)
-item(tt(printf) [ -v var(name) ] var(format) [ var(arg) ... ])(
+item(tt(printf) [ tt(-v) var(name) ] var(format) [ var(arg) ... ])(
Print the arguments according to the format specification. Formatting
rules are the same as used in C. The same escape sequences as for tt(echo)
are recognised in the format. All C conversion specifications ending in
@@ -2029,6 +2029,9 @@ scalar version causes a split on all separators (which cannot be quoted).
It is possible to apply tt(-T) to two previously tied variables but with a
different separator character, in which case the variables remain joined
as before but the separator is changed.
+
+When an existing scalar is tied to a new array, the value of the scalar
+is preserved but no attribute other than export will be preserved.
)
enditem()
@@ -2076,12 +2079,12 @@ flag.
)
item(tt(-U))(
For arrays (but not for associative arrays), keep only the first
-occurrence of each duplicated value. This may also be set for
-colon-separated special parameters like tt(PATH) or tt(FIGNORE), etc.
-Note the flag takes effect on assignment, and the type of the
-variable being assigned to is determinative; for variables with
-shared values it is therefore recommended to set the flag for
-all interfaces, e.g. `tt(typeset -U PATH path)'.
+occurrence of each duplicated value. This may also be set for tied
+parameters (see tt(-T)) or colon-separated special parameters like
+tt(PATH) or tt(FIGNORE), etc. Note the flag takes effect on assignment,
+and the type of the variable being assigned to is determinative; for
+variables with shared values it is therefore recommended to set the flag
+for all interfaces, e.g. `tt(typeset -U PATH path)'.
This flag has a different meaning when used with tt(-f); see below.
)
@@ -2174,9 +2177,17 @@ be turned off.
If the tt(POSIX_BUILTINS) option is set, the readonly attribute is
more restrictive: unset variables can be marked readonly and cannot then
be set; furthermore, the readonly attribute cannot be removed from any
-variable. Note that in zsh (unlike other shells) it is still possible
-to create a local variable of the same name as this is considered a
-different variable (though this variable, too, can be marked readonly).
+variable.
+
+It is still possible to change other attributes of the variable though,
+some of which like tt(-U) or tt(-Z) would affect the value. More generally,
+the readonly attribute should not be relied on as a security mechanism.
+
+Note that in zsh (like in pdksh but unlike most other shells) it is
+still possible to create a local variable of the same name as this is
+considered a different variable (though this variable, too, can be marked
+readonly). Special variables that have been made readonly retain their value
+and readonly attribute when made local.
)
item(tt(-t))(
Tags the named parameters. Tags have no special meaning to the shell.
@@ -2373,6 +2384,12 @@ item(tt(whence) [ tt(-vcwfpamsS) ] [ tt(-x) var(num) ] var(name) ...)(
For each var(name), indicate how it would be interpreted if used as a
command name.
+If var(name) is not an alias, built-in command, external command, shell
+function, hashed command, or a reserved word, the exit status shall be
+non-zero, and DASH()- if tt(-v), tt(-c), or tt(-w) was passed DASH()- a message
+will be written to standard output. (This is different from other shells that
+write that message to standard error.)
+
tt(whence) is most useful when var(name) is only the last path component
of a command, i.e. does not include a `tt(/)'; in particular, pattern
matching only succeeds if just the non-directory component of the command is
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 65f596752..a5a9e5b5d 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -489,7 +489,11 @@ The parameter tt($_compskip) may be set by any function defined for a
pattern context. If it is set to a value containing the substring
`tt(patterns)' none of the pattern-functions will be called; if it is
set to a value containing the substring `tt(all)', no other function
-will be called.
+will be called. Setting tt($_compskip) in this manner is of particular
+utility when using the tt(-p) option, as otherwise the dispatcher will
+move on to additional functions (likely the default one) after calling
+the pattern-context one, which can mangle the display of completion
+possibilities if not handled properly.
The form with tt(-k) defines a widget with the same name as the var(function)
that will be called for each of the var(key-sequence)s; this is like the
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 0c2ba484c..d32ba018d 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -1668,7 +1668,7 @@ tt(mq)) backend and in tt(quilt) support when the tt(unapplied-string) is
generated; the tt(get-unapplied) style must be true.
This hook gets the names of all unapplied patches which tt(vcs_info)
-collected so far in the opposite order, which mean that the first argument is
+collected so far in order, which means that the first argument is
the patch next-in-line to be applied and so forth.
When setting tt(ret) to non-zero, the string in
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index c79109700..a212d742d 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -1683,10 +1683,17 @@ any trailing newlines deleted.
If the substitution is not enclosed in double quotes, the
output is broken into words using the tt(IFS) parameter.
vindex(IFS, use of)
+
The substitution `tt($LPAR()cat) var(foo)tt(RPAR())' may be replaced
-by the equivalent but faster `tt($LPAR()<)var(foo)tt(RPAR())'.
-In either case, if the option tt(GLOB_SUBST) is set,
-the output is eligible for filename generation.
+by the faster `tt($LPAR()<)var(foo)tt(RPAR())'. In this case var(foo)
+undergoes single word shell expansions (em(parameter expansion),
+em(command substitution) and em(arithmetic expansion)), but not
+filename generation.
+
+If the option tt(GLOB_SUBST) is set, the result of any unquoted command
+substitution, including the special form just mentioned, is eligible for
+filename generation.
+
texinode(Arithmetic Expansion)(Brace Expansion)(Command Substitution)(Expansion)
sect(Arithmetic Expansion)
cindex(arithmetic expansion)
diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index d2c7cd29c..d30c9d2d7 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -183,12 +183,15 @@ findex(for)
cindex(for loops)
cindex(loops, for)
item(tt(for) var(name) ... [ tt(in) var(word) ... ] var(term) tt(do) var(list) tt(done))(
-where var(term) is at least one newline or tt(;).
Expand the list of var(word)s, and set the parameter
-var(name) to each of them in turn, executing
-var(list) each time. If the tt(in) var(word) is omitted,
+var(name) to each of them in turn, executing var(list)
+each time. If the `tt(in) var(word)' is omitted,
use the positional parameters instead of the var(word)s.
+The var(term) consists of one or more newline or tt(;)
+which terminate the var(word)s, and are optional when the
+`tt(in) var(word)' is omitted.
+
More than one parameter var(name) can appear before the list of
var(word)s. If var(N) var(name)s are given, then on each execution of the
loop the next var(N) var(word)s are assigned to the corresponding
diff --git a/Doc/Zsh/mod_datetime.yo b/Doc/Zsh/mod_datetime.yo
index 27bc78157..da65a9bbd 100644
--- a/Doc/Zsh/mod_datetime.yo
+++ b/Doc/Zsh/mod_datetime.yo
@@ -6,9 +6,13 @@ The tt(zsh/datetime) module makes available one builtin command:
startitem()
findex(strftime)
cindex(date string, printing)
-xitem(tt(strftime) [ tt(-s) var(scalar) ] var(format) var(epochtime) )
+xitem(tt(strftime) [ tt(-s) var(scalar) ] var(format) [ var(epochtime) [ var(nanoseconds) ] ] )
item(tt(strftime) tt(-r) [ tt(-q) ] [ tt(-s) var(scalar) ] var(format) var(timestring) )(
-Output the date denoted by var(epochtime) in the var(format) specified.
+Output the date in the var(format) specified. With no var(epochtime), the
+current system date/time is used; optionally, var(epochtime) may be used to
+specify the number of seconds since the epoch, and var(nanoseconds) may
+additionally be used to specify the number of nanoseconds past the second
+(otherwise that number is assumed to be 0).
See manref(strftime)(3) for details. The zsh extensions described in
ifzman(the section EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\
ifnzman(noderef(Prompt Expansion)) are also available.
diff --git a/Doc/Zsh/mod_nearcolor.yo b/Doc/Zsh/mod_nearcolor.yo
new file mode 100644
index 000000000..df7771397
--- /dev/null
+++ b/Doc/Zsh/mod_nearcolor.yo
@@ -0,0 +1,36 @@
+COMMENT(!MOD!zsh/nearcolor
+Map colours to the nearest colour in the available palette.
+!MOD!)
+The tt(zsh/nearcolor) module replaces colours specified as hex triplets
+with the nearest colour in the 88 or 256 colour palettes that are widely
+used by terminal emulators. By default, 24-bit true colour escape codes
+are generated when colours are specified using hex triplets. These are
+not supported by all terminals. The purpose of this module is to make
+it easier to define colour preferences in a form that can work across a
+range of terminal emulators.
+
+Aside from the default colour, the ANSI standard for terminal escape
+codes provides for eight colours. The bright attribute brings this to
+sixteen. These basic colours are commonly used in terminal applications
+due to being widely supported. Expanded 88 and 256 colour palettes are
+also common and, while the first sixteen colours vary somewhat between
+terminals and configurations, these add a generally consistent and
+predictable set of colours.
+
+In order to use the tt(zsh/nearcolor) module, it only needs to be
+loaded. Thereafter, whenever a colour is specified using a hex triplet,
+it will be compared against each of the available colours and the
+closest will be selected. The first sixteen colours are never matched in
+this process due to being unpredictable.
+
+It isn't possible to reliably detect support for true colour in the
+terminal emulator. It is therefore recommended to be selective in
+loading the tt(zsh/nearcolor) module. For example, the following
+checks the tt(COLORTERM) environment variable:
+
+example([[ $COLORTERM = *LPAR()24bit|truecolor+RPAR()* ]] || \
+ zmodload zsh/nearcolor)
+
+Note that some terminals accept the true color escape codes but map
+them internally to a more limited palette in a similar manner to the
+tt(zsh/nearcolor) module.
diff --git a/Doc/Zsh/mod_zpty.yo b/Doc/Zsh/mod_zpty.yo
index 44b375a3c..6f20c4b75 100644
--- a/Doc/Zsh/mod_zpty.yo
+++ b/Doc/Zsh/mod_zpty.yo
@@ -41,7 +41,8 @@ em(not) given, a newline is added at the end.
If no var(string) is provided, the standard input is copied to the
pseudo-terminal; this may stop before copying the full input if the
-pseudo-terminal is non-blocking.
+pseudo-terminal is non-blocking. The exact input is always copied:
+the tt(-n) option is not applied.
Note that the command under the pseudo-terminal sees this input as if it
were typed, so beware when sending special tty driver characters such as
diff --git a/Doc/Zsh/redirect.yo b/Doc/Zsh/redirect.yo
index c793638b7..7e38cd0c3 100644
--- a/Doc/Zsh/redirect.yo
+++ b/Doc/Zsh/redirect.yo
@@ -26,6 +26,7 @@ separate filename in turn.
startitem()
item(tt(<) var(word))(
Open file var(word) for reading as standard input.
+It is an error to open a file in this fashion if it does not exist.
)
item(tt(<>) var(word))(
Open file var(word) for reading and writing as standard input.
@@ -234,6 +235,9 @@ example(date >foo | cat)
writes the date to the file `tt(foo)', and also pipes it to cat.
+Note that the shell opens all the files to be used in the multio process
+immediately, not at the point they are about to be written.
+
Note also that redirections are always expanded in order. This happens
regardless of the setting of the tt(MULTIOS) option, but with the option
in effect there are additional consequences. For example,
@@ -268,9 +272,13 @@ example(echo exit 0 >> *.sh)
If the user tries to open a file descriptor for reading more than once,
the shell opens the file descriptor as a pipe to a process that copies
-all the specified inputs to its output in the order
-specified, similar to bf(cat),
-provided the tt(MULTIOS) option is set. Thus
+all the specified inputs to its output in the order specified, provided
+the tt(MULTIOS) option is set. It should be noted that each file is
+opened immediately, not at the point where it is about to be read:
+this behaviour differs from tt(cat), so if strictly standard behaviour
+is needed, tt(cat) should be used instead.
+
+Thus
example(sort <foo <fubar)
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index 6ae4863c6..fe4e5bd04 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -47,11 +47,11 @@ by default be entered in emacs mode by holding the alt key and typing
a number, or pressing escape before each digit, and in vi command mode
by typing the number before entering a command. Generally the numeric
argument causes the next command entered to be repeated the specified
-number of times, unless otherwise noted below. See also
+number of times, unless otherwise noted below; this is implemented
+by the tt(digit-argument) widget. See also
ifzman(the em(Arguments) subsection of the em(Widgets) section )\
ifnzman(noderef(Arguments) )\
-for some other ways the numeric argument can be modified. The default
-bindings mentioned here use the tt(digit-argument) widget.
+for some other ways the numeric argument can be modified.
startmenu()
menu(Keymaps)
@@ -2703,8 +2703,9 @@ this to appear with other types of highlighting; it is used to override
a default.
)
item(tt(fg=)var(colour))(
-The foreground colour should be set to var(colour), a decimal integer
-or the name of one of the eight most widely-supported colours.
+The foreground colour should be set to var(colour), a decimal integer,
+the name of one of the eight most widely-supported colours or as a
+`tt(#)' followed by an RGB triplet in hexadecimal format.
Not all terminals support this and, of those that do, not all provide
facilities to test the support, hence the user should decide based on the
@@ -2721,6 +2722,15 @@ Co)'; if this succeeds, it indicates a limit on the number of colours which
will be enforced by the line editor. The number of colours is in any case
limited to 256 (i.e. the range 0 to 255).
+Some modern terminal emulators have support for 24-bit true colour (16
+million colours). In this case, the hex triplet format can be used. This
+consists of either a three or six digit hexadecimal number describing
+the red, green and blue components of the colour. Hex triplets can also
+be used with 88 and 256 colour terminals via the tt(zsh/nearcolor)
+module (see ifzman(zmanref(zshmodules))\
+ifnzman(noderef(The zsh/nearcolor Module))\
+).
+
Colour is also known as color.
)
item(tt(bg=)var(colour))(
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index a3dfc6c13..6c46cc09d 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -127,6 +127,7 @@ Chapter 3: How to get various things to work
3.26. Why is my output duplicated with `tt(foo 2>&1 >foo.out | bar)'?
3.27. What are these `^' and `~' pattern characters, anyway?
3.28. How do I edit the input buffer in $EDITOR?
+3.29. Why does `which' output for missing commands go to stdout?
Chapter 4: The mysteries of completion
4.1. What is completion?
@@ -306,7 +307,7 @@ sect(On what machines will it run?)
sect(What's the latest version?)
- Zsh 5.6.2 is the latest production version. For details of all the
+ Zsh 5.7 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
@@ -1964,6 +1965,36 @@ label(328)
quitting the editor will only return to zsh's command-line editing mode.
+sect(Why does `which' output for missing commands go to stdout?)
+
+ The issue is that if you run:
+ verb(
+ which non-existent-command
+ )
+ the error message goes, unusually, to standard output rather than
+ to standard error. Other shells send this message to standard error,
+ as they would if the command was about to be executed but could not be
+ found.
+
+ The original reason for this is that this behaviour is inherited from
+ previous versions of `tt(which)', a builtin in later versions of csh,
+ the C shell, as well as tcsh, an adaptation of the C Shell with better
+ editing, and is also available as a separate script sometimes still
+ found in certain distributions. Other shells had equivalent commands,
+ `tt(whence)' and `tt(type), that zsh has also adopted. So in fact
+ this has always been a feature of `tt(which)'. (It would be possible
+ to change this in emulation modes; however, so far this possibility
+ has been seen as more of an additional confusion than a help.)
+
+ If you want some further rationalisation, you might note that
+ `tt(which)' is designed as a way of outputting information about a
+ command. So `this command can be found in ...' and `this command
+ can't be found' are both bits of information here, unlike the case
+ where the command is to be executed. So although it differs from
+ other Bourne-style shells it is in fact self-consistent. Note that
+ the exit status does reflect the fact the command can't be found.
+
+
chapter(The mysteries of completion)
diff --git a/Functions/Misc/add-zle-hook-widget b/Functions/Misc/add-zle-hook-widget
index d8a3950fb..9cc35496f 100644
--- a/Functions/Misc/add-zle-hook-widget
+++ b/Functions/Misc/add-zle-hook-widget
@@ -129,7 +129,7 @@ function add-zle-hook-widget {
else
# Check whether attempting to add a widget named for the hook
if [[ "$fn" = "$hook" ]]; then
- if [[ -n "${widgets[$fn]}" ]]; then
+ if (( ${+widgets[$fn]} )); then
print -u2 "$funcstack[1]: Cannot hook $fn to itself"
return 1
fi
@@ -141,8 +141,8 @@ function add-zle-hook-widget {
integer i=${#options[ksharrays]}-2
zstyle -g extant_hooks "$hook" widgets
# Check for an existing widget, add it as the first hook
- if [[ ${widgets[$hook]} != "user:azhw:$hook" ]]; then
- if [[ -n ${widgets[$hook]} ]]; then
+ if [[ ${widgets[$hook]:-} != "user:azhw:$hook" ]]; then
+ if [[ -n ${widgets[$hook]:-} ]]; then
zle -A "$hook" "${widgets[$hook]}"
extant_hooks=(0:"${widgets[$hook]}" "${extant_hooks[@]}")
fi
@@ -152,17 +152,17 @@ function add-zle-hook-widget {
if [[ -z ${(M)extant_hooks[@]:#(<->:|)$fn} ]]; then
# no index and not already hooked
# assign largest existing index plus 1
- i=${${(On@)${(@M)extant_hooks[@]#<->:}%:}[i]}+1
+ i=${${(On@)${(@M)extant_hooks[@]#<->:}%:}[i]:-0}+1
else
return 0
fi
extant_hooks+=("${i}:${fn}")
zstyle -- "$hook" widgets "${extant_hooks[@]}"
- if [[ -z "${widgets[$fn]}" ]]; then
+ if (( ! ${+widgets[$fn]} )); then
autoload "${autoopts[@]}" -- "$fn"
zle -N -- "$fn"
fi
- if [[ -z "${widgets[$hook]}" ]]; then
+ if (( ! ${+widgets[$hook]} )); then
zle -N "$hook" azhw:"$hook"
fi
fi
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_p4 b/Functions/VCS_Info/Backends/VCS_INFO_detect_p4
index 95a534786..d171c68ee 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_p4
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_p4
@@ -16,6 +16,7 @@
# of having such files in all client root directories and nowhere above.
+(( ${+functions[VCS_INFO_p4_get_server]} )) ||
VCS_INFO_p4_get_server() {
emulate -L zsh
setopt extendedglob
@@ -43,6 +44,7 @@ VCS_INFO_p4_get_server() {
}
+(( ${+functions[VCS_INFO_detect_p4]} )) ||
VCS_INFO_detect_p4() {
local serverport p4where
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
index 705db65a7..b30e0e12b 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
@@ -8,6 +8,7 @@ local bzrbase bzrbr bzr_changes bzr_type
local -a bzrinfo
local -A hook_com bzr_info
+(( ${+functions[VCS_INFO_bzr_get_info]} )) ||
VCS_INFO_bzr_get_info() {
bzrinfo=( ${(s.:.)$( ${vcs_comm[cmd]} version-info --custom \
--template="{revno}:{branch_nick}:{clean}")} )
@@ -20,6 +21,7 @@ VCS_INFO_bzr_get_info() {
fi
}
+(( ${+functions[VCS_INFO_bzr_get_info_restricted]} )) ||
VCS_INFO_bzr_get_info_restricted() {
# we are forbidden from fetching info on bound branch from remote repository
bzrinfo=( $(${vcs_comm[cmd]} revno) ${bzrbase:t} )
@@ -30,6 +32,7 @@ VCS_INFO_bzr_get_info_restricted() {
fi
}
+(( ${+functions[VCS_INFO_bzr_get_changes]} )) ||
VCS_INFO_bzr_get_changes() {
local -A counts
local line flag
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index c3e62db3a..ceb4f978a 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -8,6 +8,7 @@ local -i querystaged queryunstaged
local -a git_patches_applied git_patches_unapplied
local -A hook_com
+(( ${+functions[VCS_INFO_git_getaction]} )) ||
VCS_INFO_git_getaction () {
local gitdir=$1
local tmp
@@ -70,6 +71,7 @@ VCS_INFO_git_getaction () {
return 1
}
+(( ${+functions[VCS_INFO_git_getbranch]} )) ||
VCS_INFO_git_getbranch () {
local gitdir=$1 tmp actiondir
local gitsymref="${vcs_comm[cmd]} symbolic-ref HEAD"
@@ -87,8 +89,8 @@ VCS_INFO_git_getbranch () {
gitbranch="$(${(z)gitsymref} 2> /dev/null)"
[[ -z ${gitbranch} ]] && [[ -r ${actiondir}/head-name ]] \
&& gitbranch="$(< ${actiondir}/head-name)"
- [[ -z ${gitbranch} || ${gitbranch} == 'detached HEAD' ]] \
- && gitbranch="$(< ${gitdir}/ORIG_HEAD)"
+ [[ -z ${gitbranch} || ${gitbranch} == 'detached HEAD' ]] && [[ -r ${actiondir}/onto ]] \
+ && gitbranch="$(< ${actiondir}/onto)"
elif [[ -f "${gitdir}/MERGE_HEAD" ]] ; then
gitbranch="$(${(z)gitsymref} 2> /dev/null)"
@@ -110,18 +112,22 @@ VCS_INFO_git_getbranch () {
## Commented out because we don't know of a case in which 'describe --contains' fails and 'name-rev --tags' succeeds.
#elif gitbranch="$(${vcs_comm[cmd]} name-rev --name-only --no-undefined --tags HEAD 2>/dev/null)" ; then
elif gitbranch="$(${vcs_comm[cmd]} name-rev --name-only --no-undefined --always HEAD 2>/dev/null)" ; then
- elif gitbranch="${${"$(< $gitdir/HEAD)"}[1,7]}..." ; then
- else
- # Can't happen
+ fi
+
+ if [[ -z ${gitbranch} ]]
+ then
+ gitbranch="${${"$(< $gitdir/HEAD)"}[1,7]}..."
fi
return 0
}
+(( ${+functions[VCS_INFO_git_handle_patches]} )) ||
VCS_INFO_git_handle_patches () {
local git_applied_s git_unapplied_s gitmsg
+ # All callers populate $git_patches_applied and $git_patches_unapplied in
+ # order, but the hook requires us to reverse $git_patches_applied.
git_patches_applied=(${(Oa)git_patches_applied})
- git_patches_unapplied=(${(Oa)git_patches_unapplied})
VCS_INFO_set-patch-format 'git_patches_applied' 'git_applied_s' \
'git_patches_unapplied' 'git_unapplied_s' \
@@ -183,6 +189,7 @@ then
git_patches_unapplied=(${(f)"$(< "${patchdir}/unapplied")"})
VCS_INFO_git_handle_patches
elif [[ -d "${gitdir}/rebase-merge" ]]; then
+ # 'git rebase -i'
patchdir="${gitdir}/rebase-merge"
local p
[[ -f "${patchdir}/done" ]] &&
@@ -190,21 +197,57 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then
# pick/edit/fixup/squash/reword: Add "$hash $subject" to $git_patches_applied.
# exec: Add "exec ${command}" to $git_patches_applied.
# (anything else): As 'exec'.
- p=${p/(#s)(p|pick|e|edit|r|reword|f|fixup|s|squash) /}
- p=${p/(#s)x /exec }
+ case $p in
+ ((p|pick|e|edit|r|reword|f|fixup|s|squash)' '*)
+ # The line is of the form "pick $hash $subject".
+ # Just strip the verb and we're good to go.
+ p=${p#* }
+ # Special case: in an interactive rebase, if the user wrote "p $shorthash\n"
+ # in the editor (without a description after the hash), then the .../done
+ # file will contain "p $longhash $shorthash\n" (git 2.11.0) or "pick $longhash\n"
+ # (git 2.19.0).
+ if [[ $p != *\ * ]]; then
+ # The line is of the form "pick $longhash\n"
+ #
+ # Mark the log message subject as unknown.
+ # TODO: Can we performantly obtain the subject?
+ p+=" ?"
+ elif (( ${#${p//[^ ]}} == 1 )) && [[ ${p%% *} == ${p#* }* ]]; then
+ # The line is of the form "p $longhash $shorthash\n"
+ #
+ # The shorthash is superfluous, so discard it, and mark
+ # the log message subject as unknown.
+ # TODO: Can we performantly obtain the subject?
+ p="${p%% *} ?"
+ fi
+ ;;
+ (x *)
+ # The line is of the form 'exec foo bar baz' where 'foo bar
+ # baz' is a shell command. There's no way to map _that_ to
+ # "$hash $subject", but I hope this counts as making an effort.
+ p=${p/x /exec }
+ ;;
+ (*)
+ # Forward compatibility with not-yet-existing 'git rebase -i' verbs.
+ if [[ $p != *\ * ]]; then
+ p+=" ?"
+ fi
+ esac
git_patches_applied+=("$p")
done
if [[ -f "${patchdir}/git-rebase-todo" ]] ; then
+ # TODO: Process ${patchdir}/git-rebase-todo lines like ${patchdir}/done lines are
git_patches_unapplied=( ${${(f)${"$(<"${patchdir}/git-rebase-todo")"}}:#[#]*} )
fi
VCS_INFO_git_handle_patches
elif [[ -d "${gitdir}/rebase-apply" ]]; then
- # Fake patch names for all but current patch
+ # 'git rebase' without -i
patchdir="${gitdir}/rebase-apply"
local next="${patchdir}/next"
if [[ -f $next ]]; then
local cur=$(< $next)
local p subject
+ # Fake patch names for all but current patch
for ((p = 1; p < cur; p++)); do
printf -v "git_patches_applied[$p]" "%04d ?" "$p"
done
@@ -220,18 +263,11 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then
subject=$REPLY
}
fi
+ subject=${subject:-'?'}
if [[ -f "${patchdir}/original-commit" ]]; then
- if [[ -n $subject ]]; then
- git_patches_applied+=("$(< ${patchdir}/original-commit) $subject")
- else
- git_patches_applied+=("$(< ${patchdir}/original-commit)")
- fi
+ git_patches_applied+=("$(< ${patchdir}/original-commit) $subject")
else
- if [[ -n $subject ]]; then
- git_patches_applied+=("? $subject")
- else
- git_patches_applied+=("?")
- fi
+ git_patches_applied+=("? $subject")
fi
local last="$(< "${patchdir}/last")"
if (( cur+1 <= last )); then
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
index a773a727d..c1547950f 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
@@ -9,6 +9,7 @@ local svnbase svnbranch a b rrn
local -i rc
local -A svninfo parentinfo cwdinfo
local -A hook_com
+integer -r SVN_ERR_WC_UPGRADE_REQUIRED=155036 # from /usr/local/include/subversion-1/svn_error_codes.h
svnbase=".";
svninfo=()
@@ -18,7 +19,15 @@ svninfo=()
local -a dat
dat=( ${(f)"$(${vcs_comm[cmd]} info --non-interactive 2>&1)"} )
rc=$?
-(( rc != 0 )) && return 1
+if (( rc != 0 )) ; then
+ if (( rc == 1 )) && [[ -n ${(M)dat:#"svn: E${SVN_ERR_WC_UPGRADE_REQUIRED}: "*} ]]; then
+ hook_com=()
+ VCS_INFO_formats '' '?' '?' '' '' '?' 'upgrade required'
+ return $?
+ else
+ return 1
+ fi
+fi
# The following line is the real code, the following is the workaround.
#${vcs_comm[cmd]} info --non-interactive \
print -l "${dat[@]}" \
diff --git a/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt
index 381b58489..1f20e895d 100644
--- a/Functions/VCS_Info/VCS_INFO_quilt
+++ b/Functions/VCS_Info/VCS_INFO_quilt
@@ -1,5 +1,6 @@
## vim:ft=zsh:foldmethod=marker
+(( ${+functions[VCS_INFO_quilt-match]} )) ||
function VCS_INFO_quilt-match() {
emulate -L zsh
setopt extendedglob
@@ -20,6 +21,7 @@ function VCS_INFO_quilt-match() {
return 1
}
+(( ${+functions[VCS_INFO_quilt-standalone-detect]} )) ||
function VCS_INFO_quilt-standalone-detect() {
emulate -L zsh
setopt extendedglob
@@ -58,6 +60,7 @@ function VCS_INFO_quilt-standalone-detect() {
return 1
}
+(( ${+functions[VCS_INFO_quilt-dirfind]} )) ||
function VCS_INFO_quilt-dirfind() {
# This is a wrapper around VCS_INFO_bydir_detect(). It makes sure
# that $vcs_comm[] is unchanged. Currently, changing anything in it
@@ -80,11 +83,12 @@ function VCS_INFO_quilt-dirfind() {
return ${ret}
}
+(( ${+functions[VCS_INFO_quilt-patch2subject]} )) ||
function VCS_INFO_quilt-patch2subject() {
VCS_INFO_patch2subject "$@"
}
-function VCS_INFO_quilt() {
+{
emulate -L zsh
setopt extendedglob
local mode="$1"
@@ -192,4 +196,3 @@ function VCS_INFO_quilt() {
VCS_INFO_hook 'post-quilt' ${mode} ${patches} ${pc:-\\-nopc-}
}
-VCS_INFO_quilt "$@"
diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format
index cdf2d303e..917ebf6bf 100644
--- a/Functions/VCS_Info/VCS_INFO_set-patch-format
+++ b/Functions/VCS_Info/VCS_INFO_set-patch-format
@@ -3,8 +3,10 @@
#
# Parameters:
# $1 - name of an array parameter to be the argument to gen-applied-string
+# (patches in reverse order)
# $2 - name of a parameter to store the applied-string in
# $3 - name of an array parameter to be the argument to gen-unapplied-string
+# (patches in order)
# $4 - name of a parameter to store the unapplied-string in
# $5 - context argument for use in zstyle getters
# $6 - name of a parameter to store a patch-format format string in
diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
index e17893e93..991775ea5 100644
--- a/Functions/Zle/edit-command-line
+++ b/Functions/Zle/edit-command-line
@@ -6,6 +6,8 @@
# will give ksh-like behaviour for that key,
# except that it will handle multi-line buffers properly.
+emulate -L zsh
+
() {
exec </dev/tty
diff --git a/Functions/Zle/select-bracketed b/Functions/Zle/select-bracketed
index d467bb804..0cb4d0e76 100644
--- a/Functions/Zle/select-bracketed
+++ b/Functions/Zle/select-bracketed
@@ -17,8 +17,8 @@ setopt localoptions noksharrays
local style=${${1:-$KEYS}[1]} matching="(){}[]<>bbBB"
local -i find=${NUMERIC:-1} idx=${matching[(I)[${${1:-$KEYS}[2]}]]}%9
(( idx )) || return 1 # no corresponding closing bracket
-local lmatch=${matching[1 + (idx-1) & ~1]}
-local rmatch=${matching[1 + (idx-1) | 1]}
+local lmatch=${matching[1 + ((idx-1) & ~1)]}
+local rmatch=${matching[1 + ((idx-1) | 1)]}
local -i start=CURSOR+1 end=CURSOR+1 rfind=find
[[ $BUFFER[start] = "$rmatch" ]] && (( start--, end-- ))
diff --git a/NEWS b/NEWS
index f3e617b9c..0b0c0e84c 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,15 @@ CHANGES FROM PREVIOUS VERSIONS OF ZSH
Note also the list of incompatibilities in the README file.
+Changes since 5.6.2
+-------------------
+
+Support for 24-bit true color terminals has been added. Hex triplets
+can be used when specifying colours for prompts and line editor
+highlighting. On 88 and 256 colour terminals, a new zsh/nearcolor module
+allows colours specified with hex triplets to be matched against the
+nearest available colour.
+
Changes from 5.6.1 to 5.6.2
---------------------------
diff --git a/README b/README
index c792d4075..aaaee5014 100644
--- a/README
+++ b/README
@@ -5,12 +5,10 @@ THE Z SHELL (ZSH)
Version
-------
-This is version 5.6.2 of the shell. This is a bugfix release, following
-5.6 which was a security and feature release and 5.6.1 which was a bugfix
-release.
+This is version 5.7 of the shell.
Note in particular the changes highlighted under "Incompatibilities since
-5.5.1" below. See NEWS for more information.
+5.6.2" below. See NEWS for more information.
Installing Zsh
--------------
@@ -31,9 +29,22 @@ Zsh is a shell with lots of features. For a list of some of these, see the
file FEATURES, and for the latest changes see NEWS. For more
details, see the documentation.
-Incompatibilities since 5.5.1
+Incompatibilities since 5.6.2
-----------------------------
+1) vcs_info git: The gen-unapplied-string hook receives the patches in
+order (next to be applied first). This is consistent with the hg
+backend and with one of two contradictory claims in the documentation
+(the other one has been corrected). In zsh through 5.6.2, the patches
+were passed in reverse order, next to be applied being last in the
+array.
+
+The gen-applied-string hook is unaffected; it still receives the patches in
+reverse order, from last applied to first applied.
+
+Incompatibilities between 5.5.1 and 5.6.2
+------------------------------------------
+
The completion helper _remote_files, typically used after a hostname
with scp-style completion, now uses remote-files instead of files as a
tag. This makes it easier to restrict completions with the tag-order
diff --git a/Src/Modules/clone.c b/Src/Modules/clone.c
index ef6275dcf..4b2655505 100644
--- a/Src/Modules/clone.c
+++ b/Src/Modules/clone.c
@@ -96,7 +96,8 @@ bin_clone(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
init_io(NULL);
setsparam("TTY", ztrdup(ttystrname));
}
- close(ttyfd);
+ else
+ close(ttyfd);
if (pid < 0) {
zerrnam(nam, "fork failed: %e", errno);
return 1;
diff --git a/Src/Modules/datetime.c b/Src/Modules/datetime.c
index be378b347..18c7fb58e 100644
--- a/Src/Modules/datetime.c
+++ b/Src/Modules/datetime.c
@@ -100,8 +100,8 @@ output_strftime(char *nam, char **argv, Options ops, UNUSED(int func))
{
int bufsize, x, len;
char *endptr = NULL, *scalar = NULL, *buffer;
- time_t secs;
- struct tm *t;
+ struct tm *tm;
+ struct timespec ts;
if (OPT_ISSET(ops,'s')) {
scalar = OPT_ARG(ops, 's');
@@ -110,30 +110,58 @@ output_strftime(char *nam, char **argv, Options ops, UNUSED(int func))
return 1;
}
}
- if (OPT_ISSET(ops, 'r'))
+ if (OPT_ISSET(ops, 'r')) {
+ if (!argv[1]) {
+ zwarnnam(nam, "timestring expected");
+ return 1;
+ }
return reverse_strftime(nam, argv, scalar, OPT_ISSET(ops, 'q'));
-
- errno = 0;
- secs = (time_t)strtoul(argv[1], &endptr, 10);
- if (errno != 0) {
- zwarnnam(nam, "%s: %e", argv[1], errno);
- return 1;
- } else if (*endptr != '\0') {
- zwarnnam(nam, "%s: invalid decimal number", argv[1]);
- return 1;
}
- t = localtime(&secs);
- if (!t) {
- zwarnnam(nam, "%s: unable to convert to time", argv[1]);
- return 1;
+ if (!argv[1]) {
+ zgettime(&ts);
+ tm = localtime(&ts.tv_sec);
+ } else {
+ errno = 0;
+
+ ts.tv_sec = (time_t)strtoul(argv[1], &endptr, 10);
+ if (errno != 0) {
+ zwarnnam(nam, "%s: %e", argv[1], errno);
+ return 1;
+ } else if (*argv[1] == '\0' || *endptr != '\0') {
+ zwarnnam(nam, "%s: invalid decimal number", argv[1]);
+ return 1;
+ }
+
+ tm = localtime(&ts.tv_sec);
+ if (!tm) {
+ zwarnnam(nam, "%s: unable to convert to time", argv[1]);
+ return 1;
+ }
+
+ ts.tv_nsec = 0L;
+ if (argv[2]) {
+ ts.tv_nsec = (long)zstrtol(argv[2], &endptr, 10);
+ if (errno != 0) {
+ zwarnnam(nam, "%s: %e", argv[2], errno);
+ return 1;
+ } else if (*argv[2] == '\0' || *endptr != '\0') {
+ zwarnnam(nam, "%s: invalid decimal number", argv[2]);
+ return 1;
+ } else if (ts.tv_nsec < 0) {
+ zwarnnam(nam, "%s: invalid nanosecond value", argv[2]);
+ return 1;
+ }
+ }
}
+
bufsize = strlen(argv[0]) * 8;
buffer = zalloc(bufsize);
len = 0;
for (x=0; x < 4; x++) {
- if ((len = ztrftime(buffer, bufsize, argv[0], t, 0L)) >= 0 || x==3)
+ if ((len = ztrftime(buffer, bufsize, argv[0], tm, ts.tv_nsec)) >= 0 ||
+ x==3)
break;
buffer = zrealloc(buffer, bufsize *= 2);
}
@@ -207,7 +235,7 @@ getcurrenttime(UNUSED(Param pm))
}
static struct builtin bintab[] = {
- BUILTIN("strftime", 0, bin_strftime, 2, 2, 0, "qrs:", NULL),
+ BUILTIN("strftime", 0, bin_strftime, 1, 3, 0, "qrs:", NULL),
};
static const struct gsu_integer epochseconds_gsu =
diff --git a/Src/Modules/db_gdbm.c b/Src/Modules/db_gdbm.c
index ed702b912..12dd839cf 100644
--- a/Src/Modules/db_gdbm.c
+++ b/Src/Modules/db_gdbm.c
@@ -809,7 +809,7 @@ myfreeparamnode(HashNode hn)
zsfree(pm->node.nam);
/* If this variable was tied by the user, ename was ztrdup'd */
- if (pm->node.flags & PM_TIED && pm->ename) {
+ if (!(pm->node.flags & PM_SPECIAL) && pm->ename) {
zsfree(pm->ename);
pm->ename = NULL;
}
diff --git a/Src/Modules/nearcolor.c b/Src/Modules/nearcolor.c
new file mode 100644
index 000000000..b49ee9afb
--- /dev/null
+++ b/Src/Modules/nearcolor.c
@@ -0,0 +1,210 @@
+/*
+ * nearcolor.c - map colours to nearest match in 88 or 256 colour palette
+ *
+ * This file is part of zsh, the Z shell.
+ *
+ * Copyright (c) 2018 Oliver Kiddle
+ * All rights reserved.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and to distribute modified versions of this software for any
+ * purpose, provided that the above copyright notice and the following
+ * two paragraphs appear in all copies of this software.
+ *
+ * In no event shall Oliver Kiddle or the Zsh Development Group be liable
+ * to any party for direct, indirect, special, incidental, or consequential
+ * damages arising out of the use of this software and its documentation,
+ * even if Oliver Kiddle and the Zsh Development Group have been advised of
+ * the possibility of such damage.
+ *
+ * Oliver Kiddle and the Zsh Development Group specifically disclaim any
+ * warranties, including, but not limited to, the implied warranties of
+ * merchantability and fitness for a particular purpose. The software
+ * provided hereunder is on an "as is" basis, and Oliver Kiddle and the
+ * Zsh Development Group have no obligation to provide maintenance,
+ * support, updates, enhancements, or modifications.
+ *
+ */
+
+#include "nearcolor.mdh"
+#include "nearcolor.pro"
+
+#include <math.h>
+
+struct cielab {
+ double L, a, b;
+};
+typedef struct cielab *Cielab;
+
+static double
+deltae(Cielab lab1, Cielab lab2)
+{
+ /* taking square root unnecessary as we're just comparing values */
+ return pow(lab1->L - lab2->L, 2) +
+ pow(lab1->a - lab2->a, 2) +
+ pow(lab1->b - lab2->b, 2);
+}
+
+static void
+RGBtoLAB(int red, int green, int blue, Cielab lab)
+{
+ double R = red / 255.0;
+ double G = green / 255.0;
+ double B = blue / 255.0;
+ R = 100.0 * (R > 0.04045 ? pow((R + 0.055) / 1.055, 2.4) : R / 12.92);
+ G = 100.0 * (G > 0.04045 ? pow((G + 0.055) / 1.055, 2.4) : G / 12.92);
+ B = 100.0 * (B > 0.04045 ? pow((B + 0.055) / 1.055, 2.4) : B / 12.92);
+
+ /* Observer. = 2 degrees, Illuminant = D65 */
+ double X = (R * 0.4124 + G * 0.3576 + B * 0.1805) / 95.047;
+ double Y = (R * 0.2126 + G * 0.7152 + B * 0.0722) / 100.0;
+ double Z = (R * 0.0193 + G * 0.1192 + B * 0.9505) / 108.883;
+
+ X = (X > 0.008856) ? pow(X, 1.0/3.0) : (7.787 * X) + (16.0 / 116.0);
+ Y = (Y > 0.008856) ? pow(Y, 1.0/3.0) : (7.787 * Y) + (16.0 / 116.0);
+ Z = (Z > 0.008856) ? pow(Z, 1.0/3.0) : (7.787 * Z) + (16.0 / 116.0);
+
+ lab->L = (116.0 * Y) - 16.0;
+ lab->a = 500.0 * (X - Y);
+ lab->b = 200.0 * (Y - Z);
+}
+
+static int
+mapRGBto88(int red, int green, int blue)
+{
+ int component[] = { 0, 0x8b, 0xcd, 0xff, 0x2e, 0x5c, 0x8b, 0xa2, 0xb9, 0xd0, 0xe7 };
+ struct cielab orig, next;
+ double nextl, bestl = -1;
+ int r, g, b;
+ int comp_r = 0, comp_g = 0, comp_b = 0;
+
+ /* Get original value */
+ RGBtoLAB(red, green, blue, &orig);
+
+ /* try every one of the 72 colours */
+ for (r = 0; r < 11; r++) {
+ for (g = 0; g <= 3; g++) {
+ for (b = 0; b <= 3; b++) {
+ if (r > 3) g = b = r; /* advance inner loops to the block of greys */
+ RGBtoLAB(component[r], component[g], component[b], &next);
+ nextl = deltae(&orig, &next);
+ if (nextl < bestl || bestl < 0) {
+ bestl = nextl;
+ comp_r = r;
+ comp_g = g;
+ comp_b = b;
+ }
+ }
+ }
+ }
+
+ return (comp_r > 3) ? 77 + comp_r :
+ 16 + (comp_r * 16) + (comp_g * 4) + comp_b;
+}
+
+/*
+ * Convert RGB to nearest colour in the 256 colour range
+ */
+static int
+mapRGBto256(int red, int green, int blue)
+{
+ int component[] = {
+ 0, 0x5f, 0x87, 0xaf, 0xd7, 0xff,
+ 0x8, 0x12, 0x1c, 0x26, 0x30, 0x3a, 0x44, 0x4e,
+ 0x58, 0x62, 0x6c, 0x76, 0x80, 0x8a, 0x94, 0x9e,
+ 0xa8, 0xb2, 0xbc, 0xc6, 0xd0, 0xda, 0xe4, 0xee
+ };
+ struct cielab orig, next;
+ double nextl, bestl = -1;
+ int r, g, b;
+ int comp_r = 0, comp_g = 0, comp_b = 0;
+
+ /* Get original value */
+ RGBtoLAB(red, green, blue, &orig);
+
+ for (r = 0; r < sizeof(component)/sizeof(*component); r++) {
+ for (g = 0; g <= 5; g++) {
+ for (b = 0; b <= 5; b++) {
+ if (r > 5) g = b = r; /* advance inner loops to the block of greys */
+ RGBtoLAB(component[r], component[g], component[b], &next);
+ nextl = deltae(&orig, &next);
+ if (nextl < bestl || bestl < 0) {
+ bestl = nextl;
+ comp_r = r;
+ comp_g = g;
+ comp_b = b;
+ }
+ }
+ }
+ }
+
+ return (comp_r > 5) ? 226 + comp_r :
+ 16 + (comp_r * 36) + (comp_g * 6) + comp_b;
+}
+
+static int
+getnearestcolor(UNUSED(Hookdef dummy), Color_rgb col)
+{
+ /* we add 1 to the colours so that colour 0 (black) is
+ * distinguished from runhookdef() indicating that no
+ * hook function is registered */
+ if (tccolours == 256)
+ return mapRGBto256(col->red, col->green, col->blue) + 1;
+ if (tccolours == 88)
+ return mapRGBto88(col->red, col->green, col->blue) + 1;
+ return -1;
+}
+
+static struct features module_features = {
+ NULL, 0,
+ NULL, 0,
+ NULL, 0,
+ NULL, 0,
+ 0
+};
+
+/**/
+int
+setup_(UNUSED(Module m))
+{
+ return 0;
+}
+
+/**/
+int
+features_(Module m, char ***features)
+{
+ *features = featuresarray(m, &module_features);
+ return 0;
+}
+
+/**/
+int
+enables_(Module m, int **enables)
+{
+ return handlefeatures(m, &module_features, enables);
+}
+
+/**/
+int
+boot_(Module m)
+{
+ addhookfunc("get_color_attr", (Hookfn) getnearestcolor);
+ return 0;
+}
+
+/**/
+int
+cleanup_(Module m)
+{
+ deletehookfunc("get_color_attr", (Hookfn) getnearestcolor);
+ return setfeatureenables(m, &module_features, NULL);
+}
+
+/**/
+int
+finish_(UNUSED(Module m))
+{
+ return 0;
+}
diff --git a/Src/Modules/nearcolor.mdd b/Src/Modules/nearcolor.mdd
new file mode 100644
index 000000000..2fcdaf04e
--- /dev/null
+++ b/Src/Modules/nearcolor.mdd
@@ -0,0 +1,5 @@
+name=zsh/nearcolor
+link=dynamic
+load=no
+
+objects="nearcolor.o"
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index 783c36df3..76824cf58 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -75,6 +75,8 @@ paramtypestr(Param pm)
val = dyncat(val, "-readonly");
if (f & PM_TAGGED)
val = dyncat(val, "-tag");
+ if (f & PM_TIED)
+ val = dyncat(val, "-tied");
if (f & PM_EXPORTED)
val = dyncat(val, "-export");
if (f & PM_UNIQUE)
@@ -2194,67 +2196,67 @@ static const struct gsu_array historywords_gsu =
static struct paramdef partab[] = {
SPECIALPMDEF("aliases", 0,
&pmraliases_gsu, getpmralias, scanpmraliases),
- SPECIALPMDEF("builtins", PM_READONLY, NULL, getpmbuiltin, scanpmbuiltins),
+ SPECIALPMDEF("builtins", PM_READONLY_SPECIAL, NULL, getpmbuiltin, scanpmbuiltins),
SPECIALPMDEF("commands", 0, &pmcommands_gsu, getpmcommand, scanpmcommands),
SPECIALPMDEF("dirstack", PM_ARRAY,
&dirs_gsu, NULL, NULL),
SPECIALPMDEF("dis_aliases", 0,
&pmdisraliases_gsu, getpmdisralias, scanpmdisraliases),
- SPECIALPMDEF("dis_builtins", PM_READONLY,
+ SPECIALPMDEF("dis_builtins", PM_READONLY_SPECIAL,
NULL, getpmdisbuiltin, scanpmdisbuiltins),
SPECIALPMDEF("dis_functions", 0,
&pmdisfunctions_gsu, getpmdisfunction, scanpmdisfunctions),
- SPECIALPMDEF("dis_functions_source", PM_READONLY, NULL,
+ SPECIALPMDEF("dis_functions_source", PM_READONLY_SPECIAL, NULL,
getpmdisfunction_source, scanpmdisfunction_source),
SPECIALPMDEF("dis_galiases", 0,
&pmdisgaliases_gsu, getpmdisgalias, scanpmdisgaliases),
- SPECIALPMDEF("dis_patchars", PM_ARRAY|PM_READONLY,
+ SPECIALPMDEF("dis_patchars", PM_ARRAY|PM_READONLY_SPECIAL,
&dispatchars_gsu, NULL, NULL),
- SPECIALPMDEF("dis_reswords", PM_ARRAY|PM_READONLY,
+ SPECIALPMDEF("dis_reswords", PM_ARRAY|PM_READONLY_SPECIAL,
&disreswords_gsu, NULL, NULL),
SPECIALPMDEF("dis_saliases", 0,
&pmdissaliases_gsu, getpmdissalias, scanpmdissaliases),
- SPECIALPMDEF("funcfiletrace", PM_ARRAY|PM_READONLY,
+ SPECIALPMDEF("funcfiletrace", PM_ARRAY|PM_READONLY_SPECIAL,
&funcfiletrace_gsu, NULL, NULL),
- SPECIALPMDEF("funcsourcetrace", PM_ARRAY|PM_READONLY,
+ SPECIALPMDEF("funcsourcetrace", PM_ARRAY|PM_READONLY_SPECIAL,
&funcsourcetrace_gsu, NULL, NULL),
- SPECIALPMDEF("funcstack", PM_ARRAY|PM_READONLY,
+ SPECIALPMDEF("funcstack", PM_ARRAY|PM_READONLY_SPECIAL,
&funcstack_gsu, NULL, NULL),
SPECIALPMDEF("functions", 0, &pmfunctions_gsu, getpmfunction,
scanpmfunctions),
- SPECIALPMDEF("functions_source", PM_READONLY, NULL,
+ SPECIALPMDEF("functions_source", PM_READONLY_SPECIAL, NULL,
getpmfunction_source, scanpmfunction_source),
- SPECIALPMDEF("functrace", PM_ARRAY|PM_READONLY,
+ SPECIALPMDEF("functrace", PM_ARRAY|PM_READONLY_SPECIAL,
&functrace_gsu, NULL, NULL),
SPECIALPMDEF("galiases", 0,
&pmgaliases_gsu, getpmgalias, scanpmgaliases),
- SPECIALPMDEF("history", PM_READONLY,
+ SPECIALPMDEF("history", PM_READONLY_SPECIAL,
NULL, getpmhistory, scanpmhistory),
- SPECIALPMDEF("historywords", PM_ARRAY|PM_READONLY,
+ SPECIALPMDEF("historywords", PM_ARRAY|PM_READONLY_SPECIAL,
&historywords_gsu, NULL, NULL),
- SPECIALPMDEF("jobdirs", PM_READONLY,
+ SPECIALPMDEF("jobdirs", PM_READONLY_SPECIAL,
NULL, getpmjobdir, scanpmjobdirs),
- SPECIALPMDEF("jobstates", PM_READONLY,
+ SPECIALPMDEF("jobstates", PM_READONLY_SPECIAL,
NULL, getpmjobstate, scanpmjobstates),
- SPECIALPMDEF("jobtexts", PM_READONLY,
+ SPECIALPMDEF("jobtexts", PM_READONLY_SPECIAL,
NULL, getpmjobtext, scanpmjobtexts),
- SPECIALPMDEF("modules", PM_READONLY,
+ SPECIALPMDEF("modules", PM_READONLY_SPECIAL,
NULL, getpmmodule, scanpmmodules),
SPECIALPMDEF("nameddirs", 0,
&pmnameddirs_gsu, getpmnameddir, scanpmnameddirs),
SPECIALPMDEF("options", 0,
&pmoptions_gsu, getpmoption, scanpmoptions),
- SPECIALPMDEF("parameters", PM_READONLY,
+ SPECIALPMDEF("parameters", PM_READONLY_SPECIAL,
NULL, getpmparameter, scanpmparameters),
- SPECIALPMDEF("patchars", PM_ARRAY|PM_READONLY,
+ SPECIALPMDEF("patchars", PM_ARRAY|PM_READONLY_SPECIAL,
&patchars_gsu, NULL, NULL),
- SPECIALPMDEF("reswords", PM_ARRAY|PM_READONLY,
+ SPECIALPMDEF("reswords", PM_ARRAY|PM_READONLY_SPECIAL,
&reswords_gsu, NULL, NULL),
SPECIALPMDEF("saliases", 0,
&pmsaliases_gsu, getpmsalias, scanpmsaliases),
- SPECIALPMDEF("userdirs", PM_READONLY,
+ SPECIALPMDEF("userdirs", PM_READONLY_SPECIAL,
NULL, getpmuserdir, scanpmuserdirs),
- SPECIALPMDEF("usergroups", PM_READONLY,
+ SPECIALPMDEF("usergroups", PM_READONLY_SPECIAL,
NULL, getpmusergroups, scanpmusergroups)
};
diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c
index 50a6a9bb2..7c736072b 100644
--- a/Src/Modules/stat.c
+++ b/Src/Modules/stat.c
@@ -198,10 +198,8 @@ stattimeprint(time_t tim, long nsecs, char *outbuf, int flags)
if (flags & STF_STRING) {
char *oend = outbuf + strlen(outbuf);
/* Where the heck does "40" come from? */
- int len = ztrftime(oend, 40, timefmt, (flags & STF_GMT) ? gmtime(&tim) :
+ ztrftime(oend, 40, timefmt, (flags & STF_GMT) ? gmtime(&tim) :
localtime(&tim), nsecs);
- if (len > 0)
- metafy(oend, len, META_NOALLOC);
if (flags & STF_RAW)
strcat(oend, ")");
}
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 8eca39447..0a454ad5f 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -3160,9 +3160,7 @@ matcheq(Cmatch a, Cmatch b)
matchstreq(a->ppre, b->ppre) &&
matchstreq(a->psuf, b->psuf) &&
matchstreq(a->suf, b->suf) &&
- ((!a->disp && !b->disp && matchstreq(a->str, b->str)) ||
- (a->disp && b->disp && !strcmp(a->disp, b->disp) &&
- matchstreq(a->str, b->str)));
+ matchstreq(a->str, b->str);
}
/* Make an array from a linked list. The second argument says whether *
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index e768aee5d..429c8159f 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -1096,6 +1096,7 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop)
p += len;
if (*p) {
int arg = 0, is_fg;
+ zattr atr;
if (idigit(*p))
arg = zstrtol(p, &p, 10);
@@ -1159,13 +1160,13 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop)
/* colours must be ASCII */
if (*p == '{') {
p++;
- arg = match_colour((const char **)&p, is_fg, 0);
+ atr = match_colour((const char **)&p, is_fg, 0);
if (*p == '}')
p++;
} else
- arg = match_colour(NULL, is_fg, arg);
- if (arg >= 0 && dopr)
- set_colour_attribute(arg, is_fg ? COL_SEQ_FG :
+ atr = match_colour(NULL, is_fg, arg);
+ if (atr != TXT_ERROR && dopr)
+ set_colour_attribute(atr, is_fg ? COL_SEQ_FG :
COL_SEQ_BG, 0);
break;
case ZWC('f'):
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 5526e0ad0..cb1c01042 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -561,9 +561,9 @@ cd_init(char *nam, char *hide, char *mlen, char *sep,
if (str->str == str->match)
str->str = ztrdup(str->str);
if (hide[1] && str->str[0] == '-' && str->str[1] == '-')
- strcpy(str->str, str->str + 2);
+ memmove(str->str, str->str + 2, strlen(str->str) - 1);
else if (str->str[0] == '-' || str->str[0] == '+')
- strcpy(str->str, str->str + 1);
+ memmove(str->str, str->str + 1, strlen(str->str));
}
}
for (ap = args; *args &&
diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h
index 8261da92b..f06c56483 100644
--- a/Src/Zle/zle.h
+++ b/Src/Zle/zle.h
@@ -430,7 +430,7 @@ enum {
*/
struct region_highlight {
/* Attributes turned on in the region */
- int atr;
+ zattr atr;
/* Start of the region */
int start;
/* Start of the region in metafied ZLE line */
@@ -488,7 +488,7 @@ typedef struct {
* need the effect; 'off' attributes are only present for the
* last character in the sequence.
*/
- int atr;
+ zattr atr;
} REFRESH_ELEMENT;
/* A string of screen cells */
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index d0dd1ef06..1f293845f 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -149,7 +149,7 @@ char *lpromptbuf, *rpromptbuf;
/* Text attributes after displaying prompts */
/**/
-unsigned pmpt_attr, rpmpt_attr;
+zattr pmpt_attr, rpmpt_attr;
/* number of lines displayed */
@@ -208,7 +208,7 @@ int predisplaylen, postdisplaylen;
* displayed on screen.
*/
-static int default_atr_on, special_atr_on;
+static zattr default_atr_on, special_atr_on;
/*
* Array of region highlights, no special termination.
@@ -521,7 +521,7 @@ unset_region_highlight(Param pm, int exp)
/* The last attributes that were on. */
-static int lastatr;
+static zattr lastatr;
/*
* Clear the last attributes that we set: used when we're going
@@ -560,7 +560,7 @@ tcoutclear(int cap)
/**/
void
-zwcputc(const REFRESH_ELEMENT *c, int *curatrp)
+zwcputc(const REFRESH_ELEMENT *c, zattr *curatrp)
{
/*
* Safety: turn attributes off if last heard of turned on.
@@ -638,7 +638,7 @@ static int
zwcwrite(const REFRESH_STRING s, size_t i)
{
size_t j;
- int curatr = 0;
+ zattr curatr = 0;
for (j = 0; j < i; j++)
zwcputc(s + j, &curatr);
@@ -891,7 +891,7 @@ snextline(Rparams rpms)
/**/
static void
-settextattributes(int atr)
+settextattributes(zattr atr)
{
if (txtchangeisset(atr, TXTNOBOLDFACE))
tsetcap(TCALLATTRSOFF, 0);
@@ -992,7 +992,7 @@ zrefresh(void)
int tmppos; /* t - tmpline */
int tmpalloced; /* flag to free tmpline when finished */
int remetafy; /* flag that zle line is metafied */
- int txtchange; /* attributes set after prompts */
+ zattr txtchange; /* attributes set after prompts */
int rprompt_off = 1; /* Offset of rprompt from right of screen */
struct rparams rpms;
#ifdef MULTIBYTE_SUPPORT
@@ -1212,8 +1212,9 @@ zrefresh(void)
rpms.s = nbuf[rpms.ln = 0] + lpromptw;
rpms.sen = *nbuf + winw;
for (t = tmpline, tmppos = 0; tmppos < tmpll; t++, tmppos++) {
- int base_atr_on = default_atr_on, base_atr_off = 0, ireg;
- int all_atr_on, all_atr_off;
+ unsigned ireg;
+ zattr base_atr_on = default_atr_on, base_atr_off = 0;
+ zattr all_atr_on, all_atr_off;
struct region_highlight *rhp;
/*
* Calculate attribute based on region.
@@ -1446,7 +1447,8 @@ zrefresh(void)
more_end = 1;
if (statusline) {
- int outll, outsz, all_atr_on, all_atr_off;
+ int outll, outsz;
+ zattr all_atr_on, all_atr_off;
char *statusdup = ztrdup(statusline);
ZLE_STRING_T outputline =
stringaszleline(statusdup, 0, &outll, &outsz, NULL);
@@ -1672,7 +1674,7 @@ zrefresh(void)
/* output the right-prompt if appropriate */
if (put_rpmpt && !iln && !oput_rpmpt) {
- int attrchange;
+ zattr attrchange;
moveto(0, winw - rprompt_off - rpromptw);
zputs(rpromptbuf, shout);
@@ -1926,7 +1928,7 @@ refreshline(int ln)
/* 3: main display loop - write out the buffer using whatever tricks we can */
for (;;) {
- int now_off;
+ zattr now_off;
#ifdef MULTIBYTE_SUPPORT
if ((!nl->chr || nl->chr != WEOF) && (!ol->chr || ol->chr != WEOF)) {
@@ -2506,8 +2508,9 @@ singlerefresh(ZLE_STRING_T tmpline, int tmpll, int tmpcs)
*vp = zr_zr;
for (t0 = 0; t0 < tmpll; t0++) {
- int base_atr_on = 0, base_atr_off = 0, ireg;
- int all_atr_on, all_atr_off;
+ unsigned ireg;
+ zattr base_atr_on = 0, base_atr_off = 0;
+ zattr all_atr_on, all_atr_off;
struct region_highlight *rhp;
/*
* Calculate attribute based on region.
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 22c381237..2b25d6b2e 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -2431,6 +2431,7 @@ printfmt(char *fmt, int n, int dopr, int doesc)
/* Handle the `%' stuff (%% == %, %n == <number of matches>). */
if (doesc && *p == '%') {
int arg = 0, is_fg;
+ zattr atr;
if (idigit(*++p))
arg = zstrtol(p, &p, 10);
if (*p) {
@@ -2482,13 +2483,13 @@ printfmt(char *fmt, int n, int dopr, int doesc)
is_fg = (*p == 'F');
if (p[1] == '{') {
p += 2;
- arg = match_colour((const char **)&p, is_fg, 0);
+ atr = match_colour((const char **)&p, is_fg, 0);
if (*p != '}')
p--;
} else
- arg = match_colour(NULL, is_fg, arg);
- if (arg >= 0)
- set_colour_attribute(arg, is_fg ? COL_SEQ_FG :
+ atr = match_colour(NULL, is_fg, arg);
+ if (atr != TXT_ERROR)
+ set_colour_attribute(atr, is_fg ? COL_SEQ_FG :
COL_SEQ_BG, 0);
break;
case 'f':
diff --git a/Src/builtin.c b/Src/builtin.c
index 4abc7da35..8dcdcc024 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -64,7 +64,7 @@ static struct builtin builtins[] =
BUILTIN("enable", 0, bin_enable, 0, -1, BIN_ENABLE, "afmprs", NULL),
BUILTIN("eval", BINF_PSPECIAL, bin_eval, 0, -1, BIN_EVAL, NULL, NULL),
BUILTIN("exit", BINF_PSPECIAL, bin_break, 0, 1, BIN_EXIT, NULL, NULL),
- BUILTIN("export", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "E:%F:%HL:%R:%TUZ:%afhi:%lp:%rtu", "xg"),
+ BUILTIN("export", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, BIN_EXPORT, "E:%F:%HL:%R:%TUZ:%afhi:%lp:%rtu", "xg"),
BUILTIN("false", 0, bin_false, 0, -1, 0, NULL, NULL),
/*
* We used to behave as if the argument to -e was optional.
@@ -2258,6 +2258,22 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
} else if (pm->env && !(pm->node.flags & PM_HASHELEM))
delenv(pm);
DPUTS(ASG_ARRAYP(asg), "BUG: typeset got array value where scalar expected");
+ if (altpm && !(pm->node.flags & PM_SPECIAL)) {
+ struct tieddata* tdp = (struct tieddata *) pm->u.data;
+ if (tdp) {
+ if (tdp->joinchar != joinchar && !asg->value.scalar) {
+ /*
+ * Reassign the scalar to itself to do the splitting with
+ * the new joinchar
+ */
+ tdp->joinchar = joinchar;
+ if (!(pm = assignsparam(pname, ztrdup(getsparam(pname)), 0)))
+ return NULL;
+ }
+ }
+ else
+ DPUTS(!tdp, "BUG: no join character to update");
+ }
if (asg->value.scalar &&
!(pm = assignsparam(pname, ztrdup(asg->value.scalar), 0)))
return NULL;
@@ -2325,6 +2341,9 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
zerrnam(cname, "%s: can only have a single instance", pname);
return pm;
}
+
+ on |= pm->node.flags & PM_TIED;
+
/*
* For specials, we keep the same struct but zero everything.
* Maybe it would be easier to create a new struct but copy
@@ -2476,7 +2495,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
return NULL;
}
- if (altpm && PM_TYPE(pm->node.flags) == PM_SCALAR) {
+ if (altpm && PM_TYPE(pm->node.flags) == PM_SCALAR && !(pm->node.flags & PM_SPECIAL)) {
/*
* It seems safer to set this here than in createparam(),
* to make sure we only ever use the colonarr functions
@@ -2646,7 +2665,17 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
/* Given no arguments, list whatever the options specify. */
if (OPT_ISSET(ops,'p')) {
- printflags |= PRINT_TYPESET;
+
+ if (isset(POSIXBUILTINS) && SHELL_EMULATION() != EMULATE_KSH) {
+ if (func == BIN_EXPORT)
+ printflags |= PRINT_POSIX_EXPORT;
+ else if (func == BIN_READONLY)
+ printflags |= PRINT_POSIX_READONLY;
+ else
+ printflags |= PRINT_TYPESET;
+ } else
+ printflags |= PRINT_TYPESET;
+
if (OPT_HASARG(ops,'p')) {
char *eptr;
int pflag = (int)zstrtol(OPT_ARG(ops,'p'), &eptr, 10);
@@ -2662,13 +2691,20 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
}
hasargs = *argv != NULL || (assigns && firstnode(assigns));
if (!hasargs) {
+ int exclude = 0;
if (!OPT_ISSET(ops,'p')) {
if (!(on|roff))
printflags |= PRINT_TYPE;
if (roff || OPT_ISSET(ops,'+'))
printflags |= PRINT_NAMEONLY;
+ } else if (printflags & (PRINT_POSIX_EXPORT|PRINT_POSIX_READONLY)) {
+ /*
+ * For POSIX export/readonly, exclude non-scalars unless
+ * explicitly requested.
+ */
+ exclude = (PM_ARRAY|PM_HASHED) & ~(on|roff);
}
- scanhashtable(paramtab, 1, on|roff, 0, paramtab->printnode, printflags);
+ scanhashtable(paramtab, 1, on|roff, exclude, paramtab->printnode, printflags);
unqueue_signals();
return 0;
}
@@ -2683,6 +2719,7 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
struct asgment asg0, asg2;
char *oldval = NULL, *joinstr;
int joinchar, nargs;
+ int already_tied = 0;
if (OPT_ISSET(ops,'m')) {
zwarnnam(name, "incompatible options for -T");
@@ -2765,47 +2802,81 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
joinchar = joinstr[1] ^ 32;
else
joinchar = *joinstr;
- /*
- * Keep the old value of the scalar. We need to do this
- * here as if it is already tied to the same array it
- * will be unset when we retie the array. This is all
- * so that typeset -T is idempotent.
- *
- * We also need to remember here whether the damn thing is
- * exported and pass that along. Isn't the world complicated?
- */
- if ((pm = (Param) paramtab->getnode(paramtab, asg0.name))
- && !(pm->node.flags & PM_UNSET)
- && (locallevel == pm->level || !(on & PM_LOCAL))) {
- if (pm->node.flags & PM_TIED) {
+
+ pm = (Param) paramtab->getnode(paramtab, asg0.name);
+ apm = (Param) paramtab->getnode(paramtab, asg->name);
+
+ if (pm && (pm->node.flags & (PM_SPECIAL|PM_TIED)) == (PM_SPECIAL|PM_TIED)) {
+ /*
+ * Only allow typeset -T on special tied parameters if the tied
+ * parameter and join char are the same
+ */
+ if (strcmp(pm->ename, asg->name) || !(apm->node.flags & PM_SPECIAL)) {
+ zwarnnam(name, "%s special parameter can only be tied to special parameter %s", asg0.name, pm->ename);
+ unqueue_signals();
+ return 1;
+ }
+ if (joinchar != ':') {
+ zwarnnam(name, "cannot change the join character of special tied parameters");
unqueue_signals();
- if (PM_TYPE(pm->node.flags) != PM_SCALAR) {
- zwarnnam(name, "already tied as non-scalar: %s", asg0.name);
- } else if (!strcmp(asg->name, pm->ename)) {
+ return 1;
+ }
+ already_tied = 1;
+ } else if (apm && (apm->node.flags & (PM_SPECIAL|PM_TIED)) == (PM_SPECIAL|PM_TIED)) {
+ /*
+ * For the array variable, this covers attempts to tie the
+ * array to a different scalar or to the scalar after it has
+ * been made non-special
+ */
+ zwarnnam(name, "%s special parameter can only be tied to special parameter %s", asg->name, apm->ename);
+ unqueue_signals();
+ return 1;
+ } else if (pm) {
+ if (!(pm->node.flags & PM_UNSET)
+ && (locallevel == pm->level || !(on & PM_LOCAL))) {
+ if (pm->node.flags & PM_TIED) {
+ if (PM_TYPE(pm->node.flags) != PM_SCALAR) {
+ zwarnnam(name, "already tied as non-scalar: %s", asg0.name);
+ unqueue_signals();
+ return 1;
+ } else if (!strcmp(asg->name, pm->ename)) {
+ already_tied = 1;
+ } else {
+ zwarnnam(name, "can't tie already tied scalar: %s",
+ asg0.name);
+ unqueue_signals();
+ return 1;
+ }
+ } else {
/*
- * Already tied in the fashion requested.
+ * Variable already exists in the current scope but is not tied.
+ * We're preserving its value and export attribute but no other
+ * attributes upon converting to "tied".
*/
- struct tieddata *tdp = (struct tieddata*)pm->u.data;
- int flags = (asg->flags & ASG_KEY_VALUE) ?
- ASSPM_KEY_VALUE : 0;
- /* Update join character */
- tdp->joinchar = joinchar;
- if (asg0.value.scalar)
- assignsparam(asg0.name, ztrdup(asg0.value.scalar), 0);
- else if (asg->value.array)
- assignaparam(
- asg->name, zlinklist2array(asg->value.array),flags);
- return 0;
- } else {
- zwarnnam(name, "can't tie already tied scalar: %s",
- asg0.name);
+ if (!asg0.value.scalar && !asg->value.array &&
+ !(PM_TYPE(pm->node.flags) & (PM_ARRAY|PM_HASHED)))
+ oldval = ztrdup(getsparam(asg0.name));
+ on |= (pm->node.flags & ~roff) & PM_EXPORTED;
}
- return 1;
}
- if (!asg0.value.scalar && !asg->value.array &&
- !(PM_TYPE(pm->node.flags) & (PM_ARRAY|PM_HASHED)))
- oldval = ztrdup(getsparam(asg0.name));
- on |= (pm->node.flags & PM_EXPORTED);
+ }
+ if (already_tied) {
+ int ret;
+ /*
+ * If already tied, we still need to call typeset_single on
+ * both the array and colonarray, if only to update the attributes
+ * of both, and of course to set the new value if one is provided
+ * for either of them.
+ */
+ ret = !(typeset_single(name, asg0.name, pm,
+ func, on, off, roff, &asg0, apm,
+ ops, joinchar) &&
+ typeset_single(name, asg->name, apm,
+ func, (on | PM_ARRAY) & ~PM_EXPORTED,
+ off & ~PM_ARRAY, roff, asg, NULL, ops, 0)
+ );
+ unqueue_signals();
+ return ret;
}
/*
* Create the tied array; this is normal except that
@@ -2832,9 +2903,7 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
* Create the tied colonarray. We make it as a normal scalar
* and fix up the oddities later.
*/
- if (!(pm=typeset_single(name, asg0.name,
- (Param)paramtab->getnode(paramtab,
- asg0.name),
+ if (!(pm=typeset_single(name, asg0.name, pm,
func, on, off, roff, &asg0, apm,
ops, joinchar))) {
if (oldval)
@@ -5578,8 +5647,9 @@ bin_break(char *name, char **argv, UNUSED(Options ops), int func)
if (stopmsg || (zexit(0,2), !stopmsg)) {
retflag = 1;
breaks = loops;
- exit_pending = (num << 1) | 1;
+ exit_pending = 1;
exit_level = locallevel;
+ exit_val = num;
}
} else
zexit(num, 0);
@@ -5629,6 +5699,42 @@ checkjobs(void)
/**/
int shell_exiting;
+/*
+ * Exit status if explicitly set by an exit command.
+ * This is complicated by the fact the exit command may be within
+ * a function whose state we need to unwind (exit_pending set
+ * and the exit will happen up the stack), or we may need to execute
+ * additional code such as a trap after we are committed to exiting
+ * (shell_exiting and the exit will happen down the stack).
+ *
+ * It's lucky this is all so obvious there is no possibility of any
+ * bugs. (C.f. the entire rest of the shell.)
+ */
+/**/
+int exit_val;
+
+/*
+ * Actually exit the shell, working out the status locally.
+ * This is exit_val if "exit" has explicitly been called in the shell,
+ * else lastval.
+ */
+
+/**/
+void
+realexit(void)
+{
+ exit((shell_exiting || exit_pending) ? exit_val : lastval);
+}
+
+/* As realexit(), but call _exit instead */
+
+/**/
+void
+_realexit(void)
+{
+ _exit((shell_exiting || exit_pending) ? exit_val : lastval);
+}
+
/* exit the shell. val is the return value of the shell. *
* from_where is
* 1 if zexit is called because of a signal
@@ -5640,7 +5746,12 @@ int shell_exiting;
mod_export void
zexit(int val, int from_where)
{
- /* Don't do anything recursively: see below */
+ /*
+ * Don't do anything recursively: see below.
+ * Do, however, update exit status --- there's no nesting,
+ * a later value always overrides an earlier.
+ */
+ exit_val = val;
if (shell_exiting == -1)
return;
@@ -5688,7 +5799,7 @@ zexit(int val, int from_where)
#endif
}
}
- lastval = val;
+ lastval = exit_val;
/*
* Now we are committed to exiting any previous state
* is irrelevant. Ensure trap can run.
@@ -5702,9 +5813,9 @@ zexit(int val, int from_where)
release_pgrp();
}
if (mypid != getpid())
- _exit(val);
+ _exit(exit_val);
else
- exit(val);
+ exit(exit_val);
}
/* . (dot), source */
diff --git a/Src/exec.c b/Src/exec.c
index b9af9ea63..042ba065a 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -738,7 +738,7 @@ execute(LinkList args, int flags, int defpath)
if (!search_defpath(arg0, pbuf, PATH_MAX)) {
if (commandnotfound(arg0, args) == 0)
- _exit(lastval);
+ _realexit();
zerr("command not found: %s", arg0);
_exit(127);
}
@@ -802,7 +802,7 @@ execute(LinkList args, int flags, int defpath)
if (eno)
zerr("%e: %s", eno, arg0);
else if (commandnotfound(arg0, args) == 0)
- _exit(lastval);
+ _realexit();
else
zerr("command not found: %s", arg0);
_exit((eno == EACCES || eno == ENOEXEC) ? 126 : 127);
@@ -1012,6 +1012,7 @@ entersubsh(int flags, struct entersubsh_ret *retp)
unsettrap(sig);
monitor = isset(MONITOR);
job_control_ok = monitor && (flags & ESUB_JOB_CONTROL) && isset(POSIXJOBS);
+ exit_val = 0; /* parent exit status is irrelevant */
if (flags & ESUB_NOMONITOR)
opts[MONITOR] = 0;
if (!isset(MONITOR)) {
@@ -1036,7 +1037,7 @@ entersubsh(int flags, struct entersubsh_ret *retp)
if (!(flags & ESUB_ASYNC))
attachtty(jobtab[thisjob].gleader);
}
- if (retp) {
+ if (retp && !(flags & ESUB_ASYNC)) {
retp->gleader = jobtab[list_pipe_job].gleader;
retp->list_pipe_job = list_pipe_job;
}
@@ -1058,12 +1059,13 @@ entersubsh(int flags, struct entersubsh_ret *retp)
!jobtab[list_pipe_job].gleader)
jobtab[list_pipe_job].gleader = jobtab[thisjob].gleader;
setpgrp(0L, jobtab[thisjob].gleader);
- if (!(flags & ESUB_ASYNC))
+ if (!(flags & ESUB_ASYNC)) {
attachtty(jobtab[thisjob].gleader);
- if (retp) {
- retp->gleader = jobtab[thisjob].gleader;
- if (list_pipe_job != thisjob)
- retp->list_pipe_job = list_pipe_job;
+ if (retp) {
+ retp->gleader = jobtab[thisjob].gleader;
+ if (list_pipe_job != thisjob)
+ retp->list_pipe_job = list_pipe_job;
+ }
}
}
}
@@ -1534,9 +1536,9 @@ sublist_done:
if (sigtrapped[SIGEXIT])
dotrap(SIGEXIT);
if (mypid != getpid())
- _exit(lastval);
+ _realexit();
else
- exit(lastval);
+ realexit();
}
if (errreturn) {
retflag = 1;
@@ -2744,7 +2746,10 @@ execcmd_fork(Estate state, int how, int type, Wordcode varspc,
flags |= ESUB_JOB_CONTROL;
*filelistp = jobtab[thisjob].filelist;
entersubsh(flags, &esret);
- write(synch[1], &esret, sizeof(esret));
+ if (write_loop(synch[1], (const void *) &esret, sizeof(esret)) != sizeof(esret)) {
+ zerr("Failed to send entersubsh_ret report: %e", errno);
+ return -1;
+ }
close(synch[1]);
zclose(close_if_forked);
@@ -2930,7 +2935,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
/* autoload the builtin if necessary */
if (!(hn = resolvebuiltin(cmdarg, hn))) {
if (forked)
- _exit(lastval);
+ _realexit();
return;
}
if (type != WC_TYPESET)
@@ -3111,7 +3116,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
lastval = 1;
errflag |= ERRFLAG_ERROR;
if (forked)
- _exit(lastval);
+ _realexit();
return;
}
}
@@ -3206,7 +3211,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
lastval = 1;
errflag |= ERRFLAG_ERROR;
if (forked)
- _exit(lastval);
+ _realexit();
return;
} else if (!nullcmd || !*nullcmd || opts[SHNULLCMD]) {
if (!args)
@@ -3226,7 +3231,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
} else if ((cflags & BINF_PREFIX) && (cflags & BINF_COMMAND)) {
lastval = 0;
if (forked)
- _exit(lastval);
+ _realexit();
return;
} else {
/*
@@ -3238,7 +3243,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
zerr("no match");
lastval = 1;
if (forked)
- _exit(lastval);
+ _realexit();
return;
}
cmdoutval = use_cmdoutval ? lastval : 0;
@@ -3256,7 +3261,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
fflush(xtrerr);
}
if (forked)
- _exit(lastval);
+ _realexit();
return;
}
} else if (isset(RESTRICTED) && (cflags & BINF_EXEC) && do_exec) {
@@ -3264,7 +3269,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
(char *) getdata(firstnode(args)));
lastval = 1;
if (forked)
- _exit(lastval);
+ _realexit();
return;
}
@@ -3300,7 +3305,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
if (oautocont >= 0)
opts[AUTOCONTINUE] = oautocont;
if (forked)
- _exit(lastval);
+ _realexit();
return;
}
break;
@@ -3311,7 +3316,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
/* autoload the builtin if necessary */
if (!(hn = resolvebuiltin(cmdarg, hn))) {
if (forked)
- _exit(lastval);
+ _realexit();
return;
}
break;
@@ -3329,7 +3334,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
if (oautocont >= 0)
opts[AUTOCONTINUE] = oautocont;
if (forked)
- _exit(lastval);
+ _realexit();
return;
}
@@ -3408,7 +3413,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
if (oautocont >= 0)
opts[AUTOCONTINUE] = oautocont;
if (forked)
- _exit(lastval);
+ _realexit();
return;
}
}
@@ -3438,7 +3443,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
if (oautocont >= 0)
opts[AUTOCONTINUE] = oautocont;
if (forked)
- _exit(lastval);
+ _realexit();
return;
}
@@ -4114,13 +4119,13 @@ execcmd_exec(Estate state, Execcmd_params eparams,
if (do_exec) {
if (subsh)
- _exit(lastval);
+ _realexit();
/* If we are exec'ing a command, and we are not in a subshell, *
* then check if we should save the history file. */
if (isset(RCS) && interact && !nohistsave)
savehistfile(NULL, 1, HFILE_USE_OPTIONS);
- exit(lastval);
+ realexit();
}
if (restorelist)
restore_params(restorelist, removelist);
@@ -4211,7 +4216,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
closem(FDT_UNUSED, 1);
if (thisjob != -1)
waitjobs();
- _exit(lastval);
+ _realexit();
}
fixfds(save);
@@ -4627,7 +4632,7 @@ getoutput(char *cmd, int qt)
execode(prog, 0, 1, "cmdsubst");
cmdpop();
close(1);
- _exit(lastval);
+ _realexit();
zerr("exit returned in child!!");
kill(getpid(), SIGKILL);
return NULL;
@@ -4800,7 +4805,8 @@ getoutputfile(char *cmd, char **eptr)
}
if ((cmdoutpid = pid = zfork(NULL)) == -1) {
- /* fork or open error */
+ /* fork error */
+ close(fd);
child_unblock();
return nam;
} else if (pid) {
@@ -4821,7 +4827,7 @@ getoutputfile(char *cmd, char **eptr)
execode(prog, 0, 1, "equalsubst");
cmdpop();
close(1);
- _exit(lastval);
+ _realexit();
zerr("exit returned in child!!");
kill(getpid(), SIGKILL);
return NULL;
@@ -4934,7 +4940,7 @@ getproc(char *cmd, char **eptr)
execode(prog, 0, 1, out ? "outsubst" : "insubst");
cmdpop();
zclose(out);
- _exit(lastval);
+ _realexit();
return NULL;
#endif /* HAVE_FIFOS and PATH_DEV_FD not defined */
}
@@ -4982,7 +4988,7 @@ getpipe(char *cmd, int nullexec)
cmdpush(CS_CMDSUBST);
execode(prog, 0, 1, out ? "outsubst" : "insubst");
cmdpop();
- _exit(lastval);
+ _realexit();
return 0;
}
@@ -5923,7 +5929,7 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
* exit command was handled.
*/
stopmsg = 1;
- zexit(exit_pending >> 1, 0);
+ zexit(exit_val, 0);
}
}
diff --git a/Src/hashtable.h b/Src/hashtable.h
index 21398e17c..f6778664e 100644
--- a/Src/hashtable.h
+++ b/Src/hashtable.h
@@ -63,6 +63,7 @@
#define BIN_UNALIAS 29
#define BIN_UNFUNCTION 30
#define BIN_UNSET 31
+#define BIN_EXPORT 32
/* These currently depend on being 0 and 1. */
#define BIN_SETOPT 0
diff --git a/Src/init.c b/Src/init.c
index e9e6be9b4..e7e62e2f7 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -94,6 +94,7 @@ mod_export struct hookdef zshhooks[] = {
HOOKDEF("exit", NULL, HOOKF_ALL),
HOOKDEF("before_trap", NULL, HOOKF_ALL),
HOOKDEF("after_trap", NULL, HOOKF_ALL),
+ HOOKDEF("get_color_attr", NULL, HOOKF_ALL),
};
/* keep executing lists until EOF found */
@@ -157,7 +158,7 @@ loop(int toplevel, int justonce)
* Handle that now.
*/
stopmsg = 1;
- zexit(exit_pending >> 1, 0);
+ zexit(exit_val, 0);
}
if (tok == LEXERR && !lastval)
lastval = 1;
@@ -215,14 +216,14 @@ loop(int toplevel, int justonce)
clearerr(stderr);
}
if (subsh) /* how'd we get this far in a subshell? */
- exit(lastval);
+ realexit();
if (((!interact || sourcelevel) && errflag) || retflag)
break;
if (isset(SINGLECOMMAND) && toplevel) {
dont_queue_signals();
if (sigtrapped[SIGEXIT])
dotrap(SIGEXIT);
- exit(lastval);
+ realexit();
}
if (justonce)
break;
@@ -1358,7 +1359,7 @@ init_misc(char *cmd, char *zsh_name)
bshin = fdopen(SHIN, "r");
execstring(cmd, 0, 1, "cmdarg");
stopmsg = 1;
- zexit(lastval, 0);
+ zexit((exit_pending || shell_exiting) ? exit_val : lastval, 0);
}
if (interact && isset(RCS))
diff --git a/Src/input.c b/Src/input.c
index 9787dedf6..e9989ffe4 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -555,6 +555,7 @@ inpush(char *str, int flags, Alias inalias)
if ((instacktop->alias = inalias))
inalias->inuse = 1;
} else {
+ instacktop->alias = NULL;
/* If we are continuing an alias expansion, record the alias
* expansion in new set of flags (do we need this?)
*/
@@ -691,6 +692,7 @@ char *input_hasalias(void)
{
if (!(flags & INP_CONT))
break;
+ DPUTS(instackptr == instack, "BUG: continuation at bottom of instack");
instackptr--;
if (instackptr->alias)
return instackptr->alias->node.nam;
diff --git a/Src/jobs.c b/Src/jobs.c
index db2e87ec1..ed9f81f26 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -30,6 +30,27 @@
#include "zsh.mdh"
#include "jobs.pro"
+/*
+ * Job control in zsh
+ * ==================
+ *
+ * A 'job' represents a pipeline; see the section JOBS in zshmisc(1)) for an
+ * introduction. The 'struct job's are allocated in the array 'jobtab' which
+ * has 'jobtabsize' elements. The job whose processes we are currently
+ * preparing to execute is identified by the global variable 'thisjob'.
+ *
+ * A 'superjob' is a job that represents a complex shell construct that has been
+ * backgrounded. For example, if one runs '() { vi; echo }', a job is created
+ * for the pipeline 'vi'. If one then backgrounds vi (with ^Z / SIGTSTP),
+ * the shell forks; the parent shell returns to the interactive prompt and
+ * the child shell becomes a new job in the parent shell. The job representing
+ * the child shell to the parent shell is a superjob (STAT_SUPERJOB); the 'vi'
+ * job is marked as a subjob (STAT_SUBJOB) in the parent shell. When the child
+ * shell is resumed (with fg / SIGCONT), it forwards the signal to vi and,
+ * after vi exits, continues executing the remainder of the function.
+ * (See workers/43565.)
+ */
+
/* the process group of the shell at startup (equal to mypgprp, except
when we started without being process group leader */
@@ -40,18 +61,23 @@ mod_export pid_t origpgrp;
/**/
mod_export pid_t mypgrp;
+
+/* the last process group to attach to the terminal */
+
+/**/
+pid_t last_attached_pgrp;
-/* the job we are working on */
+/* the job we are working on, or -1 if none */
/**/
mod_export int thisjob;
-/* the current job (+) */
+/* the current job (%+) */
/**/
mod_export int curjob;
-/* the previous job (-) */
+/* the previous job (%-) */
/**/
mod_export int prevjob;
@@ -454,19 +480,42 @@ update_job(Job jn)
jn->ty = (struct ttyinfo *) zalloc(sizeof(struct ttyinfo));
gettyinfo(jn->ty);
}
- if (jn->stat & STAT_STOPPED) {
- if (jn->stat & STAT_SUBJOB) {
- /* If we have `cat foo|while read a; grep $a bar;done'
- * and have hit ^Z, the sub-job is stopped, but the
- * super-job may still be running, waiting to be stopped
- * or to exit. So we have to send it a SIGTSTP. */
- int i;
-
- if ((i = super_job(job)))
- killpg(jobtab[i].gleader, SIGTSTP);
+ if (jn->stat & STAT_SUBJOB) {
+ /* If we have `cat foo|while read a; grep $a bar;done'
+ * and have hit ^Z, the sub-job is stopped, but the
+ * super-job may still be running, waiting to be stopped
+ * or to exit. So we have to send it a SIGTSTP. */
+ int i;
+
+ jn->stat |= STAT_CHANGED | STAT_STOPPED;
+ if ((i = super_job(job))) {
+ Job sjn = &jobtab[i];
+ killpg(sjn->gleader, SIGTSTP);
+ /*
+ * Job may already be stopped if it consists of only the
+ * forked shell waiting for the subjob -- so mark as
+ * stopped immediately. This ensures we send it (and,
+ * crucially, the subjob, as the visible job used with
+ * fg/bg is the superjob) a SIGCONT if we need it.
+ */
+ sjn->stat |= STAT_CHANGED | STAT_STOPPED;
+ if (isset(NOTIFY) && (sjn->stat & STAT_LOCKED) &&
+ !(sjn->stat & STAT_NOPRINT)) {
+ /*
+ * Print the subjob state, which we don't usually
+ * do, so the user knows something has stopped.
+ * So as not to be confusing, we actually output
+ * the user-visible superjob.
+ */
+ if (printjob(sjn, !!isset(LONGLISTJOBS), 0) &&
+ zleactive)
+ zleentry(ZLE_CMD_REFRESH);
+ }
}
return;
}
+ if (jn->stat & STAT_STOPPED)
+ return;
}
{ /* job is done or stopped, remember return value */
lastval2 = val;
@@ -1020,15 +1069,30 @@ printjob(Job jn, int lng, int synch)
"bogus job number, jn = %L, jobtab = %L, oldjobtab = %L",
(long)jn, (long)jobtab, (long)oldjobtab);
- if (jn->stat & STAT_NOPRINT) {
+ if (jn->stat & STAT_NOPRINT)
skip_print = 1;
- }
if (lng < 0) {
conted = 1;
lng = !!isset(LONGLISTJOBS);
}
+ if (jn->stat & STAT_SUPERJOB &&
+ jn->other)
+ {
+ Job sjn = &jobtab[jn->other];
+ if (sjn->procs || sjn->auxprocs)
+ {
+ /*
+ * A subjob still has process, which must finish before
+ * further excution of the superjob, which the user wants to
+ * know about. So report the status of the subjob as if it
+ * were the user-visible superjob.
+ */
+ jn = sjn;
+ }
+ }
+
/* find length of longest signame, check to see */
/* if we really need to print this job */
@@ -1405,6 +1469,11 @@ addproc(pid_t pid, char *text, int aux, struct timeval *bgtime,
jobtab[thisjob].gleader = gleader;
if (list_pipe_job_used != -1)
jobtab[list_pipe_job_used].gleader = gleader;
+ /*
+ * Record here this is the latest process group to grab the
+ * terminal as attachtty() was run in the subshell.
+ */
+ last_attached_pgrp = gleader;
} else if (!jobtab[thisjob].gleader)
jobtab[thisjob].gleader = pid;
/* attach this process to end of process list of current job */
@@ -1559,10 +1628,8 @@ zwaitjob(int job, int wait_cmd)
errflag = 0; */
- if (subsh) {
+ if (subsh)
killjb(jn, SIGCONT);
- jn->stat &= ~STAT_STOPPED;
- }
if (jn->stat & STAT_SUPERJOB)
if (handle_sub(jn - jobtab, 1))
break;
@@ -1580,6 +1647,17 @@ zwaitjob(int job, int wait_cmd)
return 0;
}
+static void waitonejob(Job jn)
+{
+ if (jn->procs || jn->auxprocs)
+ zwaitjob(jn - jobtab, 0);
+ else {
+ deletejob(jn, 0);
+ pipestats[0] = lastval;
+ numpipestats = 1;
+ }
+}
+
/* wait for running job to finish */
/**/
@@ -1589,13 +1667,11 @@ waitjobs(void)
Job jn = jobtab + thisjob;
DPUTS(thisjob == -1, "No valid job in waitjobs.");
- if (jn->procs || jn->auxprocs)
- zwaitjob(thisjob, 0);
- else {
- deletejob(jn, 0);
- pipestats[0] = lastval;
- numpipestats = 1;
- }
+ /* If there's a subjob, it should finish first. */
+ if (jn->stat & STAT_SUPERJOB)
+ waitonejob(jobtab + jn->other);
+ waitonejob(jn);
+
thisjob = -1;
}
@@ -2284,11 +2360,8 @@ bin_fg(char *name, char **argv, Options ops, int func)
Process p;
if (findproc(pid, &j, &p, 0)) {
- if (j->stat & STAT_STOPPED) {
+ if (j->stat & STAT_STOPPED)
retval = (killjb(j, SIGCONT) != 0);
- if (retval == 0)
- makerunning(j);
- }
if (retval == 0) {
/*
* returns 0 for normal exit, else signal+128
diff --git a/Src/lex.c b/Src/lex.c
index 44ad88043..f43bcc7db 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1613,6 +1613,7 @@ parsestr(char **s)
zerr("parse error near `%c'", err);
else
zerr("parse error");
+ tok = LEXERR;
}
}
return err;
@@ -1626,7 +1627,7 @@ parsestrnoerr(char **s)
zcontext_save();
untokenize(*s);
- inpush(dupstring(*s), 0, NULL);
+ inpush(dupstring_wlen(*s, l), 0, NULL);
strinbeg(0);
lexbuf.len = 0;
lexbuf.ptr = tokstr = *s;
@@ -1658,7 +1659,7 @@ parse_subscript(char *s, int sub, int endchar)
if (!*s || *s == endchar)
return 0;
zcontext_save();
- untokenize(t = dupstring(s));
+ untokenize(t = dupstring_wlen(s, l));
inpush(t, 0, NULL);
strinbeg(0);
/*
@@ -1674,7 +1675,7 @@ parse_subscript(char *s, int sub, int endchar)
* length preservation.
*/
lexbuf.len = 0;
- lexbuf.ptr = tokstr = dupstring(s);
+ lexbuf.ptr = tokstr = dupstring_wlen(s, l);
lexbuf.siz = l + 1;
err = dquote_parse(endchar, sub);
toklen = (int)(lexbuf.ptr - tokstr);
@@ -1713,7 +1714,7 @@ parse_subst_string(char *s)
return 0;
zcontext_save();
untokenize(s);
- inpush(dupstring(s), 0, NULL);
+ inpush(dupstring_wlen(s, l), 0, NULL);
strinbeg(0);
lexbuf.len = 0;
lexbuf.ptr = tokstr = s;
diff --git a/Src/module.c b/Src/module.c
index 4ae78310f..33d75ebbd 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -1390,8 +1390,6 @@ setmathfuncs(char const *nam, MathFunc f, int size, int *e)
if (deletemathfunc(f)) {
zwarnnam(nam, "math function `%s' already deleted", f->name);
ret = 1;
- } else {
- f->flags &= ~MFF_ADDED;
}
}
f++;
diff --git a/Src/params.c b/Src/params.c
index a1c299f60..089a958ae 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -290,7 +290,7 @@ static initparam special_params[] ={
#define GSU(X) BR((GsuScalar)(void *)(&(X)))
#define NULL_GSU BR((GsuScalar)(void *)NULL)
#define IPDEF1(A,B,C) {{NULL,A,PM_INTEGER|PM_SPECIAL|C},BR(NULL),GSU(B),10,0,NULL,NULL,NULL,0}
-IPDEF1("#", pound_gsu, PM_READONLY),
+IPDEF1("#", pound_gsu, PM_READONLY_SPECIAL),
IPDEF1("ERRNO", errno_gsu, PM_UNSET),
IPDEF1("GID", gid_gsu, PM_DONTIMPORT | PM_RESTRICTED),
IPDEF1("EGID", egid_gsu, PM_DONTIMPORT | PM_RESTRICTED),
@@ -300,11 +300,11 @@ IPDEF1("SAVEHIST", savehist_gsu, PM_RESTRICTED),
IPDEF1("SECONDS", intseconds_gsu, 0),
IPDEF1("UID", uid_gsu, PM_DONTIMPORT | PM_RESTRICTED),
IPDEF1("EUID", euid_gsu, PM_DONTIMPORT | PM_RESTRICTED),
-IPDEF1("TTYIDLE", ttyidle_gsu, PM_READONLY),
+IPDEF1("TTYIDLE", ttyidle_gsu, PM_READONLY_SPECIAL),
#define IPDEF2(A,B,C) {{NULL,A,PM_SCALAR|PM_SPECIAL|C},BR(NULL),GSU(B),0,0,NULL,NULL,NULL,0}
IPDEF2("USERNAME", username_gsu, PM_DONTIMPORT|PM_RESTRICTED),
-IPDEF2("-", dash_gsu, PM_READONLY),
+IPDEF2("-", dash_gsu, PM_READONLY_SPECIAL),
IPDEF2("histchars", histchars_gsu, PM_DONTIMPORT),
IPDEF2("HOME", home_gsu, PM_UNSET),
IPDEF2("TERM", term_gsu, PM_UNSET),
@@ -337,7 +337,7 @@ LCIPDEF("LC_TIME"),
# endif
#endif /* USE_LOCALE */
-#define IPDEF4(A,B) {{NULL,A,PM_INTEGER|PM_READONLY|PM_SPECIAL},BR((void *)B),GSU(varint_readonly_gsu),10,0,NULL,NULL,NULL,0}
+#define IPDEF4(A,B) {{NULL,A,PM_INTEGER|PM_READONLY_SPECIAL},BR((void *)B),GSU(varint_readonly_gsu),10,0,NULL,NULL,NULL,0}
IPDEF4("!", &lastpid),
IPDEF4("$", &mypid),
IPDEF4("?", &lastval),
@@ -377,10 +377,9 @@ IPDEF7("PS3", &prompt3),
IPDEF7R("PS4", &prompt4),
IPDEF7("SPROMPT", &sprompt),
-#define IPDEF9F(A,B,C,D) {{NULL,A,D|PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT},BR((void *)B),GSU(vararray_gsu),0,0,NULL,C,NULL,0}
-#define IPDEF9(A,B,C) IPDEF9F(A,B,C,0)
-IPDEF9F("*", &pparams, NULL, PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT|PM_READONLY),
-IPDEF9F("@", &pparams, NULL, PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT|PM_READONLY),
+#define IPDEF9(A,B,C,D) {{NULL,A,D|PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT},BR((void *)B),GSU(vararray_gsu),0,0,NULL,C,NULL,0}
+IPDEF9("*", &pparams, NULL, PM_ARRAY|PM_READONLY_SPECIAL|PM_DONTIMPORT),
+IPDEF9("@", &pparams, NULL, PM_ARRAY|PM_READONLY_SPECIAL|PM_DONTIMPORT),
/*
* This empty row indicates the end of parameters available in
@@ -389,17 +388,17 @@ IPDEF9F("@", &pparams, NULL, PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT|PM_READONLY),
{{NULL,NULL,0},BR(NULL),NULL_GSU,0,0,NULL,NULL,NULL,0},
#define IPDEF8(A,B,C,D) {{NULL,A,D|PM_SCALAR|PM_SPECIAL},BR((void *)B),GSU(colonarr_gsu),0,0,NULL,C,NULL,0}
-IPDEF8("CDPATH", &cdpath, "cdpath", 0),
-IPDEF8("FIGNORE", &fignore, "fignore", 0),
-IPDEF8("FPATH", &fpath, "fpath", 0),
-IPDEF8("MAILPATH", &mailpath, "mailpath", 0),
-IPDEF8("WATCH", &watch, "watch", 0),
-IPDEF8("PATH", &path, "path", PM_RESTRICTED),
-IPDEF8("PSVAR", &psvar, "psvar", 0),
-IPDEF8("ZSH_EVAL_CONTEXT", &zsh_eval_context, "zsh_eval_context", PM_READONLY),
+IPDEF8("CDPATH", &cdpath, "cdpath", PM_TIED),
+IPDEF8("FIGNORE", &fignore, "fignore", PM_TIED),
+IPDEF8("FPATH", &fpath, "fpath", PM_TIED),
+IPDEF8("MAILPATH", &mailpath, "mailpath", PM_TIED),
+IPDEF8("WATCH", &watch, "watch", PM_TIED),
+IPDEF8("PATH", &path, "path", PM_RESTRICTED|PM_TIED),
+IPDEF8("PSVAR", &psvar, "psvar", PM_TIED),
+IPDEF8("ZSH_EVAL_CONTEXT", &zsh_eval_context, "zsh_eval_context", PM_READONLY_SPECIAL|PM_TIED),
/* MODULE_PATH is not imported for security reasons */
-IPDEF8("MODULE_PATH", &module_path, "module_path", PM_DONTIMPORT|PM_RESTRICTED),
+IPDEF8("MODULE_PATH", &module_path, "module_path", PM_DONTIMPORT|PM_RESTRICTED|PM_TIED),
#define IPDEF10(A,B) {{NULL,A,PM_ARRAY|PM_SPECIAL},BR(NULL),GSU(B),10,0,NULL,NULL,NULL,0}
@@ -409,7 +408,7 @@ IPDEF8("MODULE_PATH", &module_path, "module_path", PM_DONTIMPORT|PM_RESTRICTED),
*/
/* All of these have sh compatible equivalents. */
-IPDEF1("ARGC", argc_gsu, PM_READONLY),
+IPDEF1("ARGC", argc_gsu, PM_READONLY_SPECIAL),
IPDEF2("HISTCHARS", histchars_gsu, PM_DONTIMPORT),
IPDEF4("status", &lastval),
IPDEF7("prompt", &prompt),
@@ -417,20 +416,20 @@ IPDEF7("PROMPT", &prompt),
IPDEF7("PROMPT2", &prompt2),
IPDEF7("PROMPT3", &prompt3),
IPDEF7("PROMPT4", &prompt4),
-IPDEF8("MANPATH", &manpath, "manpath", 0),
-IPDEF9("argv", &pparams, NULL),
-IPDEF9("fignore", &fignore, "FIGNORE"),
-IPDEF9("cdpath", &cdpath, "CDPATH"),
-IPDEF9("fpath", &fpath, "FPATH"),
-IPDEF9("mailpath", &mailpath, "MAILPATH"),
-IPDEF9("manpath", &manpath, "MANPATH"),
-IPDEF9("psvar", &psvar, "PSVAR"),
-IPDEF9("watch", &watch, "WATCH"),
+IPDEF8("MANPATH", &manpath, "manpath", PM_TIED),
+IPDEF9("argv", &pparams, NULL, 0),
+IPDEF9("fignore", &fignore, "FIGNORE", PM_TIED),
+IPDEF9("cdpath", &cdpath, "CDPATH", PM_TIED),
+IPDEF9("fpath", &fpath, "FPATH", PM_TIED),
+IPDEF9("mailpath", &mailpath, "MAILPATH", PM_TIED),
+IPDEF9("manpath", &manpath, "MANPATH", PM_TIED),
+IPDEF9("psvar", &psvar, "PSVAR", PM_TIED),
+IPDEF9("watch", &watch, "WATCH", PM_TIED),
-IPDEF9F("zsh_eval_context", &zsh_eval_context, "ZSH_EVAL_CONTEXT", PM_READONLY),
+IPDEF9("zsh_eval_context", &zsh_eval_context, "ZSH_EVAL_CONTEXT", PM_TIED|PM_READONLY_SPECIAL),
-IPDEF9F("module_path", &module_path, "MODULE_PATH", PM_RESTRICTED),
-IPDEF9F("path", &path, "PATH", PM_RESTRICTED),
+IPDEF9("module_path", &module_path, "MODULE_PATH", PM_TIED|PM_RESTRICTED),
+IPDEF9("path", &path, "PATH", PM_TIED|PM_RESTRICTED),
/* These are known to zsh alone. */
@@ -451,7 +450,7 @@ IPDEF8("MAILPATH", &mailpath, NULL, 0),
IPDEF8("WATCH", &watch, NULL, 0),
IPDEF8("PATH", &path, NULL, PM_RESTRICTED),
IPDEF8("PSVAR", &psvar, NULL, 0),
-IPDEF8("ZSH_EVAL_CONTEXT", &zsh_eval_context, NULL, PM_READONLY),
+IPDEF8("ZSH_EVAL_CONTEXT", &zsh_eval_context, NULL, PM_READONLY_SPECIAL),
/* MODULE_PATH is not imported for security reasons */
IPDEF8("MODULE_PATH", &module_path, NULL, PM_DONTIMPORT|PM_RESTRICTED),
@@ -464,7 +463,7 @@ IPDEF8("MODULE_PATH", &module_path, NULL, PM_DONTIMPORT|PM_RESTRICTED),
* and $@, this is not readonly. This parameter is not directly
* visible in user space.
*/
-static initparam argvparam_pm = IPDEF9F("", &pparams, NULL, \
+static initparam argvparam_pm = IPDEF9("", &pparams, NULL, \
PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT);
#undef BR
@@ -5024,10 +5023,10 @@ arrfixenv(char *s, char **t)
if (!(pm->node.flags & PM_EXPORTED))
return;
- if (pm->node.flags & PM_TIED)
- joinchar = STOUC(((struct tieddata *)pm->u.data)->joinchar);
- else
+ if (pm->node.flags & PM_SPECIAL)
joinchar = ':';
+ else
+ joinchar = STOUC(((struct tieddata *)pm->u.data)->joinchar);
addenv(pm, t ? zjoin(t, joinchar, 1) : "");
}
@@ -5650,7 +5649,7 @@ freeparamnode(HashNode hn)
pm->gsu.s->unsetfn(pm, 1);
zsfree(pm->node.nam);
/* If this variable was tied by the user, ename was ztrdup'd */
- if (pm->node.flags & PM_TIED)
+ if (!(pm->node.flags & PM_SPECIAL))
zsfree(pm->ename);
zfree(pm, sizeof(struct param));
}
@@ -5685,7 +5684,9 @@ static const struct paramtypes pmtypes[] = {
{ PM_UPPER, "uppercase", 'u', 0},
{ PM_READONLY, "readonly", 'r', 0},
{ PM_TAGGED, "tagged", 't', 0},
- { PM_EXPORTED, "exported", 'x', 0}
+ { PM_EXPORTED, "exported", 'x', 0},
+ { PM_UNIQUE, "unique", 'U', 0},
+ { PM_TIED, "tied", 'T', 0}
};
#define PMTYPES_SIZE ((int)(sizeof(pmtypes)/sizeof(struct paramtypes)))
@@ -5774,10 +5775,6 @@ printparamvalue(Param p, int printflags)
}
break;
}
- if ((printflags & (PRINT_KV_PAIR|PRINT_LINE)) == PRINT_KV_PAIR)
- putchar(' ');
- else if (!(printflags & PRINT_KV_PAIR))
- putchar('\n');
}
/**/
@@ -5785,36 +5782,41 @@ mod_export void
printparamnode(HashNode hn, int printflags)
{
Param p = (Param) hn;
+ Param peer = NULL;
if (p->node.flags & PM_UNSET) {
- if (isset(POSIXBUILTINS) && (p->node.flags & PM_READONLY) &&
- (printflags & PRINT_TYPESET))
- {
+ if (printflags & (PRINT_POSIX_READONLY|PRINT_POSIX_EXPORT) &&
+ p->node.flags & (PM_READONLY|PM_EXPORTED)) {
/*
- * Special POSIX rules: show the parameter as readonly
+ * Special POSIX rules: show the parameter as readonly/exported
* even though it's unset, but with no value.
*/
printflags |= PRINT_NAMEONLY;
}
- else if (p->node.flags & PM_EXPORTED)
- printflags |= PRINT_NAMEONLY;
else
return;
}
if (p->node.flags & PM_AUTOLOAD)
printflags |= PRINT_NAMEONLY;
- if (printflags & PRINT_TYPESET) {
- if ((p->node.flags & (PM_READONLY|PM_SPECIAL)) ==
- (PM_READONLY|PM_SPECIAL) ||
- (p->node.flags & PM_AUTOLOAD)) {
+ if (printflags & (PRINT_TYPESET|PRINT_POSIX_READONLY|PRINT_POSIX_EXPORT)) {
+ if (p->node.flags & (PM_RO_BY_DESIGN|PM_AUTOLOAD)) {
/*
* It's not possible to restore the state of
* these, so don't output.
*/
return;
}
- if (locallevel && p->level >= locallevel) {
+ /*
+ * The zsh variants of export -p/readonly -p also report other
+ * flags to indicate other attributes or scope. The POSIX variants
+ * don't.
+ */
+ if (printflags & PRINT_POSIX_EXPORT) {
+ printf("export ");
+ } else if (printflags & PRINT_POSIX_READONLY) {
+ printf("readonly ");
+ } else if (locallevel && p->level >= locallevel) {
printf("typeset "); /* printf("local "); */
} else if ((p->node.flags & PM_EXPORTED) &&
!(p->node.flags & (PM_ARRAY|PM_HASHED))) {
@@ -5863,13 +5865,46 @@ printparamnode(HashNode hn, int printflags)
}
if (doneminus)
putchar(' ');
+
+ if (p->node.flags & PM_TIED) {
+ /*
+ * For scalars tied to arrays,s
+ * * typeset +m outputs
+ * array tied SCALAR array
+ * tied array SCALAR
+ * * typeset -p outputs:
+ * typeset -T SCALAR array (for hidden values)
+ * typeset -T SCALAR array=(values)
+ * for both scalar and array (flags may be different)
+ *
+ * We choose to print the value for the array instead of the scalar
+ * as scalars can't disambiguate between
+ * typeset -T SCALAR array=()
+ * and
+ * typeset -T SCALAR array=('')
+ * (same for (a b:c)...)
+ */
+ Param tmp = (Param) paramtab->getnode(paramtab, p->ename);
+
+ /*
+ * Swap param and tied peer for typeset -p output
+ */
+ if (!(printflags & PRINT_TYPESET) || (p->node.flags & PM_ARRAY))
+ peer = tmp;
+ else {
+ peer = p;
+ p = tmp;
+ }
+
+ quotedzputs(peer->node.nam, stdout);
+ putchar(' ');
+ }
}
if ((printflags & PRINT_NAMEONLY) ||
- ((p->node.flags & PM_HIDEVAL) && !(printflags & PRINT_INCLUDEVALUE))) {
- zputs(p->node.nam, stdout);
- putchar('\n');
- } else {
+ ((p->node.flags & PM_HIDEVAL) && !(printflags & PRINT_INCLUDEVALUE)))
+ quotedzputs(p->node.nam, stdout);
+ else {
if (printflags & PRINT_KV_PAIR) {
if (printflags & PRINT_LINE)
printf("\n ");
@@ -5881,4 +5916,22 @@ printparamnode(HashNode hn, int printflags)
printparamvalue(p, printflags);
}
+ if (peer && (printflags & PRINT_TYPESET) && !(p->node.flags & PM_SPECIAL)) {
+ /*
+ * append the join char for tied parameters if different from colon
+ * for typeset -p output.
+ */
+ unsigned char joinchar = STOUC(((struct tieddata *)peer->u.data)->joinchar);
+ if (joinchar != ':') {
+ char buf[2];
+ buf[0] = joinchar;
+ buf[1] = '\0';
+ putchar(' ');
+ quotedzputs(buf, stdout);
+ }
+ }
+ if ((printflags & (PRINT_KV_PAIR|PRINT_LINE)) == PRINT_KV_PAIR)
+ putchar(' ');
+ else if (!(printflags & PRINT_KV_PAIR))
+ putchar('\n');
}
diff --git a/Src/prompt.c b/Src/prompt.c
index 959ed8e3d..568bfc2a9 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -33,7 +33,7 @@
/* text attribute mask */
/**/
-mod_export unsigned txtattrmask;
+mod_export zattr txtattrmask;
/* the command stack for use with %_ in prompts */
@@ -168,7 +168,7 @@ promptpath(char *p, int npath, int tilde)
/**/
mod_export char *
-promptexpand(char *s, int ns, char *rs, char *Rs, unsigned int *txtchangep)
+promptexpand(char *s, int ns, char *rs, char *Rs, zattr *txtchangep)
{
struct buf_vars new_vars;
@@ -236,8 +236,8 @@ promptexpand(char *s, int ns, char *rs, char *Rs, unsigned int *txtchangep)
}
/* Parse the argument for %F and %K */
-static int
-parsecolorchar(int arg, int is_fg)
+static zattr
+parsecolorchar(zattr arg, int is_fg)
{
if (bv->fm[1] == '{') {
char *ep;
@@ -268,10 +268,11 @@ parsecolorchar(int arg, int is_fg)
/**/
static int
-putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
+putpromptchar(int doprint, int endchar, zattr *txtchangep)
{
char *ss, *hostnam;
int t0, arg, test, sep, j, numjobs, len;
+ zattr atr;
struct tm *tm;
struct timespec ts;
time_t timet;
@@ -538,13 +539,13 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
tsetcap(TCUNDERLINEEND, TSC_PROMPT|TSC_DIRTY);
break;
case 'F':
- arg = parsecolorchar(arg, 1);
- if (arg >= 0 && !(arg & TXTNOFGCOLOUR)) {
- txtchangeset(txtchangep, arg & TXT_ATTR_FG_ON_MASK,
+ atr = parsecolorchar(arg, 1);
+ if (!(atr & (TXT_ERROR | TXTNOFGCOLOUR))) {
+ txtchangeset(txtchangep, atr & TXT_ATTR_FG_ON_MASK,
TXTNOFGCOLOUR | TXT_ATTR_FG_COL_MASK);
txtunset(TXT_ATTR_FG_COL_MASK);
- txtset(arg & TXT_ATTR_FG_ON_MASK);
- set_colour_attribute(arg, COL_SEQ_FG, TSC_PROMPT);
+ txtset(atr & TXT_ATTR_FG_ON_MASK);
+ set_colour_attribute(atr, COL_SEQ_FG, TSC_PROMPT);
break;
}
/* else FALLTHROUGH */
@@ -554,13 +555,13 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
set_colour_attribute(TXTNOFGCOLOUR, COL_SEQ_FG, TSC_PROMPT);
break;
case 'K':
- arg = parsecolorchar(arg, 0);
- if (arg >= 0 && !(arg & TXTNOBGCOLOUR)) {
- txtchangeset(txtchangep, arg & TXT_ATTR_BG_ON_MASK,
+ atr = parsecolorchar(arg, 0);
+ if (!(atr & (TXT_ERROR | TXTNOBGCOLOUR))) {
+ txtchangeset(txtchangep, atr & TXT_ATTR_BG_ON_MASK,
TXTNOBGCOLOUR | TXT_ATTR_BG_COL_MASK);
txtunset(TXT_ATTR_BG_COL_MASK);
- txtset(arg & TXT_ATTR_BG_ON_MASK);
- set_colour_attribute(arg, COL_SEQ_BG, TSC_PROMPT);
+ txtset(atr & TXT_ATTR_BG_ON_MASK);
+ set_colour_attribute(atr, COL_SEQ_BG, TSC_PROMPT);
break;
}
/* else FALLTHROUGH */
@@ -1185,7 +1186,7 @@ countprompt(char *str, int *wp, int *hp, int overf)
/**/
static int
prompttrunc(int arg, int truncchar, int doprint, int endchar,
- unsigned int *txtchangep)
+ zattr *txtchangep)
{
if (arg > 0) {
char ch = *bv->fm, *ptr, *truncstr;
@@ -1567,8 +1568,8 @@ static const char *ansi_colours[] = {
/* Defines the available types of highlighting */
struct highlight {
const char *name;
- int mask_on;
- int mask_off;
+ zattr mask_on;
+ zattr mask_off;
};
static const struct highlight highlights[] = {
@@ -1615,24 +1616,12 @@ match_named_colour(const char **teststrp)
*/
/**/
-mod_export int
+mod_export zattr
match_colour(const char **teststrp, int is_fg, int colour)
{
- int shft, on, named = 0, tc;
+ int shft, named = 0, tc;
+ zattr on;
- if (teststrp) {
- if ((named = ialpha(**teststrp))) {
- colour = match_named_colour(teststrp);
- if (colour == 8) {
- /* default */
- return is_fg ? TXTNOFGCOLOUR : TXTNOBGCOLOUR;
- }
- }
- else
- colour = (int)zstrtol(*teststrp, (char **)teststrp, 10);
- }
- if (colour < 0 || colour >= 256)
- return -1;
if (is_fg) {
shft = TXT_ATTR_FG_COL_SHIFT;
on = TXTFGCOLOUR;
@@ -1642,8 +1631,47 @@ match_colour(const char **teststrp, int is_fg, int colour)
on = TXTBGCOLOUR;
tc = TCBGCOLOUR;
}
+ if (teststrp) {
+ if (**teststrp == '#' && isxdigit((*teststrp)[1])) {
+ struct color_rgb color;
+ char *end;
+ zlong col = zstrtol(*teststrp+1, &end, 16);
+ if (end - *teststrp == 4) {
+ color.red = col >> 8 | ((col >> 8) << 4);
+ color.green = (col & 0xf0) >> 4;
+ color.green |= color.green << 4;
+ color.blue = col & 0xf;
+ color.blue |= color.blue << 4;
+ } else if (end - *teststrp == 7) {
+ color.red = col >> 16;
+ color.green = (col & 0xff00) >> 8;
+ color.blue = col & 0xff;
+ } else
+ return TXT_ERROR;
+ *teststrp = end;
+ colour = runhookdef(GETCOLORATTR, &color) - 1;
+ if (colour == -1) { /* no hook function added, try true color (24-bit) */
+ colour = (((color.red << 8) + color.green) << 8) + color.blue;
+ return on | (is_fg ? TXT_ATTR_FG_24BIT : TXT_ATTR_BG_24BIT) |
+ (zattr)colour << shft;
+ } else if (colour <= -2) {
+ return TXT_ERROR;
+ }
+ } else if ((named = ialpha(**teststrp))) {
+ colour = match_named_colour(teststrp);
+ if (colour == 8) {
+ /* default */
+ return is_fg ? TXTNOFGCOLOUR : TXTNOBGCOLOUR;
+ }
+ }
+ else {
+ colour = (int)zstrtol(*teststrp, (char **)teststrp, 10);
+ if (colour < 0 || colour >= 256)
+ return TXT_ERROR;
+ }
+ }
/*
- * Try termcap for numbered characters if posible.
+ * Try termcap for numbered characters if possible.
* Don't for named characters, since our best bet
* of getting the names right is with ANSI sequences.
*/
@@ -1654,7 +1682,7 @@ match_colour(const char **teststrp, int is_fg, int colour)
* Can we assume ANSI colours work?
*/
if (colour > 7)
- return -1; /* No. */
+ return TXT_ERROR; /* No. */
} else {
/*
* We can handle termcap colours and the number
@@ -1664,7 +1692,7 @@ match_colour(const char **teststrp, int is_fg, int colour)
TXT_ATTR_BG_TERMCAP;
}
}
- return on | (colour << shft);
+ return on | (zattr)colour << shft;
}
/*
@@ -1674,7 +1702,7 @@ match_colour(const char **teststrp, int is_fg, int colour)
/**/
mod_export void
-match_highlight(const char *teststr, int *on_var)
+match_highlight(const char *teststr, zattr *on_var)
{
int found = 1;
@@ -1684,7 +1712,8 @@ match_highlight(const char *teststr, int *on_var)
found = 0;
if (strpfx("fg=", teststr) || strpfx("bg=", teststr)) {
- int is_fg = (teststr[0] == 'f'), atr;
+ int is_fg = (teststr[0] == 'f');
+ zattr atr;
teststr += 3;
atr = match_colour(&teststr, is_fg, 0);
@@ -1694,7 +1723,7 @@ match_highlight(const char *teststr, int *on_var)
break;
found = 1;
/* skip out of range colours but keep scanning attributes */
- if (atr >= 0)
+ if (atr != TXT_ERROR)
*on_var |= atr;
} else {
for (hl = highlights; hl->name; hl++) {
@@ -1718,11 +1747,12 @@ match_highlight(const char *teststr, int *on_var)
/*
* Count or output a string for colour information: used
- * by output_highlight().
+ * by output_highlight(). count when buf is NULL.
+ * returned count excludes the terminating null byte.
*/
static int
-output_colour(int colour, int fg_bg, int use_tc, char *buf)
+output_colour(int colour, int fg_bg, int use_tc, int truecol, char *buf)
{
int atrlen = 3, len;
char *ptr = buf;
@@ -1730,8 +1760,12 @@ output_colour(int colour, int fg_bg, int use_tc, char *buf)
strcpy(ptr, fg_bg == COL_SEQ_FG ? "fg=" : "bg=");
ptr += 3;
}
+ if (truecol) {
+ /* length of hex triplet always 7, don't need sprintf to count */
+ atrlen += buf ? sprintf(ptr, "#%02x%02x%02x", colour >> 16,
+ (colour >> 8) & 0xff, colour & 0xff) : 7;
/* colour should only be > 7 if using termcap but let's be safe */
- if (use_tc || colour > 7) {
+ } else if (use_tc || colour > 7) {
char digbuf[DIGBUFSIZE];
sprintf(digbuf, "%d", colour);
len = strlen(digbuf);
@@ -1759,7 +1793,7 @@ output_colour(int colour, int fg_bg, int use_tc, char *buf)
/**/
mod_export int
-output_highlight(int atr, char *buf)
+output_highlight(zattr atr, char *buf)
{
const struct highlight *hp;
int atrlen = 0, len;
@@ -1769,6 +1803,7 @@ output_highlight(int atr, char *buf)
len = output_colour(txtchangeget(atr, TXT_ATTR_FG_COL),
COL_SEQ_FG,
(atr & TXT_ATTR_FG_TERMCAP),
+ (atr & TXT_ATTR_FG_24BIT),
ptr);
atrlen += len;
if (buf)
@@ -1785,6 +1820,7 @@ output_highlight(int atr, char *buf)
len = output_colour(txtchangeget(atr, TXT_ATTR_BG_COL),
COL_SEQ_BG,
(atr & TXT_ATTR_BG_TERMCAP),
+ (atr & TXT_ATTR_BG_24BIT),
ptr);
atrlen += len;
if (buf)
@@ -1922,7 +1958,8 @@ allocate_colour_buffer(void)
strlen(fg_bg_sequences[COL_SEQ_BG].end);
len = lenfg > lenbg ? lenfg : lenbg;
- colseq_buf = (char *)zalloc(len+1);
+ /* add 1 for the null and 14 for truecolor */
+ colseq_buf = (char *)zalloc(len+15);
}
/* Free the colour buffer previously allocated. */
@@ -1953,21 +1990,23 @@ free_colour_buffer(void)
/**/
mod_export void
-set_colour_attribute(int atr, int fg_bg, int flags)
+set_colour_attribute(zattr atr, int fg_bg, int flags)
{
char *ptr;
int do_free, is_prompt = (flags & TSC_PROMPT) ? 1 : 0;
- int colour, tc, def, use_termcap;
+ int colour, tc, def, use_termcap, use_truecolor;
if (fg_bg == COL_SEQ_FG) {
colour = txtchangeget(atr, TXT_ATTR_FG_COL);
tc = TCFGCOLOUR;
def = txtchangeisset(atr, TXTNOFGCOLOUR);
+ use_truecolor = txtchangeisset(atr, TXT_ATTR_FG_24BIT);
use_termcap = txtchangeisset(atr, TXT_ATTR_FG_TERMCAP);
} else {
colour = txtchangeget(atr, TXT_ATTR_BG_COL);
tc = TCBGCOLOUR;
def = txtchangeisset(atr, TXTNOBGCOLOUR);
+ use_truecolor = txtchangeisset(atr, TXT_ATTR_BG_24BIT);
use_termcap = txtchangeisset(atr, TXT_ATTR_BG_TERMCAP);
}
@@ -1975,12 +2014,13 @@ set_colour_attribute(int atr, int fg_bg, int flags)
* If we're not restoring the default, and either have a
* colour value that is too large for ANSI, or have been told
* to use the termcap sequence, try to use the termcap sequence.
+ * True color is not covered by termcap.
*
* We have already sanitised the values we allow from the
* highlighting variables, so much of this shouldn't be
* necessary at this point, but we might as well be safe.
*/
- if (!def && (colour > 7 || use_termcap)) {
+ if (!def && !use_truecolor && (colour > 7 || use_termcap)) {
/*
* We can if it's available, and either we couldn't get
* the maximum number of colours, or the colour is in range.
@@ -2024,6 +2064,9 @@ set_colour_attribute(int atr, int fg_bg, int flags)
strcpy(ptr, fg_bg_sequences[fg_bg].def);
while (*ptr)
ptr++;
+ } else if (use_truecolor) {
+ ptr += sprintf(ptr, "8;2;%d;%d;%d", colour >> 16,
+ (colour >> 8) & 0xff, colour & 0xff);
} else
*ptr++ = colour + '0';
strcpy(ptr, fg_bg_sequences[fg_bg].end);
diff --git a/Src/signals.c b/Src/signals.c
index 99aad0fab..f294049c2 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -540,8 +540,8 @@ wait_for_processes(void)
if (WIFEXITED(status) &&
pn->pid == jn->gleader &&
killpg(pn->pid, 0) == -1) {
- jn->gleader = 0;
- if (!(jn->stat & STAT_NOSTTY)) {
+ if (last_attached_pgrp == jn->gleader &&
+ !(jn->stat & STAT_NOSTTY)) {
/*
* This PID was in control of the terminal;
* reclaim terminal now it has exited.
@@ -552,6 +552,7 @@ wait_for_processes(void)
attachtty(mypgrp);
adjustwinsize(0);
}
+ jn->gleader = 0;
}
}
update_job(jn);
@@ -781,7 +782,20 @@ killjb(Job jn, int sig)
if (kill(pn->pid, sig) == -1 && errno != ESRCH)
err = -1;
- return err;
+ /*
+ * The following marks both the superjob and subjob
+ * as running, as done elsewhere.
+ *
+ * It's not entirely clear to me what the right way
+ * to flag the status of a still-pausd final process,
+ * as handled above, but we should be cnsistent about
+ * this inside makerunning() rather than doing anything
+ * special here.
+ */
+ if (err != -1)
+ makerunning(jn);
+
+ return err;
}
if (killpg(jobtab[jn->other].gleader, sig) == -1 && errno != ESRCH)
err = -1;
@@ -791,8 +805,11 @@ killjb(Job jn, int sig)
return err;
}
- else
- return killpg(jn->gleader, sig);
+ else {
+ err = killpg(jn->gleader, sig);
+ if (sig == SIGCONT && err != -1)
+ makerunning(jn);
+ }
}
for (pn = jn->procs; pn; pn = pn->next) {
/*
diff --git a/Src/subst.c b/Src/subst.c
index c1021fbf3..ff6750a59 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2405,6 +2405,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
aspar = 0;
} else if (aspar)
idbeg = val;
+ if (*val == Nularg)
+ ++val;
*s = sav;
/*
* This tests for the second double quote in an expression
@@ -2552,8 +2554,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
val = dyncat(val, "-readonly");
if (f & PM_TAGGED)
val = dyncat(val, "-tag");
- if (f & PM_TAGGED_LOCAL)
- val = dyncat(val, "-tag_local");
+ if (f & PM_TIED)
+ val = dyncat(val, "-tied");
if (f & PM_EXPORTED)
val = dyncat(val, "-export");
if (f & PM_UNIQUE)
diff --git a/Src/utils.c b/Src/utils.c
index 075d27241..e43a3cdb4 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3820,6 +3820,14 @@ wordcount(char *s, char *sep, int mul)
return r;
}
+/*
+ * 's' is a NULL-terminated array of strings.
+ * 'sep' is a string.
+ *
+ * Return a string consisting of the elements of 's' joined by 'sep',
+ * allocated on the heap iff 'heap'.
+ */
+
/**/
mod_export char *
sepjoin(char **s, char *sep, int heap)
@@ -4670,6 +4678,10 @@ attachtty(pid_t pgrp)
ep = 1;
}
}
+ else
+ {
+ last_attached_pgrp = pgrp;
+ }
}
}
@@ -7447,19 +7459,28 @@ mailstat(char *path, struct stat *st)
/* See if cur/ is present */
dir = appstr(ztrdup(path), "/cur");
- if (stat(dir, &st_tmp) || !S_ISDIR(st_tmp.st_mode)) return 0;
+ if (stat(dir, &st_tmp) || !S_ISDIR(st_tmp.st_mode)) {
+ zsfree(dir);
+ return 0;
+ }
st_ret.st_atime = st_tmp.st_atime;
/* See if tmp/ is present */
dir[plen] = 0;
dir = appstr(dir, "/tmp");
- if (stat(dir, &st_tmp) || !S_ISDIR(st_tmp.st_mode)) return 0;
+ if (stat(dir, &st_tmp) || !S_ISDIR(st_tmp.st_mode)) {
+ zsfree(dir);
+ return 0;
+ }
st_ret.st_mtime = st_tmp.st_mtime;
/* And new/ */
dir[plen] = 0;
dir = appstr(dir, "/new");
- if (stat(dir, &st_tmp) || !S_ISDIR(st_tmp.st_mode)) return 0;
+ if (stat(dir, &st_tmp) || !S_ISDIR(st_tmp.st_mode)) {
+ zsfree(dir);
+ return 0;
+ }
st_ret.st_mtime = st_tmp.st_mtime;
#if THERE_IS_EXACTLY_ONE_MAILDIR_IN_MAILPATH
@@ -7471,6 +7492,7 @@ mailstat(char *path, struct stat *st)
st_tmp.st_atime == st_new_last.st_atime &&
st_tmp.st_mtime == st_new_last.st_mtime) {
*st = st_ret_last;
+ zsfree(dir);
return 0;
}
st_new_last = st_tmp;
diff --git a/Src/zsh.h b/Src/zsh.h
index b81db1527..10897372b 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1867,7 +1867,7 @@ struct tieddata {
/* The following are the same since they *
* both represent -U option to typeset */
#define PM_UNIQUE (1<<13) /* remove duplicates */
-#define PM_UNALIASED (1<<13) /* do not expand aliases when autoloading */
+#define PM_UNALIASED (1<<13) /* (function) do not expand aliases when autoloading */
#define PM_HIDE (1<<14) /* Special behaviour hidden by local */
#define PM_CUR_FPATH (1<<14) /* (function): can use $fpath with filename */
@@ -1876,28 +1876,30 @@ struct tieddata {
#define PM_TIED (1<<16) /* array tied to colon-path or v.v. */
#define PM_TAGGED_LOCAL (1<<16) /* (function): non-recursive PM_TAGGED */
-#define PM_KSHSTORED (1<<17) /* function stored in ksh form */
-#define PM_ZSHSTORED (1<<18) /* function stored in zsh form */
-
/* Remaining flags do not correspond directly to command line arguments */
-#define PM_DONTIMPORT_SUID (1<<19) /* do not import if running setuid */
-#define PM_LOADDIR (1<<19) /* (function) filename gives load directory */
-#define PM_SINGLE (1<<20) /* special can only have a single instance */
-#define PM_ANONYMOUS (1<<20) /* (function) anonymous function */
-#define PM_LOCAL (1<<21) /* this parameter will be made local */
-#define PM_SPECIAL (1<<22) /* special builtin parameter */
-#define PM_DONTIMPORT (1<<23) /* do not import this variable */
-#define PM_RESTRICTED (1<<24) /* cannot be changed in restricted mode */
-#define PM_UNSET (1<<25) /* has null value */
-#define PM_REMOVABLE (1<<26) /* special can be removed from paramtab */
-#define PM_AUTOLOAD (1<<27) /* autoloaded from module */
-#define PM_NORESTORE (1<<28) /* do not restore value of local special */
-#define PM_AUTOALL (1<<28) /* autoload all features in module
+#define PM_DONTIMPORT_SUID (1<<17) /* do not import if running setuid */
+#define PM_LOADDIR (1<<17) /* (function) filename gives load directory */
+#define PM_SINGLE (1<<18) /* special can only have a single instance */
+#define PM_ANONYMOUS (1<<18) /* (function) anonymous function */
+#define PM_LOCAL (1<<19) /* this parameter will be made local */
+#define PM_KSHSTORED (1<<19) /* (function) stored in ksh form */
+#define PM_SPECIAL (1<<20) /* special builtin parameter */
+#define PM_ZSHSTORED (1<<20) /* (function) stored in zsh form */
+#define PM_RO_BY_DESIGN (1<<21) /* to distinguish from specials that can be
+ made read-only by the user */
+#define PM_READONLY_SPECIAL (PM_SPECIAL|PM_READONLY|PM_RO_BY_DESIGN)
+#define PM_DONTIMPORT (1<<22) /* do not import this variable */
+#define PM_RESTRICTED (1<<23) /* cannot be changed in restricted mode */
+#define PM_UNSET (1<<24) /* has null value */
+#define PM_REMOVABLE (1<<25) /* special can be removed from paramtab */
+#define PM_AUTOLOAD (1<<26) /* autoloaded from module */
+#define PM_NORESTORE (1<<27) /* do not restore value of local special */
+#define PM_AUTOALL (1<<27) /* autoload all features in module
* when loading: valid only if PM_AUTOLOAD
* is also present.
*/
-#define PM_HASHELEM (1<<29) /* is a hash-element */
-#define PM_NAMEDDIR (1<<30) /* has a corresponding nameddirtab entry */
+#define PM_HASHELEM (1<<28) /* is a hash-element */
+#define PM_NAMEDDIR (1<<29) /* has a corresponding nameddirtab entry */
/* The option string corresponds to the first of the variables above */
#define TYPESET_OPTSTR "aiEFALRZlurtxUhHTkz"
@@ -2138,6 +2140,8 @@ typedef groupset *Groupset;
#define PRINT_INCLUDEVALUE (1<<4)
#define PRINT_TYPESET (1<<5)
#define PRINT_LINE (1<<6)
+#define PRINT_POSIX_EXPORT (1<<7)
+#define PRINT_POSIX_READONLY (1<<8)
/* flags for printing for the whence builtin */
#define PRINT_WHENCE_CSH (1<<7)
@@ -2629,6 +2633,12 @@ struct ttyinfo {
* Text attributes for displaying in ZLE
*/
+#ifdef HAVE_STDINT_H
+ typedef uint64_t zattr;
+#else
+ typedef zulong zattr;
+#endif
+
#define TXTBOLDFACE 0x0001
#define TXTSTANDOUT 0x0002
#define TXTUNDERLINE 0x0004
@@ -2660,32 +2670,41 @@ struct ttyinfo {
*/
#define TXT_MULTIWORD_MASK 0x0400
+/* used when, e.g an invalid colour is specified */
+#define TXT_ERROR 0x0800
+
/* Mask for colour to use in foreground */
-#define TXT_ATTR_FG_COL_MASK 0x000FF000
+#define TXT_ATTR_FG_COL_MASK 0x000000FFFFFF0000
/* Bits to shift the foreground colour */
-#define TXT_ATTR_FG_COL_SHIFT (12)
+#define TXT_ATTR_FG_COL_SHIFT (16)
/* Mask for colour to use in background */
-#define TXT_ATTR_BG_COL_MASK 0x0FF00000
+#define TXT_ATTR_BG_COL_MASK 0xFFFFFF0000000000
/* Bits to shift the background colour */
-#define TXT_ATTR_BG_COL_SHIFT (20)
+#define TXT_ATTR_BG_COL_SHIFT (40)
/* Flag to use termcap AF sequence to set colour, if available */
-#define TXT_ATTR_FG_TERMCAP 0x10000000
+#define TXT_ATTR_FG_TERMCAP 0x1000
/* Flag to use termcap AB sequence to set colour, if available */
-#define TXT_ATTR_BG_TERMCAP 0x20000000
+#define TXT_ATTR_BG_TERMCAP 0x2000
+
+/* Flag to indicate that foreground is a 24-bit colour */
+#define TXT_ATTR_FG_24BIT 0x4000
+/* Flag to indicate that background is a 24-bit colour */
+#define TXT_ATTR_BG_24BIT 0x8000
/* Things to turn on, including values for the colour elements */
#define TXT_ATTR_ON_VALUES_MASK \
(TXT_ATTR_ON_MASK|TXT_ATTR_FG_COL_MASK|TXT_ATTR_BG_COL_MASK|\
- TXT_ATTR_FG_TERMCAP|TXT_ATTR_BG_TERMCAP)
+ TXT_ATTR_FG_TERMCAP|TXT_ATTR_BG_TERMCAP|\
+ TXT_ATTR_FG_24BIT|TXT_ATTR_BG_24BIT)
/* Mask out everything to do with setting a foreground colour */
#define TXT_ATTR_FG_ON_MASK \
- (TXTFGCOLOUR|TXT_ATTR_FG_COL_MASK|TXT_ATTR_FG_TERMCAP)
+ (TXTFGCOLOUR|TXT_ATTR_FG_COL_MASK|TXT_ATTR_FG_TERMCAP|TXT_ATTR_FG_24BIT)
/* Mask out everything to do with setting a background colour */
#define TXT_ATTR_BG_ON_MASK \
- (TXTBGCOLOUR|TXT_ATTR_BG_COL_MASK|TXT_ATTR_BG_TERMCAP)
+ (TXTBGCOLOUR|TXT_ATTR_BG_COL_MASK|TXT_ATTR_BG_TERMCAP|TXT_ATTR_BG_24BIT)
/* Mask out everything to do with activating colours */
#define TXT_ATTR_COLOUR_ON_MASK \
@@ -2703,6 +2722,12 @@ struct ttyinfo {
#define COL_SEQ_BG (1)
#define COL_SEQ_COUNT (2)
+struct color_rgb {
+ unsigned int red, green, blue;
+};
+
+typedef struct color_rgb *Color_rgb;
+
/*
* Flags to testcap() and set_colour_attribute (which currently only
* handles TSC_PROMPT).
@@ -3199,6 +3224,7 @@ enum {
#define EXITHOOK (zshhooks + 0)
#define BEFORETRAPHOOK (zshhooks + 1)
#define AFTERTRAPHOOK (zshhooks + 2)
+#define GETCOLORATTR (zshhooks + 3)
#ifdef MULTIBYTE_SUPPORT
/* Final argument to mb_niceformat() */
diff --git a/Src/zsh_system.h b/Src/zsh_system.h
index 8289ee97c..e7d529b6e 100644
--- a/Src/zsh_system.h
+++ b/Src/zsh_system.h
@@ -137,6 +137,10 @@ char *alloca _((size_t));
#include <stddef.h>
#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
#include <stdio.h>
#include <ctype.h>
#include <sys/stat.h>
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 217f7bea4..339ce7494 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -873,3 +873,13 @@
0:Assignment-only current shell commands in LHS of pipelin
>1
>1
+
+ echo pipe | ; sed s/pipe/PIPE/
+ true && ; echo and true
+ false && ; echo and false
+ true || ; echo or true
+ false || ; echo or false
+0:semicolon is equivalent to newline
+>PIPE
+>and true
+>or false
diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst
index 996af064f..ac86e0ad1 100644
--- a/Test/B02typeset.ztst
+++ b/Test/B02typeset.ztst
@@ -20,6 +20,14 @@
# Not yet tested:
# Assorted illegal flag combinations
+# For a few tests, we include a
+# typeset -p param
+# typeset -m param
+# typeset +m param
+# to test the proper output of typeset for a number of different types
+# of variables. Note that we can't use a dedicated function to factorize
+# that code, as that would affect the scoping.
+
%prep
## Do not remove the next line, it's used by V10private.ztst
# test_zsh_param_private
@@ -37,6 +45,9 @@
typeset -a array
array=(l o c a l)
print $scalar $array
+ typeset -p scalar array
+ typeset -m scalar array
+ typeset +m scalar array
}
scope01() {
local scalar
@@ -44,6 +55,9 @@
local -a array
array=(l o c a l)
print $scalar $array
+ typeset -p scalar array
+ typeset -m scalar array
+ typeset +m scalar array
}
scope02() {
declare scalar
@@ -51,10 +65,16 @@
declare -a array
array=(l o c a l)
print $scalar $array
+ typeset -p scalar array
+ typeset -m scalar array
+ typeset +m scalar array
}
scope10() {
export outer=outer
/bin/sh -fc 'echo $outer'
+ typeset -p outer
+ typeset -m outer
+ typeset +m outer
}
scope11() {
typeset -x outer=outer
@@ -68,6 +88,9 @@
local -xT OUTER outer
outer=(i n n e r)
/bin/sh -fc 'echo $OUTER'
+ typeset -p OUTER outer
+ typeset -m OUTER outer
+ typeset +m OUTER outer
}
# Bug? `typeset -h' complains that ! # $ * - ? @ are not identifiers.
@@ -79,8 +102,14 @@
%test
+ typeset -p scalar array
+ typeset -m scalar array
typeset +m scalar array
-0:Report types of parameters with typeset +m
+0:Report types for global variables
+>typeset -g scalar=scalar
+>typeset -g -a array=( a r r a y )
+>scalar=scalar
+>array=( a r r a y )
>scalar
>array array
@@ -88,18 +117,36 @@
print $scalar $array
0:Simple local declarations
>local l o c a l
+>typeset scalar=local
+>typeset -a array=( l o c a l )
+>scalar=local
+>array=( l o c a l )
+>local scalar
+>array local array
>scalar a r r a y
scope01
print $scalar $array
0:Equivalence of local and typeset in functions
>local l o c a l
+>typeset scalar=local
+>typeset -a array=( l o c a l )
+>scalar=local
+>array=( l o c a l )
+>local scalar
+>array local array
>scalar a r r a y
scope02
print $scalar $array
0:Basic equivalence of declare and typeset
>local l o c a l
+>typeset scalar=local
+>typeset -a array=( l o c a l )
+>scalar=local
+>array=( l o c a l )
+>local scalar
+>array local array
>scalar a r r a y
declare +m scalar
@@ -110,6 +157,9 @@
print $outer
0:Global export
>outer
+>export outer=outer
+>outer=outer
+>outer
>outer
scope11
@@ -130,18 +180,30 @@
print $f
float -F f
print $f
+ typeset -p f
+ typeset -m f
+ typeset +m f
0:Floating point, adding a precision, and fixed point
>float local f
>3.14e+00
>3.142
+>typeset -F f=3.142
+>f=3.142
+>float local f
integer i=3.141
typeset +m i
integer -i2 i
print $i
+ typeset -p i
+ typeset -m i
+ typeset +m i
0:Integer and changing the base
>integer local i
>2#11
+>typeset -i2 i=3
+>i=3
+>integer 2 local i
float -E3 f=3.141
typeset +m f
@@ -174,16 +236,33 @@
typeset -gU array
print $array
+ typeset -p array
+ typeset -m array
+ typeset +m array
0:Uniquified arrays and non-local scope
>a r y
+>typeset -g -aU array=( a r y )
+>array=( a r y )
+>array unique array
typeset -T SCALAR=l:o:c:a:l array
print $array
typeset -U SCALAR
print $SCALAR $array
+ typeset -p SCALAR array
+ typeset -m SCALAR array
+ typeset +m SCALAR array
+ print ${(t)SCALAR} ${(t)array}
0:Tied parameters and uniquified colon-arrays
>l o c a l
>l:o:c:a l o c a
+>typeset -UT SCALAR array=( l o c a )
+>typeset -aT SCALAR array=( l o c a )
+>SCALAR=l:o:c:a
+>array=( l o c a )
+>local unique tied array SCALAR
+>array local tied SCALAR array
+>scalar-local-tied-unique array-local-tied
(setopt NO_multibyte cbases
LC_ALL=C 2>/dev/null
@@ -209,9 +288,18 @@
typeset -T SCALAR=$'l\000o\000c\000a\000l' array $'\000'
typeset -U SCALAR
print $array
+ typeset -p SCALAR array
+ typeset -m SCALAR array
+ typeset +m SCALAR array
[[ $SCALAR == $'l\000o\000c\000a' ]]
0:Tied parameters and uniquified arrays with NUL-character as separator
>l o c a
+>typeset -UT SCALAR array=( l o c a ) ''
+>typeset -aT SCALAR array=( l o c a ) ''
+>SCALAR=$'l\C-@o\C-@c\C-@a'
+>array=( l o c a )
+>local unique tied array SCALAR
+>array local tied SCALAR array
typeset -T SCALAR array
typeset +T SCALAR
@@ -223,15 +311,30 @@
print $OUTER
0:Export of tied parameters
>i:n:n:e:r
+>typeset -xT OUTER outer=( i n n e r )
+>typeset -aT OUTER outer=( i n n e r )
+>OUTER=i:n:n:e:r
+>outer=( i n n e r )
+>local exported tied outer OUTER
+>array local tied OUTER outer
>outer
typeset -TU MORESTUFF=here-we-go-go-again morestuff '-'
print -l $morestuff
+ typeset -p MORESTUFF morestuff
+ typeset -m MORESTUFF morestuff
+ typeset +m MORESTUFF morestuff
0:Tied arrays with separator specified
>here
>we
>go
>again
+>typeset -UT MORESTUFF morestuff=( here we go again ) -
+>typeset -aUT MORESTUFF morestuff=( here we go again ) -
+>MORESTUFF=here-we-go-again
+>morestuff=( here we go again )
+>local unique tied morestuff MORESTUFF
+>array local unique tied MORESTUFF morestuff
typeset -T THIS will not work
1:Tied array syntax
@@ -251,13 +354,25 @@
local b=1 ;: to stomp assoc[1] if assoc[b] is broken
typeset assoc[1]=a assoc[b]=2 assoc[3]=c
print $assoc[1] $assoc[b] $assoc[3]
+ typeset -p assoc
+ typeset -m assoc
+ typeset +m assoc
0:Legal local associative array element assignment
>a 2 c
+>typeset -A assoc=( [1]=a [3]=c [b]=2 )
+>assoc=( [1]=a [3]=c [b]=2 )
+>association local assoc
local scalar scalar[1]=a scalar[2]=b scalar[3]=c
print $scalar
+ typeset -p scalar
+ typeset -m scalar
+ typeset +m scalar
0:Local scalar subscript assignment
>abc
+>typeset scalar=abc
+>scalar=abc
+>local scalar
typeset -L 10 fools
for fools in " once" "twice" " thrice" " oops too long here"; do
@@ -273,11 +388,17 @@
for foolf in 1.3 4.6 -2.987 -4.91031; do
print "'$foolf'"
done
+ typeset -p foolf
+ typeset -m foolf
+ typeset +m foolf
0:Left justification of floating point
>'1.300 '
>'4.600 '
>'-2.987 '
>'-4.910 '
+>typeset -FL10 foolf=-4.910
+>foolf=-4.910
+>float local left justified 10 foolf
typeset -L 10 -Z foolzs
for foolzs in 001.3 04.6 -2.987 -04.91231; do
@@ -293,10 +414,16 @@
for foors in short longer even-longer; do
print "'$foors'"
done
+ typeset -p foors
+ typeset -m foors
+ typeset +m foors
0:Right justification of scalars
>' short'
>' longer'
>'ven-longer'
+>typeset -R10 foors=even-longer
+>foors=even-longer
+>local right justified 10 foors
typeset -Z 10 foozs
for foozs in 42 -42 " 43" " -43"; do
@@ -436,24 +563,36 @@
print $case1
upper="VALUE OF \$UPPER"
print ${(P)case1}
+ typeset -p case1
+ typeset -m case1
+ typeset +m case1
0:Upper case conversion, does not apply to values used internally
>UPPER
>VALUE OF $UPPER
+>typeset -u case1=upper
+>case1=upper
+>local uppercase case1
local case2=LOWER
typeset -l case2
print $case2
LOWER="value of \$lower"
print ${(P)case2}
+ typeset -p case2
+ typeset -m case2
+ typeset +m case2
0:Lower case conversion, does not apply to values used internally
>lower
>value of $lower
+>typeset -l case2=LOWER
+>case2=LOWER
+>local lowercase case2
typeset -a array
array=(foo bar)
fn() { typeset -p array nonexistent; }
fn
-1:declare -p shouldn't create scoped values
+1:typeset -p shouldn't create scoped values
>typeset -g -a array=( foo bar )
?fn:typeset: no such variable: nonexistent
@@ -490,7 +629,7 @@
?0
?(eval):5: read-only variable: pbro
?(eval):6: read-only variable: pbro
-?typeset -g -r pbro
+?readonly pbro
?0
?(eval):10: read-only variable: pbro
@@ -819,3 +958,146 @@
> [one]=two
> [three]=''
>)
+
+ (export PATH MANPATH
+ path=(/bin)
+ MANPATH=/
+ # read-only special params like zsh_eval_context are not output by typeset -p
+ specials=(path PATH manpath MANPATH zsh_eval_context ZSH_EVAL_CONTEXT)
+ typeset -p $specials
+ typeset -m $specials
+ typeset +m $specials
+ for var ($specials) print $var: ${(Pt)var}
+ )
+0:typeset output for some special tied parameters
+>typeset -g -aT PATH path=( /bin )
+>export -T PATH path=( /bin )
+>typeset -g -aT MANPATH manpath=( / )
+>export -T MANPATH manpath=( / )
+>path=( /bin )
+>PATH=/bin
+>manpath=( / )
+>MANPATH=/
+>zsh_eval_context=( toplevel shfunc shfunc shfunc eval )
+>ZSH_EVAL_CONTEXT=toplevel:shfunc:shfunc:shfunc:eval
+>array tied PATH path
+>tied path PATH
+>array tied MANPATH manpath
+>tied manpath MANPATH
+>array readonly tied ZSH_EVAL_CONTEXT zsh_eval_context
+>readonly tied zsh_eval_context ZSH_EVAL_CONTEXT
+>path: array-tied-special
+>PATH: scalar-tied-export-special
+>manpath: array-tied-special
+>MANPATH: scalar-tied-export-special
+>zsh_eval_context: array-readonly-tied-special
+>ZSH_EVAL_CONTEXT: scalar-readonly-tied-special
+
+ typeset -T VAR var=(a b a b)
+ typeset -UuT VAR var +
+ print $VAR
+0:redeclare a tied variable with different attributes
+>A+B
+
+ typeset -T VAR=a+b var
+ typeset -T VAR var +
+ print $var
+0:colonarray re-split when changing the join character
+>a b
+
+ readonly -T VAR var=(a b)
+ readonly -T VAR var +
+1:cannot change the join character on a readonly tied variable
+?(eval):1: read-only variable: var
+
+ typeset -T FOO manpath
+1:Can't tie a special tied array to a different variable
+?(eval):typeset:1: manpath special parameter can only be tied to special parameter MANPATH
+
+ typeset -T MANPATH foo
+1:Can't tie a special tied scalar to a different variable
+?(eval):typeset:1: MANPATH special parameter can only be tied to special parameter manpath
+
+ typeset -T MANPATH manpath +
+1:Can't change the join character of a special tied variable
+?(eval):typeset:1: cannot change the join character of special tied parameters
+
+ (){
+ typeset -h path
+ typeset -T PATH path=(x)
+ }
+ (){
+ typeset -h PATH
+ typeset -T PATH path=(x)
+ }
+1:reject attempt to tie special to downgraded peer
+?(anon):typeset:2: PATH special parameter can only be tied to special parameter path
+?(anon):typeset:2: path special parameter can only be tied to special parameter PATH
+
+ typeset MANPATH
+ manpath=(/ /)
+ typeset -UT MANPATH manpath
+ print $manpath
+0:OK to run typeset -T on tied specials as long as peer and joinchar are unchanged
+>/
+
+ typeset FOO=a:b
+ export FOO
+ typeset +x -T FOO foo
+ typeset -p FOO
+0:Make sure +x is honoured when tying a parameter
+>typeset -T FOO foo=( a b )
+
+ $ZTST_testdir/../Src/zsh --emulate sh -f -c '
+ PATH=/bin; export PATH; readonly PATH
+ export -p PATH
+ typeset -p PATH
+ readonly -p'
+0: readonly/export output for exported+readonly+special when started as sh
+>export PATH=/bin
+>export -r PATH=/bin
+>readonly PATH=/bin
+
+ function {
+ emulate -L sh
+ MANPATH=/bin; export MANPATH; readonly MANPATH
+ export -p MANPATH
+ typeset -p MANPATH
+ readonly -p
+ }
+0: readonly/export output for exported+readonly+tied+special after switching to sh emulation
+>export MANPATH=/bin
+>export -rT MANPATH manpath=( /bin )
+>readonly MANPATH=/bin
+
+ function {
+ local -rax zsh_exported_readonly_array=(2)
+ local -rAx zsh_exported_readonly_hash=(3 3)
+ local -rx zsh_exported_readonly_scalar=1
+ print zsh:
+ export -p | grep zsh_exported_readonly
+ readonly -p | grep zsh_exported_readonly
+ print sh:
+ emulate -L sh
+ export -p | grep zsh_exported_readonly
+ readonly -p | grep zsh_exported_readonly
+ print still asking for arrays:
+ export -ap | grep zsh_exported_readonly
+ readonly -ap | grep zsh_exported_readonly
+ }
+0: no array/hash in POSIX export/readonly -p
+>zsh:
+>typeset -arx zsh_exported_readonly_array=( 2 )
+>typeset -Arx zsh_exported_readonly_hash=( [3]=3 )
+>typeset -rx zsh_exported_readonly_scalar=1
+>typeset -arx zsh_exported_readonly_array=( 2 )
+>typeset -Arx zsh_exported_readonly_hash=( [3]=3 )
+>typeset -rx zsh_exported_readonly_scalar=1
+>sh:
+>export zsh_exported_readonly_scalar=1
+>readonly zsh_exported_readonly_scalar=1
+>still asking for arrays:
+>export zsh_exported_readonly_array=( 2 )
+>export zsh_exported_readonly_scalar=1
+>readonly zsh_exported_readonly_array=( 2 )
+>readonly zsh_exported_readonly_scalar=1
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index dce263f94..4aebd92b7 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -863,6 +863,25 @@ F:Must be tested with a top-level script rather than source or function
>a
>b
+ $ZTST_testdir/../Src/zsh -fc 'fn() { exit 13; }; trap fn EXIT; exit'
+13:Explicit exit in exit trap overrides status
+
+ $ZTST_testdir/../Src/zsh -fc 'fn() { exit $?+8; }; trap fn EXIT; exit 7'
+15:Progated exit status through exit trap
+
+ $ZTST_testdir/../Src/zsh -fc 'fn() { exit 13; }; trap fn EXIT'
+13:Explicit exit in exit trap overrides implicit exit status
+
+ $ZTST_testdir/../Src/zsh -fc 'fn() { exit 0; }; trap fn EXIT; false'
+0:Explicit exit status 0 in exit trap overrides implicit non-zero status
+
+ $ZTST_testdir/../Src/zsh -f <<<'fn() { exit 13; }; trap fn EXIT; false'
+13:Exit status from exit trap, script-like path
+
+ $ZTST_testdir/../Src/zsh -f <<<'fn() { exit 0; }; trap fn EXIT; false'
+0:Explicit exit status overrides implicit: script-like code path
+
%clean
rm -f TRAPEXIT
+
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index e327a784c..7ab2384aa 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -2430,3 +2430,10 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
)
0:Use of parameter subst + to test element of hash with KSH_ARRAYS.
>0
+
+ for baz in "" "inga"; do
+ echo ${#${baz}} "${#${baz}}" ${#baz} "${#baz}"
+ done
+0:double-quoted nested evaluation of empty string
+>0 0 0 0
+>4 4 4 4
diff --git a/Test/V07pcre.ztst b/Test/V07pcre.ztst
index 9feeb47fb..ab67f3d80 100644
--- a/Test/V07pcre.ztst
+++ b/Test/V07pcre.ztst
@@ -1,11 +1,10 @@
%prep
- if ! zmodload -F zsh/pcre C:pcre-match 2>/dev/null
+ if grep '^name=zsh/pcre .* link=no ' $ZTST_testdir/../config.modules >/dev/null
then
- ZTST_unimplemented="the zsh/pcre module is not available"
+ ZTST_unimplemented="the zsh/pcre module was disabled by configure (see config.modules)"
return 0
fi
-# Load the rest of the builtins
zmodload zsh/pcre
setopt rematch_pcre
# Find a UTF-8 locale.
diff --git a/Test/V09datetime.ztst b/Test/V09datetime.ztst
index ffad96c04..22d560750 100644
--- a/Test/V09datetime.ztst
+++ b/Test/V09datetime.ztst
@@ -82,3 +82,32 @@
# The result can be '%@' (Linux), '@' (BSDs) or an error (Cygwin).
[[ $(strftime '%@' 0 2> /dev/null) == (%|)@ || $? != 0 ]]
0:bad format specifier
+
+# This test may fail at 23:59:59.xxx on New Year's Eve :/
+ [[ "$( strftime '%Y' )" == "$( strftime '%Y' "$EPOCHSECONDS" )" ]]
+0:epochtime optional
+
+ strftime '%Y-%m-%d %H:%M:%S.%3.' 1012615322
+ strftime '%Y-%m-%d %H:%M:%S.%3.' 1012615322 0
+ strftime '%Y-%m-%d %H:%M:%S.%3.' 1012615322 2
+ strftime '%Y-%m-%d %H:%M:%S.%3.' 1012615322 $(( 222 * (10 ** 9) ))
+0:optional nanoseconds
+>2002-02-02 02:02:02.000
+>2002-02-02 02:02:02.000
+>2002-02-02 02:02:02.000
+>2002-02-02 02:02:02.222
+
+ strftime '%Y' '' 2> /dev/null
+1:empty epochtime not allowed
+
+ strftime '%Y' 1012615322 '' 2> /dev/null
+1:empty nanoseconds not allowed
+
+ strftime '%N' 1012615322 ${(l<64><9>):-} 2> /dev/null
+1:overflowed nanoseconds not allowed
+
+ strftime '%N' 1012615322 -1 2> /dev/null
+1:negative nanoseconds not allowed
+
+ strftime -r '%Y' 2> /dev/null
+1:-r timestring not optional