summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.editorconfig10
-rw-r--r--.gitignore157
-rw-r--r--ChangeLog2746
-rw-r--r--Completion/BSD/Command/_bsd_pkg48
-rw-r--r--Completion/BSD/Command/_freebsd-update2
-rw-r--r--Completion/BSD/Command/_ipfw325
-rw-r--r--Completion/BSD/Command/_kdump84
-rw-r--r--Completion/BSD/Command/_ktrace30
-rw-r--r--Completion/BSD/Command/_pfctl2
-rw-r--r--Completion/BSD/Command/_pkgin2
-rw-r--r--Completion/BSD/Command/_portmaster14
-rw-r--r--Completion/BSD/Command/_rcctl15
-rw-r--r--Completion/BSD/Command/_signify1
-rw-r--r--Completion/BSD/Command/_sysclean6
-rw-r--r--Completion/BSD/Command/_sysmerge6
-rw-r--r--Completion/BSD/Command/_syspatch7
-rw-r--r--Completion/BSD/Command/_sysrc2
-rw-r--r--Completion/BSD/Command/_systat10
-rw-r--r--Completion/BSD/Command/_sysupgrade9
-rw-r--r--Completion/BSD/Command/_usbconfig63
-rw-r--r--Completion/BSD/Type/_ktrace_points50
-rw-r--r--Completion/BSD/Type/_login_classes11
-rw-r--r--Completion/BSD/Type/_obsd_architectures2
-rw-r--r--Completion/BSD/Type/_routing_domains6
-rw-r--r--Completion/BSD/Type/_routing_tables6
-rw-r--r--Completion/Base/Completer/_expand11
-rw-r--r--Completion/Base/Core/_description10
-rw-r--r--Completion/Base/Core/_main_complete16
-rw-r--r--Completion/Base/Core/_message2
-rw-r--r--Completion/Base/Utility/_arguments22
-rw-r--r--Completion/Base/Utility/_call_program1
-rw-r--r--Completion/Base/Utility/_numbers87
-rw-r--r--Completion/Base/Utility/_sequence4
-rw-r--r--Completion/Base/Utility/_store_cache2
-rw-r--r--Completion/Base/Utility/_values2
-rw-r--r--Completion/Base/Widget/_bash_completions2
-rw-r--r--Completion/Base/Widget/_complete_debug6
-rw-r--r--Completion/Base/Widget/_complete_help2
-rw-r--r--Completion/Base/Widget/_complete_tag4
-rw-r--r--Completion/Cygwin/Command/_cygserver8
-rw-r--r--Completion/Darwin/Command/_defaults2
-rw-r--r--Completion/Darwin/Command/_hdiutil91
-rw-r--r--Completion/Darwin/Command/_qtplay2
-rw-r--r--Completion/Darwin/Command/_softwareupdate2
-rw-r--r--Completion/Darwin/Type/_retrieve_mac_apps7
-rw-r--r--Completion/Debian/Command/_apt2
-rw-r--r--Completion/Debian/Command/_aptitude115
-rw-r--r--Completion/Debian/Command/_axi-cache2
-rw-r--r--Completion/Debian/Command/_dak14
-rw-r--r--Completion/Debian/Command/_debsnap77
-rw-r--r--Completion/Debian/Command/_dpkg2
-rw-r--r--Completion/Debian/Command/_dscverify26
-rw-r--r--Completion/Debian/Command/_git-buildpackage6
-rw-r--r--Completion/Debian/Command/_lintian6
-rw-r--r--Completion/Debian/Command/_madison2
-rw-r--r--Completion/Debian/Command/_module-assistant2
-rw-r--r--Completion/Linux/Command/_alsa-utils2
-rw-r--r--Completion/Linux/Command/_basenc30
-rw-r--r--Completion/Linux/Command/_btrfs77
-rw-r--r--Completion/Linux/Command/_choom10
-rw-r--r--Completion/Linux/Command/_cpupower3
-rw-r--r--Completion/Linux/Command/_cryptsetup13
-rw-r--r--Completion/Linux/Command/_dkms11
-rw-r--r--Completion/Linux/Command/_ethtool60
-rw-r--r--Completion/Linux/Command/_findmnt9
-rw-r--r--Completion/Linux/Command/_free2
-rw-r--r--Completion/Linux/Command/_fusermount2
-rw-r--r--Completion/Linux/Command/_ionice4
-rw-r--r--Completion/Linux/Command/_ipset23
-rw-r--r--Completion/Linux/Command/_losetup5
-rw-r--r--Completion/Linux/Command/_lsns18
-rw-r--r--Completion/Linux/Command/_mat19
-rw-r--r--Completion/Linux/Command/_mat219
-rw-r--r--Completion/Linux/Command/_mdadm2
-rw-r--r--Completion/Linux/Command/_modutils27
-rw-r--r--Completion/Linux/Command/_networkmanager9
-rw-r--r--Completion/Linux/Command/_nsenter28
-rw-r--r--Completion/Linux/Command/_perf809
-rw-r--r--Completion/Linux/Command/_pidof2
-rw-r--r--Completion/Linux/Command/_setpriv107
-rw-r--r--Completion/Linux/Command/_sshfs13
-rw-r--r--Completion/Linux/Command/_strace122
-rw-r--r--Completion/Linux/Command/_sysstat15
-rw-r--r--Completion/Linux/Command/_tpb2
-rw-r--r--Completion/Linux/Command/_unshare40
-rw-r--r--Completion/Linux/Command/_valgrind9
-rw-r--r--Completion/Linux/Command/_wipefs1
-rw-r--r--Completion/Linux/Type/_capabilities65
-rw-r--r--Completion/Linux/Type/_fuse_values2
-rw-r--r--Completion/Mandriva/Command/_urpmi6
-rw-r--r--Completion/Redhat/Command/_dnf555
-rw-r--r--Completion/Redhat/Command/_rpm3
-rw-r--r--Completion/Redhat/Command/_yum2
-rw-r--r--Completion/Solaris/Command/_coreadm2
-rw-r--r--Completion/Solaris/Command/_dhcpinfo58
-rw-r--r--Completion/Solaris/Command/_dtrace187
-rw-r--r--Completion/Solaris/Command/_inetadm22
-rw-r--r--Completion/Solaris/Command/_pfexec12
-rw-r--r--Completion/Solaris/Command/_prstat79
-rw-r--r--Completion/Solaris/Command/_svcadm129
-rw-r--r--Completion/Solaris/Command/_svcprop42
-rw-r--r--Completion/Solaris/Command/_zlogin30
-rw-r--r--Completion/Solaris/Type/_svcs_fmri6
-rw-r--r--Completion/Unix/Command/_aap2
-rw-r--r--Completion/Unix/Command/_abcde45
-rw-r--r--Completion/Unix/Command/_ack4
-rw-r--r--Completion/Unix/Command/_adb130
-rw-r--r--Completion/Unix/Command/_ansible208
-rw-r--r--Completion/Unix/Command/_ant2
-rw-r--r--Completion/Unix/Command/_arp2
-rw-r--r--Completion/Unix/Command/_attr1
-rw-r--r--Completion/Unix/Command/_awk4
-rw-r--r--Completion/Unix/Command/_baz24
-rw-r--r--Completion/Unix/Command/_bittorrent2
-rw-r--r--Completion/Unix/Command/_bpython3
-rw-r--r--Completion/Unix/Command/_bzr14
-rw-r--r--Completion/Unix/Command/_chmod5
-rw-r--r--Completion/Unix/Command/_cpio10
-rw-r--r--Completion/Unix/Command/_csplit51
-rw-r--r--Completion/Unix/Command/_ctags244
-rw-r--r--Completion/Unix/Command/_curl2
-rw-r--r--Completion/Unix/Command/_cvs12
-rw-r--r--Completion/Unix/Command/_date6
-rw-r--r--Completion/Unix/Command/_dd14
-rw-r--r--Completion/Unix/Command/_dhclient1
-rw-r--r--Completion/Unix/Command/_dict2
-rw-r--r--Completion/Unix/Command/_dig12
-rw-r--r--Completion/Unix/Command/_django4
-rw-r--r--Completion/Unix/Command/_dmesg11
-rw-r--r--Completion/Unix/Command/_doas21
-rw-r--r--Completion/Unix/Command/_dropbox66
-rw-r--r--Completion/Unix/Command/_dtruss2
-rw-r--r--Completion/Unix/Command/_ecasound4
-rw-r--r--Completion/Unix/Command/_entr1
-rw-r--r--Completion/Unix/Command/_env34
-rw-r--r--Completion/Unix/Command/_fetchmail2
-rw-r--r--Completion/Unix/Command/_ffmpeg6
-rw-r--r--Completion/Unix/Command/_find6
-rw-r--r--Completion/Unix/Command/_fuser2
-rw-r--r--Completion/Unix/Command/_gcc3040
-rw-r--r--Completion/Unix/Command/_gcore16
-rw-r--r--Completion/Unix/Command/_gdb4
-rw-r--r--Completion/Unix/Command/_gem12
-rw-r--r--Completion/Unix/Command/_getfacl1
-rw-r--r--Completion/Unix/Command/_git706
-rw-r--r--Completion/Unix/Command/_gnupod4
-rw-r--r--Completion/Unix/Command/_gnutls11
-rw-r--r--Completion/Unix/Command/_go2
-rw-r--r--Completion/Unix/Command/_gpg2
-rw-r--r--Completion/Unix/Command/_gprof4
-rw-r--r--Completion/Unix/Command/_gradle40
-rw-r--r--Completion/Unix/Command/_grep39
-rw-r--r--Completion/Unix/Command/_growisofs2
-rw-r--r--Completion/Unix/Command/_gzip8
-rw-r--r--Completion/Unix/Command/_head30
-rw-r--r--Completion/Unix/Command/_imagemagick7
-rw-r--r--Completion/Unix/Command/_initctl24
-rw-r--r--Completion/Unix/Command/_install2
-rw-r--r--Completion/Unix/Command/_iostat3
-rw-r--r--Completion/Unix/Command/_java66
-rw-r--r--Completion/Unix/Command/_joe2
-rw-r--r--Completion/Unix/Command/_killall12
-rw-r--r--Completion/Unix/Command/_less43
-rw-r--r--Completion/Unix/Command/_lldb24
-rw-r--r--Completion/Unix/Command/_locale1
-rw-r--r--Completion/Unix/Command/_locate2
-rw-r--r--Completion/Unix/Command/_logger80
-rw-r--r--Completion/Unix/Command/_lp165
-rw-r--r--Completion/Unix/Command/_ls2
-rw-r--r--Completion/Unix/Command/_lsof2
-rw-r--r--Completion/Unix/Command/_luarocks48
-rw-r--r--Completion/Unix/Command/_lz49
-rw-r--r--Completion/Unix/Command/_make2
-rw-r--r--Completion/Unix/Command/_man22
-rw-r--r--Completion/Unix/Command/_md5sum5
-rw-r--r--Completion/Unix/Command/_module2
-rw-r--r--Completion/Unix/Command/_moosic4
-rw-r--r--Completion/Unix/Command/_mtr2
-rw-r--r--Completion/Unix/Command/_mysql_utils6
-rw-r--r--Completion/Unix/Command/_mysqldiff6
-rw-r--r--Completion/Unix/Command/_netstat25
-rw-r--r--Completion/Unix/Command/_nm7
-rw-r--r--Completion/Unix/Command/_nmap24
-rw-r--r--Completion/Unix/Command/_objdump9
-rw-r--r--Completion/Unix/Command/_openstack117
-rw-r--r--Completion/Unix/Command/_opustools71
-rw-r--r--Completion/Unix/Command/_pandoc451
-rw-r--r--Completion/Unix/Command/_patchutils1
-rw-r--r--Completion/Unix/Command/_pbm2
-rw-r--r--Completion/Unix/Command/_perforce14
-rw-r--r--Completion/Unix/Command/_perl103
-rw-r--r--Completion/Unix/Command/_perldoc4
-rw-r--r--Completion/Unix/Command/_pgrep34
-rw-r--r--Completion/Unix/Command/_php2
-rw-r--r--Completion/Unix/Command/_ping69
-rw-r--r--Completion/Unix/Command/_pip213
-rw-r--r--Completion/Unix/Command/_pkginfo36
-rw-r--r--Completion/Unix/Command/_pkgrm32
-rw-r--r--Completion/Unix/Command/_pr103
-rw-r--r--Completion/Unix/Command/_ps4
-rw-r--r--Completion/Unix/Command/_ptx54
-rw-r--r--Completion/Unix/Command/_pv18
-rw-r--r--Completion/Unix/Command/_python7
-rw-r--r--Completion/Unix/Command/_qemu8
-rw-r--r--Completion/Unix/Command/_quilt101
-rw-r--r--Completion/Unix/Command/_rake4
-rw-r--r--Completion/Unix/Command/_rar4
-rw-r--r--Completion/Unix/Command/_rclone16
-rw-r--r--Completion/Unix/Command/_readelf15
-rw-r--r--Completion/Unix/Command/_renice2
-rw-r--r--Completion/Unix/Command/_ri23
-rw-r--r--Completion/Unix/Command/_rm2
-rw-r--r--Completion/Unix/Command/_route2
-rw-r--r--Completion/Unix/Command/_rsync63
-rw-r--r--Completion/Unix/Command/_ruby12
-rw-r--r--Completion/Unix/Command/_runit6
-rw-r--r--Completion/Unix/Command/_samba2
-rw-r--r--Completion/Unix/Command/_scons2
-rw-r--r--Completion/Unix/Command/_script21
-rw-r--r--Completion/Unix/Command/_sed8
-rw-r--r--Completion/Unix/Command/_setfacl10
-rw-r--r--Completion/Unix/Command/_sh46
-rw-r--r--Completion/Unix/Command/_sqlite3
-rw-r--r--Completion/Unix/Command/_ssh137
-rw-r--r--Completion/Unix/Command/_stat2
-rw-r--r--Completion/Unix/Command/_stdbuf6
-rw-r--r--Completion/Unix/Command/_strings2
-rw-r--r--Completion/Unix/Command/_strip1
-rw-r--r--Completion/Unix/Command/_su8
-rw-r--r--Completion/Unix/Command/_subversion99
-rw-r--r--Completion/Unix/Command/_sudo17
-rw-r--r--Completion/Unix/Command/_surfraw94
-rw-r--r--Completion/Unix/Command/_tail24
-rw-r--r--Completion/Unix/Command/_tex2
-rw-r--r--Completion/Unix/Command/_texinfo21
-rw-r--r--Completion/Unix/Command/_tidy2
-rw-r--r--Completion/Unix/Command/_tiff3
-rw-r--r--Completion/Unix/Command/_timeout8
-rw-r--r--Completion/Unix/Command/_tla24
-rw-r--r--Completion/Unix/Command/_tmux267
-rw-r--r--Completion/Unix/Command/_todo.sh7
-rw-r--r--Completion/Unix/Command/_top6
-rw-r--r--Completion/Unix/Command/_tput2
-rw-r--r--Completion/Unix/Command/_transmission40
-rw-r--r--Completion/Unix/Command/_truncate69
-rw-r--r--Completion/Unix/Command/_uname17
-rw-r--r--Completion/Unix/Command/_uniq3
-rw-r--r--Completion/Unix/Command/_unison9
-rw-r--r--Completion/Unix/Command/_units6
-rw-r--r--Completion/Unix/Command/_user_admin2
-rw-r--r--Completion/Unix/Command/_vcsh89
-rw-r--r--Completion/Unix/Command/_vi47
-rw-r--r--Completion/Unix/Command/_vim8
-rw-r--r--Completion/Unix/Command/_vmstat1
-rw-r--r--Completion/Unix/Command/_w1
-rw-r--r--Completion/Unix/Command/_w3m24
-rw-r--r--Completion/Unix/Command/_wget6
-rw-r--r--Completion/Unix/Command/_wiggle6
-rw-r--r--Completion/Unix/Command/_xargs2
-rw-r--r--Completion/Unix/Command/_xmlsoft7
-rw-r--r--Completion/Unix/Command/_xmms216
-rw-r--r--Completion/Unix/Command/_xxd1
-rw-r--r--Completion/Unix/Command/_yafc2
-rw-r--r--Completion/Unix/Command/_zfs1903
-rw-r--r--Completion/Unix/Command/_zip2
-rw-r--r--Completion/Unix/Command/_zpool311
-rw-r--r--Completion/Unix/Type/_bpf_filters2
-rw-r--r--Completion/Unix/Type/_date_formats6
-rw-r--r--Completion/Unix/Type/_diff_options7
-rw-r--r--Completion/Unix/Type/_email_addresses2
-rw-r--r--Completion/Unix/Type/_files47
-rw-r--r--Completion/Unix/Type/_find_net_interfaces12
-rw-r--r--Completion/Unix/Type/_path_commands13
-rw-r--r--Completion/Unix/Type/_perl_modules11
-rw-r--r--Completion/Unix/Type/_pgids5
-rw-r--r--Completion/Unix/Type/_remote_files22
-rw-r--r--Completion/Unix/Type/_ssh_hosts21
-rw-r--r--Completion/Unix/Type/_tar_archive6
-rw-r--r--Completion/Unix/Type/_time_zone2
-rw-r--r--Completion/Unix/Type/_urls2
-rw-r--r--Completion/Unix/Type/_zfs_dataset19
-rw-r--r--Completion/Unix/Type/_zfs_keysource_props15
-rw-r--r--Completion/X/Command/_code2
-rw-r--r--Completion/X/Command/_gnome-gv2
-rw-r--r--Completion/X/Command/_gv5
-rw-r--r--Completion/X/Command/_kdeconnect2
-rw-r--r--Completion/X/Command/_mozilla2
-rw-r--r--Completion/X/Command/_mplayer6
-rw-r--r--Completion/X/Command/_netscape2
-rw-r--r--Completion/X/Command/_pdftk14
-rw-r--r--Completion/X/Command/_sublimetext2
-rw-r--r--Completion/X/Command/_urxvt4
-rw-r--r--Completion/X/Command/_vnc6
-rw-r--r--Completion/X/Command/_xauth2
-rw-r--r--Completion/X/Command/_xdvi2
-rw-r--r--Completion/X/Command/_xinput139
-rw-r--r--Completion/X/Command/_xournal2
-rw-r--r--Completion/X/Command/_xrandr11
-rw-r--r--Completion/X/Command/_xset4
-rw-r--r--Completion/X/Command/_xterm2
-rw-r--r--Completion/X/Type/_x_color13
-rw-r--r--Completion/Zsh/Command/_bindkey2
-rw-r--r--Completion/Zsh/Command/_compadd121
-rw-r--r--Completion/Zsh/Command/_disable10
-rw-r--r--Completion/Zsh/Command/_enable10
-rw-r--r--Completion/Zsh/Command/_fc3
-rw-r--r--Completion/Zsh/Command/_sched2
-rw-r--r--Completion/Zsh/Command/_strftime12
-rw-r--r--Completion/Zsh/Command/_typeset35
-rw-r--r--Completion/Zsh/Command/_zed16
-rw-r--r--Completion/Zsh/Command/_zle8
-rw-r--r--Completion/Zsh/Command/_zmodload4
-rw-r--r--Completion/Zsh/Command/_zstyle34
-rw-r--r--Completion/Zsh/Context/_brace_parameter6
-rw-r--r--Completion/Zsh/Context/_subscript6
-rw-r--r--Completion/Zsh/Context/_zcalc_line2
-rw-r--r--Completion/Zsh/Function/__arguments44
-rw-r--r--Completion/Zsh/Function/_add-zle-hook-widget9
-rw-r--r--Completion/Zsh/Function/_add-zsh-hook11
-rw-r--r--Completion/Zsh/Function/_vcs_info31
-rw-r--r--Completion/Zsh/Function/_zargs20
-rw-r--r--Completion/Zsh/Type/_command_names31
-rw-r--r--Completion/Zsh/Type/_globflags33
-rw-r--r--Completion/Zsh/Type/_globquals8
-rw-r--r--Completion/Zsh/Type/_parameters48
-rw-r--r--Completion/Zsh/Type/_ps12346
-rw-r--r--Completion/Zsh/Type/_vcs_info_hooks2
-rw-r--r--Completion/bashcompinit7
-rw-r--r--Completion/compdump58
-rw-r--r--Completion/compinit48
-rw-r--r--Completion/openSUSE/Command/_hwinfo2
-rw-r--r--Completion/openSUSE/Command/_zypper12
-rw-r--r--Config/version.mk4
-rw-r--r--Doc/Makefile.in1
-rw-r--r--Doc/Zsh/arith.yo2
-rw-r--r--Doc/Zsh/builtins.yo147
-rw-r--r--Doc/Zsh/calsys.yo2
-rw-r--r--Doc/Zsh/compat.yo9
-rw-r--r--Doc/Zsh/compsys.yo312
-rw-r--r--Doc/Zsh/compwid.yo668
-rw-r--r--Doc/Zsh/contrib.yo171
-rw-r--r--Doc/Zsh/exec.yo23
-rw-r--r--Doc/Zsh/expn.yo166
-rw-r--r--Doc/Zsh/func.yo7
-rw-r--r--Doc/Zsh/grammar.yo53
-rw-r--r--Doc/Zsh/intro.yo2
-rw-r--r--Doc/Zsh/jobs.yo4
-rw-r--r--Doc/Zsh/manmodmenu.yo1
-rw-r--r--Doc/Zsh/manual.yo4
-rw-r--r--Doc/Zsh/metafaq.yo35
-rw-r--r--Doc/Zsh/mod_curses.yo2
-rw-r--r--Doc/Zsh/mod_datetime.yo7
-rw-r--r--Doc/Zsh/mod_mapfile.yo2
-rw-r--r--Doc/Zsh/mod_newuser.yo2
-rw-r--r--Doc/Zsh/mod_parameter.yo6
-rw-r--r--Doc/Zsh/mod_private.yo9
-rw-r--r--Doc/Zsh/mod_regex.yo12
-rw-r--r--Doc/Zsh/mod_stat.yo2
-rw-r--r--Doc/Zsh/mod_system.yo24
-rw-r--r--Doc/Zsh/mod_watch.yo146
-rw-r--r--Doc/Zsh/mod_zselect.yo2
-rw-r--r--Doc/Zsh/mod_zutil.yo32
-rw-r--r--Doc/Zsh/modlist.yo10
-rw-r--r--Doc/Zsh/modmenu.yo1
-rw-r--r--Doc/Zsh/options.yo75
-rw-r--r--Doc/Zsh/params.yo164
-rw-r--r--Doc/Zsh/redirect.yo3
-rw-r--r--Doc/Zsh/roadmap.yo4
-rw-r--r--Doc/Zsh/zftpsys.yo8
-rw-r--r--Doc/Zsh/zle.yo87
-rw-r--r--Doc/help/alias8
-rw-r--r--Doc/help/fc95
-rw-r--r--Doc/help/fg2
-rw-r--r--Doc/help/functions120
-rw-r--r--Doc/help/getopts15
-rw-r--r--Doc/help/hash46
-rw-r--r--Doc/help/jobs33
-rw-r--r--Doc/help/kill26
-rw-r--r--Doc/help/let6
-rw-r--r--Doc/help/limit24
-rw-r--r--Doc/help/log2
-rw-r--r--Doc/help/read2
-rw-r--r--Doc/help/return13
-rw-r--r--Doc/help/ttyctl3
-rw-r--r--Doc/help/typeset29
-rw-r--r--Doc/help/umask12
-rw-r--r--Doc/version.yo4
-rw-r--r--Doc/zsh.150
-rw-r--r--Doc/zsh.texi2398
-rw-r--r--Doc/zshall.152
-rw-r--r--Doc/zshbuiltins.1177
-rw-r--r--Doc/zshcalsys.14
-rw-r--r--Doc/zshcompctl.12
-rw-r--r--Doc/zshcompsys.1330
-rw-r--r--Doc/zshcompwid.1691
-rw-r--r--Doc/zshcontrib.1185
-rw-r--r--Doc/zshexpn.1175
-rw-r--r--Doc/zshmisc.1107
-rw-r--r--Doc/zshmodules.1257
-rw-r--r--Doc/zshoptions.162
-rw-r--r--Doc/zshparam.1182
-rw-r--r--Doc/zshroadmap.16
-rw-r--r--Doc/zshtcpsys.12
-rw-r--r--Doc/zshzftpsys.110
-rw-r--r--Doc/zshzle.164
-rw-r--r--Doc/ztexi.yo3
-rw-r--r--Etc/.gitignore1
-rw-r--r--Etc/BUGS34
-rw-r--r--Etc/CONTRIBUTORS8
-rw-r--r--Etc/FAQ257
-rw-r--r--Etc/FAQ.yo292
-rw-r--r--Etc/NEWS-4.32
-rwxr-xr-xEtc/changelog2html.pl2
-rw-r--r--Etc/completion-style-guide37
-rw-r--r--Etc/creating-a-release.txt43
-rw-r--r--Etc/zsh-development-guide8
-rw-r--r--Functions/Chpwd/cdr2
-rw-r--r--Functions/Chpwd/zsh_directory_name_cdr4
-rw-r--r--Functions/Example/zpgrep15
-rw-r--r--Functions/Math/zmathfunc26
-rw-r--r--Functions/Misc/add-zle-hook-widget4
-rw-r--r--Functions/Misc/colors11
-rw-r--r--Functions/Misc/regexp-replace102
-rw-r--r--Functions/Misc/run-help15
-rw-r--r--Functions/Misc/run-help-btrfs18
-rw-r--r--Functions/Misc/run-help-git10
-rw-r--r--Functions/Misc/run-help-ip4
-rw-r--r--Functions/Misc/run-help-p42
-rw-r--r--Functions/Misc/run-help-sudo2
-rw-r--r--Functions/Misc/run-help-svk2
-rw-r--r--Functions/Misc/run-help-svn2
-rw-r--r--Functions/Misc/zargs54
-rw-r--r--Functions/Misc/zed62
-rw-r--r--Functions/Misc/zmathfuncdef2
-rw-r--r--Functions/Newuser/zsh-newuser-install2
-rw-r--r--Functions/Prompts/prompt_restore_setup1
-rw-r--r--Functions/Prompts/promptinit188
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_cvs17
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_git1
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr11
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs11
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_fossil1
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git114
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_hg31
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_p411
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_svk10
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_svn20
-rw-r--r--Functions/VCS_Info/VCS_INFO_bydir_detect2
-rw-r--r--Functions/VCS_Info/VCS_INFO_patch2subject2
-rw-r--r--Functions/VCS_Info/VCS_INFO_quilt57
-rw-r--r--Functions/VCS_Info/VCS_INFO_set-branch-format24
-rw-r--r--Functions/VCS_Info/VCS_INFO_set-patch-format16
-rwxr-xr-xFunctions/VCS_Info/test-repo-git-rebase-apply59
-rwxr-xr-xFunctions/VCS_Info/test-repo-git-rebase-merge59
-rw-r--r--Functions/VCS_Info/vcs_info1
-rw-r--r--Functions/Zle/edit-command-line60
-rw-r--r--Functions/Zle/zed-set-file-name27
-rw-r--r--META-FAQ35
-rw-r--r--Misc/vcs_info-examples78
-rw-r--r--NEWS118
-rw-r--r--README123
-rw-r--r--Src/Builtins/rlimits.awk116
-rw-r--r--Src/Builtins/rlimits.c700
-rw-r--r--Src/Builtins/rlimits.mdd15
-rw-r--r--Src/Modules/curses.c4
-rw-r--r--Src/Modules/curses_keys.awk7
-rw-r--r--Src/Modules/datetime.c5
-rw-r--r--Src/Modules/db_gdbm.c4
-rw-r--r--Src/Modules/files.c44
-rw-r--r--Src/Modules/nearcolor.c2
-rw-r--r--Src/Modules/param_private.c12
-rw-r--r--Src/Modules/parameter.c110
-rw-r--r--Src/Modules/system.c84
-rw-r--r--Src/Modules/watch.c (renamed from Src/watch.c)163
-rw-r--r--Src/Modules/watch.mdd7
-rw-r--r--Src/Modules/zprof.c31
-rw-r--r--Src/Modules/zpty.c11
-rw-r--r--Src/Modules/zutil.c82
-rw-r--r--Src/Zle/comp.h9
-rw-r--r--Src/Zle/compcore.c146
-rw-r--r--Src/Zle/complete.c23
-rw-r--r--Src/Zle/complist.c38
-rw-r--r--Src/Zle/compmatch.c15
-rw-r--r--Src/Zle/compresult.c15
-rw-r--r--Src/Zle/computil.c114
-rw-r--r--Src/Zle/zle.h4
-rw-r--r--Src/Zle/zle_hist.c9
-rw-r--r--Src/Zle/zle_keymap.c2
-rw-r--r--Src/Zle/zle_main.c8
-rw-r--r--Src/Zle/zle_misc.c9
-rw-r--r--Src/Zle/zle_move.c2
-rw-r--r--Src/Zle/zle_refresh.c64
-rw-r--r--Src/Zle/zle_thingy.c19
-rw-r--r--Src/Zle/zle_utils.c23
-rw-r--r--Src/builtin.c136
-rw-r--r--Src/compat.c28
-rw-r--r--Src/exec.c136
-rw-r--r--Src/glob.c87
-rw-r--r--Src/hashnameddir.c125
-rw-r--r--Src/hashtable.c107
-rw-r--r--Src/hist.c99
-rw-r--r--Src/init.c31
-rw-r--r--Src/input.c25
-rw-r--r--Src/jobs.c91
-rw-r--r--Src/lex.c24
-rw-r--r--Src/linklist.c13
-rw-r--r--Src/loop.c12
-rw-r--r--Src/makepro.awk2
-rw-r--r--Src/math.c23
-rw-r--r--Src/mem.c51
-rw-r--r--Src/module.c2
-rw-r--r--Src/openssh_bsd_setres_id.c4
-rw-r--r--Src/options.c6
-rw-r--r--Src/params.c103
-rw-r--r--Src/parse.c112
-rw-r--r--Src/patchlevel.h.release2
-rw-r--r--Src/pattern.c11
-rw-r--r--Src/prompt.c67
-rw-r--r--Src/signals.c20
-rw-r--r--Src/sort.c25
-rw-r--r--Src/string.c5
-rw-r--r--Src/subst.c115
-rw-r--r--Src/text.c4
-rw-r--r--Src/utils.c432
-rw-r--r--Src/zsh.h95
-rw-r--r--Src/zsh.mdd2
-rw-r--r--Src/zsh_system.h21
-rw-r--r--Test/A01grammar.ztst42
-rw-r--r--Test/A04redirect.ztst16
-rw-r--r--Test/A05execution.ztst23
-rw-r--r--Test/B01cd.ztst25
-rw-r--r--Test/B02typeset.ztst8
-rw-r--r--Test/B03print.ztst10
-rw-r--r--Test/B07emulate.ztst22
-rw-r--r--Test/B10getopts.ztst29
-rw-r--r--Test/B11kill.ztst86
-rw-r--r--Test/B12limit.ztst28
-rw-r--r--Test/B13whence.ztst34
-rw-r--r--Test/C01arith.ztst10
-rw-r--r--Test/C02cond.ztst38
-rw-r--r--Test/C04funcdef.ztst8
-rw-r--r--Test/D01prompt.ztst34
-rw-r--r--Test/D02glob.ztst76
-rw-r--r--Test/D03procsubst.ztst13
-rw-r--r--Test/D04parameter.ztst79
-rw-r--r--Test/D06subscript.ztst5
-rw-r--r--Test/D07multibyte.ztst42
-rw-r--r--Test/E01options.ztst64
-rw-r--r--Test/E02xtrace.ztst115
-rw-r--r--Test/E03posix.ztst161
-rw-r--r--Test/P01privileged.ztst23
-rw-r--r--Test/V01zmodload.ztst48
-rw-r--r--Test/V05styles.ztst22
-rw-r--r--Test/V07pcre.ztst3
-rw-r--r--Test/V08zpty.ztst2
-rw-r--r--Test/V09datetime.ztst4
-rw-r--r--Test/V10private.ztst18
-rw-r--r--Test/V12zparseopts.ztst8
-rw-r--r--Test/V13zformat.ztst91
-rw-r--r--Test/V14system.ztst149
-rw-r--r--Test/W01history.ztst22
-rw-r--r--Test/W02jobs.ztst6
-rw-r--r--Test/W03jobparameters.ztst78
-rw-r--r--Test/X02zlevi.ztst4
-rw-r--r--Test/X03zlebindkey.ztst4
-rw-r--r--Test/X04zlehighlight.ztst57
-rw-r--r--Test/Y01completion.ztst115
-rw-r--r--Test/Y02compmatch.ztst130
-rw-r--r--Test/Y03arguments.ztst69
-rw-r--r--Test/Z01is-at-least.ztst27
-rw-r--r--Test/Z02zmathfunc.ztst58
-rw-r--r--Test/Z03run-help.ztst106
-rw-r--r--Test/comptest40
-rw-r--r--Test/runtests.zsh2
-rwxr-xr-xTest/ztst.zsh20
-rw-r--r--Util/ztst-syntax.vim21
-rw-r--r--Util/zyodl.vim24
-rw-r--r--aclocal.m48
-rw-r--r--aczsh.m4117
-rwxr-xr-xconfig.guess27
-rw-r--r--config.h.in16
-rwxr-xr-xconfig.sub31
-rwxr-xr-xconfigure322
-rw-r--r--configure.ac165
584 files changed, 24836 insertions, 9762 deletions
diff --git a/.editorconfig b/.editorconfig
index 808512ec0..ebc2a806b 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -6,10 +6,20 @@ root = true
end_of_line = lf
tab_width = 8
indent_size = 2
+indent_style = space
+
+[**/Makefile*]
indent_style = tab
+indent_size = 8
+
+[Functions/VCS_Info/**/*]
+indent_size = 4
+indent_style = space
[ChangeLog]
indent_size = 8
+indent_style = tab
[*.[ch]]
indent_size = 4
+indent_style = tab
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..ec2f56642
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,157 @@
+Makefile
+tags
+TAGS
+*.o
+*.o.c
+*.orig
+*.a
+*.so
+*.dll
+*~
+.*.sw?
+\#*
+
+/META-FAQ
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.modules
+/config.modules.sh
+/config.status
+/config.status.lineno
+/configure
+/cscope.out
+/stamp-h
+/stamp-h.in
+/autom4te.cache
+
+Config/defs.mk
+
+CVS
+.#*
+
+Doc/help
+Doc/help.txt
+Doc/help/[_a-zA-Z0-9]*
+
+Doc/intro.pdf
+Doc/intro.ps
+Doc/intro.a4.pdf
+Doc/intro.a4.ps
+Doc/intro.us.pdf
+Doc/intro.us.ps
+Doc/version.yo
+Doc/texi2html.conf
+Doc/zsh*.1
+Doc/zsh.texi
+Doc/zsh.info*
+Doc/*.html
+Doc/zsh.aux
+Doc/zsh.toc
+Doc/zsh.cp
+Doc/zsh.cps
+Doc/zsh.fn
+Doc/zsh.fns
+Doc/zsh.ky
+Doc/zsh.kys
+Doc/zsh.pg
+Doc/zsh.pgs
+Doc/zsh.vr
+Doc/zsh.vrs
+Doc/zsh.log
+Doc/zsh.dvi
+Doc/zsh_a4.dvi
+Doc/zsh_us.dvi
+Doc/zsh.tp
+Doc/zsh.tps
+Doc/zsh.idx
+Doc/zsh_*.ps
+Doc/infodir
+Doc/zsh.pdf
+Doc/zsh_a4.pdf
+Doc/zsh_us.pdf
+
+Doc/Zsh/modlist.yo
+Doc/Zsh/modmenu.yo
+Doc/Zsh/manmodmenu.yo
+
+Etc/FAQ
+Etc/FAQ.html
+
+Src/*.epro
+Src/*.export
+Src/*.mdh
+Src/*.mdh.tmp
+Src/*.mdhi
+Src/*.mdhs
+Src/*.syms
+Src/Makemod.in
+Src/Makemod
+Src/[_a-zA-Z0-9]*.pro
+Src/ansi2knr
+Src/bltinmods.list
+Src/cscope.out
+Src/libzsh.so*
+Src/modules-bltin
+Src/modules.index
+Src/modules.index.tmp
+Src/modules.stamp
+Src/patchlevel.h
+Src/sigcount.h
+Src/signames.c
+Src/signames2.c
+Src/stamp-modobjs
+Src/stamp-modobjs.tmp
+Src/tags
+Src/TAGS
+Src/version.h
+Src/zsh
+Src/zsh.exe
+Src/zshcurses.h
+Src/zshpaths.h
+Src/zshterm.h
+Src/zshxmods.h
+
+Src/Builtins/Makefile.in
+Src/Builtins/*.export
+Src/Builtins/so_locations
+Src/Builtins/*.pro
+Src/Builtins/*.epro
+Src/Builtins/*.syms
+Src/Builtins/*.mdh
+Src/Builtins/*.mdhi
+Src/Builtins/*.mdhs
+Src/Builtins/*.mdh.tmp
+
+Src/Modules/Makefile.in
+Src/Modules/*.export
+Src/Modules/so_locations
+Src/Modules/*.pro
+Src/Modules/*.epro
+Src/Modules/*.syms
+Src/Modules/*.mdh
+Src/Modules/*.mdhi
+Src/Modules/*.mdhs
+Src/Modules/*.mdh.tmp
+Src/Modules/errnames.c
+Src/Modules/errcount.h
+Src/Modules/curses_keys.h
+
+Src/Zle/Makefile.in
+Src/Zle/*.export
+Src/Zle/so_locations
+Src/Zle/*.pro
+Src/Zle/*.epro
+Src/Zle/*.syms
+Src/Zle/*.mdh
+Src/Zle/*.mdhi
+Src/Zle/*.mdhs
+Src/Zle/*.mdh.tmp
+Src/Zle/thingies.list
+Src/Zle/widgets.list
+Src/Zle/zle_things.h
+Src/Zle/zle_widget.h
+
+Test/*.tmp
+/.project
diff --git a/ChangeLog b/ChangeLog
index 8a5ad4941..212007ba4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,27 +1,278 @@
-2022-02-12 dana <dana@dana.is>
+2022-04-09 dana <dana@dana.is>
- * unposted: Config/version.mk, Etc/FAQ.yo, README: Update
- for 5.8.1
+ * unposted: Config/version.mk, Etc/FAQ.yo: Update for
+ 5.8.1.2-test (5.9)
-2022-01-27 dana <dana@dana.is>
+ * 49958: NEWS: Dedicate zsh 5.9 to Sven Guckes
- * Jun-ichi Takimoto: unposted: Src/input.c: add 'static' to
- shinsavestack
+ * 49958, (tweaked per 50019): NEWS, README: Add missing
+ changes, update for zsh 5.9
- * Peter Stephenson: 49290: Src/init.c, Src/input.c: Replace
- stdio for buffered shell input to avoid memory management
- interacting with signal handlers.
+2022-04-06 Matthew Martin <phy1729@gmail.com>
- * Jun-ichi Takimoto: 49377: Src/Zle/zle_keymap.c,
- Test/X03zlebindkey.ztst: fix segfault by 'bindkey -d' with
- reordered keymapnamtab
+ * 49960: Doc/Zsh/compsys.yo: Sort lists in zshcompsys.
- * Jun-ichi Takimoto: 47560: configure.ac, aczsh.m4: add necessary
- includes or prototypes for the tests in configure (fix errors in
- macOS 11)
+2022-04-05 Bart Schaefer <schaefer@toltec-ubuntu>
- * unposted: Completion/Unix/Command/_git: Fix copy/paste error
- in earlier commit that broke `git stash drop`
+ * 49994: Src/glob.c: Single-byte equivalence of users/22601 and
+ workers/40891 for matching against zero-length strings
+
+2022-04-05 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 49989: Src/Zle/compresult.c, Src/utils.c, Src/zsh.h: Align
+ "nice" printing for single byte compilation with multibyte.
+
+2022-04-04 Bart Schaefer <schaefer@zsh.org>
+
+ * 49992: Src/utils.c: further unify single- and multi-byte
+ implementations of nicechar() to fix ${(V)...} output format
+
+ * 49991: Src/glob.c, Src/utils.c: single-byte brace expansion
+ handles $'\0' and control character output aligns with multibyte
+
+ * 49990: Src/hist.c: in single-byte, like multibyte, casemodify()
+ avoids metafying characters that it otherwise did not touch
+
+2022-04-03 Bart Schaefer <schaefer@zsh.org>
+
+ * 49955 (with thanks to Madhu <enometh@meer.net>): Src/glob.c:
+ fix bad free in incremental-pattern-search matching (observed
+ only when compiled without MULTIBYTE support)
+
+2022-04-03 Mikael Magnusson <mikachu@gmail.com>
+
+ * 49959: Completion/Zsh/Context/_brace_parameter:
+ _brace_parameter: add (-)
+
+ * 49957: Src/Zle/compcore.c: Brown paper bag for 49915
+
+ * 49961: Completion/Unix/Command/_adb: _adb: handle exec-out
+ like shell
+
+ * 49962: Completion/Unix/Command/_adb: _adb: Add dumpsys and
+ cmd completion
+
+ * 49963: Completion/Unix/Command/_adb: _adb: Fix device serial
+ completion for hostname:port syntax
+
+ * 49964: Completion/Unix/Command/_adb: _adb: Complete services
+ for start/stop
+
+ * 49965: Completion/Unix/Command/_adb: _adb: use $CURRENT instead
+ of $#words
+
+ * 49966: Completion/Unix/Command/_adb: _adb: Parse device spec
+ correctly
+
+ * 49967: Completion/Unix/Command/_adb: _adb: Handle dumpsys
+ SurfaceFlinger arguments
+
+ * 49968: Completion/Unix/Command/_adb: _adb: also replace model
+ names, since device names aren't sent on wifi listing
+
+2022-04-02 dana <dana@dana.is>
+
+ * unposted (see 48073): Completion/Zsh/Command/_fc: Complete
+ new -s option
+
+ * unposted (see security/107): Etc/creating-a-release.txt:
+ Normalise white space, clarify some steps
+
+2022-04-01 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49943: Completion/Unix/Type/_time_zone: offer only filenames
+ starting with an uppercase letter
+
+2022-03-31 Matthew Martin <phy1729@gmail.com>
+
+ * unposted: Completion/BSD/Command/_rcctl: Fix typo.
+
+ * github #88: elig0n: Doc/Zsh/func.yo: Fix typo.
+
+ * 49933: Doc/Zsh/mod_system.yo, Src/Modules/system.c: Add
+ nonblock to sysopen.
+
+ * 49932: Completion/Zsh/Context/_brace_parameter: Update
+ _brace_parameter # description.
+
+ * 49931: Completion/BSD/Command/_bsd_pkg: Update _bsd_pkg.
+
+ * 49907: Etc/completion-style-guide: Mention _numbers in
+ completion guide.
+
+2022-03-31 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 27639: Doc/Zsh/expn.yo: clarify that ${(#)...} deals with
+ character codes.
+
+2022-03-30 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 49906 (Bart), 49911: Doc/Zsh/builtins.yo,
+ Doc/Zsh/mod_parameter.yo, Src/exec.c, Src/jobs.c,
+ Test/W03jobparameters.ztst: Fix querying jobs in subshell.
+ Don't query invalid job at end, if background job started in
+ subshell query jobs in subshell instead of main shell.
+
+2022-03-30 Mikael Magnusson <mikachu@gmail.com>
+
+ * 49893: Src/Zle/comp.h, Src/Zle/compcore.c: Fix comments for
+ UNIQCON/ALL
+
+ * 49915: Src/Zle/comp.h, Src/Zle/compcore.c: Efficient dedup
+ for unsorted completions
+
+ * 49870: Src/glob.c: Fix NULL reference in match code more
+
+ * 49813: Doc/Zsh/redirect.yo, Src/exec.c: <<<: Document newline
+ behavior and fix optimization
+
+ * 49820: Src/Zle/compresult.c: Fix a crash when completing with
+ combination of -Q and braces
+
+2022-03-30 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49910: Test/D07multibyte.ztst, Test/E03posix.ztst: move
+ multibyte-related incompatibility with POSIX from E03 to D07
+
+ * 49908: Test/ztst.zsh: reset LC_CTYPE to C during tests.
+
+2022-03-29 Bart Schaefer <schaefer@zsh.org>
+
+ * 49918: NEWS, README: Update for 49917 and 49911.
+
+ * 49917: Completion/compinit, Doc/Zsh/compsys.yo: change sense
+ of "Ignore insecure ..." answer to ignore the files rather than
+ ignore the problem. Use "autoload -r" for autoload paths.
+
+2022-03-29 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49853 + 49882/49883: Src/subst.c, Test/D04parameter.ztst: make
+ "${array[*]:offset:length}" compatible with ksh/bash
+
+2022-03-28 Bart Schaefer <schaefer@zsh.org>
+
+ * 49897: Functions/Misc/zargs: Eliminate reliance on $jobstates
+ parameter, fix -P exit status check.
+
+2022-03-28 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 49890: Src/Zle/zle_utils.c: best not to look at unallocated
+ memory in saved command line.
+
+2022-03-24 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 49875: Completion/Unix/Command/_texinfo: info -f completes
+ both info pages by search and (if there's a slash present) local
+ files. Not all versions of info seem to need the slash, however.
+
+ * 49845: Doc/Zsh/options.yo: clarify that options can be local
+ in function scope.
+
+2022-03-18 Matthew Martin <phy1729@gmail.com>
+
+ * 49852: Completion/BSD/Command/_pfctl,
+ Completion/BSD/Type/_routing_domains,
+ Completion/BSD/Type/_routing_tables,
+ Completion/Unix/Command/_arp, Completion/Unix/Command/_netstat,
+ Completion/Unix/Command/_pgrep, Completion/Unix/Command/_ping,
+ Completion/Unix/Command/_route, Completion/Unix/Command/_top:
+ Add _routing_domains and _routing_tables types.
+
+ * 49851: Completion/BSD/Type/_login_classes: Complete
+ login.conf.d classes.
+
+2022-03-13 Bart Schaefer <schaefer@zsh.org>
+
+ * 49844: Doc/Zsh/expn.yo, Doc/Zsh/zle.yo: Fix node reference
+ errors from 49446 and 49448.
+
+2022-03-08 Mikael Magnusson <mikachu@gmail.com>
+
+ * 49773: Functions/Prompts/promptinit: promptinit: only exclude
+ current theme from preview if no arguments are given
+
+2022-03-06 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49802 (+ 49804:Daniel): Test/W03jobparameters.ztst: pass
+ MODULE_PATH to the zsh started by zpty
+
+2022-03-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 49792: Src/input.c, Test/A01grammar.ztst: Use line buffering
+ for non-interactive input.
+
+ * 49787: Test/W02jobs.ztst, Test/W03jobparameters.ztst: test for
+ jobs fix in 49783.
+
+2022-03-01 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 49783: Src/jobs.c, Src/Modules/parameter.c: Consistently use
+ old job table in parameter module.
+
+ * users/27536: Doc/Zsh/builtins.yo: Clarify interaction of
+ history matching and numeric indices.
+
+2022-02-23 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49766: Completion/Unix/Command/_less: add quotes to -" and -#
+
+ * 49765: Completion/Unix/Command/_less: add option --color
+ as synonym for -D
+
+2022-02-22 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Doc/Zsh/contrib.yo, Src/Modules/parameter.c,
+ Src/string.c, Src/zsh.h: Fix some typos and markup.
+
+2022-02-22 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 49672: Doc/Zsh/expn.yo: document "tied" output in parameter
+ (t) output.
+
+2022-02-22 Mikael Magnusson <mikachu@gmail.com>
+
+ * 49769: Doc/Zsh/mod_stat.yo: Mention how to show nanosecond
+ precision
+
+2022-02-20 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 49728: Functions/VCS_Info/Backends/VCS_INFO_get_data_hg:
+ vcs_info hg mq: Don't include applied patches in the unapplied
+ patches
+
+ * 49727 (+ comment): Doc/Zsh/contrib.yo,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_git,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_hg,
+ Functions/VCS_Info/VCS_INFO_quilt,
+ Functions/VCS_Info/VCS_INFO_set-patch-format: vcs_info
+ quilt: Pass the patches dir path to the gen-applied-string,
+ gen-unapplied-string, and set-patch-format hooks
+
+ * unposted: Functions/VCS_Info/Backends/VCS_INFO_get_data_hg:
+ vcs_info hg mg (with get-unapplied set): Stop leaking a variable
+ to global scope
+
+2022-02-16 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49757 (sourceforge #1): samcarter: Completion/Unix/Command/_tex:
+ offer *.dtx as TeX input files
+
+2022-02-15 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49756 + 49758 (Daniel): Etc/FAQ.yo, Util/zyodl.vim: replace
+ yodl macro LPAR() in FAQ.yo by SUBST(_LPAR_)
+
+2022-02-13 Axel Beckert <abe@deuxchevaux.org>
+
+ * unposted: README: Fix underline length of "Incompatibilities
+ between 5.5.1 and 5.6.2" headline. (Cosmetic fix)
+
+2022-02-12 dana <dana@dana.is>
+
+ * unposted: Config/version.mk: Post-release version bump
+
+ * unposted: Config/version.mk, Etc/FAQ.yo, README: Update
+ for 5.8.1
* Marc Cornellà: security/82 (tweaked):
Functions/VCS_Info/VCS_INFO_formats: Fix typo in
@@ -37,8 +288,2461 @@
* Oliver Kiddle: security/41: Src/prompt.c: Prevent recursive
PROMPT_SUBST
+2022-02-04 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49730: Completion/Unix/Command/_csplit,
+ Completion/Unix/Command/_pr, Completion/Unix/Command/_ptx,
+ Completion/Unix/Command/_truncate: New completers
+
+2022-02-02 Matthew Martin <phy1729@gmail.com>
+
+ * 49731: Completion/BSD/Command/_sysclean,
+ Completion/BSD/Command/_sysmerge,
+ Completion/BSD/Command/_syspatch,
+ Completion/BSD/Command/_sysupgrade: Add completers
+
+2022-01-30 Mikael Magnusson <mikachu@gmail.com>
+
+ * 49694 + doc: Doc/Zsh/builtins.yo, Doc/Zsh/params.yo, Src/exec.c:
+ Allow using empty STTY= to freeze tty for a single command
+
+2022-01-29 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Functions/VCS_Info/test-repo-git-rebase-apply,
+ Functions/VCS_Info/test-repo-git-rebase-merge: vcs_info git:
+ Teach the rebase-apply test case generator to also generate
+ rebase-merge test cases
+
+ * unposted: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: Add a missing guard against redefining a function.
+
+ * unposted: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: Deconfuse $EDITOR
+
+ * unposted: Functions/VCS_Info/VCS_INFO_patch2subject,
+ Functions/VCS_Info/VCS_INFO_set-branch-format,
+ Functions/VCS_Info/VCS_INFO_set-patch-format: vcs_info: Add
+ Vim modelines
+
+ * 49723: Functions/VCS_Info/VCS_INFO_quilt: vcs_info quilt:
+ Use quilt-patch-dir and ${QUILT_PATCHES} even when get-unapplied
+ hasn't been set
+
+ * 49722: Functions/VCS_Info/VCS_INFO_quilt: vcs_info quilt:
+ Refactor for readability. No functional change.
+
+ * 49715: Completion/Unix/Command/_subversion: add: Complete
+ target arguments to this subcommand
+
+ * 49714: Completion/Unix/Command/_subversion: resolve: Complete
+ conflicted files created by merges, too
+
+ * 49713: Completion/Unix/Command/_subversion: commit, diff,
+ revert: Update completions for svn 1.7 and newer
+
+ * 49712: Completion/Unix/Command/_subversion: svn rm: Complete
+ all svn-controlled files, not only missing/deleted files
+
+ * 49711: Completion/Unix/Command/_subversion: _svn_status:
+ Don't offer unversioned files
+
+2022-01-27 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Doc/Zsh/contrib.yo: vcs_info quilt docs: Fix
+ misspelled style name
+
+ * unposted: Functions/VCS_Info/VCS_INFO_quilt: vcs_info quilt:
+ Remove a no-op variable assignment
+
+2022-01-25 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 49709: Functions/VCS_Info/Backends/VCS_INFO_get_data_hg:
+ vcs_info hg: Keep $HGPLAIN set for hooks if it had been set
+ outside vcs_info
+
+2022-01-23 Andreas Schneider <asn@cryptomilk.org>
+
+ * gitlab !17: Completion/Unix/Command/_quilt: Add missing
+ options for quilt setup command
+
+2022-01-01 Bart Schaefer <schaefer@zsh.org>
+
+ * Matt Alexander: 49667: Functions/Misc/colors: include "gray"
+
+2021-12-29 Oliver Kiddle <opk@zsh.org>
+
+ * Aaron Schrab: 49664: Completion/Unix/Command/_git:
+ Use associative array for third-party completion
+
+ * 49668: Completion/Unix/Command/_zfs,
+ Completion/Unix/Type/_zfs_dataset: update zfs completion
+
+2021-12-24 Bart Schaefer <schaefer@zsh.org>
+
+ * m0viefreak: 38150: Src/Zle/compmatch.c: fix off-by-one error
+ in matcher spec parsing
+
+2021-12-21 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 49658: Src/glob.c: Remove erroneous use of NULL pointer for
+ replacement pattern match.
+
+2021-12-21 Oliver Kiddle <opk@zsh.org>
+
+ * 49655 based on 34928 (Daniel Hahler):
+ Completion/Unix/Command/_pip: new pip completion
+
+2021-12-16 Oliver Kiddle <opk@zsh.org>
+
+ * 49653: Src/Zle/computil.c: fix array indexing issue introduced
+ with 49518 due to using decimal rather than hex 20
+
+ * 49648 based on github #80 (Vincent Bernat):
+ Completion/Unix/Command/_find, Completion/Zsh/Type/_globquals:
+ invert before/since for date glob qualifiers completion
+
+2021-12-14 Oliver Kiddle <opk@zsh.org>
+
+ * 49518: Src/Zle/computil.c, Etc/BUGS, Test/Y03arguments.ztst:
+ fix exclusions for mixed - and + stacked options
+
+2021-12-13 Oliver Kiddle <opk@zsh.org>
+
+ * 49646: Doc/Zsh/mod_watch.yo, Src/Modules/watch.c, Src/prompt.c:
+ allow colors in WATCHFMT with %F/%K
+
+ * 49645: Completion/Unix/Type/_path_commands: when completing for
+ the path_dirs option, add a / suffix and follow symlinks
+
+ * 49643: Completion/Zsh/Type/_command_names: facilitate use
+ of the fake style by always calling _description with the
+ executables tag
+
+ * 49634, reported by Claes Nästén: configure.ac: revert 28989,
+ defining _POSIX_C_SOURCE caused issues on Solaris 10 but
+ doesn't seem to be needed for musl anymore
+
+2021-12-07 Oliver Kiddle <opk@zsh.org>
+
+ * 49633: Completion/Unix/Command/_git: update options for git 2.34
+
+2021-12-02 Oliver Kiddle <opk@zsh.org>
+
+ * 49630: Completion/bashcompinit: allow zsh to quote matches but
+ include a special case for space suffixes
+
+ * 49631: Completion/Unix/Command/_logger: new logger completion
+
+ * 49629: Completion/Linux/Command/_perf: new Linux perf completion
+
+2021-12-01 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 49628: Test/D01prompt.ztst: Add an xfail test for RPS1/RPROMPT
+ equivalence.
+
+ * 49624: Test/E03posix.ztst: Expect the test 'All identifiers
+ are variable references in POSIX arithmetic' to pass, as it
+ has been passing since 49611.
+
+ * unposted: Doc/Zsh/zle.yo, Doc/ztexi.yo: Add whitespace and
+ comments. No functional change.
+
+ * 49621: Doc/Zsh/manual.yo, Doc/Zsh/zle.yo: Fix the info Doc
+ build, broken in 49448.
+
+2021-11-30 Oliver Kiddle <opk@zsh.org>
+
+ * 49612: Src/module.c: avoid startup error with clashing non-local
+ module parameter name
+
+ * 49611 based on 49590 (Martijn Dekker): Src/math.c: disable Inf
+ and NaN in math expressions for sh emulation
+
+2021-11-28 Oliver Kiddle <opk@zsh.org>
+
+ * 49606: Src/hashnameddir.c, Src/utils.c, configure.ac: remove old
+ NIS-specific code for retrieving user data
+
+ * 49602: Src/params.c: only set LOGCHECK from the watch module
+
+ * 49601: Src/hist.c, Test/W01history.ztst: don't create
+ ambiguous history file entries for lines ending with a backslash
+
+2021-11-26 Paul Seyfert <Paul.Seyfert@sevensense.ch>
+
+ * github #83: Completion/Unix/Command/_git: _git-push,
+ _git-send-pack: Make --push-option repeatable.
+
+2021-11-26 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 49448: Doc/Zsh/contrib.yo, Doc/Zsh/zle.yo: docs: Fix pointers
+ to the `Widgets', `User-defined Widgets', and `Standard Widgets'
+ sections.
+
+ * 49447: Doc/Zsh/compsys.yo: docs: _wanted: Clarify the example
+ and point to another one.
+
+ * 49446: Doc/Zsh/expn.yo: docs: Add texinode()s, so the next
+ commit can link directly to a subsection.
+
+ * 49445: Doc/Zsh/calsys.yo, Doc/Zsh/contrib.yo, Doc/Zsh/expn.yo,
+ Doc/Zsh/intro.yo, Doc/Zsh/jobs.yo, Doc/Zsh/mod_newuser.yo,
+ Doc/Zsh/options.yo, Doc/Zsh/params.yo, Doc/Zsh/roadmap.yo,
+ Doc/Zsh/zle.yo: docs: Clean up some subsection references.
+
+ * 49449: Completion/Unix/Command/_stat: _zstat: Don't offer -o
+ after -s, since -s is ignored when both -s and -o are specified.
+
+ * 47599 (tweaked): New test for '{foo,bar}' in command position
+
+2021-11-24 Oliver Kiddle <opk@zsh.org>
+
+ * 49597: Completion/Base/Core/_description, Doc/Zsh/compsys.yo,
+ Completion/Base/Utility/_numbers, Completion/BSD/Command/_ipfw,
+ Completion/Linux/Command/_btrfs, Completion/Unix/Command/_dd,
+ Completion/Unix/Command/_git, Completion/Unix/Command/_head,
+ Completion/Unix/Command/_killall, Completion/Unix/Command/_pv,
+ Completion/Unix/Command/_rclone, Completion/Unix/Command/_rsync,
+ Completion/Unix/Command/_stdbuf, Completion/Unix/Command/_tail,
+ Completion/Unix/Command/_timeout, Completion/Unix/Command/_zfs,
+ Completion/X/Command/_xset: add a helper for completing numbers
+ with unit suffixes and separate out defaults, ranges and units
+ in completion descriptions
+
+2021-11-22 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49586: Src/hist.c: fix :a and :A modifiers (with PWD="/") on
+ Cygwin
+
+2021-11-19 Oliver Kiddle <opk@zsh.org>
+
+ * 49594: Completion/Unix/Command/_chmod: adapt to changes in 49499
+ to ensure file modes starting with dash aren't taken to be flags
+
+ * 49584: Completion/Unix/Command/_gem: allow for build options
+ in gem install completion
+
+ * Arseny Maslennikov: 49575: Doc/Zsh/compsys.yo:
+ clarify _alternative's action syntax
+
+2021-11-15 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49563: Src/Modules/watch.c: fix build problem of watch module
+ on Cygwin
+
+2021-11-12 Oliver Kiddle <opk@zsh.org>
+
+ * github #82: Dimitris Apostolou: Completion/BSD/Command/_kdump,
+ Completion/Redhat/Command/_dnf, Completion/BSD/Command/_ktrace,
+ Completion/Linux/Command/_modutils, Test/A01grammar.ztst,
+ Completion/Linux/Command/_sysstat, Functions/Chpwd/cdr,
+ Completion/Unix/Command/_ansible, Completion/Unix/Command/_gcc,
+ Completion/Mandriva/Command/_urpmi, Etc/NEWS-4.3,
+ Completion/Debian/Command/_aptitude, Etc/FAQ.yo,
+ Functions/Newuser/zsh-newuser-install, NEWS,
+ Functions/Misc/regexp-replace, Src/Zle/compmatch.c,
+ Src/exec.c, Src/math.c, Test/B12limit.ztst: fix typos
+
+ * Marlon: 49572: Completion/Base/Completer/_expand,
+ Test/Y01completion.ztst: Let _expand preserve array form w/out
+ zstyle glob
+
+ * unposted: Completion/Unix/Command/_ansible: fix case statement
+ fall-through for ansible-galaxy role completion
+
+ * 49566: Doc/Zsh/compsys.yo: document the _default function
+
+ * 49564: Completion/Unix/Type/_files, Doc/Zsh/compsys.yo: always
+ use descriptions included in the file-patterns style and allow
+ the recursive-files style to also work in those cases
+
+ * 49562: Doc/Zsh/compsys.yo: remove old documentation for
+ other-files tag that was removed in 36165
+
+ * 49561: Src/Modules/zutil.c, Doc/Zsh/mod_zutil.yo,
+ Completion/Base/Core/_description, Completion/Base/Core/_message,
+ Test/V13zformat.ztst: Add zformat -F option, similar to -f but
+ ternary expressions check for existence instead of doing math
+ evaluation. Make use of it with the format style.
+
+2021-11-07 Oliver Kiddle <opk@zsh.org>
+
+ * 49544: Src/Modules/watch.c: only tie watch/WATCH if both come
+ from the module
+
+2021-11-02 Oliver Kiddle <opk@zsh.org>
+
+ * 49534, 49539: Doc/Makefile.in, Doc/Zsh/builtins.yo,
+ Doc/Zsh/compat.yo, Doc/Zsh/mod_watch.yo, Doc/Zsh/params.yo,
+ Src/Modules/watch.mdd, Src/builtin.c, Src/init.c, Src/params.c,
+ Src/utils.c, Src/Modules/watch.c, Src/zsh.mdd: separate watch/log
+ functionality out into a module
+
+ * 49537: aczsh.m4, configure.ac: fix finding utmpx file on FreeBSD
+
+2021-11-01 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49535: Src/Zle/compcore.c: fix completion of parameter names
+ for ${<TAB> and ${(a)<TAB>
+
+2021-10-31 Bart Schaefer <schaefer@zsh.org>
+
+ * users/27302: Completion/Unix/Type/_remote_files: respect setting
+ of AUTO_REMOVE_SLASH option
+
+2021-10-30 Oliver Kiddle <opk@zsh.org>
+
+ * 49533: Src/utils.c: add null check for preprompt functions list
+ that could occur following an error when loading a module
+
+ * 49528: Src/Zle/comp.h, Src/Zle/compcore.c, Src/Zle/complete.c,
+ Completion/X/Command/_xinput, Completion/Zsh/Command/_compadd,
+ Doc/Zsh/compwid.yo: allow multiple -D options to compadd
+
+ * unposted (c.f. Bart: 49531): Test/Y02compmatch.ztst: fix test
+
+2021-10-27 Matthew Martin <phy1729@gmail.com>
+
+ * 49529: Completion/BSD/Command/_rcctl: Add rogue and
+ descriptions to _rcctl ls.
+
+2021-10-26 Oliver Kiddle <opk@zsh.org>
+
+ * Peter Palfrader: 49431 (tweaked, c.f. Bart: 49434):
+ Completion/Unix/Type/_ssh_hosts: Faster ~/.ssh/config processing
+
+ * Marlon: 49521: Doc/Zsh/compwid.yo, Test/Y02compmatch.ztst:
+ Define correct behavior of || completion matchers
+
+ * 49519: Completion/Base/Utility/_arguments,
+ Completion/Darwin/Command/_qtplay, Completion/Unix/Command/_less,
+ Completion/Unix/Command/_nm, Completion/Unix/Command/_php,
+ Completion/Unix/Command/_strings, Completion/Unix/Command/_zip,
+ Completion/X/Command/_gnome-gv: quote completed options as needed
+ and remove the now superfluous quotes from option specifications
+
+ * 49516: Src/Zle/compmatch.c: bail out early from matching
+ control if command line content is too short for the coanchor
+
+2021-10-24 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49520: Etc/completion-style-guide: document $_args_cache_cmd
+
+ * 49493: Completion/Base/Utility/_arguments: fix handling of
+ optional argument of long option in help text
+
+2021-10-23 Oliver Kiddle <opk@zsh.org>
+
+ * 49499 based on 49496 by Jun T.: Src/Zle/computil.c,
+ Test/Y03arguments.ztst: fixes to option -A of _arguments
+
+ * 49500: Completion/Linux/Command/_lsns: new completion
+
+2021-10-16 dana <dana@dana.is>
+
+ * github #79 (tweaked): Xavier Hsinyuan:
+ Completion/Unix/Command/_ssh: update options in apple's version
+ of ssh-add
+
+2021-10-13 Matthew Martin <phy1729@gmail.com>
+
+ * 49441: Completion/Unix/Command/_timeout: Add OpenBSD.
+
+2021-10-11 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49464: Completion/Linux/Command/_basenc: new completion
+
+2021-10-05 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 49433: Src/parse.c: Assuming EPROG references are bounded by
+ function depth is incorrect as we have efficient function copy.
+
+2021-10-04 Bart Schaefer <schaefer@zsh.org>
+
+ * 49456: Doc/Zsh/mod_private.yo, Doc/Zsh/params.yo,
+ Src/Modules/param_private.c, Src/params.c, Test/V10private.ztst:
+ clean up detection of private params in nested scopes, update doc
+
+2021-09-28 Oliver Kiddle <opk@zsh.org>
+
+ * ivan tkachenko: 49440: Doc/Zsh/expn.yo: Make double-flag
+ parameter expansion syntax more discoverable in docs
+
+ * ivan tkachenko: 49435: Doc/Zsh/expn.yo: Remove trailing whitespace
+
+ * Alex Xu: 49444: Completion/Unix/Type/_tar_archive:
+ libarchive tar can actually extract much more formats
+
+ * Marlon Richert: 49423: Completion/Unix/Command/_gradle:
+ Add support for multi-project builds
+
+ * 49454: Completion/compdump: open dump file once only instead
+ of reopening it for appends
+
+ * 49450: Src/Zle/compcore.c: don't display explanation with
+ compadd -x if any of -D, -A or -O are also used
+
+2021-09-26 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Doc/Zsh/contrib.yo, Doc/Zsh/mod_curses.yo,
+ Doc/Zsh/mod_zselect.yo, Test/A05execution.ztst,
+ Test/C04funcdef.ztst: Fix typos
+
+2021-09-22 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49422: Src/Modules/parameter.c, Src/hashnameddir.c, Src/options.c,
+ Src/params.c, Src/utils.c: improve support of --disable-dynamic-nss
+
+2021-09-09 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 49353: Src/exe.c, Test/A01grammar.ztst: In sourced file,
+ always parse comments normally, ignoring INTERACTIVE_COMMENTS.
+
+2021-09-08 Bart Schaefer <schaefer@zsh.org>
+
+ * 49391: Doc/Zsh/zle.yo: document default bracketed-paste bindings
+
+ * 49389: Completion/Zsh/Command/_typeset: leading variables in
+ autoload file completion
+
+ * 49387: Src/Zle/zle_misc.c: suffix highlight with "compadd -R"
+
+ * 49386: Test/Z03run-help.ztst: handle separate source/build trees
+
+2021-09-08 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * unposted: Src/Modules/db_gdbm.c, Src/Modules/files.c,
+ Src/Modules/nearcolor.c, Src/Zle/complete.c, Src/builtin.c:
+ add/remove UNUSED() for some funtion parameters
+
+ * unposted: Src/input.c: add 'static' to shinsavestack
+
+ * 49377: Src/Zle/zle_keymap.c, Test/X03zlebindkey.ztst: fix
+ segfault by 'bindkey -d' with reordered keymapnamtab
+
+2021-09-06 Bart Schaefer <schaefer@zsh.org>
+
+ * Stephane Chazelas: 45180: Doc/Zsh/contrib.yo,
+ Functions/Example/zpgrep, Functions/Misc/regexp-replace: clarify
+ doc for POSIX EREs, fix an issue with PCRE when the replacement
+ was empty or generated more than one element
+
+ * zeurkous: 49154: Doc/Zsh/exec.yo: clarify status on exec failure
+
+ * Marlon Richert: 49378: Src/parse.c: skip check for collision
+ of aliases and functions when NO_EXEC
+
+ * Marlon Richert: 49292: Src/Zle/complist.c: turn off colors
+ before clearing to end of line
+
+ * 49282: set $0 correctly when calling functions from hooks
+
+ * 49266: fix segfault on metacharacters in long job texts
+
+ * Marlon Richert: 49218: Functions/Misc/run-help,
+ Functions/Misc/run-help-btrfs, Functions/Misc/run-help-git,
+ Functions/Misc/run-help-ip, Functions/Misc/run-help-p4,
+ Functions/Misc/run-help-svk, Functions/Misc/run-help-svn:
+ run-help filters cmd_args before calling run-help-<command>
+
+ * unposted (cf. 49202 and 49217): Src/Zle/zle_hist.c: insertlastword
+ ignores blank/missing history entries when repeating
+
+ * 49196: Src/Modules/db_gdbm.c: gdbm keys not present in the
+ database appear unset in tied hashes
+
+ * Marlon Richert: 48969: fix for "zle -N" completion
+
+ * 48888: Doc/Zsh/mod_system.yo, Doc/Zsh/params.yo, Test/E03posix.ztst:
+ improve doc for $$ and $PPID, add fail test for PPID readonly-ness
+
+ * 48832: Completion/Unix/Command/_curl: try _gnu_generic first
+
+2021-09-04 Oliver Kiddle <opk@zsh.org>
+
+ * Shohei YOSHIDA: 49343: Completion/Unix/Command/_md5sum:
+ Fix file name completion of GNU digest utilities
+
+ * 49345: Completion/Unix/Command/_git: fix git file completion
+ for paths starting with ../
+
+2021-08-29 Oliver Kiddle <opk@zsh.org>
+
+ * 49327: Completion/Unix/Command/_git: complete for new git
+ maintenance, for-each-repo, sparse-checkout and bugreport commands
+
+ * 49319: Completion/...: completion options update
+
+ * 49317: Completion/Unix/Command/_transmission,
+ Completion/Unix/Command/_gcore, Completion/Unix/Command/_pandoc,
+ Completion/Unix/Command/_luarocks: cleanup inappropriate use
+ of {...} specs with _arguments or _alternative
+
+ * 49316: Completion/Unix/Command/_transmission,
+ Completion/Unix/Command/_bittorrent, Completion/Unix/Command/_go,
+ Completion/Unix/Command/_pandoc, Completion/X/Command/_pdftk:
+ add (-.) glob qualifier to globs where only files are applicable
+
+ * 49315: Completion/Unix/Command/_transmission,
+ Completion/Debian/Command/_dak, Completion/Linux/Command/_tpb,
+ Completion/Mandriva/Command/_urpmi, Completion/Unix/Command/_cpio,
+ Completion/Unix/Command/_dropbox, Completion/X/Command/_urxvt,
+ Completion/Unix/Command/_growisofs,
+ Completion/Unix/Command/_perforce,
+ Completion/Unix/Command/_mysql_utils:
+ list units in brackets at the end of group descriptions
+
+2021-08-28 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Peter A. Castro: users/26982 (subset as most of this already
+ present): Src/openssh_bsd_setres_id.c: use standard header
+ includes.
+
+2021-08-27 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 49290: Src/init.c, Src/input.c: Replace stdio for buffered
+ shell input to avoid memory management interacting with signal
+ handlers.
+
+2021-08-27 Oliver Kiddle <opk@zsh.org>
+
+ * Marlon: 49272: Completion/Base/Utility/_call_program:
+ Set $COLUMNS in _call_program to ensure cached command
+ output is sufficiently wide
+
+ * unposted (based on Marlon: 49273):
+ Completion/Zsh/Command/_typeset: add -x to local completion
+
+ * 49309: Completion/Linux/Command/_strace: update the
+ strace completion through strace 5.13
+
+ * 49306: Completion/Linux/Command/_losetup: fix file
+ completion for the second parameter to losetup
+
+ * Štěpán Němec: 49234: Completion/Unix/Command/_python:
+ add missing options in python completion
+
+2021-08-26 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 49307 with documentation updated: Src/exec,
+ Doc/Zsh/grammar.yo, Doc/Zsh/options.yo: With POSIX_TRAPS,
+ ignored signals stay that way in subshell.
+
+2021-08-24 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 49297 with quoting updated: Src/Modules/files.c: check
+ which files is in error when ENOENT on link etc.
+
+2021-08-24 dana <dana@dana.is>
+
+ * github #78: DCsunset: Completion/Unix/Command/_pandoc: Fix
+ completions in _pandoc
+
+2021-08-16 Oliver Kiddle <opk@zsh.org>
+
+ * 49268: Completion/Unix/Command/_texinfo: use an empty string search
+ to find matches for info --index-search= completion
+
+ * 49160: Completion/Unix/Command/_xmlsoft: fix quoting for
+ xmllint --pretty completion
+
+2021-08-14 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * users/26734: Doc/Zsh/builtins.yo: docs: read: Notate the
+ parameter name argument as optional.
+
+2021-08-10 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 49269: Src/parse.c, Test/C02cond.ztst: "[ ! -o ]" should
+ detect "-o" as a non-empty string and return status 1. Update
+ test to reflect this.
+
+2021-07-30 dana <dana@dana.is>
+
+ * github #77: Stavros Ntentos: Completion/X/Command/_sublimetext:
+ Improve subl completions for Sublime Text v4
+
+2021-07-30 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49211: Completion/Zsh/Command/_typeset: correctly set return value
+
+2021-07-23 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Erik Paulson: 49029: Src/signals.c: Remove additional copies
+ of signals sent by zsh with MONITOR enabled.
+
+ * 49182: Src/hist.c, Src/lex.c: Interactive word correction
+ doesn't work inside command substitution, so don't try to do it.
+
+2021-07-19 Eric Cook <llua@gmx.com>
+
+ * 49147: Completion/Linux/Command/_modutils: fix the completion
+ linux kernel modules
+
+2021-07-19 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 49166: Src/subst.c, Test/D04parameter.ztst: fix coredump in
+ ${name:offset:length} with ill-formatted length
+
+2021-07-10 Oliver Kiddle <opk@zsh.org>
+
+ * 49158: Completion/Debian/Command/_dscverify,
+ Completion/Solaris/Command/_dhcpinfo,
+ Completion/Solaris/Command/_inetadm,
+ Completion/Solaris/Command/_prstat,
+ Completion/Solaris/Command/_svcadm,
+ Completion/Solaris/Command/_svcprop,
+ Completion/Solaris/Command/_zlogin,
+ Completion/Unix/Command/_pkginfo, Completion/Unix/Command/_pkgrm:
+ remove superfluous function definitions
+
+ * 49157: Completion/Linux/Command/_valgrind,
+ Completion/Unix/Command/_baz, Completion/Unix/Command/_opustools,
+ Completion/Unix/Command/_tla: fix uses of literal % characters in
+ completion descriptions
+
+ * 49156: Completion/Cygwin/Command/_cygserver,
+ Completion/Debian/Command/_git-buildpackage,
+ Completion/Linux/Command/_alsa-utils, Completion/Unix/Command/_adb,
+ Completion/Linux/Command/_ipset, Completion/Unix/Command/_django,
+ Completion/Solaris/Command/_dtrace, Completion/Unix/Command/_ant,
+ Completion/Solaris/Command/_prstat, Completion/Unix/Command/_gcc,
+ Completion/Unix/Command/_dtruss, Completion/Unix/Command/_gnupod,
+ Completion/Unix/Command/_initctl, Completion/Unix/Command/_pandoc,
+ Completion/Unix/Command/_mysqldiff, Completion/Unix/Command/_pbm,
+ Completion/Unix/Command/_perforce, Completion/Unix/Command/_qemu,
+ Completion/Unix/Command/_ruby, Completion/Unix/Command/_tidy,
+ Completion/Unix/Command/_w3m, Completion/X/Command/_vnc,
+ Completion/X/Command/_xdvi: make wider use of the convention of
+ square brackets for defaults
+
+2021-07-08 Oliver Kiddle <opk@zsh.org>
+
+ * 49151: Completion/Debian/Command/_madison,
+ Completion/Debian/Command/_dak, Completion/Debian/Command/_dpkg,
+ Completion/Unix/Command/_aap, Completion/Unix/Command/_samba,
+ Completion/Unix/Command/_setfacl, Completion/Zsh/Function/_zargs:
+ remove commas erroneously included in _arguments exclusion lists
+
+ * 49150: Completion/...: consistently use singular form for
+ headings on completion match groups
+
+ * 49149: Completion/Unix/Command/_ssh: add specific values
+ in completion after ssh-keygen -b depending on the key type
+
+ * Max Voit: 49153: Completion/Unix/Command/_module:
+ cut off .lua extension from module files that occurs
+ when using lmod for module
+
+2021-07-06 Suraj N. Kurapati <sunaku@riseup.net>
+
+ * 49128 (github #76): Misc/vcs_info-examples: optimize
+ +vi-git-untracked()
+
+2021-06-28 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 49102: Src/subst.c: Dynamic directory expansion failure is
+ ignored if NO_EXEC is set.
+
+2021-06-22 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 48906: Doc/Zsh/manual.yo, Doc/Zsh/metafaq.yo, Etc/FAQ.yo,
+ Etc/changelog2html.pl: Update Sourceforge links to
+ https://zsh.sourceforge.io/.
+
+2021-06-14 dana <dana@dana.is>
+
+ * 48920: Completion/Unix/Command/_pgrep: Address issues related to
+ -f completion
+
+ * 48920: Completion/Unix/Command/_pgrep: Clarify -x description
+
+2021-06-13 Bart Schaefer <schaefer@zsh.org>
+
+ * 49069: NEWS, Src/builtin.c: literal interpretation of subscripts
+ for unset of array/hash elements
+
+2021-06-02 Oliver Kiddle <opk@zsh.org>
+
+ * Akinori MUSHA: 48942: Functions/Zle/edit-command-line:
+ Let EDITOR invoked by edit-command-line know it's a zsh script
+
+ * 48954: Src/Zle/complist.c: avoid crash in reverse-menu-complete
+ from menuselect without 'menu' in $compstate[insert]
+
+ * 48952: Completion/Unix/Command/_perl: expand octal codes for
+ record separators in perl completion
+
+ * 48938 (minus _cdrdao changes): Completion/Unix/Command/_pandoc,
+ Completion/Unix/Command/_bpython: remove vim fold and option markers
+
+ * 48939: Completion/Unix/Command/_rsync: update for rsync 3.2.3
+
+2021-05-21 Oliver Kiddle <opk@zsh.org>
+
+ * 48897: Completion/Unix/Command/_sed, Completion/Unix/Command/_head,
+ Completion/Unix/Command/_dhclient, Completion/Unix/Command/_pgrep,
+ Completion/Unix/Command/_ping, Completion/Unix/Command/_tail,
+ Completion/Unix/Command/_timeout, Completion/Unix/Command/_uname:
+ completion updates for DragonFly 6.0 and OpenBSD 6.9
+
+ * Marlon Richert: 48891: Completion/Unix/Command/_pgrep:
+ Fix pgrep/pkill -f completion
+
+ * Marlon Richert: 48864: Completion/Zsh/Type/_parameters: Improve
+ extra-verbose completion display strings for array parameter values
+
+2021-05-18 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 48601/0005: Functions/Misc/zmathfuncdef: Fix the workers/48147
+ return status / 'set -e' bug.
+
+ * 48601/0004: Doc/Zsh/builtins.yo: docs: return: Give examples
+ of using arithmetic evaluation.
+
+ * 48601/0003: Doc/Zsh/builtins.yo: docs: functions -M: Add a
+ subheading and index entries.
+
+ * 48601/0002: Doc/Zsh/builtins.yo: docs: functions -M: Document
+ the return status / result interdependency gotchas (cf. 48147).
+
+ * 48601/0001: Doc/Zsh/builtins.yo: docs: functions -M: Move an
+ example to be near the specification of the relevant flag
+
+ * 48594 (plus an "F:" line corresponding to the question there):
+ Test/E02xtrace.ztst: New tests for functions -t / functions -T
+
+2021-05-16 Bart Schaefer <schaefer@zsh.org>
+
+ * Marlon Richert: 48853: Doc/Zsh/contrib.yo,
+ Functions/Prompts/promptinit: improved handling of theme resets
+ when changing prompt themes, especially for theme preview
+
+ * 48860: Etc/BUGS: remove mention of bugs that were fixed
+
+ * 48857: Src/builtin.c, Src/exec.c, Src/loop.c, Src/makepro.awk,
+ Src/params.c, Src/signals.c: declare as "volatile" all globals
+ that may be modified by signal handlers; recognize in makepro.awk
+
+2021-05-16 Oliver Kiddle <opk@zsh.org>
+
+ * Jörg Sommer: users/26649: Completion/Unix/Command/_rake:
+ add zstyle for rake targets without description
+
+ * 48783: Completion/Unix/Command/_ansible: update ansible
+ completion to 2.10.8
+
+ * 48623: Completion/Unix/Command/_ssh: update options in openssh
+ completion to version 8.6
+
+2021-05-16 Mikael Magnusson <mikachu@gmail.com>
+
+ * unposted: Completion/Unix/Command/_timeout: Fix wrong syntax
+
+2021-05-15 Bart Schaefer <schaefer@zsh.org>
+
+ * Han Pingtian: 33465 (very belatedly): use prctl() for "jobs -Z"
+ where available
+
+ * Vincent Lefevre: 48723: Src/math.c: locale-safe recognition of
+ "Inf" and "NaN" constants
+
+ * Peter Stephenson: users/26742: Src/builtin.c: break out of
+ surrounding shell loops when "exit" is called from an exit hook
+
+ * users/26736: Src/Zle/zle_main.c: avoid infinite loop in getbyte
+ when read -q is called from exit hook
+
+ * 48810: Test/C04funcdef.ztst: name clash in test for autoloading
+
+ * 48790: Src/Zle/compcore.c: COMPLETE_IN_WORD inside brace-param
+
+ * 48710: Completion/Zsh/Command/_zed, Doc/Zsh/contrib.yo,
+ Functions/Misc/zed: add "zed -h" aka "histed", update doc and
+ completion; improve compatibility with SH_WORD_SPLIT
+
+ * 48709: Completion/Base/Widget/_complete_help: suppress error
+ messages from comptry
+
+ * 48707: Doc/Zsh/contrib.yo, Functions/Zle/zed-set-file-name:
+ fix keymap handling when zed invokes read-from-minibuffer
+
+2021-05-06 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 48787: Src/loop.c, Test/A01grammar.ztst: status was incorrect
+ on hard error flagged by condition in "if" without "else".
+
+2021-05-03 dana <dana@dana.is>
+
+ * unposted (see 48613): Etc/FAQ.yo: Move section 3.31 to 2.8
+
+ * unposted (see 48613): Doc/Zsh/metafaq.yo, Doc/Zsh/roadmap.yo:
+ Update http:// FAQ links to https://
+
+ * 48551 (tweaked per 48565, 48629): Doc/Zsh/compat.yo: Add
+ disclaimer about POSIX compliance and emulation of other shells
+
+ * 48614 (tweaked per 48630): Doc/Zsh/builtins.yo,
+ Doc/Zsh/options.yo, README, Src/builtin.c, Test/B10getopts.ztst:
+ Calculate OPTIND according to POSIX_BUILTINS
+
+2021-05-03 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 48767: Doc/Zsh/params.yo: docs: $SECONDS: Clarify what types
+ may be set
+
+2021-04-28 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 48702: Completion/Unix/Command/_pandoc: do not use cache,
+ support two or more extensions of format, and other fixes
+
+2021-04-21 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 48606 + 48607 + unposted test: Functions/Math/zmathfunc,
+ Test/Z02zmathfunc.ztst: zmathfunc: Force arguments to be numbers
+ and catch errors.
+
+ * unposted (cf. 48156): Test/Z02zmathfunc.ztst: New test.
+
+ * users/26635 (tweaked):
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_hg: vcs_info hg:
+ Compute the branch name correctly when get-revision is set and
+ check-for-changes is not
+
+2021-04-20 Bart Schaefer <schaefer@zsh.org>
+
+ * 48638: NEWS: mention TYPESET_TO_UNSET
+
+2021-04-20 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 48435 (tweaked): Doc/Zsh/contrib.yo, Misc/vcs_info-examples:
+ vcs_info docs: applied-string/unapplied-string: Correct an
+ omission in the documentation and add an example.
+
+ * 48528/0002: Misc/vcs_info-examples: vcs_info git docs:
+ ahead/behind commits: Reduce the number of forks
+
+ * 48528/0001: Misc/vcs_info-examples: vcs_info git docs:
+ ahead/behind commits: Don't run rev-list when that would fail
+
+2021-04-19 Bart Schaefer <schaefer@zsh.org>
+
+ * 48617: Completion/Base/Widget/_complete_debug: fix misuse of
+ IGNORE_BRACES when initializing debug_indent
+
+ * 47489: Functions/Misc/colors: rename standout as italic
+
+2021-04-19 Oliver Kiddle <opk@zsh.org>
+
+ * Marlon Richert: 48621: Completion/Zsh/Function/_add-zsh-hook,
+ Completion/Zsh/Function/_add-zle-hook-widget: Add -L to
+ add-(zsh|zle)-hook[-widget] completion
+
+ * André Kugland: github/zsh-completions #792:
+ Completion/Unix/Command/_opustools: new opus-tools completion
+
+ * 48619: Completion/Unix/Command/_ansible: complete inventory
+ plugins in assignments to ANSIBLE_INVENTORY_ENABLED
+
+ * 48618: Completion/Unix/Command/_date,
+ Completion/Unix/Command/_grep, Completion/Unix/Command/_netstat,
+ Completion/Unix/Command/_ping, Completion/Unix/Command/_readelf,
+ Completion/Unix/Command/_uname: update completions for FreeBSD 13
+
+2021-04-18 Bart Schaefer <schaefer@zsh.org>
+
+ * 47704: Src/builtin.c, Src/params.c, Test/B02typeset.ztst:
+ POSIX export and readonly ignore the "-p" option when parameter
+ names are also present.
+
+ * 48560: Completion/compinit, Doc/Zsh/builtins.yo,
+ Doc/Zsh/options.yo, Doc/Zsh/params.yo, Src/builtin.c,
+ Src/options.c, Src/params.c, Src/subst.c, Src/zsh.h,
+ Test/D06subscript.ztst, Test/E01options.ztst, Test/E03posix.ztst,
+ Test/V10private.ztst, Test/runtests.zsh, Test/ztst.zsh: add
+ TYPESET_TO_UNSET option, which removes initialization of newly
+ declared parameters such that ${newparam-notset} yields "notset"
+ and "typeset -p newparam" does not show an assignment to the
+ parameter. This is similar to the default behavior of bash and
+ ksh, with minor differences in typeset output. Also add tests for
+ some POSIX incompatibilities plus minor changes for test harness
+ robustness.
+
+2021-04-18 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * unposted: Etc/BUGS: remove a bug fixed by 47301
+
+2021-04-17 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 48361 (+ 48368 review comments):
+ Completion/Zsh/Function/__arguments: New completion function
+ for _arguments.
+
+2021-04-16 Oliver Kiddle <opk@zsh.org>
+
+ * Marlon Richert: 48513: Completion/Zsh/Type/_parameters,
+ Test/Y01completion.ztst: Let extra-verbose completion
+ show parameter values
+
+ * unposted: Etc/BUGS: update on bug list
+
+ * 48556: Completion/BSD/Command/_ipfw: new completion
+
+2021-04-16 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted (cf. 48153): Test/Z02zmathfunc.ztst: Add tests for
+ max() and min().
+
+2021-04-15 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 48574/0008: Doc/Zsh/contrib.yo: vcs_info git: Use best
+ practices in an example
+
+ * 48574/0007: Doc/Zsh/contrib.yo: vcs_info docs:
+ vcs_info_lastmsg: Correct an ambiguous/wrong description.
+
+ * 48574/0006: Doc/Zsh/contrib.yo: vcs_info docs: Change
+ user-context name in an example, to avoid confusion with the
+ special-casing of the value `command' in vcs_info_lastmsg.
+
+ * 48574/0005: Doc/Zsh/contrib.yo: vcs_info docs: Recommend use
+ of prompt expandos rather than terminal escape sequences.
+
+ * 48574/0004: Doc/Zsh/func.yo: docs: Document that hook functions
+ may rely on $? (see workers/48570).
+
+ * 48574/0003: Doc/Zsh/contrib.yo: docs: Fix rendering in the
+ man page output
+
+ * 48574/0002 (tweaked): Doc/Zsh/contrib.yo: docs: Fix rendering
+ of an example in the man page output
+
+ * 48574/0001: Doc/Zsh/func.yo: docs: Minor markup tweak
+
+2021-04-13 dana <dana@dana.is>
+
+ * Daniel Shahaf: 48522: README: Clarify _alternative change
+
+2021-04-13 Tim Lee <progscriptclone@gmail.com>
+
+ * 48525: Misc/vcs_info-examples: vcs_info git docs: ahead/behind
+ commits: Run fewer external programs
+
+2021-04-12 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 48439: Src/mem.c: remove macros that became unnecessary by 47785
+
+2021-04-11 Oliver Kiddle <opk@zsh.org>
+
+ * 48504: Src/hist.c, Src/input.c, Src/watch.c:
+ use SEEK_ macros in fseek() calls
+
+ * Michael Stapelberg: 45396: Src/hist.c: readhistfile:
+ avoid thousands of lseek(2) syscalls via ftell()
+
+ * Marc Chantreux: 48466: Completion/Unix/Command/_surfraw:
+ correct indentation and remove tabs and trailing spaces
+
+ * Marc Chantreux: 48445: Completion/Unix/Command/_surfraw:
+ pluralize tags in _surfraw
+
+ * Marc Chantreux: users/26645: Completion/X/Command/_gv:
+ update options in gv completion
+
+2021-04-10 Bart Schaefer <schaefer@zsh.org>
+
+ * 47913: Doc/Zsh/options.yo, Src/options.c, Src/pattern.c, Src/zsh.h:
+ implement CASE_PATHS option to make NO_CASE_GLOB more sensible
+
+2021-04-10 dana <dana@dana.is>
+
+ * brian m. carlson: 47794: README, Src/exec.c,
+ Test/B07emulate.ztst: exec: run final pipeline command in a
+ subshell in sh mode
+
+ * unposted (see 48415): README: Document incompatibility
+ caused by workers/43928
+
+ * 48338: Completion/Unix/Command/_git: Support case-insensitive
+ path matching
+
+2021-04-09 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 48432 (plus test change): Src/Modules/zutil.c,
+ Test/V05styles.ztst: Fix quoting of zstyle -L output for
+ -e styles, and enable test.
+
+2021-04-09 Oliver Kiddle <opk@zsh.org>
+
+ * 48378: Completion/Zsh/Command/_compadd: complete compadd
+ options for other completion functions
+
+ * 48437: Completion/Unix/Command/_gdb: fix pid completion when
+ cursor is in the middle of the line
+
+ * Felipe Contreras: 47786: aclocal.m4, aczsh.m4: prepare for
+ autoconf 2.70
+
+ * Felipe Contreras: 47785: Src/Modules/files.c, Src/zsh_system.h,
+ Src/mem.c, configure.ac: remove deprecated autoconf functions
+
+2021-04-08 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 48416: Completion/Unix/Command/_gcore: support macOS, with
+ update for GNU gcore
+
+2021-04-08 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 48410: Doc/Zsh/metafaq.yo, Etc/FAQ.yo: FAQ, METAFAQ: Mention
+ zsh-security@.
+
+ * 48379: Src/subst.c, Test/D04parameter.ztst: Make the parameter
+ expansion subscript flags parse error message, "error in flags",
+ identify the location of the parse error.
+
+ * 48321 (tweaked per thread): Completion/Unix/Type/_perl_modules:
+ Don't assume ${words[1]} to be either "perl" or "perldoc"
+
+2021-04-07 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 48425: Test/V05styles.ztst: Add an XFail test for a 'zstyle
+ -L' escaping bug (workers/48424).
+
+2021-04-06 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 48391: Src/Zle/compresult.c: correctly calculate display string
+ width in completion list to fix display problem in menu-complete
+
+ * 48389: Src/math.c, Src/utils.c: getkeystring(GETKEY_SINGLE_CHAR)
+ should not return a pointer to a local variable
+
+2021-04-06 Oliver Kiddle <opk@zsh.org>
+
+ * Marc Chantreux: users/26579: Completion/Unix/Command/_surfraw:
+ changes from review including parameter expansion to replace awk
+
+ * 48414: Completion/Unix/Type/_bpf_filters: quote closing bracket
+ to adapt for change in 43928
+
+ * Marlon Richert: 48413: Test/comptest, Test/Y01completion.ztst:
+ Fix _expand completion test
+
+ * unposted: Etc/BUGS: add several references to old list posts
+
+2021-04-05 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Etc/FAQ.yo: FAQ: Move the 'The mailing lists have
+ moved' notice to a more appropriate place.
+
+2021-04-04 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * Felipe Contreras: 47784: Src/pattern.c: silence compiler
+ warning -Wmaybe-uninitialized
+
+ * Jacob Gelbman: 48218 (+ 48354): Completion/Unix/Command/_gcc:
+ various improvements for _gcc
+
+2021-04-02 Oliver Kiddle <opk@zsh.org>
+
+ * 47510: Src/prompt.c, Src/zsh.h: drop code that avoided
+ termcap for named colours
+
+ * 48356: Doc/Zsh/compwid.yo: clarify (the intended)
+ behaviour for the two anchor forms of matching control
+
+2021-04-01 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Etc/BUGS: Add 39319, a named-file process
+ substitution cleanup bug.
+
+2021-04-01 Mikael Magnusson <mikachu@gmail.com>
+
+ * 48202 (+ 48366 test fix from Jun): Src/utils.c,
+ Test/B03print.ztst: Fix handling of NUL bytes in zexpandtabs
+ multibyte version
+
+2021-03-31 Oliver Kiddle <opk@zsh.org>
+
+ * github #74: Caleb Maclennan: Completion/Unix/Command/_vcsh:
+ Drop vcsh completions, maintained upstream
+
+ * Marlon Richert: 48214: Completion/Base/Completer/_expand,
+ Test/Y01completion.ztst: add file types to _expand completions,
+ so they can be colored through complist
+
+ * Christian K: 48192: Completion/Unix/Command/_openstack:
+ Fix openstack completion for new style clients
+
+ * Marc Chantreux: users/26557: Completion/Unix/Command/_surfraw:
+ add bookmarks support and remove the header from the final list
+
+2021-03-29 Aleksandr Mezin <mezin.alexander@gmail.com>
+
+ * 47561 (the git and cvs parts) (compare 44919 + 44920):
+ Functions/VCS_Info/Backends/VCS_INFO_detect_cvs,
+ Functions/VCS_Info/Backends/VCS_INFO_detect_git,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info
+ internals: cvs, git: Set ${vcs_comm[basedir]} like all other
+ backends do.
+
+2021-03-29 dana <dana@dana.is>
+
+ * 47737: Completion/Zsh/Command/_zstyle: Fix option completion
+ when positional arguments are already present (regression from
+ workers/39659 (commit ae3b675ce6e4ac62451ea08169c2b4dc45cf533b))
+
+2021-03-29 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: ChangeLog: Fix X-Seq numbers for the 39657, 39658,
+ 39659 patch series.
+
+ * unposted: Doc/Zsh/compsys.yo: docs: _arguments: Fix a typo
+ in the example.
+
+2021-03-28 Oliver Kiddle <opk@zsh.org>
+
+ * Jacob Gelbman: 48166: Completion/Unix/Command/_ctags:
+ add completion for language options
+
+ * Arseny Maslennikov: 48210, 48211:
+ Completion/Linux/Command/_setpriv: new completion for setpriv(1)
+
+ * Arseny Maslennikov: 48212: Completion/Linux/Type/_capabilities:
+ Introduce new completion for Linux task capabilities
+
+ * Štěpán Němec: 48231: Completion/Unix/Command/_git:
+ add missing --pretty formats and improve descriptions
+
+ * 48230, 48233 (Jun T): Completion/Solaris/Command/_dtrace:
+ completion of dtrace probes and runtime options
+
+2021-03-28 dana <dana@dana.is>
+
+ * 48216: Test/Y01completion.ztst: Fix broken test from
+ workers/48180
+
+2021-03-26 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 48131/0004: Etc/FAQ.yo: FAQ: 3.31: Rearrange
+
+ * 48131/0003: Etc/FAQ.yo: FAQ: 3.31: Move two paragraphs
+ unchanged, reordering them
+
+ * 48131/0002: Etc/FAQ.yo: FAQ: 3.31: Tweak summary paragraph
+
+ * 48131/0001: Etc/FAQ.yo: FAQ: 3.31: Add a one-sentence summary
+
+2021-03-23 dana <dana@dana.is>
+
+ * unposted: Doc/Zsh/expn.yo, Test/D07multibyte.ztst: Improve
+ documentation and add regression test for workers/47745
+
+ * 47745: Stephane Chazelas: Src/utils.c: Fix [:IDENT:] vs
+ posixidentifiers
+
+2021-03-17 dana <dana@dana.is>
+
+ * 48180: Marlon Richert: Completion/Base/Core/_main_complete,
+ Test/Y01completion.ztst: Start menu selection with
+ select=long-list in menu style
+
+2021-03-07 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 48147/0002: Functions/Math/zmathfunc, Test/Z02zmathfunc.ztst:
+ zmathfunc: Fix bug where the exit code would be non-zero if
+ the expression evaluted to zero.
+
+ * 48147/0001: Test/Z02zmathfunc.ztst: tests: Add a unit test for
+ zmathfunc and a regression test for workers/48146 affecting it.
+
+2021-02-24 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 48105: Jacob Gelbman: Completion/Unix/Command/_ctags: update and
+ fix formatting and import.
+
+2021-02-23 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 48096: Jacob Gelbman: Completion/Unix/Command/_ctags: new
+ completion.
+
+2021-02-22 Bart Schaefer <schaefer@zsh.org>
+
+ * 48094: Arseny Maslennikov: Functions/Prompts/prompt_restore_setup,
+ Functions/Prompts/promptinit: apply cleanup commands of the current
+ theme on any theme change, including "prompt -[hp] $theme"
+
+2021-02-19 dana <dana@dana.is>
+
+ * 47867: Arseny Maslennikov: Functions/Prompts/promptinit: Fix
+ RPROMPT typo
+
+2021-02-18 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * users/26509: Src/builtin.c: fc -L should ignore remote entries
+ rather than treat them as an error.
+
+2021-02-17 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 48073: Martijn Dekker: Doc/Zsh/builtins.yo, Src/builtin.c: fc
+ -s is POSIX version of fc -e -.
+
+2021-02-16 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 47876: Justtine Tunney: Src/exec.c: Add more cases where
+ shell scripts can be recognised from the first line as
+ described by POSIX.
+
+2021-02-16 Lawrence Velázquez <vq@larryv.me>
+
+ * 47830: Doc/Zsh/contrib.yo, README: Fix some documentation typos
+
+2021-02-13 Oliver Kiddle <opk@zsh.org>
+
+ * unposted (Daniel): Completion/Unix/Command/_locale:
+ add exclusion list missed in recent OpenBSD update
+
+ * github #68: taiyu.len: Completion/Unix/Command/_man,
+ Completion/Zsh/Command/_zstyle, Doc/Zsh/compsys.yo:
+ support section suffix completion for man pages
+
+ * 47905: Joshua Krusell: Src/Modules/zutil.c,
+ Test/V12zparseopts.ztst: Add leading '-' to zparseopts option
+ parsing errors
+
+2021-02-11 Bart Schaefer <schaefer@zsh.org>
+
+ * unposted: NEWS, README: mention the effects of 47997.
+
+ * 47997: Src/Zle/compcore.c: disable xtrace around completions
+
+2021-02-07 Oliver Kiddle <opk@zsh.org>
+
+ * 47944: Completion/BSD/Command/_bsd_pkg,
+ Completion/BSD/Command/_pkgin, Completion/BSD/Command/_systat,
+ Completion/Unix/Command/_dmesg: update completions for NetBSD 9
+
+ * 47943: Completion/Unix/Command/_date,
+ Completion/Unix/Command/_xargs: update completions for DragonflyBSD
+
+ * 47932: Completion/Linux/Command/_free, Completion/Unix/Command/_w,
+ Completion/Unix/Command/_pgrep, Completion/Unix/Command/_vmstat:
+ update completions for procps 3.3.16
+
+ * 47931: Completion/BSD/Command/_signify,
+ Completion/BSD/Command/_systat, Completion/Unix/Command/_locale,
+ Completion/Unix/Command/_netstat, Completion/Unix/Command/_top:
+ update completions for OpenBSD base up to 6.8
+
+ * 47930: Completion/BSD/Command/_freebsd-update,
+ Completion/Unix/Command/_uniq, Completion/Unix/Type/_diff_options:
+ update completions for FreeBSD base up to 12.2
+
+ * 47929: Completion/Zsh/Command/_zstyle: complete newer
+ possible values for the sort style
+
+ * based on github #62: oxiedi@yandex.ru:
+ Completion/Unix/Type/_date_formats: return proper exit status
+
+ * github #66: DCsunset: Completion/Unix/Command/_todo.sh:
+ Add more commands to _todo.sh
+
+ * github #63: oxiedi@yandex.ru: Completion/Base/Utility/_values:
+ fix regression caused by 44274, with sort style -o may be passed
+
+ * github #72 (tweaked): Semnodime: Completion/Unix/Command/_lldb:
+ fix unix command lldb tab-completion, args are space separated
+
+ * gitlab !16: aaaz <i1460889@mvrht.net>:
+ Completion/Unix/Command/_transmission: allow spaces between short
+ options and their parameters in transmission completion
+
+2021-02-06 Oliver Kiddle <opk@zsh.org>
+
+ * 47919: Completion/BSD/Type/_login_classes,
+ Completion/Unix/Command/_env, Completion/Unix/Command/_pgrep,
+ Completion/Unix/Command/_su, Completion/Unix/Command/_user_admin:
+ use common function for completing BSD login classes and update for
+ options to env
+
+ * 47918: Completion/Linux/Command/_nsenter,
+ Completion/Linux/Command/_unshare: new util-linux completions
+
+2021-02-05 Bart Schaefer <schaefer@zsh.org>
+
+ * unposted: Doc/Zsh/expn.yo: Add cindex entries for subsections
+
+2021-02-04 Bart Schaefer <schaefer@zsh.org>
+
+ * 47895: Src/builtin.c, Test/D02glob.ztst: Remove trailing spaces
+ from "print -ac" output lines.
+
+ * 47865: Test/D02glob.ztst: More tests for restricted directories
+
+ * 47889: Etc/FAQ.yo: Update csh alias equivalences (section 2.3)
+
+2021-02-03 Joshua Krusell <js.shirin@gmail.com>
+
+ * 47899: Src/Modules/zutil.c, Test/V12zparseopts.ztst: Improved
+ error message from zparseopts.
+
+2021-01-20 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 47883: Completion/Unix/Command/_awk: support gawk ver.5
+
+2021-01-27 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 47873: Completion/Base/Core/_main_complete,
+ Completion/Zsh/Context/_subscript,
+ Functions/Chpwd/zsh_directory_name_cdr: Improve completion
+ within dynamic directory names ~[<here>].
+
+ * GammaFunction@vivaldi.net via Roman: 47744:
+ Src/Zle/zle_main.c: Fix vi-repeat-change when hooks are in use.
+
+2021-01-26 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Etc/FAQ.yo: Fix a typo in the front matter.
+
+2021-01-24 Paul Seyfert <pseyfert.mathphys@gmail.com>
+
+ * github #71 (tweaked): Completion/X/Command/_xrandr: Complete
+ providers
+
+2021-01-23 Bart Schaefer <schaefer@zsh.org>
+
+ * users/26406: Functions/Misc/zargs: preserve caller setopts
+
+2021-01-20 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 47849: Test/E01options.ztst, Test/V08zpty.ztst,
+ Test/W02jobs.ztst, Test/X02zlevi.ztst, Test/X03zlebindkey.ztst,
+ Test/X04zlehighlight.ztst, Test/Y01completion.ztst,
+ Test/Y02compmatch.ztst, Test/Y03arguments.ztst: do not skip
+ tests that require zpty on Cygwin
+
+ * Peiyuan Song: 47840: Src/Modules/zpty.c, configure.ac: make
+ zpty module work on Cygwin
+
+2020-12-12 dana <dana@dana.is>
+
+ * unposted: NEWS: Catch up on new features
+
+2020-12-11 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 47731 (+unposted): Functions/Misc/run-help-btrfs,
+ Doc/Zsh/contrib.yo: add run-help assistant for btrfs command.
+ (based on the patch by Samir Benmendil in 43947⁩)
+
+ * Samir Benmendil: 43946: Functions/Misc/run-help-sudo: call
+ run-help (instead of man) for the command given to sudo
+
+2020-12-05 Bart Schaefer <schaefer@zsh.org>
+
+ * unposted: Doc/Zsh/compsys.yo: index compprefuncs and comppostfuncs
+
+2020-12-04 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 47716: Etc/BUGS: Add Aleksandr's vcs_info patch.
+
+2020-12-02 Bart Schaefer <schaefer@zsh.org>
+
+ * 47704: Src/Modules/param_private.c: fix scope for "private -p"
+
+2020-12-01 Bart Schaefer <schaefer@zsh.org>
+
+ * unposted: Etc/BUGS: Add users/26150 (multios + exec)
+
+2020-11-16 ivan tkachenko <me@ratijas.tk>
+
+ * 47547: Doc/Zsh/arith.yo: docs: Specify the exact kind of
+ quoting which is assumed when parsing arithmetic expressions
+
+2020-11-16 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 47560: configure.ac, aczsh.m4: add necessary includes or
+ prototypes for the tests in configure (fix errors in macOS 11)
+
+2020-10-29 Oliver Kiddle <opk@zsh.org>
+
+ * users/26107: Completion/Unix/Command/_git: complete changed
+ files after git diff HEAD
+
+2020-10-25 Mikael Magnusson <mikachu@gmail.com>
+
+ * Jun-ichi Takimoto: 47301: Src/builtin.c: Fix print -v
+ metafication
+
+ * 47302: Test/B03print.ztst, Test/D07multibyte.ztst: Test for
+ print -v fix
+
+ * 47494, 47495: Completion/Zsh/Command/_strftime,
+ Doc/Zsh/mod_datetime.yo, Src/Modules/datetime.c,
+ Test/V09datetime.ztst: Add -n option to strftime
+
+2020-10-18 Roman Perepelitsa <roman.perepelitsa@gmail.com>
+
+ * 47476: Src/Modules/files.c: Fix a race condition in zf_mkdir -p
+ (based on the patch by Matthew Martin in workers/47436)
+
+2020-10-18 Axel Beckert <abe@deuxchevaux.org>
+
+ * 47468: Doc/Zsh/contrib.yo: Fix typo
+
+2020-10-03 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * users/26088: Doc/Zsh/zle.yo: docs: zle -R: Clarify that it
+ needs not be called in the normal course of things, but only
+ when an immediate, interim redisplay is desired.
+
+2020-09-23 Meng Bo <mengbo@lnu.edu.cn>
+
+ * github #65: Completion/Unix/Command/_nmap: Rename option flags
+ (s/_/-/g)
+
+2020-09-22 Jacob Menke <linux.dev25@gmail.com>
+
+ * 47395: Completion/Base/Utility/_store_cache: Don't leak the
+ variable ${_cache_dir}.
+
+2020-09-13 Bart Schaefer <schaefer@zsh.org>
+
+ * Mikael Magnusson: 47382: Completion/Zsh/Context/_brace_parameter:
+ Completion for 47364
+
+ * 47364: Doc/Zsh/expn.yo, Src/subst.c, Src/zsh.h, Test/D02glob.ztst:
+ Enable extendedglob in pattern with ${(*)name/pattern/replacement}
+
+2020-09-09 Stephane Chazelas <stephane@chazelas.org>
+
+ * 47352 (+ extra test cases): Src/prompt.c, Test/D01prompt.ztst:
+ fix %<n>K prompt expansion (regression introduced in 5.0.3).
+
+2020-09-05 Doug Kearns <dougkearns@gmail.com>
+
+ * unposted: Completion/Unix/Command/_lp,
+ Completion/Unix/Command/_transmission, Completion/X/Command/_code,
+ Completion/X/Command/_kdeconnect, Completion/Zsh/Command/_zstyle:
+ Remove periods from completion descriptions as per the
+ completion-style-guide recommendations.
+
+2020-09-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 47350; Completion/Unix/Command/_dropbox: new completion.
+
+2020-08-28 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * github #64: Src/Modules/curses_keys.awk: Fix a build-time
+ error when building against ncurses that hadn't been built
+ with --enable-wgetch-events. (Reported by Martin Liska.)
+
+2020-08-21 Oliver Kiddle <opk@zsh.org>
+
+ * 47328: Doc/Zsh/metafaq.yo, Etc/CONTRIBUTORS: remove references
+ to old zsh.org mail addresses
+
+ * 47322: Completion/Unix/Command/_ssh: allow prefix with ssh
+ cipher completion and add matching control for options
+
+2020-08-18 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 47323: Completion/Redhat/Command/_rpm: _rpmbuild: Complete
+ file arguments after -r/-b/-t.
+
+2020-08-16 Mikael Magnusson <mikachu@gmail.com>
+
+ * 47304: Completion/Zsh/Type/_globflags: support specifying more
+ than one flag where appropriate
+
+ * 47305: Functions/Zle/edit-command-line: when possible, set
+ $BUFFER directly
+
+ * 47306: Completion/Zsh/Command/_zstyle, Doc/Zsh/contrib.yo,
+ Functions/Zle/edit-command-line: add editor style
+
+ * 47307: Functions/Zle/edit-command-line: restrict editing to
+ region if it is active
+
+2020-08-16 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 47314 (+ extra test case): Test/Z01is-at-least.ztst: is-at-least
+ false positive (5.8.0.2 / 5.8)
+
+ * 47313: Doc/Zsh/expn.yo: docs: Document explicitly that the
+ :P modifier returns a symlink-less path.
+
+2020-08-13 Oliver Kiddle <opk@zsh.org>
+
+ * Jörg Sommer: 47320: Completion/Linux/Command/_choom: Add
+ completion for Linux tool used to adjust process OOM score
+
+ * 47321: Completion/Linux/Command/_btrfs: update for btrfs 5.4
+
+ * 47319: Completion/Unix/Command/_imagemagick: complete more
+ options to ImageMagick's convert command
+
+2020-08-10 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 47294: Completion/Debian/Command/_aptitude: updates to options
+
+ * 47293: Completion/Unix/Command/_lp: lowercase descriptions
+
+2020-08-10 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 47308: Etc/zsh-development-guide: Document the new X-Seq
+ autoreply bot.
+
+2020-08-09 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 47303: Functions/VCS_Info/Backends/VCS_INFO_get_data_hg,
+ Functions/VCS_Info/VCS_INFO_set-patch-format: vcs_info hg:
+ Fix changing the expansion of %g (hook_com[guards]) in the
+ set-patch-format hook (regression from workers/40480).
+
+2020-08-08 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Doc/Zsh/metafaq.yo, Etc/FAQ.yo: Update documentation
+ for the move to new hosting.
+
+ * 47296 (+ unposted additional tests and comments): Src/loop.c,
+ Test/A05execution.ztst: 'repeat' loops: Let the repeat count
+ use $?.
+
+ * 47300: Src/parse.c, Src/zsh.h: Document the EC_NODUP, EC_DUP,
+ EC_DUPTOK triplet.
+
+2020-08-08 Mikael Magnusson <mikachu@gmail.com>
+
+ * unposted: Completion/BSD/Command/_kdump,
+ Completion/BSD/Type/_ktrace_points: fix syntax errors in
+ completers added in 45940
+
+2020-08-05 Mikael Magnusson <mikachu@gmail.com>
+
+ * unposted: Completion/compinit: add help text for -w
+
+ * 46280: Completion/compinit: add -w to explain why compdump runs
+
+2020-07-29 Roman Perepelitsa <roman.perepelitsa@gmail.com>
+
+ * unposted: Src/zsh.h: comments explaining how hashtable must
+ be created
+
+2020-07-28 Roman Perepelitsa <roman.perepelitsa@gmail.com>
+
+ * 46275: Src/hashtable.c, Src/zsh.h: eliminate undefined behavior
+ caused by redefinition of hashtable
+
+2020-07-27 Roman Perepelitsa <roman.perepelitsa@gmail.com>
+
+ * 46268: Src/exec.c: suppress a useless compiler warning
+ around nice()
+
+2020-07-14 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 46244 (cont.): Etc/creating-a-release.txt: Flesh out the TODO
+ from the previous commit.
+
+ * 46244: Etc/creating-a-release.txt: Start to introduce a
+ release managers keyring.
+
+2020-07-14 oxiedi <oxiedi@yandex.ru>
+
+ * github #61: Completion/Zsh/Type/_parameters: Don't leak the
+ variable $i
+
+2020-07-13 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 46240: Doc/Zsh/builtins.yo, Doc/Zsh/contrib.yo,
+ Doc/Zsh/jobs.yo, Doc/Zsh/params.yo, Doc/ztexi.yo: Make the
+ expansion of manref()() in ztexi.yo match its expansion in
+ zman.yo.
+
+2020-07-12 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 46183: Test/D03procsubst.ztst: New XFail test: external
+ command with =(...) on LHS of pipeline cleans up its tempfiles.
+
+ * unposted (cf. GitHub #11): Misc/vcs_info-examples: vcs_info
+ hg: docs: Change an example to not use a hex dump incantation
+ that may replace some bytes' values with asterisks.
+
+ * users/24985: Doc/Zsh/expn.yo: Clarify documentation of the
+ ${(n)} and ${(-)} parameter expansion flags, and add a forward
+ compatibility hatch to the latter.
+
+ * 46204: Test/E01options.ztst: Fix new test case for the
+ theoretical case of having more than 100 files in the root
+ directory.
+
+ * unposted: .editorconfig: For Makefiles, make the indent size
+ equal to tab width.
+
+2020-07-11 dana <dana@dana.is>
+
+ * Cedric Ware: 46152: Src/Modules/system.c, Test/V14system.ztst:
+ Re-allow '0' timeout in zsystem flock
+
+2020-07-09 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 46215 (w/ minor tweak): Test/E01options.ztst: make the test
+ added by 46175/0002 work on wider systems, and skip the test
+ on Cygwin.
+
+2020-07-08 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * 46216: Completion/Unix/Command/_ansible: update for ansible 2.9
+
+ * 46217: Completion/Unix/Command/_tmux: update options for tmux 3.1
+
+ * github #60: Mathias Fredriksson: Completion/Unix/Type/_zfs_dataset:
+ Fix completion for a zfs dataset containing spaces
+
+ * gitlab !15: Doron Behar: Completion/Linux/Command/_modutils:
+ Fix FHS assumption
+
+ * 46201 (tweaked per Daniel): Etc/completion-style-guide: add
+ guidelines for caching and use of imperative mood in descriptions
+
+ * 46195: Completion/X/Type/_x_color: use showrgb command to get
+ colours if it is available
+
+ * github #50: SATOH Fumiyasu: Completion/Unix/Type/_ssh_hosts:
+ Complete hosts in "Match" directive
+
+ * github #53: James Pike: Completion/Unix/Type/_remote_files:
+ allow specifying directory name.
+
+2020-07-07 Bart Schaefer <schaefer@brasslantern.com>
+
+ * 46189: Test/comptest: Ignore exit status of final zpty_flush
+
+2020-07-07 Nuri Jung <jnooree@gmail.com>
+
+ * github #58: Doc/Zsh/mod_regex.yo: docs: Note that the zsh/regex
+ syntax is platform-dependent.
+
+2020-07-06 Pete Moore <pmoore@mozilla.com>
+
+ * 46194: Doc/Zsh/metafaq.yo: docs: metafaq: Remove spurious
+ closing bracket
+
+2020-07-05 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 46175/0003: Src/exec.c, Test/E01options.ztst: Fix the
+ RM_STAR_SILENT bug from the parent commit.
+
+ * 46175/0002: Test/E01options.ztst: Add a regression test for
+ 46169: the RM_STAR_SILENT logic processes the current directory
+ rather than the root directory.
+
+ * 46175/0001: Test/E01options.ztst: Add a unit test for the
+ RM_STAR_SILENT option.
+
+ * 46174/0002: Test/comptest: test harness: Restore indentation
+ after the previous commit. No functional change.
+
+ * 46174/0001: Test/comptest: test harness: Plug a symlink attack
+
+2020-07-03 Matthew Martin <phy1729@gmail.com>
+
+ * 46168: Src/builtin.c, Test/B01cd.ztst: Update $PWD and call
+ chpwd hook after normalizing path.
+
+2020-07-03 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted (cf. users/24972, users/24978): Doc/Zsh/expn.yo:
+ Use an ASCII hyphen/minus rather than a dash.
+
+2020-07-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * users/24971: Doc/Zsh/expn.yo, Src/sort.c, Src/subst.c,
+ Src/zsh.h, Test/D04parameter.ztst: Add parameter flag (-)
+ to allow signed numeric sorting.
+
+2020-06-28 zsugabubus <zsugabubus>
+
+ * 46097: Completion/Unix/Command/_rm: Fix "assignment to invalid
+ subscript range" error in _rm.
+
+2020-06-28 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 46132: Doc/Zsh/expn.yo: docs: Use an itemized list in the
+ documentation of the *(o) glob qualifier.
+
+ * 46131: Completion/Unix/Command/_git: _git-config: Partly
+ fix a bug whereby a 'foo.ba<TAB>' wouldn't be completed to
+ 'foo.bar.baz'.
+
+ * 46128: Completion/Unix/Command/_git: Complete more options
+ and diff/merge tools.
+
+ * 46129: Completion/Unix/Command/_git: _git-config: Fix a bug
+ where a second trailing dot would be incorrectly offered.
+
+ * 46130: Completion/Unix/Command/_git: _git-config: Complete
+ some more options.
+
+2020-06-27 Miroslav Koškár <mk@mkoskar.com>
+
+ * 46140: Completion/Unix/Command/_git: Fix insufficiently
+ quoted pattern
+
+ * 46139: Completion/Unix/Command/_git: Remove hanging whitespaces
+
+2020-06-27 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted (after 46068): Src/Zle/zle_utils.c: Fix a compiler
+ warning.
+
+ * 46072 + 46136: Doc/Zsh/contrib.yo, Doc/Zsh/zle.yo,
+ Functions/Misc/add-zle-hook-widget, Src/Zle/zle_thingy.c,
+ Test/X04zlehighlight.ztst: Add the 'zle $widget -f nolast'
+ syntax, to improve add-zle-hook-widget support for multiple
+ hook functions.
+
+ * users/24959/0002: Doc/Zsh/grammar.yo: Update aliases
+ documentation for the addition of the ALIAS_FUNC_DEF option.
+
+ * users/24959/0001: Doc/Zsh/builtins.yo, Doc/Zsh/grammar.yo:
+ Extend documentation of global aliases.
+
+2020-06-26 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Doc/Zsh/contrib.yo, Doc/Zsh/expn.yo,
+ Doc/Zsh/mod_mapfile.yo, Etc/FAQ.yo: docs: Fix some markup
+ and typos.
+
+2020-06-26 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 46110: Src/subst.c, Test/D03procsubst.ztst: If =subst occurs
+ before =(subst) we should allow for the possibility of the latter.
+
+2020-06-26 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * unposted c.f. 46034: Completion/Unix/Command/_gpg: workaround
+ incompatibility with sh_file_expansion option
+
+ * 46106: Completion/BSD/Command/_usbconfig: new completion
+
+ * 46105: Completion/X/Command/_xinput: new xinput completion
+
+ * 46075: drelo: Completion/Unix/Type/_find_net_interfaces:
+ prefer ip on linux for finding network interfaces
+
+ * 45895: oxiedi: Completion/Base/Utility/_sequence,
+ Test/Y01completion.ztst: ignore dedup patterns in _sequence
+
+2020-06-25 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 46068 (tweaked) (was: github #57): Doc/Zsh/zle.yo, README,
+ Src/Zle/zle.h, Src/Zle/zle_refresh.c, Src/Zle/zle_utils.c,
+ Src/prompt.c, Test/X04zlehighlight.ztst: region_highlight:
+ Add memo= support.
+
+ * 46102: Test/ztst.zsh: test harness: Make the XPass message
+ distinct from the Fail message.
+
+2020-06-22 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 46079: Src/math.c, Test/C01arith.ztst: Ignore double quotes in
+ math expression: treat as white space.
+
+2020-06-22 Manuel Jacob <me@manueljacob.de>
+
+ * 46091: Doc/Zsh/contrib.yo,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_hg: Add code to
+ Mercurial VCS backend to show topic if there is any.
+
+2020-06-19 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 46044 (tweaked per Matthew): Completion/Unix/Command/_units:
+ Correct the path to the units data file on Debian with units
+ 2.00 and newer and on FreeBSD.
+
+2020-06-18 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 46067: Test/A05execution.ztst: Add a unit test for
+ workers/46060.
+
+2020-06-18 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 46060: Src/jobs.c: Ensure process has been signalled before
+ taking special action for SIGINT or SIGQUIT.
+
+2020-06-17 Eric Cook <llua@gmx.com>
+
+ * 45982: Frederick Zhang: Completion/Unix/Command/_zfs:
+ Add space read-only property
+
+2020-06-17 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Util/ztst-syntax.vim: internal: ztst.vim: Recognize
+ empty "F:" line as well, as the test harness does.
+
+2020-06-17 Miroslav Koškár <mk@mkoskar.com>
+
+ * 46049: Doc/Zsh/options.yo: docs: Correct the sense of the
+ single-letter abstract of the GLOBAL_RCS option (-d)
+
+2020-06-11 Oliver Kiddle <okiddle@yahoo.co.uk>
+
+ * gitlab !12: Jan Máslo: Completion/Linux/Command/_mat,
+ Completion/Linux/Command/_mat2: new completions
+
+ * 46036: Completion/Zsh/Type/_ps1234: fix colouring in prompt
+ completion
+
+ * users/24892: Completion/Unix/Type/_files,
+ Completion/Zsh/Command/_zstyle: fix local declaration with
+ recursive-files style and complete it for zstyle
+
+2020-06-10 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Doc/Zsh/mod_zutil.yo: zstyle docs: Fix typo.
+
+2020-06-09 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 46026: Doc/Zsh/options.yo, Src/exec.c, Src/options.c,
+ Src/zsh.h, Test/A04redirect.ztst: Add CLOBBER_EMPTY option.
+
+2020-06-08 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * uwers/24909: Src/exec.c: Don't clean up files used for
+ substitution until after function has run.
+
+2020-06-08 Doron Behar <doron.behar@gmail.com>
+
+ * gitlab !14 (fixup): Completion/Linux/Command/_modutils:
+ modutils comp: Fix getting the value of kver from opt_args
+
+2020-06-07 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 45932: Etc/FAQ.yo: FAQ (3.1): Update ksh compatibility answer
+ for reserved word typeset.
+
+ * 45933: Etc/FAQ.yo: FAQ: Add "Why does my bash script report
+ an error when I run it under zsh?".
+
+ * 45791 (tweaked): Etc/FAQ.yo, Util/zyodl.vim: FAQ: Explain
+ how to binary search one's dotfiles
+
+ * unposted: Etc/FAQ.yo: FAQ: Update section number in links to
+ the "The future of zsh" section.
+
+2020-06-06 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Etc/BUGS: Add users/24904 to Etc/BUGS (a process
+ substitution / forking issue).
+
+2020-06-05 Mikael Magnusson <mikachu@gmail.com>
+
+ * 45985: Src/builtin.c: typeset: Fix leaving corrupted entries
+ in paramtab
+
+2020-06-03 Yasuhiro KIMURA <yasu@utahime.org>
+
+ * 45950: configure.ac: Fix 'make install' in out-of-tree
+ tarball builds.
+
+2020-06-01 Matthew Martin <phy1729@gmail.com>
+
+ * 45940: Completion/BSD/Command/_kdump,
+ Completion/BSD/Command/_ktrace,
+ Completion/BSD/Type/_ktrace_points: Add _kdump and _ktrace
+ completers and supporting _ktrace_points type.
+
+ * 45939: Completion/Linux/Command/_ionice,
+ Completion/Unix/Command/_lsof, Completion/Unix/Command/_pgrep,
+ Completion/Unix/Command/_renice, Completion/Unix/Type/_pgids:
+ Add _pgids type.
+
+2020-06-01 Doron Behar <doron.behar@gmail.com>
+
+ * gitlab !14: Completion/Linux/Command/_modutils: modutils
+ completion: Fix getting the value of kver from opt_args
+
+2020-05-30 Bart Schaefer <schaefer@zsh.org>
+
+ * 45915: Src/utils.c: fix handling of hyphens in spckword()
+
+2020-05-28 Yasuhiro KIMURA <yasu@utahime.org>
+
+ * 45934: Completion/Unix/Command/_subversion: Make 'svnliteadmin'
+ completed same as 'svnadmin'
+
+2020-05-28 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Util/zyodl.vim: Highlight the word "note", like
+ ft=help does.
+
+ * unposted: Util/zyodl.vim: Highlight yodl continuation line
+ marker
+
+ * 45923 (with memory leak fixed, cf. 45924): Src/Modules/zprof.c,
+ Src/exec.c: zprof: Don't tally all anonymous functions as though
+ they were a single function named "(anon)".
+
+2020-05-23 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 45900: Src/lex.c, Test/D04parameter.ztst: Fix issues with
+ escaped newline in $-substitution.
+
+2020-05-21 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 45884 (Oliver's, edited by me): Etc/BUGS: Add a few entries.
+
+2020-05-20 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 45862: Test/D04parameter.ztst: Add test cases for 45843#1
+ and 45843#2, adapted from Aaron Esau and pws.
+
+2020-05-17 Eitan Adler <lists@eitanadler.com>
+
+ * Eitan Adler: unposted: config.guess, config.sub: update to
+ 2020-04-26.
+
+2020-05-17 Matthew Martin <phy1729@gmail.com>
+
+ * 45831: Completion/Unix/Command/_vi: Add _vi completer.
+
+2020-05-16 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * users/24843: Doc/Zsh/compsys.yo: zshcompsys(1): Point to the
+ 'format' style from the 'tag-order' style.
+
+2020-05-12 Mikael Magnusson <mikachu@gmail.com>
+
+ * 45796: Src/subst.c, Test/D04parameter.ztst: Support
+ ${name:offset:length} with an empty offset
+
+2020-05-09: Eitan Adler <lists@eitanadler.com>
+
+ * noraj: gitlab !13: Completion/Unix/Type/_tar_archive: libarchive and
+ GNU tar can uncompress zstandard (zstd) based files
+
+2020-05-07: Eitan Adler <lists@eitanadler.com>
+
+ * unposted: Completion/Unix/Type/_tar_archive: libarchive based
+ tar can uncompress zip files
+
+2020-05-07 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Completion/Debian/Command/_dscverify,
+ Completion/Unix/Command/_pandoc: Use alternation patterns rather
+ than brace expansion
+
+2020-05-05 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 45764: Test/D07multibyte.ztst: Add a regression test for 45772.
+ Test by Roman
+
+2020-05-05 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 45772: Src/params.c: Upon restoring locale variables, restore
+ the corresponding system settings.
+
+2020-05-23 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * unposted: Src/Builtins/rlimits.c: add a comment about how to
+ add a new resource.
+
+ * 45614: Completion/Redhat/Command/_dnf: add support for several
+ subcommands and options.
+
+2020-05-03 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 45731: Completion/Debian/Command/_debsnap: New completion
+ function.
+
+ * 45730: Completion/Base/Utility/_arguments, Doc/Zsh/compsys.yo,
+ Src/Zle/computil.c, Src/utils.c, Test/Y03arguments.ztst:
+ _arguments: Add the -0 flag, which makes $opt_args be populated
+ sanely.
+
+ * 45729: Src/Modules/curses.c, Src/Zle/compcore.c,
+ Src/Zle/computil.c, Src/builtin.c, Src/linklist.c: internal:
+ Add a second parameter to zlinklist2array(), analogously to
+ hlinklist2array().
+
+2020-05-02 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Util/zyodl.vim: Use 'conceal' for some macros that
+ expand to a single character.
+
+ * 45737 (+ docs, and update the test from 45722):
+ Doc/Zsh/mod_zutil.yo, README, Src/Modules/zutil.c,
+ Test/V05styles.ztst: zstyle: When determining the weight
+ (specificity) of a pattern, consider the number of components
+ before anything else, as documented.
+
+ * unposted: Test/V05styles.ztst: Revert unintentional move
+ from 45722.
+
+ * 45739: Doc/Zsh/compsys.yo, Doc/Zsh/zftpsys.yo: docs:
+ Clarifications about zstyle patterns.
+
+ * 45722: Doc/Zsh/mod_zutil.yo, V05styles.ztst: docs: Change
+ zstyle example to a non-hierarchical one
+
+ * 45752/0002: Completion/Unix/Command/_gcc: Complete --output
+ like -o.
+
+ * 45752/0001: Completion/Unix/Command/_gcc: Add .cpp and .hpp
+ to the ignored extensions list.
+
+2020-04-27 Benjamin Esham <benjamin@esham.io>
+
+ * github #56: Doc/Zsh/mod_zutil.yo: typo: Add a single quote
+ that had been missing
+
+2020-04-21 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: README: Give the 'zsystem flock' limit in
+ pretty-printed form as well.
+
+2020-04-21 dana <dana@dana.is>
+
+ * github #54: davey hathorn: Completion/Unix/Command/_dig:
+ Fix dig completion error
+
+2020-04-20 dana <dana@dana.is>
+
+ * unposted: NEWS, README: Document zsh/system changes from
+ workers/45708
+
+ * unposted: Doc/Zsh/mod_system.yo: Adjust documentation from
+ workers/45708
+
+ * Cedric Ware: 45708: Doc/Zsh/mod_system.yo,
+ Src/Modules/system.c, Src/compat.c, Src/utils.c,
+ Test/V14system.ztst: Enable sub-second timeout in zsystem flock
+
+ * 45702: Doc/Zsh/compsys.yo: Improve documentation of
+ {insert,separate}-sections
+
+2020-04-15 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 45684: Doc/Zsh/expn.yo: - glob qualifier behaviour in error
+ cases.
+
+2020-04-12 dg1727 <dg1727@protonmail.com>
+
+ * 45661: Doc/Zsh/params.yo: docs: Clarify the effect of
+ KSH_ARRAYS on the (I) subscript.
+
+2020-04-09 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 45660: Src/builtin,c, Src/init.c: Delay initial setting of
+ keympa options until module system is active.
+
+2020-04-05 dana <dana@dana.is>
+
+ * 45655: Completion/Darwin/Type/_retrieve_mac_apps: Update
+ search paths and Spotlight index check for recent macOS
+
+2020-04-05 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 45656: Etc/BUGS: Document the -o emacs segfault bug.
+
+2020-04-02 Mikael Magnusson <mikachu@gmail.com>
+
+ * 45142: Doc/Zsh/grammar.yo, Doc/Zsh/options.yo, Src/lex.c,
+ Src/options.c, Src/parse.c, Src/zsh.h, Test/E01options.ztst:
+ Add SHORT_REPEAT option
+
+2020-04-02 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Test/D02glob.ztst: Make test platform-independent.
+
+2020-04-01 dana <dana@dana.is>
+
+ * 45542: Test/P01privileged.ztst: Use test-directory owner for
+ auto-determined EUID/EGID
+
+ * unposted: Test/D02glob.ztst: Fix platform-dependent test
+ failure introduced by workers/45583
+
+2020-03-29 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 45649: Completion/Unix/Command/_unison: completion: Simplify
+ Unison completion. No functional change.
+
+2020-03-29 Henri Menke <henri@icp.uni-stuttgart.de>
+
+ * 45646: Completion/Unix/Command/_unison: completion: Unison:
+ Honour the $UNISON variable
+
+2020-03-28 Gastón Haro <gaston.haro@fing.edu.uy>
+
+ * github #46: Completion/Unix/Command/_git: _git-restore:
+ Complete arguments to the --source option after a '=' sign
+
+2020-03-28 Gastón Haro <harogaston@users.noreply.github.com>
+
+ * github #46: Completion/Unix/Command/_git: Better restrict
+ git-restore(1) file completions
+
+2020-03-28 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 45644: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: Fix current patch's name in several cases.
+
+ * unposted: Test/V07pcre.ztst: Fix syntax error introduced
+ in 45591.
+
+ * 45640: Test/B13whence.ztst: Fix new test when ${PWD}'s value
+ contains symlinks.
+
+2020-03-26 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 45627: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: Under git-am(1) conflicts, pass to the
+ gen-applied-string hook information on already-applied patches.
+
+ * 45625: Functions/VCS_Info/Backends/VCS_INFO_get_data_svn:
+ vcs_info svn: Detect the "working copy format is too new" error.
+
+ * 45626: Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_p4,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_svk,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_svn,
+ Functions/VCS_Info/VCS_INFO_set-branch-format,
+ Functions/VCS_Info/vcs_info: vcs_info: Deduplicate calling the
+ set-branch-format hook.
+
+ * 45624: Functions/VCS_Info/Backends/VCS_INFO_get_data_fossil,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_p4,
+ Functions/VCS_Info/VCS_INFO_bydir_detect: vcs_info: Set $rrn
+ in all backends.
+
+ * 45623: Completion/Unix/Command/_quilt: Add subcommand
+ descriptions
+
+ * 45622: Completion/Unix/Command/_quilt: Categorize subcommands
+
+ * 45584, 45620: Test/B12limit.ztst: zsh/rlimits: Skip the tests
+ for this module when it wasn't compiled in.
+
+ * 45591 (Cf. 45587, 45620): Test/V01zmodload.ztst,
+ Test/V07pcre.ztst: In the test suite, centralize testing that
+ compiled modules can be loaded successfully.
+
+2020-03-26 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 45616: Src/loop.c, Test/A01grammar.ztst: Remove tokens
+ from count to repeat keyword.
+
+2020-03-25 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 45583/0008: Etc/BUGS, Src/utils.c, Test/B13whence.ztst:
+ Extend tests to prove that what remains of xsymlinks() handles
+ symlink loops gracefully.
+
+ * 45583/0007: Src/utils.c: Remove code that is now unreachable.
+
+ * 45583/0006: Src/utils.c: Don't use xsymlinks() in 'whence -s'.
+
+ * 45583/0005: Test/B13whence.ztst: Add a test for bin_whence's
+ symlinks resolution.
+
+ * 45583/0004: Etc/BUGS, Src/utils.c, Test/D02glob.ztst: Fix
+ segfault on resolving symlink loops
+
+ * 45583/0003: Src/hist.c, Src/subst.c: chrealpath: Let caller
+ decide how the return value should be allocated.
+
+ * 45583/0002: Src/hist.c, Src/subst.c: chrealpath: Make symlink
+ resolution optional.
+
+ * 45583/0001: Test/D02glob.ztst: Add tests for the segfault on
+ resolving a symlink loop bug (workers/45282).
+
+ * 45590/0002 (in part): Test/B12limit.ztst: zsh/rlimits: Test
+ that ulimit letters are unique.
+
+2020-03-25 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 45601: Test/E02xtrace.ztst: fix one more return status
+
+2020-03-22 Rin Okuyama <rokuyama.rk@gmail.com>
+
+ * github #51: aczsh.m4, configure.ac: Fix configure for cross
+ build.
+
+2020-03-22 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * 45601: Test/E02xtrace.ztst: Fix status in new functions -T
+ test.
+
+ * 45563: Src/utils.c: %z supplies zlong for errors and warnings.
+
+2020-03-22 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 45583/0009: README, Src/parse.c, Test/E02xtrace.ztst: Add
+ end-of-options guard support to 'function -T'.
+
+ * 45583/0008: Doc/Zsh/grammar.yo, README, Src/exec.c,
+ Src/parse.c, Test/E02xtrace.ztst: Add the 'function -T' syntax.
+
+ * 45583/0007: Config/version.mk, Src/exec.c, Src/parse.c,
+ Src/text.c: WC_FUNCDEF: Add a placeholder element.
+
+ * 45583/0006: Src/parse.c: internal: Add some comments for
+ orientation. No functional change.
+
+ * 45583/0005: Src/parse.c: internal: Document the WC_FUNCDEF
+ data layout for anonymous functions with arguments (follow-up
+ to 29492)
+
+ * 45583/0004: Src/parse.c, Src/zsh.h: internal: Add some comments
+ around wordcodes. No functional change.
+
+ * 45583/0003: Src/parse.c, Src/zsh.h: internal: Add some comments
+ around Eccstr. No functional change.
+
+ * 45583/0002: Src/parse.c: internal: Reduce some variables'
+ visibility. No functional change.
+
+ * 45583/0001: Src/exec.c: internal: Remove a redundant
+ assignment.
+
+2020-03-20 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: Src/Builtins/rlimits.c: Deconfuse $EDITOR's balanced
+ braces mode. No functional change.
+
+ * unposted: Doc/Zsh/expn.yo: ${(Z)}: Convert documentation to
+ a description block.
+
+ * unposted: Util/ztst-syntax.vim: internal: ztst.vim: Make
+ sure syntax elements are only hidden if they're followed by
+ something visible
+
+2020-03-18 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * unposted: .editorconfig: Specify tabs for Makefiles.
+
+2020-03-17 Daniel Shahaf <danielsh@apache.org>
+
+ * 45572: Completion/Linux/Command/_sshfs: Complete some more
+ options
+
+2020-03-17 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 45536: Src/utils.c: fix handling of 8bit character in
+ is_wcs_nicechar() and wcs_nicechar_sel() under C-locale.
+
+2020-03-15 Daniel Shahaf <danielsh@apache.org>
+
+ * 45541: Functions/VCS_Info/test-repo-git-rebase-apply: internal:
+ vcs_info git: Add a test case repository for rebase-apply
+ situations
+
+ * 45539: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: In non-interactive rebases, obtain applied
+ patches' names.
+
+ * 45540: Doc/Zsh/contrib.yo,
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info git:
+ In non-interactive rebases, compute patch names for unapplied
+ patches.
+
+ * 45543: Functions/VCS_Info/VCS_INFO_quilt, README: vcs_info
+ quilt: Allow quiltcommand to be a function.
+
+ * 45547: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: In interactive rebases, process
+ gen-unapplied-string arguments like gen-applied-string arguments
+ are processed.
+
+ * 45546: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: In interactive rebases, properly support the full
+ form of the "exec" verb.
+
+ * 45545: Functions/VCS_Info/Backends/VCS_INFO_get_data_git:
+ vcs_info git: In interactive rebases, ignore comment lines.
+
+2020-03-13 dana <dana@dana.is>
+
+ * unposted: Completion/Unix/Command/_git: Fix copy/paste error
+ in earlier commit that broke `git stash drop`
+
+ * 45535: Completion/Unix/Command/_lz4: Order compression levels
+ numerically
+
+ * 45534: Completion/Darwin/Command/_hdiutil: Update image-file
+ extensions, image/disk formats, &c.
+
+ * 45531: Completion/Unix/Command/_sh: Complete options more
+ accurately
+
+ * 45537 (tweaked per 45550, needs 45536): Test/E02xtrace.ztst:
+ Fix inconsistent function-name encoding in preserves-xtrace test
+
+2020-03-12 Daniel Shahaf <danielsh@apache.org>
+
+ * unposted: .editorconfig: Specify spaces rather than tabs for
+ zsh scripts.
+
+2020-03-11 dana <dana@dana.is>
+
+ * 45470: Test/C02cond.ztst: Simplify '-N cond' test
+
+ * 45424 (tweaked): Completion/Solaris/Command/_pfexec,
+ Completion/Unix/Command/_doas, Completion/Unix/Command/_su,
+ Completion/Unix/Command/_sudo, Completion/Zsh/Type/_command_names:
+ Add **/sbin to PATH when completing commands like sudo
+
+2020-03-10 Romain Porte <debian@microjoe.org>
+
+ * 45524: Completion/Debian/Command/_dscverify: Add completion
+ for dscverify(1) from Debian's devscripts.
+
+2020-03-09 Daniel Shahaf <danielsh@apache.org>
+
+ * 45518 + unposted tweak (change single quotes to double quotes):
+ Test/V01zmodload.ztst: Fix V01zmotload.ztst test failures when
+ zsh/parameter is dynamically linked (which is the default).
+
+2020-03-07 Daniel Shahaf <danielsh@apache.org>
+
+ * unposted: README: Move a new incompatibility notice.
+
+ * unposted: Test/V01zmodload.ztst: Fix trailing whitespace in
+ test expectations.
+
+2020-01-29 Daniel Shahaf <danielsh@apache.org>
+
+ * 45342: Test/V01zmodload.ztst: Add tests for interaction
+ between autoloadable parameters and module loading.
+
+2020-01-17 Daniel Shahaf <danielsh@apache.org>
+
+ * 45313: Completion/Unix/Command/_git: Support completion from
+ outside of a worktree when --git-dir/--work-tree are specified
+ on the command line
+
+2020-01-16 Daniel Shahaf <danielsh@apache.org>
+
+ * 45304: Src/loop.c, Test/A01grammar.ztst: Do execute the always
+ block even when the try/always block itself is the last command.
+
+2020-01-15 dana <dana@dana.is>
+
+ * 45292: Test/D02glob.ztst: Add regression test for macOS stat(2)
+ misbehaviour, now worked around by previous fix (see workers/42891)
+
+ * Daniel: 45291: Src/glob.c, Test/D02glob.ztst: A glob with a
+ trailing slash will now match unreadable/unexecutable directories.
+
+2020-01-15 Daniel Shahaf <danielsh@apache.org>
+
+ * 45288: Completion/Unix/Command/_git: Complete bisect/new as
+ well as bisect/bad.
+
+2020-01-06 Daniel Shahaf <d.s@daniel.shahaf.name>
+
+ * 45246: configure.ac: Make --disable-multibyte warn, since
+ the test suite fails in that configuration.
+
+2020-01-06 Daniel Shahaf <danielsh@apache.org>
+
+ * 45213: README, configure.ac: Make --enable-gdbm default to
+ false, rather than default to true with an unavoidable warning.
+
+2019-12-26 Daniel Shahaf <danielsh@apache.org>
+
+ * unposted (follow-up to 45131): Test/E02xtrace.ztst: Extra
+ testing by Mikael
+
+ * 45137: Src/Modules/zutil.c, Test/V13zformat.ztst: zformat:
+ Allow the specifying minimum width and a dot with an empty
+ maximum width.
+
+ * 45138: Src/Modules/zutil.c, Test/V13zformat.ztst: Add zformat
+ unit tests.
+
+ * 45131: Src/exec.c, Test/E02xtrace.ztst: Make a function that
+ redefines itself preserve its tracedness.
+
+2020-03-06 Daniel Shahaf <danielsh@apache.org>
+
+ * unposted: Completion/BSD/Type/_obsd_architectures: Remove
+ 'sgi', as that OpenBSD port has been discontinued.
+
+2020-03-06 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 45509: Test/B01cd.ztst: Fix typos.
+
+ * 45490 (+45495 and a test): .gitignore,
+ Src/Builtins/rlimits.awk, Src/Builtins/rlimits.c,
+ Src/Builtins/rlimits.mdd, Test/B12limit.ztst, configure.ac:
+ Refactor rlimits.c.
+
+2020-03-05 Bryan Irvine <sparctacus@gmail.com>
+
+ * github #49: Completion/BSD/Type/_obsd_architectures: Fix typo:
+ longson should be loongson
+
+2020-02-27 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * users/24710: Src/exec.c, Src/jobs.c, Src/signals.c: when using
+ kill or killpg to test for continued existince of a process
+ group, check errono is ESRCH on failure as EPERM indicates
+ processes exist but under a different UID.
+
+2020-02-27 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
+
+ * 45492: Test/D02glob.ztst: skip test added by users/24633
+ on Cygwin.
+
+2020-02-25 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 45488: Marc Cornella: Completion/bashcompinit: Need "$@"
+ quoting for empty words in COMP_WORDS for bash completion.
+
+2020-02-24 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 45487: Src/Zle/zle_keymap.c, Src/Zle/zle_main.c,
+ Src/Zle/zle_move.c, Src/builtin.c, Src/compat.c, Src/utils.c:
+ Add missing mod_export for AIX compilation.
+
+2020-02-19 Daniel Shahaf <danielsh@apache.org>
+
+ * 45447: Completion/Zsh/Command/_zstyle,
+ Completion/Zsh/Function/_vcs_info,
+ Completion/Zsh/Type/_vcs_info_hooks: Complete vcs_info_hookadd
+ and vcs_info_hookdel. Expose _vcs_info_hooks as a top-level
+ helper function.
+
+2020-02-18 Chris Down <chris@chrisdown.name>
+
+ * 45463: Test/B11kill.ztst: test: kill: Document why we use
+ SIGURG
+
+ * 45453: Src/jobs.c, Test/B11kill.ztst: builtins: kill: Do not
+ signal current process group when pid is empty
+
+ * 45452: Test/B11kill.ztst: builtins: kill: Add `kill ''`
+ regression test with explicit sigspec
+
+ * 45451: Test/B11kill.ztst: builtins: kill: Add basic test suite
+
+2020-02-17 brian m. carlson <sandals@crustytoothpaste.net>
+
+ * github #48/0002:
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info git:
+ properly detect bare repositories
+
+ * github #48/0001:
+ Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info git:
+ avoid warnings in bare repositories
+
2020-02-14 dana <dana@dana.is>
+ * unposted: Config/version.mk: Post-release version bump
+
* unposted: Config/version.mk: Update for 5.8
* Sam Foxman, Daniel Shahaf, dana: CVE-2019-20044: NEWS,
@@ -1375,7 +4079,7 @@ g
2019-02-14 Peter Stephenson <p.stephenson@samsung.com>
- * see 44062: back off change to ZLE per-line initiialisation,
+ * see 44062: back off change to ZLE per-line initialisation,
causing problems after failed reads and apparently not needed
for the intended fix of interrupt handling (40305 / 34656ec2).
@@ -6186,10 +8890,10 @@ g
Baptiste Daroussin) Better support bmake, FreeBSD's default
make(1) implementation.
- * 39657: Completion/Zsh/Command/_zstyle: Complete the -g,
+ * 39659: Completion/Zsh/Command/_zstyle: Complete the -g,
-s,-b,-a, -t,-T, -m options.
- * 39657: Completion/Zsh/Command/_zstyle: When completing a
+ * 39658: Completion/Zsh/Command/_zstyle: When completing a
style for an unrecognised context, complete all known styles.
* 39657: Completion/Zsh/Command/_zstyle,
@@ -14098,7 +16802,7 @@ g
* 32338: Doc/Makefile.in: create Doc/help.txt as an empty file
when Util/helpfiles fails, so that the rest of the build does not
- yeild a spurious error
+ yield a spurious error
* 32337: Src/params.c: initialize several special parameters to
unset for better compatibility in emulation modes; for the same
diff --git a/Completion/BSD/Command/_bsd_pkg b/Completion/BSD/Command/_bsd_pkg
index 25d4f346a..82cf6226c 100644
--- a/Completion/BSD/Command/_bsd_pkg
+++ b/Completion/BSD/Command/_bsd_pkg
@@ -78,12 +78,12 @@ _bsd_pkg() {
;;
openbsd*)
flags+=(
- '-A[arch to assume for any package tests]:architecture:_obsd_architectures'
+ '-A+[arch to assume for any package tests]:architecture:_obsd_architectures'
'-a[do not record packages as installed manually]'
'-aa[force already installed packages to be tagged as installed automatically]'
- '-B[specify destdir prefix]:destdir directory:_files -/'
+ '-B+[specify destdir prefix]:destdir directory:_files -/'
'-c[while replacing packages, delete extra configuration file in the old package]'
- '-D[specify failsafe to waive]:failsafe:((
+ '*-D+[specify failsafe to waive]:failsafe:((
allversions\:"do not trim older p* variants of packages for updates"
arch\:"architecture recorded in package may not match"
checksum\:"verify checksums before deleting or tying old files"
@@ -91,9 +91,7 @@ _bsd_pkg() {
donttie\:"do not try to find new files in old packages by comparing the stored sha256"
downgrade\:"do not filter out package versions older than what is currently installed"
installed\:"in update mode, reinstall an existing package with the same update signature"
- libdepends\:"library specifications may not be fulfilled"
nonroot\:"install even if not running as root"
- paranoid\:"do not run any @exec/@unexec"
repair\:"attempt to repair installed packages with missing registration data"
scripts\:"external scripts may fail"
SIGNER\:"list of trusted signers, separated by commas"
@@ -103,10 +101,10 @@ _bsd_pkg() {
))'
'-I[force non-interactive mode]'
'-i[force interactive mode]'
- '-L[specify a localbase]:localbase:_files -/'
- '-l[specify pkg_info output file to install]:pkg_info file:_files'
+ '-L+[specify a localbase]:localbase:_files -/'
+ '-l+[specify pkg_info output file to install]:pkg_info file:_files'
'-m[always display progress meter]'
- '-P[check distribution permissions]:permission type:(cdrom ftp)'
+ '-P+[check distribution permissions]:permission type:(ftp)'
"-qq[don't check checksums]"
'-r[replace existing packages]'
"-s[don't install; just report disk size changes]"
@@ -143,25 +141,28 @@ _bsd_pkg() {
case "$OSTYPE" in
netbsd*)
flags+=(
- '(:)-a[delete all installed packages]'
+ '(:)-A[remove automatically installed packages that are no longer required]'
"-D[don't execute deinstallation scripts]"
'-F[specify each package by an installed file]'
'-f[force deinstallation]'
- '-K[override PKG_DBDIR]:pkg_dbdir:_files -/'
+ '-ff[force deinstallation even if preserved]'
+ '-K+[override PKG_DBDIR]:pkg_dbdir:_files -/'
+ '-k[silently skip preserved packages]'
+ '-N[leave the files installed]'
"-O[only delete the package's entries]"
- '-P[specify destdir prefix]:destdir directory:_files -/'
- '-p[specify prefix]:prefix directory:_files -/'
+ '-P+[specify destdir prefix]:destdir directory:_files -/'
+ '-p+[specify prefix]:prefix directory:_files -/'
'-R[delete upward recursively]'
'-r[delete recursively]'
'-V[show version and exit]'
- '(-a)*:package name:_bsd_pkg_pkgs_and_files'
+ '*:package name:_bsd_pkg_pkgs_and_files'
)
;;
openbsd*)
flags+=(
'-a[delete unused dependencies]'
- '-B[specify destdir prefix]:destdir directory:_files -/'
- '-D[specify failsafe to waive]:failsafe:((
+ '-B+[specify destdir prefix]:destdir directory:_files -/'
+ '*-D+[specify failsafe to waive]:failsafe:((
baddepend\:"force deletion of packages even if they reference nonexistent dependencies"
checksum\:"verify checksums before deleting or tying old files"
dependencies\:"delete the set of packages that depend upon the requested packages"
@@ -189,11 +190,11 @@ _bsd_pkg() {
'(:)-a[show all installed packages]'
'-c[show comment fields]'
'-d[show long descriptions]'
- '-e[test if package is installed]:package name:_bsd_pkg_pkgs'
+ '-e+[test if package is installed]:package name:_bsd_pkg_pkgs'
'-f[show packing list instructions]'
'-I[show index lines]'
'-L[show full pathnames of files]'
- '-l[specify prefix string]:prefix string:'
+ '-l+[specify prefix string]:prefix string:'
'-q[be quiet]'
'-R[show list of installed requiring packages]'
'-s[show total size occupied by each package]'
@@ -209,13 +210,13 @@ _bsd_pkg() {
'-D[show install-message files]'
'-F[specify each package by an installed file]'
'-i[show install scripts]'
- '-K[override PKG_DBDIR]:pkg_dbdir:_files -/'
+ '-K+[override PKG_DBDIR]:pkg_dbdir:_files -/'
'-k[show deinstall scripts]'
'-m[show mtree files]'
'-N[show which packages each package was built with]'
'-n[show which packages each package needs]'
'-p[show installation prefixes]'
- '-Q[show the definition of the specified variable from the build information]:variable:'
+ '-Q+[show the definition of the specified variable from the build information]:variable:'
'-r[show list of installed requiring packages recursively]'
'-S[show total size occupied by each package and its dependents]'
'-u[show information for all user-installed packages]'
@@ -227,14 +228,19 @@ _bsd_pkg() {
flags+=(
'(:)-A[show all installed packages, including internal packages]'
'-C[show certificate information]'
+ '*-D+[specify failsafe to waive]:failsafe:((
+ SIGNER\:"list of trusted signers, separated by commas"
+ snap\:"force %c and %m to expand to snapshots"
+ unsigned\:"allow the installation of unsigned packages without warnings/errors"
+ ))'
'-E[show the package that contains the specified file]:file:_files'
# XXX only with -L
'-K[prefix filenames with category keywords]'
'-M[show the install-message file]'
'-m[only show manual installations]'
'-P[show the pkgpath]'
- '-Q[show packages matching the specified query]:query:'
- '-r[check the list of packages for a specified pkgspec]:pkgspec:'
+ '-Q+[show packages matching the specified query]:query:'
+ '-r+[check the list of packages for a specified pkgspec]:pkgspec:'
'-S[show the update signature]'
'-t[show packages not required by any other]'
'-U[show the deinstall-message file]'
diff --git a/Completion/BSD/Command/_freebsd-update b/Completion/BSD/Command/_freebsd-update
index d42457272..7dd907298 100644
--- a/Completion/BSD/Command/_freebsd-update
+++ b/Completion/BSD/Command/_freebsd-update
@@ -5,9 +5,11 @@ flags=(
'(cron)fetch[fetch a compressed snapshot or update existing one]'
'(fetch)cron[sleep rand(3600) seconds, and then fetch updates]'
'(install rollback)upgrade[fetch files necessary for upgrading to a new release]'
+ 'updatesready[check if there are fetched updates ready to install]'
'(upgrade rollback)install[install the most recently fetched updates or upgrade]'
'(upgrade install)rollback[uninstall the most recently installed updates]'
'IDS[compare the system against an index of "known good" files]'
+ 'showconfig[show configuration options after parsing conffile and command line options]'
)
_arguments \
diff --git a/Completion/BSD/Command/_ipfw b/Completion/BSD/Command/_ipfw
new file mode 100644
index 000000000..49d0ef1e8
--- /dev/null
+++ b/Completion/BSD/Command/_ipfw
@@ -0,0 +1,325 @@
+#compdef ipfw
+
+local word=$'/[^ \t\0]#[ \t\0]/' comma next pqs nat
+local -a actions address pathname ropts ca
+local -A opt_args nat_options
+
+_ipfw_tables() {
+ local -a expl match opts all
+ zparseopts -D -E -a opts M+: x+: X+: J+: V+: o+: 1 2 a=all
+ _description -x ipfw-tables expl 'table'
+ match=( ${${${(M)${(f)"$(_call_program ipfw-tables
+ ipfw table all info 2>/dev/null)"}:#-*}#*\(}%%\)*} )
+ if (( $#all )); then
+ match+=( all )
+ compadd -D match -a match
+ [[ $#PREFIX -eq 0 && $#match -eq 1 && $match[1] = all ]] && compstate[insert]=''
+ fi
+ compadd "$opts[@]" "$expl[@]" "$@" -a match
+}
+
+_ipfw_rules() {
+ local -a rules
+ rules=( ${${(f)"$(_call_program ipfw-rules ipfw list)"}/ /:} )
+ _describe -x -t ipfw-rules rule rules "$@"
+}
+
+ropts=( # rule options
+ bridged
+ defer-{immediate-,}action diverted{,-loopback,-output}
+ dst-{ip{,6,v6},port} established ext6hdr
+ fib flow flow-id frag gid jail
+ icmptypes icmp6types in out
+ ipid iplen ipoptions ipprecedence ipsec iptos dscp ipttl ipversion
+ keep-state layer2 limit lookup
+ MAC mac-type proto record-state recv xmit via
+ set-limit setup sockarg
+ src-{ip,ip6,port} tagged
+ tcpack tcpdatalen tcpflags tcpmss tcpseq tcpwin tcpoptions
+ uid verrevpath versrcreach antispoof
+)
+
+nat_options=(
+ nat64lsn "prefix4 prefix6 states_chunk host_del_age pg_del_age tcp_syn_age tcp_est_age tcp_close_age udp_age icmp_age log -log allow_private -allow_private"
+ nat64stl "prefix6 table4 table6 log -log allow_private -allow_private"
+ nat64clat "clat_prefix plat_prefix log -log allow_private -allow_private"
+ nptv6 "int_prefix ext_prefix ext_if prefixlen"
+)
+
+ca=( compadd -S " " -r " $compstate[quote]\t\n\-" )
+
+address=(
+ \( $'/not[ \t\0]/' ':operators:operator:$ca not' \| \)
+ \( $'/(any|me|me6)[ \t\0]/' ':addresses:address:$ca any me me6'
+ \| '/table??/' ':tables:table:compadd -S "" -s\( table'
+ $word ':tables:table:_ipfw_tables -s\) -S ""'
+ \| // -'comma=0'
+ \(
+ // -'(( ! comma ))'
+ \( $'/[^, \t\0]#/' $'%[, \t\0]%' ':hosts:ip or host:_hosts -S, -r "/: \t\n\-"'
+ \| $'/[^},/:]##//' '/[]/' ': _message -e numbers "mask length"'
+ \| $'/[^},/:]##:/' '/[]/' ': _message -e numbers "mask"'
+ \| $'/([0-9]##.)(#c3)[0-9]##/' '/[]/' ':symbols:symbol:compadd -S "" / : ,'
+ \| // '%[1-9]%' '/[]/' ': _message -e ip-addresses "IP address"' \)
+ \( /,/ -'comma=0' \| // -'comma=1' \)
+ $'/([ \t\0]|)/'
+ \) \#
+ // -'(( comma ))'
+ \)
+)
+address=(
+ \( $'/[({][ \t]\0/' -'next=1' ':symbols:symbol:$ca - {'
+ \( // -'(( next ))' $address
+ \( $'/or[ \t\0]/' -'next=1' ':symbols:symbol:$ca - or \}' \| // -'next=0' \)
+ \) \#
+ $'/[})][ \t\0]/'
+ \| $address \)
+ \(
+ \( $'/not[ \t\0]/' ':specifiers:specifier:$ca - not' \| \)
+ $word -$'[[ $match != to? && -z ${(M)ropts:#${match%?}} ]]' ':ports:port:_sequence _ports'
+ \| \)
+)
+
+actions=(
+ $'/[^\0]##\0(-[a-zA-Z0-9]##[ \t]#)#/' # skip over options, completed by _arguments but can
+ \( # be quoted in one argument which that doesn't handle
+ $'/add[ \t\0]/' ':firewall-commands:firewall configuration:$ca add'
+ \( $'/<->[ \t\0]/' ': _guard "[0-9]#" "rule number (00000-65535)"' \| \)
+ \( $'/set[ \t\0]/' ':specifiers:specifier:$ca set' $word ':sets:set:$ca -o numeric {0..31}' \| \)
+ \( $'/prob[ \t\0]/' ':specifiers:specifier:$ca prob' $word ': _message -e probabilities "match probability (0.0-1.0)"' \| \)
+ \( # rule actions
+ $'/check-state[ \t\0]/' $word ': _message -e flow-names "flow name"'
+ \|
+ \( $'/(divert|tee)[ \t\0]/' $word ': _message -e ports port'
+ \| $'/(fwd|forward)[ \t\0]/'
+ \( $word ': _guard "[0-9]#" "ip address"'
+ \| '/[^\0]#,/' ':specials:special:compadd -qS, tablearg'
+ $word ':ports:port:_ports -qS " "' \)
+ \| $'/(nat*|nptv6)[ \t\0]/'
+ \( $word ': _guard "[0-9]#" "nat instance"'
+ \| $word ':specials:special:$ca global tablearg' \)
+ \| $'/pipe[ \t\0]/' $word ': _message -e pipes "dummynet pipe"'
+ \| $'/queue[ \t\0]/' $word ': _message -e queues "dummynet queue"'
+ \| $'/(skipto|call)[ \t\0]/' \( /t/+ $word ':specials:special:$ca tablearg' \| '/[]/' ':ipfw-rules:rule:_ipfw_rules -qS " "' \)
+ \| $'/unreach[ \t\0]/' $word ':codes:code:$ca net host protocol port needfrag srcfail net-unknown host-unknown isolated net-prohib host-prohib tosnet toshost filter-prohib host-precedence precedence-cutoff'
+ \| $'/unreach6[ \t\0]/' $word ':codes:code:$ca no-route admin-prohib address port'
+ \| $'/(netgraph|ngtee)[ \t\0]/' $word ': _message -e cookies cookie'
+ \| $'/setfib[ \t\0]/' \( $word ': _guard "[0-9]#" "routing table"' \| '/[]/' ':specials:special:$ca tablearg' \)
+ \| $'/setdscp[ \t\0]/' \( $word ':dscps:dscp:$ca cs{0..7} af{1,2,3,4}{1,2,3} ef be' \| '/[]/' ':specials:special:$ca tablearg' \)
+ \| $'/tcp-setmss[ \t\0]/' $word ': _message -e mss mss'
+ \| $word \)
+ \( $'/log[ \t\0]/' ':specifiers:specifier:$ca log'
+ \( $'/logamount[ \t\0]/' ':specifiers:specifier:$ca logamount' $word ': _message -e limits "maximum count"' \| \)
+ \| \)
+ \( $'/altq[ \t\0]/' ':specifiers:specifier:$ca altq' $word ': _message -e queues queue' \| \)
+ \( $'/(tag|untag)[ \t\0]/' ':specifiers:specifier:$ca tag untag' $word ': _message -e numbers "tag (1-65534)"' \| \)
+ # rule body
+ \( \( $'/not[ \t\0]/' ':operators:operator:$ca not' \| \)
+ $'/(ip(v|)(4|6|)|all|icmp|ip|tcp|udp|sctp)[ \t\0]/' ':protocols:protocol:$ca ip ip4 ipv4 ip6 ipv6 all icmp tcp udp sctp'
+ $'/from[ \t\0]/' ':specifiers:specifier:$ca from'
+ $address
+ $'/to[ \t\0]/' ':specifiers:specifier:$ca to'
+ $address
+ \| \)
+ # rule options
+ \( $'///[ \t\0]/' ':rule-options:rule option:((//\:comment))' // ': _message -e comments comment'
+ \| $'/(dst|src)-ip(|6|v6)[ \t\0]/' $word ': _message -e addresses address'
+ \| $'/(dst|src)-port[ \t\0]/' $word ':ports:port:_sequence _ports'
+ \| $'/ext6hdr[ \t\0]/' $word ':headers:extended header:_sequence compadd - frag hopopt route rthdr0 rthdr2 dstopt ah esp'
+ \| $'/fib[ \t\0]/' $word ': _message -e routing-tables "routing table"'
+ \| $'/flow[ \t\0]/' '/table??/' ':tables:table:compadd -S "" -s\( table'
+ $word ':tables:table:_ipfw_tables -s\) -S ""'
+ \| $'/flow-id[ \t\0]/' $word ': _message -e flow-labels "flow label"'
+ \| $'/frag[ \t\0]/' $word ':fragmentation options:fragmentation option:_sequence compadd - df mf rf offset'
+ \| $'/gid[ \t\0]/' $word ':groups:group:_groups'
+ \| $'/jail[ \t\0]/' $word ':jails:jail:_jails'
+ \| $'/ipoptions[ \t\0]/' $word ':ip-options:ip option:_sequence compadd - ssrr lsrr rr ts'
+ \| $'/iptos[ \t\0]/' $word ':tos-fields:tos field:_sequence compadd - lowdelay throughput reliability mincost congestion'
+ \| $'/(set-|)limit[ \t\0]/' $word ':parameters:parameter to limit:$ca {src,dsr}-{addr,port}'
+ $word ': _message -e numbers "connection limit"'
+ \| $'/lookup[ \t\0]/' $word ':fields:field:$ca {src,dst}-{ip,port} uid jail'
+ $word ': _message -e names name'
+ \| $'/(#i)mac[ \t\0]/' $word ': _message -e mac-addresses "destination mac"'
+ $word ': _message -e mac-addresses "source mac"'
+ \| $'/proto[ \t\0]/' $word ': _message -e protocols "IP protocol"'
+ \| $'/(recv|xmit|via)[ \t\0]/'
+ \( $word ':interfaces:interface:_net_interfaces -qS " "'
+ \| $word ':ipfw-tables:table:_ipfw_tables -qS " "'
+ \| $'/any[ \t\0]/' ':interfaces:interface:$ca any' \)
+ \| $'/tcpflags[ \t\0]/' $word ':tcp-flags:tcp flag:_sequence compadd - fin syn rst psh ack urg'
+ \| $'/tcpoptions[ \t\0]/' $word ':tcp-options:tcp option:_sequence compadd - mss window sack ts cc'
+ \| $'/uid[ \t\0]/' $word ':users:user:_users -qS " "'
+ \| $'/(icmp(|6)types|ipid|iplen|ipprecedence|dscp|ipttl|ipversion|keep-state|mac-type|tagged|tcp(ack|datalen|mss|pack|seq|win))[ \t\0]/' $word ': _message -e values value'
+ \| $word ':rule-options:rule option:$ca -a ropts'
+ \) \#
+ \|
+ '/[]/' ':actions:action:$ca allow check-state count deny divert forward nat nat64lsn nat64stl nat64clat nptv6 pipe queue reset reset6 skipto call return tee unreach unreach6 netgraph setfib ngtee setfib setdscp tcp-setmss reass abort abort6'
+ \)
+ \| $'/set[ \t\0]show[ \t\0]/'
+ \| $'/set[ \t\0]move[ \t\0]/'
+ \( // %r% $'/rule[ \t\0]/' ': $ca rule' \| \)
+ $word ':ipfw-rules: :_ipfw_rules -qS " "'
+ $'/to[ \t\0]/' ': $ca to'
+ $word ':ipfw-rules: :_ipfw_rules'
+ \| $'/set[ \t\0]swap[ \t\0]/'
+ $word ':ipfw-sets:set:$ca -o numeric {0..31}'
+ $word ':ipfw-sets:set:compadd -o numeric {0..31}'
+ \| $'/set[ \t\0]/' '%[ed]%'
+ \(
+ $'/(en|dis)able[ \t\0]/' ':set-commands:set command:$ca -F line enable disable'
+ $'/<->[ \t\0]/' ':ipfw-sets:set:$ca -o numeric {0..31}'
+ $'/<->[ \t\0]/' ':ipfw-sets:set:$ca -o numeric {0..31}' \#
+ \) \#
+ \|
+ \( $'/set[ \t\0]/' ':firewall-commands:firewall configuration:$ca set'
+ \( $'/<->[ \t\0]/' ':sets:set:$ca -o numeric {0..31}'
+ \| '/[]/' ':set-commands:set command:$ca move swap show enable disable' \)
+ \| \)
+ \( $'/(list|show|delete)[ \t\0]/' ':firewall-commands:firewall configuration:$ca list show delete zero resetlog'
+ \( $'/[0-9]##-/' $word ':ipfw-rules: :_ipfw_rules -qS " "'
+ \| $word ':ipfw-rules: :_ipfw_rules -qS "-"' \) \#
+ \| $'/(zero|resetlog)[ \t\0]/' $word ':ipfw-rules: :_ipfw_rules -qS " "' \#
+ \| $'/flush[ \t\0]/' ':firewall-commands:firewall configuration:(flush)'
+ \| $'/table[ \t\0]/' ':commands:command:$ca table'
+ \( # lookup tables
+ $'/all[ \t\0]/' $word ':commands:table command:compadd destroy list info detail flush'
+ \|
+ $word ':tables:table:_ipfw_tables -a -qS " "'
+ \( $'/create[ \t\0]/'
+ \( $'/type[ \t\0]/' $word ':types:type:(addr iface number flow)'
+ \| $'/valtype[ \t\0]([^ \t\0]#,|)/' $word ':value-types:value type:compadd -qS, skipto pipe fib nat dscp tag divert netgraph limit ipv4 ipv6'
+ \| $'/algo[ \t\0]/' $word ':algorithms:lookup algorithm:$ca addr\:radix addr\:hash iface\:array number\:array flow\:hash'
+ \| $'/limit[ \t\0]/' $word ': _message -e numbers "maximum number of items"'
+ \| $word ':options:option:$ca -F line type valtype algo limit locked missing or-flush' \) \#
+ \| $'/modify[ \t\0]/'
+ $'/limit[ \t\0]/' ':options:option:$ca limit'
+ $word ': _message -e numbers "maximum number of items"'
+ \| $'/swap[ \t\0]/'
+ $word ':tables:table:_ipfw_tables -a'
+ \| $'/(atomic[ \t\0]|)add[ \t\0]/' \(
+ $word ': _message -e table-keys "table key"'
+ $word ': _message -e values value' \) \#
+ \| $'/delete[ \t\0]/' $word ': _message -e table-keys "table key"' \#
+ \| $'/lookup[ \t\0]/' $word ': _message -e addresses address'
+ \|
+ '/[]/' ':commands:table command:compadd - destroy lock unlock list info detail flush'
+ \|
+ $word ':commands:table command:$ca -Q - create modify swap add atomic\ add delete lookup'
+ \)
+ \)
+ \| $'/(nat64(lsn|stl|clat)|nptv6)[ \t\0]/' -'nat=${match%?}' ':commands:command:$ca nat64lsn nat64stl nat64clat nptv6'
+ $word ': _message -e names name'
+ \( $'/(config|create)[ \t\0]/'
+ \( $'/[^\0]#prefix([46]|)[ \t\0]/' $word ': _message -e prefixes prefix'
+ \| $'/states_chunks[ \t\0]/' $word ': _message -e numbers number'
+ \| $'/[^\0]#_age[ \t\0]/' ': _message -e seconds "age (seconds)"'
+ \| $'/table[46][ \t\0]/' $word ':ipfw-tables:ipfw table:_ipfw_tables -qS " "'
+ \| $'/ext_if[ \t\0]/' $word ':interfaces:interface:_net_interfaces -qS " "'
+ \| $'/prefixlen[ \t\0]/' ': _message -e lengths length'
+ \| $word ':options:option:$ca -F line $=nat_options[$nat]' \) \#
+ \| $'/(list|show)[ \t\0]/'
+ \( // -'[[ $nat = *lsn]' $word ':states:state:(states)'
+ \| // -'[[ $nat != *lsn]' \)
+ \| $'/stats[ \t\0]/' $word ':commands:command:(reset)'
+ \|
+ $word ':commands:command:$ca create config list show destroy stats'
+ \)
+ \)
+ \| # in-kernel NAT
+ $'/nat[ \t\0]/' ':commands:command:$ca nat'
+ $word ': _message -e numbers "nat instance"'
+ \( $'/config[ \t\0]/'
+ \( $'/if[ \t\0]/' $word ':interfaces:interface:_net_interfaces -qS " "'
+ \| $'/ip[ \t\0]/' $word ': _message -e ip-addresses "ip address"'
+ \| $'/redirect_addr[ \t\0]/'
+ $word ': _message -e ip-addresses "IP address"'
+ $word ': _message -e ip-addresses "IP address"'
+ \| $'/redirect_port[ \t\0]/' $word ':protocols:protocol:$ca sctp tcp udp'
+ '/[^:]##:/' ': _message -e ip-addresses "IP address"'
+ $word ':ports:port:_ports'
+ $word ':ports:port:_sequence _ports'
+ \| $'/redirect_proto[ \t\0]/' $word ':protocols:protocol:$ca sctp tcp udp'
+ $word ': _message -e ip-addresses "IP address"'
+ $word ': _message -e ip-addresses "IP address"'
+ \| $word ':parameters:config parameter:$ca ip if log deny_in same_ports unreg_only unreg_cgn reset reverse proxy_only skip_global redirect_port redirect_addr redirect_proto'
+ \) \#
+ \| $'/show[ \t\0]/' $word ':actions:action:(config log)'
+ \| '/[]/' ':commands:command:$ca config show' \)
+ \| # dummynet configuration
+ $'/(pipe|queue|sched)[ \t\0]/' -'pqs=${match%?}' ':dummynet-commands:dummynet configuration:$ca pipe queue sched'
+ $word ': _message -e numbers number'
+ $word ':options:config:$ca config'
+ \( $'/bw[ \t\0]/'
+ \( $word ':bandwidths: :_numbers -M "m:{a-z}={A-Z}" bandwidth {K,M,G}{bit,Byte}/s'
+ \| $word ':devices:device:_net_interfaces -qS " "' \)
+ \| $'/delay[ \t\0]/' $word ': _message -e numbers "propagation delay (ms)"'
+ \| $'/burst[ \t\0]/' $word ': _message -e numbers "size (bytes)"'
+ \| $'/profile[ \t\0]/' $word ':files:file:_files -qS " "'
+ \| $'/pipe[ \t\0]/' $word ': _message -e pipes pipe'
+ \| $'/weight[ \t\0]/' $word ': _message -e weights "weight (1-100) [1]"'
+ \| $'/type[ \t\0]/-'
+ \( $'/fq_(pie|codel)[ \t\0]/'
+ \( $'/limit[ \t\0]/' $word ': _message -e numbers "limit (packets) [10240]"'
+ \| $'/flows[ \t\0]/' $word ': _message -e numbers "flow queues [1024]"'
+ \| $'/quantum[ \t\0]/' ':parameters:parameter:$ca -F line quantum limit flows' \) \#
+ '/[]/'
+ \| $word ':types:scheduling algorithm:$ca fifo wf2q+ rr qfq fq_codel fq_pie fq_codel' \)
+ \| $'/buckets[ \t\0]/' $word ': _message -e sizes "hash table size (16-65536)"'
+ \| $'/mask[ \t\0]/' $word ':mask-specifiers:mask specifier:$ca dst-ip dst-ip6 src-ip src-ip6 dst-port src-port flow-id proto all'
+ \| $'/plr[ \t\0]/' $word ': _message -e numbers "packet loss rate (0.0-1.0)"'
+ \| $'/queue[ \t\0]/' $word ': _message -e sizes "queue size"'
+ \| $'/(red|gred)[ \t\0]/' $word ': _message -e thresholds thresholds'
+ \| $'/codel[ \t\0]/'
+ \( $'/(target|interval)[ \t\0]/' $word ': _message -e times "time (ms)"'
+ \| $'/(ecn|noecn)[ \t\0]/' ':options:option:$ca -F line target interval ecn noecn' \) \#
+ '/[]/'
+ \| $'/pie[ \t\0]/'
+ \( $'/(target|tupdate|max_burst)[ \t\0]/' $word ': _message -e times "time"'
+ \| $'/(alpha|beta)[ \t\0]/' $word ': _message -e weights weight'
+ \| $'/max_ecnth[ \t\0]/' $word ': _message -e probabilities probability'
+ \| $word ':options:option:$ca -F line alpha beta max_burst max_ecnth {,no}{ecn,capdrop,drand} onoff dre ts' \) \#
+ '/[]/'
+ \| // '-[[ $pqs = pipe ]]' $'/noerror[ \t\0]/' ':options:option:$ca -F line bw delay burst profile buckets mask noerror plr queue red gred codel pie'
+ \| // '-[[ $pqs = queue ]]' $'/noerror[ \t\0]/' ':options:option:$ca -F line pipe weight buckets mask noerror plr queue red gred codel pie'
+ \| // '-[[ $pqs = sched ]]' $'/[]/' ':options:option:$ca -F line type bw delay burst profile'
+ \) \#
+ \| # sysctl shortcuts
+ $'/(en|dis)able[ \t\0]/' ':sysctl-shortcuts:sysctl shortcut:$ca enable disable'
+ $word ':values:value:(firewall altq one_pass debug verbose dyn_keepalive)'
+ \|
+ $'/internal[ \t\0]/' ':commands:command:$ca internal'
+ $word ':lists:list:(iflist talist vlist)'
+ \)
+)
+
+if (( $words[(I)-p*] )); then
+ pathname=( ':path:_files -P / -W /' )
+fi
+
+_regex_arguments _ipfw_actions "$actions[@]"
+
+if [[ -prefix *[$' \t']* ]]; then
+ # This allows from things like ipfw "-n add..."
+ _ipfw_actions
+ return
+fi
+
+_arguments -s $pathname \
+ '(-p)-a[show counter values when listing rules (implied by show)]' \
+ '(-p)-b[show only the action and the comment]' \
+ '-c[show rules in compact form]' \
+ '(-p)-d[show dynamic rules in addition to static ones]' \
+ '(-p)-D[act on dynamic states only]' \
+ '-f[run without confirmation]' \
+ '(- *)-h[display syntax summary]' \
+ '(-p)-i[format values as IP addresses in table listings]' \
+ '-n[only check syntax, make no changes]' \
+ '-N[resolve addresses and service names in output]' \
+ '-q[quiet output]' \
+ '-S[show the set each rule belongs to]' \
+ '(-p)-s+[sort pipes by field]:field (negative reverses):((0\:unsorted 1\:packets 2\:bytes 3\:total\ packets 4\:total\ bytes))' \
+ '(-p -T)-t[show timestamp of last match, ctime() format]' \
+ '(-p -t)-T[show timestamp of last match as seconds since epoch]' \
+ '(-a -b -d -D -i -s -t -T *)-p+[specify preprocessor]:preprocessor:_command_names -e' \
+ '*:::actions:= _ipfw_actions'
+
diff --git a/Completion/BSD/Command/_kdump b/Completion/BSD/Command/_kdump
new file mode 100644
index 000000000..e5c7c4cce
--- /dev/null
+++ b/Completion/BSD/Command/_kdump
@@ -0,0 +1,84 @@
+#compdef kdump
+
+_kdump_pid() {
+ local -a args pids
+ local -A assoc_pids
+
+ if (( $+opt_args[-f] )); then
+ args=(-f $opt_args[-f])
+ fi
+ pids=(${${${(f)"$(_call_program kdump-pids kdump $args)"}:#($'\t'| )*}## #})
+ [[ $OSTYPE == netbsd* ]] && pids=(${pids/ ##[0-9]##/})
+ pids=(${(u)${pids/ /:}%% *})
+ for 1 in $pids; do
+ local pid=${1%%:*} process=${1#*:}
+ if (( $+assoc_pids[$pid] )); then
+ assoc_pids[$pid]+=", $process"
+ else
+ assoc_pids[$pid]=$process
+ fi
+ done
+ pids=()
+ for pid procs in ${(kv)assoc_pids}; do
+ pids+=($pid:$procs)
+ done
+ _describe -t kdump-pids 'kdump pid' pids
+}
+
+local args=(
+ '-d[display numbers in decimal]'
+ '-f+[use the specified file (- for stdin)]:dump file:_files'
+ '-l[loop reading the trace file]'
+ '-m+[maximum I/O bytes to display]:max data bytes:'
+ '-n[suppress ad hoc translations]'
+ '-p+[show output only for the specified pid]: :_kdump_pid'
+ '(-E -T)-R[display relative timestamps]'
+ '(-E -R )-T[display absolute timestamps]'
+ '-t[select which tracepoints to display]: :_ktrace_points'
+)
+
+case $OSTYPE; in
+ freebsd*|netbsd*)
+ args+=(
+ '(-R -T)-E[display elapsed timestamps]'
+ )
+ ;|
+ freebsd*|openbsd*)
+ args+=(
+ '-H[display thread identifiers]'
+ )
+ ;|
+ dragonfly*)
+ args+=(
+ '(-c -R)-a[display full human readable output]'
+ '-c[display the CPU the thread is running on]'
+ '-j[use a fixed format output]'
+ )
+ ;;
+ freebsd*)
+ args+=(
+ '-A[display description of the ABI of traced process]'
+ '-r[symbolically display structure members]'
+ '-S[display system call numbers]'
+ '-s[suppress display of I/O data]'
+ )
+ ;;
+ netbsd*)
+ args+=(
+ '-e[interpret system call maps using the specified emulation]:emulation:'
+ '-N[suppress system call name translation]'
+ '-X[Display GIO data in hex and ascii in groups of specified size]:size:(1 2 4 8 16)'
+ '-x[Display GIO data in hex and ascii]'
+ '1:dump file:_files'
+ )
+ ;;
+ openbsd*)
+ args+=(
+ # XXX handle -TR
+ '-X[display I/O data in hex and ASCII]'
+ '-x[display I/O data in hex]'
+ )
+ ;;
+esac
+
+_arguments -s -S -A '-*' : $args
diff --git a/Completion/BSD/Command/_ktrace b/Completion/BSD/Command/_ktrace
new file mode 100644
index 000000000..9613ba2bf
--- /dev/null
+++ b/Completion/BSD/Command/_ktrace
@@ -0,0 +1,30 @@
+#compdef ktrace
+
+local args=(
+ '-a[append to the trace file]'
+ '(*)-C[disable tracing on all user owned processes or all processes if executed by root]'
+ '-c[clear the trace points]'
+ '-d[trace current descendants]'
+ '-f+[log trace to specified file]:trace file:_files'
+ '(-p *)-g+[enable/disable tracing on specified process group]:pgid:_pgids'
+ '-i[inherit trace flags on future children]'
+ '(-g *)-p+[enable/disable tracing on specified PID]: :_pids'
+ '-t+[select information to include in dump]:trace string:_ktrace_points'
+ '*:: : _normal -p ktrace'
+)
+
+case $OSTYPE; in
+ openbsd*)
+ args+=(
+ '-B[process relocations immediately]'
+ )
+ ;;
+ netbsd*)
+ args+=(
+ '-n[stop tracing if writes to the trace file would block]'
+ '-s[write to the trace file with synchronized I/O]'
+ )
+ ;;
+esac
+
+_arguments -s -S -A '-*' : $args
diff --git a/Completion/BSD/Command/_pfctl b/Completion/BSD/Command/_pfctl
index 23898882f..812e52bdb 100644
--- a/Completion/BSD/Command/_pfctl
+++ b/Completion/BSD/Command/_pfctl
@@ -66,7 +66,7 @@ case $OSTYPE in
"-N[don't perform domain name resolution]"
'-P[display ports using service names]'
'-S+[store pf state table in the specified file]:file:_files'
- '-V+[select routing domain to be used to kill states]:routing domain'
+ '-V+[select routing domain to be used to kill states]:routing domain:_routing_domains'
)
;;
(free|net)bsd*)
diff --git a/Completion/BSD/Command/_pkgin b/Completion/BSD/Command/_pkgin
index 5cb12baea..662bed181 100644
--- a/Completion/BSD/Command/_pkgin
+++ b/Completion/BSD/Command/_pkgin
@@ -26,7 +26,7 @@ _arguments -s -S -C \
'*:: :->restargs' && ret=0
if [[ -n $state ]]; then
- cmds=( ${${${(f)"$(_call_program commands $pkgin -h 2>&1)"}[3,-1]/ - (#b)(?)/:$match:l}%.} )
+ cmds=( ${${${(f)"$(_call_program commands $pkgin -h 2>&1)"}[3,-1]/ - (#b)(?)/:$match:l}%.} )
short=( ${${cmds#*\(}/ #\)/} )
cmds=( ${cmds// #\(*\)/} )
if [[ $state = subcommands && ! -prefix - ]]; then
diff --git a/Completion/BSD/Command/_portmaster b/Completion/BSD/Command/_portmaster
index 48390c9ad..ee6fefc6e 100644
--- a/Completion/BSD/Command/_portmaster
+++ b/Completion/BSD/Command/_portmaster
@@ -8,11 +8,11 @@ _portmaster_ports() {
local expl ret=1 _fbsd_ports _fbsd_cat
_fbsd_cat=(${PORTSDIR:-/usr/ports}/[a-z]*(/:t))
if [[ $PREFIX != */* ]] ; then
- _wanted cat_packages expl 'category/ports' compadd -S '/' $_fbsd_cat
+ _wanted cat_packages expl 'category/port' compadd -S '/' $_fbsd_cat
else
compset -P '*/'
_fbsd_ports=(${PORTSDIR:-/usr/ports}/$IPREFIX/*(/:t))
- _wanted cat_packages expl 'category/ports' compadd $_fbsd_ports
+ _wanted cat_packages expl 'category/port' compadd $_fbsd_ports
fi
return ret
}
@@ -77,7 +77,7 @@ _portmaster() {
_arguments -s \
$standalone_args \
$common_args \
- '*:packages and ports:_portmaster_pkgs_and_ports'
+ '*:package or port:_portmaster_pkgs_and_ports'
else
case "$words[2]" in
--clean-distfiles|--clean-distfiles-all|--check-depends|--check-port-dbdir|--version|-help|-h)
@@ -86,14 +86,14 @@ _portmaster() {
*)
if (( $words[(I)-(e|r)] ));then
_arguments -s \
- '*:packages:_portmaster_pkgs'
+ '*:package:_portmaster_pkgs'
elif (( kid=$words[(I)-o] ));then
if (( CURRENT == $kid + 1 ));then
_arguments -s \
- '*:ports replacing:_portmaster_ports'
+ '*:replacement port:_portmaster_ports'
elif (( CURRENT == $kid + 2 )); then
_arguments -s \
- '*:package to replace:_portmaster_pkgs'
+ '*:package to replace:_portmaster_pkgs'
else
return 0
fi
@@ -102,7 +102,7 @@ _portmaster() {
else
_arguments -s \
$common_args \
- '*:packages and ports:_portmaster_pkgs_and_ports'
+ '*:package or port:_portmaster_pkgs_and_ports'
fi
;;
esac
diff --git a/Completion/BSD/Command/_rcctl b/Completion/BSD/Command/_rcctl
index 62cb8f634..6cfebf420 100644
--- a/Completion/BSD/Command/_rcctl
+++ b/Completion/BSD/Command/_rcctl
@@ -1,11 +1,20 @@
#compdef rcctl
local context state line
-local -a actions subcmds variables
+local -a actions lsarg subcmds variables
actions=(check reload restart start stop)
subcmds=(disable enable get getdef ls order set)
variables=(class flags status timeout user)
+lsarg=(
+ 'all:all services and daemons'
+ 'failed:enabled but stopped daemons'
+ 'off:disabled services and daemons'
+ 'on:enabled services and daemons'
+ 'rogue:daemons which are disabled but currently running'
+ 'started:running daemons'
+ 'stopped:stopped daemons'
+)
if [[ $service == "rcctl" ]]; then
_arguments -C \
@@ -23,11 +32,11 @@ case $service in
':variable:compadd -a variables'
;;
ls)
- _arguments ':display a list of services and daemons matching:(all failed off on started stopped)'
+ _arguments ':display a list of services and daemons matching:(($lsarg))'
;;
order)
_arguments \
- ':service to start first:_services'
+ ':service to start first:_services' \
'*:service to start next:_services'
;;
set)
diff --git a/Completion/BSD/Command/_signify b/Completion/BSD/Command/_signify
index 6a786e2e1..91e97e811 100644
--- a/Completion/BSD/Command/_signify
+++ b/Completion/BSD/Command/_signify
@@ -5,6 +5,7 @@ _arguments -s -S -A "-*" : \
'-C[verify a signed checksum list and the checksum for each file]' \
'-p+[public key]:public key:_files' \
'-q[quiet mode]' \
+ '-t+[specify key type]:key type' \
'-x+[specify signature file]:signature file:_files' \
'*:file:_files' \
- generate \
diff --git a/Completion/BSD/Command/_sysclean b/Completion/BSD/Command/_sysclean
new file mode 100644
index 000000000..755861644
--- /dev/null
+++ b/Completion/BSD/Command/_sysclean
@@ -0,0 +1,6 @@
+#compdef sysclean
+
+_arguments -s : \
+ '(-p)-a[include filenames used by installed packages]' \
+ '-i[include ignored filenames]' \
+ '(-a)-p[output package names that are using obsolete files]'
diff --git a/Completion/BSD/Command/_sysmerge b/Completion/BSD/Command/_sysmerge
new file mode 100644
index 000000000..00ee18299
--- /dev/null
+++ b/Completion/BSD/Command/_sysmerge
@@ -0,0 +1,6 @@
+#compdef sysmerge
+
+_arguments -s : \
+ '-b[run non-interactively]' \
+ '-d[do not take any automatic action]' \
+ '-p[only compare configuration of packages]'
diff --git a/Completion/BSD/Command/_syspatch b/Completion/BSD/Command/_syspatch
new file mode 100644
index 000000000..850636d09
--- /dev/null
+++ b/Completion/BSD/Command/_syspatch
@@ -0,0 +1,7 @@
+#compdef syspatch
+
+_arguments \
+ '( -l -R -r)-c[list available patches]' \
+ '(-c -R -r)-l[list installed patches]' \
+ '(-c -l -r)-R[revert all patches]' \
+ '(-c -l -R )-r[revert the most recently installed patch]'
diff --git a/Completion/BSD/Command/_sysrc b/Completion/BSD/Command/_sysrc
index f0c12a2be..892dac407 100644
--- a/Completion/BSD/Command/_sysrc
+++ b/Completion/BSD/Command/_sysrc
@@ -29,7 +29,7 @@ _sysrc() {
'(- *)-h[print short usage message]' \
'(- *)--help[print full usage message]' \
'-i[ignore unknown variables]' \
- '-j+[jail to operate within]:jails:_jails' \
+ '-j+[jail to operate within]:jail:_jails' \
'-n[print only variable values]' \
'-N[print only variable names]' \
'-R+[specify an alternative root]:alternative root:_files -/' \
diff --git a/Completion/BSD/Command/_systat b/Completion/BSD/Command/_systat
index 73533e864..03df07631 100644
--- a/Completion/BSD/Command/_systat
+++ b/Completion/BSD/Command/_systat
@@ -45,6 +45,7 @@ case $OSTYPE in
'-B[raw, non-interactive mode (two screen updates)]'
'-b[raw, non-interactive mode (one screen update)]'
'-d[exit after `count'\'' updates]:count'
+ '-h[human readable output]'
'-i[interactive mode]'
'-N[resolve network addresses to names]'
'-n[do not resolve network addresses to names]'
@@ -74,15 +75,16 @@ case $OSTYPE in
opts=(
'-M[alternative source to extract values from]:core:_files'
'-N[alternative source to extract the name list from]:system:_files'
- '-n[do not resolve IP addresses]'
- '-w[refresh interval]:refresh interval'
- '-t[the amount of refreshes for each screen in '\''all'\'' display mode]:turns'
+ '(-t -w)-b[show the chosen display once and exit]'
+ "-n[don't resolve IP addresses]"
+ '(-b)-w[refresh interval]:refresh interval'
+ "(-b)-t[specify amount of refreshes for each screen in 'all' display mode]:turns"
)
esac
if (( $#screens )); then
_arguments -M 'r:|.=* r:|=*' : $opts \
- '1:systat(1) displays:(( ${pre}$^screens ))' \
+ '1:systat(1) display:(( ${pre}$^screens ))' \
'2:refresh interval'
return
fi
diff --git a/Completion/BSD/Command/_sysupgrade b/Completion/BSD/Command/_sysupgrade
new file mode 100644
index 000000000..b1144b0d5
--- /dev/null
+++ b/Completion/BSD/Command/_sysupgrade
@@ -0,0 +1,9 @@
+#compdef sysupgrade
+
+_arguments -s -S -A '-*' : \
+ '-f[force an already applied upgrade]' \
+ '-k[keep the downloaded files]' \
+ '-n[do not reboot]' \
+ '(-s)-r[upgrade to the next release]' \
+ '(-r)-s[upgrade to a snapshot]' \
+ ':installurl:'
diff --git a/Completion/BSD/Command/_usbconfig b/Completion/BSD/Command/_usbconfig
new file mode 100644
index 000000000..e7da8132c
--- /dev/null
+++ b/Completion/BSD/Command/_usbconfig
@@ -0,0 +1,63 @@
+#compdef usbconfig
+
+local curcontext="$curcontext" i ret=1
+local -a state line expl devices ids partial args
+
+_arguments -C \
+ '(-d)-u[limit device range to given USBUS unit]:bus:->buses' \
+ '(-d)-a[limit device range to given USB device index]:address:->addresses' \
+ '(-a -u)-d[limit device range to given unit and address]:device:->devices' \
+ '-i[specify interface index]:interface index' \
+ '(- 1)-h[display usage information]' \
+ '(-)1:command:compadd -M "r:|_=* r:|=*"
+ set_config set_alt set_template get_template add_dev_quirk_vplh
+ remove_dev_quirk_vplh add_quirk remove_quirk detach_kernel_driver
+ dump_quirk_names dump_device_quirks dump_all_desc dump_device_desc
+ dump_curr_config_desc dump_all_config_desc dump_string dump_info show_ifdrv
+ suspend resume power_off power_save power_on reset list do_request' \
+ '*::: := ->args' && ret=0
+
+case $state in
+ buses) partial=( ${(kv)=opt_args[(i)-a]:--a 1} ) i=1 ;|
+ addresses) partial=( ${(kv)opt_args[(i)-u]} ) i=2 ;&
+ buses)
+ devices=( ${${(f)"$(_call_program usb-devices usbconfig $partial list)"}:#No device*} )
+ ids=( ${${(MSI.i.)devices##[^0-9]<->}#?} )
+ _wanted usb-$state expl ${state%es} compadd -ld devices -o numeric -a ids && ret=0
+ ;;
+ devices)
+ devices=( ${${${(f)"$(_call_program usb-devices usbconfig list)"}/: /:}:#No device*} )
+ if (( $#devices )); then
+ _describe -t usb-devices device devices -M 'B:=ugen' && ret=0
+ else
+ _message -e usb-devices device
+ fi
+ ;;
+ args)
+ curcontext="${curcontext%:*}-$line[1]:"
+ case $line[1] in
+ set_config) args=( '1:cfg index' ) ;;
+ set_alt) args=( '1:alt index' ) ;;
+ set_template) args=( '1:template (see usb_template(4))' ) ;;
+ (add|remove)_dev_quirk_vplh) args=( -C
+ ':vendor id' ':product id' ':low revision'
+ ':high revision' ':quirk:->quirks'
+ ) ;;
+ (add|remove)_quirk) args=( -C '1:quirk:->quirks' ) ;;
+ dump_string) args=( '1:index' ) ;;
+ do_request) args=( :bmReqTyp :bReq :wVal :wIdx :wLen '*:data' ) ;;
+ esac
+ if (( $#args )); then
+ _arguments $args && ret=0
+ else
+ _message 'no more arguments'
+ fi
+ if [[ $state = quirks ]]; then
+ _wanted quirks expl quirk compadd \
+ -M 'm:{:lower:}={:upper:} r:|_=* r:|=* b:=UQ_' \
+ ${${(f)"$(_call_program quirks usbconfig dump_quirk_names)"}:#*list of*} && ret=0
+ fi
+ ;;
+esac
+
+return ret
diff --git a/Completion/BSD/Type/_ktrace_points b/Completion/BSD/Type/_ktrace_points
new file mode 100644
index 000000000..3068951fd
--- /dev/null
+++ b/Completion/BSD/Type/_ktrace_points
@@ -0,0 +1,50 @@
+#autoload
+
+local points=(
+ 'c[trace system calls]'
+ 'i[trace I/O]'
+ 'n[trace namei translations]'
+ 's[trace signal processing]'
+ 'u[trace user data]'
+ '+[trace the default points]'
+)
+
+case $OSTYPE in
+ dragonfly*|freebsd*|netbsd*)
+ points+=(
+ 'w[context switches]'
+ )
+ ;|
+ freebsd*|openbsd*)
+ points+=(
+ 't[trace various structures]'
+ )
+ ;|
+ freebsd*)
+ points+=(
+ 'f[trace page faults]'
+ 'p[trace capability check failures]'
+ 'y[trace sysctl(3) requests]'
+ )
+ ;;
+ netbsd*)
+ points+=(
+ 'A[trace all tracepoints]'
+ 'a[trace exec arguments]'
+ 'e[trace emulation changes]'
+ 'f[trace open file descriptors after exec]'
+ 'S[trace MIB access (sysctl)]'
+ 'v[trace exec environment]'
+ '-[do not trace following trace points]'
+ )
+ ;;
+ openbsd*)
+ points+=(
+ 'p[trace violation of pledge(2) restrictions]'
+ 'x[trace argument vector in execve(2)]'
+ 'X[trace environment in execve(2)]'
+ )
+ ;;
+esac
+
+_values -s '' 'ktrace point' $points
diff --git a/Completion/BSD/Type/_login_classes b/Completion/BSD/Type/_login_classes
new file mode 100644
index 000000000..a2e6983a9
--- /dev/null
+++ b/Completion/BSD/Type/_login_classes
@@ -0,0 +1,11 @@
+#autoload
+
+local expl login_classes
+
+login_classes=(${${(M)${(f)"$(</etc/login.conf)"}:#[^#[:blank:]]*}%%[:|]*})
+if [[ $OSTYPE = openbsd* ]]; then
+ login_classes+=(/etc/login.conf.d/*(N:t))
+fi
+
+_description login-classes expl 'login class'
+compadd "$@" "$expl[@]" - $login_classes
diff --git a/Completion/BSD/Type/_obsd_architectures b/Completion/BSD/Type/_obsd_architectures
index ca3e0e12f..cec000a08 100644
--- a/Completion/BSD/Type/_obsd_architectures
+++ b/Completion/BSD/Type/_obsd_architectures
@@ -3,4 +3,4 @@
local expl
_description architectures expl 'architecture'
-compadd "$@" "$expl[@]" alpha amd64 arm64 armv7 hppa i386 landisk longson luna88k macppc octeon sgi sparc64
+compadd "$@" "$expl[@]" alpha amd64 arm64 armv7 hppa i386 landisk loongson luna88k macppc octeon sparc64
diff --git a/Completion/BSD/Type/_routing_domains b/Completion/BSD/Type/_routing_domains
new file mode 100644
index 000000000..4bb9f78b0
--- /dev/null
+++ b/Completion/BSD/Type/_routing_domains
@@ -0,0 +1,6 @@
+#autoload
+
+local expl
+
+_description routing-domains expl 'routing domain'
+compadd "$@" "$expl[@]" - ${${(M)${(f)"$(_call_program routing-domains netstat -R)"}:#Rdomain *}#Rdomain }
diff --git a/Completion/BSD/Type/_routing_tables b/Completion/BSD/Type/_routing_tables
new file mode 100644
index 000000000..3ba1931fe
--- /dev/null
+++ b/Completion/BSD/Type/_routing_tables
@@ -0,0 +1,6 @@
+#autoload
+
+local expl
+
+_description routing-tables expl 'routing table'
+compadd "$@" "$expl[@]" - ${(s: :)${${(M)${(f)"$(_call_program routing-tables netstat -R)"}:# Routing tables#: *}#*: }}
diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand
index def522a76..e5e4f9b39 100644
--- a/Completion/Base/Completer/_expand
+++ b/Completion/Base/Completer/_expand
@@ -11,7 +11,7 @@ setopt localoptions nonomatch
[[ _matcher_num -gt 1 ]] && return 1
-local exp word sort expr expl subd suf=" " force opt asp tmp opre pre epre
+local exp word sort expr expl subd pref suf=" " force opt asp tmp opre pre epre
local continue=0
(( $# )) &&
@@ -105,7 +105,7 @@ subd=("$exp[@]")
# We need to come out of this with consistent quoting, by hook or by crook.
integer done_quote
-local orig_exp=$exp
+local -a orig_exp=( $exp )
if [[ "$force" = *g* ]] || zstyle -T ":completion:${curcontext}:" glob; then
eval 'exp=( ${~exp//(#b)\\([ \"'"\'"'
])/$match[1]} ); exp=( ${(q)exp} )' 2>/dev/null && (( $#exp )) && done_quote=1
@@ -214,9 +214,10 @@ else
normal=( "$normal[@]" "$i" )
fi
done
- (( $#dir )) && compadd "$expl[@]" -UQ -qS/ -a dir
- (( $#space )) && compadd "$expl[@]" -UQ -qS " " -a space
- (( $#normal )) && compadd "$expl[@]" -UQ -qS "" -a normal
+ pref="${${word:#[~/]*}:+$PWD}/"
+ (( $#dir )) && compadd "$expl[@]" -fW "$pref" -UQ -qS/ -a dir
+ (( $#space )) && compadd "$expl[@]" -fW "$pref" -UQ -qS " " -a space
+ (( $#normal )) && compadd "$expl[@]" -fW "$pref" -UQ -qS "" -a normal
fi
if _requested all-expansions; then
local disp dstr
diff --git a/Completion/Base/Core/_description b/Completion/Base/Core/_description
index bdb4007a6..368b41ee2 100644
--- a/Completion/Base/Core/_description
+++ b/Completion/Base/Core/_description
@@ -2,6 +2,7 @@
local name nopt xopt format gname hidden hide match opts tag
local -a ign gropt sort
+local -a match mbegin mend
opts=()
@@ -78,7 +79,14 @@ shift 2
if [[ -z "$1" && $# -eq 1 ]]; then
format=
elif [[ -n "$format" ]]; then
- zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
+ if [[ -z $2 ]]; then
+ argv+=( h:${1%%( ##\((#b)([^\)]#[^0-9-][^\)]#)(#B)\)|)( ##\((#b)([0-9-]##)(#B)\)|)( ##\[(#b)([^\]]##)(#B)\]|)} )
+ [[ -n $match[1] ]] && argv+=( m:$match[1] )
+ [[ -n $match[2] ]] && argv+=( r:$match[2] )
+ [[ -n $match[3] ]] && argv+=( o:$match[3] )
+ fi
+
+ zformat -F format "$format" "d:$1" "${(@)argv[2,-1]}"
fi
if [[ -n "$gname" ]]; then
diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete
index 6b2cf2bcf..169ca1f40 100644
--- a/Completion/Base/Core/_main_complete
+++ b/Completion/Base/Core/_main_complete
@@ -94,8 +94,18 @@ if [[ -z "$compstate[quote]" ]]; then
if [[ -o equals ]] && compset -P 1 '='; then
compstate[context]=equal
elif [[ "$PREFIX" != */* && "$PREFIX[1]" = '~' ]]; then
- compset -p 1
- compstate[context]=tilde
+ if [[ "$PREFIX" = '~['[^\]]# ]]; then
+ # Inside ~[...] should be treated as a subscript.
+ compset -p 2
+ # To be consistent, we ignore all but the contents of the square
+ # brackets.
+ compset -S '\]*'
+ compstate[context]=subscript
+ [[ -n $_comps[-subscript-] ]] && $_comps[-subscript-] && return
+ else
+ compset -p 1
+ compstate[context]=tilde
+ fi
fi
fi
@@ -234,7 +244,7 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then
_menu_style=( "$_menu_style[@]" "$_def_menu_style[@]" )
- if [[ "$compstate[list]" = *list && tmp -gt LINES &&
+ if [[ "$compstate[list]" = *list(| *) && tmp -gt LINES &&
( -n "$_menu_style[(r)select=long-list]" ||
-n "$_menu_style[(r)(yes|true|on|1)=long-list]" ) ]]; then
compstate[insert]=menu
diff --git a/Completion/Base/Core/_message b/Completion/Base/Core/_message
index 4d5645eaf..dbeed4a88 100644
--- a/Completion/Base/Core/_message
+++ b/Completion/Base/Core/_message
@@ -39,7 +39,7 @@ else
fi
if [[ -n "$format$raw" ]]; then
- [[ -z "$raw" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
+ [[ -z "$raw" ]] && zformat -F format "$format" "d:$1" "${(@)argv[2,-1]}"
builtin compadd "$gopt[@]" -x "$format"
_comp_mesg=yes
fi
diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments
index 136dd5826..5ff34ff47 100644
--- a/Completion/Base/Utility/_arguments
+++ b/Completion/Base/Utility/_arguments
@@ -7,11 +7,13 @@ local long cmd="$words[1]" descr odescr mesg subopts opt opt2 usecc autod
local oldcontext="$curcontext" hasopts rawret optarg singopt alwopt
local setnormarg start rest
local -a match mbegin mend
+integer opt_args_use_NUL_separators=0
subopts=()
singopt=()
-while [[ "$1" = -([AMO]*|[CRSWnsw]) ]]; do
+while [[ "$1" = -([AMO]*|[0CRSWnsw]) ]]; do
case "$1" in
+ -0) opt_args_use_NUL_separators=1; shift ;;
-C) usecc=yes; shift ;;
-O) subopts=( "${(@P)2}" ); shift 2 ;;
-O*) subopts=( "${(@P)${1[3,-1]}}" ); shift ;;
@@ -130,8 +132,8 @@ if (( long )); then
# variant syntax seen in fetchmail:
# --[fetch]all means --fetchall or --all.
# maybe needs to be more general
- if [[ $start = (#b)(*)\[(*)\](*) ]]; then
- tmp+=("${match[1]}${match[2]}${match[3]}" "${match[1]}${match[3]}")
+ if [[ $start = (#b)--\[(*)\](*) ]]; then
+ tmp+=("--${match[1]}${match[2]}" "--${match[2]}")
else
tmp+=($start)
fi
@@ -388,7 +390,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
if [[ "$action" = -\>* ]]; then
action="${${action[3,-1]##[ ]#}%%[ ]#}"
if (( ! $state[(I)$action] )); then
- comparguments -W line opt_args
+ comparguments -W line opt_args $opt_args_use_NUL_separators
state+=( "$action" )
state_descr+=( "$descr" )
if [[ -n "$usecc" ]]; then
@@ -406,7 +408,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
local=yes
fi
- comparguments -W line opt_args
+ comparguments -W line opt_args $opt_args_use_NUL_separators
if [[ "$action" = \ # ]]; then
@@ -511,8 +513,8 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
_describe -O option \
- tmp1 tmp2 -Q -S '' -- \
- tmp3 -Q
+ tmp1 tmp2 -S '' -- \
+ tmp3
[[ -n "$optarg" && "$single" = next && nm -eq $compstate[nmatches] ]] &&
_all_labels options expl option \
@@ -523,9 +525,9 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
else
next+=( "$odirect[@]" )
_describe -O option \
- next -Q -M "$matcher" -- \
- direct -QS '' -M "$matcher" -- \
- equal -QqS= -M "$matcher"
+ next -M "$matcher" -- \
+ direct -S '' -M "$matcher" -- \
+ equal -qS= -M "$matcher"
fi
PREFIX="$prevpre"
IPREFIX="$previpre"
diff --git a/Completion/Base/Utility/_call_program b/Completion/Base/Utility/_call_program
index 73f3ef6d2..55712b04b 100644
--- a/Completion/Base/Utility/_call_program
+++ b/Completion/Base/Utility/_call_program
@@ -1,5 +1,6 @@
#autoload +X
+local -xi COLUMNS=999
local curcontext="${curcontext}" tmp err_fd=-1 clocale='_comp_locale;'
local -a prefix
diff --git a/Completion/Base/Utility/_numbers b/Completion/Base/Utility/_numbers
new file mode 100644
index 000000000..97bb8b4c8
--- /dev/null
+++ b/Completion/Base/Utility/_numbers
@@ -0,0 +1,87 @@
+#autoload
+
+# Usage: _numbers [compadd options] [-t tag] [-f|-N] [-u units] [-l min] [-m max] \
+# [-d default] ["description"] [unit-suffix...]
+
+# -t : specify a tag (defaults to 'numbers')
+# -u : indicate the units, e.g. seconds
+# -l : lowest possible value
+# -m : maximum possible value
+# -d : default value
+# -N : allow negative numbers (implied by range including a negative)
+# -f : allow decimals (float)
+
+# For a unit-suffix, an initial colon indicates a unit that asserts the default
+# otherwise, colons allow for descriptions, e.g:
+
+# :s:seconds m:minutes h:hours
+
+# unit-suffixes are not sorted by the completion system when listed
+# Specify them in order of magnitude, this tends to be ascending unless
+# the default is of a higher magnitude, in which case, descending.
+# So for, example
+# bytes kB MB GB
+# s ms us ns
+# Where the compadd options include matching control or suffixes, these
+# are applied to the units
+
+# For each unit-suffix, the format style is looked up with the
+# unit-suffixes tag and the results concatenated. Specs used are:
+# x : the suffix
+# X : suffix description
+# d : indicate suffix is for the default unit
+# i : list index
+# r : reverse list index
+# The latter three of these are useful with ternary expressions.
+
+# _description is called with the x token set to make the completed
+# list of suffixes available to the normal format style
+
+local desc tag range suffixes suffix suffixfmt pat='<->' partial=''
+local -a expl formats
+local -a default max min keep tags units
+local -i i
+local -A opts
+
+zparseopts -K -D -A opts M+:=keep q:=keep s+:=keep S+:=keep J+: V+: 1 2 o+: n F: x+: X+: \
+ t:=tags u:=units l:=min m:=max d:=default f=type e=type N=type
+
+desc="${1:-number}" tag="${tags[2]:-numbers}"
+(( $# )) && shift
+
+[[ -n ${(M)type:#-f} ]] && pat='(<->.[0-9]#|[0-9]#.<->|<->)' partial='(|.)'
+[[ -n ${(M)type:#-N} || $min[2] = -* || $max[2] = -* ]] && \
+ pat="(|-)$pat" partial="(|-)$partial"
+
+if (( $#argv )) && compset -P "$pat"; then
+ zstyle -s ":completion:${curcontext}:units" list-separator sep || sep=--
+ _description -V units expl unit
+ disp=( ${${argv#:}/:/ $sep } )
+ compadd -M 'r:|/=* r:|=*' -d disp "$keep[@]" "$expl[@]" - ${${argv#:}%%:*}
+ return
+elif [[ -prefix $~pat || $PREFIX = $~partial ]]; then
+ formats=( "h:$desc" )
+ (( $#units )) && formats+=( m:${units[2]} ) desc+=" ($units[2])"
+ (( $#min )) && range="$min[2]-"
+ (( $#max )) && range="${range:--}$max[2]"
+ [[ -n $range ]] && formats+=( r:$range ) desc+=" ($range)"
+ (( $#default )) && formats+=( o:${default[2]} ) desc+=" [$default[2]]"
+
+ zstyle -s ":completion:${curcontext}:unit-suffixes" format suffixfmt || \
+ suffixfmt='%(d.%U.)%x%(d.%u.)%(r..|)'
+ for ((i=0;i<$#;i++)); do
+ zformat -f suffix "$suffixfmt" "x:${${argv[i+1]#:}%%:*}" \
+ "X:${${argv[i+1]#:}#*:}" "d:${#${argv[i+1]}[1]#:}" \
+ i:i r:$(( $# - i - 1))
+ suffixes+="$suffix"
+ done
+ [[ -n $suffixes ]] && formats+=( x:$suffixes )
+
+ _comp_mesg=yes
+ _description -x $tag expl "$desc" $formats
+ [[ $compstate[insert] = *unambiguous* ]] && compstate[insert]=
+ compadd "$expl[@]"
+ return 0
+fi
+
+return 1
diff --git a/Completion/Base/Utility/_sequence b/Completion/Base/Utility/_sequence
index c1ff32184..1a87c1753 100644
--- a/Completion/Base/Utility/_sequence
+++ b/Completion/Base/Utility/_sequence
@@ -8,10 +8,10 @@
# -d : duplicate values allowed
local curcontext="$curcontext" nm="$compstate[nmatches]" pre qsep nosep minus
-local -a opts sep num pref suf cont end uniq dedup
+local -a opts sep num pref suf cont end uniq dedup garbage
zparseopts -D -a opts s:=sep n:=num p:=pref i:=pref P:=pref I:=suf S:=suf \
- q=suf r:=suf R:=suf C:=cont d=uniq M+: J+: V+: 1 2 o+: X+: x+:
+ q=suf r:=suf R:=suf C:=cont F:=garbage d=uniq M+: J+: V+: 1 2 o+: X+: x+:
(( $#cont )) && curcontext="${curcontext%:*}:$cont[2]"
(( $#sep )) || sep[2]=,
diff --git a/Completion/Base/Utility/_store_cache b/Completion/Base/Utility/_store_cache
index fb2ab328a..b08ff1142 100644
--- a/Completion/Base/Utility/_store_cache
+++ b/Completion/Base/Utility/_store_cache
@@ -2,7 +2,7 @@
#
# Storage component of completions caching layer
-local _cache_ident _cache_ident_dir
+local _cache_ident _cache_ident_dir _cache_dir
_cache_ident="$1"
if zstyle -t ":completion:${curcontext}:" use-cache; then
diff --git a/Completion/Base/Utility/_values b/Completion/Base/Utility/_values
index 6e38e00f4..688ada848 100644
--- a/Completion/Base/Utility/_values
+++ b/Completion/Base/Utility/_values
@@ -4,7 +4,7 @@ local subopts opt usecc garbage keep
subopts=()
zparseopts -D -a garbage s+:=keep S+:=keep w+=keep C=usecc O:=subopts \
- M: J: V: 1 2 n F: X:
+ M: J: V: 1 2 o+: n F: X:
(( $#subopts )) && subopts=( "${(@P)subopts[2]}" )
diff --git a/Completion/Base/Widget/_bash_completions b/Completion/Base/Widget/_bash_completions
index 7abb654d4..feb721451 100644
--- a/Completion/Base/Widget/_bash_completions
+++ b/Completion/Base/Widget/_bash_completions
@@ -32,7 +32,7 @@ local key=$KEYS[-1] expl
case $key in
'!') _main_complete _command_names
;;
- '$') _main_complete - parameters _wanted parameters expl 'exported parameters' \
+ '$') _main_complete - parameters _wanted parameters expl 'exported parameter' \
_parameters -g '*export*'
;;
'@') _main_complete _hosts
diff --git a/Completion/Base/Widget/_complete_debug b/Completion/Base/Widget/_complete_debug
index 85a0f372a..94fd4accd 100644
--- a/Completion/Base/Widget/_complete_debug
+++ b/Completion/Base/Widget/_complete_debug
@@ -14,7 +14,11 @@ integer debug_fd=-1
exec {debug_fd}>&2 2>| $tmp
fi
- local -a debug_indent; debug_indent=( '%'{3..20}'(e. .)' )
+ local -a debug_indent
+ () {
+ setopt localoptions no_ignorebraces
+ debug_indent=( '%'{3..20}'(e. .)' )
+ }
local PROMPT4 PS4="${(j::)debug_indent}+%N:%i> "
setopt xtrace
: $ZSH_NAME $ZSH_VERSION
diff --git a/Completion/Base/Widget/_complete_help b/Completion/Base/Widget/_complete_help
index 252b0e281..69855de9d 100644
--- a/Completion/Base/Widget/_complete_help
+++ b/Completion/Base/Widget/_complete_help
@@ -84,7 +84,7 @@ _help_sort_tags() {
[[ "$help_funcs[$curcontext]" != *${f}* ]] &&
help_funcs[$curcontext]+=$'\0'"${f}"
help_tags[${curcontext}${f}]+=",${argv}:${f}"
- comptry "$@"
+ comptry "$@" 2>/dev/null
fi
}
diff --git a/Completion/Base/Widget/_complete_tag b/Completion/Base/Widget/_complete_tag
index 5b50f1d85..397b8d901 100644
--- a/Completion/Base/Widget/_complete_tag
+++ b/Completion/Base/Widget/_complete_tag
@@ -50,13 +50,13 @@ if [[ -f $c_path$c_Tagsfile ]]; then
-e '/^[a-zA-Z_].*/p' $c_path$c_Tagsfile))
# c_tags_array=($(perl -ne '/([a-zA-Z_0-9]+)[ \t:;,\(]*\x7f/ &&
# print "$1\n"' $c_path$c_Tagsfile))
- _main_complete - '' _wanted etags expl 'emacs tags' \
+ _main_complete - '' _wanted etags expl 'emacs tag' \
compadd -a c_tags_array
elif [[ -f $c_path$c_tagsfile ]]; then
# tags doesn't have as much in, but the tag is easy to find.
# we can use awk here.
c_tags_array=($(awk '{ print $1 }' $c_path$c_tagsfile))
- _main_complete - '' _wanted vtags expl 'vi tags' compadd -a c_tags_array
+ _main_complete - '' _wanted vtags expl 'vi tag' compadd -a c_tags_array
else
return 1
fi
diff --git a/Completion/Cygwin/Command/_cygserver b/Completion/Cygwin/Command/_cygserver
index 1c2744c8f..392bf5cbd 100644
--- a/Completion/Cygwin/Command/_cygserver
+++ b/Completion/Cygwin/Command/_cygserver
@@ -3,14 +3,14 @@
# cygwin 1.5.25
_arguments -s -S \
- '(--config-file -f)'{-f,--config-file}'[use specified file as config file (default /etc/cygserver.conf)]:config file:_files -g "*.conf(-.)"' \
- '(--cleanup-threads -c)'{-c,--cleanup-threads}'[number of cleanup threads to use (default 2)]:number of threads:' \
+ '(--config-file -f)'{-f,--config-file}'[use specified config file]:config file [/etc/cygserver.conf]:_files -g "*.conf(-.)"' \
+ '(--cleanup-threads -c)'{-c,--cleanup-threads}'[number of cleanup threads to use]:number of threads [2]' \
'(--process-cache -p)'{-p,--process-cache}'[size of process cache]:cache size:' \
- '(--request-threads -r)'{-r,--request-threads}'[number of request threads to use (default 10)]:number of threads:' \
+ '(--request-threads -r)'{-r,--request-threads}'[number of request threads to use]:number of threads [10]' \
'(--debug -d)'{-d,--debug}'[log debug messages to stderr]' \
'(--stderr -e --no-stderr -E)'{-e,--stderr}'[log to stderr (default if stderr is a tty)]' \
'(--stderr -e --no-stderr -E)'{-E,--no-stderr}"[don't log to stderr (see -y, -Y options)]" \
- '(--log-level -l)'{-l,--log-level}'[verbosity of logging (1..7) (default 6)]:verbosity level:({1..7})' \
+ '(--log-level -l)'{-l,--log-level}'[specify log verbosity]:verbosity level [6]:({1..7})' \
'(--syslog -y --no-syslog -Y)'{-y,--syslog}'[log to syslog (default if stderr is no tty)]' \
'(--syslog -y --no-syslog -Y)'{-Y,--no-syslog}"[don't log to syslog (see -e, -E options)]" \
'(--no-sharedmem -m)'{-m,--no-sharedmem}"[don't start XSI Shared Memory support]" \
diff --git a/Completion/Darwin/Command/_defaults b/Completion/Darwin/Command/_defaults
index ca5d87e65..b05222af6 100644
--- a/Completion/Darwin/Command/_defaults
+++ b/Completion/Darwin/Command/_defaults
@@ -42,7 +42,7 @@ _defaults(){
_arguments \
"(1)-app:application:_mac_applications" \
"(-app)1:domain:_defaults_domains" \
- "2:keys:_defaults_keys"
+ "2:key:_defaults_keys"
;;
write)
_arguments \
diff --git a/Completion/Darwin/Command/_hdiutil b/Completion/Darwin/Command/_hdiutil
index c31808716..20e69cbc5 100644
--- a/Completion/Darwin/Command/_hdiutil
+++ b/Completion/Darwin/Command/_hdiutil
@@ -10,7 +10,7 @@ _hdiutil_disk() {
disk_desc+=( "$disk_name:${${(M)REPLY% *}#?}" )
fi
done
- _describe -t devices disks disk_desc
+ _describe -t devices disk disk_desc
}
_hdiutil_device() {
@@ -46,28 +46,40 @@ _hdiutil_imagesize(){
}
_hdiutil_imageformat(){
- local -a fmts
+ local -a fmts ofmts
fmts=(
"UDRW:UDIF read/write image"
"UDRO:UDIF read-only image"
- "UDZO:UDIF zlib-compressed image"
"UDCO:UDIF ADC-compressed image"
- "UFBI:UDIF entire image with MD5 checksum"
+ "UDZO:UDIF zlib-compressed image"
+ "ULFO:UDIF lzfse-compressed image"
+ "ULMO:UDIF lzma-compressed image"
+ "UDBZ:UDIF bzip2-compressed image"
"UDTO:DVD/CD-R master for export"
- "UDxx:UDIF stub image"
- "UDSP:SPARSE (growable with content)"
- "Rdxx:NDIF read-only image (Disk Copy 6.3.3 format)"
- "DC42:Disk Copy 4.2 image"
+ "UDSP:SPARSE (grows with content)"
+ "UDSB:SPARSEBUNDLE (grows with content; bundle-backed)"
+ "UFBI:UDIF entire image with MD5 checksum"
)
ofmts=(
"UDRo:UDIF read-only"
"UDCo:UDIF compressed"
"RdWr:NDIF read/write image"
+ "Rdxx:NDIF read-only image (Disk Copy 6.3.3 format)"
"ROCo:NDIF compressed image"
"Rken:NDIF compressed"
+ "DC42:Disk Copy 4.2 image"
+ "IPOD:iPod image" # Mentioned in help, not manual
+ "UDxx:UDIF stub image" # Mentioned in help, not manual
+ "UNIV:hybrid image (HFS+/ISO/UDF)" # Mentioned in help, not manual
)
_describe -t types "image format" fmts -V1 ||
- _describe -t types "obsolete/deprecated image format" ofmts -V1
+ _describe -t types "obsolete/deprecated image format" ofmts -V1
+}
+
+_hdiutil_images() {
+ local -a expl
+ _description files expl 'disk image'
+ _files "$@" "${(@)expl}" -g '*.(bin|cdr|dmg|img|iso|sparse(bundle|image))(-.)'
}
_hdiutil(){
@@ -131,7 +143,7 @@ _hdiutil(){
_arguments -C '*:: :->subcmds'
if (( CURRENT == 1 )); then
- _describe -t commands "hdiutil subcommands" _1st_arguments
+ _describe -t commands "hdiutil subcommand" _1st_arguments
return
fi
@@ -178,7 +190,7 @@ _hdiutil(){
"(-autoopenro)-noautoopenro" \
"(-noautoopenrw)-autoopenrw[auto-open read/write volumes]" \
"(-autoopenrw)-noautoopenrw" \
- "1:disk image to attach:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1:disk image to attach:_hdiutil_images" \
&& return 0
;;
detach|eject)
@@ -195,7 +207,7 @@ _hdiutil(){
"$_common_usage_options[-imagekey]" \
"$_common_usage_options[-srcimagekey]" \
"$_common_usage_options[-plist]" \
- "1:disk image to verify:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1:disk image to verify:_hdiutil_images" \
&& return 0
;;
create)
@@ -214,8 +226,26 @@ _hdiutil(){
"($size_spec)-srcfolder[specify directory]: :_directories" \
"($size_spec)-srcdir[specify directory]: :_directories" \
"-align[size to which partition is aligned]:size" \
- "-type[image type]:image type:(UDIF SPARSE)" \
- "-fs[filesystem to make]:filesystem:(HFS+ HFS+J HFSX HFS MS-DOS UFS)" \
+ "-type[image type]:image type:((
+ SPARSEBUNDLE\:'sparse bundle disk image'
+ SPARSE\:'sparse disk image'
+ UDIF\:'read/write disk image'
+ UDTO\:'DVD/CD master'
+ ))" \
+ "-fs[filesystem to make]:filesystem:((
+ UDF\:'Universal Disk Format'
+ MS-DOS\ FAT12\:'MS-DOS (FAT12)'
+ MS-DOS\:'MS-DOS (FAT)'
+ MS-DOS\ FAT16\:'MS-DOS (FAT16)'
+ {FAT32,MS-DOS\ FAT32}\:'MS-DOS (FAT32)'
+ ExFAT\:'ExFAT'
+ HFS+\:'Mac OS Extended'
+ {HFS+J,JHFS+,HFSJ,Journaled\ HFS+}\:'Mac OS Extended (journaled)'
+ {HFS+X,HFSX,Case-sensitive\ HFS+}\:'Mac OS Extended (case-sensitive)'
+ {JHFS+X,JHFSX,HFS+X+J,HFS+XJ,HFSXJ,Case-sensitive\ Journaled\ HFS+}\:'Mac OS Extended (case-sensitive, journaled)'
+ APFS\:'APFS'
+ Case-sensitive\ APFS\:'APFS (case-sensitive)'
+ ))" \
"-volname[volume name]:name" \
"-uid[uid of root directory]:uid in number" \
"-gid[gid of root directory]:gid in number" \
@@ -225,7 +255,16 @@ _hdiutil(){
"(-autostretch)-noautostretch" \
"-stretch[max_stretch]: :_hdiutil_imagesize" \
"-fsargs[additional arguments to pass to newfs]:arguments" \
- "-layout[partition layout]:partition layout:(NONE SPUD UNIVERSAL\ CD UNIVERSAL\ HD)" \
+ "-layout[partition layout]:partition layout:((
+ MBRSPUD\:'single partition, MBR'
+ SPUD\:'single partition, APM'
+ UNIVERSAL\ CD\:'CD/DVD'
+ NONE\:'no partition map'
+ GPTSPUD\:'single partition, GPT'
+ SPCD\:'single partition, CD/DVD'
+ UNIVERSAL\ HD\:'hard disk'
+ ISOCD\:'single partition, CD/DVD with ISO data'
+ ))" \
"-partitionType[partition type]:partition type:(Apple_HFS Apple_UFS)" \
"-ov[overwrite an existing file]" \
"-attach[attach the image after creating it]" \
@@ -265,7 +304,7 @@ _hdiutil(){
"-ov[overwrite an existing file]" \
"-format:format:_hdiutil_imageformat" \
"-o:target disk image:_files" \
- "1:source disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1:source disk image:_hdiutil_images" \
&& return 0
if [[ $state = keyvalue ]]; then
@@ -302,7 +341,7 @@ _hdiutil(){
"-erase[erase the media]" \
"-fullerase[erase all sectors of the disc]" \
"-list[list all burning devices with paths suitable for -device]" \
- "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1: :_hdiutil_images" \
&& return 0
;;
makehybrid)
@@ -343,7 +382,7 @@ _hdiutil(){
"(-nokernel)-nokernel[attach with a helper process]" \
"(-kernel)-kernel[attach without a helper process]" \
"-o:target disk image:_files" \
- "1:source disk image or directory:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1:source disk image or directory:_hdiutil_images" \
&& return 0
;;
compact)
@@ -376,7 +415,7 @@ _hdiutil(){
"$_common_usage_options[-cacert]" \
"$_common_usage_options[-plist]" \
"-type:image type:(UDIF-CRC32 UDIF-MD5 DC42 CRC28 CRC32 MD5)" \
- "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1: :_hdiutil_images" \
&& return 0
;;
chpass)
@@ -386,7 +425,7 @@ _hdiutil(){
"$_common_usage_options[-srcimagekey]" \
"-oldstdinpass[specify old password from standard input]" \
"-newstdinpass[specify new password from standard input]" \
- "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1: :_hdiutil_images" \
&& return 0
;;
unflatten)
@@ -395,7 +434,7 @@ _hdiutil(){
"$_common_usage_options[-encryption]" \
"$_common_usage_options[-stdinpass]" \
"$_common_usage_options[-srcimagekey]" \
- "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1: :_hdiutil_images" \
&& return 0
;;
flatten)
@@ -408,7 +447,7 @@ _hdiutil(){
"(-noxml)-xml" \
"(-rsrcfork)-norsrcfork[don\'t embed resource fork data]" \
"(-norsrcfork)-rsrcfork" \
- "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1: :_hdiutil_images" \
&& return 0
;;
hfsanalyze)
@@ -420,7 +459,7 @@ _hdiutil(){
"$_common_usage_options[-shadow]" \
"$_common_usage_options[-insecurehttp]" \
"$_common_usage_options[-cacert]" \
- "1:disk image or device:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1:disk image or device:_hdiutil_images" \
&& return 0
;;
mountvol)
@@ -447,7 +486,7 @@ _hdiutil(){
"$_common_usage_options[-plist]" \
"-format[just print out the image format]" \
"-checksum[just print out the image checksum]" \
- "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1: :_hdiutil_images" \
&& return 0
;;
plugins)
@@ -462,7 +501,7 @@ _hdiutil(){
"$_common_usage_options[-srcimagekey]" \
"$_common_usage_options[-plist]" \
"(-yes -no -query)"{-yes,-no,-query} \
- "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1: :_hdiutil_images" \
&& return 0
;;
@@ -514,7 +553,7 @@ _hdiutil(){
"$_common_usage_options[-insecurehttp]" \
"$_common_usage_options[-cacert]" \
"-options[just print out the image checksum]: :->option" \
- "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \
+ "1: :_hdiutil_images" \
&& return 0
case "$state" in
diff --git a/Completion/Darwin/Command/_qtplay b/Completion/Darwin/Command/_qtplay
index 39a7c6de2..839efee83 100644
--- a/Completion/Darwin/Command/_qtplay
+++ b/Completion/Darwin/Command/_qtplay
@@ -15,6 +15,6 @@ _arguments -S \
'-t[specify update time]:update time (seconds)' \
'-T[kill time]:ticks' \
'-V[volume]:percentage of normal volume' \
- '(-)'{-?,--help,-h}'[display help information]' \
+ '(-)'{-\?,--help,-h}'[display help information]' \
'(-)*:quicktime file:_files'
diff --git a/Completion/Darwin/Command/_softwareupdate b/Completion/Darwin/Command/_softwareupdate
index 6db577b06..6054fd768 100644
--- a/Completion/Darwin/Command/_softwareupdate
+++ b/Completion/Darwin/Command/_softwareupdate
@@ -55,7 +55,7 @@ _softwareupdate() {
ignored_subcmd=(add remove)
if (( CURRENT == 1 )); then
- _describe -t commands "subcommands" ignored_subcmd && return 0
+ _describe -t commands "subcommand" ignored_subcmd && return 0
fi
case $words[1] in
add)
diff --git a/Completion/Darwin/Type/_retrieve_mac_apps b/Completion/Darwin/Type/_retrieve_mac_apps
index f24d36c3c..655170d3a 100644
--- a/Completion/Darwin/Type/_retrieve_mac_apps
+++ b/Completion/Darwin/Type/_retrieve_mac_apps
@@ -73,7 +73,7 @@ _retrieve_mac_apps() {
typeset retrieve
if ! zstyle -s ":completion:*:*:${service}:commands" search-method retrieve
then
- if [[ -d /.Spotlight-V100 ]]; then
+ if [[ "$( command mdutil -s / 2>&1 )" == *enabled* ]]; then
# / is indexed to use Spotlight
retrieve=_mac_apps_spotlight_retrieve
else
@@ -88,7 +88,10 @@ _retrieve_mac_apps() {
if ! zstyle -a ":completion:${curcontext}:" application-path app_dir_root
then
if [[ $retrieve = _mac_apps_old_retrieve ]]; then
- app_dir_root=( {,/Developer,/Network,"$HOME"}/{Applications*(N),Desktop} )
+ app_dir_root=(
+ {,/Developer,/Network,/System,$HOME}/{Applications*(N),Desktop}
+ )
+ app_dir_root=( $^app_dir_root(N) )
else
app_dir_root=( / )
fi
diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt
index 4d60cd249..494d3bf82 100644
--- a/Completion/Debian/Command/_apt
+++ b/Completion/Debian/Command/_apt
@@ -531,7 +531,7 @@ _apt-cache () {
--installed:bool \
-- \
/$'help\0'/ \| \
- /$'add\0'/ /$'[^\0]#\0'/ ':files:index files:_files' \# \| \
+ /$'add\0'/ /$'[^\0]#\0'/ ':files:index file:_files' \# \| \
/$'gencaches\0'/ \| \
/$'showpkg\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
/$'showsrc\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
diff --git a/Completion/Debian/Command/_aptitude b/Completion/Debian/Command/_aptitude
index bbaa8ebbd..5b10adb80 100644
--- a/Completion/Debian/Command/_aptitude
+++ b/Completion/Debian/Command/_aptitude
@@ -1,60 +1,32 @@
#compdef aptitude
-local curcontext="$curcontext" state line cmds ret=1
-
-function _aptitude_release() {
- #{{{
- local expl releases
- releases=(
-${${(M)${(f)"$(</etc/apt/sources.list)"}\
-:#[ $'\t']#deb(|-src)*}/(#b)[ $'\t']#[^ $'\t']##[ $'\t']##[^ $'\t']##[ $'\t']##([^ $'\t']##)*/$match[1]}
- )
- _wanted list expl release compadd ${expl} - ${(u)releases}
- #}}}
-}
-
-# Helper function for -F / --display-format
-function _aptitude_format_strings() {
- _values -s , 'format string' \
- '%%[Literal %]' \
- '%#number[Parameter replacement]' \
- '%a[Action flag]' \
- '%A[Action]' \
- '%B[Broken count]' \
- '%c[Current state flag]' \
- '%C[Current state]' \
- '%d[Description]' \
- '%H[Hostname]' \
- '%i[Pin priority]' \
- '%I[Installed size]' \
- '%m[Maintainer]' \
- '%M[Automatic flag]' \
- '%n[Program version]' \
- '%N[Program name]' \
- '%o[Download size]' \
- '%p[Package name]' \
- '%P[Priority]' \
- '%r[Reverse depends count]' \
- '%R[Abbreviated priority]' \
- '%s[Section]' \
- '%S[Trust status]' \
- '%t[Archive]' \
- '%T[Tagged]' \
- '%u[Disk usage change]' \
- '%v[Current version]' \
- '%V[Candidate version]' \
- '%Z[Size change]'
-}
+local curcontext="$curcontext" sep ret=1
+local state line expl specs disp cmds suf
_arguments -C \
'(- 1 *)'{-h,--help}'[display help information]' \
'(- 1 *)--version[display version information]' \
+ '--add-user-tag=[add user tag to affected packages]:tag' \
+ '--add-user-tag-to=[add user tag to matching packages]:tag,pattern' \
+ '--allow-new-upgrades[install upgrades for packages regardless]' \
+ '(--no-new-installs)--allow-new-installs[allow the safe-upgrade command to install new packages]' \
+ '--allow-untrusted[install packages from untrusted sources without prompting]' \
+ '--disable-columns[output results without any special formatting]' \
+ '(-F --display-format)'{-F,--display-format}'[specify output format for search command]:format:->format-strings' \
+ '--group-by=[control how the versions command groups its output]:grouping:(archive auto none package source-package source-version)' \
+ '--log-file=[specify output log file]:file:_files' \
+ '*--log-level=[specify minimum message level to log]:level:compadd -o nosort off fatal error warn info debug trace' \
+ '--log-resolver[set some standard log levels related to the resolver]' \
+ '(--allow-new-installs)--no-new-installs[prevent safe-upgrade from installing any new packages]' \
+ '(--allow-new-upgrades)--no-new-upgrades[prevent safe-upgrade from upgrading packages regardless]' \
+ "--no-show-resolver-actions[don't display the actions performed by the “safe” resolver]" \
+ '(-O --sort)'{-O,--sort}'[specify sort order]:sort order:->orderings' \
+ '-o[set a configuration file option]:key=value' \
'(-s --simulate)'{-s,--simulate}'[print actions without performing them]' \
'(-d --download-only)'{-d,--download-only}"[just download packages - don\'t install]" \
'(-P --prompt)'{-P,--prompt}'[always display a prompt]' \
+ '--purge-unused[purge in addition to removing each package that is no longer required]' \
'(-y --assume-yes)'{-y,--assume-yes}'[assume yes answer to questions]' \
- '(-F --display-format)'{-F,--display-format}'[specify output format for search command]:format:_aptitude_format_strings' \
- '(-O --sort)'{-O,--sort}'[specify sort order]:sort order:()' \
'(-w --width)'{-w,--width}'[specify output width]:width' \
'-f[aggressively try to fix dependencies of broken packages]' \
'(-V --show-versions)'{-V,--show-versions}'[show which versions of packages will be installed]' \
@@ -65,25 +37,72 @@ _arguments -C \
'(--without-suggests)--with-suggests[install suggested packages when installing new packages]' \
'(-r --with-recommends)'{-r,--without-recommends}'[ignore recommended packages when installing new packages]' \
'(--with-suggests)--without-suggests[ignore suggested packages when installing new packages]' \
- '(-t --target-release)'{-t,--target-release}'[set the release from which packages should be installed]:release:_aptitude_release' \
+ '--remove-user-tag=[remove user tag from affected packages]:tag' \
+ '--remove-user-tag-from=[remove user tag from matching packages]:tag,pattern' \
+ '(-t --target-release)'{-t,--target-release}'[set the release from which packages should be installed]:release:->aptitude-releases' \
'(-q --quiet)'{-q=,--quiet=}'[less Output]:level' \
'--schedule-only[schedule operations to be performed in the future]' \
'--purge-unused[purge unused packages instead of removing]' \
'--visual-preview[start up the visual interface and display its preview screen]' \
'--full-resolver[attempts to resolve conflicts with a higher risk of breakage]' \
'--safe-resolver[attempts to resolve conflicts with a lower risk of breakage]' \
+ '--show-package-names[control when the versions command shows package names]:when:(always auto never)' \
+ '--show-summary=[summarize each dependency chain that the why command outputs]::mode:(no-summary first-package first-package-and-type all-packages all-packages-with-dep-versions)' \
+ '(-W --show-why)'{-W,--show-why}'[show which manually installed package requires each automatically installed package]' \
'-S[load the extended state information from non-standard state file]:state file:_files' \
'-u[begin updating the package lists as soon as the program starts]' \
'-i[displays a download preview when the program starts]' \
+ '-Z[show how much disk space will be used or freed by the individual packages]' \
'1: :->cmds' \
'*: :->args' && ret=0
case $state in
+ aptitude-releases)
+ releases=(
+ ${${(M)${(f)"$(</etc/apt/sources.list)"}\
+:#[ $'\t']#deb(|-src)*}/(#b)[ $'\t']#[^ $'\t']##[ $'\t']##[^ $'\t']##[ $'\t']##([^ $'\t']##)*/$match[1]}
+ )
+ _description releases expl release
+ compadd "$expl[@]" -a releases && ret=0
+ ;;
cmds)
cmds=( ${${(M)${(f)"$(_call_program commands aptitude -h 2>/dev/null)"}:# [^- ][^ ]## *}/(#b) ([^ ]##) ##(- )#([^- ]*)/$match[1]:$match[3]:l})
_describe -t commands 'aptitude command' cmds && ret=0
;;
+ format-strings)
+ compset -P '(%\#[0-9]|%[A-Za-z%]|[^%])#'
+ compset -S '*'
+ zstyle -s ":completion:${curcontext}:format-specifiers" list-separator sep || sep=--
+ specs=(
+ '%%:literal %' '%#:parameter replacement' '%a:action flag'
+ '%A:action' '%B:broken count' '%c:current state flag'
+ '%C:current state' '%d:description' '%D:package size'
+ '%E:architecture' '%H:hostname' '%i:pin priority'
+ '%I:installed size' '%m:maintainer' '%M:automatic flag'
+ '%n:program version' '%N:program name' '%o:download size'
+ '%O:origin' '%p:package name' '%P:priority'
+ '%r:reverse depends count' '%R:abbreviated priority' '%s:section'
+ '%S:trust status' '%t:archive' '%T:tagged'
+ '%u:disk usage change' '%v:current version' '%V:candidate version'
+ '%Z:size change'
+ )
+ zformat -a disp " $sep " $specs
+ _description format-specifiers expl 'format specifier'
+ compadd "$expl[@]" -S '' -d disp - ${specs%:*}
+ ;;
+ orderings)
+ line=( "${(@)${(@)${(@s.,.)PREFIX}#(\\|)\~}[1,-2]}" )
+ compset -P '*,'
+ compset -S ',*' || suf=( -qS , )
+ if ! compset -P '(\\|)~'; then
+ _description prefixes expl 'reverse order'
+ compadd "$expl[@]" -S '' \~ && ret=0
+ fi
+ _description sort-key expl 'order [name,version]'
+ compadd -F line "$expl[@]" $suf - installsize installsizechange debsize \
+ name priority version && ret=0
+ ;;
args)
case $line[1] in
search)
diff --git a/Completion/Debian/Command/_axi-cache b/Completion/Debian/Command/_axi-cache
index bdefdd979..5fd4c38f8 100644
--- a/Completion/Debian/Command/_axi-cache
+++ b/Completion/Debian/Command/_axi-cache
@@ -10,7 +10,7 @@ _arguments \
'*:args:->args' && return 0
if (( CURRENT == 2 )); then
- _wanted tag expl 'axi-cache commands' \
+ _wanted tag expl 'axi-cache command' \
compadd help search more last show again info \
rdetails depends madison policy showpkg showsrc
else
diff --git a/Completion/Debian/Command/_dak b/Completion/Debian/Command/_dak
index 086196c4a..9976c7371 100644
--- a/Completion/Debian/Command/_dak
+++ b/Completion/Debian/Command/_dak
@@ -27,7 +27,7 @@ case $cmd in
'(-G --greaterthan)'{-G,--greaterthan}
'(-r --regex)'{-r,--regex}
'(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable experimental'
- '(-S, --source-and-binary)'{-S,--source-and-binary}
+ '(-S --source-and-binary)'{-S,--source-and-binary}
'*:package:_deb_packages avail'
)
;;
@@ -75,7 +75,7 @@ case $cmd in
'(-p --partial)'{-p,--partial}'[do not affect override files]'
'(-R --rdep-check)'{-R,--rdep-check}'[check reverse dependencies]'
'(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable experimental'
- '(-S, --source-only)'{-S,--source-only}'[remove source only]'
+ '(-S --source-only)'{-S,--source-only}'[remove source only]'
'*:package:_deb_packages avail'
)
;;
@@ -155,10 +155,10 @@ case $cmd in
'(-c --component)'{-c,--component=}':component:(main contrib non-free)'
'(-s --suite)'{-s,--suite=}':suite:(oldstable stable testing unstable experimental)'
'(-t --type)'{-t,--type=}':type:(deb dsc udeb)'
- '(-a, --add)'{-a,--add}'[add overrides]'
- '(-S, --set)'{-S,--set}'[set overrides]'
- '(-l, --list)'{-l,--list}'[list overrides]'
- '(-q, --quiet)'{-q,--quiet}'[be less verbose]'
+ '(-a --add)'{-a,--add}'[add overrides]'
+ '(-S --set)'{-S,--set}'[set overrides]'
+ '(-l --list)'{-l,--list}'[list overrides]'
+ '(-q --quiet)'{-q,--quiet}'[be less verbose]'
)
;;
@@ -207,7 +207,7 @@ case $cmd in
(poolize)
args+=(
- '(-l --limit)'{-l,--limit=}'[only migrate amount of packages]:amount in kb:'
+ '(-l --limit)'{-l,--limit=}'[only migrate amount of packages]:amount (kb)'
'(-n --no-action)'{-n,--no-action}'[do not do anything]'
'(-v --verbose)'{-v,--verbose}'[explain what is being done]'
)
diff --git a/Completion/Debian/Command/_debsnap b/Completion/Debian/Command/_debsnap
new file mode 100644
index 000000000..b9393cac4
--- /dev/null
+++ b/Completion/Debian/Command/_debsnap
@@ -0,0 +1,77 @@
+#compdef debsnap
+
+# Based on debsnap from devscripts-2.20.3
+
+local context state state_descr line ret=1
+local -a expl
+typeset -A opt_args
+
+_arguments \
+ '(-d --destdir)'{-d+,--destdir=}'[set download directory]:download directory:_files -/' \
+ '(-f --force)'{-f,--force}'[allow non-empty destination directory]' \
+ '(-v --verbose)'{-v,--verbose}'[print configuration and report progress]' \
+ --list"[list versions; don't download]" \
+ --binary'[operate on binary packages (default: source packages)]' \
+ '*'{-a+,--architecture=}'[specify architectures to download]:architecture to download:_deb_architectures' \
+ --first='[download all versions newer than this]:version number (lower bound):->versions' \
+ --last='[download all versions older than this]:version number (upper bound):->versions' \
+ '(-)'{-h,--help}'[show usage information]' \
+ '(-)'--version'[show version number and license]' \
+ '1: :->package' \
+ '2:version number to download:->versions' \
+ && ret=0
+
+# -a implies --binary
+if (( ${+opt_args[-a]} || ${+opt_args[--architecture]} )); then
+ opt_args[--binary]=''
+fi
+
+case $state in
+ (package)
+ if (( ${+opt_args[--binary]} )); then
+ _description binary-packages expl 'binary package to download'
+ _deb_packages "${expl[@]}" avail && ret=0
+ else
+ _description source-packages expl 'source package to download'
+ _deb_packages "${expl[@]}" source && ret=0
+ fi
+ ;;
+ (versions)
+ local package=${(Q)line[1]}
+ if [[ -n $package ]]; then
+ # Compute the arguments to --list
+ local -a args
+ () {
+ local i j
+
+ # repeatable flags with arguments, where the values can't contain colons
+ for i in ${(k)opt_args[(I)(-a|--architecture)]}; do
+ for j in ${(@s.:.)opt_args[$i]}; do
+ [[ -n $j ]] || continue
+ args+=( $i $j )
+ done
+ done
+
+ # non-repeatable flags with arguments, where the values may contain colons
+ for i in ${(k)opt_args[(I)(--first|--last)]}; do
+ # Avoid spurious "No matches" results in 'debsnap --first 42.1 --last 42.<TAB>'.
+ [[ $context != option${i}-* ]] || continue
+
+ # Un-escape colons (epoch separators in the version number)
+ args+=( $i ${(Q)opt_args[$i]} )
+ done
+
+ # flags without arguments
+ args+=( ${(k)opt_args[(I)(--binary)]} )
+ }
+
+ local -a versions=( ${(Oaf)"$(_call_program versions debsnap --list ${args} -- ${line[1]})"} )
+ _description -V versions expl ${state_descr}
+ compadd "$@" "${expl[@]}" -a versions && ret=0
+ else
+ _message -- $state_descr && ret=0
+ fi
+ ;;
+esac
+
+return ret
diff --git a/Completion/Debian/Command/_dpkg b/Completion/Debian/Command/_dpkg
index 3477e6116..48ea2db97 100644
--- a/Completion/Debian/Command/_dpkg
+++ b/Completion/Debian/Command/_dpkg
@@ -86,7 +86,7 @@ _dpkg_deb_and_query_only_options=(
_dpkg_query_actions=(
'(--status -s)'{--status,-s}'[display package status]:*:packages:->status'
'(--print-avail -p)'{--print-avail,-p}'[display available details]:packages:_deb_packages avail'
- '(--listfiles, -L)'{--listfiles,-L}'[list owned files]:*:packages:->listfiles'
+ '(--listfiles -L)'{--listfiles,-L}'[list owned files]:*:packages:->listfiles'
'(--list -l)'{--list,-l}'[list packages]:*:packages:->list'
'(--search -S)'{--search,-S}'[search for file owner]:*:pattern:->search'
'--admindir=[data directory]:directory:_files -/'
diff --git a/Completion/Debian/Command/_dscverify b/Completion/Debian/Command/_dscverify
new file mode 100644
index 000000000..84b00e4e7
--- /dev/null
+++ b/Completion/Debian/Command/_dscverify
@@ -0,0 +1,26 @@
+#compdef dscverify
+
+# $ dscverify --version
+# This is dscverify, from the Debian devscripts package, version 2.20.2
+# ...
+
+local all_opts=(
+ '--help[show the help message and exit]'
+ '--version[show the version + copyright and exit]'
+ '--no-default-keyrings[do not check against the default keyrings]'
+ '*--keyring[add keyring to the list of keyrings used]:keyring:_files -g "*.(kbx|gpg)(-.)"'
+ '(--nosigcheck --no-sig-check -u)'{--nosigcheck,--no-sig-check,-u}"[don't verify the GPG signature]"
+ "--verbose[don't suppress GPG output]"
+ '*:dsc file:_files -g "*.(changes|dsc|buildinfo)(-.)"'
+)
+
+local first_only=(
+ '(--no-conf --noconf)'{--no-conf,--noconf}"[don't read the devscripts config file]"
+)
+
+if (( CURRENT == 2 )); then
+ all_opts+=( $first_only )
+fi
+
+_arguments \
+ "$all_opts[@]"
diff --git a/Completion/Debian/Command/_git-buildpackage b/Completion/Debian/Command/_git-buildpackage
index c38edc1cc..81bf7dac9 100644
--- a/Completion/Debian/Command/_git-buildpackage
+++ b/Completion/Debian/Command/_git-buildpackage
@@ -13,14 +13,14 @@ _arguments \
'--git-sign-tags[sign tags]' \
'--git-no-sign-tags[negates --git-sign-tags]' \
'--git-keyid=-[GPG keyid to sign tags with]:GPG key:' \
- '--git-debian-tag=-[format string for debian tags]:default is debian/%(version)s:' \
- '--git-upstream-tag=-[format string for upstream tags]:default is upstream/%(version)s:' \
+ '--git-debian-tag=-[format string for debian tags]:format string [debian/%%(version)s]' \
+ '--git-upstream-tag=-[format string for upstream tags]:format string [upstream/%%(version)s]' \
'--git-pristine-tar[use pristine-tar to create .orig.tar.gz]' \
'--git-no-pristine-tar[negates --git-pristine-tar]' \
'--git-force-create[force creation of orig.tar.gz]' \
'--git-no-create-orig[do not create orig.tar.gz]' \
'--git-tarball-dir=-[location to look for external tarballs]:tarball directory:_files -/' \
- '--git-compression=-[compression type]:compression:(auto gzip bzip2 lzma xz)' \
+ '--git-compression=-[compression type]:compression type [auto]:(auto gzip bzip2 lzma xz)' \
'--git-compression-level=-[set compression level]:level:(1 2 3 4 5 6 7 8 9)' \
'--git-upstream-branch=-[upstream branch]::' \
'--git-debian-branch=-[branch the Debian package is being developed on]::' \
diff --git a/Completion/Debian/Command/_lintian b/Completion/Debian/Command/_lintian
index 71e71ee3d..03491624f 100644
--- a/Completion/Debian/Command/_lintian
+++ b/Completion/Debian/Command/_lintian
@@ -8,8 +8,8 @@ case "$service" in
'(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-S,--setup-lab}'[setup or update the laboratory]' \
'(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-R,--remove-lab}'[remove the laboratory directory]' \
'(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-c,--check}'[run all checks over the specified packages]' \
- '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-C,--check-part}'[run only the specified checks]:checks:_values -s , "lintian checks" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \
- '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-X,--dont-check-part}'[run only the specified checks]:checks:_values -s , "lintian checks" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \
+ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-C,--check-part}'[run only the specified checks]: :_values -s , "lintian check" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \
+ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-X,--dont-check-part}'[run only the specified checks]: :_values -s , "lintian check" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \
'(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-u,--unpack}'[unpack up to unpack level]' \
'(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-r,--remove}'[clean packages up to current unpack level]' \
'(-h --help)'{-h,--help}'[help]' \
@@ -23,7 +23,7 @@ case "$service" in
'(-o --no-override)'{-o,--no-override}'[do not use the overrides file]' \
'--show-overrides[output tags that have been overridden]' \
'--color:when:(never always auto)' \
- '(-U --unpack-info)'{-U,--unpack-info}'[collect information]:info:_values -s , "collectibles" changelog-file copyright-file debfiles debian-readme diffstat doc-base-files file-info init.d md5sums menu-files objdump-info override-file scripts source-control-file' \
+ '(-U --unpack-info)'{-U,--unpack-info}'[collect information]:info:_values -s , "collectible" changelog-file copyright-file debfiles debian-readme diffstat doc-base-files file-info init.d md5sums menu-files objdump-info override-file scripts source-control-file' \
'(-m --md5sums)'{-m,--md5sums}'[check md5sums when processing a .changes file]' \
'--allow-root[override warning when run with superuser privileges]' \
'--cfg:config file:_files' \
diff --git a/Completion/Debian/Command/_madison b/Completion/Debian/Command/_madison
index 445b79a45..dfdf1b438 100644
--- a/Completion/Debian/Command/_madison
+++ b/Completion/Debian/Command/_madison
@@ -9,6 +9,6 @@ _arguments \
'(-h --help)'{-h,--help} \
'(-r --regex)'{-r,--regex} \
'(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable' \
- '(-S, --source-and-binary)'{-S,--source-and-binary} \
+ '(-S --source-and-binary)'{-S,--source-and-binary} \
'*:package:_deb_packages avail'
diff --git a/Completion/Debian/Command/_module-assistant b/Completion/Debian/Command/_module-assistant
index d75284954..b2c1e56ee 100644
--- a/Completion/Debian/Command/_module-assistant
+++ b/Completion/Debian/Command/_module-assistant
@@ -33,5 +33,5 @@ _arguments -A \
'(-k --kernel-dir)'{-k,--kernel-dir}'[list of kernel headers/source directories, comma separated]:list of dirs:_files -/' \
'(-t --text-mode)'{-t,--text-mode}'[no progress bars]' \
'1:list of commands:_values -s , subcommands "${_module_assistant_commands[@]}"' \
- '*:packages: compadd /usr/src/modass/var_cache_modass/*.avail_version(N:t:r) /var/cache/modass/*.avail_version(N:t:r)'
+ '*:package: compadd /usr/src/modass/var_cache_modass/*.avail_version(N:t:r) /var/cache/modass/*.avail_version(N:t:r)'
diff --git a/Completion/Linux/Command/_alsa-utils b/Completion/Linux/Command/_alsa-utils
index 91bb0b86c..dd5c26866 100644
--- a/Completion/Linux/Command/_alsa-utils
+++ b/Completion/Linux/Command/_alsa-utils
@@ -38,7 +38,7 @@ opts=(
--disable-format'[disable automatic format conversions]'
--disable-softvol'[disable software volume control (softvol)]'
--test-position'[test ring buffer position]'
- --test-coef='[test coefficient for ring buffer position (default 8)]'
+ --test-coef='[test coefficient for ring buffer position]:coefficient [8]'
--test-nowait'[do not wait for ring buffer - eats whole CPU]'
--max-file-time='[start another output file when the old file has recorded]'
--process-id-file='[write the process ID here]'
diff --git a/Completion/Linux/Command/_basenc b/Completion/Linux/Command/_basenc
new file mode 100644
index 000000000..515621aaa
--- /dev/null
+++ b/Completion/Linux/Command/_basenc
@@ -0,0 +1,30 @@
+#compdef basenc
+# based on GNU coreutils 8.32
+
+local specs=(
+ + '(type)'
+ "(info)--base64[same as 'base64' program (RFC4648 section 4)]"
+ "(info)--base64url[file- and url-safe base64 (RFC4648 section 5)]"
+ "(info)--base32[same as 'base32' program (RFC4648 section 6)]"
+ "(info)--base32hex[extended hex alphabet base32 (RFC4648 section 7)]"
+ "(info)--base16[hex encoding (RFC4648 section 8)]"
+ "(info)--base2msbf[bit string with most significant bit (msb) first]"
+ "(info)--base2lsbf[bit string with least significant bit (lsb) first]"
+ "(info)--z85[ascii85-like encoding (ZeroMQ spec-32/Z85)]"
+
+ + enc
+ '(info dec -w --wrap)'{-w+,--wrap=}"[wrap encoded lines at specified column]:number of characters (0=disable wrapping) [76]: "
+
+ + dec
+ '(info enc -d --decode)'{-d,--decode}"[decode data]"
+ '(info enc -i --ignore-garbage)'{-i,--ignore-garbage}"[when decoding, ignore non-alphabet characters]"
+
+ + info
+ "(: -)--help[display help information and exit]"
+ "(: -)--version[output version information and exit]"
+
+ + input
+ '(info)1:input file:_files'
+)
+
+_arguments -s -S : $specs
diff --git a/Completion/Linux/Command/_btrfs b/Completion/Linux/Command/_btrfs
index eb31580ad..65cf067aa 100644
--- a/Completion/Linux/Command/_btrfs
+++ b/Completion/Linux/Command/_btrfs
@@ -17,11 +17,14 @@ 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 )
+cmds_11=( chunk-recover fix-device-size super-recover zero-log create-control-device )
_arguments -C -A "-*" "$args[@]" \
'(- *)--help[print help information]' \
'(- *)--version[print version information]' \
+ '(-v --verbose -q --quiet --help --version)'{-v,--verbose}'[verbose output of operation]' \
+ '(-v --verbose -q --quiet --help --version)'{-q,--quiet}'[suppress all messages except errors]' \
+ '(--help --version)--format=[specify output format]:format:(text json)' \
'(--version)1: :->groups' \
'2: :->cmds' \
'*:: :->args' && ret=0
@@ -60,6 +63,11 @@ while (( $#state )); do
fi
args=( '(-)--help[print help information]' )
case ${cont} in
+ (balance|replace):start|device:(add|delete|remove)|filesystem:resize)
+ args+=(
+ "--enqueue[wait if there's another exclusive operation running, otherwise continue]"
+ )
+ ;|
subvolume:create)
args+=(
'*-i[add the newly created subvolume to a qgroup]:qgroup'
@@ -67,10 +75,10 @@ while (( $#state )); do
)
;;
subvolume:delete)
- args+=(
+ args+=( '!-v' '!--verbose'
'(-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]'
+ '(-i --subvolid)'{-i+,--subvolid=}'[specify id of subvolume to be removed]:subvolume id'
'1:subvolume:_files -/'
)
;;
@@ -112,7 +120,7 @@ while (( $#state )); do
;|
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|subvolume):(df|du|show|usage))
+ (device|filesystem|qgroup|subvolume):(df|du|show|usage)|scrub:status)
args+=(
'--iec[use 1024 as a base]'
'--si[use 1000 as a base]'
@@ -129,7 +137,7 @@ while (( $#state )); do
'(-t --tbytes)'{-t,--tbytes}'[show sizes in TiB, or TB with --si]'
)
;|
- (filesystem|qgroup):(du|show))
+ (filesystem|qgroup|scrub):(du|show|status))
args+=(
'--raw[output raw numbers in bytes]'
'--human-readable[output human friendly numbers, base 1024]'
@@ -139,17 +147,16 @@ while (( $#state )); do
'--tbytes[show sizes in TiB, or TB with --si]'
)
;|
- filesystem:resize) args+=( '1:size:_guard "(|+|-)[0-9]#[GKM]"' '2:path:->mounts' );;
+ filesystem:resize) args+=( '1: :_numbers -u bytes -N size K M G T P E' '2:path:->mounts' );;
filesystem:defragment)
- args+=(
- '-v[verbose]'
+ args+=( '!-v'
'-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) [32M]'
+ '-s[start position]: :_numbers -u bytes -d "beginning of file" offset K M G T P E'
+ '-l[defragment limited number of bytes]: :_numbers -u bytes length K M G T P E'
+ '-t[defragment only extents up to a certain size]: :_numbers -u bytes -d 32M "maximum extent size" K M G T P E'
'*:file:_files'
)
;;
@@ -192,10 +199,9 @@ while (( $#state )); do
;;
device:ready) args+=( '1:device: _files -g "*(-%)"' );;
scrub:(start|resume))
- args+=(
+ args+=( '!-q'
"-B[don't background and print statistics at end]"
'-d[print separate statistics for each device]'
- '-q[omit error message and statistics]'
'-r[read only mode]'
'-R[raw print mode]'
'-c[set ioprio class]:class:(( 0\:none 1\:realtime 2\:best-effort 3\:idle))'
@@ -215,18 +221,17 @@ while (( $#state )); do
)
;;
balance:start)
- args+=(
+ args+=( '!-v' '!--verbose'
'(-m -s)-d+[act on data chunks]:filter:->filters'
'(-d -s)-m+[act on metadata chunks]:filter:->filters'
'(-d -m)-s+[act on system chunks (only under -f)]:filters:->filters'
- '-v[verbose mode]'
'-f[force a reduction 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:status) args+=( '!-v' '!--verbose' '1:path:_files -/' );;
balance:(pause|cancel|resume)) args+=( '1:path:_files -/' );;
property:set) args+=( '3:value' );&
property:get) args+=( '2:property:(ro label compression)' );&
@@ -244,10 +249,14 @@ while (( $#state )); do
'1:path:_files -/'
)
;;
- qgroup:(assign|remove)) args+=( '1:source 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 inconsistent]" )
+ qgroup:(assign|remove))
+ args+=(
+ \!--rescan
+ "--no-rescan[don't do a rescan, even if the quotas may become inconsistent]"
+ '1:source path:_files -/'
+ '2:destination path:_files -/'
+ '3:path:_files -/'
+ )
;;
qgroup:(create|destroy)) args+=( '1:qgroupid:' '2:path:_files -/' );;
qgroup:show)
@@ -296,6 +305,11 @@ while (( $#state )); do
'(-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]'
"--noscan[don't scan devices from the filesystem, use only the listed ones]"
+ '!(--dfs)--bfs'
+ '--dfs[depth-first traversal of the trees]'
+ '--hide-names[hide filenames/subvolume/xattrs and other name references]'
+ '--csum-headers[print node checksums stored in headers (metadata)]'
+ '--csum-items[print checksums stored in checksum items (data)]'
)
;;
inspect*:dump-super)
@@ -307,12 +321,12 @@ while (( $#state )); do
'--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*:inode*) args+=( '!-v' '1:inode:_files' '2:path:_files -/' );;
+ inspect*:subvol*) args+=( '!-v' '1:subvolid:_guard "[0-9]#" subvolume id' '2:path:_files -/' );;
inspect*:logical*)
- args+=(
- '-v[verbose mode]'
+ args+=( '!-v'
'-P[skip the path resolving and print the inodes instead]'
+ '-o[ignore offsets when matching references]'
'-s[specify buffer size]:buffer size [4096]'
'1:logical address:_files'
'2:filesystem path:_files -/'
@@ -322,9 +336,8 @@ while (( $#state )); do
inspect*:rootid) args+=( '1:path:_files -/' );;
inspect*:tree*) args+=( '-b[print raw numbers in bytes]' );;
rescue:(chunk|super)-recover)
- args+=(
+ args+=( '!-v'
'-y[assume yes to every question]'
- '-v[verbose mode]'
'1:device:_files'
)
[[ ${${(P)group}[cmd]} == chunk-recover ]] && args+=('(-)-h[display help]')
@@ -352,12 +365,11 @@ while (( $#state )); do
)
;;
restore)
- args+=(
+ args+=( '!-v' '!--verbose'
'(-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'
@@ -374,23 +386,20 @@ while (( $#state )); do
)
;;
send|receive)
- args+=( '(-q --quiet)'{-q,--quiet}'[suppress all messages except errors]' )
+ args+=( '!-q' '!--quiet' )
;|
send)
- args+=(
- '*-v[verbose mode]'
+ args+=( '!-v'
'-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[specify output file]:file:_files'
'--no-data[send in NO_FILE_DATA mode]'
- '(-v --verbose)'{-v,--verbose}'[enable verbose output]'
'1:subvolume:_files -/'
)
;;
receive)
- args+=(
- '*-v[verbose mode]'
+ args+=( '!-v'
'-f[input file]:file: _files'
'-e[terminate after <end cmd>]'
'(-C --chroot)'{-C,--chroot}'[confine the process to destination path using chroot(1)]'
diff --git a/Completion/Linux/Command/_choom b/Completion/Linux/Command/_choom
new file mode 100644
index 000000000..2a6dd03c7
--- /dev/null
+++ b/Completion/Linux/Command/_choom
@@ -0,0 +1,10 @@
+#compdef choom
+
+_arguments -S \
+ '(H -n --adjust)'{-n,--adjust}'+[specify the adjust score value (-1000...1000)]:score (-1000...1000)' \
+ '(H -p --pid)'{-p,--pid}'[interpret args as process ID]:process ID:_pids' \
+ '(H -p --pid):command:_command_names' \
+ '*::arguments:_normal' \
+ + 'H' \
+ '(- *)'{-V,--version}'[display version information]' \
+ '(- *)'{-h,--help}'[display help information]'
diff --git a/Completion/Linux/Command/_cpupower b/Completion/Linux/Command/_cpupower
index ae1f1d3d1..6763bdd12 100644
--- a/Completion/Linux/Command/_cpupower
+++ b/Completion/Linux/Command/_cpupower
@@ -20,11 +20,12 @@ cmds=(
'info:show global power parameters'
'set:set global power parameters'
'monitor:report frequency and idle statistics'
+ 'powercap-info:show powercapping related kernel and hardware configurations'
'help:print usage information'
)
case $state in
cmds)
- _describe command cmds && ret=0
+ _describe command cmds -M 'r:|-=* r:|=*' && ret=0
;;
args)
curcontext="${curcontext%:*}-$words[1]"
diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup
index 45159d0be..f7149a76f 100644
--- a/Completion/Linux/Command/_cryptsetup
+++ b/Completion/Linux/Command/_cryptsetup
@@ -21,6 +21,7 @@ _arguments -s \
'--new-keyfile-offset=[specify number of bytes to skip in newly added keyfile]:offset (bytes)' \
'(-S --key-slot)'{-S+,--key-slot=}'[select key slot]:key slot' \
'(-b --size)'{-b+,--size=}'[force device size]:sectors' \
+ '--device-size=[use only specified device size (ignore rest of device)]:size (bytes)' \
'(-o --offset)'{-o+,--offset=}'[set start offset]:sectors' \
'(-p --skip)'{-p+,--skip=}'[data to skip at beginning]:sectors' \
'(-r --readonly)'{-r,--readonly}'[create a read-only mapping]' \
@@ -44,10 +45,12 @@ _arguments -s \
'--veracrypt[scan also for VeraCrypt compatible device]' \
'--veracrypt-pim=[specify personal iteration multiplier for VeraCrypt compatible device]:multiplier' \
'--veracrypt-query-pim[query personal iteration multiplier for VeraCrypt compatible device]' \
- '(-M --type)'{-M+,--type=}'[specify type of device metadata]:type:(luks plain loopaes tcrypt)' \
+ '(-M --type)'{-M+,--type=}'[specify type of device metadata]:type:(luks luks1 luks2 plain loopaes tcrypt bitlk)' \
'--force-password[disable password quality check (if enabled)]' \
'--perf-same_cpu_crypt[use dm-crypt same_cpu_crypt performance compatibility option]' \
'--perf-submit_from_crypt_cpus[use dm-crypt submit_from_crypt_cpus performance compatibility option]' \
+ '--perf-no_read_workqueue[bypass dm-crypt workqueue and process read requests synchronously]' \
+ '--perf-no_write_workqueue[bypass dm-crypt workqueue and process write requests synchronously]' \
'--deferred[device removal is deferred until the last user closes it]' \
'--serialize-memory-hard-pbkdf[use global lock to serialize memory]' \
'--pbkdf=[specify PBKDF algorithm for LUKS2]:algorithm:(argon2i argon2id pbkdf2)' \
@@ -60,14 +63,16 @@ _arguments -s \
'(-I --integrity)'{-I+,--integrity=}'[specify data integrity algorithm (LUKS2 only)]:algorithm' \
'--integrity-no-journal[disable journal for integrity device]' \
"--integrity-no-wipe[don't wipe device after format]" \
+ '--integrity-legacy-padding[use inefficient legacy padding (old kernels)]' \
"--token-only[don't ask for passphrase if activation by token fails]" \
'--token-id=[specify token number]:number [any]' \
'--key-description=[specify key description]:description' \
'--sector-size=[specify encryption sector size]:size [512 bytes]' \
+ '--iv-large-sectors[use IV counted in sector size (not in 512 bytes)]' \
'--persistent[set activation flags persistent for device]' \
'--label=[set label for the LUKS2 device]:label' \
'--subsystem=[set subsystem label for the LUKS2 device]:subsystem' \
- '--unbound[create unbound (no assigned data segment) LUKS2 keyslot]' \
+ '--unbound[create or dump unbound (no assigned data segment) LUKS2 keyslot]' \
'--json-file=[read or write token to json file]:json file:_files -g "*.json(-.)"' \
'--luks2-metadata-size=[specify LUKS2 header metadata area size]:size (bytes)' \
'--luks2-keyslots-size=[specify LUKS2 header keyslots area size]:size (bytes)' \
@@ -77,12 +82,13 @@ _arguments -s \
'--encrypt[Encrypt LUKS2 device (in-place encryption)]' \
'--decrypt[decrypt LUKS2 device (remove encryption)]' \
'--init-only[initialize LUKS2 reencryption in metadata only]' \
+ '--resume-only[resume initialized LUKS2 reencryption only]' \
'--reduce-device-size=[reduce data device size (move data offset)]:size (bytes)' \
'--hotzone-size=[specify maximal reencryption hotzone size]:size (bytes)' \
'--resilience=[specify reencryption hotzone resilience type]:resilience type:(checksum journal none)' \
'--resilience-hash=[specify reencryption hotzone checksums hash]:string' \
'--active-name=[override device autodetection of dm device to be reencrypted]:string' \
- "${ign}(- : *)--version[show version information]" \
+ "${ign}(- : *)"{-V,--version}'[show version information]' \
"${ign}(- : *)"{-\?,--help}'[display help information]' \
"${ign}(- : *)--usage[display brief usage]" \
':action:->actions' \
@@ -111,6 +117,7 @@ case $state in
'isLuks:check if device is a LUKS partition'
'luksDump:dump header information'
'tcryptDump:dump TCRYPT device information'
+ 'bitlkDump:dump BITLK device information'
'luksSuspend:suspend LUKS device and wipe key'
'luksResume:resume suspended LUKS device'
'luksHeaderBackup:store binary backup of headers'
diff --git a/Completion/Linux/Command/_dkms b/Completion/Linux/Command/_dkms
index a0a666e33..2a3c016c5 100644
--- a/Completion/Linux/Command/_dkms
+++ b/Completion/Linux/Command/_dkms
@@ -8,6 +8,7 @@ subcmds=(
'add:add a module/version combination to the tree for builds and installs'
'remove:remove a module from the tree'
'build:compile a module for a kernel'
+ 'unbuild:undoes the build of a module'
"install:install a build module for it's corresponding kernel"
'uninstall:uninstall a module for a kernel'
'match:install every module that is installed for a template kernel for another kernel'
@@ -17,6 +18,7 @@ subcmds=(
'mkrpm:create an RPM package for a module'
'mkdeb:create a debian binary package for a module'
'mkdsc:create a debian source package for a module'
+ 'mkbmdeb:create a debian package containing just binary modules'
'mkkmp:create a Kernel Module Package source RPM for a module'
'status:display the current status of modules, versions and kernels within the tree'
'autoinstall:try to install the latest revision of all modules that have been installed for other kernel revisions'
@@ -32,6 +34,7 @@ args=(
'--installtree=:path:_directories'
'--sourcetree=:path:_directories'
'--dkmsframework=:path:_directories'
+ '--force-version-override'
'1: : _describe -t commands command subcmds'
)
@@ -44,7 +47,7 @@ else
'(remove|build|install|uninstall|match|status|mk(^kmp))' 'k' \
'(add|remove)' '-rpm_safe_upgrade' \
'mk(driverdisk|kmp)' '-spec' \
- 'mk(deb|dsc|rpm)' '-legacy-postinst' \
+ 'mk(deb|dsc|bmdeb|rpm)' '-legacy-postinst' \
'mk(tarball|rpm|deb|dsc)' '-(source|binary)-only' \
'(match|build|mkkmp)' '(k|-no-(prepare|clean)-kernel|-kernelsourcedir)' \
'(|un)install' '-no-(depmod|initrd)' \
@@ -67,7 +70,7 @@ case $cmd in
remove|build|install|uninstall|mk*|status)
args+=( ': :->modules' )
;|
- |remove|build|install|uninstall|match|status|mk(^kmp))
+ |remove|(un|)build|install|uninstall|match|status|mk(^kmp))
args+=( '(--all)*-k[specify kernel version]:kernel:->kernels' )
;|
|add|remove) args+=( "${ign}--rpm_safe_upgrade" ) ;|
@@ -77,7 +80,7 @@ case $cmd in
|(mk|ld)tarball)
args+=( "${ign}--archive=:tarball:_files -g '*.tar(-.)'" )
;|
- |mk(deb|dsc|rpm))
+ |mk(deb|dsc|bmdeb|rpm))
args+=( "${ign}--legacy-postinst=:value [1]:(0 1)" )
;|
|mk(tarball|rpm|deb|dsc)) args+=( "${ign}(--source-only --binaries-only)--"{source,binaries}-only ) ;|
@@ -100,7 +103,7 @@ case $cmd in
'-c[specify location of dkms.conf file]:location:_files'
)
;|
- |remove|build|install|status|mk(^kmp))
+ |remove|(un|)build|install|status|mk(^kmp))
args+=( '(-a --arch -k)--all[specify all relevant kernels/arches]' )
;|
|build)
diff --git a/Completion/Linux/Command/_ethtool b/Completion/Linux/Command/_ethtool
index dccda4684..95a8bbfb6 100644
--- a/Completion/Linux/Command/_ethtool
+++ b/Completion/Linux/Command/_ethtool
@@ -5,16 +5,21 @@ local -a state line expl cmds
local -A opt_args
_arguments -C \
+ '--debug[turn on debugging messages]:mask:((1\:parser\ information))' \
+ '--json[output results in JSON]' \
+ '(-I --include-statistics)'{-I,--include-statistics}'[include command-related statistics in the output]' \
+ '(cmds)'{-Q,--per-queue}'[apply per-queue command]: :(queue_mask):queue mask' \
"1:interface:_net_interfaces" \
- '*: :->args' \
+ '*:: :->args' \
+ + '(cmdc)' \
+ '(cmds)'{-c,--show-coalesce}'[query the specified ethernet device for coalescing information]' \
+ '(cmds)'{-C,--coalesce}'[change the coalescing settings of the specified ethernet device]' \
+ '(cmds)' \
'(1)'{-h,--help}'[display help information]' \
'(1)--version[display version information]' \
{-s,--change}'[allow changing some or all settings of the specified ethernet device]' \
{-a,--show-pause}'[query the specified ethernet device for pause parameter information]' \
{-A,--pause}'[change the pause parameters of the specified ethernet device]' \
- {-c,--show-coalesce}'[query the specified ethernet device for coalescing information]' \
- {-C,--coalesce}'[change the coalescing settings of the specified ethernet device]' \
{-g,--show-ring}'[query the specified ethernet device for RX/TX ring parameter information]' \
{-G,--set-ring}'[change the RX/TX ring parameters of the specified ethernet device]' \
{-k,--show-features,--show-offload}'[query the specified ethernet device for offload information]' \
@@ -46,10 +51,21 @@ _arguments -C \
'--set-eee[set EEE settings]' \
'--set-phy-tunable[set PHY tunable]' \
'--get-phy-tunable[get PHY tunable]' \
+ '--get-tunable[get tunable parameters]' \
+ "--set-tunable[set driver's tunable parameters]" \
'--reset[reset hardware components]' \
'--show-fec[query device for forward error correction support]' \
'--set-fec[configure forward error correction for device]' \
- {-Q,--per-queue}'[apply per-queue command]' && return
+ '--cable-test[perform cable test and report the results]' \
+ '--cable-test-tdr[perform cable test and report Time Domain Reflectometer data]' \
+ '--show-tunnels[show tunnel-related device capabilities and state]' \
+ '--monitor[listen to netlink notifications and displays them]::command:(
+ --all -s --change -k --show-features --show-offload -K
+ --features --offload --show-priv-flags --set-priv-flags -g --show-ring
+ -G --set-ring -l --show-channels -L --set-channels -c --show-coalesce
+ -C --coalesce -a --show-pause -A --pause --show-eee --set-eee
+ --cable-test --cable-test-tdr
+ )' && return
if [[ -n $state ]]; then
case $words[CURRENT-1] in
@@ -62,7 +78,8 @@ if [[ -n $state ]]; then
_wanted onoff expl 'enabled' compadd off on
fi
;;
- autoneg|adaptive-[rt]x|raw|hex|sg|tso|ufo|gso|lro|eee|tx-lpi|downshift|fast-link-down)
+ autoneg|adaptive-[rt]x|raw|hex|sg|tso|ufo|gso|lro|eee|tx-lpi|downshift) ;&
+ fast-link-down|energy-detect-power-down|mode)
_wanted onoff expl 'enabled' compadd off on
;;
rx-usecs|rx-frames|rx-usecs-irq|rx-frames-irq|tx-usecs|tx-frames) ;&
@@ -71,6 +88,8 @@ if [[ -n $state ]]; then
rx-frames-high|tx-usecs-high|tx-frames-high|sample-interval|dmac|rx-mini) ;&
rx-jumbo|offset|length|magic|value|phyad|proto|tos|tclass|l4proto|src-port) ;&
dst-port|spi|l4data|vlan-etype|vlan|user-def|action|vf|queue|loc) ;&
+ page|bank|i2c|first|last|step|pair|lanes) ;&
+ rx-copybreak|tx-copybreak|pfc-prevention-tout) ;&
other|combined|tx-timer|count|msecs)
_message -e numbers 'number'
;;
@@ -81,7 +100,10 @@ if [[ -n $state ]]; then
_wanted duplex expl 'duplex mode' compadd half full
;;
port)
- _wanted port expl 'device port' compadd tp aui bnc mii fibre
+ _wanted port expl 'device port' compadd tp aui bnc mii fibre da
+ ;;
+ master-slave)
+ _wanted roles expl role compadd {preferred,forced}-{master,slave}
;;
advertise)
_values 'hexadecimal value (or a combination of the following)' \
@@ -93,7 +115,8 @@ if [[ -n $state ]]; then
'0x020[1000 full]' \
'0x8000[2500 full(not supported by IEEE standards)]' \
'0x800[10000 full]' \
- '0x03F[auto]'
+ '0x03F[auto]' \
+ 'mode[set mode]'
;;
xcvr)
_wanted xcvr expl 'transceiver type' compadd internal external
@@ -144,7 +167,7 @@ if [[ -n $state ]]; then
_message -e contexts 'RSS context'
;;
*)
- case $words[2] in
+ case ${${(Mk)opt_args:#cmd?*}[1]#cmd?-} in
-A|--pause)
_values -S ' ' -w 'pause parameter' \
'autoneg[specify if pause autonegotiation is enabled]' \
@@ -192,6 +215,9 @@ if [[ -n $state ]]; then
-p|--identify)
(( CURRENT = 4 )) && _message -e length 'duration (seconds)'
;;
+ -S|--statistics)
+ _arguments '(-)--all-groups' '(-)--groups:eth-phy: :eth-mac: :eth-ctrl: :rmon'
+ ;;
-t|--test)
_values -S ' ' -w 'test mode' \
'(online)offline:perform full set of tests possibly causing normal operation interruption (default)]' \
@@ -202,8 +228,10 @@ if [[ -n $state ]]; then
if (( ! $words[(I)msglvl] )); then
_values -S ' ' -w 'generic option' \
'speed[set speed in Mb/s]' \
+ 'lanes[set number of lanes]' \
'duplex[set full or half duplex mode]' \
'port[select device port]' \
+ 'master-slave[configure interface role]' \
'autoneg[specify if autonegotiation is enabled]' \
'advertise[set the speed and duplex advertised by autonegotiation]' \
'phyad[PHY address]' \
@@ -274,16 +302,23 @@ if [[ -n $state ]]; then
fi
;;
-m|--dump-module-eeprom|--module-info)
- _wanted options expl option compadd -F line - raw hex offset length
+ _wanted options expl option compadd -F line - raw hex offset \
+ length page bank i2c
;;
--set-eee)
_wanted behaviours expl behaviour compadd -F line - eee advertise tx-lpi tx-timer
;;
--set-phy-tunable)
- _wanted options expl tunable compadd -F line - downshift count fast-link-down msecs
+ _wanted options expl tunable compadd -F line - downshift count \
+ fast-link-down msecs energy-detect-power-down
;;
--get-phy-tunable)
- _wanted options expl tunable compadd downshift fast-link-down
+ _wanted options expl tunable compadd downshift fast-link-down \
+ energy-detect-power-down
+ ;;
+ --[gs]et-tunable)
+ _wanted options expl tunable compadd rx-copybreak tx-copybreak \
+ pfc-prevention-tout
;;
--reset)
_wanted components expl component compadd flags dedicated all \
@@ -303,6 +338,9 @@ if [[ -n $state ]]; then
_wanted options expl option compadd -c --show-coalescing -C --coalesce
fi
;;
+ --cable-test-tdr)
+ _wanted options expl 'distance options' compadd first last step pair
+ ;;
esac
;;
esac
diff --git a/Completion/Linux/Command/_findmnt b/Completion/Linux/Command/_findmnt
index 9f13e695f..0c832364d 100644
--- a/Completion/Linux/Command/_findmnt
+++ b/Completion/Linux/Command/_findmnt
@@ -22,9 +22,12 @@ _arguments -s -C \
'(H -M --mountpoint :)'{-M+,--mountpoint=}'[specify the mountpoint]: :->targets' \
'(H -n --noheadings)'{-n,--noheadings}'[do not print a header line]' \
'(H -O --options)'{-O+,--options=}'[only print the filesystems with the specified options]:list of options: ' \
- '(H -o --output)'{-o+,--output=}'[specify output columns]: :->columns' \
+ '(H -o --output --output-all)'{-o+,--output=}'[specify output columns]: :->columns' \
+ '(H -o --output)--output-all[output all available columns]' \
'(H -p --poll)'{-p+,--poll=}'[monitor changes in /proc/self/mountinfo]::action:(mount umount remount move)' \
+ '(H --real)--pseudo[print only pseudo-filesystems]' \
'(H -R --submounts)'{-R,--submounts}'[print recursively all submounts]' \
+ '(H --pseudo)--real[print only real filesystems]' \
'(H -S --source :)'{-S+,--source=}'[specify the mount source]: :->sources' \
'(H -T --target :)'{-T+,--target=}'[specify the mount target]:target:_files' \
'(H -t --types)'{-t+,--types=}'[specify the type of filesystems]:filesystem types:_sequence -s , _file_systems' \
@@ -39,7 +42,7 @@ _arguments -s -C \
'(H)2:: :->targets' \
+ '(format)' \
'(H)'{-D,--df}'[imitate the output of df command]' \
- '(H)'{-J,--json}'[use JASON output format]' \
+ '(H)'{-J,--json}'[use JSON output format]' \
'(H)'{-l,--list}'[use list output format]' \
'(H)'{-P,--pairs}'[use key="value" output format]' \
'(H)'{-r,--raw}'[use raw output format]' \
@@ -101,7 +104,7 @@ case $state in
'prefixes:prefix:compadd -S "" LABEL= UUID= PARTLABEL= PARTUUID='
)
[[ $state = sources_targets ]] &&
- alts+=( 'mount-points:moutpoint:__findmnt_mountpoints' )
+ alts+=( 'mount-points:mountpoint:__findmnt_mountpoints' )
_alternative $alts && ret=0
fi
;;
diff --git a/Completion/Linux/Command/_free b/Completion/Linux/Command/_free
index cc5bcf3bd..6d74e4a0d 100644
--- a/Completion/Linux/Command/_free
+++ b/Completion/Linux/Command/_free
@@ -1,5 +1,4 @@
#compdef free
-# based on procps-ng-3.3.15
_arguments -s \
'(-l --lohi)'{-l,--lohi}'[show detailed low and high memory statistics]' \
@@ -7,6 +6,7 @@ _arguments -s \
'(-w --wide)'{-w,--wide}'[wide mode]' \
'(-s --seconds)'{-s,--seconds}'[specify the delay between display]:seconds: ' \
'(-c --count)'{-c+,--count=}'[specify the display count]:count: ' \
+ '(-C --full-cache)'{-C,--full-cache}'[add further cache lines to main cache]' \
'--si[use power of 1000 instead of power of 1024]' \
'(-)--help[print help and exit]' \
'(-)'{-V,--version}'[print version information and exit]' \
diff --git a/Completion/Linux/Command/_fusermount b/Completion/Linux/Command/_fusermount
index 02cb57237..41d3dec72 100644
--- a/Completion/Linux/Command/_fusermount
+++ b/Completion/Linux/Command/_fusermount
@@ -6,7 +6,7 @@ typeset -A opt_args
_arguments \
'-h[display help information]' \
'-V[display version information]' \
- '-o[specify mount options]:mount options:_fuse_values "mount options"' \
+ '-o[specify mount options]:mount option:_fuse_values "mount option"' \
'-u[unmount a fuse mount]' \
'-z[unmount lazily (work even when if the resource is still busy)]' \
'-q[suppress nonessential output]' \
diff --git a/Completion/Linux/Command/_ionice b/Completion/Linux/Command/_ionice
index d64f1c496..ba403ca56 100644
--- a/Completion/Linux/Command/_ionice
+++ b/Completion/Linux/Command/_ionice
@@ -17,14 +17,14 @@ _arguments -C -s -S \
'(- *)'{-h,--help}'[display help information]' \
+ '(args)' \
'(H)'{-p-,--pid=-}'[interpret args as process ID]::process id:_pids' \
- '(H)'{-P-,--pgid=-}'[specify process group IDs]::process group' \
+ '(H)'{-P-,--pgid=-}'[specify process group IDs]::process group:_pgids' \
'(H)'{-u-,--uid=-}'[act on running process owned by specified users]::user id' && ret=0
if [[ -n $state ]]; then
if (( $+opt_args[args--p] || $+opt_args[args---pid] )); then
_pids && ret=0
elif (( $+opt_args[args--P] || $+opt_args[args---pgid] )); then
- _message -e pgids 'process group'
+ _pgids && ret=0
elif (( $+opt_args[args--u] || $+opt_args[args---uid] )); then
_message -e uids 'user id'
else
diff --git a/Completion/Linux/Command/_ipset b/Completion/Linux/Command/_ipset
index d05f13caf..a40480904 100644
--- a/Completion/Linux/Command/_ipset
+++ b/Completion/Linux/Command/_ipset
@@ -4,7 +4,7 @@ local offset=0
local -a args from_to hash cmds listopts addopts
_set_types () {
- _values -S \ "Set type" \
+ _values -S \ "set type" \
'bitmap\:ip[uses a memory range to store IPv4 host (default) or IPv4 subnet addresses up to 65536 elements]'\
'bitmap\:ip,mac[uses a memory range to store an IPv4 host/subnet and mac address pair up to 65536 elements]'\
'bitmap\:port[uses a memory range to store port numbers independent of L4 protocol at up to 65536 elements]'\
@@ -25,7 +25,7 @@ _set_types () {
_ipsets () {
local -a vals
vals=( ${${(M)${(f)"$(_call_program ipsets ipset -L)"}%Name: *}#Name: } )
- _describe -t ipsets "IP sets" vals
+ _describe -t ipsets "IP set" vals
}
_sets () {
_ipsets
@@ -37,18 +37,11 @@ from_to=('(--network)--from[from IP or network (with --netmask)]:IP'
'(--from --to)--network[network]:IP/mask'
)
-_addressfamily () {
- vals=( inet
- inet6
- )
- _describe -t addressfamily "Address Family" vals
-}
-
-hash=( '--hashsize[the initial hash size aligned to a power of 2(default 1024)]:hashsize'
- '--maxelem[the maximum number of elements in the set (default 65536)]:maxelements'
- '--family[the protocol family of addresses to be stored in the set (default inet)]:addressfamily:_addressfamily'
+hash=( '--hashsize[the initial hash size aligned to a power of 2]:hashsize [1024]'
+ '--maxelem[the maximum number of elements in the set]:max elements [65536]'
+ '--family[the protocol family of addresses to be stored in the set]:address family [inet]:(inet inet6)'
'--timeout[adds timeout support to the set with your specified value as default, (0 = forever)]:entrytimeout'
- '--probes[max number of tries to resolve clashing, altering this is discouraged (default 8)]:probes'
+ '--probes[max number of tries to resolve clashing, altering this is discouraged]:tries [8]'
'--resize[ratio of increasing hash size after unsuccessful <probes> of double-hashing, altering discouraged]:percent'
)
@@ -100,7 +93,7 @@ case $words[offset+2]; in
args=( $hash )
;;
list\:set)
- args=( '--size[size of the new setlist (default 8)]:size' )
+ args=( '--size[size of the new setlist]:size [8]' )
;;
esac
;;
@@ -118,7 +111,7 @@ _ips () {
if (( $ips )); then vals1+=$i; else bindings+=${i/ ->/:}; fi
done
_describe -t ips "IPs from $words[offset+3] set" vals1
- _describe -t special_values "special values" vals2
+ _describe -t special_values "special value" vals2
fi
}
diff --git a/Completion/Linux/Command/_losetup b/Completion/Linux/Command/_losetup
index 54debe19e..f5a7ec1b1 100644
--- a/Completion/Linux/Command/_losetup
+++ b/Completion/Linux/Command/_losetup
@@ -33,14 +33,15 @@ _arguments -s -S \
{-D,--detach-all}'[detach all associated loop devices]' \
- 'create' \
'--direct-io[open backing file with O_DIRECT]::enable:(on off)' \
- '(-f --find 2)'{-f,--find}'[find the first unused loop device]' \
+ '(-f --find 1)'{-f,--find}'[find the first unused loop device]' \
'(-L --nooverlap)'{-L,--nooverlap}'[avoid possible conflict between devices]' \
'(-P --partscan)'{-P,--partscan}'[scan the partition table of newly created loop devices]' \
'--sizelimit[limit device to specified size]:size (bytes)' \
'(-b --sector-size)'{-b+,--sector-size=}'[set logical sector size of loop device]:size (bytes)' \
'--show[print device name after setup]' \
'(-r --read-only)'{-r,--read-only}'[set up a read-only loop device]' \
- '1:file:_files' \
+ "(-f)$device" \
+ '2:file:_files' \
- 'assoc' \
'(-j --associated)'{-j,--associated}'[show the status of all loop devices associated with an file]:associated file:_files' \
"(-f)$device"
diff --git a/Completion/Linux/Command/_lsns b/Completion/Linux/Command/_lsns
new file mode 100644
index 000000000..994101d97
--- /dev/null
+++ b/Completion/Linux/Command/_lsns
@@ -0,0 +1,18 @@
+#compdef lsns
+
+local ign
+
+(( $#words > 2 )) && ign='!'
+_arguments -s -S \
+ '(-J --json)'{-J,--json}'[use JSON output format]' \
+ '(-l --list)'{-l,--list}'[use list format output]' \
+ '(-n --noheadings)'{-n,--noheadings}"[don't print headings]" \
+ '(-o --output)'{-o,--output}'[define which output columns to use]:column:_sequence compadd -M "m\:{a-z}={A-Z}" - NS TYPE PATH NPROCS PID PPID COMMAND UID USER NETNSID NSFS' \
+ '(-p --task)'{-p+,--task=}'[print process namespaces]:process id:_pids' \
+ '(-r --raw)'{-r,--raw}'[use the raw output format]' \
+ '(-u --notruncate)'{-u,--notruncate}"[don't truncate text in columns]" \
+ '(-W --nowrap)'{-W,--nowrap}"[don't use multi-line representation]" \
+ '(-t --type)'{-t+,--type=}'[filter by namespace type]:namespace type:(mnt net ipc user pid uts cgroup)' \
+ "$ign(- *)"{-h,--help}'[display usage information]' \
+ "$ign(- *)"{-V,--version}'[display version information]' \
+ '*: :_guard "^-*" namespace'
diff --git a/Completion/Linux/Command/_mat b/Completion/Linux/Command/_mat
new file mode 100644
index 000000000..ff65167ff
--- /dev/null
+++ b/Completion/Linux/Command/_mat
@@ -0,0 +1,19 @@
+#compdef mat
+
+# Completion for mat 0.6.1 (https://tails.boum.org/blueprint/doc/mat)
+
+local curcontext="$curcontext" state line
+typeset -A opt_args
+_arguments \
+ '(- *)'{-h,--help}'[show help message and exit]' \
+ '(-a --add2archive)'{-a,--add2archive}'[add to output archive non-supported filetypes]' \
+ '(-b --backup)'{-b,--backup}'[keep a backup copy]' \
+ '(-L --low-pdf-quality)'{-L,--low-pdf-quality}'[produces a lighter, but lower quality PDF]' \
+ '(-c --check -b --backup)'{-c,--check}'[check if a file is free of harmful metadatas]' \
+ '(-d --display -b --backup)'{-d,--display}'[list all the harmful metadata of a file without removing them]' \
+ '(- *)'{-l,--list}'[list all supported fileformats]' \
+ '(- *)'{-v,--version}"[show program's version number and exit]" \
+ '*:file:_files -g "*.(tif|tiff|png|jpeg|jpg|jpe|odt|fodt|odx|odp|fodp|ods|fods|odg|fodg|docx|docm|pptx|pptm|xlsx|xlsm|pdf|tar|tar.bz2|tar.gz|zip|mp3|mp2|mp1|mpa|ogg|oga|flac|torrent)"'
+ # they are all that are in --list
+ # might not be all the supported files
+
diff --git a/Completion/Linux/Command/_mat2 b/Completion/Linux/Command/_mat2
new file mode 100644
index 000000000..98dd1d05b
--- /dev/null
+++ b/Completion/Linux/Command/_mat2
@@ -0,0 +1,19 @@
+#compdef mat2
+
+# Completion for mat2 0.11.0 (https://0xacab.org/jvoisin/mat2).
+
+local curcontext="$curcontext" state line
+typeset -A opt_args
+_arguments \
+ '(- *)'{-h,--help}'[show help message and exit]' \
+ '(-V --verbose)'{-V,--verbose}'[show more verbose status information]' \
+ --unknown-members'[policy how to handle unknown members of archive-style files]:policy:(abort omit keep)' \
+ --inplace'[clean in place, without backup]' \
+ --no-sandbox"[disable bubblewrap's sandboxing]" \
+ '(- *)'{-v,--version}"[show program's version number and exit]" \
+ '(- *)'{-l,--list}'[list all supported fileformats]' \
+ '(- *)'--check-dependencies'[check if mat2 has all the dependencies it needs]' \
+ '(-L --lightweight -s --show)'{-L,--lightweight}'[remove SOME metadata]' \
+ '(-s --show -L --lightweight)'{-s,--show}'[list harmful metadata detectable by mat2 without removing them]' \
+ '*:file:_files -g "*.(epub|pdf|odc|odf|odg|odi|odp|ods|odt|pptx|xlsx|docx|torrent|ncx|tar|xhtml|xhtm|xht|zip|mp3|mpga|mp1|mp2|oga|opus|ogg|spx|flac|wav|gif|jpg|jpe|jfif|jpeg|png|svgz|svg|tiff|tif|bmp|ppm|css|htm|html|cxx|text|log|txt|hh|hxx|el|conf|cc|pm|f90|mpg4|m4v|mp4|wmv|avi)"'
+
diff --git a/Completion/Linux/Command/_mdadm b/Completion/Linux/Command/_mdadm
index b6dce7ccb..5b73ef4be 100644
--- a/Completion/Linux/Command/_mdadm
+++ b/Completion/Linux/Command/_mdadm
@@ -156,7 +156,7 @@ _mds () {
return 1
fi
vals=( ${${${(M)${(f)"$(< $mdadm_conf)"}##ARRAY *}//ARRAY /}%%[[:blank:]]*} )
- _describe -t mds "RAID devices" vals
+ _describe -t mds "RAID device" vals
_arguments \
"(-h --help)"{-h,--help}'[display a mode specific help message]'
}
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index ff6844f41..3e46130a2 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -12,7 +12,19 @@ _modules_caching_policy()
_modutils() {
local curcontext="$curcontext" expl state line modules modaliases ign args ret=1
local -A opt_args
- local -r modules_dir=/lib/modules
+ local -a possible_modules_dirs=(
+ # Mostly every other distro
+ /lib/modules
+ # NixOS & possibly Guix
+ /run/booted-system/kernel-modules/lib/modules
+ )
+ local modules_dir tested_modules_dir
+ for tested_modules_dir in "${possible_modules_dirs[@]}"; do
+ if [[ -d "$tested_modules_dir" ]]; then
+ modules_dir="$tested_modules_dir"
+ break
+ fi
+ done
local update_policy
zstyle -s ":completion:*:*:$service:*" cache-policy update_policy
@@ -93,8 +105,10 @@ _modutils() {
loaded-modules|loadable-modules)
if [[ -r /proc/modules ]]; then
loaded_modules=(${${(f)"$(</proc/modules)"}%% *})
+ # For compatibility with old systems. Kernels nowadays provide
+ # `/proc/modules` which is more reliable and faster for us.
elif [[ -x /sbin/lsmod ]]; then
- loaded_modules=(${${(f)"$(/sbin/lsmod)"}[2,-1]%% *})
+ loaded_modules=(${${(f)"$(_call_program loaded-modules /sbin/lsmod)"}[2,-1]%% *})
else
return 1
fi
@@ -106,8 +120,11 @@ _modutils() {
;&
all-modules)
- local kver=${opt_args[(i)(-S|-k|--set-version)]:-$(uname -r)}
+ local kver=${(v)opt_args[(i)(-S|-k|--set-version)]:-$(uname -r)}
+ if [[ -z "$modules_dir" ]]; then
+ return
+ fi
if _cache_invalid modules-$kver || ! _retrieve_cache modules-$kver;
then
modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko|ko.gz|ko.xz)(.:t:r:r) )
@@ -115,7 +132,7 @@ _modutils() {
_store_cache modules-$kver modules modaliases
fi
- if (( ${+opt_args[(k)(-R|--resolve-alias)]} )); then
+ if [[ -v opt_args[(i)(-R|--resolve-alias)] ]]; then
_tags module-aliases
else
_tags files modules module-aliases
@@ -137,7 +154,7 @@ _modutils() {
_message -e value 'parameter value'
else
local params
- params=( ${${(M)${(f)"$(_call_program module-parameters /sbin/modinfo "$words[2]" 2>/dev/null)"}:#parm:*}##parm:[[:space:]]##} )
+ params=( ${${(M)${(f)"$(_call_program module-parameters modinfo "$words[2]" 2>/dev/null)"}:#parm:*}##parm:[[:space:]]##} )
compset -S '=*'
if (( $#params )); then
_values -S = -w 'module parameter' \
diff --git a/Completion/Linux/Command/_networkmanager b/Completion/Linux/Command/_networkmanager
index c9b09d145..1e05252b2 100644
--- a/Completion/Linux/Command/_networkmanager
+++ b/Completion/Linux/Command/_networkmanager
@@ -244,7 +244,7 @@ _nm_device_wifi() {
local curcontext="$curcontext" state line
_arguments -C \
- "1:command:(list connect hotspot rescan)" \
+ "1:command:(list connect hotspot rescan show-password)" \
"*::arg:->args"
case $line[1] in
@@ -252,6 +252,7 @@ _nm_device_wifi() {
c*) _nm_device_wifi_connect ;;
ho*) _nm_device_wifi_hotspot ;;
r*) _nm_device_wifi_rescan ;;
+ s*) _nm_device_wifi_show-password ;;
esac
}
@@ -362,6 +363,12 @@ _nm_device_wifi_rescan() {
"4:ssid:_nm_device_wifi_ssids"
}
+_nm_device_wifi_show-password() {
+ _arguments \
+ "1: :(ifname)" \
+ "2:interface:_nm_device_ifnames"
+}
+
_nm_device_wifi_bssids() {
local -a bssids
bssids=(${(f)"$(_call_program nmcli nmcli -t -f bssid device wifi list)"})
diff --git a/Completion/Linux/Command/_nsenter b/Completion/Linux/Command/_nsenter
new file mode 100644
index 000000000..8e7c6bc42
--- /dev/null
+++ b/Completion/Linux/Command/_nsenter
@@ -0,0 +1,28 @@
+#compdef nsenter
+
+local ign
+(( $#words > 2 )) && ign='!'
+
+_arguments -S -s \
+ '(-a --all)'{-a,--all}'[enter all namespaces]' \
+ '(-t --target)'{-t+,--target=}'[specify target process to get namespaces from]:pid:_pids' \
+ '(-m --mount)'{-m-,--mount=-}'[enter mount namespace]::file:_files' \
+ '(-u --uts)'{-u-,--uts=-}'[enter UTS namespace (hostname etc)]::file:_files' \
+ '(-i --ipc)'{-i-,--ipc=-}'[enter System V IPC namespace]::file:_files' \
+ '(-n --net)'{-n-,--net=-}'[enter network namespace]::file:_files' \
+ '(-p --pid)'{-p-,--pid=-}'[enter pid namespace]::file:_files' \
+ '(-C --cgroup)'{-C-,--cgroup=-}'[enter cgroup namespace]::file:_files' \
+ '(-U --user)'{-U-,--user=-}'[enter user namespace]::file:_files' \
+ '(-T --time)'{-T-,--time=-}'[enter time namespace]::file:_files' \
+ '(-S --setuid)'{-S+,--setuid=}'[set uid in entered namespace]:uid [0]' \
+ '(-G --setgid)'{-G+,--setgid=}'[set gid in entered namespace]:gid [0]' \
+ "--preserve-credentials[don't touch uids or gids]" \
+ '(-r --root)'{-r+,--root=}'[set the root directory]:directory:_directories' \
+ '(-w --wd)'{-w+,--wd=}'[set the working directory]:directory:_directories' \
+ '(-F --no-fork)'{-F,--no-fork}"[don't fork]" \
+ '(-Z --follow-context)'{-Z,--follow-context}'[set SELinux context according to --target PID]' \
+ "${ign}(- 1 *)"{-h,--help}'[display usage information]' \
+ "${ign}(- 1 *)"{-V,--version}'[display version information]' \
+ '1: : _command_names -e' \
+ '*::args :_normal'
+
diff --git a/Completion/Linux/Command/_perf b/Completion/Linux/Command/_perf
new file mode 100644
index 000000000..dd9621606
--- /dev/null
+++ b/Completion/Linux/Command/_perf
@@ -0,0 +1,809 @@
+#compdef perf
+
+local curcontext="$curcontext" curstate state line expl nm="$compstate[nmatches]"
+local -a args opts cmd fields sortkeys
+local -A exclude full short
+local -i i skip
+
+exclude=(
+ --add \* --cgroup \* --definition \* --del \*
+ --detailed \* --dlarg \* --dsos \* --event \* --events \*
+ --fields \* --funcs \* --node-info \* --symbols \* --vars \*
+ --gtk '(--stdio --stdio2 --tui)'
+ --tui '(--gtk --stdio --stdio2)'
+ --stdio '(--gtk --tui --stdio2)'
+ --stdio2 '(--gtk --tui --stdio)'
+ --log-fd '(--output)'
+ --output '(--log-fd)'
+ --tracer '(-G --graph-funcs -g --nograph-funcs -F --funcs)'
+ --graph-funcs '(-g --nograph-funcs -N --notrace-funcs -T --trace-funcs -t --tracer)*'
+ --nograph-funcs '(-G --graph-funcs -N --notrace-funcs -T --trace-funcs -t --tracer)*'
+ --trace-funcs '(-N --notrace-funcs -G --graph-funcs -g --nograph-funcs -t --tracer)*'
+ --notrace-funcs '(-T --trace-funcs -G --graph-funcs -g --nograph-funcs -t --tracer)*'
+ --source '!(--no-source)'
+)
+
+full=(
+ --addr-range '=[list traced records within address range]:range'
+ --affinity '=[set affinity mask of trace reading thread]:affinity:(node cpu)'
+ --aio '=[specify number of control blocks in asynchronous trace writing mode]:control blocks (1-4) [1]'
+ --all-cgroups '[record cgroup events]'
+ --all-cpus '[system-wide collection from all CPUs]'
+ --asm-raw '[show raw instruction encoding of assembly instructions]'
+ --aux-sample '=[sample AUX area]::options'
+ --baseline-only '[show only items with match in baseline]'
+ --branch-any '[sample any taken branches]'
+ --branch-filter '=[enable taken branch stack sampling]:mask'
+ --branch-stack '[use branch records for per branch histogram filling]'
+ --buffer-size '=[size of per-cpu buffer]: :_numbers size B K M G'
+ --build-ids '[inject build-ids into the output stream]'
+ --buildid-all '[handle build-id of all DSOs]'
+ --call-graph '=[enable call-graph (stacktrace) recording]:(fp dwarf)'
+ --cgroup '=[monitor event in named cgroup only]:cgroup'
+ --children '[accumulate callchains of children and show total overhead]'
+ --clang-opt '=:clang option'
+ --clang-path '=:clang binary:_command_names -e'
+ --clockid '=[specify clockid to use for events]:clock id'
+ --coalesce '=:coalesce field:_sequence compadd - pid tid iaddr dso'
+ --color-cpus '=[highlight given CPUs in map]:cpus'
+ --color-pids '=[highlight given pids in map]: :_sequence _pids'
+ --column-widths '=[use fixed column widths]:widths (comma-separated)'
+ --comms '=[restrict to specified comms]:comms'
+ --compression-level '=[produce compressed trace using specified level]:level (1-22) [1]'
+ --compute '=[set comparison method]:comparison method [delta-abs]:(delta delta-abs ratio wdiff)'
+ --control '=[listen on ctl-fd descriptor for command to control measurement]:descriptor'
+ --count '=[specify event period]:period'
+ --count-filter '=[only display functions with more than given number of events]:minimum number of events'
+ --cpu '=[restrict to specified CPUs]:cpus'
+ --cpus '=[restrict to specified CPUs]:cpus'
+ --cycles-hist '[show cycles histogram and standard deviation]'
+ --data '[record the sample addresses]'
+ --data-page-size '[record the sampled data address data page size]'
+ --definition '=[show trace-event definition converted from given probe-event]:event'
+ --delay '=[specify delay before starting measurement after program start]:delay (ms)'
+ --demangle '[demangle symbols]'
+ --demangle-kernel '[demangle kernel symbols]'
+ --detailed '[detailed run - start a lot of events]'
+ --disassembler-style '=[specify disassembler style]:style'
+ --dlarg '=:dlfilter argument'
+ --dlfilter '=[filter sample events using the given shared object]:file:_files -g "*.so(-.)"'
+ --dry-run '[parse options then exit]'
+ --dsos '=[only consider symbols in these dsos]:dso'
+ --dump-raw-trace '[dump raw trace in ASCII]'
+ --dump-symtab '[dump the symbol table used for profiling]'
+ --duration '=[show only events with duration over threshold]:minimum duration (ms)'
+ --entries '=[specify how many functions to display]:number of functions'
+ --event '=[select the PMU event]:event:->events'
+ --exclude-other '[only display entries with parent-match]'
+ --exclude-perf "[don't record events from perf itself]"
+ --exec '=[specify path to executable or shared library]:file:_files'
+ --expr '=[specify syscalls/events to trace]:syscall or event'
+ --field-separator '=[specify field separator]:separator'
+ --fields '=[specify output field]:field:->fields'
+ --filter '=[event filter]:filter'
+ --filter-pids '=[specify pids to filter]: :_sequence _pids'
+ --for-each-cgroup '=[expand events for each cgroup]:cgroup'
+ --force "[don't complain, do it]"
+ --format '=[specify output formatting style]:style:(default simple)'
+ --formula '[show formula]'
+ --freq '=[specify profile frequency]:frequency (Hz)'
+ --func-opts '=[specify function tracer options]:option:_sequence compadd - call-graph irq-info'
+ --funcs '=[show available functions]::filter'
+ --graph-funcs '=[select function_graph tracer and trace given functions]:function'
+ --graph-function '=[only print symbols and callees with --call-trace/--call-ret-trace]:symbol list'
+ --graph-opts '=[specify graph tracer options]: : _values -s , option nosleep-time noirqs verbose thresh\:duration depth\:depth'
+ --group '=[show event group information together]'
+ --group-sort-idx '=[sort output by specified event in group]:event index'
+ --gtk '[use the graphical interface]'
+ --guestkallsyms '=[provide copy of guest os /proc/kallsyms]:file:_files'
+ --guestmodules '=[provide copy of guest os /proc/modules]:file:_files'
+ --guestmount '=[specify guest os root file system mount directory]:path:_directories'
+ --guestvmlinux '=[provide guest os kernel]:kernel file:_files'
+ --hide_kernel_symbols '[hide kernel symbols]'
+ --hide_user_symbols '[hide user symbols]'
+ --hide-unresolved '[only display entries resolved to a symbol]'
+ --hierarchy '[show entries in a hierarchy]'
+ --ignore-callees '=[ignore callees of specified functions in call graphs]:functions (regex)'
+ --ignore-vmlinux '[ignore vmlinux files]'
+ --inherit '[trace child processes]'
+ --input '=[specify input file]:file:_files'
+ --interval-count '=[print counts for fixed number of times]:times'
+ --interval-print '=[print counts at regular interval]:interval (ms)'
+ --intr-regs '=[sample selected machine registers on interrupt]:register'
+ --inverted '[alias for inverted call graph]'
+ --iostat '=::default'
+ --itrace '=[specify instruction tracing options]:option:->itrace-opts'
+ --jit '[merge jitdump files into perf.data file]'
+ --kallsyms '=[specify kallsyms pathname]:path:_files'
+ --kcore '=[add specified kcore file to the cache]:file:_files'
+ --kernel '[show running kernel build id]'
+ --Latency '[show latency attributes (irqs/preemption disabled, etc)]'
+ --list '[list all cached files]'
+ --list-opts '[list available options]'
+ --log-fd '=[log output to file descriptor instead of stderr]:file descriptor:_file_descriptors'
+ --map-dump '=[specify BPF map to periodically dump]:BPF map'
+ --max-blocks '=[set maximum number of code blocks to dump with brstackinsn]:blocks'
+ --max-events '=[set maximum number of events to print]:events'
+ --max-size '=[limit the maximum size of the output file]: :_numbers size B K M G'
+ --max-stack '=[set maximum stack depth when parsing the callchain]:depth [kernel.perf_event_max_stack or 127]'
+ --metrics '=[monitor specified metrics or metric groups]:metric'
+ --min-stack '=[set minimum stack depth when parsing the callchain]:depth'
+ --mmap-flush '=[specify minimum size that is extracted from mmap data pages]: :_numbers -d 1 -u bytes size B K M G'
+ --mmap-pages '=[specify number of mmap data pages]:number of pages'
+ --modules '[load module symbols]'
+ --namespaces '[record namespaces events]'
+ --no-bpf-event "[don't record bpf events]"
+ --no-buildid "[don't collect buildids in perf.data]"
+ --no-buildid-cache "[don't update the buildid cache]"
+ --no-inherit "[child tasks don't inherit counters]"
+ --no-samples "[don't sample]"
+ --node-info '[show extra node info in report]'
+ --nograph-funcs "=[select function_graph tracer and don't trace given functions]:function"
+ --notrace-funcs "=[select function tracer and don't trace given functions]:function filter"
+ --null "[null run - don't start any counters]"
+ --num-thread-synthesize '=[specify number of threads to run for event synthesis]:threads'
+ --objdump '=[specify objdump binary to use for disassembly and annotations]:path:_command_names -e'
+ --order '=[specify compute sorting]:ordering [1]:((
+ 0\:baseline\ overhead
+ 1\:computed\ value\ of\ column\ 1))'
+ --output '=[specify output file]:file:_files'
+ --parent '=[filter by parent caller]:parent (regex)'
+ --percent-limit "=[don't show entries under specified percentage]:percent"
+ --percent-type '=[set annotation percent type]:compadd {local,global}{period,hits}'
+ --percentage '=[set display of filtered entries percentages]:display:(relative absolute)'
+ --phys-data '[record/report sample physical addresses]'
+ --pid '=[restrict to specified process id]:process: _sequence _pids'
+ --post '=[specify command to run after to the measured command]: :_cmdstring'
+ --pre '=[specify command to run prior to the measured command]: :_cmdstring'
+ --prefix '=[add prefix to source file path names]:prefix:_directories'
+ --prefix-strip '=[strip elements from source file path names]:elements'
+ --pretty '=[specify pretty printing style]:key:(normal raw)'
+ --proc-map-timeout '=[specify per-thread proc mmap processing timeout]:timeout (ms)'
+ --quiet "[don't print any messages]"
+ --raw-samples '[collect raw sample records from all opened counters]'
+ --raw-trace '[show raw trace event output]'
+ --realtime '=[profile --addevents with specified priority]:RT SCHED_FIFO priority'
+ --repeat '=[specify amount of times to repeat the run]:repetitions'
+ --samples '=[specify number of samples to save per histogram entry for individual browsing]:samples'
+ --sched-stat '[get details of how long tasks slept]'
+ --show-cpu-utilization '[show sample percentage for different cpu modes]'
+ --show-info '[display extended perf.data information]'
+ --show-nr-samples '[show a column with the number of samples]'
+ --show-on-off-events '[show the --switch-on/off events too]'
+ --show-round-events '[display finished round events]'
+ --show-switch-events '[display context switch events]'
+ --show-total-period '[show a column with the sum of periods]'
+ --skip-missing '--skip-missing[skip symbols that cannot be annotated]'
+ --snapshot '=[select AUX area tracing snapshot mode]::snapshot capturing parameter'
+ --socket-filter '=[only show processor socket that match specified filter]:filter'
+ --sort '=[sort by specified keys]:key:->sort-keys'
+ --stat '[per-thread counts]'
+ --stdio '[use the stdio interface]'
+ --stdio-color '=[specify when to use colors in output]:mode [always]:(always never auto)'
+ --stdio2 '[use the stdio2 interface, non-interactive, TUI formatting]'
+ --stitch-lbr '[enable LBR callgraph stitching approach]'
+ --stop-bt '=[stop display of callgraph at these symbols]:symbol list'
+ --stream '[enable hot streams comparison]'
+ --strip '[strip non-synthesized events]'
+ --summary '[show only syscall summary with statistics]'
+ --switch-max-files '=[limit number of generated files to keep]:limit'
+ --switch-off '=[stop considering events after occurrence of specified event]:event'
+ --switch-on '=[consider events after occurrence of specified event]:event'
+ --switch-output '=[specify when to rotate output file]::signal or size [USR2]:_signals'
+ --switch-output-event '=[switch output event selector]:event:->events'
+ --sym-annotate '=[specify symbol to annotate]:symbol'
+ --symbol '=[specify symbol]:symbol'
+ --symbol-filter '=[only show symbols that match filter]:filter'
+ --symbols '=[only consider specified symbols]:symbol'
+ --symfs '=[look symbol files relative to specified directory]:directory:_directories'
+ --sync '[call sync() before starting a run]'
+ --system '[read and write system config file]'
+ --target-ns '=[obtain mount namespace information form the target pid]:pid:_processes'
+ --td-level '=[set the metrics level for the top-down statistics]:level'
+ --tid '=[restrict to specified threads]:tids'
+ --time '=[specify time span of interest]:time span (start,stop)'
+ --time-quantum '=[set time quantum for time sort key]: :_numbers -d 100ms "time quantum" ms us ns s'
+ --timeout '=[stop workload and print counts after a timeout period]:timeout (ms)'
+ --timestamp-filename '[append timestamp to output file name]'
+ --trace-fields '[show tracepoint fields]'
+ --trace-funcs '=[select function tracer and set function filter]:function filter'
+ --tracer '=[specify tracer to use]:tracer:(function_graph function)'
+ --tui '[use the curses interface]'
+ --uid '=[profile events in threads owned by uid]:uid:_users'
+ --user '[read and write user config file]'
+ --user-regs '=[sample selected machine registers on interrupt]:registers'
+ --vars '=[show available local variables at given probe point]:probe'
+ --vcpu '=[specify vcpu id to report]:vcpu'
+ --verbose '[be more verbose]'
+ --vm-time-correlation '=[correlate time between VM guests and the host]::options'
+ --vmlinux '=[specify vmlinux path]:vmlinux pathname:_files'
+ --weight '[sample by weight (on special events only)]'
+ --with-hits '[show only DSOs with hits]'
+ --with-summary '[show all syscalls and summary with statistics]'
+ --zero '[zero history across updates]'
+)
+short=(
+ --add -a
+ --all-cpus -a
+ --baseline-only -b
+ --branch-any -b
+ --build-ids -b
+ --cpu -C
+ --coalesce -c
+ --compute -c
+ --count -c
+ --delay -D
+ --dump-raw-trace -D
+ --data -d
+ --dsos -d
+ --event -e
+ --fields -F
+ --formula -F
+ --freq -F
+ --funcs -F
+ --force -f
+ --cgroup -G
+ --graph-funcs -G
+ --with-hits -H
+ --intr-regs -I
+ --show-info -I
+ --input -i
+ --no-inherit -i
+ --branch-filter -j
+ --jit -j
+ --clockid -k
+ --key -k
+ --vmlinux -k
+ --list -l
+ --disassembler-style -M
+ --buffer-size -m
+ --mmap-pages -m
+ --modules -m
+ --node-info -N
+ --no-buildid-cache -N
+ --no-samples -n
+ --show-nr-samples -n
+ --order -o
+ --output -o
+ --pid -p
+ --quiet -q
+ --raw-samples -R
+ --realtime -r
+ --repeat -r
+ --snapshot -S
+ --symbols -S
+ --with-summary -S
+ --sched-stat -s
+ --script -s
+ --sort -s
+ --summary -s
+ --timestamp -T
+ --tid -t
+ --tracer -t
+ --uid -u
+ --verbose -v
+ --weight -W
+ --column-widths -w
+ --field-separator -x
+ --compression-level -z
+ --zero -z
+)
+
+cmd=( $words[1] )
+(( $#words > 2 )) && ign='!'
+
+_arguments -C -A "-*" \
+ "${ign}(- *)"{-v,--version}'[display version information]' \
+ "${ign}(- *)"{-h,--help}'[display usage information]' \
+ "${ign}(- *)-vv[print the compiled-in status of libraries]" \
+ '(- *)--exec-path[display or set exec path]' \
+ '(- *)--html-path[display html documentation path]' \
+ "${ign}(- *)--list-opts[list available options]" \
+ "${ign}(- *)--list-cmds[list available subcommands]" \
+ '!(-p --paginate --no-pager)'{-p,--paginate} \
+ --no-pager \
+ '--buildid-dir=[setup buildid cache directory]: :_directories' \
+ '--debugfs-dir=[set debugfs directory]: :_directories' \
+ '--debug=[setup debug variable]: : _values -s, "debug option"
+ verbose\:level ordered-events data-convert stderr perf-event-open' \
+ '1: :->subcmds' \
+ '*:: :->args'
+
+while (( $#state )); do
+ curstate=$state
+ shift state
+ case $curstate in
+ subcmds)
+ subcmds=(
+ ${${${(f)"$(_call_program subcmds $cmd)"}[3,-2]## ##}/ ##(#m)?/:$MATCH[-1]:l}
+ 'help:display help information about perf'
+ )
+ _describe 'subcommand' subcmds
+ ;;
+ subsubcmds)
+ _description commands expl command
+ compadd "$expl[@]" -a subcmds
+ ;;
+ args)
+ (( $#words < 3 )) && ign=''
+ cmd+=( $words[1] )
+ curcontext="${curcontext%:*:*}:${(j.-.)cmd}:"
+ args=()
+ skip=0
+ case ${(j.-.)cmd[2,-1]} in
+ kvm-*|top|stat)
+ full[--group]='[put the counters into a counter group]'
+ ;|
+ bench-[^-]##(|-all)) skip=1 opts=() subcmds=() ;|
+
+ annotate)
+ full+=(
+ --full-paths "[don't shorten the displayed pathnames]"
+ --print-line "[print matching source lines (may be slow)]"
+ )
+ short+=(
+ --print-line -l
+ --full-paths -P
+ --symbol -s
+ )
+ args+=(
+ "--no-source[don't interleave source code with assembly code]"
+ '1:: :_guard "^-*" "symbol name"'
+ )
+ ;;
+
+ archive)
+ _arguments --help '1:file:_files'
+ break
+ ;;
+
+ bench)
+ short+=(
+ --edge -E
+ --format -f
+ --nfds -f
+ --group -g
+ --iterations -i
+ --loop -l
+ --nr_loops -l
+ --nr-mmaps -m
+ --multiq -m
+ --nested -N
+ --noaffinity -n
+ --nonblocking -B
+ --nr-samples -n
+ --pipe -p
+ --randomize -R
+ -fruntime -r
+ --size -s
+ --thread -t
+ --threaded -T
+ )
+ args=(
+ '1:subsystem:(sched syscall mem numa futex epoll internals all)'
+ '*:: :->args'
+ )
+ full+=(
+ --group '=[specify number of groups]:groups'
+ --nr_loops '=[specify number of loops to run]:loops [100]'
+ --pipe '[use pipe() instead of socketpair()]'
+ --runtime '=[specify runtime]:runtime (seconds)'
+ --thread '[be multi thread instead of multi process]'
+ --threads '=[specify number of threads]:threads'
+ --loop '=[specify number of loops]:loops'
+ --iterations '=[number of iterations used to compute average]:iterarions'
+ --threaded '[specify threads/process based task setup]'
+ --size '=[specify size of memory buffers]: :_numbers -d 1MB size B KB MB GB TB'
+ )
+ ;;
+ bench-sched) args=( '1:suite:(all messaging pipe)' '*:: :->args' ) ;;
+ bench-numa) args=( '1:suite:(all mem)' '*:: :->args' ) ;;
+ bench-mem) args=( '1:suite:(all memcpy memset find_bit)' '*:: :->args' ) ;;
+ bench-futex)
+ args=( '1:suite:(all hash wake wake-parallel requeue lock-pi)' '*:: :->args' )
+ ;;
+ bench-epoll) args=( '1:suite:(all wait ctl)' '*:: :->args' ) ;;
+ bench-internals) args=( '1:suite:(all synthesize kallsyms-parse inject-build-id)' '*:: :->args' ) ;;
+ bench-syscall) args=( '1:suite:(all basic)' '*:: :->args' ) ;;
+
+ buildid-cache)
+ full+=(
+ --add '=[add specified file to the cache]:file:_files'
+ --debuginfod '=[specify debuginfod URL to be used when retrieving perf.data binaries]:url:_urls'
+ --missing '=[list missing build ids in the cache for the specified]:file:_files'
+ --purge '=[purge all cached binaries including older caches which have specified path from the cache]:path:_files'
+ --purge-all '[purge all cached binaries - flush out entire cache]'
+ --remove '=[remove a cached binary which has same build-id of specified file from the cache]:file:_files'
+ --update '=[update specified file of the cache]:file:_files'
+ )
+ short+=(
+ --kcore -k
+ --missing -M
+ --purge -p
+ --purge-all -P
+ --remove -r
+ --update -u
+ )
+ ;;
+ c2c)
+ args+=( '1:commands:(record report)' '*:: :->args' )
+ ;;
+ daemon)
+ full+=(
+ --base '=[specify base directory]:base directory:_directories'
+ --config '=[specify config file path]:config file:_files'
+ --foreground "[don't put process in background]"
+ --session '=[apply to specific session]:session'
+ )
+ short[--foreground]=-f
+ args=( '1:action:(start stop signal ping)' '*:: :->args' )
+ ;;
+ (kvm-|)buildid-list)
+ short[--kernel]=-k
+ ;;
+ config)
+ full[--list]='[show current config variables]'
+ ;;
+ data)
+ full+=(
+ --all '[convert all events]'
+ --to-json '=[convert to JSON format]:output file:_files'
+ --to-ctf '=[convert to CTF format]:output file:_files'
+ --tod '[convert time to wall clock time]'
+ )
+ exclude+=(
+ --to-ctf '(--to-json)'
+ --to-json '(--to-ctf)'
+ )
+ ;;
+ (kvm-|)diff)
+ short+=(
+ --baseline-only -b
+ --compute -c
+ --comms -C
+ --field-separator -t
+ --formula -F
+ --order -o
+ --period -p
+ )
+ full+=(
+ --period '[show period values]'
+ )
+ unset 'short[--pid]'
+ unset 'short[--tid]'
+ sortkeys=( pid comm dso symbol cpu parent srcline )
+ ;;
+ evlist)
+ short+=( --group -g )
+ ;;
+ ftrace)
+ short+=(
+ --nograph-funcs -g
+ --graph-funcs -G
+ --buffer-size -m
+ --notrace-funcs -N
+ --trace-funcs -T
+ --tracer -t
+ )
+ unset 'short[--tid]'
+ ;;
+ help*)
+ short+=( -a --all -i --info -m --man -w --web )
+ ;;
+ inject)
+ short+=( --jit -j --build-ids -b --sched-stat -s )
+ ;;
+ kmem)
+ full+=(
+ --alloc '[show per-allocation statistics]'
+ --caller '[show per-callsite statistics]'
+ --raw-ip '[show raw ip instead of symbol]'
+ --line '=[show specified number of lines]:lines'
+ --live '[show live page stat]'
+ --slab '[analyze SLAB allocator events]'
+ --page '[analyze page allocator events]'
+ )
+ short[--line]=-l
+ sortkeys=(
+ ptr callsite bytes hit pingpong frag
+ page order migtype gfp
+ )
+ ;;
+ list)
+ short+=( --desc -d --long-desc -v )
+ full+=(
+ --desc '[print extra event descriptions]'
+ --details '[print information on the perf event names and expressions used internally by events]'
+ --long-desc '[print longer event descriptions]'
+ )
+ args=( '*::events:->event-types' )
+ ;;
+ lock-info)
+ short[--map]=-m
+ short[--threads]=-t
+ full+=(
+ --map '[dump map of lock instances (address:name table)]'
+ --threads '[dump thread list in perf.data]'
+ )
+ ;;
+ lock-report)
+ full[--key]='=[specify sort key]:key [acquired]:(acquired contended avg_wait wait_total wait_max wait_min)'
+ ;;
+ mem)
+ short[--phys-data]=-p
+ short[--type]=-t
+ short[--dump-raw-samples]=-D
+ full[--type]='=[select the memory operation type]:type:(load store)'
+ full[--dump-raw-samples]='[dump raw samples in ASCII]'
+ ;;
+ probe)
+ full+=(
+ --add '=[probe point definition]:probe'
+ --del '=[delete a probe event]:probe event'
+ --filter '=[set a filter]:filter'
+ --line '[show source code lines which can be probed]'
+ --max-probes '=[set how many probe points can be found for a probe]:probes'
+ --module '=[specify target module name or path]:module name or path:_directories'
+ --range '[show variables location range in scope]'
+ --source '=[specify path to kernel source]:path:_directories'
+ )
+ short+=(
+ --definition -D
+ --del -d
+ --exec -x
+ --line -L
+ --module -m
+ --dry-run -n
+ --source -s
+ --vars -V
+ )
+ unset 'exclude[--source]'
+ unset 'short[--list]'
+ ;;
+ timechart-record)
+ short+=( --io-only -I --callchain -g )
+ full+=(
+ --callchain '[record callchain]'
+ --io-only '[record only IO data]'
+ )
+ ;;
+ *record)
+ short+=(
+ --data -d
+ --clockid -k
+ --no-samples -n
+ --no-buildid -B
+ --no-buildid-cache -N
+ --period -P
+ --stat -s
+ )
+ full+=(
+ --overwrite '[use overwrite mode]'
+ --period '[record the sample period]'
+ --timestamp '[record the sample timestamps]'
+ --transaction '[sample transaction flags (special events only)]'
+ )
+ ;;
+ (c2c-|kvm-|)report)
+ short+=(
+ --branch-stack -b
+ --comms -c
+ --inverted -G
+ --call-graph -g
+ --parent -p
+ --threads -T
+ --field-separator -t
+ --exclude-other -x
+ )
+ full+=(
+ --threads '[show per-thread event counters]'
+ )
+ unset 'short[--pid]'
+ unset 'short[--tid]'
+ sortkeys=(
+ pid comm dso symbol parent cpu socket srcline weight local_weight cgroup_id
+ )
+ fields=(
+ overhead period sample overhead overhead_sys overhead_us
+ overhead_guest_sys overhead_guest_us overhead_children
+ sample period pid comm dso symbol parent cpu socket
+ srcline srcfile local_weight weight transaction trace
+ symbol_size dso_size cgroup cgroup_id ipc_null time
+ code_page_size local_ins_lat ins_lat p_stage_cyc dso_from
+ dso_to symbol_from symbol_to mispredict abort in_tx
+ cycles srcline_from srcline_to ipc_lbr symbol_daddr
+ dso_daddr locked tlb mem snoop dcacheline symbol_iaddr
+ phys_daddr data_page_size blocked
+ )
+ ;;
+ sched-latency)
+ short+=(
+ --CPU -C
+ --pids -p
+ )
+ full+=(
+ --pids '[latency stats per pid instead of per comm]'
+ --CPU '=[specify CPU to profile on]:cpu'
+ )
+ ;;
+ sched-timehist)
+ short+=(
+ --idle-hist -I
+ --migrations -M
+ --next -n
+ --cpu-visual -V
+ --wakeups -w
+ )
+ full+=(
+ --cpu-visual '[add CPU visual]'
+ --idle-hist '[show idle events only]'
+ --migrations '[show migration events]'
+ --next '[show next task]'
+ --state '[show task state when sched-out]'
+ --wakeups '[show wakeup events]'
+ )
+ ;;
+ (*-|)script)
+ short+=( --comms -c --gen-script -g --Latency -L --debug-mode -d )
+ full+=(
+ --debug-mode '[do various checks like samples ordering and lost events]'
+ --gen-script '=[generate perf-script.xx script in specified language]:language'
+ --script '=[specify script file name]:script file name:_files'
+ )
+ unset 'short[--pid]'
+ unset 'short[--dsos]'
+ unset 'short[--tid]'
+ fields=(
+ comm tid pid time cpu event trace ip sym dso addr symoff
+ srcline period iregs uregs brstack brstacksym flags
+ bpf-output brstackinsn brstackoff callindent insn insnlen
+ synth phys_addr metric misc ipc tod data_page_size
+ code_page_size
+ )
+ ;;
+ *stat*)
+ full+=(
+ --big-num "[print large numbers with thousands' separators]"
+ --delay '=[wait after starting program]:delay (msecs)'
+ --key '=[specify key for sorting]:key:(sample time)'
+ --no-aggr '[disable CPU count aggregation]'
+ --transaction '[hardware transaction statistics]'
+ )
+ short+=(
+ --no-aggr -A
+ --big-num -B
+ --detailed -d
+ --group -g
+ --interval-print -I
+ --metrics -M
+ --null -n
+ --sync -S
+ --transaction -T
+ )
+ exclude+=(
+ --log-fd '(-o --output)'
+ --output '(--log-fd)'
+ )
+ unset 'short[--quiet]'
+ ;;
+ test*)
+ short+=( --dont-fork -F --skip -s )
+ full+=(
+ --dont-fork "[don't fork for testcase]"
+ --skip '=[specify tests to skip]:test'
+ )
+ ;;
+ timechart)
+ short+=( --width -w --topology -t --proc-num -n --process -p )
+ full+=(
+ --highlight '=[highlight tasks that outlast duration or with given name]:duration or name'
+ --io-skip-eagain "[don't draw EAGAIN IO events]"
+ --io-min-time '=[all IO faster than minimum time will visually appear longer]: :_numbers -u ns -d 1ms time ms us'
+ --io-merge-dist '=[merge events that are within specified time]: :_numbers -u ns -d 1us time ms us'
+ --process '=[select process]:process:_pids'
+ --proc-num '=[specify minimum number of tasks to print]:tasks'
+ --topology '[sort CPUs according to topology]'
+ --width '=[specify page width]:page width'
+ )
+ ;;
+ (kvm-|)top)
+ full+=(
+ --delay '=[specify delay between refreshes]:delay (seconds)'
+ --comms '=[only consider symbols in specified comms]:comm'
+ --dsos '=[only consider symbols in these dsos]:dso'
+ --overwrite '[use a backward ring buffer]'
+ )
+ short+=(
+ --count-filter -f
+ --delay -d
+ --dump-symtab -D
+ --entries -E
+ )
+ unset 'short[--dsos]'
+ unset 'short[--fields]'
+ unset 'short[--force]'
+ unset 'short[--symbols]'
+ sortkeys=(
+ pid comm dso symbol parent srcline weight local_weight
+ abort in_tx transaction overhead sample period
+ )
+ fields=( overhead period sample $sortkeys )
+ ;;
+ trace)
+ short+=(
+ --pf -F
+ --summary -s
+ --time -T
+ )
+ full+=(
+ --pf '=[trace pagefaults]::type [maj]:(all min maj)'
+ --time '[show full timestamp, not relative]'
+ )
+ unset 'short[--no-inherit]'
+ ;;
+ esac
+ if (( !skip )); then
+ subcmds=( $(_call_program commands "$cmd --list-cmds|grep -v -e '^#' -e Unknown") )
+ opts=( $(_call_program options "$cmd --list-opts|grep -v -e '^#' -e Unknown") )
+ fi
+
+ for (( i = $#opts; i; i-- )); do
+ opts[i]=(
+ ${exclude[$opts[i]]}${opts[i]}${full[$opts[i]]}
+ ${short[$opts[i]]:+${exclude[$opts[i]]}${short[$opts[i]]}${full[$opts[i]]/(#s)=/+}}
+ )
+ done
+ (( $#subcmds)) && opts+=(
+ "${ign}(- *)--list-cmds[list available subcommands]" \
+ '1: :->subsubcmds'
+ '*:: :->args'
+ )
+ (( $#opts )) && opts+=(
+ "${ign}(- *)--help[display help information]"
+ "${ign}(- *)--list-opts[list available options]"
+ )
+ _arguments -C $opts $args \
+ "${ign}(- *)-h[display brief usage summary]"
+ ;;
+ event-types)
+ _wanted event-types expl 'event type' compadd - hw sw cache pmu tracepoint event_glob
+ ;&
+ events)
+ _wanted events expl event compadd - \
+ ${${=${${(f)"$(_call_program events perf list hw sw cache pmu tracepoint event_glob)"}[2,-5]# }%% [ \[]*}:#OR}
+ ;;
+ itrace-opts)
+ _values -s '' "itrace option [ibxwpe]" \
+ 'i[synthesize instructions events]' \
+ 'b[synthesize branches events (branch misses for Arm SPE)]' \
+ 'c[synthesize branches events (calls only)]' \
+ 'r[synthesize branches events (returns only)]' \
+ 'x[synthesize transactions events]' \
+ 'w[synthesize ptwrite events]' \
+ 'p[synthesize power events (incl. PSB events for Intel PT)]' \
+ 'o[synthesize other events recorded due to the use of aux-output]' \
+ 'e[synthesize error events]' \
+ 'd[create a debug log]' \
+ 'f[synthesize first level cache events]' \
+ 'm[synthesize last level cache events]' \
+ 'M[synthesize memory events]' \
+ 't[synthesize TLB events]' \
+ 'a[synthesize remote access events]' \
+ 'g[synthesize a call chain (use with i or x)]' \
+ 'G[synthesize a call chain on existing event records]' \
+ 'l[synthesize last branch entries (use with i or x)]' \
+ 'L[synthesize last branch entries on existing event records]' \
+ 's[skip initial number of events]' \
+ 'q[quicker (less detailed) decoding]' \
+ 'Z[prefer to ignore timestamps (so-called "timeless" decoding)]'
+ ;;
+ fields)
+ _sequence _wanted fields expl 'field' compadd - -a fields
+ ;;
+ sort-keys)
+ _sequence _wanted sort-keys expl 'sort key' compadd - -a sortkeys
+ ;;
+ esac
+done
+
+[[ nm -ne compstate[nmatches] ]]
diff --git a/Completion/Linux/Command/_pidof b/Completion/Linux/Command/_pidof
index 05fb23d45..dd0649ce9 100644
--- a/Completion/Linux/Command/_pidof
+++ b/Completion/Linux/Command/_pidof
@@ -9,6 +9,8 @@ _arguments -C -s -w \
'(- *)'{-V,--version}'[print program version]' \
"(-s --single-shot $exargs)"{-s,--single-shot}'[return one PID only]' \
"(-c --check-root $exargs)"{-c,--check-root}'[omit processes with different root]' \
+ '-q[quiet mode, only set the exit code]' \
+ '(-w --with-workers)'{-w,--with-workers}'[show kernel workers too]' \
"(-x $exargs)"-x'[include shells running named scripts]' \
"($exargs)"\*{-o+,--omit-pid=}'[omit processes with PIDs]:pids:_sequence -s , _pids' \
'(-S --separator)'{-S+,--separator=}'[specify separator put between PIDs]:separator' \
diff --git a/Completion/Linux/Command/_setpriv b/Completion/Linux/Command/_setpriv
new file mode 100644
index 000000000..196f2f627
--- /dev/null
+++ b/Completion/Linux/Command/_setpriv
@@ -0,0 +1,107 @@
+#compdef setpriv
+
+__setpriv_prctl_securebits_set_elements() {
+ local -a expl
+ local -a bits
+
+ bits=(
+ noroot noroot_locked
+ no_setuid_fixup no_setuid_fixup_locked
+ keep_caps_locked
+ )
+
+ if ! compset -P '[+-]'; then
+ _description minus-or-plus expl "-/+"
+ compadd "${(@)expl}" -qS '' {+,-}
+ return
+ fi
+
+ _description minus-plus-securebits expl "prctl securebit"
+ compadd "${(@)expl}" "$@" -a - bits
+}
+
+__setpriv_numbered_caps() {
+ # The cap_ prefix.
+ # We override the suffix from _sequence with -S '' to stay adjacent
+ # to the following number.
+ if ! compset -P cap_; then
+ compadd -S '' "$@" -n - cap_
+ return
+ fi
+ # A capability number; i.e. a non-negative integer.
+ # We can't complete integers, so no matches.
+ if ! compset -P '[0-9]##'; then
+ local -a expl
+ _description -x numbers expl "capability number"
+ compadd -S '' "${(@)expl}" -n -
+ return
+ fi
+ # The numbered cap expression is complete.
+ compadd "$@" -n - ''
+}
+
+__setpriv_cap_set_elements() {
+ # '-' or '+', followed by one of the following:
+ # - a capability name
+ # - the word 'all'
+ # - 'cap_[0-9]+' (to specify unknown capabilities).
+ if ! compset -P '[+-]'; then
+ local -a expl
+ _description minus-or-plus expl "-/+"
+ compadd "${(@)expl}" -qS '' + -
+ return
+ fi
+
+ # We pass through compadd options generated by _sequence.
+ local -a sequence_argv=( "$@" )
+
+ _alternative -O sequence_argv \
+ 'special-words:drop/obtain all caps:(all)' \
+ 'capabilities: :_capabilities' \
+ 'numbered-capabilities:cap_N:__setpriv_numbered_caps' \
+ #
+}
+
+__setpriv_death_signals() {
+ _alternative \
+ 'special-words:keep or clear:(keep clear)' \
+ 'signals:UNIX signal:_signals' \
+ #
+}
+
+local curcontext="$curcontext" state state_descr line
+typeset -A opt_args
+
+_arguments -C -S -s \
+ '(- : *)'{-h,--help}'[print help and exit]' \
+ '(- : *)'{-V,--version}'[print version information and exit]' \
+ '(- : *)'{-d,--dump}'[display the current privilege state]:*: :->option-dump' \
+ '(--groups --init-groups --keep-groups)--clear-groups[clear supplementary groups]' \
+ '(--clear-groups --init-groups --keep-groups)--groups[set supplementary groups]: : _sequence _groups' \
+ '(--clear-groups --groups --init-groups)--keep-groups[preserve supplementary groups]' \
+ '(--clear-groups --groups --keep-groups)--init-groups[initialize supplementary groups]' \
+ '--inh-caps[set inheritable caps]: : _sequence __setpriv_cap_set_elements' \
+ '--ambient-caps[set ambient caps]: : _sequence __setpriv_cap_set_elements' \
+ '--bounding-set[set the cap bounding set]: : _sequence __setpriv_cap_set_elements' \
+ '(- : *)--list-caps[list all known capabilities]' \
+ '--no-new-privs[set NO_NEW_PRIVS]' \
+ '--rgid[set real UNIX group id]:UNIX group:_groups' \
+ '--egid[set effective UNIX group id]:UNIX group:_groups' \
+ '--regid[set real and effective UNIX group id]:UNIX group:_groups' \
+ '--ruid[set real UNIX user id]:UNIX user:_users' \
+ '--euid[set effective UNIX user id]:UNIX user:_users' \
+ '--reuid[set real and effective UNIX user id]:UNIX user:_users' \
+ '--securebits[set "process securebits"]: : _sequence __setpriv_prctl_securebits_set_elements' \
+ '--pdeathsig[keep, clear, or set parent death signal]: : __setpriv_death_signals' \
+ '--selinux-label[request a selinux label]:SELinux labels: ' \
+ '--apparmor-profile[request an apparmor profile]:AppArmor profiles: ' \
+ '--reset-env[set environment as for a classic login shell]' \
+ '*:::command:_normal' \
+ && return 0
+
+case $state in
+ option-dump)
+ _arguments -S '*'{-d,--dump}'[display the current privilege state]'
+ ;;
+ *) ;;
+esac
diff --git a/Completion/Linux/Command/_sshfs b/Completion/Linux/Command/_sshfs
index 3363ecdc0..3467fbd8a 100644
--- a/Completion/Linux/Command/_sshfs
+++ b/Completion/Linux/Command/_sshfs
@@ -19,8 +19,14 @@ _arguments -C -S : \
':mountpoint:_files -/' && ret=0
if [[ $state == options ]]; then
- _values -s , "sshfs or fuse or mount options" \
+ # TODO complete ssh(1) options
+ _values -s , "options to ssh, sshfs, mount, or FUSE" \
+ 'port:number' \
+ 'compression: :(yes no)' \
reconnect delay_connect sshfs_sync no_readahead sync_readdir \
+ sshfs_debug \
+ 'cache: :(yes no)' \
+ 'cache_timeout:timeout (seconds)' \
'dir_cache:cache setting:(yes no)' \
'dcache_max_size:size [10000]' \
'dcache_timeout:timeout (seconds) [20]' \
@@ -37,12 +43,13 @@ if [[ $state == options ]]; then
sftp_server:path:_files \
directport:port:_ports \
slave disable_hardlink transform_symlinks follow_symlinks no_check_root password_stdin \
+ debug \
allow_other allow_root auto_unmount nonempty default_permissions \
fsname:filesystem\ name \
subtype:filesystem\ type \
large_read \
max_read:max\ size \
- hard_remove use_ino readdir_ino direct_io kernel_cache auto_cache \
+ hard_remove use_ino readdir_ino direct_io kernel_cache auto_cache noauto_cache \
'umask:permissions' \
'uid:owner' 'gid:group' \
'entry_timeout:timeout (seconds) [1]' \
@@ -60,7 +67,7 @@ if [[ $state == options ]]; then
congestion_threshold:threshold \
async_read sync_read atomic_o_trunc big_writes no_remote_lock no_remote_flock \
no_remote_posix_lock splice_write splice_move splice_read \
- from_code:charset to_code:charset subdir:_directories rellinks && ret=0
+ from_code:charset to_code:charset subdir:_directories rellinks norellinks && ret=0
fi
return ret
diff --git a/Completion/Linux/Command/_strace b/Completion/Linux/Command/_strace
index 7d4595a33..b3b6f5096 100644
--- a/Completion/Linux/Command/_strace
+++ b/Completion/Linux/Command/_strace
@@ -1,50 +1,66 @@
#compdef strace strace64
-local curcontext="$curcontext" state line root expl ret=1
+local curcontext="$curcontext" root
+local -i prec=1 form=1 ret=1
+local -a state line expl alts suf
typeset -A opt_args
-(( EUID )) && root='!'
+(( EUID && ! $+_comp_priv_prefix )) && root='!'
_arguments -C -s \
- '-a+[align return values in a specific column]:column number [40]' \
- '(-c)-i[print instruction pointer at time of syscall]' \
- '-o+[write the trace output to the file]:output file:->file-pipe' \
- '-q[suppress messages about attaching, detaching etc.]' \
- '(-q)-qq[suppress messages about process exit status]' \
- '(-c)-r[print a relative timestamp upon entry to each system call]' \
- '-s+[specify the maximum string size to print]:maximum string size [32]' \
- '(-c -ttt)-t[prefix each line of the trace with the time of day]' \
- '(-c -ttt -tt)-tt[prefix each line of the trace with the time of day including the microseconds]' \
- '(-c -tt -t)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]' \
- '(-c)-T[show the time spent in system calls]' \
- '(-xx)-x[print all non-ASCII strings in hexadecimal string format]' \
- '(-x)-xx[print all strings in hexadecimal string format]' \
- '-X+[set the format for printing of named constants and flags]:format:(raw abbrev verbose)' \
- '(-c -yy)-y[print paths associated with file descriptor arguments]' \
- '(-c -y)-yy[print protocol specific information associated with socket file descriptors]' \
- '(-C -i -k -r -ff -t -tt -ttt -T -y -yy)-c[count time, calls, and errors for each system call and report a summary]' \
- '(-c)-C[count time, calls, and errors for each system call and report a summary in addition to regular output]' \
- '-O+[overhead for tracing system calls]:overhead (microseconds)' \
- '-S+[sort the output of the histogram (-c option) by the specified criterion]:sort criterion [time]:(time calls errors name nothing)' \
- '-w[summarise syscall latency]' \
- '*-e+[select events to trace or how to trace]:system call:->expressions' \
- '*-P+[trace only system calls accessing given path]:path:_files' \
- '(-Z)-z[trace only system calls that return success]' \
- '(-z)-Z[trace only system calls that return an error]' \
- '-b+[detach from process on specified syscall]:syscall:(execve)' \
- '-f[trace child processes as they are created by currently traced processes]' \
- '(-c -C)-ff[write each process trace to <filename>.<pid> (when using -o <filename>]' \
- '-D[run tracer as detached grandchild, keeping traced process as direct child of calling process]' \
- '-I+[when strace can be interrupted by signals]:interruptible:((1\:"no signals are blocked" 2\:"fatal signals are blocked while decoding syscall (default)" 3\:"fatal signals are always blocked (default with -o)" 4\:"fatal signals and SIGTSTP are always blocked"))' \
- '*-E+[set or remove exported environment variable]:variable:->envars' \
- "${root}-u+[run as specified user]:user:_users" \
- '(:)*-p+[attach to the process with specified process ID and begin tracing]:process ID:_pids' \
+ \*{-E+,--env=}'[set or remove exported environment variable]:variable:->envars' \
+ '(:)*'{-p+,--attach=}'[attach to the process with specified process ID and begin tracing]:process ID:_pids' \
+ "${root}(-u --user)"{-u+,--user=}'[run as specified user]:user:_users' \
+ '(-b --detach-on)'{-b+,--detach-on=}'[detach from process on specified syscall]:syscall:(execve)' \
+ '(--daemonize)-D[run tracer as detached grandchild, keeping traced process as direct child of calling process]' \
+ '(-D)--daemonize=-[specify how to run tracer process]::method:(grandchild pgroup session)' \
+ '(-f --follow-forks)'{-f,--follow-forks}'[trace child processes as they are created by currently traced processes]' \
+ '(-I --interruptible)'{-I+,--interruptible=}'[specify when strace can be interrupted by signals]:interruptible:((1\:"no signals are blocked" 2\:"fatal signals are blocked while decoding syscall (default)" 3\:"fatal signals are always blocked (default with -o)" 4\:"fatal signals and SIGTSTP are always blocked"))' \
+ \*{-e+,--trace=}'[select events to trace or how to trace]:system call:->expressions' \
+ \*{-P+,--path=}'[trace only system calls accessing given path]:path:_files' \
+ '(-z -Z --successful-only --failed-only)'{-z,--successful-only}'[trace only system calls that return success]' \
+ '(-z -Z --successful-only --failed-only)'{-Z,--failed-only}'[trace only system calls that return an error]' \
+ '(-a --columns)'{-a+,--columns=}'[align return values in a specific column]:column number [40]' \
+ '(-i --instruction-pointer -c --summary-only)'{-i,--instruction-pointer}'[print instruction pointer at time of syscall]' \
+ '(-c --summary-only -k --stack-traces)'{-k,--stack-traces}'[obtain stack trace between each syscall]' \
+ '(-n --syscall-number)'{-n,--syscall-number}'[print syscall number]' \
+ '(-o --output)'{-o+,--output=}'[send trace output to the specified file]:output file:->file-pipe' \
+ '(-A --output-append-mode)'{-A,--output-append-mode}'[open the file provided with the -o option in append mode]' \
+ '--output-separately[output to separate files for child processes (by appending pid to file names)]' \
+ '(--quiet)-q[suppress messages about attaching, detaching etc]' \
+ '(-q --quiet)-qq[suppress messages about process exit status]' \
+ '(-q -qq --quiet)-qqq[suppress all suppressible messages]' \
+ '(-q -qq -qqq)--quiet=[suppress messages about attaching, detaching etc]:suppression:_sequence compadd - attach personality exit all' \
+ '(--relative-timestamps -c --summary-only)-r[print a relative timestamp upon entry to each system call]' \
+ '(-r -c --summary-only)--relative-timestamps=-[print a relative timestamp upon entry to each system call]:precision [us]:compadd -o nosort s ms us ns' \
+ '(--absolute-timestamps)-t[prefix each line of the trace with the wall clock time]' \
+ '(-t)--absolute-timestamps=-[prefix each line of the trace with the wall clock time]:: :->time-formats' \
+ '!(-t --absolute-timestamps)--timestamps=-:: :->time-formats' \
+ '(-s --string-limit)'{-s+,--string-limit=}'[specify the maximum string size to print]:maximum string size [32]' \
+ '(-c --summary-only -ttt)-t[prefix each line of the trace with the time of day]' \
+ '(-c --summary-only -ttt -tt)-tt[prefix each line of the trace with the time of day including the microseconds]' \
+ '(-c --summary-only -tt -t)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]' \
+ '(--syscall-times -c --summary-only)-T[show the time spent in system calls]' \
+ '(-T -c --summary-only)--syscall-times=-[show the time spent in system calls]::precision [us]:compadd -o nosort s ms us ns' \
+ '(-v --no-abbrev)'{-v,--no-abbrev}'[print unabbreviated versions of environment, stat, termios, etc. calls]' \
+ '(-xx --strings-in-hex)-x[print all non-ASCII strings in hexadecimal string format]' \
+ '(-x --strings-in-hex)-xx[print all strings in hexadecimal string format]' \
+ '(-x -xx)--strings-in-hex=[specify strings to print in hexadecimal format]:string type:(all non-ascii)' \
+ '(-X --const-print-style)'{-X+,--const-print-style=}'[set the format for printing of named constants and flags]:format:(raw abbrev verbose)' \
+ '(-c --summary-only -yy --decode-fds)-y[print paths associated with file descriptor arguments]' \
+ '(-c --summary-only -y --decode-fds)-yy[print protocol specific information associated with socket file descriptors]' \
+ '(-c --summary-only -y -yy)--decode-fds=-[print information associated with file descriptors]::information [none]:_sequence compadd - none all path socket dev pidfd' \
+ '(-c --summary-only -C --summary -i --instruction-pointer -k --stack-traces -r --relative-timestamps -ff -t -tt -ttt --absolute-timestamps -T --syscall-times -y -yy --decode-fds)'{-c,--summary-only}'[count time, calls, and errors for each system call and report a summary]' \
+ '(-c --summary-only -C --summary)'{-C,--summary}'[count time, calls, and errors for each system call and report a summary in addition to regular output]' \
+ '(-O --summary-syscall-overhead)'{-O+,--summary-syscall-overhead=}'[specify overhead for tracing system calls]:overhead (microseconds)' \
+ '(-S --summary-sort-by)'{-S+,--summary-sort-by=}'[sort the output of the histogram (-c option) by the specified criterion]:sort criterion [time]:(time min-time max-time avg-time calls errors name nothing)' \
+ '(-U --summary-columns)'{-U+,--summary-columns=}'[show specific columns in the summary report]:column:_sequence compadd - time-percent total-time min-time max-time avg-time calls errors name' \
+ '(-w --summary-wall-clock)'{-w,--summary-wall-clock}'[summarise syscall latency]' \
+ '(-c --summary-only -C)-ff[write each process trace to <filename>.<pid> (when using -o <filename>]' \
+ '(-d --debug)'{-d,--debug}'[show debug output of strace itself on standard error]' \
+ '(- 1 *)'{-h,--help}'[display help information]' \
'--seccomp-bpf[enable seccomp-bpf filtering]' \
- '-d[show debug output of strace itself on standard error]' \
- '-v[print unabbreviated versions of environment, stat, termios, etc. calls]' \
- '(- 1 *)-h[display help information]' \
- '(- 1 *)-V[display version information]' \
- '(-c)-k[obtain stack trace between each syscall]' \
+ '(- 1 *)'{-V,--version}'[display version information]' \
'(-):command name: _command_names -e' \
'*::arguments:_normal' && ret=0
@@ -61,7 +77,9 @@ case $state in
'fault[perform syscall fault injection]:system call:_sys_calls -a -n' \
'inject[perform syscall tampering]:system call:_sys_calls -a -n' \
'status[trace system calls with given return status]:status:->status' \
- 'kvm[print the exit reason of kvm vcpu]: :(vcpu)' && ret=0
+ 'quiet[suppress various information messages]:message [none]:_sequence compadd - none attach exit path-resolution personality thread-execve superseded' \
+ 'kvm[print the exit reason of kvm vcpu]: :(vcpu)' \
+ 'decode-fds[print information associated with file descriptors]:information [none]:_sequence compadd - none all path socket dev pidfd' && ret=0
if [[ $state = status ]]; then
_values -s , 'return status [all]' \
all successful failed \
@@ -69,15 +87,17 @@ case $state in
'unavailable[system calls that return but strace fails to fetch the error]' \
'detached[system calls where strace detaches before the return]' && ret=0
elif [[ $words[CURRENT] != *=* || $state = syscalls ]]; then
- local dedup sets suf="-qS,"
+ local dedup sets
compset -P '!'
dedup=( ${(Ms.,.)PREFIX##*,} ${(Ms.,.)SUFFIX%%,*} )
- compset -S ',*' || suf=""
+ compset -S ',*' || suf=( "-qS," )
compset -P '*,'
if compset -P /; then
_wanted syscalls expl "system call (regex)" _sys_calls -a -n $suf -F dedup && ret=0
else
sets=(
+ '%clock:trace system calls that read or modify system clocks'
+ '%creds:trace system calls that read or modify user and group identifiers or capability sets'
{%,}'file:trace all system calls which take a file name as an argument'
{%,}'process:trace all system calls which involve process management'
{%net,{%,}network}':trace all the network related system calls'
@@ -122,6 +142,22 @@ case $state in
_parameters -qS= -g "*export*" && ret=0
fi
;;
+ time-formats)
+ alts=()
+ compset -P '(precision:*|s|ms|us|ns),' && prec=0
+ compset -P '(format:*|none|time|unix),' && form=0
+ compset -S ',*' || (( !prec + !form )) || suf=( -S , )
+ if compset -P 'precision:'; then
+ form=0
+ elif compset -P 'format:'; then
+ prec=0
+ else
+ alts=( 'prefixes:prefix:compadd -S ":" ${${(s. .):-format x}[form]} ${${(s. .):-precision x}[prec]}' )
+ fi
+ (( prec )) && alts+=( 'precisions:precision [s]:compadd -o nosort $suf s ms us ns' )
+ (( form )) && alts+=( 'formats:format [time]:compadd $suf none time unix' )
+ _alternative $alts && ret=0
+ ;;
esac
return ret
diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat
index e091dd3ea..5620da73d 100644
--- a/Completion/Linux/Command/_sysstat
+++ b/Completion/Linux/Command/_sysstat
@@ -11,6 +11,7 @@ _mpstat() {
'--dec=-[specify the number of decimal places to use]:decimal places [2]:(0 1 2)' \
'-o[display statistics in JSON]:format:(JSON)' \
'(-A)-P[specify processor number]:processor: _values -s "," processor ALL {0..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \
+ '-T[display topology elements in the CPU report]' \
'-u[report CPU utilization]' \
'(- 1 2)-V[display version information]' \
'1: : _guard "^-*" interval' \
@@ -26,6 +27,7 @@ _cifsiostat() {
'-t[print timestamp for each report]' \
'(- 1 2)-V[print version number]' \
'--human[print sizes in human readable format]' \
+ '--pretty[make the CIFS report easier to read by a human]' \
'1: : _guard "^-*" interval' \
'2: : _guard "^-*" count'
}
@@ -49,8 +51,8 @@ _sadf() {
'-H[display only the header of the report]' \
'(-g -j -p -r -x)-h[print on a single line when used with -d]' \
'-O[specify output options]: : _values -s , option
- autoscale height\:value oneday packed showidle showinfo skipempty showhints' \
- '-P[restrict processor dependant statistics]:processor number(zero indexed) or ALL:(ALL)' \
+ autoscale bwcol customcol height\:value oneday packed showidle showinfo showtoc skipempty hz\:value pcparchive\:name\:_files debug' \
+ '-P[restrict processor dependent statistics]:processor number(zero indexed) or ALL:(ALL)' \
'--dev=-[specify block devices for which statistics are to be displayed]:block device:_files -g "*(-%)"' \
'--fs=-[specify filesystems for which statistics are to be displayed]:file system:_dir_list -s ,' \
'--iface=-[specify network interfaces for which statistics are to be displayed]:network interface:_sequence _net_interfaces' \
@@ -66,6 +68,7 @@ _sadf() {
'-d[output file in SQL format]' \
'-g[print data in SVG format]' \
'-j[output file in JSON]' \
+ '-l[export the contents of the data file to a PCP (Performance Co-Pilot) archive]' \
'-p[print in format parsable by tools like awk]' \
'-r[print raw contents of data file]' \
'-x[output file in XML]' \
@@ -96,16 +99,16 @@ _sar() {
'(--human -p)-h[make output easier to read: implies --human and -p]' \
'(- 1 2)--help[display usage information]' \
'--human[print sizes in human readable format]' \
- '*-I[report statistics for interrupts]:interrupts: _values -s "," interrupts 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SUM ALL XALL' \
+ '*-I[report statistics for interrupts]: : _values -s "," interrupt 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SUM ALL XALL' \
'-i[select records as close as possible to interval]:interval' \
'--iface=-[specify network interfaces for which statistics are to be displayed]:network interface:_sequence _net_interfaces' \
'-j[display persistent device names]:type:(ID LABEL PATH UUID)' \
- '-m[report power management statistics]:keywords: _values -s "," keywords CPU FAN FREQ IN TEMP USB ALL' \
- '-n[report network statistics]:keywords: _values -s "," keywords DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 FC SOFT ALL' \
+ '-m[report power management statistics]:keyword:_sequence compadd - CPU FAN FREQ IN TEMP USB ALL' \
+ '-n[report network statistics]:keyword:_sequence compadd - DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 FC SOFT ALL' \
'-o[save readings to file in binary form]:file:_files' \
'-P[report per-processor statistics]:processor: _values -s "," processors ALL' \
'-p[pretty-print device names]' \
- '-q[report queue length and load averages]' \
+ '-q[report queue length and load averages]::keyword:(CPU IO LOAD MEM PSI ALL)' \
'-R[report memory statistics]' \
'-r[report memory utilization statistics]:: :(ALL)' \
'-S[report swap space utilization]' \
diff --git a/Completion/Linux/Command/_tpb b/Completion/Linux/Command/_tpb
index c4c4c2bbd..2bdee0942 100644
--- a/Completion/Linux/Command/_tpb
+++ b/Completion/Linux/Command/_tpb
@@ -9,7 +9,7 @@ _arguments \
'(-x --xevents)'{-x,--xevents=}':state:(on off)' \
'(-m --mixer)'{-m,--mixer=}':state:(on off)' \
'(-o --osd)'{-o,--osd=}':state:(on off)' \
- '(-p --poll)'{-p,--poll=}':delay in microseconds:' \
+ '(-p --poll)'{-p,--poll=}':delay (microseconds)' \
'(-t --thinkpad)'{-t,--thinkpad=}':command to execute:_command_names' \
'(-H --home)'{-H,--home=}':command to execute:_command_names' \
'(-S --search)'{-S,--search=}':command to execute:_command_names' \
diff --git a/Completion/Linux/Command/_unshare b/Completion/Linux/Command/_unshare
new file mode 100644
index 000000000..ff6f7042f
--- /dev/null
+++ b/Completion/Linux/Command/_unshare
@@ -0,0 +1,40 @@
+#compdef unshare
+
+local ign
+(( $#words > 2 )) && ign='!'
+
+# a different unshare exists on some systems
+if [[ $OSTYPE != linux* ]]; then
+ _default
+ return
+fi
+
+_arguments -S -s \
+ '(-m --mount)'{-m-,--mount=-}'[enter mount namespace]::file:_files' \
+ '(-u --uts)'{-u-,--uts=-}'[enter UTS namespace (hostname etc)]::file:_files' \
+ '(-i --ipc)'{-i-,--ipc=-}'[enter System V IPC namespace]::file:_files' \
+ '(-n --net)'{-n-,--net=-}'[enter network namespace]::file:_files' \
+ '(-p --pid)'{-p-,--pid=-}'[enter pid namespace]::file:_files' \
+ '(-U --user)'{-U-,--user=-}'[enter user namespace]::file:_files' \
+ '(-C --cgroup)'{-C-,--cgroup=-}'[enter cgroup namespace]::file:_files' \
+ '(-T --time)'{-T-,--time=-}'[enter time namespace]::file:_files' \
+ '(-f --fork)'{-f,--fork}"[fork before launching]" \
+ '(-r --map-root-user)--map-user=[map current user to uid (implies --user)]:user:_users' \
+ '--map-group=[map current group to gid (implies --user)]:group:_groups' \
+ '(-r --map-root-user -c --map-current-user --map-user)'{-r,--map-root-user}'[map current user to root (implies --user)]' \
+ '(-c --map-current-user)'{-c,--map-current-user}'[map current user to itself (implies --user)]' \
+ '(-f --fork)--kill-child=-[when dying, kill the forked child (implies --fork)]::signal [KILL]:_signals' \
+ '--mount-proc=-[mount proc filesystem first (implies --mount)]::mount point [/proc]:_directories' \
+ '--propagation=[modify mount propagation in mount namespace]:propagation flag:(slave shared private unchanged)' \
+ '--setgroups=[control the setgroups syscall in user namespaces]:grant setgroups:(allow deny)' \
+ '--keep-caps[retain capabilities granted in user namespaces]' \
+ '(-R --root)'{-R+,--root=}'[set the root directory]:directory:_directories' \
+ '(-w --wd)'{-w+,--wd=}'[set the working directory]:directory:_directories' \
+ '(-S --setuid)'{-S+,--setuid=}'[set uid in entered namespace]:uid [0]' \
+ '(-G --setgid)'{-G+,--setgid=}'[set gid in entered namespace]:gid [0]' \
+ '--monotonic=[set clock monotonic offset in time namespaces]:offset (seconds)' \
+ '--boottime=[set clock boottime offset in time namespaces]:offset (seconds)' \
+ "${ign}(- 1 *)"{-h,--help}'[display usage information]' \
+ "${ign}(- 1 *)"{-V,--version}'[display version information]' \
+ '1: : _command_names -e' \
+ '*::args :_normal'
diff --git a/Completion/Linux/Command/_valgrind b/Completion/Linux/Command/_valgrind
index 4a710e7f7..b4bb3248e 100644
--- a/Completion/Linux/Command/_valgrind
+++ b/Completion/Linux/Command/_valgrind
@@ -20,7 +20,7 @@ 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'
+ '--xtree-memory-file=-[specify xtree memory report file]:file [xtmemory.kcg.%%p]:_files'
)
common_read_varinfo=(
@@ -67,7 +67,7 @@ args_addrcheck=(
'(--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'
+ '--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
@@ -123,7 +123,7 @@ args_cachegrind=(
'--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'
+ '--cachegrind-out-file=-[specify output file name]:file name [cachegrind.out.%%p]:_files'
)
args_helgrind=(
@@ -169,7 +169,7 @@ args_massif=(
))"
'--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'
+ '--massif-out-file=-[specify output file name]:filename [massif.out.%%p]:_files'
)
args_exp_bbv=(
@@ -205,6 +205,7 @@ _arguments -C ${(P)args} $cmd \
'(--version)--tool=-[specify valgrind tool]:valgrind tool:->tools' \
'(-h --help)'{-h,--help}'[show help information]' \
'--help-debug[show help info including debugging options]' \
+ '--help-dyn-options[show the dynamically changeable options]' \
'(-)--version[show version]' \
'(-q --quiet)'{-q,--quiet}'[run silently; only print error msgs]' \
'(-v --verbose)'{-v,--verbose}'[be more verbose]' \
diff --git a/Completion/Linux/Command/_wipefs b/Completion/Linux/Command/_wipefs
index 5142def8a..8642aab92 100644
--- a/Completion/Linux/Command/_wipefs
+++ b/Completion/Linux/Command/_wipefs
@@ -19,6 +19,7 @@ _arguments -s -S \
'(H -p --parsable -i --no-headings -J --json)'{-p,--parsable}'[print out in parsable instead of printable format]' \
'(H -q --quiet)'{-q,--quiet}'[suppress output messages]' \
'(H -t --types)'{-t+,--types=}'[limit the set of filesystem, RAIDs or partition tables]:type:_file_systems' \
+ '(H)--lock=-[use exclusive device lock]::mode:(yes no nonblock)' \
'(H)*:disk device:_files -g "*(-%)" -P / -W /' \
+ '(H)' \
'(- *)'{-h,--help}'[display help information]' \
diff --git a/Completion/Linux/Type/_capabilities b/Completion/Linux/Type/_capabilities
new file mode 100644
index 000000000..8cb31878f
--- /dev/null
+++ b/Completion/Linux/Type/_capabilities
@@ -0,0 +1,65 @@
+#autoload
+
+# This function completes POSIX capabilities for Linux.
+# Many command line utilities expect different syntax to encode various kinds
+# of capability names or sets, so this function tries to be as generic as
+# possible. It accepts compadd options to allow variations on the exact
+# generated completion matches.
+#
+# Usage examples:
+#
+# Complete full capability names:
+# _capabilities -p cap_
+# Sort the completion list by capability number:
+# _capabilities -o nosort
+
+# The list of Linux capabilities is taken from include/uapi/linux/capability.h
+# and subject to the following pipe filter:
+# grep 'define CAP' | sed -r 's/^[[:space:]]*#define[[:space:]]+CAP_//; s/[[:space:]]+[0-9]+$//' | tr '[[:upper:]]' '[[:lower:]]'
+local -a caplist=(
+ chown
+ dac_override
+ dac_read_search
+ fowner
+ fsetid
+ kill
+ setgid
+ setuid
+ setpcap
+ linux_immutable
+ net_bind_service
+ net_broadcast
+ net_admin
+ net_raw
+ ipc_lock
+ ipc_owner
+ sys_module
+ sys_rawio
+ sys_chroot
+ sys_ptrace
+ sys_pacct
+ sys_admin
+ sys_boot
+ sys_nice
+ sys_resource
+ sys_time
+ sys_tty_config
+ mknod
+ lease
+ audit_write
+ audit_control
+ setfcap
+ mac_override
+ mac_admin
+ syslog
+ wake_alarm
+ block_suspend
+ audit_read
+ perfmon
+ bpf
+ checkpoint_restore
+)
+local -a expl
+
+_description capabilities expl "Linux capability"
+compadd "${(@)expl}" "$@" -a - caplist
diff --git a/Completion/Linux/Type/_fuse_values b/Completion/Linux/Type/_fuse_values
index be830cb40..211eb5b35 100644
--- a/Completion/Linux/Type/_fuse_values
+++ b/Completion/Linux/Type/_fuse_values
@@ -47,7 +47,7 @@ fvals=(
[[ -n $cvalsvar ]] && set -- "$@" ${(P)cvalsvar}
if [[ $# -eq 0 ]]; then
- set -- 'mount options' $fvals
+ set -- 'mount option' $fvals
else
set -- "$@" $fvals
fi
diff --git a/Completion/Mandriva/Command/_urpmi b/Completion/Mandriva/Command/_urpmi
index d897f2c4b..21c44ffaa 100644
--- a/Completion/Mandriva/Command/_urpmi
+++ b/Completion/Mandriva/Command/_urpmi
@@ -73,7 +73,7 @@ _urpmi() {
opts_net=(
"($help --wget)--curl[use curl to retrieve distant files]"
- "($help)--limit-rate[limit the download speed (b/s)]:download speed in b/s: "
+ "($help)--limit-rate[limit the download speed]:download speed (b/s)"
"($help)--proxy:proxy host:_hosts"
"($help)--proxy-user:proxy user:_users"
"($help --curl)--wget[use wget to retrieve distant files]"
@@ -131,7 +131,7 @@ _urpmi() {
"($help --no-probe --probe-hdlist)--probe-synthesis[try to find and use synthesis file]" \
"($help)--update[mark as update media]" \
"($help)--version[use specified distribution version]:Mandrake version: " \
- "($help)--virtual[create virtual media wich are always up-to-date]" \
+ "($help)--virtual[create virtual media which are always up-to-date]" \
"($help)-c[clean headers cache directory]" \
"($help)-f[force generation of hdlist files]" \
"($help --distrib):name of media: " \
@@ -286,7 +286,7 @@ _urpmi() {
"($help --all --interactive --name)--summary[print tag summary: summary]" \
"($help)--uniq[do not print identical lines]" \
"($help --all --interactive --name)--url[print tag url: url]" \
- "*:hdlist files:_files -g '*.cz(-.)'" \
+ "*:hdlist file:_files -g '*.cz(-.)'" \
&& ret=0
;;
esac
diff --git a/Completion/Redhat/Command/_dnf b/Completion/Redhat/Command/_dnf
index 82b9b188f..ce111f38f 100644
--- a/Completion/Redhat/Command/_dnf
+++ b/Completion/Redhat/Command/_dnf
@@ -1,78 +1,268 @@
#compdef dnf dnf-2 dnf-3
+#
+# based on dnf-4.2.18
+#
_dnf_helper() {
- compadd $($python_exec $helper "$@" -d 0 -q -C 2>/dev/null)
+ # Get the pathname of the python executable from the 1st line of dnf-2/dnf-3.
+ # Probably /usr/bin/python{2,3} or /usr/libexec/platform-python.
+ local shebang
+ read -u0 shebang < $(readlink -f /usr/bin/dnf)
+ local python_exec=${${shebang##\#! #}%% *}
+ local -a helper_script=(
+ 'import sys'
+ 'from dnf.cli.completion_helper import main'
+ 'main(sys.argv[1:])'
+ )
+ $python_exec -c ${(j.;.)helper_script} "$@" "$PREFIX" \
+ -d 0 -q -C --assumeno --nogpgcheck 2>/dev/null </dev/null
}
_dnf_query_db() {
- sqlite3 -batch -init /dev/null "$cache_file" "$1"
+ # $1: table name in the database ('available' or 'installed')
+ sqlite3 -batch -init /dev/null "$cache_file" \
+ "select pkg from $1 WHERE pkg LIKE '$PREFIX%$SUFFIX'"
}
-_dnf_disabled_repos() {
- _dnf_helper repolist disabled ""
+_dnf_repositories() {
+ # required option: -T (all|disabled|enabled)
+ local selected expl
+ zparseopts -D -E - T:=selected
+ selected=$selected[2]
+ _wanted $selected-repositories expl "$selected repository" \
+ compadd "$@" - $(_dnf_helper repolist --$selected)
}
-_dnf_enabled_repos() {
- _dnf_helper repolist enabled ""
+_dnf_packages() {
+ # required option: -T (all|available|installed|upgradable)
+ local selected pkgs expl
+ zparseopts -D -E - T:=selected
+ selected=$selected[2]
+ if [[ $selected = upgradable ]]; then
+ pkgs=( $(_dnf_helper upgrade) )
+ elif [[ -r $cache_file ]]; then
+ local table=$selected
+ # 'available' table contains both 'available' and 'installed' packages
+ [[ $selected = all ]] && table=available
+ pkgs=( $(_dnf_query_db $table) )
+ if [[ $selected = available ]]; then
+ local inst=( $(_dnf_query_db installed) )
+ pkgs=( ${pkgs:|inst} ) # remove installed packages
+ fi
+ else
+ pkgs=( $(_dnf_helper list --$selected) )
+ fi
+ _wanted $selected-packages expl "$selected package" compadd "$@" -a pkgs
}
-_dnf_available_packages() {
- if [ -r $cache_file ]; then
- compadd $(_dnf_query_db "select pkg from available WHERE pkg LIKE \"$1%\"")
+_dnf_rpm_files() {
+ local expl
+ _wanted rpm-files expl 'rpm file' _files -g '(#i)*.rpm(-.)'
+}
+
+_dnf_packages_or_rpms() {
+ if [[ "$words[CURRENT]" = (*/*|\~*) ]]; then # if looks like a path name
+ _dnf_rpm_files
else
- _dnf_helper install "$1"
+ _dnf_packages "$@"
fi
}
-_dnf_installed_packages() {
- if [ -r $cache_file ]; then
- compadd $(_dnf_query_db "select pkg from installed WHERE pkg LIKE \"$1%\"")
- else
- _dnf_helper remove "$1"
+_dnf_groups_caching_policy() {
+ # TODO: Are there any reliable ways to validate the cache?
+ local -a newer=( "$1"(Nmw-1) ) # rebuild if more than a week old
+ return $#newer
+}
+
+_dnf_groups() {
+ local package_groups update_policy expl
+ zstyle -s ":completion:${curcontext}:" cache-policy update_policy
+ if [[ -z "$update_policy" ]]; then
+ zstyle ":completion:${curcontext}:" cache-policy _dnf_groups_caching_policy
+ fi
+ if _cache_invalid dnf-groups || ! _retrieve_cache dnf-groups; then
+ # this can be very slow
+ package_groups=( ${${${(M)${(f)"$(_call_program package-groups \
+ $service group list -v 2>/dev/null)"}:# *}#*\(}%\)*} )
+ _store_cache dnf-groups package_groups
fi
+ _wanted package-groups expl 'package group' compadd "$@" -a package_groups
}
-_dnf_local_packages() {
- _files -/ -g '(#i)*.rpm(-.)'
+_dnf_repoquery() {
+ local _h=''
+ # 'dnf deplist' is an alias for 'dnf repoquery --deplist'
+ [[ $words[1] = deplist ]] && _h='!'
+ local -a opts=( '(- *)--querytags[list tags recognized by --queryformat]' )
+ # Select options
+ opts+=(
+ '(-a --all)'{-a,--all}'[query all packages]'
+ '--arch=[limit results to specified architectures]:list of archs: '
+ '--available[limit results to available packages]'
+ '--disable-modular-filtering[include packages of inactive module streams]'
+ '(-f --file)'{-f+,--file=}'[limit results to packages which own specified file]:file:_files'
+ '--latest-limit=[limit results to latest packages of specified number]:number: '
+ '--recent[limit results to recently edited packages]'
+ '(--exactdeps)--alldeps[with --what{depends,requires}, also check non-explicit dependencies]'
+ '(--alldeps)--exactdeps[with --what{depends,requires}, check only explicit dependencies]'
+ '*--repo=[limit result to packages from the specified repo]: : _sequence _dnf_repositories -T all'
+ '--srpm[operate on the corresponding source RPM]'
+ '--whatdepends=[limit result to packages that require, enhance, recommend, suggest or supplement specified capability]:capability: '
+ )
+ for v in conflict enhance obsolete provide recommend require suggest supplement; do
+ opts+=( "--what${v}s=[limit result to packages that $v specified capability]:capability: " )
+ done
+ # Query options
+ opts+=(
+ '--location[show a location where package could be downloaded from]'
+ '--tree[display recursive tree of packages]'
+ $_h'--deplist[display list of all direct dependencies and their providers]'
+ '--recursive[query packages recursively]'
+ '--resolve[resolve capabilities to originating package(s)]'
+ )
+ # mutually exclusive Select options
+ opts+=(
+ + '(pkg_filter)'
+ '--duplicates[limit results to installed duplicate packages]'
+ '--installonly[limit results to installed installonly packages]'
+ '--unsatisfied[limit results to installed packages with unsatisfied dependencies]'
+ + '(list_group)'
+ '--installed[limit results to installed packages]'
+ '--extras[limit results to extra packages (not in any repos)]'
+ '--upgrades[limit results to upgrades for installed packages]'
+ '--unneeded[limit results to packages which are no longer needed]'
+ '--userinstalled[limit results to packages installed by user]'
+ )
+ # mutually exclusive Query options
+ opts+=(
+ + '(output_format)'
+ {-i,--info}'[show detailed info about the package]'
+ {-l,--list}'[show list of files in the packages]'
+ {-s,--source}'[show source RPM name]'
+ '--changelogs[print package changelogs]'
+ '--nvr[show found packages in name-version-release format]'
+ '--nevra[show found packages in name-epoch:version-release.architecture format]'
+ '--envra[show found packages in epoch:name-version-release.architecture format]'
+ {--qf=,--queryformat=}'[specify custom output format]:format: '
+ '--groupmember[display groups in which the package belongs]'
+ + '(pkg_attr)'
+ '--conflicts[display capabilities that the package conflicts with]'
+ '--depends[display capabilities that the package depends on, enhances, recommends, suggests or supplements]'
+ '--enhances[display capabilities that the package enhance]'
+ '--provides[display capabilities that the package provides]'
+ '--recommends[display capabilities that the package recommends]'
+ '--requires[display capabilities that the package depends on]'
+ '--requires-pre[display capabilities that the package depends on for running %pre script]'
+ '--suggests[display capabilities that the package suggests]'
+ '--supplements[display capabilities that the package supplements]'
+ '--obsoletes[display capabilities that the package obsoletes]'
+ )
+ _arguments : '*: : _dnf_packages -T all' $opts
}
-_dnf() {
- if [[ "$(readlink /usr/bin/dnf)" == "dnf-2" ]]; then
- local python_exec="/usr/bin/python2"
+_dnf_repository_packages() {
+ if (( CURRENT == 2 )); then
+ _dnf_repositories -T all
+ elif (( CURRENT == 3 )); then
+ local -a subcmds=(
+ 'check-update:check if updates are available in the repository'
+ 'info:list description of packages in the repository'
+ 'install:install all packages in the repository'
+ 'list:list packages in the repository'
+ 'move-to:reinstall all packages that are available in the repository'
+ 'reinstall:run reinstall-old, or move-to if it fails'
+ 'reinstall-old:reinstall all packages that were installed from the repository'
+ 'remove:remove all packages installed from the repository'
+ 'remove-or-distro-sync:sync packages with other repo if available there, or remove otherwise'
+ 'remove-or-reinstall:reinstall packages if available in other repo, or remove otherwise'
+ 'upgrade:update all packages in the repository'
+ )
+ _describe -t subcommands 'subcommand' subcmds
+ elif [[ $words[3] = (info|list) ]]; then
+ if (( CURRENT == 4 )); then
+ _wanted options expl "option" compadd - --all --installed --available \
+ --extras --obsoletes --recent --upgrades
+ else
+ _dnf_packages -T all
+ fi
+ elif [[ $words[3] = install ]]; then
+ _dnf_packages -T available
+ elif [[ $words[3] = upgrade* ]]; then
+ _dnf_packages -T upgradable
else
- local python_exec="/usr/bin/python3"
+ _dnf_packages -T installed
fi
- local helper=$(${python_exec} -c "import dnf.cli; print('{}/completion_helper.py'.format(dnf.cli.__path__[0]))")
- local cache_file="/var/cache/dnf/packages.db"
+}
- _arguments -s \
- '(- *)'{-h,--help}'[show the help message]' \
- '--version[show dnf version]' \
- '(-v --verbose)'{-v,--verbose}'[set verbose, show debug messages]' \
- '(-q --quiet)'{-q,--quiet}'[show just the relevant content]' \
- '--allowerasing[allow erasing of installed packages]' \
- '(-y --assumeyes)'{-y,--assumeyes}'[answer yes for all questions]' \
- '(-C --cacheonly)'{-C,--cacheonly}'[run entirely from cache]' \
- '(-c --config)'{-c,--config=}'[config file location]:config file:_files' \
- '(-R --randomwait)'{-R,--randomwait=}'[maximum command wait time (in minutes)]:max wait time' \
- '--releasever=[configure DNF for another release]:release' \
- '--refresh[set metadata as expired before running the command]' \
- '--nogpgcheck[skip checking GPG signatures on package]' \
- '--installroot=[set install root]:install root:_files -/' \
- '*--enablerepo=[enable one or more repositories]:repos to enable:_dnf_disabled_repos' \
- '*--disablerepo=[disable one or more repositories]:disable repos:_dnf_enabled_repos' \
- '*::dnf command:_dnf_command'
+_dnf() {
+ local cache_file="/var/cache/dnf/packages.db"
+ local -a opts=(
+ '(-6)-4[resolve to IPv4 addresses only]'
+ '(-4)-6[resolve to IPv6 addresses only]'
+ '*--advisory=[include packages for specified advisory]:advisory: '
+ '--allowerasing[allow erasing installed packages to resolve dependencies]'
+ '(-y --assumeyes)--assumeno[answer no for all questions]'
+ '(-b --best)'{-b,--best}'[try the best available package version]'
+ '--bugfix[include bugfix relevant packages]'
+ '*'{--bz=,--bzs=}'[include packages needed to fix the specified Bugzilla]:BZ ID: '
+ '(-C --cacheonly)'{-C,--cacheonly}"[run entirely from system cache, don't update cache]"
+ '--color=[control whether color is used]:when:(always never auto)'
+ '--comment=[add comment to transaction history]:comment: '
+ '(-c --config)'{-c+,--config=}'[specify configuration file]:config file:_files'
+ '*'{--cve=,--cves=}'[include packages needed to fix the specified CVE]:CVE ID: '
+ '(-d --debuglevel)'{-d+,--debuglevel=}'[specify debugging output level]:level (0-10): '
+ '--debugsolver[dump detailed solving results in file ./debugdata]'
+ '*--disableexcludes=[disable config file excludes]: : _alternative "sections\:section\:(all main)" "repositories\:repository\:_dnf_repositories -T all"'
+ '(--disable --set-disabled)'{--disable,--set-disabled}'[disable repos with config-manager command]'
+ '*--disableplugin=[disable specified plugins]:list of plugin names: '
+ '(--repo)*--disablerepo=[disable specified repos]: : _sequence _dnf_repositories -T enabled'
+ '(--downloaddir --destdir)'{--downloaddir=,--destdir=}'[redirect downloaded packages to the specified dir]:directory:_files -/'
+ '--downloadonly[only download the resolved packages]'
+ '(-e --errorlevel)'{-e+,--errorlevel=}'[specify error output level]:level (0-10): '
+ '(--enable --set-enabled)'{--enable,--set-enabled}'[enable repos with config-manager command]'
+ '--enableplugin=[enable specified plugins]:list of plugin names: '
+ '*--enablerepo=[enable additional repos]: : _sequence _dnf_repositories -T disabled'
+ '--enhancement[include enhancement relevant packages]'
+ '*'{-x+,--exclude=}'[exclude specified packages]: : _sequence _dnf_packages -T all'
+ '--forcearch=[force the use of the specified arch]:arch: '
+ '(-)'{-h,--help}'[show the help message]'
+ '--installroot=[set install root]:directory:_files -/'
+ '--newpackage[include newpackage relevant packages]'
+ '--noautoremove[disable removal of dependencies that are no longer used]'
+ '--nobest[do not limit transactions to best candidates]'
+ '--nodocs[do not install documentation]'
+ '--nogpgcheck[skip checking GPG signatures on packages]'
+ '--noplugins[disable all plugins]'
+ '--obsoletes[enable obsoletes processing logic]'
+ '(-q --quiet)'{-q,--quiet}'[show just the relevant content]'
+ '(-R --randomwait)'{-R+,--randomwait=}'[maximum command wait time]:max wait time (minutes): '
+ '--refresh[set metadata as expired before running the command]'
+ '--releasever=[configure DNF for another release]:release: '
+ '*--repofrompath=[specify additional repos]:repository_label,path_or_url: '
+ '(--disablerepo)*'{--repo=,--repoid=}'[enable just the specified repo]: : _sequence _dnf_repositories -T all'
+ '--rpmverbosity=[set RPM debug scriptlet output level]:debug level:(critical emergency error warn info debug)'
+ '*--sec-severity=[include security relevant packages matching specified severity]:severity:(Critical Important Moderate Low)'
+ '--security[include security relevant packages]'
+ '*--setopt=[override config option]:repoid.option=value: '
+ '--skip-broken[resolve depsolve problems by skipping packages]'
+ '--show-duplicates[show duplicate packages in repos]'
+ '(-v --verbose)'{-v,--verbose}'[set verbose, show debug messages]'
+ '(- *)--version[show dnf version]'
+ '(-y --assumeyes --assumeno)'{-y,--assumeyes}'[answer yes for all questions]'
+ )
+ _arguments -s : $opts '*::dnf command:_dnf_command'
}
_dnf_command() {
- local -a _dnf_cmds
- _dnf_cmds=(
+ local -a dnf_cmds=(
+ 'alias:define and manage aliases'
"autoremove:automatically remove no longer required packages"
+ 'check:report problems in local packagedb if any'
"check-update:check for available package upgrades"
"clean:remove cached data"
+ 'deplist:alias for "repoquery --deplist"'
"distro-sync:synchronize installed packages to the latest available versions"
"downgrade:downgrade a package"
- "erase:deprecated alias for remove"
"group:display, or use, the groups information"
"help:display a helpful usage message"
"history:display, or use, the transaction history"
@@ -81,117 +271,280 @@ _dnf_command() {
"list:list a package or groups of packages"
"makecache:generate the metadata cache"
"mark:mark or unmark installed packages as installed by user"
+ 'module:interact with modules'
"provides:find what package provides the given value"
"reinstall:reinstall a package"
"remove:remove a package or packages from your system"
"repolist:display the configured software repositories"
+ 'repoquery:search repos for packages and display info about them'
"repository-packages:run commands on top of all packages in given repository"
"search:search package details for the given string"
- "update:deprecated alias for upgrade"
+ 'shell:open an interactive shell'
+ 'swap:replace a package by another'
"updateinfo:display advisories about packages"
"upgrade:upgrade a package or packages on your system"
- "upgrade-to:upgrade a package on your system to the specified version"
+ 'upgrade-minimal:upgrade only bugfix, enhancement or security fix'
)
if (( CURRENT == 1 )); then
- _describe -t commands 'dnf command' _dnf_cmds || compadd "$@"
+ _describe -t dnf-commands 'dnf command' dnf_cmds
else
- local command="${${_dnf_cmds[(r)$words[1]:*]%%:*}}"
- # Deal with any aliases
- case $command in
- erase) command="remove";;
- whatprovides) command="provides";;
- update) command="upgrade";;
+ local curcontext=$curcontext cur=$words[CURRENT] cmd tmp expl ret=1
+ # Deal with aliases (not comprehensive)
+ case $words[1] in
+ check-updgrade) cmd=check-update;;
+ distrosync|dsync) cmd=distro-sync;;
+ dg) cmd=downgrade;;
+ erase|rm) cmd=remove;;
+ groups|grp) cmd=group;;
+ hist) cmd=history;;
+ in) cmd=install;;
+ mc) cmd=makecache;;
+ prov|whatprovides) cmd=provides;;
+ rei) cmd=reinstall;;
+ repoinfo) cmd=repolist;;
+ rq) cmd=repoquery;;
+ se) cmd=search;;
+ sh) cmd=shell;;
+ update|up) cmd=upgrade;;
+ update-minimal|up-min) cmd=upgrade-minimal;;
+ *) cmd="${${dnf_cmds[(r)$words[1]:*]%%:*}}";;
esac
+ (( $#cmd )) && curcontext="${curcontext%:*:*}:dnf-${cmd}:"
- _is_path() {
- [[ "$1" == *\/* ]] || [[ "$1" == \~* ]]
- }
-
- local cur=$words[CURRENT]
- local prev=""
- [[ $CURRENT > 2 ]] && prev=$words[$((CURRENT - 1))]
-
- case $command in
- install|upgrade|reinstall|info|check-update|distro-sync)
- if ! _is_path "$cur"; then
- _dnf_available_packages "$cur"
+ case $cmd in
+ alias)
+ if (( CURRENT == 2 )); then
+ _wanted subcommands expl 'subcommand' \
+ compadd - list add delete && ret=0
+ elif [[ $words[2] = add ]]; then
+ _message "name='value'" && ret=0
else
- _dnf_local_packages
+ _message "alias name" && ret=0
fi
;;
- remove|downgrade)
- if ! _is_path "$cur"; then
- _dnf_installed_packages "$cur"
- elif [[ "$command" == downgrade ]]; then
- _dnf_local_packages
+ autoremove|downgrade|reinstall)
+ _dnf_packages_or_rpms -T installed && ret=0
+ ;;
+ check)
+ tmp=(
+ '--all:show all problems (default)'
+ '--dependencies:show dependency problems'
+ '--duplicates:show duplicate problems'
+ '--obsoleted:show obsoleted packages'
+ '--provides:show problems with provides'
+ )
+ _describe -t options 'option' tmp && ret=0
+ ;;
+ check-update)
+ if [[ $cur = -* ]]; then
+ _wanted options expl 'option' compadd - --changelogs && ret=0
+ else
+ _dnf_packages -T installed && ret=0
fi
;;
- list|clean)
- _dnf_helper $command "$prev" "$cur"
+ clean)
+ tmp=(
+ 'dbcache:remove cache files generated from the repository metadata'
+ 'expire-cache:mark the repository metadata expired'
+ 'metadata:remove the repository metadata'
+ 'packages:remove any cached packages'
+ 'all:clean all'
+ )
+ _describe -t targets 'clean target' tmp && ret=0
+ ;;
+ distro-sync)
+ _dnf_packages -T installed && ret=0
;;
group)
- local -a _dnf_group_cmds
- _dnf_group_cmds=(
- "summary:display groups overview"
- "info:display package lists of a group"
- "install:install packages from a group"
- "list:list all matching groups"
- "remove:mark the group removed"
- "upgrade:upgrades the group and its packages"
- "mark:mark a group for installation or removal"
- )
if (( CURRENT == 2 )); then
- _describe -t commands 'dnf group command' _dnf_group_cmds
+ tmp=(
+ "summary:display groups overview"
+ "info:display package lists of a group"
+ "install:install packages from a group"
+ "list:list all matching groups"
+ "remove:remove packages in a group not used by other groups"
+ "upgrade:upgrade the group and its packages"
+ "mark:mark a group for installation or removal"
+ )
+ _describe -t subcommands 'subcommand' tmp && ret=0
+ elif (( CURRENT == 3 )) && [[ $cur = -* ]]; then
+ if [[ $words[2] == install ]]; then
+ _wanted options expl 'option' compadd - --with-optional && ret=0
+ elif [[ $words[2] == list ]]; then
+ tmp=(
+ '--available:show only available groups'
+ '--installed:show only installed groups'
+ '--hidden:show also hidden groups'
+ '--ids:show also ID of groups'
+ )
+ _describe -t options 'option' tmp && ret=0
+ fi
+ elif (( CURRENT == 3 )) && [[ $words[2] == mark ]]; then
+ _wanted subcommands expl 'subcommand' \
+ compadd - install remove && ret=0
+ else
+ _dnf_groups && ret=0
fi
;;
help)
if (( CURRENT == 2 )); then
- _dnf_helper '_cmds' ''
+ _wanted commands expl 'dnf command or alias' \
+ compadd - $(_dnf_helper '_cmds') && ret=0
fi
;;
history)
- local -a _dnf_history_cmds
- _dnf_history_cmds=(
- "list:list transactions"
- "info:describe the given transactions"
- "redo:repeat the specified transaction"
- "rollback:undo all since the given transaction"
- "undo:undo transactions"
- "userinstalled:list names of all packages installed by a user"
- )
if (( CURRENT == 2 )); then
- _describe -t commands 'dnf history command' _dnf_history_cmds
+ tmp=(
+ "list:list transactions"
+ "info:describe the given transactions"
+ "redo:repeat the specified transaction"
+ "rollback:undo all since the given transaction"
+ "undo:undo transactions"
+ "userinstalled:list all packages installed by users"
+ )
+ _describe -t subcommands 'subcommand' tmp && ret=0
+ elif [[ $words[2] != userinstalled ]]; then
+ _message 'transaction' && ret=0
+ fi
+ ;;
+ info|list)
+ if (( CURRENT == 2 )); then
+ if [[ $cur = -* ]]; then
+ tmp=( --all --available --installed --extras
+ --obsoletes --upgrades --autoremove --recent )
+ _wanted options expl 'option' compadd -a tmp
+ else
+ _dnf_packages -T all && ret=0
+ fi
+ elif [[ $words[2] == --(all|recent) ]]; then
+ _dnf_packages -T all && ret=0
+ elif [[ $words[2] == --available ]]; then
+ _dnf_packages -T available && ret=0
+ elif [[ $words[2] == --upgrades ]]; then
+ _dnf_packages -T upgradable && ret=0
else
- _dnf_helper $command "$prev" "$cur"
+ _dnf_packages -T installed && ret=0
fi
;;
+ install)
+ _dnf_packages_or_rpms -T available && ret=0
+ ;;
makecache)
if (( CURRENT == 2 )); then
- _values 'make cache' 'timer'
+ _describe -t options 'option' \
+ '(--timer:"be more resource-aware")' && ret=0
fi
;;
mark)
if (( CURRENT == 2 )); then
- _values 'mark' 'install' 'remove'
+ _wanted subcommands expl 'mark as' \
+ compadd - install remove group && ret=0
+ else
+ _dnf_packages -T installed && ret=0
+ fi
+ ;;
+ module)
+ if (( CURRENT == 2 )); then
+ tmp=(
+ 'install:install a module profile including its packages'
+ 'update:update packages associated with an active module stream'
+ 'remove:remove installed module profiles and their packages'
+ 'enable:enable a module stream'
+ 'disable:disable a module with all its streams'
+ 'reset:reset module state, no longer enabled or disabled'
+ 'provides:list modular packages, with modules they belong to'
+ 'list:list all (or selected) module streams, profiles and states'
+ 'info:print detailed information about a module'
+ 'repoquery:list packages belonging to a module'
+ )
+ _describe -t subcommands 'subcommand' tmp && ret=0
+ elif (( CURRENT == 3 )) && [[ $cur = -* ]]; then
+ if [[ $words[2] = remove ]]; then
+ tmp=( --all )
+ elif [[ $words[2] = list ]]; then
+ tmp=( --all --enabled --disabled --installed )
+ elif [[ $words[2] = info ]]; then
+ tmp=( --profile )
+ elif [[ $words[2] = repoquery ]]; then
+ tmp=( --available --installed )
+ fi
+ _wanted options expl 'option' compadd -a tmp && ret=0
else
- _dnf_installed_packages "$cur"
+ # TODO: complete module name or spec
+ if [[ $words[2] = provides ]]; then
+ _dnf_packages -T all && ret=0
+ elif [[ $words[2] = (disable|reset|list) ]]; then
+ _message 'module name' && ret=0
+ else
+ _message 'module spec' && ret=0
+ fi
fi
;;
provides)
- _files
+ _files && ret=0
+ ;;
+ remove)
+ if (( CURRENT == 2 )) && [[ $cur = -* ]]; then
+ _wanted options expl 'option' \
+ compadd - --duplicates --oldinstallonly && ret=0
+ elif [[ $words[2] != -* ]]; then
+ _dnf_packages_or_rpms -T installed && ret=0
+ fi
;;
repolist)
if (( CURRENT == 2 )); then
- _values 'repolist' 'enabled' 'disabled' 'all'
+ _wanted options expl 'option' \
+ compadd - --enabled --disabled --all && ret=0
fi
;;
+ repoquery|deplist)
+ _dnf_repoquery && ret=0
+ ;;
+ repository-packages)
+ _dnf_repository_packages
+ ;;
search)
+ if [[ $cur = -* ]]; then
+ _wanted options expl 'option' compadd - --all && ret=0
+ else
+ _message 'keywords' && ret=0
+ fi
+ ;;
+ shell)
if (( CURRENT == 2 )); then
- _values 'search' 'all'
+ _wanted script-files expl 'script file' _files && ret=0
fi
;;
+ swap)
+ case $CURRENT in
+ 2) _dnf_packages -T installed && ret=0 ;;
+ 3) _dnf_packages -T available && ret=0 ;;
+ esac
+ ;;
+ updateinfo)
+ tmp=(
+ '--with-cve[print only advisories referencing CVE]'
+ '--with-bz[print only advisories referencing bugzilla]'
+ + '(output-type)'
+ '--summary[display just counts of advisories of each type]'
+ '--list[display list of advisories]'
+ '--info[display detailed information of advisories]'
+ + '(availability)'
+ '--available[limit to advisories about newer versions of installed packages]'
+ '--installed[limit to advisories about equal or older versions of installed packages]'
+ '--updates[limit to advisories about newer and available versions of installed packages]'
+ )
+ _arguments '*: : _dnf_packages -T installed' $tmp && ret=0
+ ;;
+ upgrade)
+ _dnf_packages_or_rpms -T upgradable && ret=0
+ ;;
+ upgrade-minimal)
+ _dnf_packages -T upgradable && ret=0
+ ;;
esac
+ return ret
fi
}
diff --git a/Completion/Redhat/Command/_rpm b/Completion/Redhat/Command/_rpm
index e3469245f..d00f88429 100644
--- a/Completion/Redhat/Command/_rpm
+++ b/Completion/Redhat/Command/_rpm
@@ -129,6 +129,7 @@ _rpm () {
'--scm=[select the SCM to use with %autosetup]:scm [patch]:(patch gendiff git quilt)'
'*--buildpolicy=[set buildroot policy]:policy:->brp_policies'
'!--sign'
+ '--trace[trace macro expansion]'
"--nodebuginfo[don't generate debuginfo for this package]"
)
@@ -282,7 +283,7 @@ _rpm () {
build_r) tmp=( '*:source package:_files -g "*.(#i)src.rpm(-.)"' ) ;|
build_t) tmp=( '*:tar file:_files -g "*.(#i)tar(.*|)(-.)"' ) ;|
build_?)
- _arguments -s -C $buildopts $commonopts $pathopts \
+ _arguments -s -C $buildopts $commonopts $pathopts "${tmp[@]}" \
;;
checksig)
_arguments -s -C \!-K \
diff --git a/Completion/Redhat/Command/_yum b/Completion/Redhat/Command/_yum
index a30aa579f..9425ba57c 100644
--- a/Completion/Redhat/Command/_yum
+++ b/Completion/Redhat/Command/_yum
@@ -167,7 +167,7 @@ _yumdb() {
if [ "$cmd" = "help" ]; then
if (( CURRENT == 2 )); then
- _describe -t commands 'yum commands' _yum_cmds && ret=0
+ _describe -t commands 'yum command' _yum_cmds && ret=0
else
# help takes one argument
_message 'no more arguments'
diff --git a/Completion/Solaris/Command/_coreadm b/Completion/Solaris/Command/_coreadm
index 7262e6423..655b48e63 100644
--- a/Completion/Solaris/Command/_coreadm
+++ b/Completion/Solaris/Command/_coreadm
@@ -40,6 +40,6 @@ _arguments -s \
- set2 \
'-p[PID-specific per-process core file name pattern]:' \
'-P[PID-specific per-process core file content]:content:_values -s + "content" $content' \
- '*:pids:_pids' \
+ '*:pid:_pids' \
- set3 \
'-u[update options from coreadm.conf]'
diff --git a/Completion/Solaris/Command/_dhcpinfo b/Completion/Solaris/Command/_dhcpinfo
index 079b6e6f6..1dac684af 100644
--- a/Completion/Solaris/Command/_dhcpinfo
+++ b/Completion/Solaris/Command/_dhcpinfo
@@ -1,36 +1,32 @@
#compdef dhcpinfo
-_dhcpinfo() {
- local -a mnemonics_v4 mnemonics_v6
+local -a mnemonics_v4 mnemonics_v6
- mnemonics_v4=(
- Subnet UTCoffst Router Timeserv IEN116ns DNSserv Logserv
- Cookie Lprserv Impress Resource Hostname Bootsize Dumpfile
- DNSdmain Swapserv Rootpath ExtendP IpFwdF NLrouteF PFilter
- MaxIpSiz IpTTL PathTO PathTbl MTU SameMtuF Broadcst
- MaskDscF MaskSupF RDiscvyF RSolictS StaticRt TrailerF
- ArpTimeO EthEncap TcpTTL TcpKaInt TcpKaGbF NISdmain
- NISservs NTPservs NetBNms NetBDsts NetBNdT NetBScop
- XFontSrv XDispMgr LeaseTim Message T1Time T2Time NW_dmain
- NWIPOpts NIS+dom NIS+serv TFTPsrvN OptBootF MblIPAgt
- OptBootF MblIPAgt SMTPserv POP3serv NNTPserv WWWservs
- Fingersv IRCservs STservs STDAservs UserClas SLP_DA SLP_SS
- AgentOpt FQDN PXEarch BootFile BootPath BootSrvA BootSrvN
- EchoVC LeaseNeg
- )
+mnemonics_v4=(
+ Subnet UTCoffst Router Timeserv IEN116ns DNSserv Logserv
+ Cookie Lprserv Impress Resource Hostname Bootsize Dumpfile
+ DNSdmain Swapserv Rootpath ExtendP IpFwdF NLrouteF PFilter
+ MaxIpSiz IpTTL PathTO PathTbl MTU SameMtuF Broadcst
+ MaskDscF MaskSupF RDiscvyF RSolictS StaticRt TrailerF
+ ArpTimeO EthEncap TcpTTL TcpKaInt TcpKaGbF NISdmain
+ NISservs NTPservs NetBNms NetBDsts NetBNdT NetBScop
+ XFontSrv XDispMgr LeaseTim Message T1Time T2Time NW_dmain
+ NWIPOpts NIS+dom NIS+serv TFTPsrvN OptBootF MblIPAgt
+ OptBootF MblIPAgt SMTPserv POP3serv NNTPserv WWWservs
+ Fingersv IRCservs STservs STDAservs UserClas SLP_DA SLP_SS
+ AgentOpt FQDN PXEarch BootFile BootPath BootSrvA BootSrvN
+ EchoVC LeaseNeg
+)
- mnemonics_v6=(
- ClientID ServerID Preference Unicast UserClass VendorClass
- SIPNames SIPAddresses DNSAddresses DNSSearch NISServers
- NIS+Servers NISDomain NIS+Domain SNTPServers InfoRefresh
- BCMCDomain BCMCAddresses
- )
+mnemonics_v6=(
+ ClientID ServerID Preference Unicast UserClass VendorClass
+ SIPNames SIPAddresses DNSAddresses DNSSearch NISServers
+ NIS+Servers NISDomain NIS+Domain SNTPServers InfoRefresh
+ BCMCDomain BCMCAddresses
+)
- _arguments -A \
- '-c[]' \
- '-i[interface]:interface:' \
- '-n[maximum number of lines]:limit:' \
- ':DHCP Parameter:_values "DHCP Parameter" $mnemonics_v4' \
-}
-
-_dhcpinfo "$@"
+_arguments -A "-*" \
+ '-c[]' \
+ '-i[interface]:interface' \
+ '-n[maximum number of lines]:limit' \
+ ':DHCP parameter:_values "DHCP parameter" $mnemonics_v4'
diff --git a/Completion/Solaris/Command/_dtrace b/Completion/Solaris/Command/_dtrace
index a095589eb..06e0dc4f6 100644
--- a/Completion/Solaris/Command/_dtrace
+++ b/Completion/Solaris/Command/_dtrace
@@ -1,41 +1,152 @@
#compdef dtrace
-# Synced with Nevada build 160 man pages
-_dtrace() {
- _arguments -s \
- '-32[generate 32-bit D programs and ELF files]' \
- '-64[generate 64-bit D programs and ELF files]' \
- '-a[claim anonymous tracing state]' \
- '-A[generate driver.conf(4) directives for anonymous tracing]' \
- '-b[set trace buffer size]' \
- '-c[run specified command and exit upon its completion]' \
- '-C[run cpp(1) preprocessor on script files]' \
- '-D[define symbol when invoking preprocessor]' \
- '-e[exit after compiling request but prior to enabling probes]' \
- '-f[enable or list probes matching the specified function name]:function: ' \
- '-F[coalesce trace output by function]' \
- '-G[generate an ELF file containing embedded dtrace program]' \
- '-H[print included files when invoking preprocessor]' \
- '-h[Generate a header file]' \
- '-i[enable or list probes matching the specified probe id]' \
- '-I[add include directory to preprocessor search path]:include dir:_files -/' \
- '-L[Add directory to search path for DTrace libraries]:lib dir:_files -/' \
- '-l[list probes matching specified criteria]' \
- '-m[enable or list probes matching the specified module name]:module: ' \
- '-n[enable or list probes matching the specified probe name]:name: ' \
- '-o[set output file]:output file:_files' \
- '-p[grab specified process-ID and cache its symbol tables]:pid:_pids' \
- '-P[enable or list probes matching the specified provider name]:provider: ' \
- '-q[set quiet mode (only output explicitly traced data)]' \
- '-s[enable or list probes according to the specified D script]' \
- '-S[print D compiler intermediate code]' \
- '-U[undefine symbol when invoking preprocessor]' \
- '-v[set verbose mode (report program stability attributes)]' \
- '-V[report DTrace API version]' \
- '-w[permit destructive actions]' \
- '-x[enable or modify compiler and tracing options]' \
- '-X[specify ISO C conformance settings for preprocessor]:ISO C conformance:((a\:"ISO plus K&R extensions (default)" c\:"Strictly conformant ISO C" s\:"K&R C only" t\:"ISO plus K&R extensions"))' \
- '-Z[permit probe descriptions that match zero probes]'
-}
+local curcontext="$curcontext" ret=1
+local -a state line args xopts
-_dtrace "$@"
+case $OSTYPE in
+ ^darwin*)
+ args=(
+ '-32[generate 32-bit D programs and ELF files]'
+ '-64[generate 64-bit D programs and ELF files]'
+ '(-A -h -l -V)-G[generate an ELF file containing embedded dtrace program]'
+ '-X+[specify ISO C conformance settings for preprocessor]:ISO C conformance:((a\:"ISO plus K&R extensions (default)" c\:"Strictly conformant ISO C" s\:"K&R C only" t\:"ISO plus K&R extensions"))'
+ )
+ xopts=(
+ 'errexit[exit on error with specified status code]::status [1]'
+ 'noresolve[do not perform user address symbol resolution]'
+ 'uresolve[specify resolution of user addresses]:how:(no symbol basename absolute)'
+ )
+ ;;
+ darwin*)
+ args=(
+ '*-W[wait for the named process to launch]:name'
+ )
+ xopts=(
+ 'amin[set minimum stability attributes]:attribute'
+ 'arch[set target data model]:arch'
+ 'argref[ignore additional positional command-line args]'
+ 'core[create core dump when exiting dtrace]'
+ 'cpp[run C preprocessor over D programs before compiling]'
+ 'cpphdrs[print each header file name used]'
+ 'ctypes[write all CTF definitions into a file]:file:_file'
+ 'debug[enable DTrace debug messages]'
+ 'define[add preprocessor define]:var[=val]'
+ 'disallow_dsym[do not use dSYM files]'
+ 'droptags[print drop tags to stderr]'
+ 'empty[allow empty D files]'
+ 'encoding[set encoding used for output]:encoding:(ascii utf8)'
+ 'errtags[prefix error message with error tags]'
+ 'evaltime[when to start instrumenting a new process]:when:(preinit postinit)'
+ 'incdir[add include file search directory]:directory:_files -/'
+ 'ireg[specify size of DIF integer register set]:size'
+ 'late[set whether references to dynamic translators are allowed]: :(dynamic static)'
+ 'libdir[add library search directory]:directory:_files -/'
+ 'mangled[show mangled symbols for C++/Swift probes]'
+ 'nolibs[do not include D system libraries]'
+ 'nojtanalysis[disable jump table analysis]'
+ 'noerror[do not show error messages]'
+ 'pgmax[set maximum number of processes DTrace can grab at the same time]:number'
+ 'preallocate[preallocate memory in dtrace before running the script]:size'
+ 'pspec[interpret ambiguous specifications as probe names]'
+ 'strip[strip non-loadable sections from D program]'
+ 'tree[show dtrace compiler parse tree at different stages]:bitmap:(1 2 4)'
+ 'tregs[specify size of DIF tuple register set]:size'
+ 'undef[add #undef into preprocessor predefines]:var name'
+ 'verbose[show D compiler intermediate code]'
+ 'version[request specific version of DTrace scripting language]:version'
+ 'zdefs[permit probe descriptions that match zero probes]'
+ 'buflimit[specify threshold percentage for early buffer switches]:percentage (1-99)'
+ 'temporal[whether to sort events in time order]:bool:(true false)'
+ 'stacksymbols[whether to symbolicate stack symbols]:bool:(true false)'
+ )
+ ;;
+esac
+
+xopts+=(
+ 'aggrate[rate of aggregation reading]:time'
+ 'aggsize[aggregation buffer size]:size'
+ 'ustackframes[number of user stack frames]:scalar'
+ 'bufpolicy[specify the buffer policy for the principal buffer]:policy:(fill switch ring)'
+ 'bufresize[buffer resizing policy]:policy:(auto manual)'
+ 'bufsize[size of the per-CPU principal buffer]:size'
+ 'cleanrate[cleaning rate (hz)]:time'
+ 'cpu[specify the CPU on which to enable tracing]:scalar'
+ 'defaultargs[allow references to unspecified macro arguments]'
+ 'destructive[allow destructive actions]'
+ 'dynvarsize[size of the dynamic variable space]:size'
+ 'flowindent[turn on flow indentation]'
+ 'grabanon[claim anonymous state]'
+ 'jstackframes[number of default stack frames for jstack()]:scalar'
+ 'jstackstrsize[default string space size for jstack()]:scalar'
+ 'nspec[number of speculations]:scalar'
+ 'quiet[set quiet mode]'
+ 'specsize[size of the speculation buffer]:size'
+ 'strsize[maximum size of strings]:size'
+ 'stackframes[maximum number of kernelspace stack frames to unwind for stack()]:scalar'
+ 'stackindent[whitespace characters to use when indenting stack() and ustack() output]:scalar'
+ 'statusrate[rate of status checking]:time'
+ 'switchrate[rate of buffer switching]:time'
+ 'ustackframes[maximum number of userspace stack frames to unwind for ustack()]:scalar'
+ 'agghist[whether to show histogram for all aggregations]:bool:(true false)'
+ 'aggpack[pack aggregations together]'
+ 'aggsortkey[sort aggregation by key]'
+ 'aggsortkeypos[position of aggregate key used for sorting]:position'
+ 'aggsortpos[position of the aggregate variable used for sorting]:position'
+ 'aggsortrev[sort aggregations in reverse order]'
+ 'aggzoom[zoom aggregation histogram to the maximum value]'
+ 'rawbytes[always print tracemem output in hexadecimal]'
+)
+
+_arguments -C -s $args \
+ '-a[claim anonymous tracing state]' \
+ '(-G -h -l -V)-A[generate driver.conf(4) directives for anonymous tracing]' \
+ '-b+[set trace buffer size]:size' \
+ '*-c+[run specified command and exit upon its completion]:command' \
+ '-C[run cpp(1) preprocessor on script files]' \
+ '*-D+[define symbol when invoking preprocessor]:name' \
+ '-e[exit after compiling request but prior to enabling probes]' \
+ '-f+[enable or list probes matching the specified function name]:function:->functions' \
+ '-F[coalesce trace output by function]' \
+ '-H[print included files when invoking preprocessor]' \
+ '(-A -G -l -V)-h[generate a header file]' \
+ '*-i+[enable or list probes matching the specified probe id]:probe-id' \
+ '-I+[add include directory to preprocessor search path]:path:_directories' \
+ '(-A -G -h -V)-l[list probes instead of enabling them]' \
+ '-L+[add directory to search path for DTrace libraries]:path:_directories' \
+ '*-m+[trace or list probes matching the specified module name]:module:->modules' \
+ '*-n+[trace or list probes matching the specified probe name]:name:->probes' \
+ '-o+[set output file]:output file:_files' \
+ '-p+[grab specified process-ID and cache its symbol tables]:pid:_pids' \
+ '*-P+[trace or list probes matching the specified provider name]:provider:->providers' \
+ '-q[set quiet mode (only output explicitly traced data)]' \
+ '*-s+[enable or list probes according to the specified D script]:script file:_files' \
+ '-S[print D compiler intermediate code]' \
+ '*-U+[undefine symbol when invoking preprocessor]:name' \
+ '-v[set verbose mode (report program stability attributes)]' \
+ '(-A -G -h -l)-V[report DTrace API version]' \
+ '-w[permit destructive actions]' \
+ '*-x+[enable or modify compiler and tracing options]: : _values option $xopts' \
+ '-Z[permit probe descriptions that match zero probes]' && return
+
+if [[ -n $state ]]; then
+ local -a fields=( providers modules functions probes )
+ local -a suf=( : : : )
+ typeset -ga _cache_dtrace_probes
+ (( $#_cache_dtrace_probes )) || _cache_dtrace_probes=(
+ ${${${${(f)"$(_call_program dtrace-probes dtrace -l)"}[2,-1]}:#*[:[#]*}/(#b) #<-> #([^ ]#) #([^ ]#) #([^ ]#) ##([^ ]##)/${match[1]}:${match[3]:+$match[2]}:${match[3]:-$match[2]}:$match[4]}
+ ) # filtering out those containing : and [, they occur on macos but may just be unmangled forms and not directly usable
+ suf[${fields[(i)$state]}]=( "${compstate[quote][-1]} " ) # field matching the state gets a space suffix
+ while compset -P 1 '*:'; do
+ shift fields # each already listed field reduces one being possible
+ done
+ _tags dtrace-${^fields[1,(r)$state]}
+ while _tags; do
+ _requested dtrace-probes expl 'probe name' compadd -S "$suf[4]" - ${${(M)_cache_dtrace_probes:#((#s)|*:)${IPREFIX}[^:]#(#e)}##*:} && ret=0
+ _requested dtrace-functions expl 'function' compadd -S "$suf[3]" - ${${${(M)_cache_dtrace_probes:#((#s)|*:)${IPREFIX}[^:]#:[^:]#(#e)}%:*}##*:} && ret=0
+ _requested dtrace-modules expl 'module' compadd -S "$suf[2]" - ${${${(M)_cache_dtrace_probes:#((#s)|*:)${IPREFIX}[^:]#:[^:]#:[^:]#(#e)}#*:}%%:*} && ret=0
+ _requested dtrace-providers expl 'provider' compadd -S "$suf[1]" - ${_cache_dtrace_probes%%:*} && ret=0
+ (( ret )) || return 0
+ done
+fi
+
+return 1
diff --git a/Completion/Solaris/Command/_inetadm b/Completion/Solaris/Command/_inetadm
index 0c8b14a4e..527cc5a71 100644
--- a/Completion/Solaris/Command/_inetadm
+++ b/Completion/Solaris/Command/_inetadm
@@ -1,16 +1,10 @@
#compdef inetadm
-_inetadm() {
- _arguments -s \
- '-?[help]' \
- '-l[list service instance properties]:FMRI:_svcs_fmri -i' \
- '-e[enable specified instance]:FMRI:_svcs_fmri -i' \
- '-d[disable specified instance]:FMRI:_svcs_fmri -i' \
- '-p[list inet service properties]' \
- '-m[modify service instance properties]:FMRI:_svcs_fmri -i' \
- '-M[modify inet service properties]'
-}
-
-_inetadm "$@"
-
-# vi:tw=0
+_arguments -s \
+ '-?[help]' \
+ '-l[list service instance properties]:FMRI:_svcs_fmri -i' \
+ '-e[enable specified instance]:FMRI:_svcs_fmri -i' \
+ '-d[disable specified instance]:FMRI:_svcs_fmri -i' \
+ '-p[list inet service properties]' \
+ '-m[modify service instance properties]:FMRI:_svcs_fmri -i' \
+ '-M[modify inet service properties]'
diff --git a/Completion/Solaris/Command/_pfexec b/Completion/Solaris/Command/_pfexec
index 2519c3cdc..e90f33222 100644
--- a/Completion/Solaris/Command/_pfexec
+++ b/Completion/Solaris/Command/_pfexec
@@ -22,11 +22,15 @@ _privset() {
}
_pfexec() {
+ local cmd cpp
local -a _comp_priv_prefix
- _arguments \
- '-P[privileges to acquire]:privspec:_privset' \
- '(-):command name: _command_names -e' \
- '*::arguments:{ _comp_priv_prefix=( pfexec ${(kv)opt_args[-P]} ) ; _normal }'
+ local -A opt_args
+ cmd="$words[1]"
+ cpp='_comp_priv_prefix=( $cmd ${(kv)opt_args[(I)-P]} )'
+ _arguments \
+ '-P+[privileges to acquire]:privspec:_privset' \
+ "(-): :{ $cpp; _command_names -e }" \
+ "*:: :{ $cpp; _normal }"
}
_pfexec "$@"
diff --git a/Completion/Solaris/Command/_prstat b/Completion/Solaris/Command/_prstat
index 1eb38845c..a95919127 100644
--- a/Completion/Solaris/Command/_prstat
+++ b/Completion/Solaris/Command/_prstat
@@ -1,46 +1,41 @@
#compdef prstat
-_prstat()
-{
- local d_opt sort_key
- d_opt=(
- "u"\:"seconds past the epoch"
- "d"\:"standard date format"
- )
+local d_opt sort_key
+d_opt=(
+ "u"\:"seconds past the epoch"
+ "d"\:"standard date format"
+)
- sort_key=(
- "cpu"\:"process CPU usage (default)"
- "pri"\:"process priority"
- "rss"\:"resident set size"
- "size"\:"size of process image"
- "time"\:"process execution time"
- )
+sort_key=(
+ "cpu"\:"process CPU usage"
+ "pri"\:"process priority"
+ "rss"\:"resident set size"
+ "size"\:"size of process image"
+ "time"\:"process execution time"
+)
- _arguments -A "-*" \
- '-a[information about processes and users]' \
- '-c[new reports below previous reports instead of overprinting them]' \
- '-C[processes or lwps that are bound to processor sets in the list]:processor set list:' \
- '-d[specify the representation of time]:time representation:(($d_opt))' \
- '-h[only processes or lwps whose home lgroup is in the list]:lgroup list:' \
- '-H[information about home lgroup]' \
- '-j[only processes or lwps whose project ID is in the given list]:project list:' \
- '-J[information about processes and projects]' \
- '-k[only processes or lwps whose task ID is in tasklist]:task list'\
- '-L[statistics for each light-weight process (LWP)]' \
- '-m[microstate process accounting information]' \
- '-n[restrict number of output lines]:ntop,[nbottom]' \
- '-p[only processes whose process ID is in the list]:PID list' \
- '-P[only processes or lwps which have most recently executed on a CPU in the list]:CPU list' \
- '-R[Put prstat in the real time scheduling class]' \
- '-s[Sort key (descending)]:key:(($sort_key))' \
- '-S[Sort key (ascending)]:key:(($sort_key))' \
- '-t[total usage summary for each user]' \
- '-T[information about processes and tasks]' \
- '-u[only processes whose effective user ID is in the list]:UID:_users' \
- '-U[only processes whose real user ID is in the list]:UID:_users' \
- '-v[verbose process usage]' \
- '-z[only processes or LWPs whose zone ID is in the list]:zone ID:' \
- '-Z[information about processes and zones]'
-}
-
-_prstat "$@"
+_arguments -A "-*" \
+ '-a[information about processes and users]' \
+ '-c[new reports below previous reports instead of overprinting them]' \
+ '-C[processes or lwps that are bound to processor sets in the list]:processor set list' \
+ '-d[specify the representation of time]:time representation:(($d_opt))' \
+ '-h[only processes or lwps whose home lgroup is in the list]:lgroup list' \
+ '-H[information about home lgroup]' \
+ '-j[only processes or lwps whose project ID is in the given list]:project list' \
+ '-J[information about processes and projects]' \
+ '-k[only processes or lwps whose task ID is in tasklist]:task list'\
+ '-L[statistics for each light-weight process (LWP)]' \
+ '-m[microstate process accounting information]' \
+ '-n[restrict number of output lines]:ntop,[nbottom]' \
+ '-p[only processes whose process ID is in the list]:PID list' \
+ '-P[only processes or lwps which have most recently executed on a CPU in the list]:CPU list' \
+ '-R[put prstat in the real time scheduling class]' \
+ '-s[sort key (descending)]:sort key [cpu]:(($sort_key))' \
+ '-S[sort key (ascending)]:sort key [cpu]:(($sort_key))' \
+ '-t[total usage summary for each user]' \
+ '-T[information about processes and tasks]' \
+ '-u[only processes whose effective user ID is in the list]:UID:_users' \
+ '-U[only processes whose real user ID is in the list]:UID:_users' \
+ '-v[verbose process usage]' \
+ '-z[only processes or LWPs whose zone ID is in the list]:zone ID' \
+ '-Z[information about processes and zones]'
diff --git a/Completion/Solaris/Command/_svcadm b/Completion/Solaris/Command/_svcadm
index c9826f2eb..22780d03f 100644
--- a/Completion/Solaris/Command/_svcadm
+++ b/Completion/Solaris/Command/_svcadm
@@ -1,78 +1,75 @@
#compdef svcadm
-_svcadm() {
- local curcontext="$curcontext" state line expl subcmds
- typeset -A opt_args
+local curcontext="$curcontext" state line expl subcmds
+typeset -A opt_args
- subcmds=( enable disable restart refresh mark delegate clear milestone )
+subcmds=( enable disable restart refresh mark delegate clear milestone )
- if [[ $service == "svcadm" ]]; then
- _arguments -C -A "-*" \
- '-v[Print actions verbosely]' \
- '*::command:->subcmd' && return 0
+if [[ $service == "svcadm" ]]; then
+ _arguments -C -A "-*" \
+ '-v[print actions verbosely]' \
+ '*::command:->subcmd' && return 0
- if (( CURRENT == 1 )); then
- _wanted commands expl 'svcadm subcommand' compadd -a subcmds
- return
- fi
- service="$words[1]"
- curcontext="${curcontext%:*}=$service:"
- fi
+ if (( CURRENT == 1 )); then
+ _wanted commands expl 'svcadm subcommand' compadd -a subcmds
+ return
+ fi
+ service="$words[1]"
+ curcontext="${curcontext%:*}-$service:"
+fi
- case $service in
- (enable)
- _arguments -A "-*" \
- '-r[Recursively enable dependencies]' \
- '-s[Wait for service to come online]' \
- '-T[Timeout for -s]:seconds:' \
- '-t[State change is temporary]' \
- '*:instance FMRI:_svcs_fmri -i'
- ;;
+case $service in
+ (enable)
+ _arguments -A "-*" \
+ '-r[recursively enable dependencies]' \
+ '-s[wait for service to come online]' \
+ '-T[timeout for -s]:timeout (seconds)' \
+ '-t[state change is temporary]' \
+ '*:instance FMRI:_svcs_fmri -i'
+ ;;
- (disable)
- _arguments -A "-*" \
- '-s[Wait for service to become disabled]' \
- '-T[Timeout for -s]:seconds:' \
- '-t[State change is temporary]' \
- '*:instance FMRI:_svcs_fmri -i'
- ;;
+ (disable)
+ _arguments -A "-*" \
+ '-s[wait for service to become disabled]' \
+ '-T[timeout for -s]:timeout (seconds)' \
+ '-t[state change is temporary]' \
+ '*:instance FMRI:_svcs_fmri -i'
+ ;;
- (mark)
- _arguments -A "-*" \
- '-I[Change state immediately]' \
- "-s[Wait for service to reach the new state]" \
- '-T[Timeout for -s]:seconds:' \
- '-t[State change is temporary]' \
- ':state:(degraded maintenance)' \
- ':instance FMRI:_svcs_fmri -i'
- ;;
+ (mark)
+ _arguments -A "-*" \
+ '-I[change state immediately]' \
+ "-s[wait for service to reach the new state]" \
+ '-T[timeout for -s]:timeout (seconds)' \
+ '-t[state change is temporary]' \
+ ':state:(degraded maintenance)' \
+ ':instance FMRI:_svcs_fmri -i'
+ ;;
- (restart|refresh|clear)
- _arguments \
- "-s[Wait for service to $service]" \
- '-T[Timeout for -s]:seconds:' \
- '*:instance FMRI:_svcs_fmri -i'
- ;;
+ (restart|refresh|clear)
+ _arguments \
+ "-s[wait for service to $service]" \
+ '-T[timeout for -s]:timeout (seconds)' \
+ '*:instance FMRI:_svcs_fmri -i'
+ ;;
- (delegate)
- _arguments -A "-*" \
- '-s[Wait for instances to come online]' \
- '-T[Timeout for -s]:seconds:' \
- ':restarter FMRI:_svcs_fmri -r' \
- '*:FMRI:_svcs_fmri -i'
- ;;
+ (delegate)
+ _arguments -A "-*" \
+ '-s[wait for instances to come online]' \
+ '-T[timeout for -s]:timeout (seconds)' \
+ ':restarter FMRI:_svcs_fmri -r' \
+ '*:FMRI:_svcs_fmri -i'
+ ;;
- (milestone)
- _arguments -A "-*" \
- '-d[Make milestone the default]' \
- '-s[Wait for the transition to the new milestone]' \
- '-T[Timeout for -s]:seconds:' \
- '*:milestone FMRI:_svcs_fmri -m'
- ;;
+ (milestone)
+ _arguments -A "-*" \
+ '-d[make milestone the default]' \
+ '-s[wait for the transition to the new milestone]' \
+ '-T[timeout for -s]:timeout (seconds)' \
+ '*:milestone FMRI:_svcs_fmri -m'
+ ;;
- (*)
- _message "unknown svcadm subcommand: $service"
- esac
-}
-
-_svcadm "$@"
+ (*)
+ _message "unknown svcadm subcommand: $service"
+ ;;
+esac
diff --git a/Completion/Solaris/Command/_svcprop b/Completion/Solaris/Command/_svcprop
index 4a5436caf..19c65d3cf 100644
--- a/Completion/Solaris/Command/_svcprop
+++ b/Completion/Solaris/Command/_svcprop
@@ -1,26 +1,20 @@
#compdef svcprop
-_svcprop() {
- _arguments -s \
- '-f[designate properties by their FMRI]' \
- '-q[quiet]' \
- '-t[use multi-property output format]' \
- '-v[verbose]' \
- - set1 \
- '-w[waits for the selected property or property group to change]' \
- '-p[prints values of named property or property group]' \
- ':FMRI:_svcs_fmri -i' \
- - set2 \
- '-a[display all properties]' \
- '-g[group type filter]:group type:' \
- '*-l[properties from a layer]:layer:(admin site-profile system-profile manifest)' \
- '(-c -s)-C[retrieve properties without composition]' \
- '(-C -s)-c[retrieve properties with composition]' \
- '(-c -C)-s[retrieve properties from snapshot]:snapshot:' \
- '*-p[prints values of named property or property group]' \
- '*:FMRI:_svcs_fmri -i'
-}
-
-_svcprop "$@"
-
-# vi:tw=0
+_arguments -s \
+ '-f[designate properties by their FMRI]' \
+ '-q[quiet]' \
+ '-t[use multi-property output format]' \
+ '-v[verbose]' \
+ - set1 \
+ '-w[wait for the selected property or property group to change]' \
+ '-p[print values of named property or property group]' \
+ ':FMRI:_svcs_fmri -i' \
+ - set2 \
+ '-a[display all properties]' \
+ '-g[group type filter]:group type' \
+ '*-l[properties from a layer]:layer:(admin site-profile system-profile manifest)' \
+ '(-c -s)-C[retrieve properties without composition]' \
+ '(-C -s)-c[retrieve properties with composition]' \
+ '(-c -C)-s[retrieve properties from snapshot]:snapshot' \
+ '*-p[print values of named property or property group]' \
+ '*:FMRI:_svcs_fmri -i'
diff --git a/Completion/Solaris/Command/_zlogin b/Completion/Solaris/Command/_zlogin
index 74cbafe82..142114302 100644
--- a/Completion/Solaris/Command/_zlogin
+++ b/Completion/Solaris/Command/_zlogin
@@ -1,20 +1,16 @@
#compdef zlogin
# Synced with the Nevada build 162 man page
-_zlogin() {
- local -a _comp_priv_prefix
- _arguments -s \
- '-E[Disable escape character]' \
- '-e[Specify escape character]:character:' \
- '-l[Specify username]:username:_users' \
- ':zonename:_zones' \
- - set1 \
- '-C[Connect to zone console]' \
- '-d[Disconnect on zone halt]' \
- - set2 \
- '-S["Safe" login mode]' \
- '(-):command name: _command_names -e' \
- '*::utility: _normal'
-}
-
-_zlogin "$@"
+local -a _comp_priv_prefix
+_arguments -s \
+ '-E[disable escape character]' \
+ '-e[specify escape character]:character' \
+ '-l[specify username]:username:_users' \
+ ':zonename:_zones' \
+ - set1 \
+ '-C[connect to zone console]' \
+ '-d[disconnect on zone halt]' \
+ - set2 \
+ '-S["safe" login mode]' \
+ '(-):command name: _command_names -e' \
+ '*::utility: _normal'
diff --git a/Completion/Solaris/Type/_svcs_fmri b/Completion/Solaris/Type/_svcs_fmri
index ffade6985..b090461c5 100644
--- a/Completion/Solaris/Type/_svcs_fmri
+++ b/Completion/Solaris/Type/_svcs_fmri
@@ -66,18 +66,18 @@ _svcs_fmri() {
# _wanted fmri expl "full or unambiguously abbreviated FMRIs" \
# _multi_parts -i / fmri_abbrevs
- _wanted fmri expl "full or unambiguously abbreviated FMRIs" \
+ _wanted fmri expl "full or unambiguously abbreviated FMRI" \
compadd $fmri_abbrevs
;;
(-m)
- _wanted fmri expl "milestone FMRIs" \
+ _wanted fmri expl "milestone FMRI" \
compadd $(svcs -H -o fmri svc:/milestone/\*) all
;;
(-r)
# TODO: need some way to pick out only restarters
- _wanted fmri expl "restarter FMRIs" \
+ _wanted fmri expl "restarter FMRI" \
compadd master reset svc:/network/inetd:default
;;
diff --git a/Completion/Unix/Command/_aap b/Completion/Unix/Command/_aap
index 089a993c3..38e50f1fc 100644
--- a/Completion/Unix/Command/_aap
+++ b/Completion/Unix/Command/_aap
@@ -20,7 +20,7 @@ _arguments -C -s -S \
\*{-c,--command=}'[execute a command after reading the recipe]:aap command:' \
'(-k --continue)'{-k,--continue}'[continue building after an error]' \
'(-S --stop)'{-S,--stop}'[stop building at first error (default)]' \
- '(-N,--nofetch-recipe -R --fetch-recipe)'{-R,--fetch-recipe}'[fetch recipe file and child recipes]' \
+ '(-N --nofetch-recipe -R --fetch-recipe)'{-R,--fetch-recipe}'[fetch recipe file and child recipes]' \
'(-R --fetch-recipe -N --nofetch-recipe)'{-N,--nofetch-recipe}'[do not fetch recipes for "fetch" target]' \
'(-a --nocache)'{-a,--nocache}"[always download files, don't use the cache]" \
'(-l --local)'{-l,--local}'[do not recurse into subdirectories]' \
diff --git a/Completion/Unix/Command/_abcde b/Completion/Unix/Command/_abcde
index 361b43091..3f748d373 100644
--- a/Completion/Unix/Command/_abcde
+++ b/Completion/Unix/Command/_abcde
@@ -1,50 +1,41 @@
#compdef abcde
-(( $+functions[_abcde_fields] )) ||
-_abcde_fields(){
- _values -s , field year genre
-}
-
-(( $+functions[_abcde_actions] )) ||
-_abcde_actions(){
- _values -s , action cddb cue read getalbumart embedalbumart normalize encode tag move replaygain playlist clean
-}
-
-_arguments -s \
+_arguments -s -S -A "-*" \
'(-t -T -p)-1[encode the whole CD in a single file]' \
- '-a[comma-delimited list of actions to perform]:action:_abcde_actions' \
+ '-a[comma-delimited list of actions to perform]:action:_sequence compadd - cddb cue read getalbumart embedalbumart normalize encode tag move replaygain playlist clean' \
'-b[enable batch mode normalization]' \
'-B[enable automatic embedding of album art with certain containers]' \
- '-c[specify an additional configuration file to parse]:config:_files' \
- '-C[resume a session for discid when you no longer have the CD available]:discid' \
- '-d[CD-ROM block device that contains audio tracks to be read]:cd-rom-file:_files' \
+ '-c+[specify an additional configuration file to parse]:config:_files' \
+ '-C+[resume a session when read was completed but CD is not present]:disc id:compadd abcde.*(N:e)' \
+ '-d+[specify CD device from which to read audio tracks]:CD device:_files -g "*(-%)" -P / -W /' \
'-D[capture debugging information]' \
'-e[erase information about encoded tracks from the internal status file]' \
'-f[force the removal of the temporary ABCDETEMPDIR directory]' \
"-g[enable lame's --nogap option]" \
'-G[download album art using the getalbumart function]' \
'(- :)-h[get help information]' \
- '-j[start a specified number of encoder processes at once]:number' \
+ '-j+[start specified number of encoder processes at once]:number' \
'-k[keep the wav files after encoding]' \
- '-l[use the low-diskspace algorithm]' \
+ '-l[use the low disk space algorithm]' \
'-L[use a local CDDB repository]' \
'-m[create DOS-style playlists, modifying the resulting one by adding CRLF line endings those to work]' \
"-n[don't query CDDB database]" \
'-N[non interactive mode]' \
- '-o[select output type]:outputtype:(vorbis ogg mp3 flac spx mpc m4a wav wv ape opus mka aiff)' \
+ '-o+[select output type]:output type [vorbis]:(vorbis ogg mp3 flac spx mpc m4a wav wv ape opus mka aiff)' \
"-p[pads track numbers with 0's]" \
'-P[use Unix PIPES to read and encode in one step]' \
- '-r[remote encode on this comma-delimited list of machines using distmp3]:hosts:_sequence _hosts' \
- '-s[fields to be shown in the CDDB parsed entries]:field:_abcde_fields' \
- '-S[set the speed of the CD drive]:speed' \
- '-t[start the numbering of the tracks at a given number]:track-number' \
- '-T[start the numbering of the tracks at a given number and change internal tag numbering]:track-number' \
+ '-Q+[specify CD lookup methods]:lookup method [musicbrainz]:_sequence compadd - musicbrainz cddb cdtext' \
+ '-r+[remote encode on this comma-delimited list of machines using distmp3]:hosts:_sequence _hosts' \
+ '-s+[fields to be shown in the CDDB parsed entries]:field:_sequence compadd - year genre' \
+ '-S+[set the speed of the CD drive]:speed' \
+ '-t+[start the numbering of the tracks at a given number]:track-number' \
+ '-T+[start the numbering of the tracks at a given number and change internal tag numbering]:track-number' \
'-U[set CDDBPROTO to version 5]' \
'(- :)-v[show the version and exit]' \
'-V[be more verbose]' \
'-x[eject the CD when all tracks have been read]' \
- '-X[use an alternative "cue2discid" implementation]:cue2discid' \
- '-w[add a comment to the tracks ripped from the CD]:comment' \
- "-W[concatenate CD's]:cd-number" \
+ '-X+[use an alternative "cue2discid" implementation]:cue2discid:_command_names -e' \
+ '-w+[add a comment to the tracks ripped from the CD]:comment' \
+ "-W+[concatenate CD's]:cd-number" \
'-z[debug mode]' \
- '*:tracks:'
+ '*: :_guard "^-*" "track list"'
diff --git a/Completion/Unix/Command/_ack b/Completion/Unix/Command/_ack
index e83a9330e..6dc3ab0d1 100644
--- a/Completion/Unix/Command/_ack
+++ b/Completion/Unix/Command/_ack
@@ -72,7 +72,7 @@ _arguments -C -s -S \
'(1)-g[print files where the relative path + filename matches the given pattern]:pattern to match against filenames' \
'--sort-files[sorts the found files lexically]' \
'--show-types[print the file types that ack associates with each file]' \
- '(--files-from -x)--files-from=[read the list of files to search from specified file]:files:_files' \
+ '(--files-from -x)--files-from=[read the list of files to search from specified file]:file:_files' \
'(-x --files-from)-x[read the list of files to search from standard input]' \
'*--ignore-dir'{,ectory}'=[ignore directory]:directory:_directories' \
'*--noignore-dir'{,ectory}'=[remove directory from ignored list]:directory:_directories' \
@@ -86,7 +86,7 @@ _arguments -C -s -S \
'*--type-'{add,set}'=[files with the given extensions are recognized as being of the given type]:type-def:->type-defs' \
'*--type-del=[remove all filters associated with specified file type]: :->file-types' \
'(--env)--noenv[ignore environment variables and global ackrc files]' '!(--noenv)--env)' \
- '--ackrc=[specify an ackrc file to use]:files:_files' \
+ '--ackrc=[specify an ackrc file to use]:file:_files' \
'--ignore-ack-defaults[ignore default definitions included with ack]' \
"${ign}(- 1 *)--create-ackrc[output an ackrc based on customizations]" \
"${ign}(- 1 *)"{-\?,--help}'[display usage information]' \
diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb
index 75a447dfc..8a071fa8e 100644
--- a/Completion/Unix/Command/_adb
+++ b/Completion/Unix/Command/_adb
@@ -43,6 +43,7 @@ _adb() {
"disconnect"
"emu"
"enable-verity"
+ "exec-out"
"forward"
"get-devpath"
"get-serialno"
@@ -81,11 +82,12 @@ _adb() {
if ! adb ${ADB_DEVICE_SPECIFICATION} shell exit 2>/dev/null; then
# early bail-out until a single valid device/emulator is specified and up-and-running
[[ $words[CURRENT-1] = -s ]] || _message -r "No (started) device specified, completions do not yet work"
+ #TODO handle -t transport-id
_arguments \
'-s[serial]: :_adb_device_serial' \
'( -e)-d[device]' \
'(-d )-e[emulator]' \
- '1:options:_adb_options_handler' \
+ '1:option:_adb_options_handler' \
'*: : _default'
return
@@ -109,7 +111,7 @@ _adb_dispatch_command () {
fi
case ${curcontext} in
- (*:adb-shell:)
+ (*:adb-shell:|*:adb-exec-out:)
(( $+functions[_adb_dispatch_shell] )) && _adb_dispatch_shell
;;
(*:adb-backup:)
@@ -141,7 +143,7 @@ _adb_dispatch_command () {
'(-d -e)-s[serial]: :_adb_device_serial' \
'(-s -e)-d[device]' \
'(-d -s)-e[emulator]' \
- '*:options:_adb_options_handler'
+ '*:option:_adb_options_handler'
;;
esac
}
@@ -164,18 +166,16 @@ _adb_sanitize_context () {
(( $+functions[_adb_device_specification] )) ||
_adb_device_specification () {
- local -a word
- word=($words[(R)-[des]])
- if [[ $words[(R)-s] == -s ]]; then
- local i=$words[(I)-s]
- word=($words[i,i+1])
+ if [[ $words[2] == -[de] ]]; then
+ ADB_DEVICE_SPECIFICATION=($words[2])
+ elif [[ $words[2] == -[st] ]]; then
+ ADB_DEVICE_SPECIFICATION=($words[2,3])
fi
- ADB_DEVICE_SPECIFICATION=($word)
}
(( $+functions[_adb_dispatch_shell] )) ||
_adb_dispatch_shell () {
- if [[ ${#words} -le 2 ]]
+ if [[ $CURRENT -le 2 ]]
then
(( $+functions[_adb_shell_commands_handler] )) && _adb_shell_commands_handler
return
@@ -188,6 +188,15 @@ _adb_dispatch_shell () {
(pm)
(( $+functions[_adb_package_manager_handler] )) && _adb_package_manager_handler
;;
+ (cmd)
+ (( $+functions[_adb_cmd_handler] )) && _adb_cmd_handler
+ ;;
+ (dumpsys)
+ (( $+functions[_adb_dumpsys_handler] )) && _adb_dumpsys_handler
+ ;;
+ (start|stop)
+ (( $+functions[_adb_startstop] )) && _adb_startstop ${words[2]}
+ ;;
(*)
_arguments '*: :_adb_remote_folder'
;;
@@ -262,7 +271,7 @@ _adb_intent_handler () {
(( $+functions[_adb_activity_manager_handler] )) ||
_adb_activity_manager_handler () {
- if [[ ${#words} -le 3 ]]
+ if [[ $CURRENT -le 3 ]]
then
_wanted am_argument expl 'am argument' compadd start startservice broadcast instrument profile
return
@@ -318,6 +327,79 @@ _adb_package_manager_handler () {
esac
}
+(( $+functions[_adb_cmd_handler] )) ||
+_adb_cmd_handler () {
+ local -a cmds
+ cmds=(${${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out cmd -l)"}[2,-1]}##[[:space:]]##})
+ _wanted dumpsys expl 'cmd command' compadd ${cmds%$'\r'}
+}
+
+(( $+functions[_adb_dumpsys_handler] )) ||
+_adb_dumpsys_handler () {
+ if [[ $CURRENT -eq 3 ]]; then
+ local -a services
+ services=(${${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out dumpsys -l)"}[2,-1]}##[[:space:]]##})
+ _wanted dumpsys expl 'dumpsys service' compadd - ${services%$'\r'}
+ elif [[ $CURRENT -ge 4 && $words[3] == SurfaceFlinger ]]; then
+ (( CURRENT -= 2 ))
+ shift 2 words
+ typeset -A opt_args
+ local context state state_descr line
+ _arguments -R \
+ '--file[start/stop continuous dumpsys to file]' \
+ '--no-limit[disable wrapping around continuous dumpsys at ~20MB]' \
+ '--full-dump[set fullDump = true]' \
+ '--allocated_buffers[show allocated buffers dump]' \
+ '--display-id[show display id dump]' \
+ '--dispsync[show dispsync dump]' \
+ '--edid[raw edid dump for specified hwc display (binary output)]:*:hwc display:->hwcdisplay' \
+ '--latency[show latency stats]:*:layer:->layer' \
+ '--latency-clear[clear latency stats]:*:layer:->layer' \
+ '--list[list all layers]' \
+ '--planner[pass planner dump arguments]:*:planner arguments:->planner' \
+ '--static-screen[show static screen stats]' \
+ '--timestats[pass time stats arguments]:*:timestats arguments:->timestats' \
+ '--vsync[show vsync dump]' \
+ '--wide-color[show wide color info]' \
+ '--frametimeline[pass frametimeline arguments]:*:frametimeline arguments:->frametimeline' \
+ '--mini[show mini dump]'
+ if [[ $? == 300 ]]; then
+ case $state in
+ layer)
+ typeset -a layers
+ layers=(${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out dumpsys SurfaceFlinger --list)"}[2,-1]})
+ _wanted dumpsys expl 'layers' compadd - ${layers%$'\r'}
+ ;;
+ planner)
+ _arguments \
+ {--compare,-c}'[compare predictions of two hashes]:left: :right: :' \
+ {--describe,-d}'[describe hash]:hash: :' \
+ {--help,-h}'[help]' \
+ {--similar,-s}'[show similar stacks matching given plan]:plan: :' \
+ {--layers,-l}'[show current layers]'
+ ;;
+ timestats)
+ _arguments -disable -enable -clear -dump -maxlayers'[only with -dump]:int:'
+ ;;
+ frametimeline)
+ _arguments -jank -all
+ ;;
+ esac
+ fi
+ fi
+}
+
+(( $+functions[_adb_startstop] )) ||
+_adb_startstop () {
+ local -a services
+ local -A service_status
+ services=(${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out getprop)"})
+ service_status=( ${(s,: ,)${(j,: ,)${(M)services:#\[init.svc.*}}} )
+ local -A map=(start stopped stop running)
+ services=( ${(k)service_status[(R)*$map[$1]*]} )
+ _wanted services expl "$map[$1] services" compadd - ${${${services#\[}%\]}#init.svc.}
+}
+
(( $+functions[_adb_dispatch_uninstall] )) ||
_adb_dispatch_uninstall () {
_arguments \
@@ -344,12 +426,12 @@ _adb_dispatch_install () {
(( $+functions[_adb_dispatch_push] )) ||
_adb_dispatch_push () {
- if [[ ${#words} -gt 3 ]]
+ if [[ $CURRENT -gt 3 ]]
then
_message -r "Notice: you can only push a single item at a time"
return
fi
- if [[ ${#words} -gt 2 ]]
+ if [[ $CURRENT -gt 2 ]]
then
_arguments '*: :_adb_remote_folder'
else
@@ -359,12 +441,12 @@ _adb_dispatch_push () {
(( $+functions[_adb_dispatch_pull] )) ||
_adb_dispatch_pull () {
- if [[ ${#words} -gt 3 ]]
+ if [[ $CURRENT -gt 3 ]]
then
_message -r "Notice: you can only pull a single item at a time"
return
fi
- if [[ ${#words} -gt 2 ]]
+ if [[ $CURRENT -gt 2 ]]
then
_arguments '*:local file/folder:_files'
else
@@ -392,7 +474,7 @@ _adb_check_log_redirect () {
(( $+functions[_adb_trace_opts] )) ||
_adb_trace_opts() {
- _values -s , 'adb trace options' \
+ _values -s , 'adb trace option' \
'(1 adb sockets packets rwx usb sync sysdeps transport jdwp)all' \
'(all adb sockets packets rwx usb sync sysdeps transport jdwp)1' \
'adb' \
@@ -411,14 +493,16 @@ _adb_device_serial() {
local expl
local -a devices device_desc
local device
- devices=( $(adb devices -l | sed -n 's/^\([^[:space:]]*\)[[:space:]]*.*product:\([^[:space:]]*\).*$/\1:\2/p') )
+ devices=( $(adb devices -l | sed -n -e 's/:/\\:/' -e 's/^\([^[:space:]]*\)[[:space:]]*.*product:\([^[:space:]]*\).*$/\1:\2/p') )
zstyle -a :completion:${curcontext} device-names device_desc
for device in $device_desc; do
if [[ -n $devices[(r)${device%:*}:*] ]]; then
devices[(i)${device%:*}:*]=$device
+ elif [[ -n $devices[(r)*:${device%:*}] ]]; then
+ devices[(i)*:${device%:*}]=${${devices[(r)*:${device%:*}]}%:*}:${device#*:}
fi
done
- _describe -t dev_serial 'available devices' devices
+ _describe -t dev_serial 'available device' devices
}
(( $+functions[_adb_logcat_filter_specification] )) ||
@@ -446,8 +530,8 @@ _adb_dispatch_logcat() {
_arguments \
'(-c -g)-s[set default filter to silent]' \
'(-c -g)-f[log output to file (defaults to stdout)]:logfile:_files' \
- '(-c -g -d)-r[rotate log every kbytes (default 16, requires -f)]:logsize:_guard "[0-9]#" "numeric value"' \
- '(-c -g -d)-n[max number of rotated logs (default 4)]:number :_guard "[0-9]#" "numeric value"' \
+ '(-c -g -d)-r[rotate log at specified size, requires -f]:log size (kbytes) [16]' \
+ '(-c -g -d)-n[specify max number of rotated logs]:number [4]' \
'(-c -g -d)-v[log format]:format: _values "format" brief process tag thread raw time threadtime long' \
'(-d -t -g)-c[clear log]' \
'(-c -g)-d[dump log]' \
@@ -459,13 +543,13 @@ _adb_dispatch_logcat() {
(( $+functions[_adb_options_handler] )) ||
_adb_options_handler() {
local expl
- _wanted adb_options expl 'adb options' compadd "${ALL_ADB_COMMANDS[@]}"
+ _wanted adb_options expl 'adb option' compadd "${ALL_ADB_COMMANDS[@]}"
}
(( $+functions[_adb_shell_commands_handler] )) ||
_adb_shell_commands_handler() {
local expl
- _wanted adb_shell_commands expl 'adb shell commands' compadd ls pm am mkdir rmdir rm cat
+ _wanted adb_shell_commands expl 'adb shell command' compadd ls pm am mkdir rmdir rm cat cmd dumpsys start stop
}
(( $+functions[_adb_device_available] )) ||
@@ -514,7 +598,7 @@ _adb_installed_packages() {
_adb_users() {
local -a users
users=( ${${${(M)${(f)"$(adb shell pm list users)"}:#*UserInfo*}#*UserInfo\{}%:*} )
- _describe -t users 'users' users
+ _describe -t users 'user' users
}
(( $+functions[_adb_cache_policy_single_command] )) ||
diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible
index f1e13a813..2d976b0a0 100644
--- a/Completion/Unix/Command/_ansible
+++ b/Completion/Unix/Command/_ansible
@@ -1,7 +1,7 @@
-#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault -value-,ANSIBLE_STDOUT_CALLBACK,-default-
+#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault -value-,ANSIBLE_STDOUT_CALLBACK,-default- -value-,ANSIBLE_INVENTORY_ENABLED,-default-
-local curcontext="$curcontext" plug plugvar ign ret=1
-local -a args state line
+local curcontext="$curcontext" plug plugvar subcmd ign ret=1
+local -a args state line expl gactions
local -A opt_args
case $service in
@@ -9,6 +9,10 @@ case $service in
plug=callback
state=plugins
;;
+ *,ANSIBLE_INVENTORY_ENABLED,*)
+ plug=inventory
+ state=plugins
+ ;;
ansible|ansible-console|ansible-doc|ansible-playbook)
args=(
\*{-M+,--module-path=}'[specify path to modules]:module path:_dir_list'
@@ -18,6 +22,8 @@ case $service in
args+=(
'(-K --ask-become-pass)'{-K,--ask-become-pass}'[ask for privilege escalation password]'
'(-k --ask-pass)'{-k,--ask-pass}'[ask for connection password]'
+ '--list-hosts[output list of matching hosts]'
+ '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts'
'(-T --timeout)'{-T+,--timeout=}'[override the connection timeout]:timeout (seconds) [10]'
'(-c --connection)'{-c+,--connection=}'[specify connection type]:connection type [smart]:->connect-types'
'(-u --user)'{-u+,--user=}'[specify remote user for connection]:remote user:_users'
@@ -40,31 +46,17 @@ case $service in
'!(-R --su-user -U --sudo-user)'{-R,-U,--su-user,--sudo-user}':user [root]:_users'
)
;|
- ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull|ansible-vault)
- args+=(
- '--ask-vault-pass[ask for vault password]'
- '--vault-id=[specify vault identity to use]:vault identity'
- '--vault-password-file=[specify vault password file]:vault password file:_files'
- )
- ;|
ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull)
args+=(
+ --ask-vault-pass{,word}'[ask for vault password]'
+ '(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON'
+ '--vault-id=[specify vault identity to use]:vault identity'
+ --vault-pass{,word}-file='[specify vault password file]:vault password file:_files'
\*{-i+,--inventory=}'[specify inventory host file or host list]: : _alternative "files\:inventory file\:_files"
"hosts\:host\: _sequence _hosts"'
'!(-i --inventory)--inventory-file=:inventory file:_files'
)
;|
- ansible|ansible-console|ansible-playbook|ansible-pull)
- args+=(
- '--list-hosts[output list of matching hosts]'
- '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts'
- )
- ;|
- ansible|ansible-playbook|ansible-pull)
- args+=(
- '(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON'
- )
- ;|
ansible|ansible-console|ansible-inventory)
args+=(
'--playbook-dir=[specify substitute playbook directory]:directory:_directories'
@@ -72,15 +64,20 @@ case $service in
;|
ansible-playbook|ansible-pull)
args+=(
- '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]'
+ '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]:tag:->tags'
"--skip-tags[only run plays and tasks whose tags don't match]"
)
;|
+ ansible|ansible-console)
+ args+=(
+ '--task-timeout[set the task timeout limit]:timeout (seconds)'
+ )
+ ;|
ansible)
args+=(
'(-a --args)'{-a+,--args=}'[specify command or module arguments]:arguments:->args'
'(-B --background)'{-B+,--background=}'[run asynchronously, failing after specified time]:fail timeout (seconds)'
- '(-m --module-name)'{-m+,--module-name=}'[specify module]:module:->plugins'
+ '(-m --module-name)'{-m+,--module-name=}'[specify action to execute]: :->plugins'
'(-o --one-line)'{-o,--one-line}'[condense output]'
'(-P --poll)'{-P+,--poll=}'[specify the poll interval if using -B]:interval (seconds) [15]'
'(-t --tree)'{-t+,--tree=}'[specify directory for log output]:directory:_directories'
@@ -106,11 +103,15 @@ 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]'
- '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(become cache callback cliconf connection httpapi inventory lookup shell module strategy vars)'
+ '!--metadata-dump' # "internal testing only"
+ '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-j,--json}'[change output to json format]'
+ '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-l,--list}'[list available plugins]'
+ '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-F,--list_files}'[show plugin names and their source files without summaries]'
+ '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-s,--snippet}'[show playbook snippet for specified plugins]'
+ '(-l --list -F --list_files -s --snippet -e --entry-point)--metadata-dump[dump json metadata for all plugins]'
+ '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-e+,--entry-point=}'[select the entry point for roles]:entry point'
+ '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(become cache callback cliconf connection httpapi inventory lookup netconf shell vars module strategy role keyword)'
+ '(-r --roles-path)'{-r+,--roles-path=}'[specify directory containing roles]:directory:_directories'
'*:plugin:->plugins'
)
;;
@@ -124,15 +125,16 @@ case $service in
'(-y --yaml --vars --graph)--toml[use TOML format instead of JSON]'
'(-y --yaml)--vars[add variables to the graph display]'
'(-y --yaml --toml --vars --graph)'{-y,--yaml}'[use YAML format instead of JSON]'
+ ':host or group:->hosts'
)
;;
ansible-galaxy)
- args+=( -A "-*" $args
+ args=( -A "-*" $args
'--list[list integrations]'
'(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]'
'(-s --server)'{-s+,--server=}'[specify API server destination]:server destination'
'--remove=[remove integration]:integration id'
- '1:action:(delete import info init install list login remove search setup)'
+ '::type:(collection role)'
'*::args:->galaxy'
)
;;
@@ -154,7 +156,7 @@ case $service in
'(-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)'
- '--accept-host-key[adds the hostkey for the repo url if not already added]'
+ '--accept-host-key[add the hostkey for the repo url if not already added]'
'--purge[purge checkout after playbook run]'
'(-f --force)'{-f,--force}'[run the playbook even if the repository could not be updated]'
'(-C --checkout)'{-C,--checkout}'[specify branch/tag/commit to checkout]:branch/tag/commit'
@@ -168,9 +170,7 @@ case $service in
;;
ansible-vault)
args=( -A "-*" $args
- '::action:(create decrypt edit encrypt encrypt_string rekey view)'
- '--new-vault-id=[specify new vault identity to use for rekey]:vault id'
- '--new-vault-password-file=[specify new vault password file to use for rekey]:file:_files'
+ '::action:compadd -M "r:|_=* r:|=*" - create decrypt edit encrypt encrypt_string rekey view'
'*::args:->vault'
)
;;
@@ -225,34 +225,82 @@ case $state in
if zstyle -T ":completion:${curcontext}:plugins" verbose; then
(( ${(P)#plugvar} )) || set -A ${plugvar} \
${${(f)"$(_call_program plugins ansible-doc -t $plug -l)"}/ ##/:}
- _describe -t plugins "${plug} plugin" $plugvar && ret=0
+ _describe -t plugins "${plug} plugin" $plugvar -M 'r:|.=* r:|=*' && ret=0
else
(( ${(P)#plugvar} )) || set -A ${plugvar} \
${${(f)"$(_call_program plugins ansible-doc -t $plug -F)"}%% *}
- _wanted plugins expl "${plug} plugin" compadd -a $plugvar && ret=0
+ _wanted plugins expl "${plug} plugin" compadd -M 'r:|.=* r:|=*' -a $plugvar && ret=0
fi
;;
+ tags)
+ # The recursive glob here is questionable and perhaps there should be a style.
+ _sequence _wanted tags expl tag compadd - \
+ ${(s.,.)${(j.,.)${(M)${(f)"$(cat **/*.yml)"}:# #tags:*}#*: }} && ret=0
+ ;;
galaxy)
ign=''
- curcontext="${curcontext%:*}-${line[1]}:"
- (( $#words > 2 )) && ign='!'
+ gactions=( delete import info init install list remove search setup )
+ case ${(j.:.)line[1,3]} in
+ (role|collection):*:*)
+ subcmd="${line[1]}-${line[2]}"
+ ;;
+ collection:*)
+ gactions=( init build publish install )
+ subcmd=collection
+ ;;
+ role:*) subcmd=role ;;
+ *:*) subcmd="role-${line[1]}" ;&
+ [^:]#)
+ words=( role "$words[@]" )
+ (( CURRENT++ ))
+ ;;
+ esac
+ curcontext="${curcontext%:*}-${subcmd}:"
+ (( $#words > 3 )) && 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]'
+ '1: :{ _wanted actions expl action compadd -a gactions }'
)
- case $line[1] in
- info|search|list|remove|install)
+ case $subcmd in
+ *-*)
+ args+=(
+ '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]'
+ '(-s --server)'{-s+,--server=}'[specify API server destination]:server:_hosts'
+ --{token,api-key}='[specify ansible galaxy API key]:api key'
+ \*{-v,--verbose}'[verbose mode]'
+ )
+ ;|
+ role-setup) # order important here, source comes before github args
+ args+=( ': :_guard "^-*" "source"' '*:secret' )
+ ;|
+ role-(delete|import|setup))
+ args+=( ': :_guard "^-*" "github username"' ':github repository' )
+ ;|
+ role-(info|init|install|list|remove))
+ args+=( '*: :_guard "^-*" "role name"' )
+ ;|
+ role-(info|search|list|remove|install))
args+=( '(-p --roles-path)'{-p,--roles-path}'[specify location of roles]:path:_directories' )
;|
- info|init)
+ role-(info|init))
args+=( "--offline[don't query the galaxy API]" )
;|
- init|install)
- args+=( '(-f --force)'{-f,--force}'[force overwriting an existing role]' )
+ *-(init|build|install))
+ args+=( '(-f --force)'{-f,--force}'[force overwriting an existing role or collection]' )
;|
- search)
+ *-install)
+ args+=(
+ '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors and continue with the next specified role/collection]'
+ '(-n --no-deps)'{-n,--no-deps}"[don’t download roles/collections listed as dependencies]"
+ "--force-with-deps[force overwriting an existing role/collection and it's dependencies]"
+ )
+ ;|
+ *-init)
+ args+=(
+ '--init-path=[specify path in which the skeleton will be created]:path:_directories'
+ )
+ ;|
+ role-search)
args+=(
'--author=[specify GitHub username]:username'
'--galaxy-tags=[specify list of galaxy tags to filter by]:galaxy tags'
@@ -260,29 +308,25 @@ case $state in
'*: :_guard "^-*" "search term"'
)
;;
- setup)
+ role-setup)
args+=(
'--list[list integrations]'
'--remove=[remove integration]:integration id'
)
;;
- init)
+ role-init)
args+=(
- '--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]'
+ '--role-skeleton=[specify path to a role skeleton that the new role should be based upon]:path:_files'
'--type=[initialize using an alternate role type]:role type:(container apb network)'
)
;;
- install)
+ role-install)
args+=(
- "--force-with-deps[force overwriting an existing role and it's dependencies]"
- '(-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'
)
;;
- import)
+ role-import)
args+=(
'--status[check the status of the most recent import request for given github_user/github_repo]'
"--no-wait[don’t wait for import results]"
@@ -290,34 +334,70 @@ case $state in
'--role-name=[specify name the role should have]:role'
)
;;
- login)
+ collection-build)
+ args+=(
+ '--output-path=[specify path in which the collection is built to]:path [.]:_directories'
+ '*:collection directory to build:_directories'
+ )
+ ;;
+ collection-init)
args+=(
- '--github-token=[identify with github token rather than username and password]'
+ '--collection-skeleton=[specify path to a collection skeleton that the new role should be based upon]:path:_files'
+ ': :_guard "^-*" "collection name"'
)
;;
+ collection-publish)
+ args+=(
+ "--no-wait[don't wait for import validation results]"
+ '--import-timeout=[specify time to wait for import process]:time'
+ ':collection tarball:_files'
+ )
+ ;;
+ collection-install)
+ args+=(
+ '(-p --collections-path)'{-p+,--collections-path=}'[specify directory containing collections]:_directories'
+ '(-r --requirements-file *)'{-r+,--requirements-file=}'[specify file containing a list of collections to install]:file:_files'
+ '--pre[include pre-release versions]'
+ '*:collection name:_files'
+ )
+ ;;
esac
- _arguments -s -S $args && ret=0
+ _arguments -s -S : $args && ret=0
;;
vault)
+ ign=''
curcontext="${curcontext%:*}-${line[1]}:"
- args=()
+ (( $#words > 2 )) && ign='!'
+ args=(
+ "${ign}(-)"{-h,--help}'[display usage information]'
+ --ask-vault-pass{,word}'[ask for vault password]'
+ '--vault-id=[specify vault identity to use]:vault identity'
+ --vault-pass{,word}-file='[specify vault password file]:vault password file:_files'
+ \*{-v,--verbose}'[verbose mode]'
+ )
case $line[1] in
- encrypt*|edit|rekey)
+ create|(de|en)crypt*|edit|rekey)
args+=(
'--encrypt-vault-id=[specify vault id to use to encrypt (required if more than one vault-id is provided)]:vault id'
)
;|
- (de|en)crypt*) args=( '--output=[specify output file name]:file:_files' ) ;|
+ (de|en)crypt*) args+=( '--output=[specify output file name]:file:_files' ) ;|
encrypt_string)
args+=(
'(-p --prompt)'{-p,--prompt}'[prompt for the string to encrypt]'
+ "--show-input[don't hide input when prompted for the string to encrypt]"
'(-n --name)'{-n+,--name=}'[specify the variable name]:variable'
'--stdin-name=[specify the variable name for stdin]:variable'
)
;|
create|edit|rekey|view) args+=( ':file:_files' ) ;|
- (en|de)crypt) args+=( '::file:_files' )
- ;;
+ decrypt|rekey)
+ args+=(
+ '--new-vault-id=[specify new vault identity to use]:vault identity'
+ '--new-vault-password-file=[specify new vault password file]:vault password file:_files'
+ )
+ ;|
+ (en|de)crypt) args+=( '::file:_files' ) ;;
esac
_arguments -s -S $args && ret=0
;;
diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant
index 080ce6857..7401c7449 100644
--- a/Completion/Unix/Command/_ant
+++ b/Completion/Unix/Command/_ant
@@ -56,7 +56,7 @@ _arguments -C \
'-propertyfile[load all properties from specified file with -D properties taking precedence]:property file:_files -g "*.properties(-.)"' \
'-inputhandler[specify class which will handle input requests]:class:->class' \
'(-s -find -f -file -buildfile)'{-s,-find}'[search for specified build file towards the root of filesystem]:build file:(build.xml)' \
- '-nice[specify a niceness value for the main thread]:niceness value (default 5):({1..10})' \
+ '-nice[specify a niceness value for the main thread]:niceness value [5]:({1..10})' \
'-nouserlib[run ant without using the jar files from ${user.home}/.ant/lib]' \
'-noclasspath[run ant without using CLASSPATH]' \
'-autoproxy[Java1.5+: use the OS proxy settings]' \
diff --git a/Completion/Unix/Command/_arp b/Completion/Unix/Command/_arp
index 389f1099b..7727de28c 100644
--- a/Completion/Unix/Command/_arp
+++ b/Completion/Unix/Command/_arp
@@ -61,7 +61,7 @@ case $OSTYPE in
openbsd*)
args+=(
'(-a -d -W)-F[overwrite existing entries]'
- '(-W)-V+[select the routing domain]:routing domain'
+ '(-W)-V+[select the routing domain]:routing domain:_routing_domains'
)
cmds+=(
'(- 1)-W[send the wake on LAN frame]'
diff --git a/Completion/Unix/Command/_attr b/Completion/Unix/Command/_attr
index 121c0c539..efa7c5c4f 100644
--- a/Completion/Unix/Command/_attr
+++ b/Completion/Unix/Command/_attr
@@ -23,6 +23,7 @@ case $service in
'(-e --encoding)'{-e+,--encoding=}'[encode values after retrieving them]:encoding:(text hex base64)' \
'(-h --no-dereference)'{-h,--no-dereference}"[don't follow symbolic links]" \
'(-m --match)'{-m+,--match=}'[only include attributes with names matching regex]:regular expression' \
+ '--one-file-system[skip files on different filesystems]' \
"--absolute-names[don't strip leading slash characters]" \
'--only-values[dump only attribute values]' \
'(-R --recursive)'{-R,--recursive}'[list attributes of all files and directories recursively]' \
diff --git a/Completion/Unix/Command/_awk b/Completion/Unix/Command/_awk
index dcb2a6c21..e8f4a2530 100644
--- a/Completion/Unix/Command/_awk
+++ b/Completion/Unix/Command/_awk
@@ -1,6 +1,6 @@
#compdef awk gawk nawk
-# For gawk ver.3 and 4, in addition to POSIX.
+# For gawk ver.3 to 5, in addition to POSIX.
#
# gawk's options '-W ...' (such as '-W help') are not supported.
# gawk3 has some synonyms for long options (e.g., --compat is a synonym
@@ -14,7 +14,7 @@ local variant curcontext="$curcontext" state state_descr line ret=1
local -A opt_args
local -a args
-_pick_variant -r variant gawk4='GNU Awk 4' gawk3='GNU Awk 3' posix --version
+_pick_variant -r variant gawk4='GNU Awk [45]' gawk3='GNU Awk 3' posix --version
args=(
{-F+,--field-separator}'[define input field separator by extended regex]:extended regular expression:'
diff --git a/Completion/Unix/Command/_baz b/Completion/Unix/Command/_baz
index 6787f41e2..0acdc4639 100644
--- a/Completion/Unix/Command/_baz
+++ b/Completion/Unix/Command/_baz
@@ -38,8 +38,8 @@ _baz_revisions () { _arch_namespace baz 4 "$argv[@]" }
(( $+functions[_baz_local_revisions] )) ||
_baz_local_revisions () {
local expl1 expl2 tree_version=`$BAZ tree-version`
- _description -V applied-patches expl1 "patches from this version"
- _description -V other-patches expl2 "patches from other versions"
+ _description -V applied-patches expl1 "patch from this version"
+ _description -V other-patches expl2 "patch from other versions"
compadd "$expl1[@]" `$BAZ logs`
compadd "$expl2[@]" `$BAZ logs --full $($BAZ log-versions | grep -v $tree_version)`
# This is incredibly slow.
@@ -64,7 +64,7 @@ _baz_config () {
if [[ -d "$root/configs" ]]; then
configdir=("$root/configs")
- _description files expl '%Bconfig file%b'
+ _description files expl 'config file'
_files -W configdir "$expl[@]" && ret=0
else
_message -e messages "No configs/ directory in tree whose root is $root"
@@ -82,7 +82,7 @@ _baz_limit () { #presently only does push-mirror style limits
if [[ $PREFIX != *--* ]]; then
_description -V categories expl "categories in $archive"
- compadd -q -S -- "$expl[@]" `$BAZ categories $archive`
+ compadd -q -S -- "$expl[@]" `$BAZ category $archive`
else
_baz_namespace_branches 3
fi
@@ -98,7 +98,7 @@ _baz_tree_or_rev () {
_baz_libraries () {
local libraries expl
libraries=($(_call_program baz $BAZ my-revision-library))
- _description -V libraries expl "revision libraries"
+ _description -V libraries expl "revision library"
compadd "$expl[@]" -a libraries
}
@@ -115,7 +115,7 @@ _baz_my_revision_library () {
_baz_log_versions () {
local logs expl
logs=($(_call_program baz $BAZ log-versions))
- _description -V versions expl "log versions"
+ _description -V versions expl "log version"
compadd "$expl[@]" -a logs
}
@@ -238,12 +238,12 @@ methods=(
cmd_tagging_method=($cmd_id_tagging_method)
local cmd_add cmd_add_id cmd_add_tag
-cmd_add=('*:files to add:_files')
+cmd_add=('*:file to add:_files')
cmd_add_id=($cmd_add)
cmd_add_tag=($cmd_add)
local cmd_delete cmd_delete_id cmd_delete_tag
-cmd_delete=('*:files to delete:_files')
+cmd_delete=('*:file to delete:_files')
cmd_delete_id=($cmd_delete)
cmd_delete_tag=($cmd_delete)
@@ -272,7 +272,7 @@ cmd_changeset=(
':ORIG:_files -/'
':MOD:_files -/'
':DEST:_files -/'
- '*:files:_files'
+ '*:file:_files'
)
cmd_mkpatch=("$cmd_changeset[@]")
@@ -288,7 +288,7 @@ local cmd_make_archive
cmd_make_archive=('::name:' ':location:_files -/')
local cmd_archive_setup
-cmd_archive_setup=('*:versions:_baz_branches --trailing-dashes')
+cmd_archive_setup=('*:version:_baz_branches --trailing-dashes')
local cmd_make_category
cmd_make_category=(':category:_baz_archives -S /')
@@ -304,7 +304,7 @@ cmd_import=('::version:_baz_versions')
cmd_imprev=($cmd_import)
local cmd_commit cmd_cmtrev
-cmd_commit=('*:files:_files')
+cmd_commit=('*:file:_files')
cmd_cmtrev=($cmd_commit)
local cmd_get cmd_getrev
@@ -573,7 +573,7 @@ _baz_main () {
local -U cmds
help=(${(f)"$($BAZ help)"})
cmds=(${${${${(M)help:#* :*}/ #: #/:}%% ##}## #})
- arguments=(':commands:(($cmds))')
+ arguments=(':command:(($cmds))')
fi
_arguments -S -A '-*' \
{"${hide_short}(: -)-V",'(: -)--version'}'[display version]' \
diff --git a/Completion/Unix/Command/_bittorrent b/Completion/Unix/Command/_bittorrent
index 1f305a1c0..1fbab35ef 100644
--- a/Completion/Unix/Command/_bittorrent
+++ b/Completion/Unix/Command/_bittorrent
@@ -69,7 +69,7 @@ case $service in
'--piece_size_pow2+[specify power of 2 to set the piece size to]:power:' \
"--comment+[specify human-readable comment to put in .torrent]:comment:"\
"--target+[specify target file for the torrent]:file:_files"\
- ':file:_files -g "*"'
+ ':file:_files'
return
;;
diff --git a/Completion/Unix/Command/_bpython b/Completion/Unix/Command/_bpython
index 233e032e6..2c2ea11b8 100644
--- a/Completion/Unix/Command/_bpython
+++ b/Completion/Unix/Command/_bpython
@@ -41,6 +41,3 @@ case "$service" in
"$gtk_opts[@]"
;;
esac
-
-
-# vim:autoindent expandtab shiftwidth=2 tabstop=2 softtabstop=2 filetype=zsh
diff --git a/Completion/Unix/Command/_bzr b/Completion/Unix/Command/_bzr
index 1b755b4ec..121c28166 100644
--- a/Completion/Unix/Command/_bzr
+++ b/Completion/Unix/Command/_bzr
@@ -65,7 +65,7 @@ case $cmd in
'--no-recurse[do not recurse into subdirectories]'
'(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]'
'(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]'
- '*:unknown files:_bzr_unknownFiles'
+ '*:unknown file:_bzr_unknownFiles'
)
;;
@@ -74,7 +74,7 @@ case $cmd in
'--all[show annotations on all lines]'
'--long[show date in annotations]'
'(-r --revision)'{--revision=,-r}'[the revision to show]:rev:'
- '*:files:_bzr_versionedFiles'
+ '*:file:_bzr_versionedFiles'
)
;;
@@ -100,7 +100,7 @@ case $cmd in
(rename|move|mv)
if (( CURRENT == 2 )); then
- args+=( '*:files:_bzr_versionedFiles' )
+ args+=( '*:file:_bzr_versionedFiles' )
else
args=( '*:destination dir:_files -/' )
fi
@@ -218,7 +218,7 @@ case $cmd in
'--unchanged[include unchanged files]'
'(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]'
'(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]'
- '*:modified files:_bzr_modifiedFiles'
+ '*:modified file:_bzr_modifiedFiles'
)
;;
@@ -229,7 +229,7 @@ case $cmd in
'--all[shelve all changes]'
'(-q --quiet)'{--quiet,-q}'[be quiet]'
'(-v --verbose)'{--verbose,-v}'[display more information]'
- '*:modified files:_bzr_modifiedFiles'
+ '*:modified file:_bzr_modifiedFiles'
)
;;
@@ -279,7 +279,7 @@ case $cmd in
'(-r --revision)'{--revision=,-r}'[revision]:revision:'
'--diff-options=[options to pass to gdiff]:diff options:'
'(-p --prefix)'{--prefix,-p}'[set prefix added to old and new filenames]'
- '*:files:_files'
+ '*:file:_files'
)
;;
@@ -376,7 +376,7 @@ case $cmd in
args+=(
'--all[show annotations on all lines]'
"--plain[don't highlight annotation lines]"
- '*:files:_bzr_versionedFiles'
+ '*:file:_bzr_versionedFiles'
)
;;
diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod
index 3f6db7e91..42e3fa63b 100644
--- a/Completion/Unix/Command/_chmod
+++ b/Completion/Unix/Command/_chmod
@@ -1,7 +1,10 @@
#compdef chmod gchmod zf_chmod
local curcontext="$curcontext" state line expl ret=1 variant
-local -a args privs aopts=( -A '-*' )
+local -a args privs aopts
+
+# usual -* pattern picks up valid non-options, e.g. -x which is like a-x
+aopts=( -A '-[^gorstuwxX]*' )
args=( '*: :->files' '1: :_file_modes' )
diff --git a/Completion/Unix/Command/_cpio b/Completion/Unix/Command/_cpio
index 699b1d8f2..20f8c712d 100644
--- a/Completion/Unix/Command/_cpio
+++ b/Completion/Unix/Command/_cpio
@@ -25,15 +25,15 @@ else
'--message=:message at end of volume:'
'--null' '--reset-access-time'
'--verbose' '--dot' '--append'
- '--block-size=:block size in 512 byte units:'
+ '--block-size=:block size (512 byte units)'
'--dereference'
- '--io-size=:block size in bytes'
+ '--io-size=:block size (bytes)'
'--quiet' '--force-local' '--help' '--version')
fi
args+=(
'-A[append files to archive]'
'-B[block size 5120 bytes with special file]'
- '-C[set block size per record]:block size in bytes:(8192)'
+ '-C[set block size per record]:block size (bytes)'
'-F[set archive file to use]:archive file:->afile'
'(-H)-c[read/write header in ASCII]'
"(-c)-H[set format type for archive header]:$fmts"
@@ -49,7 +49,7 @@ else
'--preserve-modification-time' '--numeric'
'--rename' '--list' '--swap-bytes' '--swap-halfwords'
'--dot' '--unconditional' '--verbose'
- '--block-size=:block size in 512 byte units:'
+ '--block-size=:block size (512 byte units)'
'--swap-halfwords'
'--io-size=:block size in bytes:'
'--pattern-file=:file with list of patterns:_files'
@@ -63,7 +63,7 @@ else
'-b[reverse bytes in word]'
'-B[block size 5120 bytes with special file]'
'-d[create directories as needed]'
- '-C[set block size per record]:block size in bytes:(8192)'
+ '-C[set block size per record]:block size (bytes)'
'-E[read filenames from file]:file name for list of files:_files'
'-f[only copy files not matching patterns]'
'-F[set archive file to use]:archive file:->afile'
diff --git a/Completion/Unix/Command/_csplit b/Completion/Unix/Command/_csplit
new file mode 100644
index 000000000..5f72232bb
--- /dev/null
+++ b/Completion/Unix/Command/_csplit
@@ -0,0 +1,51 @@
+#compdef csplit
+
+local curcontext=$curcontext cnt_info ret=1
+local -a state state_descr line specs optA
+typeset -A opt_args
+
+# common specs
+specs=(
+ '(hv -f --prefix)'{-f+,--prefix=}'[specify prefix for output file names]:prefix [xx]: '
+ '(hv -n --digits -b --suffix-format)'{-n+,--digits=}'[specify number of digits in output file names]:number [2]: '
+ '(hv -k --keep-files)'{-k,--keep-files}'[do not remove output files on errors]'
+ '(hv -s --quiet --silent)'{-s,--quiet,--silent}'[do not print counts of output file sizes]'
+ '(hv)1: :_files'
+ '(hv)*: :->patterns'
+)
+
+if _pick_variant gnu=GNU unix --version; then
+ # GNU coreutils 8.32
+ specs+=(
+ '(hv -b --suffix-format -n --digits)'{-b+,--suffix-format=}'[specify format for numbers in output file names]:format [%%02d]: '
+ '(hv)--suppress-matched[suppress the lines matching the pattern]'
+ '(hv -z --elide-empty)'{-z,--elide-empty-files}'[remove empty output files]'
+ + hv
+ '(: * -)--help[display help and exit]'
+ '(: * -)--version[output version information and exit]'
+ )
+ cnt_info="(integer or '*')"
+else
+ # POSIX ({Free,Open}BSD, DragonFly, macOS)
+ specs=( ${specs:#(|*\))--*} ) # remove long options
+ optA=( -A '-?*' ) # a single '-' is a valid file name (stdin)
+fi
+
+_arguments -C -s -S $optA : $specs && ret=0
+
+case $state in
+ patterns)
+ if compset -P '(/?*/|%?*%)'; then
+ _message '[+|-]offset' && ret=0
+ elif compset -P '[/%]'; then
+ _message 'regex' && ret=0
+ elif compset -P '(|\\){'; then
+ _message "count $cnt_info" && ret=0
+ elif compset -P '[0-9]*'; then
+ _message 'line number' && ret=0
+ elif [[ ${words[CURRENT]} != -* ]] then
+ _message "line_number, '/regex/[offset]', '%%regex%%[offset]', or '{count}'" && ret=0
+ fi
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_ctags b/Completion/Unix/Command/_ctags
new file mode 100644
index 000000000..e2b28011b
--- /dev/null
+++ b/Completion/Unix/Command/_ctags
@@ -0,0 +1,244 @@
+#compdef ctags arduino-ctags ctags-exuberant ctags-universal
+
+local context state line expl
+local -A opt_args
+local -a arguments
+
+if [ -z "$_ctags_type" ]; then
+ local output=`ctags --version 2>&1`
+ if [[ "$output" = *Universal\ Ctags* ]]; then
+ _ctags_type="universal"
+ elif [[ "$output" = *Exuberant\ Ctags* ]]; then
+ _ctags_type="exuberant"
+ elif [[ "$output" = *usage:\ ctags* ]]; then
+ _ctags_type="bsd"
+ elif [[ "$output" = *Emacs* ]]; then
+ _ctags_type="etags"
+ else
+ _ctags_type="universal"
+ fi
+fi
+
+if [ "$_ctags_type" = "etags" ]; then
+ _etags
+ return $?
+fi
+
+_ctags_languages() {
+ _call_program languages $service --list-languages | sed -n 's/^\([A-Za-z][A-Za-z0-9#_+]*\).*/\1/p'
+}
+
+if [[ "$PREFIX" = --alias-*=* ]]; then
+ _message pattern
+ return 1
+elif [[ "$PREFIX" = --extras-*=* ]]; then
+ _message flags
+ return 1
+elif [[ "$PREFIX" = --fields-*=* ]]; then
+ _message flags
+ return 1
+elif [[ "$PREFIX" = --input-encoding-*=* ]]; then
+ _message encoding
+ return 1
+elif [[ "$PREFIX" = --kinddef-*=* ]]; then
+ _message kind
+ return 1
+elif [[ "$PREFIX" = --kinds-*=* ]]; then
+ _message kind
+ return 1
+elif [[ "$PREFIX" = --map-*=* ]]; then
+ _message pattern
+ return 1
+elif [[ "$PREFIX" = --mline-regex-*=* ]]; then
+ _message pattern
+ return 1
+elif [[ "$PREFIX" = --param-*=* ]]; then
+ _message argument
+ return 1
+elif [[ "$PREFIX" = --regex-*=* ]]; then
+ _message pattern
+ return 1
+elif [[ "$PREFIX" = --roles-*.*=* ]] then
+ _message role
+ return 1
+elif [[ "$PREFIX" = --roles-*.* ]] then
+ _message kind
+ return 1
+fi
+
+if [ "$_ctags_type" = "universal" ]; then
+ arguments=(
+ "-a[append to tags file]"
+ "-B[use backward searching patterns (?...?)]"
+ "-D[give definition for macro]:macro definition:"
+ "-e[output tag file for use with emacs]"
+ {-f+,-o+}"[write tags to specified file]:output file:_files"
+ "-F[use forward searching patterns (/.../)]"
+ "-h[specify a list of file extensions to be treated as include files]:extensions"
+ "-I[specify a list of tokens to be specially handled]:identifier list"
+ "-L[read a list of input file names from the specified file]:input file:_files"
+ "-n[equivalent to --excmd=number]"
+ "-N[equivalent to --excmd=pattern]"
+ "(--recurse -R)--recurse=-[search files recursively]::bool:(yes no)"
+ "(--recurse -R)-R[search files recursively]"
+ "-u[equivalent to --sort=no]"
+ "-x[print a tabular cross reference file to stdout]"
+ "--alias--[add a pattern detecting a name, can be used as an alt name for lang]:language:->languageequals"
+ "--append=-[should tags be appended to existing tag file]:bool:(yes no)"
+ "--etags-include=-[include reference to file in emacs style tag file]:file:_files"
+ "--exclude=-[exclude files and directories matching pattern]:pattern"
+ "--exclude-exception=-[don't exclude files and directories matching pattern even if they match the pattern specified with --exclude]:pattern"
+ "--excmd=-[uses the specified type of ex command to locate tags]:ex command type:(number pattern mix combine)"
+ "--extras=-[include extra tag entries for selected information]:flags (fFgpqrs)"
+ "--extras--[include <lang> own extra tag entries for selected information]:language:->languageequals"
+ "--fields=-[include selected extension fields]:flags (aCeEfFikKlmnNpPrRsStxzZ)"
+ "--fields--[include selected <lang> own extension fields]:language:->languageequals"
+ "--filter=-[behave as a filter, reading file names from stdin and writing tags to stdout]:bool:(yes no)"
+ "--filter-terminator=-[specify string to print to stdout following the tags for each file parsed when --filter is enabled]:string"
+ "--format=-[force output of specified tag file format]:level"
+ "(--guess-language-eagerly -G)"{--guess-language-eagerly,-G}"[guess the language of input file more eagerly]"
+ {--help,-?}"[display help text]"
+ "--help-full[display help text with experimental features]"
+ "--if0=-[should code within #if 0 conditionals be parsed]:bool:(yes no)"
+ "--input-encoding=-[specify encoding of all input files]:encoding"
+ "--input-encoding--[specify encoding of the <lang> input files]:language:->languageequals"
+ "--kinddef--[define new kind for <lang>]:language:->languageequals"
+ "--kinds--[enable/disable tag kinds for <lang>]:language:->languageequals"
+ "--langdef=-[define a new language to be parsed with regular expressions]:name"
+ "--langmap=-[override default mapping of language to input file extension]:maps"
+ "--language-force=-[force all files to be interpreted using specified language]:language:->language"
+ "--languages=-[restrict files scanned to these comma-separated languages]:language:->languages"
+ "--license[print details of software license]"
+ "--line-directives=-[should #line directives be processed]:bool:(yes no)"
+ "--links=-[indicate whether symlinks should be followed]:bool:(yes no)"
+ "--list-aliases=-[list of alias patterns]:language:->language"
+ "--list-excludes[list of exclude patterns for files/dirs]"
+ "--list-extras=-[list of extra tag flags]:language:->language"
+ "--list-features[list of compiled features]"
+ "--list-fields=-[list of fields]:language:->language"
+ "--list-kinds=-[list of all tag kinds for lang]:language:->language"
+ "--list-kinds-full=-[list details of all tag kinds for lang]:language:->language"
+ "--list-languages[list of supported languages]"
+ "--list-map-extensions=-[list of language extensions in mapping]:language:->language"
+ "--list-map-patterns=-[list of language patterns in mapping]:language:->language"
+ "--list-maps=-[list of language mappings (both extensions and patterns)]:language:->language"
+ "--list-mline-regex-flags[list of flags which can be used in a multiline regex parser definition]"
+ "--list-params=-[list of language parameters. works with --machinable]:language:->language"
+ "--list-pseudo-tags[list of pseudo tags]"
+ "--list-regex-flags[list of flags which can be used in a regex parser definition]"
+ "--list-roles=-[list of all roles of tag kinds specified for langs]:language:->language"
+ "--list-subparsers=-[list of subparsers for the base lang]:language:->language"
+ "--machinable=-[use tab separated representation in --list-* output]:bool:(yes no)"
+ "--map--[set, add(+), or remove(-) the map for <lang>]:language:->languageequals"
+ "--maxdepth=-[specify maximum recursion depth]:depth"
+ "--mline-regex--[define multiline regex for locating tags in <lang>]:language:->languageequals"
+ "--options=-[specify file (or dir) from which command line options should be read]:file:_files"
+ "--options-maybe=-[same as --options but doesn't error]:file:_files"
+ "--optlib-dir=-[add or set dir to optlib search path]:dir:_files -/"
+ "--output-encoding=-[the encoding to write the tag file in]:encoding"
+ "--output-format=-[specify the output format]:format:(u-ctags e-ctags etags xref)"
+ "--param--[set <lang> specific parameter]:language:->languageequals"
+ "--pattern-length-limit=-[cutoff patterns of tag entries after N characters]:number"
+ "--print-language[don't make tags file but just print the guessed lang name for input file]"
+ "--pseudo-tags=-[enable/disable emitting pseudo tag named ptag. if *, enable emitting all pseudo tags]:ptag"
+ "--put-field-prefix[put UCTAGS as prefix for the name of fields newly introducted in universal ctags]"
+ "--quiet=-[don't print notice class messages]:bool:(yes no)"
+ "--regex--[define regex for locating tags in specific lang]:language:->languageequals"
+ "--roles--[enable/disable tag roles for kinds of <lang>]:language:->languagedot"
+ "--sort=-[should tags be sorted]:argument:(yes no foldcase)"
+ "--tag-relative=-[should paths be relative to location of tag file]:argument:(yes no always never)"
+ "--totals=-[print stats about input and tag files]:argument:(yes no extra)"
+ "(--verbose -V)--verbose=-[enable verbose messages describing actions]:bool:(yes no)"
+ "(--verbose -V)-V[enable verbose messages describing actions]"
+ "--version[print version]"
+ "--with-list-header=-[prepend the column descriptions in --list-* output]:bool:(yes no)"
+ "*:file:_files"
+ )
+elif [ "$_ctags_type" = "exuberant" ]; then
+ arguments=(
+ "-a[append to tags file]"
+ "-B[use backward searching patterns (?...?)]"
+ "-e[output tag file for use with emacs]"
+ {-f+,-o+}"[write tags to specified file]:output file:_files"
+ "-F[use forward searching patterns (/.../)]"
+ "-h[specify a list of file extensions to be treated as include files]:extensions"
+ "-I[specify a list of tokens to be specially handled]:identifier list"
+ "-L[read a list of input file names from the specified file]:input file:_files"
+ "-n[equivalent to --excmd=number]"
+ "-N[equivalent to --excmd=pattern]"
+ "(--recurse -R)--recurse=-[search files recursively]::bool:(yes no)"
+ "(--recurse -R)-R[search files recursively]"
+ "-u[equivalent to --sort=no]"
+ "-x[print a tabular cross reference file to stdout]"
+ "--append=-[should tags be appended to existing tag file]:bool:(yes no)"
+ "--etags-include=-[include reference to file in emacs style tag file]:file:_files"
+ "--exclude=-[exclude files and directories matching pattern]:pattern"
+ "--excmd=-[uses the specified type of ex command to locate tags]:ex command type:(number pattern mix)"
+ "--extra=-[include extra tag entries for selected information]:flags (fg)"
+ "--fields=-[include selected extension fields]:flags (afmikKlnsStz)"
+ "--file-scope=-[should tags scoped only for a single file be included in output]:bool:(yes no)"
+ "--filter=-[behave as a filter, reading file names from stdin and writing tags to stdout]:bool:(yes no)"
+ "--filter-terminator=-[specify string to print to stdout following the tags for each file parsed when --filter is enabled]:string"
+ "--format=-[force output of specified tag file format]:level"
+ "--help[display help text]"
+ "--if0=-[should code within #if 0 conditionals be parsed]:bool:(yes no)"
+ "--langdef=-[define a new language to be parsed with regular expressions]:name"
+ "--langmap=-[override default mapping of language to input file extension]:maps"
+ "--language-force=-[force all files to be interpreted using specified language]:language:->language"
+ "--languages=-[restrict files scanned to these comma-separated languages]:language:->languages"
+ "--license[print details of software license]"
+ "--line-directives=-[should #line directives be processed]:bool:(yes no)"
+ "--links=-[indicate whether symlinks should be followed]:bool:(yes no)"
+ "--list-kinds=-[list of all tag kinds for lang]:language:->language"
+ "--list-languages[list of supported languages]"
+ "--list-maps=-[list of language mappings (both extensions and patterns)]:language:->language"
+ "--options=-[specify file (or dir) from which command line options should be read]:file:_files"
+ "--regex--[define regex for locating tags in specific lang]:language:->language"
+ "--sort=-[should tags be sorted]:argument:(yes no foldcase)"
+ "--tag-relative=-[should paths be relative to location of tag file]:argument:(yes no)"
+ "--totals=-[print stats about input and tag files]:argument:(yes no)"
+ "(--verbose -V)--verbose=-[enable verbose messages describing actions]:bool:(yes no)"
+ "(--verbose -V)-V[enable verbose messages describing actions]"
+ "--version[print version]"
+ "*:file:_files"
+ )
+ if [[ "$PREFIX" = -* ]]; then
+ local -a languages=(`_ctags_languages`)
+ local -a languages2
+ for language in $languages; do
+ arguments+=("--$language-kinds=-:kinds")
+ done
+ fi
+elif [ "$_ctags_type" = "bsd" ]; then
+ arguments=(
+ "-a[append to tags file]"
+ "-B[use backward searching patterns (?...?)]"
+ "-d[create tags for #defines that don't take arguments]"
+ "-F[use forward searching patterns (/.../)]"
+ "-f+[write tags to specified file]:output file:_files"
+ "-t[create tags for typedefs, structs, unions, and enums]"
+ "-u[update the specified files in the tags file]"
+ "-v[an index of the form expected by vgrind(1) is produced]"
+ "-w[suppress warning diagnostics]"
+ "-x[ctags produces a simple function index]"
+ "*:file:_files"
+ )
+fi
+
+_arguments -s $arguments
+
+if [ "$state" = "language" ]; then
+ local -a languages=(`_ctags_languages`)
+ _wanted languages expl language compadd -a languages
+elif [ "$state" = "languageequals" ]; then
+ local -a languages=(`_ctags_languages`)
+ _wanted languages expl language compadd -S = -a languages
+elif [ "$state" = "languagedot" ]; then
+ local -a languages=(`_ctags_languages`)
+ _wanted languages expl language compadd -S . -a languages
+elif [ "$state" = "languages" ]; then
+ local -a languages=(`_ctags_languages`)
+ _values -s , languages $languages
+fi
+
+return $(( compstate[nmatches] > 0 ? 0 : 1 ))
diff --git a/Completion/Unix/Command/_curl b/Completion/Unix/Command/_curl
index 72e2e5b53..ecccdd389 100644
--- a/Completion/Unix/Command/_curl
+++ b/Completion/Unix/Command/_curl
@@ -4,4 +4,4 @@
# definition is provided as a fallback, and should be installed later
# in $fpath than the curl-provided definition of _curl.
-_urls "$@"
+_gnu_generic || _urls "$@"
diff --git a/Completion/Unix/Command/_cvs b/Completion/Unix/Command/_cvs
index cba3eb773..4dc5b6c60 100644
--- a/Completion/Unix/Command/_cvs
+++ b/Completion/Unix/Command/_cvs
@@ -371,10 +371,10 @@ _cvs_log() {
'-R[print the name of RCS file in the repository]' \
'-N[don'\''t list tags]' \
'(-h)-t[header with descriptive text]' \
- '-d+[specify dates]:dates' \
+ '-d+[specify dates]:date range' \
'-r-[specify revisions]:revisions' \
- '-s+[specify states]:states:(Exp Stab Rel dead)' \
- '-w-[specify logins]:logins' \
+ '-s+[specify states]:state:_sequence compadd - Exp Stab Rel dead' \
+ '-w-[specify logins]:login list' \
'*:file:_cvs_files'
}
@@ -388,10 +388,10 @@ _cvs_rlog() {
'(-l)-R[recursive]' \
'-N[don'\''t list tags]' \
'(-h)-t[header with descriptive text]' \
- '-d+[specify dates]:dates' \
+ '-d+[specify dates]:date range' \
'-r-[specify revisions]:revisions' \
- '-s+[specify states]:states:(Exp Stab Rel dead)' \
- '-w-[specify logins]:logins' \
+ '-s+[specify states]:state:_sequence compadd - Exp Stab Rel dead' \
+ '-w-[specify logins]:login list' \
'*:file:_cvs_modules'
}
diff --git a/Completion/Unix/Command/_date b/Completion/Unix/Command/_date
index 68bd357fb..97c272830 100644
--- a/Completion/Unix/Command/_date
+++ b/Completion/Unix/Command/_date
@@ -61,9 +61,13 @@ else
;|
freebsd*|dragonfly*|darwin*)
args+=(
+ "*-v+[adjust and print (but don't set) date]:[+-]value[ymwdHMS]"
+ )
+ ;|
+ freebsd<-12>.*|darwin*)
+ args+=(
'-d+:daylight saving time value'
'-t+:minutes west of GMT'
- "*-v+[adjust and print (but don't set) date]:[+-]value[ymwdHMS]"
)
;|
freebsd*|dragonfly*)
diff --git a/Completion/Unix/Command/_dd b/Completion/Unix/Command/_dd
index e5c5e63ce..10682bc8e 100644
--- a/Completion/Unix/Command/_dd
+++ b/Completion/Unix/Command/_dd
@@ -1,18 +1,19 @@
#compdef dd gdd
-local -a vals conv flags
+local -a vals conv flags units
local variant
+units=( w:word b:block k:1024 m g t )
_pick_variant -r variant gnu=GNU $OSTYPE --version
vals=(
- '(ibs obs)bs[block size]:block size (bytes)'
- 'cbs[conversion buffer size]:buffer size (bytes)'
+ '(ibs obs)bs[block size]: :_numbers -u bytes "block size" $units'
+ 'cbs[conversion buffer size]: :_numbers -u bytes "buffer size" $units'
'conv[specify conversions to apply]: :_values -s , conversion $conv'
'count[number of input blocks to copy]:blocks'
- '(bs)ibs[input block size]:block size (bytes)'
+ '(bs)ibs[input block size]: :_numbers -u bytes -d 512 "block size" $units'
'if[specify input file]:input file:_tilde_files'
- '(bs)obs[output block size]:block size (bytes)'
+ '(bs)obs[output block size]: :_numbers -u bytes -d 512 "block size" $units'
'of[specify output file]:output file:_tilde_files'
'seek[output blocks initially skipped]:blocks'
'skip[input blocks initially skipped]:blocks'
@@ -63,7 +64,7 @@ case $variant in
freebsd*)
vals+=(
'fillchar[specify padding character]:character'
- 'speed[limit copying speed]:speed (bytes/second)'
+ 'speed[limit copying speed]: :_numbers -u bytes/second speed $units'
)
conv+=(
'(pareven parnone parodd parset)'{pareven,parnone,parodd,parset}
@@ -75,6 +76,7 @@ case $variant in
)
flags+=( fullblock noatime nocache count_bytes skip_bytes seek_bytes )
conv+=( excl nocreat fdatasync fsync )
+ units=( c:1 w:2 b:512 kB:1000 K:1024 MB:1000^2 M:1024\^2 GB G TB T PB P EB E ZB Z YB Y )
;;
netbsd*)
vals+=(
diff --git a/Completion/Unix/Command/_dhclient b/Completion/Unix/Command/_dhclient
index d5ca5b271..e22586b04 100644
--- a/Completion/Unix/Command/_dhclient
+++ b/Completion/Unix/Command/_dhclient
@@ -20,7 +20,6 @@ case $OSTYPE in
openbsd*)
args+=(
'-i+[ignore values provided by leases for specified options]:options'
- '-L+[specify file to write option data too]:file:_files'
"-n[don't configure any interfaces]"
'-r[release the current lease back to the server it came from]'
'-v[verbose log messages]'
diff --git a/Completion/Unix/Command/_dict b/Completion/Unix/Command/_dict
index 202fc5bab..928728e06 100644
--- a/Completion/Unix/Command/_dict
+++ b/Completion/Unix/Command/_dict
@@ -21,6 +21,8 @@ _arguments -C -S \
'(--key -k)'{--key=,-k+}'[specify key for authentication]:shared secret:' \
'(-)'{--version,-V}'[display program version]' \
'(-)'{--license,-L}'[display program license]' \
+ '(-6)-4[force use of IPv4 addresses only]' \
+ '(-4)-6[force use of IPv6 addresses only]' \
'(-)--help[display usage info]' \
'(--verbose -v)'{--verbose,-v}'[verbose output]' \
'(--raw -r)'{--raw,-r}'[be very verbose]' \
diff --git a/Completion/Unix/Command/_dig b/Completion/Unix/Command/_dig
index d2ffb0a33..3081e2cfd 100644
--- a/Completion/Unix/Command/_dig
+++ b/Completion/Unix/Command/_dig
@@ -24,10 +24,12 @@ local -a alts args
'*+'{no,}'ednsnegotiation[set EDNS version negotiation]'
'*+ednsopt=[specify EDNS option]:code point'
'*+noedns[clear EDNS options to be sent]'
+ '*+'{no,}'expandaaaa[expand AAAA records]'
'*+'{no,}'expire[send an EDNS Expire option]'
'*+'{no,}'header-only[send query without a question section]'
'*+'{no,}'idnin[set processing of IDN domain names on input]'
'*+'{no,}'idnout[set conversion of IDN puny code on output]'
+ '*+'{no,}'keepalive[request EDNS TCP keepalive]'
'*+'{no,}'keepopen[keep TCP socket open between queries]'
'*+'{no,}'mapped[allow mapped IPv4 over IPv6 to be used]'
'*+'{no,}'recurse[set the RD (recursion desired) bit in the query]'
@@ -40,12 +42,15 @@ local -a alts args
'*+'{no,}'identify[print IP and port of responder]'
'*+'{no,}'comments[print comment lines in output]'
'*+'{no,}'stats[print statistics]'
+ '*+padding[set padding block size]:size [0]'
'*+'{no,}'qr[print query as it was sent]'
'*+'{no,}'question[print question section of a query]'
+ '*+'{no,}'raflag[set RA flag in the query]'
'*+'{no,}'answer[print answer section of a reply]'
'*+'{no,}'authority[print authority section of a reply]'
'*+'{no,}'all[set all print/display flags]'
'*+'{no,}'subnet[send EDNS client subnet option]:addr/prefix-length'
+ '*+'{no,}'tcflag[set TC flag in the query]'
'*+timeout=[set query timeout]:timeout (seconds) [5]'
'*+tries=[specify number of UDP query attempts]:tries'
'*+retry=[specify number of UDP query retries]:retries'
@@ -57,13 +62,12 @@ local -a alts args
'*+'{no,}"fail[don't try next server on SERVFAIL]"
'*+'{no,}'besteffort[try to parse even malformed messages]'
'*+'{no,}'dnssec[request DNSSEC records]'
- '*+'{no,}'sigchase[chase DNSSEC signature chains]'
- '*+trusted-key=[specify file containing trusted keys]:file:_files'
- '*+'{no,}'topdown[do DNSSEC validation in top down mode]'
'*+'{no,}'nsid[include EDNS name server ID request in query]'
'*+'{no,}'ttlid[display the TTL whening printing the record]'
'*+'{no,}'ttlunits[display the TTL in human-readable units]'
+ '*+'{no,}'unexpected[print replies from unexpected sources]'
'*+'{no,}'unknownformat[print RDATA in RFC 3597 "unknown" format]'
+ '*+'{no,}'yaml[present the results as YAML]'
'*+'{no,}'zflag[set Z flag in query]'
)
_arguments -s -C $args \
@@ -89,7 +93,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/_django b/Completion/Unix/Command/_django
index 9eaa2284a..1d5cf7311 100644
--- a/Completion/Unix/Command/_django
+++ b/Completion/Unix/Command/_django
@@ -146,9 +146,9 @@ case $state in
args+=(
$locale
$verbosity
- {-d,--domain=}'[domain of the message files (default: "django")]:domain'
+ {-d,--domain=}'[domain of the message files]:domain [django]:(django djangojs)'
{-a,--all}'[re-examine all code and templates]'
- {-e,--extensions=}'[file extension(s) to examine (default: ".html")]:extension'
+ {-e,--extensions=}'[file extension(s) to examine]:extension [html]'
)
;;
diff --git a/Completion/Unix/Command/_dmesg b/Completion/Unix/Command/_dmesg
index 3dd059214..1aa3bc262 100644
--- a/Completion/Unix/Command/_dmesg
+++ b/Completion/Unix/Command/_dmesg
@@ -1,6 +1,6 @@
#compdef dmesg
-local args
+local -a args
case $OSTYPE in
linux*) args=( -S -- ) ;;
@@ -27,6 +27,13 @@ case $OSTYPE in
'-n[use specified kernel core]:number'
)
;;
+ netbsd*)
+ args+=(
+ '-d[show timestamp deltas]'
+ '(-t)-T[format uptime timestamps in a human readable form]'
+ '(-T)-t[suppress printing uptime timestamps]'
+ )
+ ;;
esac
-_arguments -s $args
+_arguments -s : $args
diff --git a/Completion/Unix/Command/_doas b/Completion/Unix/Command/_doas
index 94395557c..3ef036a88 100644
--- a/Completion/Unix/Command/_doas
+++ b/Completion/Unix/Command/_doas
@@ -1,7 +1,8 @@
#compdef doas
-local environ e cmd
+local environ e cmd cpp
local -a _comp_priv_prefix
+local -A opt_args
zstyle -a ":completion:${curcontext}:" environ environ
@@ -10,13 +11,13 @@ do local -x "$e"
done
cmd="$words[1]"
+cpp='_comp_priv_prefix=( $cmd -n ${(kv)opt_args[(I)-u]} )'
_arguments -s -S -A '-*' : \
- - optL \
- '-L[clear any persisted authorizations]' \
- - default \
- '-a+[specify authentication style]:authentication style' \
- '(-n -s)-C+[check config file and report on command matching]:config:_files' \
- '(-C)-n[non-interactive: fail rather than prompt for a password]' \
- '(-C *)-s[run a shell]' \
- '-u+[run command as specified user]:user:_users' \
- '*::arguments:{ _comp_priv_prefix=( $cmd -n ${(kv)opt_args[-u]} ) ; _normal }'
+ '(: * -)-L[clear any persisted authorizations]' \
+ '(-L)-a+[specify authentication style]:authentication style' \
+ '(-L -n -s)-C+[check config file and report on command matching]:config:_files' \
+ '(-C -L)-n[non-interactive: fail rather than prompt for a password]' \
+ '(-C -L *)-s[run a shell]' \
+ '(-L)-u+[run command as specified user]: :_users' \
+ "(-)1: :{ $cpp; _command_names -e }" \
+ "*:: :{ $cpp; _normal }"
diff --git a/Completion/Unix/Command/_dropbox b/Completion/Unix/Command/_dropbox
new file mode 100644
index 000000000..45c77ae09
--- /dev/null
+++ b/Completion/Unix/Command/_dropbox
@@ -0,0 +1,66 @@
+#compdef dropbox
+
+if [[ CURRENT -eq 2 || $words[2] = help ]]; then
+ local -a line progs
+
+ _call_program command dropbox help |
+ while read -A line; do
+ if [[ $line[1] = [a-z]## ]]; then
+ progs+=("${line[1]}:${line[2,-1]}")
+ fi
+ done
+
+ _describe -t command 'Dropbox command' progs
+else
+ local -a opts
+
+ case $words[2] in
+ (exclude)
+ _path_files -g '*(/)'
+ ;;
+
+ (filestatus)
+ shift words
+ (( CURRENT-- ))
+ _arguments -s : \
+ '(-l --list)'{-l,--list}'[use format like ls]' \
+ '(-a --all)'{-a,--all}'[do not ignore entries starting .]' \
+ '*:File to list:_files'
+ ;;
+
+ (ls|puburl|sharelink)
+ _files
+ ;;
+
+ (autostart|lansync)
+ opts=("y:turn $words[2] on" "n:turn $words[2] off")
+ _describe "$words[2] behaviour" opts
+ ;;
+
+ (proxy)
+ _arguments \
+ '2:proxy mode:(none auto manual)' \
+ '3:proxy type for manual mode:(http socks4 socks5)' \
+ '4:proxy host for manual mode:_hosts' \
+ '5:proxy port for manual mode:_ports' \
+ '6:proxy user for manual mode:_users' \
+ '7:proxy password for manual mode:'
+ ;;
+
+ (start)
+ shift words
+ (( CURRENT-- ))
+ _arguments -s : '(-i --install)'{-i,--install}'[auto install dropboxd]'
+ ;;
+
+ (throttle)
+ _arguments \
+ '2:download limit (KB/s):(unlimited)' \
+ '3:upload limit (KB/s):(unlimited)'
+ ;;
+
+ (*)
+ _default
+ ;;
+ esac
+fi
diff --git a/Completion/Unix/Command/_dtruss b/Completion/Unix/Command/_dtruss
index bd1ae8bc5..b56e713d2 100644
--- a/Completion/Unix/Command/_dtruss
+++ b/Completion/Unix/Command/_dtruss
@@ -2,7 +2,7 @@
_arguments -s : \
'-a[print all details]' \
- '-b+[specify dynamic variable buffer size]:buffer size (default 4m)' \
+ '-b+[specify dynamic variable buffer size]:buffer size [4m]' \
'-c[print system call counts]' \
'-d[print relative timestamps]' \
'-e[print elapsed times]' \
diff --git a/Completion/Unix/Command/_ecasound b/Completion/Unix/Command/_ecasound
index a39e426db..5fd9055a7 100644
--- a/Completion/Unix/Command/_ecasound
+++ b/Completion/Unix/Command/_ecasound
@@ -102,9 +102,9 @@ case $state in
elif compset -P '*,*,'; then
_message 'sampling rate'
elif compset -P '*,'; then
- _message 'channels'
+ _message 'channel'
else
- _values 'sampling parameters' \
+ _values 'sampling parameter' \
'u8[unsigned 8-bit]' \
's16_le[signed 16-bit little endian]' \
's16_be[signed 16-bit big endian]' \
diff --git a/Completion/Unix/Command/_entr b/Completion/Unix/Command/_entr
index 3e2261a18..438ab179a 100644
--- a/Completion/Unix/Command/_entr
+++ b/Completion/Unix/Command/_entr
@@ -11,6 +11,7 @@ _arguments -s -S \
'-p[postpone first execution of the utility]' \
'(-a)-r[reload a persistent child process]' \
'(*)-s[evaluate the first argument using interpreter specified by $SHELL]' \
+ '-z[exit after the utility completes]' \
'(-): :->command' \
'*::arguments:_normal' && ret=0
diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env
index 27978d936..a5dd49d37 100644
--- a/Completion/Unix/Command/_env
+++ b/Completion/Unix/Command/_env
@@ -1,6 +1,7 @@
#compdef env genv
-local context state line variant args ign ret=1
+local context state line variant ign ret=1
+local -a args suf
_pick_variant -r variant gnu=Free\ Soft $OSTYPE --version
case $variant in
@@ -20,8 +21,15 @@ case $variant in
"${ign}(- *)--version[display version information]"
)
;;
- freebsd*|darwin*)
+ freebsd*)
args=(
+ '-0[use NUL, not newline after each variable in output]'
+ '-L[add variables from system login.conf(5)]: :->user-class'
+ '-U[add variables from user and system login.conf(5)]: :->user-class'
+ )
+ ;|
+ freebsd*|darwin*|dragonfly*)
+ 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]:string to split'
@@ -44,11 +52,23 @@ _arguments $args \
'*::arguments:->normal' && ret=0
if [[ -n $state ]]; then
- while [[ $words[1] = *=* ]]; do
- shift words
- (( CURRENT-- ))
- done
- _normal && ret=0
+ case $state in
+ normal)
+ while [[ $words[1] = *=* ]]; do
+ shift words
+ (( CURRENT-- ))
+ done
+ _normal && ret=0
+ ;;
+ user-class)
+ if compset -P 1 '*/'; then
+ _login_classes && ret=0
+ else
+ compset -S '/*' || suf=( -qS/ )
+ _users $suf && ret=0
+ fi
+ ;;
+ esac
fi
return ret
diff --git a/Completion/Unix/Command/_fetchmail b/Completion/Unix/Command/_fetchmail
index 31a92d984..bc5a39688 100644
--- a/Completion/Unix/Command/_fetchmail
+++ b/Completion/Unix/Command/_fetchmail
@@ -4,7 +4,7 @@ _arguments -S \
{--bsmtp,'(--logfile)-L','(-L)--logfile','(--fetchmailrc)-f','(-f)--fetchmailrc','(--idfile)-i','(-i)--idfile'}':file:_files' \
{--plugin,--plugout,'(--mda)-m','(-m)--mda'}':command:_command_names -e' \
{'(--username)-u','(-u)--username'}:user:_users \
- '--auth:authentication types:(password kerberos kerberos_v5)' \
+ '--auth:authentication type:(password kerberos kerberos_v5)' \
{'(--protocol)-p','(-p)--protocol'}:protocol:'(auto pop2 pop3 apop rpop kpop sdps imap imap-k4 imap-gss etrn)' \
{'(--port)-P','(-P)--port'}':port number' \
'*:mail server:_hosts' \
diff --git a/Completion/Unix/Command/_ffmpeg b/Completion/Unix/Command/_ffmpeg
index c0b229f35..1329939cd 100644
--- a/Completion/Unix/Command/_ffmpeg
+++ b/Completion/Unix/Command/_ffmpeg
@@ -6,7 +6,7 @@ typeset -A opt_args
(( $+functions[_ffmpeg_presets] )) || _ffmpeg_presets() {
local presets
presets=(~/.ffmpeg/*.ffpreset(:t:r) "$FFMPEG_DATADIR"/*.ffpreset(:t:r))
- _wanted ffmpeg-presets expl 'select preset' compadd -a presets
+ _wanted ffmpeg-presets expl 'preset' compadd -a presets
}
(( $+functions[_ffmpeg_acodecs] )) || _ffmpeg_acodecs() {
@@ -49,7 +49,7 @@ typeset -A _ffmpeg_flags
(( $+functions[_ffmpeg_flag_options] )) || _ffmpeg_flag_options() {
local expl
- _wanted options expl 'select flags' compadd -S '' -- {-,+}${^flag_options}
+ _wanted options expl 'flag' compadd -S '' -- {-,+}${^flag_options}
}
(( $+functions[_ffmpeg_more_flag_options] )) || _ffmpeg_more_flag_options() {
@@ -177,7 +177,7 @@ _arguments -C -S \
&& return
[[ "$state" == "vfilters" ]] &&
- _values -s , -S = 'video filters' \
+ _values -s , -S = 'video filter' \
'aspect:set aspect ratio (rational number X\:Y or decimal number):' \
'crop:crop input video (x\:y\:width\:height):' \
'format: :_sequence -s : _ffmpeg_pix_fmts' \
diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find
index 916fcf2e6..74111f92b 100644
--- a/Completion/Unix/Command/_find
+++ b/Completion/Unix/Command/_find
@@ -89,7 +89,7 @@ case $variant in
'-X[warn if filename contains characters special to xargs]'
'-f[specify file hierarchy to traverse]:path:_directories'
"-x[don't span filesystems]"
- '*-flags:flags:_chflags'
+ '*-flags:flag:_chflags'
)
;|
freebsd*|dragonfly*) args+=( '*-sparse' ) ;|
@@ -156,11 +156,11 @@ if [[ $state = times ]]; then
if zstyle -t ":completion:${curcontext}:senses" verbose; then
zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=--
default=" [default exactly]"
- disp=( "- $sep before" "+ $sep since" )
+ disp=( "+ $sep before (older files)" "- $sep since (newer files)" )
smatch=( - + )
else
disp=( before exactly since )
- smatch=( - '' + )
+ smatch=( + '' - )
fi
alts=( "senses:sense${default}:compadd -V times -S '' -d disp -a smatch" )
fi
diff --git a/Completion/Unix/Command/_fuser b/Completion/Unix/Command/_fuser
index f497729fc..05de1c529 100644
--- a/Completion/Unix/Command/_fuser
+++ b/Completion/Unix/Command/_fuser
@@ -50,7 +50,7 @@ case $variant in
)
argf=( '*:name: _alternative "files:file:_files" "services:service:_fuser_services"' )
[[ -prefix - && -z ${${words[1,CURRENT-1]}[(r)-[A-Z][A-Z]*]} ]] &&
- argf[1]+=' "signal:signals:_signals -P-"'
+ argf[1]+=' "signals:signal:_signals -P-"'
;;
freebsd*|openbsd*|solaris2.<9->)
args+=(
diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
index 9ec09200e..ac0e8fda3 100644
--- a/Completion/Unix/Command/_gcc
+++ b/Completion/Unix/Command/_gcc
@@ -1,6 +1,7 @@
#compdef gcc g++ cc c++ llvm-gcc llvm-g++ clang clang++ -value-,LDFLAGS,-default- -value-,CFLAGS,-default- -value-,CXXFLAGS,-default- -value-,CPPFLAGS,-default- -P gcc-* -P g++-* -P c++-*
-local curcontext="$curcontext" state line ret=1 expl args args2 march
+local curcontext="$curcontext" state line ret=1 expl i
+local -a args args2 warnings arch
typeset -A opt_args
if [[ "$service" = -value-* ]]; then
@@ -23,6 +24,7 @@ fi
args=()
case $MACHTYPE in
+
m68*)
args=(
-m68000 -m68020 -m68020-40 -m68030 -m68040 -m68881
@@ -56,6 +58,16 @@ amd290?0)
arm)
args=(
-mapcs -m2 -m3 -m6 -mbsd -mxopen -mno-symrename
+ '-faapcs-bitfield-load[all volatile bit-field write generates at least one load]'
+ '-faapcs-bitfield-width[volatile bit-field width is dictated by the field container type]'
+ '-mcmse[allow use of CMSE]'
+ '-mexecute-only[disallow generation of data access to code sections]'
+ '-mno-movt[disallow use of movt/movw pairs]'
+ '-mno-neg-immediates[disallow converting instructions with negative immediates to their negation]'
+ '-mnocrc[disallow use of CRC instructions]'
+ '-mrestrict-it[disallow generation of deprecated IT blocks for ARMv8]'
+ '-mtp=[thread pointer access method]:arg'
+ '-munaligned-access[allow memory accesses to be unaligned]'
)
;;
m88k)
@@ -74,8 +86,8 @@ m88k)
)
;;
rs6000|powerpc*)
+ arch=(rios1 rios2 rsc 501 603 604 power powerpc 403 common)
args=(
- '-mcpu=:CPU type:(rios1 rios2 rsc 501 603 604 power powerpc 403 common)'
-mpower -mno-power -mpower2 -mno-power2
-mpowerpc -mno-powerpc
-mpowerpc-gpopt -mno-powerpc-gpopt
@@ -88,6 +100,32 @@ rs6000|powerpc*)
-mtoc -mno-toc -mtraceback -mno-traceback
-mlittle -mlittle-endian -mbig -mbig-endian
-mcall-aix -mcall-sysv -mprototype
+ '-mcpu=:CPU type:->arch'
+ '-maltivec[altivec]'
+ '-mcmpb[cmpb]'
+ '-mcrbits[crbits]'
+ '-mcrypto[crypto]'
+ '-mdirect-move[direct move]'
+ '-mefpu2[efpu2]'
+ '-mfloat128[float128]'
+ '-mfprnd[fprnd]'
+ '-mhtm[htm]'
+ '-minvariant-function-descriptors[invariant function descriptors]'
+ '-misel[isel]'
+ '-mlongcall[longcall]'
+ '-mmfocrf[mfocrf]'
+ '-mmfcrf[mfcrf]'
+ '-mmma[mma]'
+ '-mpaired-vector-memops[paired vector memops]'
+ '-mpcrel[pcrel]'
+ '-mpopcntd[popcntd]'
+ '-mpower10-vector[power10 vector]'
+ '-mpower8-vector[power8 vector]'
+ '-mpower9-vector[power9 vector]'
+ '-mrop-protection[rop protection]'
+ '-msecure-plt[secure plt]'
+ '-mspe[spe]'
+ '-mvsx[vsx]'
)
;;
romp)
@@ -98,179 +136,233 @@ romp)
)
;;
mips*)
+ arch=(r2000 r3000 r4000 r4400 r4600 r6000)
args=(
- '-mcpu=:CPU type:(r2000 r3000 r4000 r4400 r4600 r6000)'
- -mabicalls -membedded-data
- -membedded-pic -mfp32 -mfp64 -mgas -mgp32 -mgp64
- -mgpopt -mhalf-pic -mhard-float -mint64 -mips1
- -mips2 -mips3 -mlong64 -mlong-calls -mmemcpy
- -mmips-as -mmips-tfile -mno-abicalls
- -mno-embedded-data -mno-embedded-pic
- -mno-gpopt -mno-long-calls
- -mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats
- -mrnames -msoft-float
- -m4650 -msingle-float -mmad
- -mstats -EL -EB -nocpp
- '-G:maximum size for small section objects:'
+ -membedded-pic -mgas -mgp32 -mgp64 -mhalf-pic -mhard-float -mint64 -mips1
+ -mips2 -mips3 -mlong64 -mmemcpy -mmips-as -mmips-tfile -mno-abicalls
+ -mno-embedded-data -mno-embedded-pic -mno-gpopt -mno-long-calls -mno-memcpy
+ -mno-mips-tfile -mno-rnames -mno-stats -mrnames -msoft-float -m4650 -mmad
+ -mstats -nocpp
+ '-mcpu=:CPU type:->arch'
+ '-mabicalls[enable SVR4-style position-independent code]'
+ '-mabs=[abs]:arg'
+ '-mcheck-zero-division[check zero division]'
+ '-mcompact-branches=[compact branches]:arg'
+ '-mdouble-float[double float]'
+ '-mdsp[dsp]'
+ '-mdspr2[dspr2]'
+ '-membedded-data[place constants in the .rodata section instead of the .sdata section]'
+ '-mextern-sdata[assume that externally defined data is in the small data]'
+ '-mfp32[use 32-bit floating point registers]'
+ '-mfp64[use 64-bit floating point registers]'
+ '-mginv[ginv]'
+ '-mgpopt[use GP relative accesses for symbols known to be in a small data section]'
+ '-mindirect-jump=[change indirect jump instructions to inhibit speculation]:arg'
+ '-mips16[ips16]'
+ '-mldc1-sdc1[ldc1 sdc1]'
+ '-mlocal-sdata[extend the -G behaviour to object local data]'
+ '-mmadd4[enable the generation of 4-operand madd.s, madd.d, etc]'
+ '-mmicromips[micromips]'
+ '-mmsa[enable MSA ASE]'
+ '-mmt[enable MT ASE]'
+ '-mnan=[nan]:arg'
+ '-mno-mips16[no mips16]'
+ '-msingle-float[single float]'
+ '-mvirt[virt]'
+ '-mxgot[xgot]'
)
;;
i[3456]86|x86_64)
- march="native i386 i486 i586 pentium pentium-mmx pentiumpro i686 pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx core-avx-i core-avx2 atom k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3 c3-2 geode"
+ arch=(
+ native i386 i486 i586 pentium pentium-mmx pentiumpro i686 pentium2 pentium3
+ pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx
+ core-avx-i core-avx2 atom k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp
+ athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3
+ amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3
+ c3-2 geode
+ )
args=(
- '-mtune=-[tune code for CPU type]:CPU type:('"$march"')'
- #'-mtune-ctrl=-[Fine grain control of tune features]:feature-list:' #for dev use only
- '-march=-[generate instructions for CPU type]:CPU type:('"generic $march"')'
- -mthreads
- '-mreg-alloc=:default register allocation order:'
-
- # arguments with options
- '-mabi=-[Generate code that conforms to the given ABI]:abi:(ms sysv)'
- '-maddress-mode=-[Use given address mode]:address mode:(short long)'
- '-malign-data=-[Use the given data alignment]:type:(compat abi cacheline)'
- '-malign-functions=-[Function starts are aligned to this power of 2]: **2 base for function alignment: '
- '-malign-jumps=-[Jump targets are aligned to this power of 2]: **2 base for jump goal alignment: '
- '-malign-loops=-[Loop code aligned to this power of 2]: **2 base for loop alignment: '
- '-masm=-[Use given assembler dialect]:asm dialect:(att intel)'
- '-mbranch-cost=-[Branches are this expensive (1-5, arbitrary units)]:branch cost (1-5): '
- '-mcmodel=-[Use given x86-64 code model]:memory model:(32 small kernel medium large)'
- '-mfpmath=-[Generate floating point mathematics using given instruction set]:FPU type:(387 sse sse,387 both)'
- '-mfunction-return=-[Convert function return to call and return thunk]:choice:(keep thunk thunk-inline thunk-extern)'
- '-mincoming-stack-boundary=-[Assume incoming stack aligned to this power of 2]:assumed size of boundary: '
- '-mindirect-branch=-[Convert indirect call and jump to call and return thunks]:choice:(keep thunk thunk-inline thunk-extern)'
- '-mlarge-data-threshold=-[Data greater than given threshold will go into .ldata section in x86-64 medium model]:threshold: '
- '-mmem'{set,cpy}'-strategy=-[Specify memcpy expansion strategy when expected size is known]:strategy:'
- '-mpreferred-stack-boundary=-[Attempt to keep stack aligned to this power of 2]:size of boundary: '
- '-mrecip=-[Control generation of reciprocal estimates]::instruction:(all none div divf divd rsqrt rsqrtf rsqrtd)' #TODO comma separated and can have !
- '-mregparm=-[Number of registers used to pass integer arguments]:number of integer argument registers: '
- '-mstack-protector-guard=-[Use given stack-protector guard]:guard:(global tls)'
- '-mstringop-strategy=-[Chose strategy to generate stringop using]:stringop strategy:(byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop)'
- '-mtls-dialect=-[Use given thread-local storage dialect]:TLS dialect:(gnu gnu2)'
- '-mveclibabi=-[Vector library ABI to use]:vector library ABI:(acml svml)'
-
- # arguments without options
- '-m3dnow[Support 3DNow! built-in functions]'
- '-m3dnowa[Support Athlon 3Dnow! built-in functions]'
- '-m8bit-idiv[Expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check]'
- '-m16[Generate 16bit i386 code]'
- '-m32[Generate 32bit i386 code]'
- '-m64[Generate 64bit x86-64 code]'
- '-m96bit-long-double[sizeof(long double) is 12]'
'-m128bit-long-double[sizeof(long double) is 16]'
- '-m80387[Use hardware fp]'
- '-mabm[Support code generation of Advanced Bit Manipulation (ABM) instructions]'
- '-maccumulate-outgoing-args[Reserve space for outgoing arguments in the function prologue]'
- '-madx[Support flag-preserving add-carry instructions]'
- '-maes[Support AES built-in functions and code generation]'
- '-malign-double[Align some doubles on dword boundary]'
- '-malign-stringops[Align destination of the string operations]'
- '-mandroid[Generate code for the Android platform]'
- '-mavx2[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 built-in functions and code generation]'
- '-mavx256-split-unaligned-load[Split 32-byte AVX unaligned load]'
- '-mavx256-split-unaligned-store[Split 32-byte AVX unaligned store]'
- '-mavx512bw[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512BW built- in functions and code generation]'
- '-mavx512cd[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512CD built- in functions and code generation]'
- '-mavx512dq[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512DQ built- in functions and code generation]'
- '-mavx512er[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512ER built- in functions and code generation]'
- '-mavx512f[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F built-in functions and code generation]'
- '-mavx512ifma[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512IFMA built-in functions and code generation]'
- '-mavx512pf[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512PF built- in functions and code generation]'
- '-mavx512vbmi[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VBMI built-in functions and code generation]'
- '-mavx512vl[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VL built- in functions and code generation]'
- '-mavx512vpopcntdq[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX512VPOPCNTDQ built-in functions and code generation]'
- '-mavx5124fmaps[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124FMAPS built- in functions and code generation]'
- '-mavx5124vnniw[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124VNNIW built- in functions and code generation]'
- '-mavx[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX built-in functions and code generation]'
- '-mbionic[Use Bionic C library]'
- '-mbmi2[Support BMI2 built-in functions and code generation]'
- '-mbmi[Support BMI built-in functions and code generation]'
- '-mcld[Generate cld instruction in the function prologue]'
- '-mclflushopt[Support CLFLUSHOPT instructions]'
- '-mclwb[Support CLWB instruction]'
- '-mclzero[Support CLZERO built-in functions and code generation]'
- '-mcrc32[Support code generation of crc32 instruction]'
- '-mcx16[Support code generation of cmpxchg16b instruction]'
- '-mdispatch-scheduler[Do dispatch scheduling if processor is bdver1, bdver2, bdver3, bdver4 or znver1 and Haifa scheduling is selected]'
- '-mf16c[Support F16C built-in functions and code generation]'
- '-mfancy-math-387[Generate sin, cos, sqrt for FPU]'
- '-mfentry[Emit profiling counter call at function entry before prologue]'
- '-mfma4[Support FMA4 built-in functions and code generation]'
- '-mfma[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and FMA built-in functions and code generation]'
- '-mforce-drap[Always use Dynamic Realigned Argument Pointer (DRAP) to realign stack]'
- '-mfp-ret-in-387[Return values of functions in FPU registers]'
- '-mfsgsbase[Support FSGSBASE built-in functions and code generation]'
- '-mfxsr[Support FXSAVE and FXRSTOR instructions]'
- '-mgeneral-regs-only[Generate code which uses only the general registers]'
- '-mglibc[Use GNU C library]'
- '-mhard-float[Use hardware fp]'
- '-mhle[Support Hardware Lock Elision prefixes]'
- '-miamcu[Generate code that conforms to Intel MCU psABI]'
- '-mieee-fp[Use IEEE math for fp comparisons]'
- '-mindirect-branch-register[Force indirect call and jump via register]'
- '-minline-all-stringops[Inline all known string operations]'
- '-minline-stringops-dynamically[Inline memset/memcpy string operations, but perform inline version only for small blocks]'
- '-mlong-double-64[Use 64-bit long double]'
- '-mlong-double-80[Use 80-bit long double]'
- '-mlong-double-128[Use 128-bit long double]'
- '-mlwp[Support LWP built-in functions and code generation]'
- '-mlzcnt[Support LZCNT built-in function and code generation]'
- '-mmitigate-rop[Attempt to avoid generating instruction sequences containing ret bytes]'
- '-mmmx[Support MMX built-in functions]'
- '-mmovbe[Support code generation of movbe instruction]'
- '-mmpx[Support MPX code generation]'
- '-mms-bitfields[Use native (MS) bitfield layout]'
- '-mmusl[Use musl C library]'
- '-mmwaitx[Support MWAITX and MONITORX built-in functions and code generation]'
- '-mno-default[Clear all tune features]'
- '-mno-sse4[Do not support SSE4.1 and SSE4.2 built-in functions and code generation]'
- '-mnop-mcount[Generate mcount/__fentry__ calls as nops. To activate they need to be patched in]'
- '-momit-leaf-frame-pointer[Omit the frame pointer in leaf functions]'
- '-mpc32[Set 80387 floating-point precision to 32-bit]'
- '-mpc64[Set 80387 floating-point precision to 64-bit]'
- '-mpc80[Set 80387 floating-point precision to 80-bit]'
- '-mpclmul[Support PCLMUL built-in functions and code generation]'
- '-mpku[Support PKU built-in functions and code generation]'
- '-mpopcnt[Support code generation of popcnt instruction]'
- '-mprefer-avx128[Use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer]'
- '-mprefetchwt1[Support PREFETCHWT1 built-in functions and code generation]'
- '-mprfchw[Support PREFETCHW instruction]'
- '-mpush-args[Use push instructions to save outgoing arguments]'
- '-mrdpid[Support RDPID built-in functions and code generation]'
- '-mrdrnd[Support RDRND built-in functions and code generation]'
- '-mrdseed[Support RDSEED instruction]'
- '-mrecip[Generate reciprocals instead of divss and sqrtss]'
- '-mrecord-mcount[Generate __mcount_loc section with all mcount or __fentry__ calls]'
- '-mred-zone[Use red-zone in the x86-64 code]'
- '-mrtd[Alternate calling convention]'
- '-mrtm[Support RTM built-in functions and code generation]'
- '-msahf[Support code generation of sahf instruction in 64bit x86-64 code]'
- '-msgx[Support SGX built-in functions and code generation]'
- '-msha[Support SHA1 and SHA256 built-in functions and code generation]'
- '-mskip-rax-setup[Skip setting up RAX register when passing variable arguments]'
- '-msoft-float[Do not use hardware fp]'
- '-msse2[Support MMX, SSE and SSE2 built-in functions and code generation]'
- '-msse2avx[Encode SSE instructions with VEX prefix]'
- '-msse3[Support MMX, SSE, SSE2 and SSE3 built-in functions and code generation]'
- '-msse4.1[Support MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 built-in functions and code generation]'
- '-msse4.2[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]'
- '-msse4[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]'
- '-msse4a[Support MMX, SSE, SSE2, SSE3 and SSE4A built-in functions and code generation]'
- '-msse[Support MMX and SSE built-in functions and code generation]'
- '-msseregparm[Use SSE register passing conventions for SF and DF mode]'
- '-mssse3[Support MMX, SSE, SSE2, SSE3 and SSSE3 built-in functions and code generation]'
- '-mstack-arg-probe[Enable stack probing]'
- '-mstackrealign[Realign stack in prologue]'
- '-mstv[Disable Scalar to Vector optimization pass transforming 64-bit integer computations into a vector ones]'
- '-mtbm[Support TBM built-in functions and code generation]'
- '-mtls-direct-seg-refs[Use direct references against %gs when accessing tls data]'
- '-muclibc[Use uClibc C library]'
- '-mvect8-ret-in-mem[Return 8-byte vectors in memory]'
- '-mvzeroupper[Generate vzeroupper instruction before a transfer of control flow out of the function]'
- '-mx32[Generate 32bit x86-64 code]'
- '-mxop[Support XOP built-in functions and code generation]'
- '-mxsave[Support XSAVE and XRSTOR instructions]'
- '-mxsavec[Support XSAVEC instructions]'
- '-mxsaveopt[Support XSAVEOPT instruction]'
- '-mxsaves[Support XSAVES and XRSTORS instructions]'
+ '-m16[generate 16bit i386 code]'
+ '-m32[generate 32bit i386 code]'
+ '-m3dnowa[support Athlon 3Dnow! built-in functions]'
+ '-m3dnow[support 3DNow! built-in functions]'
+ '-m64[generate 64bit x86-64 code]'
+ '-m80387[use hardware fp]'
+ '-m8bit-idiv[expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check]'
+ '-m96bit-long-double[sizeof(long double) is 12]'
+ '-mabi=-[generate code that conforms to the given ABI]:abi:(ms sysv)'
+ '-mabm[support code generation of Advanced Bit Manipulation (ABM) instructions]'
+ '-maccumulate-outgoing-args[reserve space for outgoing arguments in the function prologue]'
+ '-maddress-mode=-[use given address mode]:address mode:(short long)'
+ '-madx[support flag-preserving add-carry instructions]'
+ '-maes[support AES built-in functions and code generation]'
+ '-malign-data=-[use the given data alignment]:type:(compat abi cacheline)'
+ '-malign-double[align some doubles on dword boundary]'
+ '-malign-functions=-[function starts are aligned to this power of 2]: **2 base for function alignment: '
+ '-malign-jumps=-[jump targets are aligned to this power of 2]: **2 base for jump goal alignment: '
+ '-malign-loops=-[loop code aligned to this power of 2]: **2 base for loop alignment: '
+ '-malign-stringops[align destination of the string operations]'
+ '-mamx-bf16[amx bf16]'
+ '-mamx-int8[amx int8]'
+ '-mamx-tile[amx tile]'
+ '-mandroid[generate code for the Android platform]'
+ '-march=-[generate instructions for CPU type]:CPU type:->archgeneric'
+ '-masm=-[use given assembler dialect]:asm dialect:(att intel)'
+ '-mavx256-split-unaligned-load[split 32-byte AVX unaligned load]'
+ '-mavx256-split-unaligned-store[split 32-byte AVX unaligned store]'
+ '-mavx2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 built-in functions and code generation]'
+ '-mavx5124fmaps[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124FMAPS built- in functions and code generation]'
+ '-mavx5124vnniw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124VNNIW built- in functions and code generation]'
+ '-mavx512bf16[avx512bf16]'
+ '-mavx512bitalg[avx512bitalg]'
+ '-mavx512bw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512BW built- in functions and code generation]'
+ '-mavx512cd[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512CD built- in functions and code generation]'
+ '-mavx512dq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512DQ built- in functions and code generation]'
+ '-mavx512er[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512ER built- in functions and code generation]'
+ '-mavx512f[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F built-in functions and code generation]'
+ '-mavx512ifma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512IFMA built-in functions and code generation]'
+ '-mavx512pf[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512PF built- in functions and code generation]'
+ '-mavx512vbmi2[avx512vbmi2]'
+ '-mavx512vbmi[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VBMI built-in functions and code generation]'
+ '-mavx512vl[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VL built- in functions and code generation]'
+ '-mavx512vnni[avx512vnni]'
+ '-mavx512vp2intersect[avx512vp2intersect]'
+ '-mavx512vpopcntdq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX512VPOPCNTDQ built-in functions and code generation]'
+ '-mavx[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX built-in functions and code generation]'
+ '-mavxvnni[avxvnni]'
+ '-mbionic[use Bionic C library]'
+ '-mbmi2[support BMI2 built-in functions and code generation]'
+ '-mbmi[support BMI built-in functions and code generation]'
+ '-mbranch-cost=-[branches are this expensive (1-5, arbitrary units)]:branch cost (1-5): '
+ '-mcldemote[cldemote]'
+ '-mcld[generate cld instruction in the function prologue]'
+ '-mclflushopt[support CLFLUSHOPT instructions]'
+ '-mclwb[support CLWB instruction]'
+ '-mclzero[support CLZERO built-in functions and code generation]'
+ '-mcmodel=-[use given x86-64 code model]:memory model:(32 small kernel medium large)'
+ '-mcpu=-[set CPU type]:CPU type:->arch'
+ '-mcrc32[support code generation of crc32 instruction]'
+ '-mcx16[support code generation of cmpxchg16b instruction]'
+ '-mdispatch-scheduler[do dispatch scheduling if processor is bdver1, bdver2, bdver3, bdver4 or znver1 and Haifa scheduling is selected]'
+ '-menqcmd[enqcmd]'
+ '-mf16c[support F16C built-in functions and code generation]'
+ '-mfancy-math-387[generate sin, cos, sqrt for FPU]'
+ '-mfentry[emit profiling counter call at function entry before prologue]'
+ '-mfma4[support FMA4 built-in functions and code generation]'
+ '-mfma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and FMA built-in functions and code generation]'
+ '-mforce-drap[always use Dynamic Realigned Argument Pointer (DRAP) to realign stack]'
+ '-mfpmath=-[generate floating point mathematics using given instruction set]:FPU type:(387 sse sse,387 both)'
+ '-mfp-ret-in-387[return values of functions in FPU registers]'
+ '-mfsgsbase[support FSGSBASE built-in functions and code generation]'
+ '-mfunction-return=-[convert function return to call and return thunk]:choice:(keep thunk thunk-inline thunk-extern)'
+ '-mfxsr[support FXSAVE and FXRSTOR instructions]'
+ '-mgeneral-regs-only[generate code which uses only the general registers]'
+ '-mgfni[gfni]'
+ '-mglibc[use GNU C library]'
+ '-mhard-float[use hardware fp]'
+ '-mhle[support Hardware Lock Elision prefixes]'
+ '-mhreset[hreset]'
+ '-miamcu[generate code that conforms to Intel MCU psABI]'
+ '-mieee-fp[use IEEE math for fp comparisons]'
+ '-mincoming-stack-boundary=-[assume incoming stack aligned to this power of 2]:assumed size of boundary: '
+ '-mindirect-branch=-[convert indirect call and jump to call and return thunks]:choice:(keep thunk thunk-inline thunk-extern)'
+ '-mindirect-branch-register[force indirect call and jump via register]'
+ '-minline-all-stringops[inline all known string operations]'
+ '-minline-stringops-dynamically[inline memset/memcpy string operations, but perform inline version only for small blocks]'
+ '-minvpcid[invpcid]'
+ '-mkl[kl]'
+ '-mlarge-data-threshold=-[data greater than given threshold will go into .ldata section in x86-64 medium model]:threshold: '
+ '-mlong-double-128[use 128-bit long double]'
+ '-mlong-double-64[use 64-bit long double]'
+ '-mlong-double-80[use 80-bit long double]'
+ '-mlwp[support LWP built-in functions and code generation]'
+ '-mlzcnt[support LZCNT built-in function and code generation]'
+ {'-mmemset-strategy=-','-mmemcpy-strategy=-'}'[specify memcpy expansion strategy when expected size is known]:strategy:'
+ '-mmitigate-rop[attempt to avoid generating instruction sequences containing ret bytes]'
+ '-mmmx[support MMX built-in functions]'
+ '-mmovbe[support code generation of movbe instruction]'
+ '-mmovdir64b[movdir64b]'
+ '-mmovdiri[movdiri]'
+ '-mmpx[support MPX code generation]'
+ '-mms-bitfields[use native (MS) bitfield layout]'
+ '-mmusl[use musl C library]'
+ '-mmwaitx[support MWAITX and MONITORX built-in functions and code generation]'
+ '-mno-default[clear all tune features]'
+ '-mnop-mcount[generate mcount/__fentry__ calls as nops. To activate they need to be patched in]'
+ '-mno-sse4[do not support SSE4.1 and SSE4.2 built-in functions and code generation]'
+ '-momit-leaf-frame-pointer[omit the frame pointer in leaf functions]'
+ '-mpc32[set 80387 floating-point precision to 32-bit]'
+ '-mpc64[set 80387 floating-point precision to 64-bit]'
+ '-mpc80[set 80387 floating-point precision to 80-bit]'
+ '-mpclmul[support PCLMUL built-in functions and code generation]'
+ '-mpconfig[pconfig]'
+ '-mpku[support PKU built-in functions and code generation]'
+ '-mpopcnt[support code generation of popcnt instruction]'
+ '-mprefer-avx128[use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer]'
+ '-mpreferred-stack-boundary=-[attempt to keep stack aligned to this power of 2]:size of boundary: '
+ '-mprefetchwt1[support PREFETCHWT1 built-in functions and code generation]'
+ '-mprfchw[support PREFETCHW instruction]'
+ '-mptwrite[ptwrite]'
+ '-mpush-args[use push instructions to save outgoing arguments]'
+ '-mrdpid[support RDPID built-in functions and code generation]'
+ '-mrdrnd[support RDRND built-in functions and code generation]'
+ '-mrdseed[support RDSEED instruction]'
+ '-mrecip=-[control generation of reciprocal estimates]::instruction:(all none div divf divd rsqrt rsqrtf rsqrtd)' # TODO comma separated and can have !
+ '-mrecip[generate reciprocals instead of divss and sqrtss]'
+ '-mrecord-mcount[generate __mcount_loc section with all mcount or __fentry__ calls]'
+ '-mred-zone[use red-zone in the x86-64 code]'
+ '-mreg-alloc=[control the default allocation order of integer registers]:default register allocation order:'
+ '-mregparm=-[number of registers used to pass integer arguments]:number of integer argument registers: '
+ '-mretpoline-external-thunk[retpoline external thunk]'
+ '-mrtd[alternate calling convention]'
+ '-mrtm[support RTM built-in functions and code generation]'
+ '-msahf[support code generation of sahf instruction in 64bit x86-64 code]'
+ '-mserialize[serialize]'
+ '-msgx[support SGX built-in functions and code generation]'
+ '-msha[support SHA1 and SHA256 built-in functions and code generation]'
+ '-mshstk[shstk]'
+ '-mskip-rax-setup[skip setting up RAX register when passing variable arguments]'
+ '-msoft-float[do not use hardware fp]'
+ '-msse2avx[encode SSE instructions with VEX prefix]'
+ '-msse2[support MMX, SSE and SSE2 built-in functions and code generation]'
+ '-msse3[support MMX, SSE, SSE2 and SSE3 built-in functions and code generation]'
+ '-msse4.1[support MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 built-in functions and code generation]'
+ '-msse4.2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]'
+ '-msse4a[support MMX, SSE, SSE2, SSE3 and SSE4A built-in functions and code generation]'
+ '-msse4[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]'
+ '-msseregparm[use SSE register passing conventions for SF and DF mode]'
+ '-msse[support MMX and SSE built-in functions and code generation]'
+ '-mssse3[support MMX, SSE, SSE2, SSE3 and SSSE3 built-in functions and code generation]'
+ '-mstack-arg-probe[enable stack probing]'
+ '-mstack-protector-guard=-[use given stack-protector guard]:guard:(global tls)'
+ '-mstackrealign[realign stack in prologue]'
+ '-mstringop-strategy=-[chose strategy to generate stringop using]:stringop strategy:(byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop)'
+ '-mstv[disable Scalar to Vector optimization pass transforming 64-bit integer computations into a vector ones]'
+ '-mtbm[support TBM built-in functions and code generation]'
+ '-mthreads[support thread-safe exception handling on MinGW]'
+ '-mtls-dialect=-[use given thread-local storage dialect]:TLS dialect:(gnu gnu2)'
+ '-mtls-direct-seg-refs[use direct references against %gs when accessing tls data]'
+ '-mtsxldtrk[tsxldtrk]'
+ #'-mtune-ctrl=-[fine grain control of tune features]:feature-list:' #for dev use only
+ '-mtune=-[tune code for CPU type]:CPU type:->arch'
+ '-muclibc[use uClibc C library]'
+ '-muintr[uintr]'
+ '-mvaes[vaes]'
+ '-mveclibabi=-[vector library ABI to use]:vector library ABI:(acml svml)'
+ '-mvect8-ret-in-mem[return 8-byte vectors in memory]'
+ '-mvpclmulqdq[vpclmulqdq]'
+ '-mvzeroupper[generate vzeroupper instruction before a transfer of control flow out of the function]'
+ '-mwaitpkg[waitpkg]'
+ '-mwbnoinvd[wbnoinvd]'
+ '-mwidekl[widekl]'
+ '-mx32[generate 32bit x86-64 code]'
+ '-mx87[x87]'
+ '-mxop[support XOP built-in functions and code generation]'
+ '-mxsavec[support XSAVEC instructions]'
+ '-mxsaveopt[support XSAVEOPT instruction]'
+ '-mxsaves[support XSAVES and XRSTORS instructions]'
+ '-mxsave[support XSAVE and XRSTOR instructions]'
)
;;
hppa*)
@@ -298,6 +390,10 @@ i960)
)
;;
sparc)
+ arch=(
+ v7 cypress v8 supersparc sparclite f930 f934 hypersparc sparclite86x sparclet
+ tsc701 v9 ultrasparc ultrasparc3
+ )
args=(
-mapp-regs -mno-app-regs
-mfpu -mhard-float
@@ -308,8 +404,8 @@ sparc)
-munaligned-doubles
-mfaster-structs -mno-faster-structs
-mimpure-text
- '-mcpu=:CPU type:(v7 cypress v8 supersparc sparclite f930 f934 hypersparc sparclite86x sparclet tsc701 v9 ultrasparc ultrasparc3)'
- '-mtune=:CPU type:(cypress supersparc hypersparc f930 f934 sparclite86x tsc701 ultrasparc ultrasparc3)'
+ '-mcpu=:CPU type:->arch'
+ '-mtune=:CPU type:->arch'
-mv8plus -mno-v8plus
-mvis -mno-vis
-mlittle-endian
@@ -341,863 +437,1797 @@ h8/300)
-mrelax -mh
)
;;
+aarch64)
+ args=(
+ '-mmark-bti-property[add .note.gnu.property with BTI to assembly files]'
+ '-moutline[enable function outlining (AArch64 only)]'
+ '-msve-vector-bits=[specify the size in bits of an SVE vector register]:bits'
+ )
+ ;;
+amdgpu)
+ args=(
+ '-mcumode[specify CU wavefront execution mode]'
+ '-mtgsplit[enable threadgroup split execution mode (AMDGPU only)]'
+ )
+ ;;
+hexagon)
+ args=(
+ '-mieee-rnd-near[ieee rnd near]'
+ '-mmemops[enable generation of memop instructions]'
+ '-mnvj[enable generation of new-value jumps]'
+ '-mnvs[enable generation of new-value stores]'
+ '-mpackets[enable generation of instruction packets]'
+ '-mhvx[enable Hexagon Vector eXtensions]'
+ '-mhvx-length=[set Hexagon Vector Length]:arg'
+ '-mhvx=[enable Hexagon Vector eXtensions]:arg'
+ )
+ ;;
+webassembly*)
+ args=(
+ '-matomics[atomics]'
+ '-mbulk-memory[bulk memory]'
+ '-mexception-handling[exception handling]'
+ '-mmultivalue[multivalue]'
+ '-mmutable-globals[mutable globals]'
+ '-mnontrapping-fptoint[no ntrapping fptoint]'
+ '-mreference-types[reference types]'
+ '-msign-ext[sign ext]'
+ '-msimd128[simd128]'
+ '-mtail-call[tail call]'
+ '-munimplemented-simd128[unimplemented simd128]'
+ '-mexec-model=[execution model]:arg'
+ )
+ ;;
+riscv)
+ args=(
+ '-msave-restore[enable using library calls for save and restore]'
+ )
+ ;;
esac
if [[ "$service" = clang* ]]; then
- args+=(
- "-flto=-[generate output files suitable for link time optimization]::style:(full thin)"
- -emit-llvm
- "-Qunused-arguments[don't emit warning for unused driver arguments]"
- --analyze
- -fshow-column -fshow-source-location -fcaret-diagnostics -fdiagnostics-fixit-info
- -fdiagnostics-parseable-fixits -fdiagnostics-print-source-range-info
- -fprint-source-range-info -fdiagnostics-show-option -fmessage-length
- "-nostdinc[Do not search standard system directories or compiler builtin directories for include files]"
- "-nostdlibinc[Do not search standard system directories for include files]"
- "-nobuiltininc[Do not search builtin directory for include files]"
- "--help[Display this information]"
- )
+ args+=(
+ '-all_load[undocumented option]'
+ '-allowable_client[undocumented option]:argument'
+ '--analyzer-no-default-checks[analyzer does no default checks]'
+ '--analyzer-output[static analyzer report output format]:format:(html plist plist-multi-file plist-html sarif sarif-html text)'
+ '--analyze[run the static analyzer]'
+ '-arch[arch]:argument'
+ '-arch_errors_fatal[arch errors fatal]'
+ '-arch_only[arch only]:argument'
+ '-arcmt-migrate-emit-errors[emit ARC errors even if the migrator can fix them]'
+ '-arcmt-migrate-report-output[output path for the plist report]:file:_files'
+ '-a-[undocumented option]:argument'
+ '--autocomplete=[autocomplete]:argument'
+ '-bind_at_load[bind at load]'
+ '--bootclasspath=[bootclasspath]:arg'
+ '-bundle[bundle]'
+ '-bundle_loader[bundle loader]:argument'
+ '--CLASSPATH=[CLASSPATH]:arg'
+ '--classpath=[classpath]:arg'
+ '-cl-denorms-are-zero[allow denormals to be flushed to zero]'
+ '-cl-fast-relaxed-math[cl fast relaxed math]'
+ '-cl-finite-math-only[allow floating-point optimizations]'
+ '-cl-fp32-correctly-rounded-divide-sqrt[specify that divide and sqrt are correctly rounded]'
+ '-client_name[client name]:argument'
+ '-cl-kernel-arg-info[generate kernel argument metadata]'
+ '-cl-mad-enable[allow use of less precise MAD computations]'
+ '-cl-no-signed-zeros[allow use of no signed zeros computations]'
+ '-cl-no-stdinc[disables all standard includes]'
+ '-cl-opt-disable[disables all optimizations]'
+ '-cl-single-precision-constant[treat double float constant as single precision]'
+ '-cl-std=[openCL language standard to compile for]:arg'
+ '-cl-strict-aliasing[this option is added for compatibility with OpenCL 1.0]'
+ '-cl-uniform-work-group-size[defines that the global work-size be uniform]'
+ '-cl-unsafe-math-optimizations[allow unsafe floating-point optimizations]'
+ '-compatibility_version[compatibility version]:compatibility version'
+ '--config[specifies configuration file]:configuration file:_files'
+ '--constant-cfstrings[use constant cfstrings]'
+ '--coverage[coverage]'
+ '-coverage[coverage]'
+ '-cpp[cpp]'
+ '--cuda-compile-host-device[compile CUDA code for both host and device]'
+ '--cuda-device-only[compile CUDA code for device only]'
+ '--cuda-gpu-arch=[cUDA offloading device architecture]:arg'
+ '--cuda-host-only[compile CUDA code for host only]'
+ '*--cuda-include-ptx=[include ptx for the following gpu architecture]:argument'
+ '--cuda-noopt-device-debug[enable device-side debug info generation]'
+ '--cuda-path=[cUDA installation path]:arg'
+ '--cuda-path-ignore-env[ignore environment variables to detect CUDA installation]'
+ '-cuid=[an id for compilation unit]:argument'
+ '-current_version[current version]:current version'
+ '-cxx-isystem[add directory to the C++ SYSTEM include search path]:directory:_files -/'
+ '-dead_strip[dead strip]'
+ '-dependency-dot[file to write dot-formatted header dependencies to]:file:_files'
+ '-dependency-file[file to write dependency output to]:file:_files'
+ '--dyld-prefix=[dyld prefix]:prefix'
+ '--dylib_file[dyld file]:file:_files'
+ '-dylinker[dylinker]'
+ '-dylinker_install_name[dylinker install name]:name'
+ '-dynamic[dynamic]'
+ '-dynamiclib[dynamic lib]'
+ '-EB[big endian]'
+ '-EL[little endian]'
+ '-emit-ast[emit Clang AST files for source inputs]'
+ '-emit-interface-stubs[generate Interface Stub Files]'
+ '-emit-llvm[use the LLVM representation for assembler and object files]'
+ '-emit-merged-ifs[generate Interface Stub Files, emit merged text not binary]'
+ '--emit-static-lib[enable linker job to emit a static library]'
+ #'-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang[trivial automatic variable initialization to zero is only here for benchmarks]'
+ '--encoding=[encoding]:arg'
+ '-exported_symbols_list[exported symbols list]:argument'
+ '--extdirs=[extdirs]:arg'
+ '--extra-warnings[enable extra warnings]'
+ '-faccess-control[access control]'
+ '*-F+[add directory to framework search path]:framework directory:_files -/'
+ '-faddrsig[emit an address-significance table]'
+ '-faggressive-function-elimination[aggressive function elimination]'
+ '-falign-commons[align commons]'
+ '-faligned-allocation[aligned allocation]'
+ '-faligned-new[enable C++17 aligned allocation functions]'
+ '-fall-intrinsics[all intrinsics]'
+ '-fallow-editor-placeholders[treat editor placeholders as valid source code]'
+ '-fallow-unsupported[allow unsupported]'
+ '-falternative-parameter-statement[enable the old style PARAMETER statement]'
+ '-faltivec[altivec]'
+ '-fansi-escape-codes[use ANSI escape codes for diagnostics]'
+ "-fapple-kext[use Apple's kernel extensions ABI]"
+ '-fapple-link-rtlib[force linking the clang builtins runtime library]'
+ '-fapple-pragma-pack[enable Apple GCC-compatible #pragma pack handling]'
+ '-fapplication-extension[restrict code to those available for App Extensions]'
+ '-fasm-blocks[asm blocks]'
+ '-fassume-sane-operator-new[assume sane operator new]'
+ '-fast[ast]'
+ '-fastcp[astcp]'
+ '-fastf[astf]'
+ '-fautolink[autolink]'
+ '-fautomatic[automatic]'
+ '-fauto-profile-accurate[auto profile accurate]'
+ '-fauto-profile=[enable sample-based profile guided optimizations]::arg'
+ '-fbackslash[change the interpretation of backslashes in string literals]'
+ '-fbacktrace[backtrace]'
+ '-fbasic-block-sections=[generate labels for each basic block]:arg'
+ '-fbinutils-version=[produced object files can use all ELF features supported by this version]:major.minor'
+ '-fblas-matmul-limit=[blas matmul limit]:arg'
+ '-fblocks[enable the blocks language feature]'
+ '-fbootclasspath=[bootclasspath]:arg'
+ '-fborland-extensions[accept non-standard constructs supported by the Borland compiler]'
+ '-fbracket-depth=[bracket depth]:arg'
+ '-fbuild-session-file=[use the last modification time of <file> as the build session timestamp]:file:_files'
+ '-fbuild-session-timestamp=[time when the current build session started]:time since Epoch in seconds'
+ '-fbuiltin-module-map[load the clang builtins module map file]'
+ '-fcaret-diagnostics[show diagnostic messages using a caret]'
+ '-fcf-protection=[instrument control-flow architecture protection]::arg (options\: return, branch, full, none)'
+ '-fcf-runtime-abi=[cf runtime abi]:arg'
+ '-fchar8_t[enable C++ builtin type char8_t]'
+ '-fcheck-array-temporaries[check array temporaries]'
+ '-fcheck=[check]:arg'
+ '-fclang-abi-compat=[attempt to match the ABI of Clang <version>]:version'
+ '-fclasspath=[classpath]:arg'
+ '-fcoarray=[coarray]:arg'
+ '-fcolor-diagnostics[enable colors in diagnostics]'
+ '-fcomment-block-commands=[treat each comma separated argument in <arg> as a documentation comment block command]:arg'
+ '-fcompile-resource=[compile resource]:arg'
+ '-fcomplete-member-pointers[require member pointer base types to be complete if they would be significant under the Microsoft ABI]'
+ '-fconstant-cfstrings[constant cfstrings]'
+ '-fconstant-string-class=[constant string class]:arg'
+ '-fconstexpr-backtrace-limit=[constexpr backtrace limit]:arg'
+ '-fconstexpr-depth=[constexpr depth]:arg'
+ '-fconstexpr-steps=[constexpr steps]:arg'
+ '-fconvergent-functions[assume functions may be convergent]'
+ '-fconvert=[convert]:arg'
+ '-fcoroutines-ts[enable support for the C++ Coroutines TS]'
+ '-fcoverage-compilation-dir=[the compilation directory to embed in the coverage mapping]:arg'
+ '-fcoverage-mapping[generate coverage mapping to enable code coverage analysis]'
+ '-fcoverage-prefix-map=[remap file source paths in coverage mapping]:arg'
+ '-fcrash-diagnostics-dir=[crash diagnostics dir]:arg'
+ '-fcray-pointer[cray pointer]'
+ '-fcreate-profile[create profile]'
+ '-fcs-profile-generate[generate instrumented code to collect context sensitive execution counts]'
+ '-fcs-profile-generate=[generate instrumented code to collect context sensitive execution counts]:directory:_files -/'
+ '-fc\+\+-static-destructors[c++ static destructors]'
+ '-fcuda-approx-transcendentals[use approximate transcendental functions]'
+ '-fcuda-flush-denormals-to-zero[flush denormal floating point values to zero in CUDA device mode]'
+ '-fcuda-rdc[cuda rdc]'
+ '-fcuda-short-ptr[use 32-bit pointers for accessing const/local/shared address spaces]'
+ '-fcxx-exceptions[enable C++ exceptions]'
+ '-fcxx-modules[cxx modules]'
+ '-fdebug-compilation-dir=[the compilation directory to embed in the debug info]:arg'
+ '-fdebug-default-version=[default DWARF version to use]:arg'
+ '-fdebug-dump-parse-tree[dump the parse tree]'
+ '-fdebug-dump-provenance[dump provenance]'
+ '-fdebug-dump-symbols[dump symbols after the semantic analysis]'
+ '-fdebug-info-for-profiling[emit extra debug info to make sample profile more accurate]'
+ '-fdebug-macro[emit macro debug information]'
+ '-fdebug-measure-parse-tree[measure the parse tree]'
+ '-fdebug-pass-arguments[debug pass arguments]'
+ '-fdebug-pass-structure[debug pass structure]'
+ '-fdebug-pre-fir-tree[dump the pre-FIR tree]'
+ '-fdebug-ranges-base-address[use DWARF base address selection entries in .debug_ranges]'
+ '-fdebug-unparse[unparse and stop]'
+ '-fdebug-unparse-with-symbols[unparse and stop]'
+ '-fdeclspec[allow __declspec as a keyword]'
+ '-fdefault-double-8[set the default double precision kind to an 8 byte wide type]'
+ '-fdefault-integer-8[set the default integer kind to an 8 byte wide type]'
+ '-fdefault-real-8[set the default real kind to an 8 byte wide type]'
+ '-fdelayed-template-parsing[parse templated function definitions at the end of the translation unit]'
+ '-fdenormal-fp-math=[denormal fp math]:arg'
+ '-fdepfile-entry=[depfile entry]:arg'
+ '-fdiagnostics-absolute-paths[print absolute paths in diagnostics]'
+ '-fdiagnostics-fixit-info[supply fixit into with diagnostic messages]'
+ '-fdiagnostics-format=[diagnostics format]:arg'
+ '-fdiagnostics-hotness-threshold=[prevent optimization remarks from being output if they do not meet threshold]:value'
+ '-fdiagnostics-parseable-fixits[print fixits in a machine parseable form]'
+ '-fdiagnostics-print-source-range-info[print source range spans in numeric form]'
+ '-fdiagnostics-show-category=[diagnostics show category]:arg'
+ '-fdiagnostics-show-hotness[enable profile hotness information in diagnostic line]'
+ '-fdiagnostics-show-note-include-stack[display include stacks for diagnostic notes]'
+ '-fdiagnostics-show-option[enable -Woption information in diagnostic line]'
+ '-fdiagnostics-show-template-tree[print a template comparison tree for differing templates]'
+ '-fdigraphs[enable alternative token representations]'
+ "-fdirect-access-external-data[don't use GOT indirection to reference external data symbols]"
+ '-fdiscard-value-names[discard value names in LLVM IR]'
+ '-fd-lines-as-code[d lines as code]'
+ '-fd-lines-as-comments[d lines as comments]'
+ '-fdollar-ok[dollar ok]'
+ '-fdouble-square-bracket-attributes[enable double square bracket attributes]'
+ '-fdump-fortran-optimized[dump fortran optimized]'
+ '-fdump-fortran-original[dump fortran original]'
+ '-fdump-parse-tree[dump parse tree]'
+ '-fdwarf-directory-asm[DWARF directory asm]'
+ '-fdwarf-exceptions[use DWARF style exceptions]'
+ '-felide-constructors[elide constructors]'
+ '-felide-type[elide types when printing diagnostics]'
+ '-fembed-bitcode=[embed LLVM bitcode (option: off, all, bitcode, marker)]:option'
+ '-fembed-bitcode[equivalent to -fembed-bitcode=all]'
+ '-fembed-bitcode-marker[equivalent to -fembed-bitcode=marker]'
+ '-femit-all-decls[emit all declarations]'
+ '-femulated-tls[use emutls functions to access thread_local variables]'
+ '-fenable-matrix[enable matrix data type and related builtin functions]'
+ '-fencoding=[encoding]:arg'
+ '-ferror-limit=[error limit]:arg'
+ '-fescaping-block-tail-calls[escaping block tail calls]'
+ '-fexperimental-isel[experimental isel]'
+ '-fexperimental-new-constant-interpreter[enable the experimental new constant interpreter]'
+ '-fexperimental-relative-c\+\+-abi-vtables[use the experimental C++ class ABI for classes with vtables]'
+ '-fexperimental-strict-floating-point[enables experimental strict floating point in LLVM]'
+ '-fextdirs=[extdirs]:arg'
+ '-fexternal-blas[external blas]'
+ '-ff2c[f2c]'
+ '-ffile-compilation-dir=[the compilation directory to embed in the debug info]:arg'
+ '-ffile-prefix-map=[remap file source paths in debug info and predefined preprocessor macros]:arg'
+ '-ffine-grained-bitfield-accesses[use separate accesses for consecutive bitfield runs with legal widths and alignments]'
+ '-ffinite-loops[assume all loops are finite]'
+ '-ffixed-form[process source files in fixed form]'
+ '-ffixed-line-length=[set column after which characters are ignored]:arg'
+ '-ffixed-point[enable fixed point types]'
+ '-fforce-dwarf-frame[always emit a debug frame section]'
+ '-fforce-emit-vtables[emits more virtual tables to improve devirtualization]'
+ '-fforce-enable-int128[enable support for int128_t type]'
+ '-ffor-scope[for scope]'
+ '-ffpe-trap=[fpe trap]:arg'
+ '-ffp-exception-behavior=[specifies the exception behavior of floating-point operations]:arg'
+ '-ffp-model=[controls the semantics of floating-point calculations]:arg'
+ '-ffree-form[process source files in free form]'
+ '-ffree-line-length-[free line length]:arg'
+ '-ffrontend-optimize[frontend optimize]'
+ '-fglobal-isel[enables the global instruction selector]'
+ '-fgnuc-version=[sets various macros to claim compatibility with the given GCC version]:version'
+ '-fgnu-inline-asm[gnu inline asm]'
+ '-fgnu-keywords[allow GNU-extension keywords regardless of language standard]'
+ '-fgnu-runtime[generate output compatible with the standard GNU Objective-C runtime]'
+ '-fgpu-allow-device-init[allow device side init function in HIP]'
+ '-fgpu-defer-diag[defer host/device related diagnostic messages for CUDA/HIP]'
+ '-fgpu-rdc[generate relocatable device code, also known as separate compilation mode]'
+ '-fgpu-sanitize[enable sanitizer for AMDGPU target]'
+ '-fheinous-gnu-extensions[heinous GNU extensions]'
+ '-fhip-new-launch-api,[-fno-hip-new-launch-api Use new kernel launching API for HIP]'
+ '-fhonor-infinites[honor infinites]'
+ '-fhonor-infinities[honor infinities]'
+ '-fhonor-nans[honor nans]'
+ '-fignore-exceptions[enable support for ignoring exception handling constructs]'
+ '-filelist[ilelist]:arg'
+ '-fimplicit-module-maps[implicit module maps]'
+ '-fimplicit-modules[implicit modules]'
+ '-fimplicit-none[no implicit typing allowed unless overridden by IMPLICIT statements]'
+ '-findirect-virtual-calls[indirect virtual calls]'
+ '-finit-character=[init character]:arg'
+ '-finit-integer=[init integer]:arg'
+ '-finit-local-zero[init local zero]'
+ '-finit-logical=[init logical]:arg'
+ '-finit-real=[init real]:arg'
+ '-finline-hint-functions[inline functions which are (explicitly or implicitly) marked inline]'
+ '-finstrument-function-entry-bare[instrument function entry only]'
+ '-finstrument-functions-after-inlining[insert the calls after inlining]'
+ '-finteger-4-integer-8[integer 4 integer 8]'
+ '-fintegrated-as[enable the integrated assembler]'
+ '-fintegrated-cc1[run cc1 in-process]'
+ '-fintrinsic-modules-path[intrinsic modules path]'
+ '-flarge-sizes[use INTEGER(KIND=8) for the result type in size-related intrinsics]'
+ '-flat_namespace[flat namespace]'
+ '-flegacy-pass-manager[use the legacy pass manager in LLVM]'
+ '-flimited-precision=[limited precision]:arg'
+ '-flogical-abbreviations[enable logical abbreviations]'
+ '-flto=-[generate output files suitable for link time optimization]::style:(full thin)'
+ '-flto-jobs=[controls the backend parallelism]:arg'
+ '-fmacro-backtrace-limit=[macro backtrace limit]:limit'
+ '-fmacro-prefix-map=[remap file source paths in predefined preprocessor macros]:arg'
+ '-fmax-array-constructor=[max array constructor]:arg'
+ '-fmax-identifier-length[max identifier length]'
+ '-fmax-stack-var-size=[max stack var size]:arg'
+ '-fmax-subrecord-length=[max subrecord length]:arg'
+ '-fmax-tokens=[max total number of preprocessed tokens for -Wmax-tokens]:number'
+ '-fmax-type-align=[specify the maximum alignment to enforce on pointers lacking an explicit alignment]:arg'
+ '-fmemory-profile=[enable heap memory profiling and dump results into <directory>]::directory:_files -/'
+ '-fmodule-file-deps[module file deps]'
+ '-fmodule-file=[specify the mapping of module name to precompiled module file]:file:_files'
+ '-fmodule-implementation-of[module implementation of]:name'
+ '-fmodule-map-file=[load this module map file]:file:_files'
+ '-fmodule-maps[implicitly search the file system for module map files.]'
+ '-fmodule-name=[specify the name of the module to build]:name'
+ '-fmodule-private[module private]'
+ '-fmodules-cache-path=[specify the module cache path]:directory:_files -/'
+ '-fmodules-decluse[require declaration of modules used within a module]'
+ '-fmodules-disable-diagnostic-validation[disable validation of the diagnostic options when loading the module]'
+ '-fmodules[enable the modules language feature]'
+ '-fmodules-ignore-macro=[ignore the definition of the given macro when building and loading modules]:macro'
+ '-fmodules-prune-after=[specify the interval after which a module file will be considered unused]:seconds'
+ '-fmodules-prune-interval=[specify the interval between attempts to prune the module cache]:seconds'
+ '-fmodules-search-all[search even non-imported modules to resolve references]'
+ '-fmodules-strict-decluse[requires all headers to be in modules]'
+ '-fmodules-ts[enable support for the C++ Modules TS]'
+ '-fmodules-user-build-path[specify the module user build path]:directory:_files -/'
+ '-fmodules-validate-input-files-content[validate PCM input files based on content if mtime differs]'
+ "-fmodules-validate-once-per-build-session[don't verify input files for the modules]"
+ '-fmodules-validate-system-headers[validate the system headers that a module depends on when loading the module]'
+ '-fms-compatibility[enable full Microsoft Visual C++ compatibility]'
+ '-fms-compatibility-version=[microsoft compiler version number]:arg'
+ '-fmsc-version=[microsoft compiler version number to report]:arg'
+ '-fms-memptr-rep=[ms memptr rep]:arg'
+ '-fms-volatile[ms volatile]'
+ '-fnested-functions[nested functions]'
+ '-fnew-alignment=[specifies the largest alignment guaranteed]:align'
+ '-fnext-runtime[next runtime]'
+ '-fno-builtin-[disable implicit builtin knowledge of a specific function]:arg'
+ '-fno-crash-diagnostics[disable auto-generation of preprocessed source files and a script for reproduction during a clang crash]'
+ '-fno-limit-debug-info[no limit debug info]'
+ '-fno-max-type-align[no max type align]'
+ '-fno_modules-validate-input-files-content[no modules validate input files content]'
+ '-fno_pch-validate-input-files-content[no pch validate input files content]'
+ '-fno-strict-modules-decluse[no strict modules decluse]'
+ '-fno-temp-file[directly create compilation output files]'
+ '-fno-working-directory[no working directory]'
+ '-fnoxray-link-deps[no xray link deps]'
+ '-fobjc-abi-version=-[set Objective-C ABI version]:version'
+ '-fobjc-arc-exceptions[use EH-safe code when synthesizing retains and releases in -fobjc-arc]'
+ '-fobjc-arc[synthesize retain and release calls for Objective-C pointers]'
+ '-fobjc-convert-messages-to-runtime-calls[convert messages to runtime calls]'
+ '-fobjc-encode-cxx-class-template-spec[fully encode C++ class template specialization]'
+ '-fobjc-exceptions[enable Objective-C exceptions]'
+ '-fobjc-infer-related-result-type[infer related result type]'
+ '-fobjc-legacy-dispatch[use legacy dispatch]'
+ '-fobjc-link-runtime[set link runtime]'
+ '-fobjc-nonfragile-abi[set nonfragile abi]'
+ '-fobjc-nonfragile-abi-version=-[set nonfragile abi version]:version'
+ '-fobjc-runtime=-[specify the target Objective-C runtime kind and version]:runtime'
+ '-fobjc-sender-dependent-dispatch[set sender dependent dispatch]'
+ '-fobjc-weak[enable ARC-style weak references in Objective-C]'
+ '-fopenmp-targets=[specify comma-separated list of triples OpenMP offloading targets to be supported]:targets'
+ '-fopenmp-version=[openmp version]:version'
+ '-foperator-arrow-depth=[operator arrow depth]:arg'
+ '-foperator-names[treat C++ operator name keywords as synonyms for operators]'
+ '-foptimization-record-file=[specify the output name of the file containing the optimization remarks]:file:_files'
+ '-foptimization-record-passes=[only include passes which match a specified regex]:regex'
+ '-force_cpusubtype_ALL[force cpusubtype all]'
+ '-force_flat_namespace[force flat namespace]'
+ '--force-link=[force link]:arg'
+ '-force_load[force load]:argument'
+ '-forder-file-instrumentation[generate instrumented code to collect order file]'
+ '-foutput-class-dir=[output class dir]:arg'
+ '-fpack-derived[pack derived]'
+ '-fparse-all-comments[parse all comments]'
+ '-fpascal-strings[recognize and construct Pascal-style string literals]'
+ '-fpass-plugin=[load pass plugin from a dynamic shared object file]:dsopath'
+ '-fpatchable-function-entry=[generate NOPs around function entry]:N,M'
+ '-fpch-codegen[generate code for uses of this PCH]'
+ '-fpch-debuginfo[generate debug info for types in an object file built from this PCH]'
+ '-fpch-instantiate-templates[instantiate templates already while building a PCH]'
+ '-fpch-validate-input-files-content[validate PCH input files based on content]'
+ '-fprebuilt-implicit-modules[look up implicit modules]'
+ '-fprebuilt-module-path=[specify the prebuilt module path]:directory:_files -/'
+ '-fpreserve-as-comments[preserve as comments]'
+ '-fproc-stat-report=[save subprocess statistics to the given file]:arg'
+ '-fprofile-exclude-files=[exclude files from profile]:arg'
+ '-fprofile-filter-files=[filter files for profile]:arg'
+ '-fprofile-instr-generate=[generate instrumented profile into file]::file:_files'
+ '-fprofile-instr-use=[use instrumentation data for profile-guided optimization]::arg'
+ '-fprofile-list=[filename defining the list of items to instrument]:file:_files'
+ '-fprofile-remapping-file=[use the remappings described in file in profile]:file:_files'
+ '-fprofile-sample-accurate[specifies that the sample profile is accurate]'
+ '-fprofile-sample-use=[profile sample use]::arg'
+ '-fprofile-update=[set update method of profile counters]:method'
+ '-fprotect-parens[protect parens]'
+ '-fpseudo-probe-for-profiling[emit pseudo probes for sample profiling]'
+ '*-framework[include framework found in search path]:framework:->framework'
+ '-frange-check[range check]'
+ '-freal-4-real-10[real 4 real 10]'
+ '-freal-4-real-16[real 4 real 16]'
+ '-freal-4-real-8[real 4 real 8]'
+ '-freal-8-real-10[real 8 real 10]'
+ '-freal-8-real-16[real 8 real 16]'
+ '-freal-8-real-4[real 8 real 4]'
+ '-frealloc-lhs[realloc lhs]'
+ '-frecord-command-line[record command line]'
+ '-frecord-marker=[record marker]:arg'
+ '-frecursive[recursive]'
+ '-fregister-global-dtors-with-atexit[use atexit to register global destructors]'
+ '-frelaxed-template-template-args[enable C++17 relaxed template template argument matching]'
+ '-frepack-arrays[repack arrays]'
+ '-freroll-loops[turn on loop reroller]'
+ '-fretain-comments-from-system-headers[retain comments from system headers]'
+ '-frewrite-imports[rewrite imports]'
+ '-frewrite-includes[rewrite includes]'
+ '-frewrite-map-file=[rewrite map file]:arg'
+ '-fropi[generate read-only position independent code (ARM only)]'
+ '-frtlib-add-rpath[add -rpath with architecture-specific resource directory to the linker flags]'
+ '-frtti-data[rtti data]'
+ '-frwpi[generate read-write position independent code (ARM only)]'
+ '-fsanitize-address-destructor-kind=[set destructor type used in ASan instrumentation]:kind'
+ '-fsanitize-address-field-padding=[level of field padding for AddressSanitizer]:arg'
+ '-fsanitize-address-globals-dead-stripping[enable linker dead stripping of globals in AddressSanitizer]'
+ '-fsanitize-address-poison-custom-array-cookie[enable poisoning array cookies when using custom operator new in AddressSanitizer]'
+ '-fsanitize-address-use-after-scope[enable use-after-scope detection in AddressSanitizer]'
+ '-fsanitize-address-use-odr-indicator[enable ODR indicator globals]'
+ '-fsanitize-blacklist=[path to blacklist file for sanitizers]:arg'
+ '-fsanitize-cfi-canonical-jump-tables[make the jump table addresses canonical in the symbol table]'
+ '-fsanitize-cfi-cross-dso[enable control flow integrity (CFI) checks for cross-DSO calls]'
+ '-fsanitize-cfi-icall-generalize-pointers[generalize pointers in CFI indirect call type signature checks]'
+ '-fsanitize-coverage-allowlist=[sanitize coverage allowlist]:arg'
+ '-fsanitize-coverage-blacklist=[disable sanitizer coverage instrumentation]:arg'
+ '-fsanitize-coverage-blocklist=[sanitize coverage blocklist]:arg'
+ '-fsanitize-coverage=[specify the type of coverage instrumentation for Sanitizers]:arg'
+ '-fsanitize-coverage-whitelist=[restrict sanitizer coverage instrumentation]:arg'
+ '-fsanitize-hwaddress-abi=[select the HWAddressSanitizer ABI to target]:arg'
+ '-fsanitize-link-c\+\+-runtime[sanitize link c++ runtime]'
+ '-fsanitize-link-runtime[sanitize link runtime]'
+ '-fsanitize-memory-track-origins=[enable origins tracking in MemorySanitizer]::arg'
+ '-fsanitize-memory-use-after-dtor[enable use-after-destroy detection in MemorySanitizer]'
+ '-fsanitize-minimal-runtime[sanitize minimal runtime]'
+ '-fsanitize-recover=[enable recovery for specified sanitizers]::arg'
+ '-fsanitize-stats[enable sanitizer statistics gathering]'
+ '-fsanitize-system-blacklist[path to system blacklist file for sanitizers]:file:_files'
+ '-fsanitize-thread-atomics[enable atomic operations instrumentation in ThreadSanitizer (default)]'
+ '-fsanitize-thread-func-entry-exit[enable function entry/exit instrumentation in ThreadSanitizer]'
+ '-fsanitize-thread-memory-access[enable memory access instrumentation in ThreadSanitizer]'
+ '-fsanitize-trap=[enable trapping for specified sanitizers]::arg'
+ '-fsanitize-undefined-strip-path-components=[strip a given number of path components when emitting check metadata]:number'
+ '-fsanitize-undefined-trap-on-error[equivalent to -fsanitize-trap=undefined]'
+ '-fsave-optimization-record=[generate an optimization record file in a specific format]::format'
+ '-fsecond-underscore[second underscore]'
+ '-fseh-exceptions[use SEH style exceptions]'
+ '-fsemantic-interposition[semantic interposition]'
+ '-fshow-column[show the column]'
+ '-fshow-overloads=[which overload candidates to show when overload resolution fails]:arg'
+ '-fshow-source-location[show source location]'
+ '-fsignaling-math[signaling math]'
+ '-fsign-zero[sign zero]'
+ '-fsized-deallocation[enable C++14 sized global deallocation functions]'
+ '-fsjlj-exceptions[use SjLj style exceptions]'
+ '-fslp-vectorize[enable the superword-level parallelism vectorization passes]'
+ '-fspell-checking-limit=[spell checking limit]:arg'
+ '-fspell-checking[spell checking]'
+ '-fsplit-dwarf-inlining[provide minimal debug info in the object]'
+ '-fsplit-lto-unit[enables splitting of the LTO unit]'
+ '-fsplit-machine-functions[enable late function splitting using profile information]'
+ '-fstack-arrays[stack arrays]'
+ '-fstack-clash-protection[enable stack clash protection]'
+ '-fstack-size-section[emit section containing metadata on function stack sizes]'
+ '-fstandalone-debug[emit full debug info for all types used by the program]'
+ '-fstrict-float-cast-overflow[assume that overflowing float-to-int casts are undefined]'
+ '-fstrict-return[strict return]'
+ '-fstrict-vtable-pointers[enable optimizations based on the strict vtables]'
+ '-fstruct-path-tbaa[struct path tbaa]'
+ '-fsycl[enable SYCL kernels compilation for device]'
+ '-fsymbol-partition=[symbol partition]:arg'
+ '-fsystem-module[build this module as a system module. only used with -emit-module]'
+ '-ftemplate-backtrace-limit=[template backtrace limit]:arg'
+ '-ftemplate-depth--[template depth]:arg'
+ '-ftemplate-depth=[template depth]:arg'
+ '-fterminated-vtables[terminated vtables]'
+ '-fthin-link-bitcode=[write minimized bitcode to <file>]:file:_files'
+ '-fthinlto-index=[perform ThinLTO importing using provided index]:arg'
+ '-fthreadsafe-statics[threadsafe statics]'
+ '-ftime-trace-granularity=[minimum time granularity traced by time profiler]:microseconds'
+ '-ftime-trace[turn on time profiler]'
+ '-ftrap-function=[issue call to specified function rather than a trap instruction]:function name'
+ '-ftrapv-handler=[specify the function to be called on overflow]:function name'
+ '-ftrigraphs[process trigraph sequences]'
+ '-ftrivial-auto-var-init=[initialize trivial automatic stack variables]:arg'
+ '-ftrivial-auto-var-init-stop-after=[stop initializing trivial automatic stack variables after the specified number of instances]:arg'
+ '-funderscoring[underscoring]'
+ '-funique-basic-block-section-names[use unique names for basic block sections]'
+ '-funique-internal-linkage-names[uniqueify Internal Linkage Symbol Names]'
+ '-funique-section-names[unique section names]'
+ '-funit-at-a-time[unit at a time]'
+ '-fuse-cuid=[method to generate ids for compilation units for single source offloading languages CUDA and HIP]:argument'
+ '-fuse-cxa-atexit[use cxa atexit]'
+ '-fuse-init-array[use init array]'
+ '-fuse-line-directives[use #line in preprocessed output]'
+ '-fvalidate-ast-input-files-content[compute and store the hash of input files used to build an AST]'
+ '-fveclib=[use the given vector functions library]:arg'
+ '-fvectorize[enable the loop vectorization passes]'
+ '-fvirtual-function-elimination[enables dead virtual function elimination optimization]'
+ '-fvisibility-dllexport=[the visibility for dllexport definitions]:arg'
+ '-fvisibility-externs-dllimport=[the visibility for dllimport external declarations]:arg'
+ '-fvisibility-externs-nodllstorageclass=[the visibility for external declarations without an explicit DLL dllstorageclass]:arg'
+ '-fvisibility-from-dllstorageclass[set the visibility of symbols in the generated code from their DLL storage class]'
+ '-fvisibility-global-new-delete-hidden[give global C++ operator new and delete declarations hidden visibility]'
+ '-fvisibility-inlines-hidden[give inline C++ member functions hidden visibility by default]'
+ '-fvisibility-inlines-hidden-static-local-var[visibility inlines hidden static local var]'
+ '-fvisibility-ms-compat[give global types and functions a specific visibility]'
+ '-fvisibility-nodllstorageclass=[the visibility for defintiions without an explicit DLL export class]:arg'
+ '-fwasm-exceptions[use WebAssembly style exceptions]'
+ '-fwhole-file[whole file]'
+ '-fwhole-program-vtables[enables whole-program vtable optimization]'
+ '-fwritable-strings[store string literals as writable data]'
+ '-fxl-pragma-pack[enable IBM XL #pragma pack handling]'
+ '-fxor-operator[enable .XOR. as a synonym of .NEQV.]'
+ '-fxray-always-emit-customevents[always emit xray customevent calls]'
+ '-fxray-always-emit-typedevents[always emit xray typedevents calls]'
+ '-fxray-always-instrument=[file defining xray always instrument]:file:_files'
+ '-fxray-attr-list=[file defining the list of xray attributes]:file:_files'
+ '-fxray-function-groups=[only instrument 1 of N groups]:arg'
+ '-fxray-function-index[xray function index]'
+ "-fxray-ignore-loops[don't instrument functions with loops unless they also meet the minimum function size]"
+ '-fxray-instruction-threshold=[sets the minimum function size to instrument with XRay]:arg'
+ '-fxray-instrumentation-bundle=[select which XRay instrumentation points to emit]:arg'
+ '-fxray-instrument[generate XRay instrumentation sleds on function entry and exit]'
+ '-fxray-link-deps[tells clang to add the link dependencies for XRay]'
+ '-fxray-modes=[list of modes to link in by default into XRay instrumented binaries]:arg'
+ '-fxray-never-instrument=[file defining the whitelist for Xray attributes]:file:_files'
+ '-fxray-selected-function-group=[select which group of functions to instrument]:arg'
+ '-fzvector[enable System z vector language extension]'
+ {-gcc-toolchain=,--gcc-toolchain=}'[use the gcc toolchain at the given directory]:directory:_files -/'
+ '-gcodeview[generate CodeView debug information]'
+ {-gcodeview-ghash,-gno-codeview-ghash}'[emit type record hashes is a .debug section]'
+ '-gcolumn-info[column info]'
+ '-gdwarf-aranges[DWARF aranges]'
+ '-gembed-source[embed source text in DWARF debug sections]'
+ '-gfull[emit debugging information for all symbols and types]'
+ {-G-,-G=-,-msmall-data-limit=,-msmall-data-threshold}'[put objects of at most size bytes into small data section]:size'
+ '-ggnu-pubnames[gnu pubnames]'
+ '-ginline-line-tables[inline line tables]'
+ '-gline-directives-only[emit debug line info directives only]'
+ '-gline-tables-only[line tables only]'
+ '-glldb[lldb]'
+ '-gmlt[emit debug line number tables only]'
+ '-gmodules[generate debug info with external references]'
+ '-gno-column-info[no column info]'
+ '-gno-embed-source[no embed source]'
+ '-gno-gnu-pubnames[no gnu pubnames]'
+ '-gno-inline-line-tables[no inline line tables]'
+ '-gno-record-command-line[no record command line]'
+ '--gpu-instrument-lib=[instrument device library for HIP]:argument'
+ '--gpu-max-threads-per-block=[default max threads per block for kernel launch bounds for HIP]'
+ '-grecord-command-line[record command line]'
+ '-gsce[sce]'
+ '-gused[emit debugging information for symbols that are used]'
+ '-gz=[DWARF debug sections compression type]::arg'
+ '-headerpad_max_install_names[headerpad max install names]:argument'
+ '-help[display this information]'
+ '--help-hidden[display help for hidden options]'
+ '--hip-device-lib=[hIP device library]:arg'
+ '--hip-device-lib-path=[hip device lib path]:arg'
+ '--hip-link[link clang-offload-bundler bundles for HIP]'
+ '--hip-version=[HIP version in the format of major.minor.patch]'
+ '-ibuiltininc[enable builtin #include directories even when -nostdinc is used before or after -ibuiltininc]'
+ '-iframework[add directory to SYSTEM framework search path]:directory:_files -/'
+ '-iframeworkwithsysroot[add directory to SYSTEM framework search path, absolute paths are relative to -isysroot]:directory:_files -/'
+ '-image_base[image base]:argument'
+ '-include-pch[include precompiled header file]:file:_files'
+ '-index-header-map[make the next included directory (-I or -F) an indexer header map]'
+ '-init[init]:arg'
+ '-install_name[install name]:arg'
+ '-integrated-as[integrated as]'
+ '-interface-stub-version=[interface stub version]:arg'
+ '-isystem-after[add directory to end of the SYSTEM include search path]:directory:_files -/'
+ '-ivfsoverlay[overlay the virtual filesystem described by file over the real file system]:arg'
+ '-iwithsysroot[add directory to SYSTEM include search path]:directory:_files -/'
+ '-J[this option specifies where to put .mod files for compiled modules]:arg'
+ '-keep_private_externs[keep private externs]'
+ '*-lazy_framework[lazy framework]:framework:->framework'
+ '*-lazy_library[lazy library]:arg'
+ '--ld-path=[ld path]:arg'
+ '--libomptarget-amdgcn-bc-path=[path to libomptarget-amdgcn bitcode library]:arg'
+ '--libomptarget-nvptx-bc-path=[path to libomptarget-nvptx bitcode library]:arg'
+ '--library-directory=[add directory to library search path]:directory:_files -/'
+ '-maix-struct-return[return all structs in memory]'
+ "-malign-branch-boundary=[specify the boundary's size to align branches]:size"
+ '-malign-branch=[specify types of branches to align]:arg'
+ '-mappletvos-version-min=[appletvos version min]:arg'
+ '-mappletvsimulator-version-min=[appletvsimulator version min]:arg'
+ '-mbackchain[link stack frames through backchain on System Z]'
+ '-mbig-endian[big endian]'
+ '-mbranches-within-32B-boundaries[align selected branches within 32-byte boundary]'
+ '-mbranch-protection=[enforce targets of indirect branches and function returns]:arg'
+ '-mcode-object-v3[legacy option to specify code object ABI V3]'
+ '-mcode-object-version=[specify code object ABI version]:version'
+ '-mconsole[console]:arg'
+ '-mcrc[allow use of CRC instructions]'
+ '-mdefault-build-attributes[default build attributes]:arg'
+ '-mdll[dll]:arg'
+ '-mdouble=[force double to be 32 bits or 64 bits]:arg'
+ '-mdynamic-no-pic[dynamic no pic]:arg'
+ '-meabi[set EABI type]:arg'
+ '-menable-experimental-extensions[enable use of experimental RISC-V extensions]'
+ '-menable-unsafe-fp-math[allow unsafe floating-point math optimizations which may decrease precision]'
+ '-mfix-cortex-a53-835769[workaround Cortex-A53 erratum 835769]'
+ '-mfloat-abi=[float abi]:arg'
+ '-mfpu=[fpu]:arg'
+ '-mglobal-merge[enable merging of globals]'
+ '-mharden-sls=[select straight-line speculation hardening scope]:arg'
+ '--mhwdiv=[hwdiv]:arg'
+ '-mhwdiv=[hwdiv]:arg'
+ '-mhwmult=[hwmult]:arg'
+ '-mignore-xcoff-visibility[do not emit the visibility attribute for asm]'
+ '--migrate[run the migrator]'
+ '-mimplicit-float[implicit float]'
+ '-mimplicit-it=[implicit it]:arg'
+ '-mincremental-linker-compatible[emit an object file which can be used with an incremental linker]'
+ '-mios-simulator-version-min=[ios simulator version min]:arg'
+ '-mios-version-min=[ios version min]:arg'
+ '-miphoneos-version-min=[iphoneos version min]:arg'
+ '-miphonesimulator-version-min=[iphonesimulator version min]:arg'
+ '-mkernel[kernel]'
+ '-mlinker-version=[linker version]:arg'
+ '-mlittle-endian[little endian]'
+ "-mllvm[additional arguments to forward to LLVM's option processing]:arg"
+ '-mlong-calls[generate branches with extended addressability]'
+ '-mlvi-cfi[enable only control-flow mitigations for Load Value Injection]'
+ '-mlvi-hardening[enable all mitigations for Load Value Injection]'
+ '-mmacos-version-min=[set Mac OS X deployment target]:arg'
+ '-mmacosx-version-min=[macosx version min]:arg'
+ '-mmcu=[mcu]:arg'
+ '-module-dependency-dir[directory to dump module dependencies to]:arg'
+ '-module-dir[odule dir]:dir'
+ '-module-file-info[provide information about a particular module file]'
+ '-moslib=[oslib]:arg'
+ '-moutline-atomics[generate local calls to out-of-line atomic operations]'
+ '-mpacked-stack[use packed stack layout]'
+ '-mpad-max-prefix-size=[specify maximum number of prefixes to use for padding]:arg'
+ '-mpie-copy-relocations[pie copy relocations]'
+ '-mprefer-vector-width=[specifies preferred vector width]:arg'
+ '-mqdsp6-compat[enable hexagon-qdsp6 backward compatibility]'
+ '-mrelax-all[relax all machine instructions]'
+ '-mrelax[enable linker relaxation]'
+ '-mretpoline[retpoline]'
+ '-mseses[enable speculative execution side effect suppression (SESES)]'
+ '-msign-return-address=[select return address signing scope]:arg'
+ '-msim[sim]'
+ '-mspeculative-load-hardening[speculative load hardening]'
+ '-mstack-alignment=[set the stack alignment]:arg'
+ '-mstack-probe-size=[set the stack probe size]:size'
+ '-mstack-protector-guard-offset=[use the given offset for addressing the stack-protector guard]:arg'
+ '-mstack-protector-guard-reg=[use the given reg for addressing the stack-protector guard]:reg'
+ '-msvr4-struct-return[return small structs in registers]'
+ '-mthread-model[the thread model to use]:arg'
+ '-mthumb[thumb]'
+ '-mtls-size=[specify bit size of immediate TLS offsets]:arg'
+ '-mtvos-simulator-version-min=[tvos simulator version min]:arg'
+ '-mtvos-version-min=[tvos version min]:arg'
+ '-multi_module[multi module]'
+ '-multiply_defined[multiply defined]:arg'
+ '-multiply_defined_unused[multiply defined unused]:arg'
+ '-municode[unicode]:arg'
+ '-munsafe-fp-atomics[enable unsafe floating point atomic instructions]'
+ '-mv55[equivalent to -mcpu=hexagonv55]'
+ '-mv5[equivalent to -mcpu=hexagonv5]'
+ '-mv60[equivalent to -mcpu=hexagonv60]'
+ '-mv62[equivalent to -mcpu=hexagonv62]'
+ '-mv65[equivalent to -mcpu=hexagonv65]'
+ '-mv66[equivalent to -mcpu=hexagonv66]'
+ '-mv67[equivalent to -mcpu=hexagonv67]'
+ '-mv67t[equivalent to -mcpu=hexagonv67t]'
+ '-mv68[equivalent to -mcpu=hexagonv68]'
+ '-mvx[vx]'
+ '-mwarn-nonportable-cfstrings[warn nonportable cfstrings]'
+ '-mwatchos-simulator-version-min=[watchos simulator version min]:arg'
+ '-mwatchos-version-min=[watchos version min]:arg'
+ '-mwatchsimulator-version-min=[watchsimulator version min]:arg'
+ '-mwavefrontsize64[specify wavefront size 64 mode]'
+ '-mwindows[windows]:arg'
+ '-mzvector[zvector]'
+ '-nobuiltininc[do not search builtin directory for include files]'
+ '-nocpp[no cpp]'
+ '-nocudainc[do not add include paths for CUDA/HIP and do not include the default CUDA/HIP wrapper headers]'
+ '*--no-cuda-include-ptx=[do not include ptx for the following gpu architecture]:argument'
+ '-nocudalib[do not link device library for CUDA/HIP device compilation]'
+ '--no-cuda-noopt-device-debug[disable device-side debug info generation]'
+ "--no-cuda-version-check[don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture]"
+ '-no_dead_strip_inits_and_terms[no dead strip inits and terms]'
+ '-nofixprebinding[no fixprebinding]'
+ '-nogpuinc[no gpuinc]'
+ '-nogpulib[no gpulib]'
+ '--no-integrated-cpp[no integrated cpp]'
+ '-no-integrated-cpp[no integrated cpp]'
+ '-nolibc[no libc]'
+ '-nomultidefs[no multidefs]'
+ '--no-offload-arch=[no offload arch]:arg'
+ '-no-pie[no pie]'
+ '-nopie[no pie]'
+ '-noprebind[no prebind]'
+ '-noprofilelib[no profilelib]'
+ '-no-pthread[no pthread]'
+ '-noseglinkedit[no seglinkedit]'
+ '--no-standard-libraries[no standard libraries]'
+ '-nostdinc\+\+[disable standard #include directories for the C++ standard library]'
+ '-nostdlibinc[do not search standard system directories for include files]'
+ '-nostdlib\+\+[no stdlib++]'
+ '--no-system-header-prefix=[no system header prefix]:prefix'
+ '--no-undefined[no undefined]'
+ '-objcmt-atomic-property[make migration to atomic properties]'
+ '-objcmt-migrate-all[enable migration to modern ObjC]'
+ '-objcmt-migrate-annotation[enable migration to property and method annotations]'
+ '-objcmt-migrate-designated-init[enable migration to infer NS_DESIGNATED_INITIALIZER for initializer methods]'
+ '-objcmt-migrate-instancetype[enable migration to infer instancetype for method result type]'
+ '-objcmt-migrate-literals[enable migration to modern ObjC literals]'
+ '-objcmt-migrate-ns-macros[enable migration to NS_ENUM/NS_OPTIONS macros]'
+ '-objcmt-migrate-property-dot-syntax[enable migration of setter/getter messages to property-dot syntax]'
+ '-objcmt-migrate-property[enable migration to modern ObjC property]'
+ '-objcmt-migrate-protocol-conformance[enable migration to add protocol conformance on classes]'
+ '-objcmt-migrate-readonly-property[enable migration to modern ObjC readonly property]'
+ '-objcmt-migrate-readwrite-property[enable migration to modern ObjC readwrite property]'
+ '-objcmt-migrate-subscripting[enable migration to modern ObjC subscripting]'
+ "-objcmt-ns-nonatomic-iosonly[enable migration to use NS_NONATOMIC_IOSONLY macro for setting property's atomic attribute]"
+ '-objcmt-returns-innerpointer-property[enable migration to annotate property with NS_RETURNS_INNER_POINTER]'
+ '-objcmt-whitelist-dir-path=[objcmt whitelist dir path]:arg'
+ '-objcmt-white-list-dir-path=[only modify files with a filename contained in the provided directory path]:arg'
+ '-ObjC[treat source files as Objective-C]'
+ '-ObjC\+\+[treat source files as Objective-C++]'
+ '-object[object]'
+ '--offload-arch=[offload arch]:arg'
+ '--output-class-directory=[output class directory]:arg'
+ '-pagezero_size[pagezero size]:arg'
+ '-pg[enable mcount instrumentation]'
+ {-p,--profile}'[enable function profiling for prof]'
+ '-prebind_all_twolevel_modules[prebind all twolevel modules]'
+ '-prebind[prebind]'
+ '--precompile[only precompile the input]'
+ '-preload[preload]'
+ '--print-diagnostic-categories[print diagnostic categories]'
+ '-print-effective-triple[print effective triple]'
+ '--print-effective-triple[print the effective target triple]'
+ '--print-file-name=[print the full library path of <file>]:file:_files'
+ '-print-ivar-layout[enable Objective-C Ivar layout bitmap print trace]'
+ '--print-libgcc-file-name[print the library path for the currently used compiler runtime library]'
+ '--print-multi-directory[print multi directory]'
+ '--print-multi-lib[print multi lib]'
+ '--print-prog-name=[print the full program path of <name>]:name'
+ '-print-resource-dir[print resource dir]'
+ '--print-resource-dir[print the resource directory pathname]'
+ '--print-search-dirs[print the paths used for finding libraries and programs]'
+ '--print-supported-cpus[print supported cpus]'
+ '-print-supported-cpus[print supported cpus]'
+ '-print-targets[print targets]'
+ '--print-targets[print the registered targets]'
+ '-print-target-triple[print target triple]'
+ '--print-target-triple[print the normalized target triple]'
+ '-private_bundle[private bundle]'
+ '--profile-blocks[undocumented option]'
+ '-pthreads[pthreads]'
+ '-pthread[support POSIX threads in generated code]'
+ '--ptxas-path=[path to ptxas (used for compiling CUDA code)]:arg'
+ "-Qunused-arguments[don't emit warning for unused driver arguments]"
+ '-read_only_relocs[read only relocs]:arg'
+ '-relocatable-pch[relocatable pch]'
+ '--relocatable-pch[whether to build a relocatable precompiled header]'
+ '-R[enable the specified remark]:remark'
+ '--resource=[resource]:arg'
+ '-rewrite-legacy-objc[rewrite Legacy Objective-C source to C++]'
+ '-rewrite-objc[rewrite Objective-C source to C++]'
+ '--rocm-device-lib-path=[rOCm device library path]:arg'
+ '--rocm-path=[rOCm installation path]:arg'
+ '-Rpass-analysis=[report transformation analysis from optimization passes]:regex'
+ '-Rpass-missed=[report missed transformations by optimization passes]:arg'
+ '-Rpass=[report transformations performed by optimization passes]:arg'
+ '-rpath[rpath]:arg'
+ '-r[product a relocatable object as output]'
+ '--rtlib=[compiler runtime library to use]:arg'
+ '-rtlib=[rtlib]:arg'
+ '--save-stats=[save llvm statistics]:arg'
+ '-sectalign[sectalign]:arg'
+ '-sectcreate[sectcreate]:arg'
+ '-sectobjectsymbols[sectobjectsymbols]:arg'
+ '-sectorder[sectorder]:arg'
+ '-seg1addr[seg1addr]:arg'
+ '-segaddr[segaddr]:arg'
+ '-seg_addr_table_filename[seg addr table filename]:arg'
+ '-seg_addr_table[seg addr table]:arg'
+ '-segcreate[segcreate]:arg'
+ '-seglinkedit[seglinkedit]'
+ '-segprot[segprot]:arg'
+ '-segs_read_only_addr[segs read only addr]:arg'
+ '-segs_read_[segs read]:arg'
+ '-segs_read_write_addr[segs read write addr]:arg'
+ '--serialize-diagnostics[serialize compiler diagnostics to a file]:arg'
+ '-serialize-diagnostics[serialize diagnostics]:arg'
+ '-shared-libasan[dynamically link the sanitizer runtime]'
+ '-shared-libsan[shared libsan]'
+ '--shared[shared]'
+ '--signed-char[signed char]'
+ '-single_module[single module]'
+ '--specs=[specs]:arg'
+ '-static-libgfortran[static libgfortran]'
+ '-static-libsan[statically link the sanitizer runtime]'
+ '-static-libstdc\+\+[static libstdc++]'
+ '-static-openmp[use the static host OpenMP runtime while linking.]'
+ '-static-pie[static pie]'
+ '--static[static]'
+ '-std-default=[std default]:arg'
+ '--stdlib=[c++ standard library to use]:arg'
+ '-stdlib\+\+-isystem[use directory as the C++ standard library include path]:directory:_files -/'
+ '-stdlib=[stdlib]:arg'
+ '-sub_library[sub library]:arg'
+ '-sub_umbrella[sub umbrella]:arg'
+ '-sycl-std=[SYCL language standard to compile for]:standard'
+ '--system-header-prefix=[treat all #include paths starting with <prefix> as including a system header]:prefix'
+ '-target[generate code for the given target]:arg'
+ '--target=[target]:arg'
+ '-Tbss[set starting address of BSS to <addr>]:addr'
+ '-Tdata[set starting address of DATA to <addr>]:addr'
+ '--traditional[traditional]'
+ '-traditional[traditional]'
+ '-Ttext[set starting address of TEXT to <addr>]:addr'
+ '-t[undocumented option]'
+ '-twolevel_namespace_hints[twolevel namespace hints]'
+ '-twolevel_namespace[twolevel namespace]'
+ '-umbrella[umbrella]:arg'
+ '-undefined[undefined]:arg'
+ '-unexported_symbols_list[unexported symbols list]:arg'
+ '--unsigned-char[unsigned char]'
+ '--unwindlib=[unwind library to use]:arg'
+ '-unwindlib=[unwindlib]:arg'
+ '--verify-debug-info[verify the binary representation of debug output]'
+ '-verify-pch[load and verify that a pre-compiled header file is not stale]'
+ '--warn-=-[enable the specified warning]:warning:->warning'
+ '*-weak_framework[weak framework]:framework:->framework'
+ '*-weak_library[weak library]:arg'
+ '-weak-l[weak l]:arg'
+ '-weak_reference_mismatches[weak reference mismatches]:arg'
+ '-whatsloaded[whatsloaded]'
+ '-whyload[whyload]'
+ '-working-directory=[resolve file paths relative to the specified directory]:arg'
+ '-Xanalyzer[pass <arg> to the static analyzer]:arg'
+ '-Xarch_device[pass arg to CUDA/HIP device compilation]:argument'
+ '-Xarch_host[pass arg to CUDA/HIP host compilation]:argument'
+ '-Xclang[pass <arg> to the clang compiler]:arg'
+ '-Xcuda-fatbinary[pass arg to fatbinary invocation]:argument'
+ '-Xcuda-ptxas[pass arg to the ptxas assemler]:argument'
+ '-Xflang[pass <arg> to the flang compiler]:arg'
+ '-Xopenmp-target[pass arg to the the target offloading toolchain]:argument'
+ '-y[the action to perform on the input]:arg'
+ '-Z-[undocumented option]:argument'
+ )
else
- args+=(
- '-flto=-[Enable link-time optimization]::jobs:'
- '*--help=-[Display this information]:class:->help'
- )
+ args+=(
+ '--dump=[dump information]:argument'
+ '-flto=-[enable link-time optimization]::jobs:'
+ '*--help=-[display this information]:class:->help'
+ )
fi
local -a sanitizers
- sanitizers=(
- address alignment bool bounds enum float-cast-overflow float-divide-by-zero
- integer-divide-by-zero memory nonnull-attribute null nullability-arg nullability-assign
- nullability-return object-size pointer-overflow return unsigned-integer-overflow
- returns-nonnull-attribute shift signed-integer-overflow unreachable vla-bound vptr
- )
+sanitizers=(
+ address alignment bool bounds enum float-cast-overflow float-divide-by-zero
+ integer-divide-by-zero memory nonnull-attribute null nullability-arg
+ nullability-assign nullability-return object-size pointer-overflow return
+ unsigned-integer-overflow returns-nonnull-attribute shift signed-integer-overflow
+ unreachable vla-bound vptr
+)
local -a languages
languages=(
- c c-header cpp-output
- c++ c++-header c++-cpp-output
- objective-c objective-c-header objective-c-cpp-output
- objective-c++ objective-c++-header objective-c++-cpp-output
- assembler assembler-with-cpp
- ada
- f77 f77-cpp-input f95 f95-cpp-input
- go
- java
- brig
- none
-)
-
-# generic options (from --help)
-args+=(
- '-###[print commands to run this compilation]'
- '-o:output file:_files -g "^*.(c|h|cc|C|cxx)(-.)"'
- '-x[Specify the language of the following input files]:input file language:('"$languages"')'
- '+e-:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))'
- '-d-:dump:->dump'
- '-g-::debugging information type or level:(0 1 2 3 gdb coff stabs stabs+ dwarf dwarf+ dwarf-2 dwarf-3 dwarf-4 xcoff xcoff+)'
- '-O-::optimization level:((0 1 2 3 g\:optimize\ for\ debugging\ experience s\:optimize\ for\ space fast\:optimize\ for\ speed\ disregarding\ exact\ standards\ compliance))'
- '*-M-::output dependencies:((M\:only\ user\ header\ files MD\:output\ to\ file G\:treat\ missing\ header\ files\ as\ generated))'
- '*-A-:define assertion:'
- '*-D-:define macro:'
- '*-U-:undefine macro:'
- '-C[do not discard comments during preprocess]'
- '-CC[do not discard comments, including macro expansion]'
- '-P[inhibit generation of linkemakers during preprocess]'
- '-H[print name of each header file used]'
- '-E[Preprocess only; do not compile, assemble or link]'
- '-S[Compile only; do not assemble or link]'
- '-c[Compile and assemble, but do not link]'
- '*-Wp,-:preprocessor option:'
- '*-Wl,-:linker option:'
- '*-Xpreprocessor:preprocessor option:'
- '*-Xlinker:linker option:'
- '*-Xassembler:assembler option:'
- '*-u:pretend symbol to be undefined:'
- '*-Wa,-:assembler option:'
- '*-l:library:->library'
- '*-L-:library search path:_files -/'
- '*-I-:header file search path:_files -/'
- '-B-[Add <prefix> to the compiler'\''s search paths]:executable prefix:_files -/'
- '-b:target machine:'
- '-V:specify compiler version:'
- '--version[Display compiler version information]'
- '-print-file-name=-[Display the full path to library <library>]:library:->library'
- '-print-prog-name=-[Display the full path to compiler component <program>]:program:'
- '*-specs=-[Override built-in specs with the contents of <file>]:file:_files'
- '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899\:1990 iso9899\:199409 c99 iso9899\:1999 c11 iso9899\:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899\:2017 gnu++17 c++2a gnu++2a)'
- '*-include:include file:_files -g \*.h\(-.\)'
- '*-imacros:macro input file:_files -g \*.h\(-.\)'
- '*-idirafter:second include path directory:_files -/'
- '*-iprefix:prefix:_files'
- '*-iwithprefix:second include path directory:_files -/'
- '*-iwithprefixbefore:main include path directory:_files -/'
- '*-isystem:second include path directory (system):_files -/'
- '--sysroot=-[Use <directory> as the root directory for headers and libraries]:directory:_files -/'
- '-pass-exit-codes[Exit with highest error code from a phase]'
- '--target-help[Display target specific command line options]'
- '-dumpspecs[Display all of the built in spec strings]'
- '-dumpversion[Display the version of the compiler]'
- '-dumpmachine[Display the compiler'\''s target processor]'
- '-print-search-dirs[Display the directories in the compiler'\''s search path]'
- '-print-libgcc-file-name[Display the name of the compiler'\''s companion library]'
- '-print-multiarch[Display the target'\''s normalized GNU triplet, used as a component in the library path]'
- '-print-multi-directory[Display the root directory for versions of libgcc]'
- '-print-multi-lib[Display the mapping between command line options and multiple library search directories]'
- '-print-multi-os-directory[Display the relative path to OS libraries]'
- '-print-sysroot[Display the target libraries directory]'
- '-print-sysroot-headers-suffix[Display the sysroot suffix used to find headers]'
- '-save-stats=-[Save code generation statistics]:location:(cwd obj)'
- '-save-temps[Do not delete intermediate files]'
- '-no-canonical-prefixes[Do not canonicalize paths when building relative prefixes to other gcc components]'
- '-pipe[Use pipes rather than intermediate files]'
- '-pie[Create a position independent executable]'
- '-shared[Create a shared library]'
- '-time[Time the execution of each subprocess]'
+ c c-header cpp-output c++ c++-header c++-cpp-output objective-c objective-c-header
+ objective-c-cpp-output objective-c++ objective-c++-header objective-c++-cpp-output
+ assembler assembler-with-cpp ada f77 f77-cpp-input f95 f95-cpp-input go java
+ brig none
)
# warnings (from --help=warnings), note some -W options are listed by --help=common instead
-args+=(
-# --help=warnings,^joined
- '-W[This switch is deprecated; use -Wextra instead]'
- '-Wabi-tag[Warn if a subobject has an abi_tag attribute that the complete object type does not have]'
- '-Wabi[Warn about things that will change when compiling with an ABI-compliant compiler]'
- '-Waddress[Warn about suspicious uses of memory addresses]'
- '-Waggregate-return[Warn about returning structures, unions or arrays]'
- '-Waggressive-loop-optimizations[Warn if a loop with constant number of iterations triggers undefined behavior]'
- '-Waliasing[Warn about possible aliasing of dummy arguments]'
- '-Walign-commons[Warn about alignment of COMMON blocks]'
- '-Wall[Enable most warning messages]'
- '-Walloc-zero[Warn for calls to allocation functions that specify zero bytes]'
- '-Walloca[Warn on any use of alloca]'
- '-Wampersand[Warn about missing ampersand in continued character constants]'
- '-Wargument-mismatch[Warn about type and rank mismatches between arguments and parameters]'
- '-Warray-bounds[Warn if an array is accessed out of bounds]'
- '-Warray-temporaries[Warn about creation of array temporaries]'
- '-Wassign-intercept[Warn whenever an Objective-C assignment is being intercepted by the garbage collector]'
- '-Wattributes[Warn about inappropriate attribute usage]'
- '-Wbad-function-cast[Warn about casting functions to incompatible types]'
- '-Wbool-compare[Warn about boolean expression compared with an integer value different from true/false]'
- '-Wbool-operation[Warn about certain operations on boolean expressions]'
- '-Wbuiltin-declaration-mismatch[Warn when a built-in function is declared with the wrong signature]'
- '-Wbuiltin-macro-redefined[Warn when a built-in preprocessor macro is undefined or redefined]'
- '-Wc++-compat[Warn about C constructs that are not in the common subset of C and C++]'
- '-Wc++0x-compat[Deprecated in favor of -Wc++11-compat]'
- '-Wc++1z-compat[Warn about C++ constructs whose meaning differs between ISO C++ 2014 and (forthcoming) ISO C++ 201z(7?)]'
- '-Wc++11-compat[Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011]'
- '-Wc++14-compat[Warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014]'
- '-Wc-binding-type[Warn if the type of a variable might be not interoperable with C]'
- '-Wc90-c99-compat[Warn about features not present in ISO C90, but present in ISO C99]'
- '-Wc99-c11-compat[Warn about features not present in ISO C99, but present in ISO C11]'
- '-Wcast-align[Warn about pointer casts which increase alignment]'
- '-Wcast-qual[Warn about casts which discard qualifiers]'
- '-Wchar-subscripts[Warn about subscripts whose type is "char"]'
- '-Wcharacter-truncation[Warn about truncated character expressions]'
- '-Wchkp[Warn about memory access errors found by Pointer Bounds Checker]'
- '-Wclobbered[Warn about variables that might be changed by "longjmp" or "vfork"]'
- '-Wcomment[Warn about possibly nested block comments, and C++ comments spanning more than one physical line]'
- '-Wcomments[Synonym for -Wcomment]'
- '-Wcompare-reals[Warn about equality comparisons involving REAL or COMPLEX expressions]'
- '-Wconditionally-supported[Warn for conditionally-supported constructs]'
- '-Wconversion-extra[Warn about most implicit conversions]'
- '-Wconversion-null[Warn for converting NULL from/to a non-pointer type]'
- '-Wconversion[Warn for implicit type conversions that may change a value]'
- '-Wcoverage-mismatch[Warn in case profiles in -fprofile-use do not match]'
- '-Wcpp[Warn when a #warning directive is encountered]'
- '-Wctor-dtor-privacy[Warn when all constructors and destructors are private]'
- '-Wdangling-else[Warn about dangling else]'
- '-Wdate-time[Warn about __TIME__, __DATE__ and __TIMESTAMP__ usage]'
- '-Wdeclaration-after-statement[Warn when a declaration is found after a statement]'
- '-Wdelete-incomplete[Warn when deleting a pointer to incomplete type]'
- '-Wdelete-non-virtual-dtor[Warn about deleting polymorphic objects with non- virtual destructors]'
- '-Wdeprecated-declarations[Warn about uses of __attribute__((deprecated)) declarations]'
- '-Wdeprecated[Warn if a deprecated compiler feature, class, method, or field is used]'
- '-Wdesignated-init[Warn about positional initialization of structs requiring designated initializers]'
- '-Wdisabled-optimization[Warn when an optimization pass is disabled]'
- '-Wdiscarded-array-qualifiers[Warn if qualifiers on arrays which are pointer targets are discarded]'
- '-Wdiscarded-qualifiers[Warn if type qualifiers on pointers are discarded]'
- '-Wdiv-by-zero[Warn about compile-time integer division by zero]'
- '-Wdouble-promotion[Warn about implicit conversions from "float" to "double"]'
- '-Weffc\+\+[Warn about violations of Effective C++ style rules]'
- '-Wduplicate-decl-specifier[Warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier]'
- '-Wduplicated-branches[Warn about duplicated branches in if-else statements]'
- '-Wduplicated-cond[Warn about duplicated conditions in an if-else-if chain]'
- '-Weffc++[Warn about violations of Effective C++ style rules]'
- '-Wempty-body[Warn about an empty body in an if or else statement]'
- '-Wendif-labels[Warn about stray tokens after #else and #endif]'
- '-Wenum-compare[Warn about comparison of different enum types]'
-#this still exists but makes completing -Werror= less convenient
- #'-Werror-implicit-function-declaration[This switch is deprecated; use -Werror=implicit-fun
- '-Wexpansion-to-defined[Warn if "defined" is used outside #if]'
- '-Wextra[Print extra (possibly unwanted) warnings]'
- '-Wfloat-conversion[Warn for implicit type conversions that cause loss of floating point precision]'
- '-Wfloat-equal[Warn if testing floating point numbers for equality]'
- '-Wformat-contains-nul[Warn about format strings that contain NUL bytes]'
- '-Wformat-extra-args[Warn if passing too many arguments to a function for its format string]'
- '-Wformat-nonliteral[Warn about format strings that are not literals]'
- '-Wformat-overflow[Warn about function calls with format strings that write past the end of the destination region]'
- '-Wformat-security[Warn about possible security problems with format functions]'
- '-Wformat-signedness[Warn about sign differences with format functions]'
- '-Wformat-truncation[Warn about calls to snprintf and similar functions that truncate output. Same as -Wformat- truncation=1. Same as -Wformat-truncation=]'
- '-Wformat-y2k[Warn about strftime formats yielding 2-digit years]'
- '-Wformat-zero-length[Warn about zero-length formats]'
- '-Wformat[Warn about printf/scanf/strftime/strfmon format string anomalies]'
- '-Wframe-address[Warn when __builtin_frame_address or __builtin_return_address is used unsafely]'
- '-Wfree-nonheap-object[Warn when attempting to free a non-heap object]'
- '-Wfunction-elimination[Warn about function call elimination]'
- '-Whsa[Warn when a function cannot be expanded to HSAIL]'
- '-Wignored-attributes[Warn whenever attributes are ignored]'
- '-Wignored-qualifiers[Warn whenever type qualifiers are ignored]'
- '-Wimplicit-function-declaration[Warn about implicit function declarations]'
- '-Wimplicit-int[Warn when a declaration does not specify a type]'
- '-Wimplicit-interface[Warn about calls with implicit interface]'
- '-Wimplicit-procedure[Warn about called procedures not explicitly declared]'
- '-Wimplicit[Warn about implicit declarations]'
- '-Wincompatible-pointer-types[Warn when there is a conversion between pointers that have incompatible types]'
- '-Winherited-variadic-ctor[Warn about C++11 inheriting constructors when the base has a variadic constructor]'
- '-Winit-self[Warn about variables which are initialized to themselves]'
- '-Winline[Warn when an inlined function cannot be inlined]'
- '-Wint-conversion[Warn about incompatible integer to pointer and pointer to integer conversions]'
- '-Wint-in-bool-context[Warn for suspicious integer expressions in boolean context]'
- '-Wint-to-pointer-cast[Warn when there is a cast to a pointer from an integer of a different size]'
- '-Winteger-division[Warn about constant integer divisions with truncated results]'
- '-Wintrinsic-shadow[Warn if a user-procedure has the same name as an intrinsic]'
- '-Wintrinsics-std[Warn on intrinsics not part of the selected standard]'
- '-Winvalid-memory-model[Warn when an atomic memory model parameter is known to be outside the valid range]'
- '-Winvalid-offsetof[Warn about invalid uses of the "offsetof" macro]'
- '-Winvalid-pch[Warn about PCH files that are found but not used]'
- '-Wjump-misses-init[Warn when a jump misses a variable initialization]'
- '-Wline-truncation[Warn about truncated source lines]'
- '-Wliteral-suffix[Warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore]'
- '-Wlogical-not-parentheses[Warn when logical not is used on the left hand side operand of a comparison]'
- '-Wlogical-op[Warn when a logical operator is suspiciously always evaluating to true or false]'
- '-Wlong-long[Do not warn about using "long long" when -pedantic]'
- '-Wlto-type-mismatch[During link time optimization warn about mismatched types of global declarations]'
- '-Wmain[Warn about suspicious declarations of "main"]'
- '-Wmaybe-uninitialized[Warn about maybe uninitialized automatic variables]'
- '-Wmemset-elt-size[Warn about suspicious calls to memset where the third argument contains the number of elements not multiplied by the element size]'
- '-Wmemset-transposed-args[Warn about suspicious calls to memset where the third argument is constant literal zero and the second is not]'
- '-Wmisleading-indentation[Warn when the indentation of the code does not reflect the block structure]'
- '-Wmissing-braces[Warn about possibly missing braces around initializers]'
- '-Wmissing-declarations[Warn about global functions without previous declarations]'
- '-Wmissing-field-initializers[Warn about missing fields in struct initializers]'
- '-Wmissing-include-dirs[Warn about user-specified include directories that do not exist]'
- '-Wmissing-parameter-type[Warn about function parameters declared without a type specifier in K&R-style functions]'
- '-Wmissing-prototypes[Warn about global functions without prototypes]'
- '-Wmudflap[Warn about constructs not instrumented by -fmudflap]'
- '-Wmultichar[Warn about use of multi-character character constants]'
- '-Wmultiple-inheritance[Warn on direct multiple inheritance]'
- '-Wnamespaces[Warn on namespace definition]'
- '-Wnarrowing[Warn about narrowing conversions within { } that are ill-formed in C++11]'
- '-Wnested-externs[Warn about "extern" declarations not at file scope]'
- '-Wnoexcept-type[Warn if C++1z noexcept function type will change the mangled name of a symbol]'
- '-Wnoexcept[Warn when a noexcept expression evaluates to false even though the expression can''t actually throw]'
- '-Wnon-template-friend[Warn when non-templatized friend functions are declared within a template]'
- '-Wnon-virtual-dtor[Warn about non-virtual destructors]'
- '-Wnonnull-compare[Warn if comparing pointer parameter with nonnull attribute with NULL]'
- '-Wnonnull[Warn about NULL being passed to argument slots marked as requiring non-NULL]'
- '-Wnull-dereference[Warn if dereferencing a NULL pointer may lead to erroneous or undefined behavior]'
- '-Wodr[Warn about some C++ One Definition Rule violations during link time optimization]'
- '-Wold-style-cast[Warn if a C-style cast is used in a program]'
- '-Wold-style-declaration[Warn for obsolescent usage in a declaration]'
- '-Wold-style-definition[Warn if an old-style parameter definition is used]'
- '-Wopenmp-simd[Warn if a simd directive is overridden by the vectorizer cost model]'
- '-Woverflow[Warn about overflow in arithmetic expressions]'
- '-Woverlength-strings[Warn if a string is longer than the maximum portable length specified by the standard]'
- '-Woverloaded-virtual[Warn about overloaded virtual function names]'
- '-Woverride-init-side-effects[Warn about overriding initializers with side effects]'
- '-Woverride-init[Warn about overriding initializers without side effects]'
- '-Wpacked-bitfield-compat[Warn about packed bit-fields whose offset changed in GCC 4.4]'
- '-Wpacked[Warn when the packed attribute has no effect on struct layout]'
- '-Wpadded[Warn when padding is required to align structure members]'
- '-Wparentheses[Warn about possibly missing parentheses]'
- '-Wpedantic[Issue warnings needed for strict compliance to the standard]'
- '-Wplacement-new[Warn for placement new expressions with undefined behavior. Same as -Wplacement-new=]'
- '-Wpmf-conversions[Warn when converting the type of pointers to member functions]'
- '-Wpointer-arith[Warn about function pointer arithmetic]'
- '-Wpointer-compare[Warn when a pointer is compared with a zero character constant]'
- '-Wpointer-sign[Warn when a pointer differs in signedness in an assignment]'
- '-Wpointer-to-int-cast[Warn when a pointer is cast to an integer of a different size]'
- '-Wpoison-system-directories[Warn for -I and -L options using system directories if cross compiling]'
- '-Wpragmas[Warn about misuses of pragmas]'
- '-Wproperty-assign-default[Warn if a property for an Objective-C object has no assign semantics specified]'
- '-Wprotocol[Warn if inherited methods are unimplemented]'
- '-Wreal-q-constant[Warn about real-literal-constants with '\'q\'' exponent-letter]'
- '-Wrealloc-lhs-all[Warn when a left-hand-side variable is reallocated]'
- '-Wrealloc-lhs[Warn when a left-hand-side array variable is reallocated]'
- '-Wredundant-decls[Warn about multiple declarations of the same object]'
- '-Wregister[Warn about uses of register storage specifier]'
- '-Wreorder[Warn when the compiler reorders code]'
- '-Wrestrict[Warn when an argument passed to a restrict- qualified parameter aliases with another argument]'
- '-Wreturn-local-addr[Warn about returning a pointer/reference to a local or temporary variable]'
- '-Wreturn-type[Warn whenever a function'\''s return type defaults to "int" (C), or about inconsistent return types (C++)]'
- '-Wscalar-storage-order[Warn on suspicious constructs involving reverse scalar storage order]'
- '-Wselector[Warn if a selector has multiple methods]'
- '-Wsequence-point[Warn about possible violations of sequence point rules]'
- '-Wshadow-ivar[Warn if a local declaration hides an instance variable]'
- '-Wshadow[Warn when one variable shadows another. Same as -Wshadow=global]'
- '-Wshift-count-negative[Warn if shift count is negative]'
- '-Wshift-count-overflow[Warn if shift count >= width of type]'
- '-Wshift-negative-value[Warn if left shifting a negative value]'
- '-Wshift-overflow[Warn if left shift of a signed value overflows. Same as -Wshift-overflow=]'
- '-Wsign-compare[Warn about signed-unsigned comparisons]'
- '-Wsign-conversion[Warn for implicit type conversions between signed and unsigned integers]'
- '-Wsign-promo[Warn when overload promotes from unsigned to signed]'
- '-Wsized-deallocation[Warn about missing sized deallocation functions]'
- '-Wsizeof-array-argument[Warn when sizeof is applied on a parameter declared as an array]'
- '-Wsizeof-pointer-memaccess[Warn about suspicious length parameters to certain string functions if the argument uses sizeof]'
- '-Wstack-protector[Warn when not issuing stack smashing protection for some reason]'
- '-Wstrict-aliasing[Warn about code which might break strict aliasing rules]'
- '-Wstrict-null-sentinel[Warn about uncasted NULL used as sentinel]'
- '-Wstrict-overflow[Warn about optimizations that assume that signed overflow is undefined]'
- '-Wstrict-prototypes[Warn about unprototyped function declarations]'
- '-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]'
+warnings+=(
+ '-Wabi-tag[warn if a subobject has an abi_tag attribute that the complete object type does not have]'
+ '-Wabi[warn about things that will change when compiling with an ABI-compliant compiler]::'
+ '-Waddress[warn about suspicious uses of memory addresses]'
+ '-Waggregate-return[warn about returning structures, unions or arrays]'
+ '-Waggressive-loop-optimizations[warn if a loop with constant number of iterations triggers undefined behavior]'
+ '-Waliasing[warn about possible aliasing of dummy arguments]'
+ '-Walign-commons[warn about alignment of COMMON blocks]'
+ '-Waligned-new=[warn even if '\'new\'' uses a class member allocation function]:none|global|all: '
+ '-Wall[enable most warning messages]'
+ '-Walloca-larger-than=[warn on unbounded uses of alloca, and on bounded uses of alloca whose bound can be larger than <number> bytes]:bytes: '
+ '-Walloca[warn on any use of alloca]'
+ '-Walloc-size-larger-than=[warn for calls to allocation functions that attempt to allocate objects larger than the specified number of bytes]:bytes: '
+ '-Walloc-zero[warn for calls to allocation functions that specify zero bytes]'
+ '-Wampersand[warn about missing ampersand in continued character constants]'
+ '-Wargument-mismatch[warn about type and rank mismatches between arguments and parameters]'
+ '-Warray-bounds[warn if an array is accessed out of bounds]'
+ '-Warray-bounds=[warn if an array is accessed out of bounds]:level:(1 2)'
+ '-Warray-temporaries[warn about creation of array temporaries]'
+ '-Wassign-intercept[warn whenever an Objective-C assignment is being intercepted by the garbage collector]'
+ '-Wattributes[warn about inappropriate attribute usage]'
+ '-Wbad-function-cast[warn about casting functions to incompatible types]'
+ '-Wbool-compare[warn about boolean expression compared with an integer value different from true/false]'
+ '-Wbool-operation[warn about certain operations on boolean expressions]'
+ '-Wbuiltin-declaration-mismatch[warn when a built-in function is declared with the wrong signature]'
+ '-Wbuiltin-macro-redefined[warn when a built-in preprocessor macro is undefined or redefined]'
+ '-Wc++0x-compat[deprecated in favor of -Wc++11-compat]'
+ '-Wc++11-compat[warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011]'
+ '-Wc++14-compat[warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014]'
+ '-Wc++1z-compat[warn about C++ constructs whose meaning differs between ISO C++ 2014 and (forthcoming) ISO C++ 201z(7?)]'
+ '-Wc90-c99-compat[warn about features not present in ISO C90, but present in ISO C99]'
+ '-Wc99-c11-compat[warn about features not present in ISO C99, but present in ISO C11]'
+ '-Wcast-align[warn about pointer casts which increase alignment]'
+ '-Wcast-qual[warn about casts which discard qualifiers]'
+ '-Wc-binding-type[warn if the type of a variable might be not interoperable with C]'
+ '-Wc++-compat[warn about C constructs that are not in the common subset of C and C++]'
+ '-Wcharacter-truncation[warn about truncated character expressions]'
+ '-Wchar-subscripts[warn about subscripts whose type is "char"]'
+ '-Wchkp[warn about memory access errors found by Pointer Bounds Checker]'
+ '-Wclobbered[warn about variables that might be changed by "longjmp" or "vfork"]'
+ '-Wcomments[synonym for -Wcomment]'
+ '-Wcomment[warn about possibly nested block comments, and C++ comments spanning more than one physical line]'
+ '-Wcompare-reals[warn about equality comparisons involving REAL or COMPLEX expressions]'
+ '-Wconditionally-supported[warn for conditionally-supported constructs]'
+ '-Wconversion-extra[warn about most implicit conversions]'
+ '-Wconversion-null[warn for converting NULL from/to a non-pointer type]'
+ '-Wconversion[warn for implicit type conversions that may change a value]'
+ '-Wcoverage-mismatch[warn in case profiles in -fprofile-use do not match]'
+ '-Wcpp[warn when a #warning directive is encountered]'
+ '-Wctor-dtor-privacy[warn when all constructors and destructors are private]'
+ '-Wdangling-else[warn about dangling else]'
+ '-Wdate-time[warn about __TIME__, __DATE__ and __TIMESTAMP__ usage]'
+ '-Wdeclaration-after-statement[warn when a declaration is found after a statement]'
+ '-Wdelete-incomplete[warn when deleting a pointer to incomplete type]'
+ '-Wdelete-non-virtual-dtor[warn about deleting polymorphic objects with non- virtual destructors]'
+ '-Wdeprecated-declarations[warn about uses of __attribute__((deprecated)) declarations]'
+ '-Wdeprecated[warn if a deprecated compiler feature, class, method, or field is used]'
+ '-Wdesignated-init[warn about positional initialization of structs requiring designated initializers]'
+ '-Wdisabled-optimization[warn when an optimization pass is disabled]'
+ '-Wdiscarded-array-qualifiers[warn if qualifiers on arrays which are pointer targets are discarded]'
+ '-Wdiscarded-qualifiers[warn if type qualifiers on pointers are discarded]'
+ '-Wdiv-by-zero[warn about compile-time integer division by zero]'
+ '-Wdouble-promotion[warn about implicit conversions from "float" to "double"]'
+ '-Wduplicated-branches[warn about duplicated branches in if-else statements]'
+ '-Wduplicated-cond[warn about duplicated conditions in an if-else-if chain]'
+ '-Wduplicate-decl-specifier[warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier]'
+ '-Weffc\+\+[warn about violations of Effective C++ style rules]'
+ '-Wempty-body[warn about an empty body in an if or else statement]'
+ '-Wendif-labels[warn about stray tokens after #else and #endif]'
+ '-Wenum-compare[warn about comparison of different enum types]'
+ # '-Werror-implicit-function-declaration[this switch is deprecated; use -Werror=implicit-fun]' # this still exists but makes completing -Werror= less convenient
+ '-Wexpansion-to-defined[warn if "defined" is used outside #if]'
+ '-Wextra[print extra (possibly unwanted) warnings]'
+ '-Wfloat-conversion[warn for implicit type conversions that cause loss of floating point precision]'
+ '-Wfloat-equal[warn if testing floating point numbers for equality]'
+ '-Wformat-contains-nul[warn about format strings that contain NUL bytes]'
+ '-Wformat-extra-args[warn if passing too many arguments to a function for its format string]'
+ '-Wformat-nonliteral[warn about format strings that are not literals]'
+ '-Wformat-overflow[warn about function calls with format strings that write past the end of the destination region]'
+ '-Wformat-overflow=[warn about function calls with format strings that write past the end of the destination region]:level:(1 2)'
+ '-Wformat-security[warn about possible security problems with format functions]'
+ '-Wformat-signedness[warn about sign differences with format functions]'
+ '-Wformat-truncation[warn about calls to snprintf and similar functions that truncate output. Same as -Wformat- truncation=1. Same as -Wformat-truncation=]'
+ '-Wformat-truncation=[warn about calls to snprintf and similar functions that truncate output]:level:(1 2)'
+ '-Wformat=[warn about printf/scanf/strftime/strfmon format string anomalies]::level:(1 2)'
+ '-Wformat-y2k[warn about strftime formats yielding 2-digit years]'
+ '-Wformat-zero-length[warn about zero-length formats]'
+ '-Wframe-address[warn when __builtin_frame_address or __builtin_return_address is used unsafely]'
+ '-Wframe-larger-than=[warn if a function'\''s stack frame requires more than <number> bytes]:bytes: '
+ '-Wfree-nonheap-object[warn when attempting to free a non-heap object]'
+ '-Wfunction-elimination[warn about function call elimination]'
+ '-Whsa[warn when a function cannot be expanded to HSAIL]'
+ '-Wignored-attributes[warn whenever attributes are ignored]'
+ '-Wignored-qualifiers[warn whenever type qualifiers are ignored]'
+ '-Wimplicit-fallthrough=[warn when a switch case falls through]:level:(1 2 3 4 5)'
+ '-Wimplicit-function-declaration[warn about implicit function declarations]'
+ '-Wimplicit-interface[warn about calls with implicit interface]'
+ '-Wimplicit-int[warn when a declaration does not specify a type]'
+ '-Wimplicit-procedure[warn about called procedures not explicitly declared]'
+ '-Wimplicit[warn about implicit declarations]'
+ '-Wimport[warn about imports]'
+ '-Wincompatible-pointer-types[warn when there is a conversion between pointers that have incompatible types]'
+ '-Winherited-variadic-ctor[warn about C++11 inheriting constructors when the base has a variadic constructor]'
+ '-Winit-self[warn about variables which are initialized to themselves]'
+ '-Winline[warn when an inlined function cannot be inlined]'
+ '-Wint-conversion[warn about incompatible integer to pointer and pointer to integer conversions]'
+ '-Winteger-division[warn about constant integer divisions with truncated results]'
+ '-Wint-in-bool-context[warn for suspicious integer expressions in boolean context]'
+ '-Wintrinsic-shadow[warn if a user-procedure has the same name as an intrinsic]'
+ '-Wintrinsics-std[warn on intrinsics not part of the selected standard]'
+ '-Wint-to-pointer-cast[warn when there is a cast to a pointer from an integer of a different size]'
+ '-Winvalid-memory-model[warn when an atomic memory model parameter is known to be outside the valid range]'
+ '-Winvalid-offsetof[warn about invalid uses of the "offsetof" macro]'
+ '-Winvalid-pch[warn about PCH files that are found but not used]'
+ '-Wjump-misses-init[warn when a jump misses a variable initialization]'
+ '-Wlarger-than=[warn if an object is larger than <number> bytes]:bytes: '
+ '-Wline-truncation[warn about truncated source lines]'
+ '-Wliteral-suffix[warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore]'
+ '-Wlogical-not-parentheses[warn when logical not is used on the left hand side operand of a comparison]'
+ '-Wlogical-op[warn when a logical operator is suspiciously always evaluating to true or false]'
+ '-Wlong-long[do not warn about using "long long" when -pedantic]'
+ '-Wlto-type-mismatch[during link time optimization warn about mismatched types of global declarations]'
+ '-Wmain[warn about suspicious declarations of "main"]'
+ '-Wmaybe-uninitialized[warn about maybe uninitialized automatic variables]'
+ '-Wmemset-elt-size[warn about suspicious calls to memset where the third argument contains the number of elements not multiplied by the element size]'
+ '-Wmemset-transposed-args[warn about suspicious calls to memset where the third argument is constant literal zero and the second is not]'
+ '-Wmisleading-indentation[warn when the indentation of the code does not reflect the block structure]'
+ '-Wmissing-braces[warn about possibly missing braces around initializers]'
+ '-Wmissing-declarations[warn about global functions without previous declarations]'
+ '-Wmissing-field-initializers[warn about missing fields in struct initializers]'
+ '-Wmissing-include-dirs[warn about user-specified include directories that do not exist]'
+ '-Wmissing-parameter-type[warn about function parameters declared without a type specifier in K&R-style functions]'
+ '-Wmissing-prototypes[warn about global functions without prototypes]'
+ '-Wmudflap[warn about constructs not instrumented by -fmudflap]'
+ '-Wmultichar[warn about use of multi-character character constants]'
+ '-Wmultiple-inheritance[warn on direct multiple inheritance]'
+ '-Wnamespaces[warn on namespace definition]'
+ '-Wnarrowing[warn about narrowing conversions within { } that are ill-formed in C++11]'
+ '-Wnested-externs[warn about "extern" declarations not at file scope]'
+ '-Wnoexcept-type[warn if C++1z noexcept function type will change the mangled name of a symbol]'
+ '-Wnoexcept[warn when a noexcept expression evaluates to false even though the expression can''t actually throw]'
+ '-Wnonnull-compare[warn if comparing pointer parameter with nonnull attribute with NULL]'
+ '-Wnonnull[warn about NULL being passed to argument slots marked as requiring non-NULL]'
+ '-Wnonportable-cfstrings[warn on CFStrings containing nonportable characters]'
+ '-Wnon-template-friend[warn when non-templatized friend functions are declared within a template]'
+ '-Wnon-virtual-dtor[warn about non-virtual destructors]'
+ '-Wnormalized=-[warn about non-normalised Unicode strings]:normalization:((id\:allow\ some\ non-nfc\ characters\ that\ are\ valid\ identifiers nfc\:only\ allow\ NFC nfkc\:only\ allow\ NFKC none\:allow\ any\ normalization)): '
+ '-Wnull-dereference[warn if dereferencing a NULL pointer may lead to erroneous or undefined behavior]'
+ '-Wodr[warn about some C++ One Definition Rule violations during link time optimization]'
+ '-Wold-style-cast[warn if a C-style cast is used in a program]'
+ '-Wold-style-declaration[warn for obsolescent usage in a declaration]'
+ '-Wold-style-definition[warn if an old-style parameter definition is used]'
+ '-Wopenmp-simd[warn if a simd directive is overridden by the vectorizer cost model]'
+ '-Woverflow[warn about overflow in arithmetic expressions]'
+ '-Woverlength-strings[warn if a string is longer than the maximum portable length specified by the standard]'
+ '-Woverloaded-virtual[warn about overloaded virtual function names]'
+ '-Woverride-init-side-effects[warn about overriding initializers with side effects]'
+ '-Woverride-init[warn about overriding initializers without side effects]'
+ '-Wpacked-bitfield-compat[warn about packed bit-fields whose offset changed in GCC 4.4]'
+ '-Wpacked[warn when the packed attribute has no effect on struct layout]'
+ '-Wpadded[warn when padding is required to align structure members]'
+ '-Wparentheses[warn about possibly missing parentheses]'
+ '-Wpedantic[issue warnings needed for strict compliance to the standard]'
+ '-Wplacement-new=[warn for placement new expressions with undefined behavior]::level:(1 2)'
+ '-Wpmf-conversions[warn when converting the type of pointers to member functions]'
+ '-Wpointer-arith[warn about function pointer arithmetic]'
+ '-Wpointer-compare[warn when a pointer is compared with a zero character constant]'
+ '-Wpointer-sign[warn when a pointer differs in signedness in an assignment]'
+ '-Wpointer-to-int-cast[warn when a pointer is cast to an integer of a different size]'
+ '-Wpoison-system-directories[warn for -I and -L options using system directories if cross compiling]'
+ '-Wpragmas[warn about misuses of pragmas]'
+ '-Wproperty-assign-default[warn if a property for an Objective-C object has no assign semantics specified]'
+ '-Wprotocol[warn if inherited methods are unimplemented]'
+ '-Wpsabi[warn about psabi]'
+ '-Wrealloc-lhs-all[warn when a left-hand-side variable is reallocated]'
+ '-Wrealloc-lhs[warn when a left-hand-side array variable is reallocated]'
+ '-Wreal-q-constant[warn about real-literal-constants with '\'q\'' exponent-letter]'
+ '-Wredundant-decls[warn about multiple declarations of the same object]'
+ '-Wregister[warn about uses of register storage specifier]'
+ '-Wreorder[warn when the compiler reorders code]'
+ '-Wrestrict[warn when an argument passed to a restrict- qualified parameter aliases with another argument]'
+ '-Wreturn-local-addr[warn about returning a pointer/reference to a local or temporary variable]'
+ '-Wreturn-type[warn whenever a function'\''s return type defaults to "int" (C), or about inconsistent return types (C++)]'
+ '-Wscalar-storage-order[warn on suspicious constructs involving reverse scalar storage order]'
+ '-Wselector[warn if a selector has multiple methods]'
+ '-Wsequence-point[warn about possible violations of sequence point rules]'
+ '-Wshadow-ivar[warn if a local declaration hides an instance variable]'
+ '-Wshadow[warn when one variable shadows another. Same as -Wshadow=global]'
+ '-Wshift-count-negative[warn if shift count is negative]'
+ '-Wshift-count-overflow[warn if shift count >= width of type]'
+ '-Wshift-negative-value[warn if left shifting a negative value]'
+ '-Wshift-overflow[warn if left shift of a signed value overflows. Same as -Wshift-overflow=]'
+ '-Wshift-overflow=[warn if left shift of a signed value overflows]:level:(1 2)'
+ '-Wsign-compare[warn about signed-unsigned comparisons]'
+ '-Wsign-conversion[warn for implicit type conversions between signed and unsigned integers]'
+ '-Wsign-promo[warn when overload promotes from unsigned to signed]'
+ '-Wsized-deallocation[warn about missing sized deallocation functions]'
+ '-Wsizeof-array-argument[warn when sizeof is applied on a parameter declared as an array]'
+ '-Wsizeof-pointer-memaccess[warn about suspicious length parameters to certain string functions if the argument uses sizeof]'
+ '-Wstack-protector[warn when not issuing stack smashing protection for some reason]'
+ '-Wstack-usage=[warn if stack usage might be larger than specified amount]:bytes: '
+ '-Wstrict-aliasing[warn about code which might break strict aliasing rules]'
+ '-Wstrict-aliasing=-[warn about code which might break strict aliasing rules]:level of checking (higher is more accurate):(1 2 3)'
+ '-Wstrict-null-sentinel[warn about uncasted NULL used as sentinel]'
+ '-Wstrict-overflow[warn about optimizations that assume that signed overflow is undefined]'
+ '-Wstrict-overflow=-[warn about optimizations that assume that signed overflow is undefined]:level of checking (higher finds more cases):(1 2 3 4 5)'
+ '-Wstrict-prototypes[warn about unprototyped function declarations]'
+ '-Wstrict-selector-match[warn if type signatures of candidate methods do not match exactly]'
+ '-Wstringop-overflow=[under the control of Object Size type, warn about buffer overflow in string manipulation functions like memcpy and strcpy]:level:(1 2 3 4)'
+ '-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 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]'
- '-Wsurprising[Warn about "suspicious" constructs]'
- '-Wswitch-bool[Warn about switches with boolean controlling expression]'
- '-Wswitch-default[Warn about enumerated switches missing a "default-" statement]'
- '-Wswitch-enum[Warn about all enumerated switches missing a specific case]'
- '-Wswitch-unreachable[Warn about statements between switch'\''s controlling expression and the first case]'
- '-Wswitch[Warn about enumerated switches, with no default, missing a case]'
- '-Wsync-nand[Warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used]'
- '-Wsynth[Deprecated. This switch has no effect]'
- '-Wsystem-headers[Do not suppress warnings from system headers]'
- '-Wtabs[Permit nonconforming uses of the tab character]'
- '-Wtarget-lifetime[Warn if the pointer in a pointer assignment might outlive its target]'
- '-Wtautological-compare[Warn if a comparison always evaluates to true or false]'
- '-Wtemplates[Warn on primary template declaration]'
- '-Wterminate[Warn if a throw expression will always result in a call to terminate()]'
- '-Wtraditional-conversion[Warn of prototypes causing type conversions different from what would happen in the absence of prototype]'
- '-Wtraditional[Warn about features not present in traditional C]'
- '-Wtrampolines[Warn whenever a trampoline is generated]'
- '-Wtrigraphs[Warn if trigraphs are encountered that might affect the meaning of the program]'
- '-Wtype-limits[Warn if a comparison is always true or always false due to the limited range of the data type]'
- '-Wundeclared-selector[Warn about @selector()s without previously declared methods]'
- '-Wundef[Warn if an undefined macro is used in an #if directive]'
- '-Wundefined-do-loop[Warn about an invalid DO loop]'
- '-Wunderflow[Warn about underflow of numerical constant expressions]'
- '-Wuninitialized[Warn about uninitialized automatic variables]'
- '-Wunknown-pragmas[Warn about unrecognized pragmas]'
- '-Wunsafe-loop-optimizations[Warn if the loop cannot be optimized due to nontrivial assumptions]'
- '-Wunsuffixed-float-constants[Warn about unsuffixed float constants]'
- '-Wunused-but-set-parameter[Warn when a function parameter is only set, otherwise unused]'
- '-Wunused-but-set-variable[Warn when a variable is only set, otherwise unused]'
- '-Wunused-const-variable[Warn when a const variable is unused. Same as -Wunused-const-variable=]'
- '-Wunused-dummy-argument[Warn about unused dummy arguments]'
- '-Wunused-function[Warn when a function is unused]'
- '-Wunused-label[Warn when a label is unused]'
- '-Wunused-local-typedefs[Warn when typedefs locally defined in a function are not used]'
- '-Wunused-macros[Warn about macros defined in the main file that are not used]'
- '-Wunused-parameter[Warn when a function parameter is unused]'
- '-Wunused-result[Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value]'
- '-Wunused-value[Warn when an expression value is unused]'
- '-Wunused-variable[Warn when a variable is unused]'
- '-Wunused[Enable all -Wunused- warnings]'
- '-Wuse-without-only[Warn about USE statements that have no ONLY qualifier]'
- '-Wuseless-cast[Warn about useless casts]'
- '-Wvarargs[Warn about questionable usage of the macros used to retrieve variable arguments]'
- '-Wvariadic-macros[Warn about using variadic macros]'
- '-Wvector-operation-performance[Warn when a vector operation is compiled outside the SIMD]'
- '-Wvirtual-inheritance[Warn on direct virtual inheritance]'
- '-Wvirtual-move-assign[Warn if a virtual base has a non-trivial move assignment operator]'
- '-Wvla[Warn if a variable length array is used]'
- '-Wvolatile-register-var[Warn when a register variable is declared volatile]'
- '-Wwrite-strings[In C++, nonzero means warn about deprecated conversion from string literals to '\''char *'\''. In C, similar warning, except that the conversion is]'
- '-Wzero-as-null-pointer-constant[Warn when a literal '\''0'\'' is used as null pointer]'
- '-Wzerotrip[Warn about zero-trip DO loops]'
- '-frequire-return-statement[Functions which return values must end with return statements]'
-# --help=warnings,joined
- '-Wabi=[Warn about things that change between the current -fabi-version and the specified version]:: '
- '-Waligned-new=[Warn even if '\'new\'' uses a class member allocation function]:none|global|all: '
- '-Walloc-size-larger-than=[Warn for calls to allocation functions that attempt to allocate objects larger than the specified number of bytes]:bytes: '
- '-Walloca-larger-than=[Warn on unbounded uses of alloca, and on bounded uses of alloca whose bound can be larger than <number> bytes]:bytes: '
- '-Warray-bounds=[Warn if an array is accessed out of bounds]:level:(1 2)'
- '-Wformat-overflow=[Warn about function calls with format strings that write past the end of the destination region]:level:(1 2)'
- '-Wformat-truncation=[Warn about calls to snprintf and similar functions that truncate output]:level:(1 2)'
- '-Wformat=[Warn about printf/scanf/strftime/strfmon format string anomalies]:level:(1 2)'
- '-Wframe-larger-than=[Warn if a function'\''s stack frame requires more than <number> bytes]:bytes: '
- '-Wimplicit-fallthrough=[Warn when a switch case falls through]:level:(1 2 3 4 5)'
- '-Wlarger-than=[Warn if an object is larger than <number> bytes]:bytes: '
- '-Wnormalized=-[Warn about non-normalised Unicode strings]:normalization:((id\:allow\ some\ non-nfc\ characters\ that\ are\ valid\ identifiers nfc\:only\ allow\ NFC nfkc\:only\ allow\ NFKC none\:allow\ any\ normalization)): '
- '-Wplacement-new=[Warn for placement new expressions with undefined behavior]:level:(1 2)'
- '-Wshift-overflow=[Warn if left shift of a signed value overflows]:level:(1 2)'
- '-Wstack-usage=[Warn if stack usage might be larger than specified amount]:bytes: '
- '-Wstrict-aliasing=-[Warn about code which might break strict aliasing rules]:level of checking (higher is more accurate):(1 2 3)'
- '-Wstrict-overflow=-[Warn about optimizations that assume that signed overflow is undefined]:level of checking (higher finds more cases):(1 2 3 4 5)'
- '-Wstringop-overflow=[Under the control of Object Size type, warn about buffer overflow in string manipulation functions like memcpy and strcpy]:level:(1 2 3 4)'
- '-Wunused-const-variable=[Warn when a const variable is unused]:level:(1 2)'
- '-Wvla-larger-than=[Warn on unbounded uses of variable-length arrays, and on bounded uses of variable-length arrays whose bound can be larger than <number> bytes]:bytes: '
-# -W options from --help=common,^warnings
- '-Werror=-[Treat specified warning as error (or all if none specified)]::warning:->werror'
- '-Wfatal-errors[Exit on the first error occurred]'
+ '-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]'
+ '-Wsurprising[warn about "suspicious" constructs]'
+ '-Wswitch-bool[warn about switches with boolean controlling expression]'
+ '-Wswitch-default[warn about enumerated switches missing a "default-" statement]'
+ '-Wswitch-enum[warn about all enumerated switches missing a specific case]'
+ '-Wswitch-unreachable[warn about statements between switch'\''s controlling expression and the first case]'
+ '-Wswitch[warn about enumerated switches, with no default, missing a case]'
+ '-Wsync-nand[warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used]'
+ '-Wsynth[deprecated. This switch has no effect]'
+ '-Wsystem-headers[do not suppress warnings from system headers]'
+ '-Wtabs[permit nonconforming uses of the tab character]'
+ '-Wtarget-lifetime[warn if the pointer in a pointer assignment might outlive its target]'
+ '-Wtautological-compare[warn if a comparison always evaluates to true or false]'
+ '-Wtemplates[warn on primary template declaration]'
+ '-Wterminate[warn if a throw expression will always result in a call to terminate()]'
+ '-W[this switch is deprecated; use -Wextra instead]'
+ '-Wtraditional-conversion[warn of prototypes causing type conversions different from what would happen in the absence of prototype]'
+ '-Wtraditional[warn about features not present in traditional C]'
+ '-Wtrampolines[warn whenever a trampoline is generated]'
+ '-Wtrigraphs[warn if trigraphs are encountered that might affect the meaning of the program]'
+ '-Wtype-limits[warn if a comparison is always true or always false due to the limited range of the data type]'
+ '-Wundeclared-selector[warn about @selector()s without previously declared methods]'
+ '-Wundefined-do-loop[warn about an invalid DO loop]'
+ '-Wundef[warn if an undefined macro is used in an #if directive]'
+ '-Wunderflow[warn about underflow of numerical constant expressions]'
+ '-Wuninitialized[warn about uninitialized automatic variables]'
+ '-Wunknown-pragmas[warn about unrecognized pragmas]'
+ '-Wunsafe-loop-optimizations[warn if the loop cannot be optimized due to nontrivial assumptions]'
+ '-Wunsuffixed-float-constants[warn about unsuffixed float constants]'
+ '-Wunused-but-set-parameter[warn when a function parameter is only set, otherwise unused]'
+ '-Wunused-but-set-variable[warn when a variable is only set, otherwise unused]'
+ '-Wunused-const-variable[warn when a const variable is unused. Same as -Wunused-const-variable=]'
+ '-Wunused-const-variable=[warn when a const variable is unused]:level:(1 2)'
+ '-Wunused-dummy-argument[warn about unused dummy arguments]'
+ '-Wunused[enable all -Wunused- warnings]'
+ '-Wunused-function[warn when a function is unused]'
+ '-Wunused-label[warn when a label is unused]'
+ '-Wunused-local-typedefs[warn when typedefs locally defined in a function are not used]'
+ '-Wunused-macros[warn about macros defined in the main file that are not used]'
+ '-Wunused-parameter[warn when a function parameter is unused]'
+ '-Wunused-result[warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value]'
+ '-Wunused-value[warn when an expression value is unused]'
+ '-Wunused-variable[warn when a variable is unused]'
+ '-Wuseless-cast[warn about useless casts]'
+ '-Wuse-without-only[warn about USE statements that have no ONLY qualifier]'
+ '-Wvarargs[warn about questionable usage of the macros used to retrieve variable arguments]'
+ '-Wvariadic-macros[warn about using variadic macros]'
+ '-Wvector-operation-performance[warn when a vector operation is compiled outside the SIMD]'
+ '-Wvirtual-inheritance[warn on direct virtual inheritance]'
+ '-Wvirtual-move-assign[warn if a virtual base has a non-trivial move assignment operator]'
+ '-Wvla-larger-than=[warn on unbounded uses of variable-length arrays, and on bounded uses of variable-length arrays whose bound can be larger than <number> bytes]:bytes: '
+ '-Wvla[warn if a variable length array is used]'
+ '-Wvolatile-register-var[warn when a register variable is declared volatile]'
+ '-Wwrite-strings[in C++, nonzero means warn about deprecated conversion from string literals to '\''char *'\''. In C, similar warning, except that the conversion is]'
+ '-Wzero-as-null-pointer-constant[warn when a literal '\''0'\'' is used as null pointer]'
+ '-Wzerotrip[warn about zero-trip DO loops]'
)
+
# clang specific warnings
if [[ "$service" = clang* ]]; then
- args+=(
- '-Wunreachable-code[Warn on code that will not be executed]'
- '-Wunreachable-code-aggressive[Controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return]'
- '-Wunreachable-code-break[Warn when break will never be executed]'
- '-Wunreachable-code-loop-increment[Warn when loop will be executed only once]'
- '-Wunreachable-code-return[Warn when return will not be executed]'
+ warnings+=(
+ '-Wlarge-by-value-copy=[warn on large by value copy]:argument'
+ '-Wunreachable-code-aggressive[controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return]'
+ '-Wunreachable-code-break[warn when break will never be executed]'
+ '-Wunreachable-code-loop-increment[warn when loop will be executed only once]'
+ '-Wunreachable-code-return[warn when return will not be executed]'
+ '-Wunreachable-code[warn on code that will not be executed]'
)
else
- args+=(
- '-Wunreachable-code[Does nothing. Preserved for backward compatibility]'
+ warnings+=(
+ '-Wunreachable-code[does nothing. Preserved for backward compatibility]'
)
fi
-# optimizers (from --help=optimizers), except for -O
-args+=(
-# --help=optimizers,^joined
- '-faggressive-loop-optimizations[Aggressively optimize loops using language constraints]'
- '-falign-functions[Align the start of functions]'
- '-falign-jumps[Align labels which are only reached by jumping]'
- '-falign-labels[Align all labels]'
- '-falign-loops[Align the start of loops]'
- '-fassociative-math[Allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]'
- '-fasynchronous-unwind-tables[Generate unwind tables that are exact at each instruction boundary]'
- '-fauto-inc-dec[Generate auto-inc/dec instructions]'
- '-fbranch-count-reg[Replace add, compare, branch with branch on count register]'
- '-fbranch-probabilities[Use profiling information for branch probabilities]'
- '-fbranch-target-load-optimize2[Perform branch target load optimization after prologue / epilogue threading]'
- '-fbranch-target-load-optimize[Perform branch target load optimization before prologue / epilogue threading]'
- '-fbtr-bb-exclusive[Restrict target load migration not to re-use registers in any basic block]'
- '-fcaller-saves[Save registers around function calls]'
- '-fcode-hoisting[Enable code hoisting]'
- '-fcombine-stack-adjustments[Looks for opportunities to reduce stack adjustments and stack references]'
- '-fcommon[Do not put uninitialized globals in the common section]'
- '-fcompare-elim[Perform comparison elimination after register allocation has finished]'
- '-fconserve-stack[Do not perform optimizations increasing noticeably stack usage]'
- '-fcprop-registers[Perform a register copy-propagation optimization pass]'
- '-fcrossjumping[Perform cross-jumping optimization]'
- '-fcse-follow-jumps[When running CSE, follow jumps to their targets]'
- '-fcx-fortran-rules[Complex multiplication and division follow Fortran rules]'
- '-fcx-limited-range[Omit range reduction step when performing complex division]'
- '-fdata-sections[Place data items into their own section]'
- '-fdce[Use the RTL dead code elimination pass]'
- '-fdefer-pop[Defer popping functions args from stack until later]'
- '-fdelayed-branch[Attempt to fill delay slots of branch instructions]'
- '-fdelete-dead-exceptions[Delete dead instructions that may throw exceptions]'
- '-fdelete-null-pointer-checks[Delete useless null pointer checks]'
- '-fdevirtualize-speculatively[Perform speculative devirtualization]'
- '-fdevirtualize[Try to convert virtual calls to direct ones]'
- '-fdse[Use the RTL dead store elimination pass]'
- '-fearly-inlining[Perform early inlining]'
- '-fexceptions[Enable exception handling]'
- '-fexpensive-optimizations[Perform a number of minor, expensive optimizations]'
- '-ffinite-math-only[Assume no NaNs or infinities are generated]'
- '-ffloat-store[Don'\''t allocate floats and doubles in extended- precision registers]'
- '-fforward-propagate[Perform a forward propagation pass on RTL]'
- '-ffp-int-builtin-inexact[Allow built-in functions ceil, floor, round, trunc to raise "inexact" exceptions]'
- '-ffunction-cse[Allow function addresses to be held in registers]'
- '-fgcse-after-reload[Perform global common subexpression elimination after register allocation has finished]'
- '-fgcse-las[Perform redundant load after store elimination in global common subexpression elimination]'
- '-fgcse-lm[Perform enhanced load motion during global common subexpression elimination]'
- '-fgcse-sm[Perform store motion after global common subexpression elimination]'
- '-fgcse[Perform global common subexpression elimination]'
- '-fgraphite-identity[Enable Graphite Identity transformation]'
- '-fgraphite[Enable in and out of Graphite representation]'
- '-fguess-branch-probability[Enable guessing of branch probabilities]'
- '-fhoist-adjacent-loads[Enable hoisting adjacent loads to encourage generating conditional move instructions]'
- '-fif-conversion2[Perform conversion of conditional jumps to conditional execution]'
- '-fif-conversion[Perform conversion of conditional jumps to branchless equivalents]'
- '-findirect-inlining[Perform indirect inlining]'
- '-finline-atomics[Inline __atomic operations when a lock free instruction sequence is available]'
- '-finline-functions-called-once[Integrate functions only required by their single caller]'
- '-finline-functions[Integrate functions not declared "inline" into their callers when profitable]'
- '-finline-small-functions[Integrate functions into their callers when code size is known not to grow]'
- '-finline[Enable inlining of function declared "inline", disabling disables all inlining]'
- '-fipa-bit-cp[Perform interprocedural bitwise constant propagation]'
- '-fipa-cp-clone[Perform cloning to make Interprocedural constant propagation stronger]'
- '-fipa-cp[Perform interprocedural constant propagation]'
- '-fipa-icf-functions[Perform Identical Code Folding for functions]'
- '-fipa-icf-variables[Perform Identical Code Folding for variables]'
- '-fipa-icf[Perform Identical Code Folding for functions and read-only variables]'
- '-fipa-profile[Perform interprocedural profile propagation]'
- '-fipa-pta[Perform interprocedural points-to analysis]'
- '-fipa-pure-const[Discover pure and const functions]'
- '-fipa-ra[Use caller save register across calls if possible]'
- '-fipa-reference[Discover readonly and non addressable static variables]'
- '-fipa-sra[Perform interprocedural reduction of aggregates]'
- '-fipa-vrp[Perform IPA Value Range Propagation]'
- '-fira-hoist-pressure[Use IRA based register pressure calculation in RTL hoist optimizations]'
- '-fira-loop-pressure[Use IRA based register pressure calculation in RTL loop optimizations]'
- '-fira-share-save-slots[Share slots for saving different hard registers]'
- '-fira-share-spill-slots[Share stack slots for spilled pseudo-registers]'
- '-fisolate-erroneous-paths-attribute[Detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a returns_nonnull or]'
- '-fisolate-erroneous-paths-dereference[Detect paths that trigger erroneous or undefined behavior due to dereferencing a null pointer. Isolate those paths from the main]'
- '-fivopts[Optimize induction variables on trees]'
- '-fjump-tables[Use jump tables for sufficiently large switch statements]'
- '-flifetime-dse[Tell DSE that the storage for a C++ object is dead when the constructor starts and when the destructor finishes]'
- '-flive-range-shrinkage[Relief of register pressure through live range shrinkage]'
- '-floop-nest-optimize[Enable the loop nest optimizer]'
- '-floop-parallelize-all[Mark all loops as parallel]'
- '-flra-remat[Do CFG-sensitive rematerialization in LRA]'
- '-fmath-errno[Set errno after built-in math functions]'
- '-fmerge-all-constants[Attempt to merge identical constants and constant variables]'
- '-fmerge-constants[Attempt to merge identical constants across compilation units]'
- '-fmodulo-sched-allow-regmoves[Perform SMS based modulo scheduling with register moves allowed]'
- '-fmodulo-sched[Perform SMS based modulo scheduling before the first scheduling pass]'
- '-fmove-loop-invariants[Move loop invariant computations out of loops]'
- '-fno-threadsafe-statics[Do not generate thread-safe code for initializing local statics]'
- '-fnon-call-exceptions[Support synchronous non-call exceptions]'
- '-fnothrow-opt[Treat a throw() exception specification as noexcept to improve code size]'
- '-fomit-frame-pointer[When possible do not generate stack frames]'
- '-fopt-info[Enable all optimization info dumps on stderr]'
- '-foptimize-sibling-calls[Optimize sibling and tail recursive calls]'
- '-foptimize-strlen[Enable string length optimizations on trees]'
- '-fpack-struct[Pack structure members together without holes]'
- '-fpartial-inlining[Perform partial inlining]'
- '-fpeel-loops[Perform loop peeling]'
- '-fpeephole2[Enable an RTL peephole pass before sched2]'
- '-fpeephole[Enable machine specific peephole optimizations]'
- '-fplt[Use PLT for PIC calls (-fno-plt- load the address from GOT at call site)]'
- '-fpredictive-commoning[Run predictive commoning optimization]'
- '-fprefetch-loop-arrays[Generate prefetch instructions, if available, for arrays in loops]'
- '-fprintf-return-value[Treat known sprintf return values as constants]'
- '-freciprocal-math[Same as -fassociative-math for expressions which include division]'
- '-freg-struct-return[Return small aggregates in registers]'
- '-frename-registers[Perform a register renaming optimization pass]'
- '-freorder-blocks-and-partition[Reorder basic blocks and partition into hot and cold sections]'
- '-freorder-blocks[Reorder basic blocks to improve code placement]'
- '-freorder-functions[Reorder functions to improve code placement]'
- '-frerun-cse-after-loop[Add a common subexpression elimination pass after loop optimizations]'
- '-freschedule-modulo-scheduled-loops[Enable/Disable the traditional scheduling in loops that already passed modulo scheduling]'
- '-frounding-math[Disable optimizations that assume default FP rounding behavior]'
- '-frtti[Generate run time type descriptor information]'
- '-fsched-critical-path-heuristic[Enable the critical path heuristic in the scheduler]'
- '-fsched-dep-count-heuristic[Enable the dependent count heuristic in the scheduler]'
- '-fsched-group-heuristic[Enable the group heuristic in the scheduler]'
- '-fsched-interblock[Enable scheduling across basic blocks]'
- '-fsched-last-insn-heuristic[Enable the last instruction heuristic in the scheduler]'
- '-fsched-pressure[Enable register pressure sensitive insn scheduling]'
- '-fsched-rank-heuristic[Enable the rank heuristic in the scheduler]'
- '-fsched-spec-insn-heuristic[Enable the speculative instruction heuristic in the scheduler]'
- '-fsched-spec-load-dangerous[Allow speculative motion of more loads]'
- '-fsched-spec-load[Allow speculative motion of some loads]'
- '-fsched-spec[Allow speculative motion of non-loads]'
- '-fsched-stalled-insns-dep[Set dependence distance checking in premature scheduling of queued insns]'
- '-fsched-stalled-insns[Allow premature scheduling of queued insns]'
- '-fsched2-use-superblocks[If scheduling post reload, do superblock scheduling]'
- '-fschedule-fusion[Perform a target dependent instruction fusion optimization pass]'
- '-fschedule-insns2[Reschedule instructions after register allocation]'
- '-fschedule-insns[Reschedule instructions before register allocation]'
- '-fsection-anchors[Access data in the same section from shared anchor points]'
- '-fsel-sched-pipelining-outer-loops[Perform software pipelining of outer loops during selective scheduling]'
- '-fsel-sched-pipelining[Perform software pipelining of inner loops during selective scheduling]'
- '-fsel-sched-reschedule-pipelined[Reschedule pipelined regions without pipelining]'
- '-fselective-scheduling2[Run selective scheduling after reload]'
- '-fselective-scheduling[Schedule instructions using selective scheduling algorithm]'
- '-fshort-enums[Use the narrowest integer type possible for enumeration types]'
- '-fshort-wchar[Force the underlying type for "wchar_t" to be "unsigned short"]'
- '-fshrink-wrap-separate[Shrink-wrap parts of the prologue and epilogue separately]'
- '-fshrink-wrap[Emit function prologues only before parts of the function that need it, rather than at the top of the function]'
- '-fsignaling-nans[Disable optimizations observable by IEEE signaling NaNs]'
- '-fsigned-zeros[Disable floating point optimizations that ignore the IEEE signedness of zero]'
- '-fsingle-precision-constant[Convert floating point constants to single precision constants]'
- '-fsplit-ivs-in-unroller[Split lifetimes of induction variables when loops are unrolled]'
- '-fsplit-loops[Perform loop splitting]'
- '-fsplit-paths[Split paths leading to loop backedges]'
- '-fsplit-wide-types[Split wide types into independent registers]'
- '-fssa-backprop[Enable backward propagation of use properties at the SSA level]'
- '-fssa-phiopt[Optimize conditional patterns using SSA PHI nodes]'
- '-fstack-protector-all[Use a stack protection method for every function]'
- '-fstack-protector-explicit[Use stack protection method only for functions with the stack_protect attribute]'
- '-fstack-protector-strong[Use a smart stack protection method for certain functions]'
- '-fstack-protector[Use propolice as a stack protection method]'
- '-fstdarg-opt[Optimize amount of stdarg registers saved to stack at start of function]'
- '-fstore-merging[Merge adjacent stores]'
- '-fstrict-aliasing[Assume strict aliasing rules apply]'
- '-fstrict-enums[Assume that values of enumeration type are always within the minimum range of that type]'
- '-fstrict-overflow[Treat signed overflow as undefined]'
- '-fstrict-volatile-bitfields[Force bitfield accesses to match their type width]'
- '-fthread-jumps[Perform jump threading optimizations]'
- '-ftracer[Perform superblock formation via tail duplication]'
- '-ftrapping-math[Assume floating-point operations can trap]'
- '-ftrapv[Trap for signed overflow in addition, subtraction and multiplication]'
- '-ftree-bit-ccp[Enable SSA-BIT-CCP optimization on trees]'
- '-ftree-builtin-call-dce[Enable conditional dead code elimination for builtin calls]'
- '-ftree-ccp[Enable SSA-CCP optimization on trees]'
- '-ftree-ch[Enable loop header copying on trees]'
- '-ftree-coalesce-vars[Enable SSA coalescing of user variables]'
- '-ftree-copy-prop[Enable copy propagation on trees]'
- '-ftree-cselim[Transform condition stores into unconditional ones]'
- '-ftree-dce[Enable SSA dead code elimination optimization on trees]'
- '-ftree-dominator-opts[Enable dominator optimizations]'
- '-ftree-dse[Enable dead store elimination]'
- '-ftree-forwprop[Enable forward propagation on trees]'
- '-ftree-fre[Enable Full Redundancy Elimination (FRE) on trees]'
- '-ftree-loop-distribute-patterns[Enable loop distribution for patterns transformed into a library call]'
- '-ftree-loop-distribution[Enable loop distribution on trees]'
- '-ftree-loop-if-convert[Convert conditional jumps in innermost loops to branchless equivalents]'
- '-ftree-loop-im[Enable loop invariant motion on trees]'
- '-ftree-loop-ivcanon[Create canonical induction variables in loops]'
- '-ftree-loop-optimize[Enable loop optimizations on tree level]'
- '-ftree-loop-vectorize[Enable loop vectorization on trees]'
- '-ftree-lrs[Perform live range splitting during the SSA- >normal pass]'
- '-ftree-partial-pre[In SSA-PRE optimization on trees, enable partial- partial redundancy elimination]'
- '-ftree-phiprop[Enable hoisting loads from conditional pointers]'
- '-ftree-pre[Enable SSA-PRE optimization on trees]'
- '-ftree-pta[Perform function-local points-to analysis on trees]'
- '-ftree-reassoc[Enable reassociation on tree level]'
- '-ftree-scev-cprop[Enable copy propagation of scalar-evolution information]'
- '-ftree-sink[Enable SSA code sinking on trees]'
- '-ftree-slp-vectorize[Enable basic block vectorization (SLP) on trees]'
- '-ftree-slsr[Perform straight-line strength reduction]'
- '-ftree-sra[Perform scalar replacement of aggregates]'
- '-ftree-switch-conversion[Perform conversions of switch initializations]'
- '-ftree-tail-merge[Enable tail merging on trees]'
- '-ftree-ter[Replace temporary expressions in the SSA->normal pass]'
- '-ftree-vectorize[Enable vectorization on trees]'
- '-ftree-vrp[Perform Value Range Propagation on trees]'
- '-funconstrained-commons[Assume common declarations may be overridden with ones with a larger trailing array]'
- '-funroll-all-loops[Perform loop unrolling for all loops]'
- '-funroll-loops[Perform loop unrolling when iteration count is known]'
- '-funsafe-loop-optimizations[Allow loop optimizations to assume that the loops behave in normal way]'
- '-funsafe-math-optimizations[Allow math optimizations that may violate IEEE or ISO standards]'
- '-funswitch-loops[Perform loop unswitching]'
- '-funwind-tables[Just generate unwind tables for exception handling]'
- '-fvar-tracking-assignments-toggle[Toggle -fvar-tracking-assignments]'
- '-fvar-tracking-assignments[Perform variable tracking by annotating assignments]'
- '-fvar-tracking-uninit[Perform variable tracking and also tag variables that are uninitialized]'
- '-fvar-tracking[Perform variable tracking]'
- '-fvariable-expansion-in-unroller[Apply variable expansion when loops are unrolled]'
- '-fvpt[Use expression value profiles in optimizations]'
- '-fweb[Construct webs and split unrelated uses of single variable]'
- '-fwhole-program[Perform whole program optimizations]'
- '-fwrapv[Assume signed arithmetic overflow wraps around]'
-# --help=optimizers,joined
- '-ffp-contract=[Perform floating-point expression contraction]:style:(off on fast)'
- '-fira-algorithm=[Set the used IRA algorithm]:algorithm:(cb priority)'
- '-fira-region=[Set regions for IRA]:region:(one all mixed)'
- '-fpack-struct=[Set initial maximum structure member alignment]:alignment (power of 2): '
- '-freorder-blocks-algorithm=[Set the used basic block reordering algorithm]:algorithm:(simple stc)'
- '-fsched-stalled-insns-dep=[Set dependence distance checking in premature scheduling of queued insns]:insns:'
- '-fsched-stalled-insns=[Set number of queued insns that can be prematurely scheduled]:insns:'
- '-fsimd-cost-model=[Specifies the vectorization cost model for code marked with a simd directive]:model:(unlimited dynamic cheap)'
- '-fstack-reuse=[Set stack reuse level for local variables]:level:(all named_vars none)'
- '-ftree-parallelize-loops=[Enable automatic parallelization of loops]'
- '-fvect-cost-model=[Specifies the cost model for vectorization]:model:(unlimited dynamic cheap)'
-
-)
-# More linker options, from gcc man pages
args+=(
- '-nostartfiles[Do not use the standard system startup files when linking]'
- '-nodefaultlibs[Do not use the standard system libraries when linking]'
- '-nostdlib[Do not use standard system startup files or libraries when linking]'
- '-rdynamic[Pass the flag -export-dynamic to the ELF linker, on targets that support it]'
- '-s[Remove all symbol table and relocation information from the executable]'
- '-static[On systems that support dynamic linking, this prevents linking with the shared libraries]'
- '-shared-libgcc[Force shared libgcc]'
- '-static-libgcc[Force static libgcc]'
- '-symbolic[Bind references to global symbols when building a shared object]'
- '-T:linker script:_files'
+ {'*-A-','*--assert='}'[make an assertion]:define assertion:'
+ '--all-warnings[display all warnings]'
+ {-ansi,--ansi}'[same as -std=c89 or -std=c++98]'
+ '-aux-info[emit declaration information into <file>]:file:_files'
+ {'-B-','--prefix='}'[add <prefix> to the compiler'\''s search paths]:executable prefix:_files -/'
+ '-b[specify target machine to compile to]:target machine:'
+ {-CC,--comments-in-macros}'[do not discard comments, including macro expansion]'
+ {-C,--comments}'[do not discard comments during preprocess]'
+ {-c,--compile}'[compile and assemble, but do not link]'
+ {'*-D-','*--define-macro='}'[define a macro]:define macro:'
+ '-d-[dump the state of the preprocessor]:dump:->dump'
+ '--dependencies[generate Makefile dependencies]'
+ '-dumpbase[set the file basename to be used for dumps]:file:_files'
+ '-dumpdir[set the directory name to be used for dumps]:file:_files -/'
+ '-dumpmachine[display the compiler'\''s target processor]'
+ '-dumpspecs[display all of the built in spec strings]'
+ '-dumpversion[display the version of the compiler]'
+ '+e-[control how virtual function definitions are used]:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))'
+ {-e,--entry}'[specify program entry point is entry]:entry'
+ {-E,--preprocess}'[preprocess only; do not compile, assemble or link]'
+ '-fabi-version=-[use specified C++ ABI version]:ABI version [0]:(0 1 2 3 4 5 6 7 8 9 10 11 12 13)'
+ '-fada-spec-parent=[dump Ada specs as child units of given parent]'
+ '-faggressive-loop-optimizations[aggressively optimize loops using language constraints]'
+ '-falign-functions[align the start of functions]'
+ '-falign-jumps[align labels which are only reached by jumping]'
+ '-falign-labels[align all labels]'
+ '-falign-loops[align the start of loops]'
+ '-fallow-parameterless-variadic-functions[allow variadic functions without named parameter]'
+ '-fasm[recognize the asm keyword]'
+ '-fassociative-math[allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]'
+ '-fasynchronous-unwind-tables[generate unwind tables that are exact at each instruction boundary]'
+ '-fauto-inc-dec[generate auto-inc/dec instructions]'
+ '-fbounds-check[generate code to check bounds before indexing arrays]'
+ '-fbranch-count-reg[replace add, compare, branch with branch on count register]'
+ '-fbranch-probabilities[use profiling information for branch probabilities]'
+ '-fbranch-target-load-optimize2[perform branch target load optimization after prologue / epilogue threading]'
+ '-fbranch-target-load-optimize[perform branch target load optimization before prologue / epilogue threading]'
+ '-fbtr-bb-exclusive[restrict target load migration not to re-use registers in any basic block]'
+ '-fbuilding-libgcc[specify building libgcc]'
+ '-fbuiltin[recognize builtin functions]'
+ '-fcaller-saves[save registers around function calls]'
+ '-fcall-saved--[mark <register> as being preserved across functions]:register'
+ '-fcall-used--[mark <register> as being corrupted by function calls]:register'
+ '-fcanonical-system-headers[where shorter use canonicalized paths to system headers]'
+ '-fcheck-data-deps[compare the results of several data dependence analyzers]'
+ '-fcheck-pointer-bounds[add pointer bounds checker instrumentation]'
+ '-fchkp-check-incomplete-type[generate pointer bounds check for variables with incomplete type]'
+ '-fchkp-check-read[generate checks for all read accesses to memory]'
+ '-fchkp-check-write[generate checks for all write accesses to memory]'
+ '-fchkp-first-field-has-own-bounds[forces checker to use narrowed bounds for address of the first field]'
+ '-fchkp-instrument-calls[generate bounds passing for calls]'
+ '-fchkp-instrument-marked-only[instrument only functions marked with bnd_instrument attribute]'
+ '-fchkp-narrow-bounds[control how checker handle pointers to object fields]'
+ '-fchkp-narrow-to-innermost-array[forces checker to use bounds of the innermost arrays in case of nested static array access]'
+ '-fchkp-optimize[allow checker optimizations]'
+ '-fchkp-store-bounds[generate bounds stores for pointer writes]'
+ '-fchkp-treat-zero-dynamic-size-as-infinite[with this option zero size obtained dynamically for objects with incomplete type will be treated as infinite]'
+ '-fchkp-use-fast-string-functions[allow to use *_nobnd versions of string functions]'
+ '-fchkp-use-nochk-string-functions[allow to use *_nochk versions of string functions]'
+ '-fchkp-use-static-bounds[use statically initialized variable for vars bounds instead of generating them each time it is required]'
+ '-fchkp-use-static-const-bounds[use statically initialized variable for constant bounds]'
+ '-fchkp-use-wrappers[transform instrumented builtin calls into calls to wrappers]'
+ '-fchkp-zero-input-bounds-for-main[use zero bounds for all incoming arguments in main function]'
+ '-fcilkplus[enable Cilk Plus]'
+ '-fcode-hoisting[enable code hoisting]'
+ '-fcombine-stack-adjustments[looks for opportunities to reduce stack adjustments and stack references]'
+ '-fcommon[do not put uninitialized globals in the common section]'
+ '-fcompare-debug=-[compile with and without e.g. -gtoggle, and compare the final-insns dump]:opts:' # TODO: complete gcc options here
+ '-fcompare-debug-second[run only the second compilation of -fcompare-debug]'
+ '-fcompare-elim[perform comparison elimination after register allocation has finished]'
+ '-fcond-mismatch[allow the arguments of the ? operator to have different types]'
+ '-fconserve-stack[do not perform optimizations increasing noticeably stack usage]'
+ '-fcprop-registers[perform a register copy-propagation optimization pass]'
+ '-fcrossjumping[perform cross-jumping optimization]'
+ '-fcse-follow-jumps[when running CSE, follow jumps to their targets]'
+ '-fcx-fortran-rules[complex multiplication and division follow Fortran rules]'
+ '-fcx-limited-range[omit range reduction step when performing complex division]'
+ '-fdata-sections[place data items into their own section]'
+ '-fdbg-cnt=-[,<counter>-<limit>,...) Set the debug counter limit]:counter\:limit,...: ' # TODO: gcc -fdbg-cnt-list -x c /dev/null -o /dev/null -c
+ '-fdbg-cnt-list[list all available debugging counters with their limits and counts]'
+ '-fdce[use the RTL dead code elimination pass]'
+ '-fdebug-cpp[emit debug annotations during preprocessing]'
+ '-fdebug-prefix-map=-[map one directory name to another in debug information]:/old/dir=/new/dir:->dirtodir'
+ '-fdebug-types-section[output .debug_types section when using DWARF v4 debuginfo]'
+ '-fdefer-pop[defer popping functions args from stack until later]'
+ '-fdelayed-branch[attempt to fill delay slots of branch instructions]'
+ '-fdelete-dead-exceptions[delete dead instructions that may throw exceptions]'
+ '-fdelete-null-pointer-checks[delete useless null pointer checks]'
+ '-fdevirtualize-speculatively[perform speculative devirtualization]'
+ '-fdevirtualize[try to convert virtual calls to direct ones]'
+ '-fdiagnostics-color=-[colorize diagnostics]::color:(never always auto)'
+ '-fdiagnostics-generate-patch[print fix-it hints to stderr in unified diff format]'
+ '-fdiagnostics-parseable-fixits[print fixit hints in machine-readable form]'
+ '-fdiagnostics-show-caret[show the source line with a caret indicating the column]'
+ '-fdiagnostics-show-location=-[how often to emit source location at the beginning of line-wrapped diagnostics]:source location:(once every-line)'
+ '-fdiagnostics-show-option[amend appropriate diagnostic messages with the command line option that controls them]'
+ '-fdirectives-only[preprocess directives only]'
+ '-fdollars-in-identifiers[permit $ as an identifier character]'
+ '-fdse[use the RTL dead store elimination pass]'
+ '-fdump-ada-spec-slim[write all declarations as Ada code for the given file only]'
+ '-fdump-ada-spec[write all declarations as Ada code transitively]'
+ '-fdump-final-insns=-[dump to filename the insns at the end of translation]:filename:_files'
+ '-fdump-go-spec=-[write all declarations to file as Go code]:filename:_files'
+ '-fdump-noaddr[suppress output of addresses in debugging dumps]'
+ '-fdump-passes[dump optimization passes]'
+ '-fdump-unnumbered-links[suppress output of previous and next insn numbers in debugging dumps]'
+ '-fdump-unnumbered[suppress output of instruction numbers, line number notes and addresses in debugging dumps]'
+ '-fdwarf2-cfi-asm[enable CFI tables via GAS assembler directives]'
+ '-fearly-inlining[perform early inlining]'
+ '-feliminate-dwarf2-dups[perform DWARF2 duplicate elimination]'
+ '-feliminate-unused-debug-symbols[perform unused type elimination in debug info]'
+ '-feliminate-unused-debug-types[perform unused type elimination in debug info]'
+ '-femit-class-debug-always[do not suppress C++ class debug information]'
+ '-femit-struct-debug-baseonly[aggressive reduced debug info for structs]'
+ '-femit-struct-debug-detailed=-[detailed reduced debug info for structs]:spec list [all]'
+ '-femit-struct-debug-reduced[conservative reduced debug info for structs]'
+ '-fexceptions[enable exception handling]'
+ '-fexcess-precision=-[specify handling of excess floating-point precision]:precision handling:(fast standard)'
+ '-fexec-charset=-[convert all strings and character constants to character set]:character set [UTF-8]'
+ '-fexpensive-optimizations[perform a number of minor, expensive optimizations]'
+ '-fextended-identifiers[permit universal character names in identifiers]'
+ '-ffast-math[sets -fno-math-errno, -funsafe-math-optimizations, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans and -fcx-limited-range]'
+ '-ffat-lto-objects[output lto objects containing both the intermediate language and binary output]'
+ '-ffinite-math-only[assume no NaNs or infinities are generated]'
+ '-ffixed--[mark <register> as being unavailable to the compiler]:register'
+ '-ffloat-store[don'\''t allocate floats and doubles in extended- precision registers]'
+ '-fforward-propagate[perform a forward propagation pass on RTL]'
+ '-ffp-contract=-[perform floating-point expression contraction]:style [fast]:(on off fast)'
+ '-ffp-int-builtin-inexact[allow built-in functions ceil, floor, round, trunc to raise "inexact" exceptions]'
+ '-ffreestanding[do not assume that standard C libraries and main exist]'
+ '-ffunction-cse[allow function addresses to be held in registers]'
+ '-ffunction-sections[place each function into its own section]'
+ '-fgcse-after-reload[perform global common subexpression elimination after register allocation has finished]'
+ '-fgcse-las[perform redundant load after store elimination in global common subexpression elimination]'
+ '-fgcse-lm[perform enhanced load motion during global common subexpression elimination]'
+ '-fgcse[perform global common subexpression elimination]'
+ '-fgcse-sm[perform store motion after global common subexpression elimination]'
+ '-fgnu89-inline[use traditional GNU semantics for inline functions]'
+ '-fgnu-tm[enable support for GNU transactional memory]'
+ '-fgraphite[enable in and out of Graphite representation]'
+ '-fgraphite-identity[enable Graphite Identity transformation]'
+ '-fguess-branch-probability[enable guessing of branch probabilities]'
+ '-fhoist-adjacent-loads[enable hoisting adjacent loads to encourage generating conditional move instructions]'
+ '-fhosted[assume normal C execution environment]'
+ '-fif-conversion2[perform conversion of conditional jumps to conditional execution]'
+ '-fif-conversion[perform conversion of conditional jumps to branchless equivalents]'
+ '-findirect-inlining[perform indirect inlining]'
+ '-finhibit-size-directive[do not generate .size directives]'
+ '-finline-atomics[inline __atomic operations when a lock free instruction sequence is available]'
+ '-finline[enable inlining of function declared "inline", disabling disables all inlining]'
+ '-finline-functions-called-once[integrate functions only required by their single caller]'
+ '-finline-functions[integrate functions not declared "inline" into their callers when profitable]'
+ '-finline-limit=-[limit the size of inlined functions to <number>]:number: '
+ '-finline-small-functions[integrate functions into their callers when code size is known not to grow]'
+ '-finput-charset=[specify the default character set for source files]:character set'
+ '-finstrument-functions-exclude-file-list=-[do not instrument functions listed in files]:comma-separated file list:->commafiles'
+ '-finstrument-functions-exclude-function-list=-[do not instrument listed functions]:comma-separated list of syms: '
+ '-finstrument-functions[instrument function entry and exit with profiling calls]'
+ '-fipa-bit-cp[perform interprocedural bitwise constant propagation]'
+ '-fipa-cp-clone[perform cloning to make Interprocedural constant propagation stronger]'
+ '-fipa-cp[perform interprocedural constant propagation]'
+ '-fipa-icf-functions[perform Identical Code Folding for functions]'
+ '-fipa-icf[perform Identical Code Folding for functions and read-only variables]'
+ '-fipa-icf-variables[perform Identical Code Folding for variables]'
+ '-fipa-profile[perform interprocedural profile propagation]'
+ '-fipa-pta[perform interprocedural points-to analysis]'
+ '-fipa-pure-const[discover pure and const functions]'
+ '-fipa-ra[use caller save register across calls if possible]'
+ '-fipa-reference[discover readonly and non addressable static variables]'
+ '-fipa-sra[perform interprocedural reduction of aggregates]'
+ '-fipa-vrp[perform IPA Value Range Propagation]'
+ '-fira-algorithm=[set the used IRA algorithm]:algorithm:(cb priority)'
+ '-fira-hoist-pressure[use IRA based register pressure calculation in RTL hoist optimizations]'
+ '-fira-loop-pressure[use IRA based register pressure calculation in RTL loop optimizations]'
+ '-fira-region=-[set regions for IRA]:region:(all mixed one)'
+ '-fira-region=[set regions for IRA]:region:(one all mixed)'
+ '-fira-share-save-slots[share slots for saving different hard registers]'
+ '-fira-share-spill-slots[share stack slots for spilled pseudo-registers]'
+ '-fira-verbose=-[control IRA'\''s level of diagnostic messages]:verbosity: '
+ '-fisolate-erroneous-paths-attribute[detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a returns_nonnull or]'
+ '-fisolate-erroneous-paths-dereference[detect paths that trigger erroneous or undefined behavior due to dereferencing a null pointer. Isolate those paths from the main]'
+ '-fivopts[optimize induction variables on trees]'
+ '-fjump-tables[use jump tables for sufficiently large switch statements]'
+ '-fkeep-inline-functions[generate code for functions even if they are fully inlined]'
+ '-fkeep-static-consts[emit static const variables even if they are not used]'
+ '-flax-vector-conversions[allow implicit conversions between vectors with differing numbers of subparts and/or differing element types]'
+ '-fleading-underscore[give external symbols a leading underscore]'
+ '-flifetime-dse[tell DSE that the storage for a C++ object is dead when the constructor starts and when the destructor finishes]'
+ '-flive-range-shrinkage[relief of register pressure through live range shrinkage]'
+ '-floop-nest-optimize[enable the loop nest optimizer]'
+ '-floop-parallelize-all[mark all loops as parallel]'
+ '-flra-remat[do CFG-sensitive rematerialization in LRA]'
+ '-flto-compression-level=-[use specified zlib compression level for IL]:compression level: '
+ '-flto-odr-type-merging[merge C++ types using One Definition Rule]'
+ '-flto-partition=-[partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max one none)'
+ '-flto-report[report various link-time optimization statistics]'
+ '-fmath-errno[set errno after built-in math functions]'
+ '-fmax-errors=-[maximum number of errors to report]:errors: '
+ '-fmem-report[report on permanent memory allocation]'
+ '-fmem-report-wpa[report on permanent memory allocation in WPA only]'
+ '-fmerge-all-constants[attempt to merge identical constants and constant variables]'
+ '-fmerge-constants[attempt to merge identical constants across compilation units]'
+ '-fmerge-debug-strings[attempt to merge identical debug strings across compilation units]'
+ '-fmessage-length=-[limit diagnostics to <number> characters per line. 0 suppresses line-wrapping]:length: '
+ '-fmodulo-sched-allow-regmoves[perform SMS based modulo scheduling with register moves allowed]'
+ '-fmodulo-sched[perform SMS based modulo scheduling before the first scheduling pass]'
+ '-fmove-loop-invariants[move loop invariant computations out of loops]'
+ "-fms-extensions[don't warn about uses of Microsoft extensions]"
+ '-fmudflapir[this switch lacks documentation]'
+ '-fmudflap[this switch lacks documentation]'
+ '-fmudflapth[this switch lacks documentation]'
+ '-fnon-call-exceptions[support synchronous non-call exceptions]'
+ '-fno-stack-limit[do not limit the size of the stack]'
+ '-fno-threadsafe-statics[do not generate thread-safe code for initializing local statics]'
+ '-fnothrow-opt[treat a throw() exception specification as noexcept to improve code size]'
+ '-fomit-frame-pointer[when possible do not generate stack frames]'
+ '-fopenacc[enable OpenACC]'
+ '-fopenmp[enable OpenMP (implies -frecursive in Fortran)]'
+ "-fopenmp-simd[enable OpenMP's SIMD directives]"
+ '-foptimize-sibling-calls[optimize sibling and tail recursive calls]'
+ '-foptimize-strlen[enable string length optimizations on trees]'
+ '-fopt-info[enable all optimization info dumps on stderr]'
+ '-fopt-info-type=-[dump compiler optimization details]:filename:_files'
+ '-fpack-struct[pack structure members together without holes]'
+ '-fpack-struct=[set initial maximum structure member alignment]:alignment (power of 2): '
+ '-fpartial-inlining[perform partial inlining]'
+ '-fpcc-struct-return[return small aggregates in memory, not registers]'
+ '-fpch-deps[this switch lacks documentation]'
+ '-fpch-preprocess[look for and use PCH files even when preprocessing]'
+ '-fpeel-loops[perform loop peeling]'
+ '-fpeephole2[enable an RTL peephole pass before sched2]'
+ '-fpeephole[enable machine specific peephole optimizations]'
+ '-fPIC[generate position-independent code if possible (large mode)]'
+ '-fpic[generate position-independent code if possible (small mode)]'
+ '-fPIE[generate position-independent code for executables if possible (large mode)]'
+ '-fpie[generate position-independent code for executables if possible (small mode)]'
+ '-fplan9-extensions[enable Plan 9 language extensions]'
+ '-fplt[use PLT for PIC calls (-fno-plt- load the address from GOT at call site)]'
+ '-fplugin-arg--[specify argument <key>=<value> for plugin <name>]:-fplugin-arg-name-key=value: ' #TODO
+ '-fplugin=-[specify a plugin to load]:plugin: ' # TODO: complete plugins?
+ '-fpost-ipa-mem-report[report on memory allocation before interprocedural optimization]'
+ '-fpredictive-commoning[run predictive commoning optimization]'
+ '-fprefetch-loop-arrays[generate prefetch instructions, if available, for arrays in loops]'
+ '-fpre-ipa-mem-report[report on memory allocation before interprocedural optimization]'
+ '-fpreprocessed[treat the input file as already preprocessed]'
+ '-fprintf-return-value[treat known sprintf return values as constants]'
+ '-fprofile-arcs[insert arc-based program profiling code]'
+ '-fprofile-correction[enable correction of flow inconsistent profile data input]'
+ '-fprofile-dir=-[set the top-level directory for storing the profile data]:profile directory:_files -/'
+ '-fprofile[enable basic program profiling code]'
+ '-fprofile-generate[enable common options for generating profile info for profile feedback directed optimizations]'
+ '-fprofile-report[report on consistency of profile]'
+ '-fprofile-use[enable common options for performing profile feedback directed optimizations]'
+ '-fprofile-values[insert code to profile values of expressions]'
+ '-frandom-seed=-[use <string> as random seed]:seed: '
+ '-freciprocal-math[same as -fassociative-math for expressions which include division]'
+ '-frecord-gcc-switches[record gcc command line switches in the object file]'
+ '-free[turn on Redundant Extensions Elimination pass]'
+ '-freg-struct-return[return small aggregates in registers]'
+ '-frename-registers[perform a register renaming optimization pass]'
+ '-freorder-blocks-algorithm=[set the used basic block reordering algorithm]:algorithm:(simple stc)'
+ '-freorder-blocks-and-partition[reorder basic blocks and partition into hot and cold sections]'
+ '-freorder-blocks[reorder basic blocks to improve code placement]'
+ '-freorder-functions[reorder functions to improve code placement]'
+ '-frequire-return-statement[functions which return values must end with return statements]'
+ '-frerun-cse-after-loop[add a common subexpression elimination pass after loop optimizations]'
+ '-freschedule-modulo-scheduled-loops[enable/disable the traditional scheduling in loops that already passed modulo scheduling]'
+ '-frounding-math[disable optimizations that assume default FP rounding behavior]'
+ '-frtti[generate run time type descriptor information]'
+ "-fsanitize=-[enable AddressSanitizer, a memory error detector]:style:($sanitizers)"
+ '-fsched2-use-superblocks[if scheduling post reload, do superblock scheduling]'
+ '-fsched-critical-path-heuristic[enable the critical path heuristic in the scheduler]'
+ '-fsched-dep-count-heuristic[enable the dependent count heuristic in the scheduler]'
+ '-fsched-group-heuristic[enable the group heuristic in the scheduler]'
+ '-fsched-interblock[enable scheduling across basic blocks]'
+ '-fsched-last-insn-heuristic[enable the last instruction heuristic in the scheduler]'
+ '-fsched-pressure[enable register pressure sensitive insn scheduling]'
+ '-fsched-rank-heuristic[enable the rank heuristic in the scheduler]'
+ '-fsched-spec[allow speculative motion of non-loads]'
+ '-fsched-spec-insn-heuristic[enable the speculative instruction heuristic in the scheduler]'
+ '-fsched-spec-load[allow speculative motion of some loads]'
+ '-fsched-spec-load-dangerous[allow speculative motion of more loads]'
+ '-fsched-stalled-insns[allow premature scheduling of queued insns]'
+ '-fsched-stalled-insns-dep[set dependence distance checking in premature scheduling of queued insns]'
+ '-fsched-stalled-insns-dep=[set dependence distance checking in premature scheduling of queued insns]:insns:'
+ '-fsched-stalled-insns-dep=-[set dependence distance checking in premature scheduling of queued insns]:instructions: '
+ '-fsched-stalled-insns=[set number of queued insns that can be prematurely scheduled]:insns:'
+ '-fsched-stalled-insns=-[set number of queued insns that can be prematurely scheduled]:instructions: '
+ '-fschedule-fusion[perform a target dependent instruction fusion optimization pass]'
+ '-fschedule-insns2[reschedule instructions after register allocation]'
+ '-fschedule-insns[reschedule instructions before register allocation]'
+ '-fsched-verbose=-[set the verbosity level of the scheduler]:verbosity: '
+ '-fsection-anchors[access data in the same section from shared anchor points]'
+ '-fselective-scheduling2[run selective scheduling after reload]'
+ '-fselective-scheduling[schedule instructions using selective scheduling algorithm]'
+ '-fsel-sched-pipelining-outer-loops[perform software pipelining of outer loops during selective scheduling]'
+ '-fsel-sched-pipelining[perform software pipelining of inner loops during selective scheduling]'
+ '-fsel-sched-reschedule-pipelined[reschedule pipelined regions without pipelining]'
+ '-fshort-double[use the same size for double as for float]'
+ '-fshort-enums[use the narrowest integer type possible for enumeration types]'
+ '-fshort-wchar[force the underlying type for "wchar_t" to be "unsigned short"]'
+ '-fshow-column[show column numbers in diagnostics, when available]'
+ '-fshrink-wrap[emit function prologues only before parts of the function that need it, rather than at the top of the function]'
+ '-fshrink-wrap-separate[shrink-wrap parts of the prologue and epilogue separately]'
+ '-fsignaling-nans[disable optimizations observable by IEEE signaling NaNs]'
+ '-fsigned-bitfields[when signed or unsigned is not given make the bitfield signed]'
+ '-fsigned-char[make char signed by default]'
+ '-fsigned-zeros[disable floating point optimizations that ignore the IEEE signedness of zero]'
+ '-fsimd-cost-model=[specifies the vectorization cost model for code marked with a simd directive]:model:(unlimited dynamic cheap)'
+ '-fsingle-precision-constant[convert floating point constants to single precision constants]'
+ '-fsplit-ivs-in-unroller[split lifetimes of induction variables when loops are unrolled]'
+ '-fsplit-loops[perform loop splitting]'
+ '-fsplit-paths[split paths leading to loop backedges]'
+ '-fsplit-stack[generate discontiguous stack frames]'
+ '-fsplit-wide-types[split wide types into independent registers]'
+ '-fssa-backprop[enable backward propagation of use properties at the SSA level]'
+ '-fssa-phiopt[optimize conditional patterns using SSA PHI nodes]'
+ '-fstack-check=-[insert stack checking code into the program. -fstack-check=specific if to argument given]:type:(none generic specific)'
+ '-fstack-limit-register=-[trap if the stack goes past <register>]:register: '
+ '-fstack-limit-symbol=-[trap if the stack goes past symbol <name>]:name: '
+ '-fstack-protector-all[use a stack protection method for every function]'
+ '-fstack-protector-explicit[use stack protection method only for functions with the stack_protect attribute]'
+ '-fstack-protector-strong[use a smart stack protection method for certain functions]'
+ '-fstack-protector[use propolice as a stack protection method]'
+ '-fstack-reuse=[set stack reuse level for local variables]:level:(all named_vars none)'
+ '-fstack-reuse=-[set stack reuse level for local variables]:reuse-level:(all named_vars none)'
+ '-fstack-usage[output stack usage information on a per-function basis]'
+ '-fstdarg-opt[optimize amount of stdarg registers saved to stack at start of function]'
+ '-fstore-merging[merge adjacent stores]'
+ '-fstrict-aliasing[assume strict aliasing rules apply]'
+ '-fstrict-enums[assume that values of enumeration type are always within the minimum range of that type]'
+ '-fstrict-overflow[treat signed overflow as undefined]'
+ '-fstrict-volatile-bitfields[force bitfield accesses to match their type width]'
+ '-fsync-libcalls[implement __atomic operations via libcalls to legacy __sync functions]'
+ '-fsyntax-only[check for syntax errors, then stop]'
+ '-ftabstop=[distance between tab stops for column reporting]:number'
+ '-ftest-coverage[create data files needed by "gcov"]'
+ '-fthread-jumps[perform jump threading optimizations]'
+ '-ftime-report[report the time taken by each compiler pass]'
+ '-ftls-model=-[set the default thread-local storage code generation model]:TLS model:(global-dynamic local-dynamic initial-exec local-exec)'
+ '-ftracer[perform superblock formation via tail duplication]'
+ '-ftrack-macro-expansion=[track locations of tokens coming from macro expansion and display them in error messages]::argument'
+ '-ftrapping-math[assume floating-point operations can trap]'
+ '-ftrapv[trap for signed overflow in addition, subtraction and multiplication]'
+ '-ftree-bit-ccp[enable SSA-BIT-CCP optimization on trees]'
+ '-ftree-builtin-call-dce[enable conditional dead code elimination for builtin calls]'
+ '-ftree-ccp[enable SSA-CCP optimization on trees]'
+ '-ftree-ch[enable loop header copying on trees]'
+ '-ftree-coalesce-vars[enable SSA coalescing of user variables]'
+ '-ftree-copy-prop[enable copy propagation on trees]'
+ '-ftree-cselim[transform condition stores into unconditional ones]'
+ '-ftree-dce[enable SSA dead code elimination optimization on trees]'
+ '-ftree-dominator-opts[enable dominator optimizations]'
+ '-ftree-dse[enable dead store elimination]'
+ '-ftree-forwprop[enable forward propagation on trees]'
+ '-ftree-fre[enable Full Redundancy Elimination (FRE) on trees]'
+ '-ftree-loop-distribute-patterns[enable loop distribution for patterns transformed into a library call]'
+ '-ftree-loop-distribution[enable loop distribution on trees]'
+ '-ftree-loop-if-convert[convert conditional jumps in innermost loops to branchless equivalents]'
+ '-ftree-loop-im[enable loop invariant motion on trees]'
+ '-ftree-loop-ivcanon[create canonical induction variables in loops]'
+ '-ftree-loop-linear[enable loop interchange transforms. Same as -floop-interchange]'
+ '-ftree-loop-optimize[enable loop optimizations on tree level]'
+ '-ftree-loop-vectorize[enable loop vectorization on trees]'
+ '-ftree-lrs[perform live range splitting during the SSA- >normal pass]'
+ '-ftree-parallelize-loops=[enable automatic parallelization of loops]'
+ '-ftree-parallelize-loops=-[enable automatic parallelization of loops]:threads: '
+ '-ftree-partial-pre[in SSA-PRE optimization on trees, enable partial- partial redundancy elimination]'
+ '-ftree-phiprop[enable hoisting loads from conditional pointers]'
+ '-ftree-pre[enable SSA-PRE optimization on trees]'
+ '-ftree-pta[perform function-local points-to analysis on trees]'
+ '-ftree-reassoc[enable reassociation on tree level]'
+ '-ftree-scev-cprop[enable copy propagation of scalar-evolution information]'
+ '-ftree-sink[enable SSA code sinking on trees]'
+ '-ftree-slp-vectorize[enable basic block vectorization (SLP) on trees]'
+ '-ftree-slsr[perform straight-line strength reduction]'
+ '-ftree-sra[perform scalar replacement of aggregates]'
+ '-ftree-switch-conversion[perform conversions of switch initializations]'
+ '-ftree-tail-merge[enable tail merging on trees]'
+ '-ftree-ter[replace temporary expressions in the SSA->normal pass]'
+ '-ftree-vectorize[enable vectorization on trees]'
+ '-ftree-vrp[perform Value Range Propagation on trees]'
+ '-funconstrained-commons[assume common declarations may be overridden with ones with a larger trailing array]'
+ '-funroll-all-loops[perform loop unrolling for all loops]'
+ '-funroll-loops[perform loop unrolling when iteration count is known]'
+ '-funsafe-loop-optimizations[allow loop optimizations to assume that the loops behave in normal way]'
+ '-funsafe-math-optimizations[allow math optimizations that may violate IEEE or ISO standards]'
+ '-funsigned-bitfields[when signed or unsigned is not given make the bitfield unsigned]'
+ '-funsigned-char[make char unsigned by default]'
+ '-funswitch-loops[perform loop unswitching]'
+ '-funwind-tables[just generate unwind tables for exception handling]'
+ '-fuse-ld=-[use the specified linker instead of the default linker]:linker:(bfd gold)'
+ '-fuse-linker-plugin[use linker plugin during link-time optimization]'
+ '-fvariable-expansion-in-unroller[apply variable expansion when loops are unrolled]'
+ '-fvar-tracking-assignments[perform variable tracking by annotating assignments]'
+ '-fvar-tracking-assignments-toggle[toggle -fvar-tracking-assignments]'
+ '-fvar-tracking[perform variable tracking]'
+ '-fvar-tracking-uninit[perform variable tracking and also tag variables that are uninitialized]'
+ '-fvect-cost-model=[specifies the cost model for vectorization]:model:(unlimited dynamic cheap)'
+ '-fverbose-asm[add extra commentary to assembler output]'
+ '-fvisibility=-[set the default symbol visibility]:visibility:(default internal hidden protected)'
+ '-fvpt[use expression value profiles in optimizations]'
+ '-fweb[construct webs and split unrelated uses of single variable]'
+ '-fwhole-program[perform whole program optimizations]'
+ '-fwide-exec-charset=[convert all wide strings and character constants to character set]:character set'
+ '-fworking-directory[generate a #line directive pointing at the current working directory]'
+ '-fwrapv[assume signed arithmetic overflow wraps around]'
+ '-fzero-initialized-in-bss[put zero initialized data in the bss section]'
+ {-g-,--debug=}'[generate debug information]::debugging information type or level:(0 1 2 3 gdb gdb0 gdb1 gdb2 gdb3 coff stabs stabs+ dwarf dwarf+ dwarf-2 dwarf-3 dwarf-4 dwarf-5 dwarf32 dwarf64 xcoff xcoff+)'
+ '-gno-pubnames[don'\''t generate DWARF pubnames and pubtypes sections]'
+ '-gno-record-gcc-switches[don'\''t record gcc command line switches in DWARF DW_AT_producer]'
+ '-gno-split-dwarf[don'\''t generate debug information in separate .dwo files]'
+ '-gno-strict-dwarf[emit DWARF additions beyond selected version]'
+ '-gpubnames[generate DWARF pubnames and pubtypes sections]'
+ '-grecord-gcc-switches[record gcc command line switches in DWARF DW_AT_producer]'
+ '-gsplit-dwarf[generate debug information in separate .dwo files]'
+ '-gstrict-dwarf[don'\''t emit DWARF additions beyond selected version]'
+ '-gtoggle[toggle debug information generation]'
+ '-gvms[generate debug information in VMS format]'
+ '--help[display this information]'
+ {-H,--trace-includes}'[print name of each header file used]'
+ {'*-idirafter','*--include-directory-after='}'[add directory after include search path]:second include path directory:_files -/'
+ {'*-I-','*--include-directory='}'[add directory to include search path]:header file search path:_files -/'
+ {'*-imacros','*--imacros='}'[include macros from file before parsing]:macro input file:_files -g \*.h\(-.\)'
+ '-imultiarch[set <dir> to be the multiarch include subdirectory]:directory:_files -/' #XXX not in manpage
+ '-imultilib=[set dir to be the multilib include subdirectory]:dir:_files -/'
+ '--include-barrier[restrict all prior -I flags to double-quoted inclusion and remove current directory from include path]'
+ {'*-include=','*--include='}'[include file before parsing]:include file:_files -g \*.h\(-.\)'
+ '-iplugindir=-[set <dir> to be the default plugin directory]:directory:_files -/'
+ {'*-iprefix','*--include-prefix='}'[set the -iwithprefix prefix]:prefix:_files'
+ '-iquote=[add dir to the end of the quote include path]:dir:_files -/'
+ '-isysroot=[set dir to be the system root directory]:dir:_files -/'
+ '*-isystem[add directory to system include search path]:second include path directory (system):_files -/'
+ {'*-iwithprefixbefore','*--include-with-prefix-before='}'[set directory to include search path with prefix]:main include path directory:_files -/'
+ {'*-iwithprefix','*--include-with-prefix=','*--include-with-prefix-after='}'[set directory to system include search path with prefix]:second include path directory:_files -/'
+ '*-L-[add directory to library search path]:library search path:_files -/'
+ '-lang-asm[set lang asm]'
+ '*-l+[include library found in search path]:library:->library'
+ '-MF[write dependency output to the given file]:file:_files'
+ '-MJ[write a compilation database entry per input]'
+ '-MQ[add a make-quoted target]:target'
+ '*-M-[set flags for generating Makefile dependencies]::output dependencies:->dependencies'
+ '-MT[add an unquoted target]:target'
+ '-no-canonical-prefixes[do not canonicalize paths when building relative prefixes to other gcc components]'
+ '-nodefaultlibs[do not use the standard system libraries when linking]'
+ '-nostartfiles[do not use the standard system startup files when linking]'
+ {-nostdinc,--no-standard-includes}'[do not search standard system directories or compiler builtin directories for include files]'
+ '-nostdlib[do not use standard system startup files or libraries when linking]'
+ {-O-,--optimize=-}'[control the optimization]::optimization level:((0 1 2 3 g\:optimize\ for\ debugging\ experience s\:optimize\ for\ space fast\:optimize\ for\ speed\ disregarding\ exact\ standards\ compliance))'
+ {-o,--output=}'[write output to file]:output file:_files -g "^*.(c|h|cc|C|cxx|cpp|hpp)(-.)"'
+ '--output-pch=[output pch]'
+ '--param[set parameter <param> to value. See manpage for a complete list of parameters]:name=value'
+ '-pass-exit-codes[exit with highest error code from a phase]'
+ {-pedantic-errors,--pedantic-errors}'[like -pedantic but issue them as errors]'
+ {-pedantic,--pedantic}'[issue all mandatory diagnostics in the C standard]'
+ '(-pg)-p[enable function profiling for prof]'
+ '-pie[create a position independent executable]'
+ {-pipe,--pipe}'[use pipes rather than intermediate files]'
+ {-P,--no-line-commands}'[inhibit generation of linkemakers during preprocess]'
+ '(-p)-pg[enable function profiling for gprof]'
+ '-###[print commands to run this compilation]'
+ '-print-file-name=-[display the full path to library <library>]:library:->library'
+ '-print-libgcc-file-name[display the name of the compiler'\''s companion library]'
+ '--print-missing-file-dependencies[print missing file dependencies]'
+ '-print-multiarch[display the target'\''s normalized GNU triplet, used as a component in the library path]'
+ '-print-multi-directory[display the root directory for versions of libgcc]'
+ '-print-multi-lib[display the mapping between command line options and multiple library search directories]'
+ '-print-multi-os-directory[display the relative path to OS libraries]'
+ '-print-prog-name=-[display the full path to compiler component <program>]:program:'
+ '-print-search-dirs[display the directories in the compiler'\''s search path]'
+ '-print-sysroot[display the target libraries directory]'
+ '-print-sysroot-headers-suffix[display the sysroot suffix used to find headers]'
+ {-Qn,-fno-ident}'[do not emit metadata containing compiler name and version]'
+ '-quiet[do not display functions compiled or elapsed time]'
+ {-Qy,-fident}'[emit metadata containing compiler name and version]'
+ '-rdynamic[pass the flag -export-dynamic to the ELF linker, on targets that support it]'
+ '-remap[remap file names when including files]'
+ {-S,--assemble}'[compile only; do not assemble or link]'
+ '-save-stats=-[save code generation statistics]:location:(cwd obj)'
+ '-save-temps[do not delete intermediate files]'
+ '-shared[create a shared library]'
+ '-shared-libgcc[force shared libgcc]'
+ '*-specs=-[override built-in specs with the contents of <file>]:file:_files'
+ '-s[remove all symbol table and relocation information from the executable]'
+ '-static-libgcc[force static libgcc]'
+ '-static[on systems that support dynamic linking, this prevents linking with the shared libraries]'
+ {'-std=-','--std='}'[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899\:1990 iso9899\:199409 c99 iso9899\:1999 c11 iso9899\:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899\:2017 gnu++17 c++2a gnu++2a)'
+ '-symbolic[bind references to global symbols when building a shared object]'
+ '--sysroot=-[use <directory> as the root directory for headers and libraries]:directory:_files -/'
+ '--target-help[display target specific command line options]'
+ '-time[time the execution of each subprocess]'
+ {-traditional-cpp,--traditional-cpp}'[use traditional preprocessor]'
+ {-trigraphs,--trigraphs}'[process trigraph sequences]'
+ '-T[specify linker script]:linker script:_files'
+ '-undef[do not predefine system specific and gcc specific macros]'
+ '*-u[pretend symbol to be undefined]:symbol:'
+ '--user-dependencies[print user dependencies]'
+ {'*-U-','*--undefine-macro='}'[undefine a macro]:undefine macro:'
+ '-version[display the compiler'\''s version]'
+ '--version[display version information]'
+ '-V[specify compiler version]:compiler version:'
+ {-v,--verbose}'[enable verbose output]'
+ '*-Wa,-[pass arguments to the assembler]:assembler option:'
+ '--warn--[enable the specified warning]:warning:->warning'
+ '*-Werror=-[treat specified warning as error (or all if none specified)]::warning:->warning'
+ '-Wfatal-errors[exit on the first error occurred]'
+ '*-Wl,-[pass arguments to the linker]:linker option:'
+ {-w,--no-warnings}'[suppress warnings]'
+ '*-Wp,-[pass arguments to the preprocessor]:preprocessor option:'
+ '--write-dependencies[write a depfile containing user and system dependencies]'
+ '--write-user-dependencies[write a depfile containing user dependencies]'
+ '*-Xassembler[pass argument to the assembler]:assembler option:'
+ '*-Xlinker[pass argument to the linker]:linker option:'
+ '*-Xpreprocessor[pass argument to the preprocessor]:preprocessor option:'
+ '-x[specify the language of the following input files]:input file language:('"$languages"')'
)
-# other common options, gcc --help=warnings --help=optimizers --help=common|sed 1,/language-independent/d
-args+=(
-# | grep -v ::
- '--help[Display this information]'
- '--no-warnings[Same as -w]'
- '--optimize[Same as -O]'
- '--output[Same as -o]'
- '--param[Set parameter <param> to value. See manpage for a complete list of parameters]:name=value'
- '--verbose[Same as -v]'
- '--version[Display version information]'
- '-aux-info[Emit declaration information into <file>]:file:_files'
- '-dumpbase[Set the file basename to be used for dumps]:file:_files'
- '-dumpdir[Set the directory name to be used for dumps]:file:_files -/'
- '-fPIC[Generate position-independent code if possible (large mode)]'
- '-fPIE[Generate position-independent code for executables if possible (large mode)]'
- '-fassociative-math[Allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]'
- '-fauto-inc-dec[Generate auto-inc/dec instructions]'
- '-fbounds-check[Generate code to check bounds before indexing arrays]'
- '-fcall-saved--[Mark <register> as being preserved across functions]:register'
- '-fcall-used--[Mark <register> as being corrupted by function calls]:register'
- '-fcheck-data-deps[Compare the results of several data dependence analyzers]'
- '-fcompare-debug-second[Run only the second compilation of -fcompare-debug]'
- '-fcompare-debug=-[Compile with and without e.g. -gtoggle, and compare the final-insns dump]:opts:' #TODO: complete gcc options here
- '-fdbg-cnt-list[List all available debugging counters with their limits and counts]'
- '-fdbg-cnt=-[,<counter>-<limit>,...) Set the debug counter limit]:counter\:limit,...: ' #TODO: gcc -fdbg-cnt-list -x c /dev/null -o /dev/null -c
- '-fdebug-types-section[Output .debug_types section when using DWARF v4 debuginfo]'
- '-fdelete-dead-exceptions[Delete dead instructions that may throw exceptions]'
- '-fdiagnostics-color=-[Colorize diagnostics]::color:(never always auto)'
- '-fdiagnostics-generate-patch[Print fix-it hints to stderr in unified diff format]'
- '-fdiagnostics-parseable-fixits[Print fixit hints in machine-readable form]'
- '-fdiagnostics-show-caret[Show the source line with a caret indicating the column]'
- '-fdiagnostics-show-location=-[How often to emit source location at the beginning of line-wrapped diagnostics]:source location:(once every-line)'
- '-fdiagnostics-show-option[Amend appropriate diagnostic messages with the command line option that controls them]'
- #not meant for end users
- #'-fdisable--pass=-[disables an optimization pass]:range1+range2: '
- #'-fdisable-[disables an optimization pass]'
- #'-fenable--pass=-[enables an optimization pass]:range1+range2: '
- #'-fenable-[enables an optimization pass]'
- #'-fdump-<type>[Dump various compiler internals to a file]'
- '-fdump-final-insns=-[Dump to filename the insns at the end of translation]:filename:_files'
- '-fdump-go-spec=-[Write all declarations to file as Go code]:filename:_files'
- '-fdump-noaddr[Suppress output of addresses in debugging dumps]'
- '-fdump-passes[Dump optimization passes]'
- '-fdump-unnumbered-links[Suppress output of previous and next insn numbers in debugging dumps]'
- '-fdump-unnumbered[Suppress output of instruction numbers, line number notes and addresses in debugging dumps]'
- '-fdwarf2-cfi-asm[Enable CFI tables via GAS assembler directives]'
- '-feliminate-dwarf2-dups[Perform DWARF2 duplicate elimination]'
- '-feliminate-unused-debug-symbols[Perform unused type elimination in debug info]'
- '-feliminate-unused-debug-types[Perform unused type elimination in debug info]'
- '-femit-class-debug-always[Do not suppress C++ class debug information]'
- '-fexcess-precision=-[Specify handling of excess floating-point precision]:precision handling:(fast standard)'
- '-ffast-math[Sets -fno-math-errno, -funsafe-math-optimizations, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans and -fcx-limited-range]'
- '-ffat-lto-objects[Output lto objects containing both the intermediate language and binary output]'
- '-ffixed--[Mark <register> as being unavailable to the compiler]:register'
- '-ffunction-cse[Allow function addresses to be held in registers]'
- '-ffunction-sections[Place each function into its own section]'
- '-fgnu-tm[Enable support for GNU transactional memory]'
- '-fgraphite[Enable in and out of Graphite representation]'
- '-fident[Process #ident directives]'
- '-findirect-inlining[Perform indirect inlining]'
- '-finhibit-size-directive[Do not generate .size directives]'
- '-finline-limit=-[Limit the size of inlined functions to <number>]:number: '
- '-finstrument-functions[Instrument function entry and exit with profiling calls]'
- '-fira-loop-pressure[Use IRA based register pressure calculation in RTL loop optimizations]'
- '-fira-share-save-slots[Share slots for saving different hard registers]'
- '-fira-share-spill-slots[Share stack slots for spilled pseudo-registers]'
- '-fira-verbose=-[Control IRA'\''s level of diagnostic messages]:verbosity: '
- '-fkeep-inline-functions[Generate code for functions even if they are fully inlined]'
- '-fkeep-static-consts[Emit static const variables even if they are not used]'
- '-fleading-underscore[Give external symbols a leading underscore]'
- '-flto-compression-level=-[Use specified zlib compression level for IL]:compression level: '
- '-flto-odr-type-merging[Merge C++ types using One Definition Rule]'
- '-flto-partition=-[Partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max one none)'
- '-flto-report[Report various link-time optimization statistics]'
- '-fmax-errors=-[Maximum number of errors to report]:errors: '
- '-fmem-report-wpa[Report on permanent memory allocation in WPA only]'
- '-fmem-report[Report on permanent memory allocation]'
- '-fmerge-debug-strings[Attempt to merge identical debug strings across compilation units]'
- '-fmessage-length=-[Limit diagnostics to <number> characters per line. 0 suppresses line-wrapping]:length: '
- '-fmodulo-sched-allow-regmoves[Perform SMS based modulo scheduling with register moves allowed]'
- '-fopt-info-type=-[Dump compiler optimization details]:filename:_files'
- '-fopt-info[Dump compiler optimization details]'
- '-fpartial-inlining[Perform partial inlining]'
- '-fpcc-struct-return[Return small aggregates in memory, not registers]'
- '-fpic[Generate position-independent code if possible (small mode)]'
- '-fpie[Generate position-independent code for executables if possible (small mode)]'
- '-fplugin-arg--[Specify argument <key>=<value> for plugin <name>]:-fplugin-arg-name-key=value: ' #TODO
- '-fpost-ipa-mem-report[Report on memory allocation before interprocedural optimization]'
- '-fpre-ipa-mem-report[Report on memory allocation before interprocedural optimization]'
- '-fprofile-arcs[Insert arc-based program profiling code]'
- '-fprofile-correction[Enable correction of flow inconsistent profile data input]'
- '-fprofile-generate[Enable common options for generating profile info for profile feedback directed optimizations]'
- '-fprofile-report[Report on consistency of profile]'
- '-fprofile-use[Enable common options for performing profile feedback directed optimizations]'
- '-fprofile-values[Insert code to profile values of expressions]'
- '-fprofile[Enable basic program profiling code]'
- '-frandom-seed=-[Use <string> as random seed]:seed: '
- '-freciprocal-math[Same as -fassociative-math for expressions which include division]'
- '-frecord-gcc-switches[Record gcc command line switches in the object file]'
- '-free[Turn on Redundant Extensions Elimination pass]'
- "-fsanitize=-[Enable AddressSanitizer, a memory error detector]:style:($sanitizers)"
- '-fsched-stalled-insns-dep=-[Set dependence distance checking in premature scheduling of queued insns]:instructions: '
- '-fsched-stalled-insns=-[Set number of queued insns that can be prematurely scheduled]:instructions: '
- '-fsched-verbose=-[Set the verbosity level of the scheduler]:verbosity: '
- '-fshow-column[Show column numbers in diagnostics, when available]'
- '-fsplit-stack[Generate discontiguous stack frames]'
- '-fstack-check=-[Insert stack checking code into the program. -fstack-check=specific if to argument given]:type:(none generic specific)'
- '-fstack-limit-register=-[Trap if the stack goes past <register>]:register: '
- '-fstack-limit-symbol=-[Trap if the stack goes past symbol <name>]:name: '
- '-fno-stack-limit'
- '-fstack-protector-all[Use a stack protection method for every function]'
- '-fstack-protector[Use propolice as a stack protection method]'
- '-fstack-usage[Output stack usage information on a per-function basis]'
- '-fstrict-overflow[Treat signed overflow as undefined]'
- '-fstrict-volatile-bitfields[Force bitfield accesses to match their type width]'
- '-fsync-libcalls[Implement __atomic operations via libcalls to legacy __sync functions]'
- '-fsyntax-only[Check for syntax errors, then stop]'
- '-ftest-coverage[Create data files needed by "gcov"]'
- '-ftime-report[Report the time taken by each compiler pass]'
- '-ftls-model=-[Set the default thread-local storage code generation model]:TLS model:(global-dynamic local-dynamic initial-exec local-exec)'
- '-ftracer[Perform superblock formation via tail duplication]'
- '-ftree-loop-linear[Enable loop interchange transforms. Same as -floop-interchange]'
- '-fuse-ld=-[Use the specified linker instead of the default linker]:linker:(bfd gold)'
- '-fuse-linker-plugin[Use linker plugin during link-time optimization]'
- '-fverbose-asm[Add extra commentary to assembler output]'
- '-fvisibility=-[Set the default symbol visibility]:visibility:(default internal hidden protected)'
- '-fzero-initialized-in-bss[Put zero initialized data in the bss section]'
- '-gno-pubnames[Don'\''t generate DWARF pubnames and pubtypes sections]'
- '-gno-record-gcc-switches[Don'\''t record gcc command line switches in DWARF DW_AT_producer]'
- '-gno-split-dwarf[Don'\''t generate debug information in separate .dwo files]'
- '-gno-strict-dwarf[Emit DWARF additions beyond selected version]'
- '-gpubnames[Generate DWARF pubnames and pubtypes sections]'
- '-grecord-gcc-switches[Record gcc command line switches in DWARF DW_AT_producer]'
- '-gsplit-dwarf[Generate debug information in separate .dwo files]'
- '-gstrict-dwarf[Don'\''t emit DWARF additions beyond selected version]'
- '-gtoggle[Toggle debug information generation]'
- '-gvms[Generate debug information in VMS format]'
- '-imultiarch[Set <dir> to be the multiarch include subdirectory]:directory:_files -/' #XXX not in manpage
- '-iplugindir=-[Set <dir> to be the default plugin directory]:directory:_files -/'
- '(-pg)-p[Enable function profiling for prof]'
- '(-p)-pg[Enable function profiling for gprof]'
- '-pedantic-errors[Like -pedantic but issue them as errors]'
- '-pedantic[Issue all mandatory diagnostics in the C standard]'
- '-quiet[Do not display functions compiled or elapsed time]'
- '-v[Enable verbose output]'
- '-version[Display the compiler'\''s version]'
- '-w[Suppress warnings]'
-# | grep ::
- '-fabi-version=-[Use version <n> of the C++ ABI (default: 2)]:ABI version:(1 2 3 4 5 6)'
- '-fdebug-prefix-map=-[Map one directory name to another in debug information]:/old/dir=/new/dir:->dirtodir'
- '-ffp-contract=-[Perform floating- point expression contraction (default: fast)]:style:(on off fast)'
- '-finstrument-functions-exclude-file-list=-[Do not instrument functions listed in files]:comma-separated file list:->commafiles'
- '-finstrument-functions-exclude-function-list=-[Do not instrument listed functions]:comma-separated list of syms: '
- '-fira-algorithm=-[Set the used IRA algorithm]:algorithm:(priority CB)'
- '-fira-region=-[Set regions for IRA]:region:(all mixed one)'
- '-fplugin=-[Specify a plugin to load]:plugin: ' # TODO: complete plugins?
- '-fprofile-dir=-[Set the top-level directory for storing the profile data]:profile directory:_files -/'
- '-fstack-reuse=-[Set stack reuse level for local variables]:reuse-level:(all named_vars none)'
- '-ftree-parallelize-loops=-[Enable automatic parallelization of loops]:threads: '
-)
+# not meant for end users
+#'-fdisable--pass=-[disables an optimization pass]:range1+range2: '
+#'-fdisable-[disables an optimization pass]'
+#'-fenable--pass=-[enables an optimization pass]:range1+range2: '
+#'-fenable-[enables an optimization pass]'
+#'-fdump-<type>[dump various compiler internals to a file]'
+
+args+=($warnings)
# How to mostly autogenerate the above stuff:
# joinhelplines() { sed '$!N;s/^\( -.*\)\n \s*\([^-]\)/\1 \2/;P;D' }
# gcc-x86() { gcc --help=target,\^undocumented | joinhelplines | joinhelplines }
# compdef _gnu_generic gcc-x86
# printf '%s\n' ${(onq-)_args_cache_gcc_x86}
+
+# TODO: -fno-<TAB> and -mno-<TAB> match lots of non-existent options.
_arguments -C -M 'L:|-{fWm}no-=-{fWm} r:|[_-]=* r:|=*' \
"$args[@]" \
"$args2[@]" && ret=0
-
case "$state" in
dump)
- _values -s '' 'dump information' \
- 'M[only macro definitions]' \
- 'N[macro names]' \
- 'D[macro definitions and normal output]' \
- 'y[debugging information during parsing]' \
- 'r[after RTL generation]' \
- 'x[only generate RTL]' \
- 'j[after jump optimization]' \
- 's[after CSE]' \
- 'L[after loop optimization]' \
- 't[after second CSE pass]' \
- 'f[after flow analysis]' \
- 'c[after instruction combination]' \
- 'S[after first instruction scheduling pass]' \
- 'l[after local register allocation]' \
- 'g[after global register allocation]' \
- 'R[after second instruction scheduling pass]' \
- 'J[after last jump optimization]' \
- 'd[after delayed branch scheduling]' \
- 'k[after conversion from registers to stack]' \
- 'a[all dumps]' \
- 'm[print memory usage statistics]' \
- 'p[annotate assembler output]' && ret=0
+ local -a dump_values=(
+ 'A[verbose assembly output]'
+ 'D[macro definitions and normal output]'
+ 'I[include directives and normal output]'
+ 'J[after last jump optimization]'
+ 'L[after loop optimization]'
+ 'M[only macro definitions]'
+ 'N[macro names]'
+ 'R[after second instruction scheduling pass]'
+ 'S[after first instruction scheduling pass]'
+ 'a[all dumps]'
+ 'c[after instruction combination]'
+ 'd[after delayed branch scheduling]'
+ 'f[after flow analysis]'
+ 'g[after global register allocation]'
+ 'j[after jump optimization]'
+ 'k[after conversion from registers to stack]'
+ 'l[after local register allocation]'
+ 'm[print memory usage statistics]'
+ 'p[annotate assembler output]'
+ 'r[after RTL generation]'
+ 's[after CSE]'
+ 't[after second CSE pass]'
+ 'x[only generate RTL]'
+ 'y[debugging information during parsing]'
+ )
+ _values -s '' 'dump information' $dump_values && ret=0
+ ;;
+dependencies)
+ local -a dependencies=(
+ 'D:generate make dependencies and compile'
+ 'G:treat missing header files as generated'
+ 'M:only user header files'
+ 'MD:output to file'
+ 'P:generate phony targets for all headers'
+ 'V:use NMake/Jom format for the depfile'
+ )
+ _describe dependencies dependencies && ret=0
;;
library)
+ # TODO: improve defaults for library_path (e.g., use output of clang -Wl,-v)
+ local -a library_path=( /usr/lib /usr/local/lib )
+ case $OSTYPE in
+ (darwin*)
+ library_path+=( $(xcrun --show-sdk-path)/usr/lib )
+ ;;
+ (linux-gnu)
+ local tmp
+ tmp=$(_call_program library-paths $words[1] -print-multiarch)
+ if [[ $tmp != '' && -d /usr/lib/$tmp ]]; then
+ library_path+=( /usr/lib/$tmp )
+ elif [[ -d /usr/lib64 ]]; then
+ library_path+=( /usr/lib64 )
+ fi
+ ;;
+ esac
+ # Add directories from -L options
+ for ((i = 2; i < $#words; i++)); do
+ if [[ "$words[i]" = -L ]]; then
+ library_path+=("$words[++i]")
+ elif [[ "$words[i]" = -L* ]]; then
+ library_path+=("${words[i]##-L}")
+ fi
+ done
_wanted libraries expl library \
- compadd - ${^=LD_LIBRARY_PATH:-/usr/lib /usr/local/lib}/lib*.(a|so*)(:t:fr:s/lib//) && ret=0
+ compadd - $library_path/lib*.(a|so*|dylib)(:t:fr:s/lib//) && ret=0
;;
rundir)
compset -P '*:'
@@ -1219,7 +2249,39 @@ commafiles)
compset -P '*,'
_files && ret=0
;;
+framework)
+ local -a framework_path=()
+ case $OSTYPE in
+ darwin*)
+ framework_path=( $(xcrun --show-sdk-path)/System/Library/Frameworks ) ;;
+ esac
+ # Add directories from -F options
+ for ((i = 2; i < $#words; i++)); do
+ if [[ "$words[i]" = -F ]]; then
+ framework_path+=("$words[++i]")
+ elif [[ "$words[i]" = -F* ]]; then
+ framework_path+=("${words[i]##-F}")
+ fi
+ done
+ _wanted frameworks expl framework \
+ compadd -- $framework_path/*.framework(:t:r) && ret=0
+ ;;
+warning)
+ local -a warning_names
+ for warning in $warnings; do
+ if [[ "$warning" = (#b)-W([^=\[]##)[^\[]#\[(*)\]* ]]; then
+ warning_names+=("$match[1]:$match[2]")
+ fi
+ done
+ _describe warning warning_names && ret=0
+ ;;
+arch)
+ _wanted cputypes expl "CPU type" compadd -a arch && ret=0
+ ;;
+archgeneric)
+ arch+=(generic)
+ _wanted cputypes expl "CPU type" compadd -a arch && ret=0
+ ;;
esac
return ret
-
diff --git a/Completion/Unix/Command/_gcore b/Completion/Unix/Command/_gcore
index 07a65cd9a..a31a81267 100644
--- a/Completion/Unix/Command/_gcore
+++ b/Completion/Unix/Command/_gcore
@@ -49,10 +49,20 @@ case $OSTYPE in
'::executable:' \
':pid:_pids'
;;
+ darwin*)
+ _arguments -s -A '-*' \
+ '-s[suspend the process while the core file is captured]' \
+ '-v[report progress on the dump as it proceeds]' \
+ '-b+[specify maximum size of core file]:size (MiB): ' \
+ '(-c)-o+[write core file to specified file]:file:_files' \
+ '(-o)-c+[specify format of core file name]:format (%%N\:program name, %%U\:uid, %%P\:pid, %%T\:time stamp)' \
+ '1:pid:_pids'
+ ;;
*)
# GNU GDB gcore
- _arguments \
- '-o[set core file base name]:file base name:_files' \
- ':pid:_pids'
+ _arguments -s -A '-*' \
+ '-a[dump all memory mappings]' \
+ '-o+[set core file base name]:file base name:_files' \
+ '*:pid:_pids'
;;
esac
diff --git a/Completion/Unix/Command/_gdb b/Completion/Unix/Command/_gdb
index 18f797633..6bdd55946 100644
--- a/Completion/Unix/Command/_gdb
+++ b/Completion/Unix/Command/_gdb
@@ -40,9 +40,9 @@ else
(-b) _baudrates && return 0 ;;
esac
- w=( "${(@)words[2,-1]}" )
+ w=( "${(@)words[2,CURRENT-1]}" )
while [[ "$w[1]" = -* ]]; do
- [[ "$w[1]" = -[decsxb] ]] && shift 1 w
+ [[ "$w[1]" = -(cd|se|tty|[decsxb]) ]] && shift 1 w
shift 1 w
done
diff --git a/Completion/Unix/Command/_gem b/Completion/Unix/Command/_gem
index b35a5c358..7d81619bb 100644
--- a/Completion/Unix/Command/_gem
+++ b/Completion/Unix/Command/_gem
@@ -46,7 +46,7 @@ if [[ $state = command ]]; then
'gem_dependencies:gem dependencies file guide'
'platforms:show information about platforms'
)
- _describe -t topics 'help topics' helptopics -- && ret=0
+ _describe -t topics 'help topic' helptopics -- && ret=0
;&
subcommands)
cmds=( ${${${(M)${(f)"$(_call_program commands gem help commands)"}:# [^ ]*}## #}/ ##/:} )
@@ -56,6 +56,11 @@ if [[ $state = command ]]; then
check|cleanup|contents|dependency|list|open|pristine|rdoc|uninstall|unpack|update)
args+=( '(--all --skip)*:installed gem:->gems-local' )
;|
+ install)
+ (( ${(M)#line:#[^-]*} > 1 )) && args+=(
+ '(*)--[specify build options]:*:build option:_default'
+ )
+ ;|
fetch|install|lock|owner|search|yank)
args+=( '*:gem:->gems-remote' )
;|
@@ -196,7 +201,7 @@ if [[ $state = command ]]; then
)
;;
environment)
- args+=( '1:information:(packageversion gemdir gempath version remotesources platform)' )
+ args+=( '1:information:(gemdir gempath version remotesources platform)' )
;;
fetch)
def=( both \! local \! remote \! )
@@ -299,6 +304,9 @@ if [[ $state = command ]]; then
'*:file:_files'
)
;;
+ yank)
+ args+=( '--otp=[specify code for multifactor authentication]:code' )
+ ;;
esac
_arguments -C ${args:-'*: :_default'} \
'(-)'{-h,--help}'[display usage information]' \
diff --git a/Completion/Unix/Command/_getfacl b/Completion/Unix/Command/_getfacl
index 15be06a1c..27b5ee1c8 100644
--- a/Completion/Unix/Command/_getfacl
+++ b/Completion/Unix/Command/_getfacl
@@ -22,6 +22,7 @@ _arguments -s -S \
'(-P --physical)'{-P,--physical}"[physical walk, don't follow symbolic links]" \
'(-t --tabular)'{-t,--tabular}'[use tabular output format]' \
'(-n --numeric)'{-n,--numeric}'[print numeric user/group identifiers]' \
+ '--one-file-system[skip files on different filesystems]' \
'(-p --absolute-names)'{-p,--absolute-names}"[don't strip leading '/' in pathnames]" \
'(- *)'{-v,--version}'[display version information]' \
'(- *)'{-h,--help}'[display help information]' \
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 675460dad..cecb80ac3 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -68,7 +68,10 @@ _git-add () {
'--refresh[do not add files, but refresh their stat() info in index]' \
'--ignore-errors[continue adding if an error occurs]' \
$ignore_missing \
- '--chmod[override the executable bit of the listed files]:override:(-x +x)' \
+ '--sparse[allow updating entries outside of sparse-checkout cone]' \
+ '--chmod=[override the executable bit of the listed files]:override:(-x +x)' \
+ '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
+ '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
'*:: :->file' && return
case $state in
@@ -76,8 +79,8 @@ _git-add () {
declare -a ignored_files_alternatives
if [[ -n ${opt_args[(I)-f|--force]} ]]; then
ignored_files_alternatives=(
- 'ignored-modified-files:ignored modified files:__git_ignore_line_inside_arguments __git_modified_files --ignored'
- 'ignored-other-files:ignored other files:__git_ignore_line_inside_arguments __git_other_files --ignored')
+ 'ignored-modified-files:ignored modified file:__git_ignore_line_inside_arguments __git_modified_files --ignored'
+ 'ignored-other-files:ignored other file:__git_ignore_line_inside_arguments __git_other_files --ignored')
fi
_alternative \
@@ -97,11 +100,8 @@ _git-am () {
# NOTE: --rebasing and --resolvemsg are only for internal use between git
# rebase and git am.
- # TODO: --patch-format is undocumented.
- # TODO: --rerere-autoupdate and --no-rerere-autoupdate are
- # undocumented (and not implemented here).
_arguments -s -S $endopt \
- '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \
+ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: trailer to the commit message]' \
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
"(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
'(-k --keep)'{-k,--keep}'[pass -k to git mailinfo]' \
@@ -111,13 +111,14 @@ _git-am () {
'(--keep-cr )--no-keep-cr[do not pass --keep-cr to git mailsplit]' \
'(-c --scissors --no-scissors)'{-c,--scissors}'[strip everything before a scissors line]' \
'(-c --scissors --no-scissors)--no-scissors[ignore scissors lines]' \
+ '--quoted-cr=[specify action when quoted CR is found]:action [warn]:(nowarn warn strip)' \
'(-q --quiet)'{-q,--quiet}'[only print error messages]' \
'(-u --utf8 --no-utf8)'{-u,--utf8}'[pass -u to git mailinfo]' \
'(-u --utf8 --no-utf8)--no-utf8[pass -n to git mailinfo]' \
'(-3 --3way)'{-3,--3way}'[use 3-way merge if patch does not apply cleanly]' \
$apply_options \
'--quit[abort the patching operation but keep HEAD where it is]' \
- '--show-current-patch[show the patch being applied]' \
+ '--show-current-patch=-[show the message being applied]::show [raw]:(diff raw)' \
'(-i --interactive)'{-i,--interactive}'[apply patches interactively]' \
'--committer-date-is-author-date[use author date as committer date]' \
'--ignore-date[use committer date as author date]' \
@@ -160,6 +161,7 @@ _git-archive () {
'(- :)'{-l,--list}'[list available archive formats]' \
'(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \
'--prefix=-[prepend the given path prefix to each filename]:path prefix:_directories -r ""' \
+ '--add-file=[add untracked file to archive]:file:_files' \
'(-o --output)'{-o+,--output=}'[write archive to specified file]:archive:_files' \
'--worktree-attributes[look for attributes in .gitattributes in working directory too]' \
$backend_args \
@@ -179,8 +181,6 @@ _git-archive () {
(( $+functions[_git-bisect] )) ||
_git-bisect () {
- # TODO: next subcommand is undocumented. Git-bisect.sh mentions that the
- # subcommand might be removed from the UI level.
local curcontext=$curcontext state line ret=1
declare -A opt_args
local good bad
@@ -226,6 +226,7 @@ _git-bisect () {
--term-{good,old}'=[specify alternate term for good revisions]:term' \
--term-{bad,new}'=[specify alternate term for bad revisions]:term' \
'--no-checkout[set BISECT_HEAD reference instead of doing checkout at each iteration]' \
+ '--first-parent[follow only the first parent commit upon seeing a merge commit]' \
':bad revision:__git_commits' \
'*: :->revision-or-path' && ret=0
case $state in
@@ -323,14 +324,14 @@ _git-branch () {
"($c $m -a)"{-r,--remotes}'[list or delete only remote-tracking branches]' \
"($c $m $d : -r --remotes)-a[list both remote-tracking branches and local branches]" \
"($c $m $d : -v -vv --verbose)"{-v,-vv,--verbose}'[show SHA1 and commit subject line for each head]' \
- "($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \
+ "($c $m $d :)--abbrev=[use specified digits to display object names]:digits" \
"($c $m $d :)--no-abbrev[don't abbreviate sha1s]" \
"(- :)--show-current[show current branch name]" \
"($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]" \
- "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names' \
+ "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote branch:__git_remote_branch_names' \
"($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \
"($l $m $d)*--contains=[only list branches that contain the specified commit]: :__git_committishs" \
"($l $m $d)*--no-contains=[only list branches that don't contain the specified commit]: :__git_committishs" \
@@ -380,6 +381,11 @@ _git-bundle () {
(create)
if (( CURRENT == 2 )); then
_arguments \
+ '(-q --quiet)'{-q,--quiet}"[don't show progress]" \
+ '--progress[show progress meter]' \
+ '--all-progress[show progress meter during object writing phase]' \
+ '--all-progress-implied[similar to --all-progress when progress meter is shown]' \
+ '--version=[specify bundle format version]:version:(2 3)' \
':bundle:_files' && ret=0
else
local revision_options
@@ -393,13 +399,20 @@ _git-bundle () {
;;
(verify)
_arguments \
+ '(-q --quiet)'{-q,--quiet}"[don't show bundle details]" \
':bundle:_files' && ret=0
;;
- (list-heads|unbundle)
+ (list-heads)
_arguments \
':bundle:_files' \
'*: :__git_references' && ret=0
- ;;
+ ;;
+ (unbundle)
+ _arguments \
+ '--progress[show progress meter]' \
+ ':bundle:_files' \
+ '*: :__git_references' && ret=0
+ ;;
esac
;;
esac
@@ -466,6 +479,8 @@ _git-checkout () {
'--no-overlay[remove files from index or working tree that are not in the tree-ish]' \
'(-q --quiet --progress)--no-progress[suppress progress reporting]' \
'--progress[force progress reporting]' \
+ '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
+ '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
'(-)--[start file arguments]' \
'*:: :->branch-or-tree-ish-or-file' && ret=0
@@ -527,11 +542,11 @@ _git-cherry-pick () {
'(-m --mainline)'{-m+,--mainline=}'[specify mainline when cherry-picking a merge commit]:parent number' \
'--rerere-autoupdate[update index with reused conflict resolution if possible]' \
'(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actual commit]' \
- '(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
+ '(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
"(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
'*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \
- '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \
+ '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \
'(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \
'*: : __git_commit_ranges -O expl:git_commit_opts'
}
@@ -548,7 +563,7 @@ _git-clean () {
_arguments -C -S -s $endopt \
'-d[also remove untracked directories]' \
- '(-f --force)'{-f,--force}'[required when clean.requireForce is true (default)]' \
+ \*{-f,--force}'[required by default; twice, removes untracked nested repositories]' \
'(-i --interactive)'{-i,--interactive}'[show what would be done and clean files interactively]' \
'(-n --dry-run)'{-n,--dry-run}'[only show what would and what would not be removed]' \
'(-q --quiet)'{-q,--quiet}"[don't print names of files removed]" \
@@ -618,6 +633,7 @@ _git-clone () {
'(-q --quiet)'{-q,--quiet}'[operate quietly]' \
'(-v --verbose)'{-v,--verbose}'[always display the progressbar]' \
'--progress[output progress even if stderr is not a terminal]' \
+ "--reject-shallow[don't clone shallow repository]" \
'(-n --no-checkout)'{-n,--no-checkout}'[do not checkout HEAD after clone is complete]' \
'(-o --origin)--bare[make a bare GIT repository]' \
'(--bare)--mirror[clone refs into refs/* instead of refs/remotes/origin/*]' \
@@ -634,13 +650,14 @@ _git-clone () {
"--no-tags[don't clone any tags and make later fetches not follow them]" \
'--shallow-submodules[any cloned submodules will be shallow]' \
'--recursive[initialize all contained submodules]' \
- '--recurse-submodules=-[initialize submodules in the clone]::file:__git_files' \
+ '(--recursive --recurse-submodules)'{--recursive,--recurse-submodules}'=-[initialize submodules in the clone]::file:__git_files' \
'--separate-git-dir[place .git dir outside worktree]:path to .git dir:_path_files -/' \
\*--server-option='[send specified string to the server when using protocol version 2]:option' \
'(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \
'(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \
'--filter=[object filtering]:filter:_git_rev-list_filters' \
'--remote-submodules[any cloned submodules will use their remote-tracking branch]' \
+ '--sparse[initialize the sparse-checkout file to start with only the top-level files]' \
': :->repository' \
': :_directories' && ret=0
@@ -684,7 +701,7 @@ _git-commit () {
# TODO: --interactive isn't explicitly listed in the documentation.
_arguments -S -s $endopt \
'(-a --all --interactive -o --only -i --include *)'{-a,--all}'[stage all modified and deleted paths]' \
- '--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \
+ '--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:_git_fixup' \
'--squash=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \
$reset_author_opt \
'( --porcelain --dry-run)--short[dry run with short output format]' \
@@ -696,7 +713,8 @@ _git-commit () {
{-p,--patch}'[use the interactive patch selection interface to chose which changes to commit]' \
'(--reset-author)--author[override the author name used in the commit]:author name' \
'--date=[override the author date used in the commit]:date' \
- '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
+ '*--trailer=[add custom trailer(s)]:trailer' \
+ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \
'(-n --no-verify)'{-n,--no-verify}'[bypass pre-commit and commit-msg hooks]' \
'--allow-empty[allow recording an empty commit]' \
'--allow-empty-message[allow recording a commit with an empty message]' \
@@ -709,6 +727,8 @@ _git-commit () {
'(-u --untracked-files)'{-u-,--untracked-files=-}'[show files in untracked directories]::mode:((no\:"show no untracked files"
normal\:"show untracked files and directories"
all\:"show individual files in untracked directories"))' \
+ '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
+ '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
'(-q --quiet -v --verbose)'{-v,--verbose}'[show unified diff of all file changes]' \
'(-q --quiet -v --verbose)'{-q,--quiet}'[suppress commit summary message]' \
'--dry-run[only show list of paths that are to be committed or not, and any untracked]' \
@@ -723,7 +743,7 @@ _git-commit () {
{-C+,--reuse-message=}'[use existing commit object with same log message]: :__git_commits' \
{-c+,--reedit-message=}'[use existing commit object and edit log message]: :__git_commits' \
{-F+,--file=}'[read commit message from given file]: :_files' \
- {-m+,--message=}'[use the given message as the commit message]:message' \
+ \*{-m+,--message=}'[use the given message as the commit message]:message' \
{-t+,--template=}'[use file as a template commit message]:template:_files'
}
@@ -735,7 +755,7 @@ _git-describe () {
'--all[use any ref found in "$GIT_DIR/refs/"]' \
'--tags[use any ref found in "$GIT_DIR/refs/tags"]' \
'(--tags)--contains[find the tag after the commit instead of before]' \
- '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \
+ '--abbrev=[use specified digits to display object names]:digits' \
'( --exact-match)--candidates=[consider up to given number of candidates]: :__git_guard_number "number of candidates"' \
'(--candidates )--exact-match[only output exact matches, same as --candidates=0]' \
'--debug[display information about the searching strategy]' \
@@ -806,11 +826,14 @@ _git-diff () {
# Example: git diff branch1..branch2 <tab>
__git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0
elif __git_is_committish $line[1] || __git_is_treeish $line[1]; then
+ local files_alt='files::__git_tree_files ${PREFIX:-.} HEAD'
+ [[ $line[1] = (HEAD|@) ]] &&
+ files_alt='files::__git_changed_files'
# Example: git diff branch1 <tab>
_alternative \
'commits::__git_commits' \
'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \
- 'files::__git_tree_files ${PREFIX:-.} HEAD' && ret=0
+ $files_alt && ret=0
elif __git_is_blob $line[1]; then
_alternative \
'files::__git_cached_files' \
@@ -831,6 +854,10 @@ _git-diff () {
__git_is_treeish $line[2]; then
# Example: git diff branch1 branch2 <tab>
__git_tree_files ${PREFIX:-.} $line[2] && ret=0
+ elif [[ $line[1] = (HEAD|@) ]]; then
+ # Example: git diff @ file1 <tab>
+ # Example: git diff HEAD -- <tab>
+ __git_ignore_line __git_changed_files && ret=0
elif __git_is_committish $line[1] || __git_is_treeish $line[1]; then
# Example: git diff branch file1 <tab>
# Example: git diff branch -- f<tab>
@@ -862,16 +889,17 @@ _git-fetch () {
_arguments -C -S -s $endopt \
$fetch_options \
- '--shallow-since=[deepen history of shallow repository based on time]:time' \
- '*--shallow-exclude=[deepen history of shallow clone by excluding revision]:revision' \
- '--deepen[deepen history of shallow clone]:number of commits' \
- '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \
+ '--atomic[use atomic transaction to update references]' \
'(--all -m --multiple)'{-m,--multiple}'[fetch from multiple remotes]' \
+ '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \
+ '--prefetch[modify the refspec to place all refs within refs/prefetch/]' \
'(-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' \
+ '--write-fetch-head[write fetched references to the FETCH_HEAD file]' \
+ "--negotiate-only[don't fetch a packfile; instead, print ancestors of negotiation tips]" \
'--filter=[object filtering]:filter:_git_rev-list_filters' \
- "--auto-gc[run 'gc --auto' after fetching]" \
+ '(--auto-maintenance --auto-gc)'--auto-{maintenance,gc}"[run 'maintenance --auto' after fetching]" \
+ '--write-commit-graph[write the commit-graph after fetching]' \
+ '--stdin[accept refspecs from stdin]' \
'*:: :->repository-or-group-or-refspec' && ret=0
case $state in
@@ -911,7 +939,7 @@ _git-format-patch () {
'--start-number=[start numbering patches at given number]: :__git_guard_number "patch number"' \
'--numbered-files[use only number for file name]' \
'(-n --numbered -N --no-numbered -k --keep-subject --rfc --subject-prefix)'{-k,--keep-subject}"[don't strip/add \[PATCH\] from the first line of the commit message]" \
- '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \
+ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: trailer to the commit message]' \
'(-o --output-directory)--stdout[output the generated mbox on standard output (implies --mbox)]' \
'( --no-attach --inline)--attach=-[create attachments instead of inlining patches]::boundary' \
'(--attach --inline)--no-attach[disable creation of attachments]' \
@@ -922,7 +950,9 @@ _git-format-patch () {
'--in-reply-to=[make the first mail a reply to the given message]:message id' \
'--ignore-if-in-upstream[do not include a patch that matches a commit in the given range]' \
'(-v --reroll-count)'{-v+,--reroll-count=}'[mark the series as the <n>-th iteration of the topic]: :__git_guard_number iteration' \
+ '--filename-max-length=[specify max length of output filename]:length' \
'(-k --keep-subject --subject-prefix)--rfc[use \[RFC PATCH\] instead of \[PATCH\]]' \
+ "--cover-from-description=[generate parts of a cover letter based on a branch's description]:mode:(message default subject auto none)" \
'(-k --keep-subject --rfc)--subject-prefix=[use the given prefix instead of \[PATCH\]]:prefix' \
'*--to=[add To: header to email headers]: :_email_addresses' \
'*--cc=[add Cc: header to email headers]: :_email_addresses' \
@@ -1140,6 +1170,8 @@ _git-init () {
'--template=[directory to use as a template for the object database]: :_directories' \
'--shared=[share repository amongst several users]:: :__git_repository_permissions' \
'--separate-git-dir=[create git dir elsewhere and link it using the gitdir mechanism]:: :_directories' \
+ '(-b --initial-branch)'{-b+,--initial-branch=}'[override the name of the initial branch]:branch name' \
+ '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)' \
':: :_directories'
}
@@ -1208,6 +1240,49 @@ _git-log () {
return ret
}
+(( $+functions[_git-maintenance] )) ||
+_git-maintenance() {
+ local curcontext="$curcontext" state state_descr line ret=1
+ local -A opt_args
+
+ _arguments -C \
+ ': :->command' \
+ '*::: := ->option-or-argument' && ret=0
+
+ case $state in
+ (command)
+ local -a commands
+
+ commands=(
+ register:'initialize config values to run maintenance on this repository'
+ run:'run one or more maintenance tasks'
+ start:'start running maintenance on the current repository'
+ stop:'halt the background maintenance schedule'
+ unregister:'remove the current repository from background maintenance'
+ )
+
+ _describe -t commands command commands && ret=0
+ ;;
+ (option-or-argument)
+ curcontext=${curcontext%:*}-$line[1]:
+ case $line[1] in
+ (run)
+ _arguments -S $endopt \
+ '--auto[run tasks based on the state of the repository]' \
+ '--schedule=[run tasks based on frequency]:frequency (seconds)' \
+ "--quiet[don't report progress or other information to stderr]" \
+ '*--task=[run a specific task]:task:(gc commit-graph prefetch loose-objects incremental-repack pack-refs)' && ret=0
+ ;;
+ (start)
+ _arguments \
+ '--scheduler=:scheduler:(auto crontab systemd-timer launchctl schtasks)'
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
(( $+functions[_git-merge] )) ||
_git-merge () {
local -a merge_options
@@ -1239,6 +1314,7 @@ _git-mv () {
'(-f --force)'{-f,--force}'[rename/move even if targets exist]' \
'-k[skip rename/move that would lead to errors]' \
'(-n --dry-run)'{-n,--dry-run}'[only show what would happen]' \
+ '--sparse[allow updating entries outside of sparse-checkout cone]' \
':source:__git_cached_files' \
'*:: :->source-or-destination' && ret=0
@@ -1302,7 +1378,6 @@ _git-notes () {
': :__git_commits' && ret=0
;;
(copy)
- # TODO: --for-rewrite is undocumented.
_arguments -S -s $endopt \
'(-f --force)'{-f,--force}'[replace existing note]' \
'(:)--stdin[read objects from stdin]' \
@@ -1367,7 +1442,6 @@ _git-pull () {
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 \
'(--no-tags -t --tags)--no-tags[disable automatic tag following]' \
': :__git_any_repositories' \
@@ -1399,6 +1473,7 @@ _git-push () {
'(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[path to git-receive-pack on remote]:remote git-receive-pack:_files' \
'(--force-with-lease --no-force-with-lease)*--force-with-lease=-[allow refs that are not ancestors to be updated if current ref matches expected value]::ref and expectation:->lease' \
'(--force-with-lease --no-force-with-lease)--no-force-with-lease[cancel all previous force-with-lease specifications]' \
+ '--force-if-includes[require remote updates to be integrated locally]' \
'(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]' \
'(:)--repo=[default repository to use]:repository:__git_any_repositories' \
'(-u --set-upstream)'{-u,--set-upstream}'[add upstream reference for each branch that is up to date or pushed]' \
@@ -1417,7 +1492,7 @@ _git-push () {
'(--no-signed --sign)--signed[GPG sign the push]' \
"(--sign --signed)--no-signed[don't GPG sign the push]" \
'--atomic[request atomic transaction on remote side]' \
- '(-o --push-option)'{-o+,--push-option=}'[transmit string to server to pass to pre/post-receive hooks]:string' \
+ '*'{-o+,--push-option=}'[transmit string to server to pass to pre/post-receive hooks]:string' \
'(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \
'(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \
': :__git_any_repositories' \
@@ -1445,6 +1520,9 @@ _git-range-diff () {
_arguments -s -S $endopt \
'--creation-factor=[specify weighting for creation]:weighting (percent)' \
'--no-dual-color[use simple diff colors]' \
+ '(--no-notes)*--notes=[show notes that annotate commit, with optional ref argument show this notes ref instead of the default notes ref(s)]:: :__git_notes_refs' \
+ '(--right-only)--left-only[only emit output related to the first range]' \
+ '(--left-only)--right-only[only emit output related to the second range]' \
$diff_options \
'1:range 1:__git_commit_ranges' \
'2:range 2:__git_commit_ranges' \
@@ -1470,38 +1548,38 @@ _git-rebase () {
'(-)--quit[abort but keep HEAD where it is]' \
'(-)--show-current-patch[show the patch file being applied or merged]' \
- options \
- '(-m --merge)'{-m,--merge}'[use merging strategies to rebase]' \
+ '(--onto --root)--keep-base[use the merge-base of upstream and branch as the current base]' \
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
"(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
- '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \
- '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \
'(-q --quiet -v --verbose --stat -n --no-stat)'{-q,--quiet}'[suppress all output]' \
'(-q --quiet -v --verbose --stat -n --no-stat)'{-v,--verbose}'[output additional information]' \
'(-n --no-stat)'{-n,--no-stat}"[don't show diffstat of what changed upstream]" \
'--rerere-autoupdate[update the index with reused conflict resolution if possible]' \
'--no-verify[bypass the pre-rebase hook]' \
- '-C-[ensure that given lines of surrounding context match]: :__git_guard_number "lines of context"' \
+ '(--apply -m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)-C-[ensure that given lines of surrounding context match]: :__git_guard_number "lines of context"' \
'(-f --force-rebase)'{-f,--force-rebase}'[force rebase even if current branch descends from commit rebasing onto]' \
- '(-i --interactive)--ignore-whitespace[ignore whitespace in context]' \
- '(-i --interactive)--whitespace=-[detect a new or modified line that has whitespace errors]: :__git_apply_whitespace_strategies' \
+ '(-i --interactive)--ignore-whitespace[ignore changes in whitespace]' \
+ '(--apply -m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)--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} \
- {-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]' \
- '--allow-empty-message[allow rebasing commits with empty messages]' \
- '(1)--root[rebase all reachable commits]' \
+ '(-f --force-rebase)'{--ignore-date,--reset-author-date}'[ignore author date and use current date]' \
+ '(-m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)--apply[use apply strategies to rebase]' \
+ '(-m --merge --apply --whitespace -C)'{-m,--merge}'[use merging strategies to rebase]' \
+ '(-i --interactive --ignore-whitespace --apply --whitespace -C --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \
+ '(--apply --whitespace -C)--empty=[specify how to handle commits that become empty]:handling:(drop keep ask)' \
+ '(--apply --whitespace -C)'{-x+,--exec=}'[with -i\: append "exec <cmd>" after each line]:command:_command_names -e' \
+ '(-r --rebase-merges --apply --whitespace -C)'{-r-,--rebase-merges=-}'[try to rebase merges instead of skipping them]::option:(rebase-cousins no-rebase-cousins)' \
+ '(--apply --whitespace -C)*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \
+ '(--apply --whitespace -C)*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \
+ '(1 --keep-base --fork-point)--root[rebase all reachable commits]' \
$autosquash_opts \
'(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \
"(--autostash --no-autostash)--no-autostash[don't stash uncommitted changes before rebasing and apply them afterwards]" \
- '--fork-point[use merge-base --fork-point to refine upstream]' \
- '--ignore-date[use current timestamp for author date]' \
- '--signoff[add Signed-off-by: line to the commit message]' \
+ '(--root)--fork-point[use merge-base --fork-point to refine upstream]' \
+ '--signoff[add Signed-off-by: trailer to the commit message]' \
'--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \
'(--keep-base)--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \
- '(--onto)--keep-base[use the merge-base of upstream and branch as the current base]' \
- "--reschedule-failed-exec[automatically re-schedule any 'exec' that fails]" \
+ "(--apply --whitespace -C)--reschedule-failed-exec[automatically re-schedule any 'exec' that fails]" \
+ '(--apply --whitespace -C)--reapply-cherry-picks[apply all changes, even those already present upstream]' \
':upstream branch:__git_revisions' \
'::working branch:__git_revisions'
}
@@ -1521,6 +1599,8 @@ _git-reset () {
'--recurse-submodules=-[control recursive updating of submodules]::reset:__git_commits' \
'(-p --patch)'{-p,--patch}'[select diff hunks to remove from the index]' \
'(-q --quiet)'{-q,--quiet}'[suppress all output]' \
+ '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
+ '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
'(--soft --mixed --hard --merge --keep):: :__git_commits' \
'(--soft --mixed --hard --merge --keep)*:: :->file' && ret=0
@@ -1548,7 +1628,7 @@ _git-restore() {
local -A opt_args
_arguments -C -s -S $endopt \
- '(-s --source)'{-s,--source}'[specify which tree-ish to checkout from]:source tree:->sources' \
+ '(-s --source)'{-s,--source=}'[specify which tree-ish to checkout from]:source tree:->sources' \
'(-S --staged)'{-S,--staged}'[restore the index]' \
'(-W --worktree)'{-W,--worktree}'[restore the working tree (default)]' \
'--ignore-unmerged[ignore unmerged entries]' \
@@ -1563,17 +1643,23 @@ _git-restore() {
'(-2 --ours -3 --theirs -m --merge)'{-3,--theirs}'[checkout their version for unmerged files]' \
'(-p --patch)'{-p,--patch}'[select hunks interactively]' \
"--ignore-skip-worktree-bits[don't limit pathspecs to sparse entries only]" \
+ '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
+ '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
'*:path spec:->pathspecs' && ret=0
case $state in
pathspecs)
- if [[ -z ${opt_args[(I)-s|--source|-S|--staged]} ]] &&
- # use index as a default base unless -S is specified
- __git_ignore_line __git_modified_files
+ integer opt_S opt_W
+ [[ -n ${opt_args[(I)-S|--staged]} ]] && opt_S=1
+ [[ -n ${opt_args[(I)-W|--worktree]} ]] && opt_W=1
+ if (( opt_S && opt_W ))
then
- ret=0
+ __git_ignore_line __git_changed_files && ret=0
+ elif (( opt_S ))
+ then
+ __git_ignore_line __git_changed-in-index_files && ret=0
else
- __git_ignore_line __git_tree_files ${PREFIX:-.} ${(Qv)opt_args[(i)-s|--source]:-HEAD} && ret=0
+ __git_ignore_line __git_changed-in-working-tree_files && ret=0
fi
;;
sources)
@@ -1601,7 +1687,7 @@ _git-revert () {
'(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]' \
'(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
'--strategy=[use given merge strategy]:merge strategy:__git_merge_strategies' \
- '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \
+ '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \
"(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \
': :__git_recent_commits'
@@ -1618,6 +1704,9 @@ _git-rm () {
'-r[allow recursive removal when a leading directory-name is given]' \
'--cached[only remove files from the index]' \
'--ignore-unmatch[exit with 0 status even if no files matched]' \
+ '--sparse[allow updating entries outside of sparse-checkout cone]' \
+ '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \
+ '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \
'(-q --quiet)'{-q,--quiet}"[don't list removed files]" \
'*:: :->file' && ret=0
@@ -1646,6 +1735,8 @@ _git-shortlog () {
'(-s --summary)'{-s,--summary}'[suppress commit description]' \
'(-e --email)'{-e,--email}'[show email address of each author]' \
'-w-[linewrap the output]:: :->wrap' \
+ '*--group=[group commits by field]: : _values -S\: field author committer trailer\:trailer' \
+ '(-c --committer)'{-c,--committer}'[alias for --group=committer]' \
$revision_options \
'(-)--[start file arguments]' \
'*:: :->commit-range-or-file' && ret=0
@@ -1721,6 +1812,50 @@ _git-show () {
return ret
}
+(( $+functions[_git-sparse-checkout] )) ||
+_git-sparse-checkout() {
+ local curcontext="$curcontext" state state_descr line ret=1
+ local -A opt_args
+
+ _arguments -C \
+ ': :->command' \
+ '*::: := ->option-or-argument' && ret=0
+
+ case $state in
+ (command)
+ local -a commands
+
+ commands=(
+ list:'describe the patterns in the sparse-checkout file'
+ init:'enable the core.sparseCheckout setting'
+ set:'write a set of patterns to the sparse-checkout file'
+ add:'update the sparse-checkout file to include additional patterns'
+ reapply:'reapply the sparsity pattern rules to paths in the working tree'
+ disable:'disable the config setting, and restore all files in the working directory'
+ )
+
+ _describe -t commands command commands && ret=0
+ ;;
+ (option-or-argument)
+ curcontext=${curcontext%:*}-$line[1]:
+ case $line[1] in
+ init)
+ _arguments \
+ '--cone[allow for better performance with a limited set of patterns]' \
+ '--no-sparse-index[rewrite index to not be sparse]'
+ ;;
+ set|add)
+ _arguments -S \
+ '--stdin[read patterns from input]' \
+ '*:pattern:_files' && ret=0
+ ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
(( $+functions[_git-stash] )) ||
_git-stash () {
local curcontext=$curcontext state line ret=1
@@ -1734,11 +1869,13 @@ _git-stash () {
'(-q --quiet)'{-q,--quiet}'[suppress all output]'
'(-p --patch -a --all -u --include-untracked)'{-u,--include-untracked}'[include untracked files]'
'(-p --patch -a --all -u --include-untracked)'{-a,--all}'[include ignored files]'
+ '(* -p --patch)--pathspec-from-file=[read pathspec from file]:file:_files'
+ '(* -p --patch)--pathspec-file-nul[pathspec elements are separated with NUL character]'
)
_arguments -C \
'*::: :->args' \
- '(-m --message)'{-m,--message}'[specify stash description]' \
+ '(-m --message)'{-m+,--message=}'[specify stash description]:description' \
${save_arguments//#\(/(* } && ret=0
if [[ -n $state ]]; then
@@ -1771,8 +1908,8 @@ _git-stash () {
(push)
_arguments -S $endopt \
$save_arguments \
- '(-m --message)'{-m,--message}'[specify stash description]' \
- ':: :__git_modified_files' && ret=0
+ '(-m --message)'{-m+,--message=}'[specify stash description]:description' \
+ '*: : __git_ignore_line __git_modified_files' && ret=0
;;
(--)
__git_modified_files
@@ -1875,7 +2012,8 @@ _git-submodule () {
init:'initialize a submodule'
deinit:'unregister a submodule'
update:'update a submodule'
- set-branch:'set the default remote tracking branch for the submodule'
+ set-branch:'set default remote tracking branch for the submodule'
+ set-url:'set URL of the specified submodule'
summary:'show commit summary between given commit and working tree/index'
foreach:'evaluate shell command in each checked-out submodule'
absorbgitdirs:'move the git directory of a submodule into its superprojects'
@@ -1931,6 +2069,7 @@ _git-submodule () {
'--remote[use the status of the submodule''s remote-tracking branch]' \
'--force[discard local changes by checking out the current up-to-date version]' \
'--init[initialize uninitialized submodules]' \
+ '--single-branch[clone only one branch]' \
'*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0
;;
(set-branch)
@@ -1939,6 +2078,11 @@ _git-submodule () {
'(-b --branch)'{-b,--branch=}'[specify the remote branch]:remote branch' \
'1:path:_directories'
;;
+ (set-url)
+ _arguments -C -A '-*' \
+ '1:path:_directories' \
+ '2:url:_urls' && ret=0
+ ;;
(summary)
_arguments -C -A '-*' \
'(-q --quiet)'{-q,--quiet}'[suppress all output]' \
@@ -2289,17 +2433,20 @@ _git-config () {
'(--global --system --local -f --file --blob)--worktree[use per-worktree config file]' \
'(--global --system --local --worktree --blob)'{-f+,--file=}'[use given config file]:config file:_files' \
'(--global --system --local --worktree -f --file)--blob=[read config from given blob object]:blob:__git_blobs' \
- '(-t --type --bool --int --bool-or-int --path --expiry-date)'{-t+,--type=}'[ensure that incoming and outgoing values are canonicalize-able as the given type]:type:(bool int bool-or-int path expiry-date color)' \
- '(-t --type --int --bool-or-int --path --expiry-date)--bool[setting is a boolean]' \
- '(-t --type --bool --bool-or-int --path --expiry-date)--int[setting is an integer]' \
- '(-t --type --bool --int --path --expiry-date)--bool-or-int[setting is an integer]' \
- '(-t --type --bool --int --bool-or-int --expiry-date)--path[setting is a path]' \
- '(-t --type --bool --int --bool-or-int --path)--expiry-date[setting is an expiry date]' \
+ '(-t --type --bool --int --bool-or-int --bool-or-str --path --expiry-date)'{-t+,--type=}'[ensure that incoming and outgoing values are canonicalize-able as the given type]:type:(bool int bool-or-int bool-or-str path expiry-date color)' \
+ '(-t --type --int --bool-or-int --bool-or-str --path --expiry-date)--bool[setting is a boolean]' \
+ '(-t --type --bool --bool-or-int --bool-or-str --path --expiry-date)--int[setting is an integer]' \
+ '(-t --type --bool --int --bool-or-str --path --expiry-date)--bool-or-int[setting is a boolean or integer]' \
+ '(-t --type --bool --int --bool-or-int --path --expiry-date)--bool-or-str[setting is a boolean or string]' \
+ '(-t --type --bool --int --bool-or-int --bool-or-str --expiry-date)--path[setting is a path]' \
+ '(-t --type --bool --int --bool-or-int --bool-or-str --path)--expiry-date[setting is an expiry date]' \
'(-z --null)'{-z,--null}'[end values with NUL and newline between key and value]' \
+ '--fixed-value[use string equality when comparing values]' \
'(--get --get-all --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--name-only[show variable names only]' \
'(--includes)'--no-includes"[don't respect \"include.*\" directives]" \
'(--no-includes)'--includes'[respect "include.*" directives in config files when looking up values]' \
- '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--show-origin[show origin of config]' \
+ '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool --show-scope)--show-origin[show origin of config]' \
+ '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool --show-origin)--show-scope[show scope of config (worktree, local, global, system, command)]' \
'(2 --add -e --edit -l --list --name-only --rename-section --remove-section --replace-all --unset --unset-all)--default=[with --get, use specified default value when entry is missing]:default' \
$name_arg \
$value_arg \
@@ -2311,14 +2458,14 @@ _git-config () {
'(--name-only --show-origin)--get-urlmatch[get value specific for the URL]' \
'(-z --null --name-only --show-origin)--replace-all[replace all values of the given key]' \
'(3 -z --null --name-only --show-origin)--add[add new value without altering any existing ones]' \
- '(2 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--unset[remove the first matching value of the key]' \
- '(2 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--unset-all[remove all matching values of the key]' \
- '(3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--rename-section[rename the given section]' \
- '(3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--remove-section[remove the given section]' \
- '(: --bool --int --bool-or-int --path)'{-l,--list}'[list all variables set in config file]' \
- '(-e --edit --bool --int --bool-or-int --path -z --null --name-only --show-origin)'{-e,--edit}'[open config file for editing]' \
- '(2 3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--get-color[find color setting]: :->gettable-color-option' \
- '(2 3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--get-colorbool[check if color should be used]: :->gettable-colorbool-option' && ret=0
+ '(2 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--unset[remove the first matching value of the key]' \
+ '(2 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--unset-all[remove all matching values of the key]' \
+ '(3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--rename-section[rename the given section]' \
+ '(3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--remove-section[remove the given section]' \
+ '(: --bool --int --bool-or-int --bool-or-str --path)'{-l,--list}'[list all variables set in config file]' \
+ '(-e --edit --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)'{-e,--edit}'[open config file for editing]' \
+ '(2 3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--get-color[find color setting]: :->gettable-color-option' \
+ '(2 3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--get-colorbool[check if color should be used]: :->gettable-colorbool-option' && ret=0
__git_config_option-or-value "$@" && ret=0
return ret
}
@@ -2342,7 +2489,7 @@ __git_config_value () {
# Helper to _git-config(). May be called by other functions, too, provided
# that The caller has set $line, $state, and $opt_args as _git-config() would
# set them:
-#
+#
# - set $line[1] to the option name being completed (even if completing an
# option value).
# - set $opt_args to git-config(1) options, as set by _arguments in
@@ -2383,12 +2530,16 @@ __git_config_option-or-value () {
advice.nestedTag:'show advice if a user attempts to recursively tag a tag object::->bool:true'
author.email:'email address used for author in commits::_email_addresses -c'
author.name:'full name used for author in commits:name:->string'
+ am.threeWay:'use 3-way merge if patch does not apply cleanly::->bool:false'
blame.blankboundary:'show blank SHA-1 for boundary commits::->bool:false'
blame.coloring:'determine the coloring scheme to be applied to blame output:scheme [none]:->string'
+ blame.showEmail:"show author email instead of author name::->bool:false"
blame.showroot:'show root commits as normal commits::->bool:false'
blame.ignoreRevsFile:'ignore revisions listed in the file:file:_files'
blame.date:'date format to use in output::__git_date_formats:iso'
'branch.*.description:branch description:branch description:->string'
+ branch.sort:"default sorting order for 'git branch' output::__git_ref_sort_keys"
+ checkout.defaultRemote:'assumed remote name when specifying an unqualified remote branch name:remote name:__git_remotes'
cvsexportcommit.cvsdir:'the default location of the CVS checkout to use for the export:cvs export dir:_directories'
column.ui:'specify whether supported commands should output in columns.::->column:never'
column.branch:'specify whether to output branch listing in git branch in columns::_git_column_layouts:never'
@@ -2400,7 +2551,9 @@ __git_config_option-or-value () {
core.fileMode:'track changes to the executable bit of files::->bool:true'
core.attributesfile:'look into this file for attributes in addition to .gitattributes:additional attributes file:_files'
core.abbrev:'set the length object names are abbreviated to:length:->int:7'
+ core.checkRoundtripEncoding:"encodings to UTF-8 round trip check::_guard '' 'comma-separated list of encodings'" # _guard used as a hack because _message doesn't take compadd options
core.commentchar:'comment character when using an editor::->string'
+ core.filesRefLockTimeout:"how long to retry locking a reference:retry time (milliseconds, or -1 for indefinite):->int:100"
core.ignoreCygwinFSTricks:'use Cygwin stat()/lstat()::->bool:true'
core.ignorecase:'use workarounds for non-case-sensitive filesystems::->bool:false'
core.trustctime:'trust inode change time::->bool:true'
@@ -2422,6 +2575,7 @@ __git_config_option-or-value () {
core.loosecompression:'level of compression to apply to non-pack files::->compression:1'
core.packedGitWindowSize:'size of mappings of pack files:pack window size:->bytes'
core.packedGitLimit:'maximum number of bytes to map from pack files:maximum pack file map size:->bytes'
+ core.packedRefsTimeout:"how long to retry locking the packed-refs file:retry time (milliseconds, or -1 for indefinite):->int:1000"
core.precomposeunicode:'revert the unicode decomposition of filenames done by Mac OS::->bool:false'
core.deltaBaseCacheLimit:'maximum size of cache for base objects:maximum base objects cache size:->bytes:96m'
core.bigFileThreshold:'maximum size of files to compress:maximum compress size:->bytes:512m'
@@ -2435,13 +2589,17 @@ __git_config_option-or-value () {
core.createObject:'take steps to prevent overwriting existing objects::->core.createObject:link'
core.checkstat:'determine which stat fields to match between the index and work tree::->core.checkstat:default'
core.notesRef:'show notes in given refs:refs:->string:refs/notes/commits'
+ core.sparseCheckoutCone:"enable git-sparse-checkout(1) cone mode::->bool:false"
core.sparseCheckout:'use sparse checkout::->bool:false'
+ core.splitIndex:"enable the split-index feature::->bool:false"
+ core.useReplaceRefs:"honour 'replace' refs::->bool:true"
credential.helper:'external helper to be called when a username or password credential is needed::_cmdstring'
credential.useHttpPath:'consider the "path" component of an http or https URL to be important::->bool:false'
credential.username:'If no username is set use this username by default:default username:->string'
'credential.*.helper:external helper to be called when a username or password credential is needed::_cmdstring'
'credential.*.useHttpPath:consider the "path" component of an http or https URL to be important::->bool:false'
'credential.*.username:if no username is set use this username by default:default username:->string'
+ credentialCache.ignoreSIGHUP:'ignore SIGHUP in git-credential-cache—daemon::->bool:false'
add.ignore-errors:'ignore indexing errors when adding files::->bool:false'
add.ignoreErrors:'ignore indexing errors when adding files::->bool:false'
am.keepcr:'keep CR characters when splitting mails::->bool:false'
@@ -2521,13 +2679,18 @@ __git_config_option-or-value () {
'diff.*.xfuncname:regular expression that the diff driver should use to recognize the hunk header:regular expression:->string'
diff.algorithm:'default diff algorithm::->diff.algorithm:default'
diff.autorefreshindex:'run git update-index --refresh before git diff::->bool:true'
+ diff.colorMoved:"color moved lines in diffs::__git_color_moved"
+ diff.colorMovedWS:"ignore whitespace when detecting moved lines::__git_color_movedws"
+ diff.wsErrorHighlight:'highlight whitespace errors: :__git_ws_error_highlight'
diff.context:'default number of context lines::->int:3'
diff.dirstat:'comma separated list of --dirstat parameters specifying default behaviour:comma-separated list:->string:changes,noncumulative,3'
diff.external:'command to generate diff with:diff command:_cmdstring'
+ diff.indentHeuristic:"heuristically shift hunk boundaries::->bool:true"
+ diff.interHunkContext:"combine hunks closer than N lines:number of lines:->int"
diff.mnemonicprefix:'use mnemonic source and destination prefixes::->bool:false'
diff.noprefix:'strip source and destination prefixes::->bool:false'
diff.orderfile:'file to read patch order glob patterns from:order file:_files'
- diff.renameLimit:'number of files to consider when detecting copy/renames:rename limit:->int'
+ diff.renameLimit:'number of files to consider when detecting copy/renames:limit (number of files):->int'
diff.renames:'try to detect renames::->diff.renames:true'
diff.ignoreSubmodules:'ignore submodules::->bool:false'
diff.statGraphWidth:'width of the graph part in --stat output:width:->int'
@@ -2539,10 +2702,15 @@ __git_config_option-or-value () {
difftool.prompt:'prompt before each invocation of the diff tool::->bool:true'
diff.wordRegex:'regex used to determine what a word is when performing word-by-word diff:regular expression:->string'
diff.guitool:'diff tool with gui to use::__git_difftools'
+ merge.guitool:'merge tool with gui to use::__git_difftools'
+ fastimport.unpackLimit:"whether to import objects as loose object files or as a pack:threshold for packing (number of objects imported):->int"
feature.experimental:'enable config options that are new to Git::->bool:false'
feature.manyFiles:'enable config options that optimize for repos with many files::->bool:false'
+ fetch.output:'output format:format:compadd compact full'
fetch.parallel:'specify maximum number of fetch operations to run in parallel:number:->int'
fetch.prune:'remove any remote tracking branches that no longer exist remotely::->bool:false'
+ fetch.pruneTags:"maintain one-to-one correspondence with upstream tag refs::->bool:false"
+ fetch.showForcedUpdates:"show forced updates::->bool:true"
fetch.unpackLimit:'maximum number of objects to unpack when fetching:unpack limit:->int'
fetch.recurseSubmodules:'recurse into submodules (as needed) when fetching::->fetch.recurseSubmodules:on-demand'
fetch.fsckObjects:'check all fetched objects::->bool:false'
@@ -2566,13 +2734,16 @@ __git_config_option-or-value () {
gc.aggressiveDepth:'maximum delta depth:maximum delta depth::->int:250'
gc.aggressiveWindow:'window size used in delta compression algorithm::->int:250'
gc.auto:'minimum limit for packing loose objects with --auto::->int:6700'
+ gc.autoDetach:"make 'git gc --auto' run in the background::->bool:true"
gc.autopacklimit:'minimum limit for packing packs with --auto::->int:50'
+ gc.bigPackThreshold:"keep large packs:size threshold:->bytes"
gc.packrefs:'allow git gc to run git pack-refs::->gc.packrefs:true'
- gc.pruneexpire:'grace period for pruning::->days+now'
+ gc.pruneexpire:'grace period for pruning:number of days, "now", or "never":->int'
gc.reflogexpire:'grace period for git reflog expire::->days:90'
gc.reflogexpireunreachable:'grace period for git reflog expire for unreachable entries::->days:30'
gc.rerereresolved:'number of days to keep records of resolved merges::->days:60'
gc.rerereunresolved:'number of days to keep records of unresolved merges::->days:15'
+ gc.worktreePruneExpire:'grace period for pruning worktrees:number of days, "now", or "never":->int' # git default: 3.months.ago
gitcvs.commitmsgannotation:'string to append to each commit message::->string'
gitcvs.enabled:'enable the cvs server interface::->bool:false'
gitcvs.logfile:'name of log file for cvs pserver:log file:_files'
@@ -2591,7 +2762,10 @@ __git_config_option-or-value () {
'gitcvs.*.dbTableNamePrefix:database table name prefix:prefix:->string'
gitcvs.usecrlfattr:'use end-of-line conversion attributes::->bool:false'
gitcvs.allbinary:'treat all files from CVS as binary::->bool:false'
- gpg.program:'use program instead of "gpg" found on $PATH when making or verifying a PGP signature::_cmdstring'
+ gpg.format:'private key format for --gpg-sign:format:compadd openpgp x509'
+ gpg.minTrustLevel:'minimum trust level for signature verification:trust level:compadd undefined never marginal fully ultimate' # TODO: sort in this order (use compadd -V)
+ {gpg.program,gpg.openpgp.program}:'use program instead of "gpg" found on $PATH when making or verifying a PGP signature::_cmdstring'
+ gpg.x509.program:'use program instead of "gpgsm" found on $PATH when making or verifying an x509 signature::_cmdstring'
gui.commitmsgwidth:'width of commit message window:width::->int:75'
gui.diffcontext:'number of context lines used in diff window:context::->int:5'
gui.encoding:'encoding to use for displaying file contents::->encoding'
@@ -2623,10 +2797,12 @@ __git_config_option-or-value () {
guitool.revunmerged:'show only unmerged branches in revprompt::->bool:false'
guitool.title:'title of prompt dialog:prompt title:->string'
guitool.prompt:'prompt to display:prompt:->string'
+ grep.column:"show column number of first match::->bool:false"
grep.extendedRegexp:'enable --extended-regexp option by default (ignored when grep.patternType is set)::->bool:false'
grep.fullname:'enable --full-name option by default::->bool:false'
grep.lineNumber:'enable -n option by default::->bool:false'
grep.patternType:'default matching pattern type::->grep.patternType:default'
+ grep.threads:"number of worker threads::->int"
help.browser:'browser used to display help in web format::__git_browsers'
help.htmlpath:'location of HTML help::->help.htmlpath'
http.cookiefile:'file containing cookie lines which should be used in the Git http session::_files'
@@ -2695,6 +2871,7 @@ __git_config_option-or-value () {
instaweb.local:'bind to 127.0.0.1::->bool:false'
instaweb.modulepath:'module path for the Apache HTTP-daemon for instaweb:module directory:_directories'
instaweb.port:'port to bind HTTP daemon to for instaweb::_ports'
+ interactive.diffFilter:"mark up diffs for human consumption:filter command:_cmdstring"
interactive.singlekey:'accept one-letter input without Enter::->bool:false'
log.abbrevCommit:'make git-log, git-show, and git-whatchanged assume --abbrev-commit::->bool:false'
log.date:'default date-time mode::__git_date_formats'
@@ -2712,7 +2889,9 @@ __git_config_option-or-value () {
merge.defaultToUpstream:'merge the upstream branches configured for the current branch by default::->bool:true'
merge.ff:'allow fast-forward merges::->merge.ff:true'
merge.log:'include summaries of merged commits in new merge commit messages::->bool:false'
- merge.renameLimit:'number of files to consider when detecting copy/renames during merge:limit:->int'
+ merge.directoryRenames:"try to detect directory renames:mode:compadd false true conflict"
+ merge.renames:"try to detect renames::->diff.renames"
+ merge.renameLimit:'number of files to consider when detecting copy/renames during merge:limit (number of files):->int'
merge.renormalize:'use canonical representation of files during merge::->bool:false'
merge.stat:'print the diffstat between ORIG_HEAD and merge at end of merge::->bool:true'
merge.tool:'tool used by git mergetool during merges::__git_mergetools'
@@ -2748,10 +2927,13 @@ __git_config_option-or-value () {
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'
+ push.pushOption:'transmit strings to server to pass to pre/post-receive hooks::->string'
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.instructionFormat:'interactive rebase todo list format::__git_format_placeholders'
rebase.missingCommitsCheck:'print a warning if some commits are removed'
+ rebase.rescheduleFailedExec:"automatically re-schedule any 'exec' that fails::->bool"
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'
@@ -2767,6 +2949,7 @@ __git_config_option-or-value () {
'remote.*.promisor:use this remote to fetch promisor objects::->bool:false'
'remote.*.pushurl:push URL of a remote repository::__git_any_repositories'
'remote.*.proxy:URL of proxy to use for a remote repository::_urls'
+ "remote.*.pruneTags:maintain one-to-one correspondence with remote's tag refs::->bool:false"
'remote.*.prune:remove any remote tracking branches that no longer exist remotely::->bool:false'
'remote.*.fetch:default set of refspecs for git fetch::__git_ref_specs_fetchy'
'remote.*.push:default set of refspecs for git push::__git_ref_specs_pushy'
@@ -2777,9 +2960,13 @@ __git_config_option-or-value () {
'remote.*.uploadpack:default program to execute on remote when fetching:git upload-pack command:_cmdstring'
'remote.*.tagopt:options for retrieving remote tags::->remote.tagopt'
'remote.*.vcs:interact with the remote through git-remote helper:remote VCS:->string'
+ repack.packKeptObjects:'repack objects in packs marked with .keep::->bool'
+ repack.useDeltaIslands:'pass --delta-islands to git-pack-objects::->bool:false'
repack.usedeltabaseoffset:'use delta-base offsets::->bool:true'
+ repack.writeBitmaps:'trade off disk space for faster subsequent repacks::->bool'
rerere.autoupdate:'update index after resolution::->bool:false'
rerere.enabled:'record resolved conflicts::->bool'
+ reset.quiet:'pass --quiet by default::->bool:false'
sendemail.identity:'default identity::__git_sendemail_identities'
sendemail.smtpencryption:'encryption method to use::->sendemail.smtpencryption'
sendemail.aliasesfile:'file containing email aliases:email aliases file:_files'
@@ -2788,13 +2975,15 @@ __git_config_option-or-value () {
sendemail.bcc:'value of Bcc\: header::_email_addresses'
sendemail.cc:'value of Cc\: header::_email_addresses'
sendemail.cccmd:'command to generate Cc\: header with:Cc\: command:_cmdstring'
- sendemail.toccmd:'command to generate To\: header with:To\: command:_cmdstring'
+ sendemail.tocmd:'command to generate To\: header with:To\: command:_cmdstring'
sendemail.chainreplyto:'send each email as a reply to the previous one::->bool:false'
sendemail.confirm:'type of confirmation required before sending::->sendemail.confirm:auto'
sendemail.envelopesender:'envelope sender to send emails as::_email_addresses'
sendemail.from:'sender email address::_email_addresses'
sendemail.multiedit:'edit all files at once::->bool:true'
sendemail.signedoffbycc:'add Signed-off-by\: or Cc\: lines to Cc\: header::->bool:true'
+ sendemail.smtpBatchSize:"number of messages to send per SMTP connection::->int"
+ sendemail.smtpReloginDelay:"delay before reconnecting to SMTP server:delay (seconds):->int"
sendemail.smtppass:'password to use for SMTP-AUTH:password:->string'
sendemail.suppresscc:'rules for suppressing Cc\:::->sendemail.suppresscc'
sendemail.suppressfrom:'add From\: address to the Cc\: list::->bool:false'
@@ -2807,6 +2996,7 @@ __git_config_option-or-value () {
sendemail.smtpuser:'user to use for SMTP-AUTH:smtp user:_users'
sendemail.thread:'set In-Reply-To\: and References\: headers::->bool:true'
sendemail.validate:'perform sanity checks on patches::->bool:true'
+ sendemail.xmailer:'add the "X-Mailer" header::->bool:true'
'sendemail.*.aliasesfile:file containing email aliases::_files'
'sendemail.*.aliasfiletype:format of aliasesfile::->sendemail.aliasfiletype'
'sendemail.*.annotate:review and edit each patch you are about to send::bool->false'
@@ -2834,17 +3024,23 @@ __git_config_option-or-value () {
sendemail.assume8bitEncoding:'encoding to use for non-ASCII messages::__git_encodings'
sequence.editor:'text editor used by git rebase -i::_cmdstring'
showbranch.default:'default set of branches for git show-branch::->branch'
+ status.aheadBehind:"display detailed ahead/behind counts relative to upstream branch::->bool:true"
status.relativePaths:'show paths relative to current directory::->bool:false'
+ status.showStash:'show number of stashes::->bool:false'
status.showUntrackedFiles:'show untracked files::->status.showUntrackedFiles:normal'
status.submodulesummary:'include submodule summary::->bool:false'
status.branch:'show branch and tracking info in short format::->bool:false'
status.short:'use short format by default::->bool:false'
+ status.renameLimit:'number of files to consider when detecting copy/renames:limit (number of files):->int'
+ status.renames:"detect renames in 'status' and 'commit'::->diff.renames"
'submodule.*.branch:remote branch name for a submodule:branch name:->string'
'submodule.*.fetchRecurseSubmodules:fetch commits of submodules::->bool'
'submodule.*.path:path within project:submodule directory:_directories -qS \:'
'submodule.*.url:URL to update from::__git_any_repositories'
'submodule.*.update:update strategy to use::->submodule.update:none'
'submodule.*.ignore:ignore modifications to submodules with git status and git diff-*::->submodule.ignore'
+ submodule.recurse:'recurse into submodules by default (for most git commands)::->bool:false'
+ ssh.variant:'SSH command flavour:flavour id:compadd ssh simple plink putty tortoiseplink'
svn.noMetadata:'disable git-svn-id: lines at end of commits::->bool:false'
svn.useSvmProps:'use remappings of URLs and UUIDs from mirrors::->bool:false'
svn.useSvnsyncProps:'use remappings of URLs and UUIDs for the svnsync command::->bool:false'
@@ -2866,6 +3062,7 @@ __git_config_option-or-value () {
'svn-remote.*.pushurl:URL to push to::_urls'
'svn-remote.*.branches:branch mappings:branch mapping:->string'
'svn-remote.*.tags:tag mappings:tag mapping:->string'
+ tag.gpgSign:'sign all tags::->bool'
tag.sort:'default sorting method:sorting method:->string'
'tar.*.command:specify a shell command through which the tar output generated by git archive should be piped::_cmdstring'
'tar.*.remote:enable <format> for use by remote clients via git-upload-archive::->bool'
@@ -2885,6 +3082,8 @@ __git_config_option-or-value () {
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'
+
+ {fetch.fsck.skipList,receive.fsck.skipList,fsck.skipList}:'ignore objects broken in a non-fatal way:path to a list of objects:_files'
)
declare -a git_present_options # 'present' is an adjective
@@ -2907,12 +3106,13 @@ __git_config_option-or-value () {
pretty
remotes
${(u)${(M)${git_options%%:*}:#*[.][*][.]*}%%.*}
+ ${(u)${(M)git_present_options:#*[.][*][.]*}%%.*}
)
local key
for key in $git_present_options ; do
if (( ${+git_options[(r)(#i)${(b)key}:*]} )); then
# $key is already in git_options
- continue
+ continue
elif (( ${+sections_that_permit_arbitrary_subsection_names[(r)${(b)key%%.*}]} )); then
if [[ $key == *.*.* ]]; then
# If $key isn't an instance of a known foo.*.bar:baz $git_options entry...
@@ -2952,6 +3152,7 @@ __git_config_option-or-value () {
if compset -P '[^.]##.*.'; then
declare -a match mbegin mend
+ # TODO: completing 'gpg.openpgp<TAB>' adds both 'gpg.openpgp.program' and 'gpg.*.program' to $options, so it ends up being listed as 'unknown option name' even though we have a description
# When completing 'remote.foo.<TAB>', offer 'bar' if $git_options contains 'remote.foo.bar'.
options+=(${${${${(M)git_options:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]})
# When completing 'remote.foo.<TAB>', offer 'bar' if $git_options contains 'remote.*.bar'.
@@ -2989,8 +3190,8 @@ __git_config_option-or-value () {
elif compset -P '[^.]##.'; then
local opt
declare -a match mbegin mend
- for opt in ${${${${(M)git_options:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}; do
- if (( ${git_options[(I)${opt%%:*}.*]} )); then
+ for opt in ${${${${(M)git_options:#(#i)${IPREFIX}[^.:][^:]#:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}; do
+ if (( ${git_options[(I)${IPREFIX}${opt%%:*}.*]} )); then
sections_and_options+=$opt
else
options+=$opt
@@ -3073,7 +3274,7 @@ __git_config_option-or-value () {
;;
(*.)
local -a existing_subsections=( ${${${(M)git_present_options:#${IPREFIX}*.*}#${IPREFIX}}%.*} )
- _describe -t existing-subsections "existing subsections" existing_subsections -S . && ret=0
+ _describe -t existing-subsections "existing subsection" existing_subsections -S . && ret=0
;;
esac
else
@@ -3238,7 +3439,7 @@ __git_config_option-or-value () {
_message 'git-merge options'
;;
(bytes)
- __git_guard_bytes "$parts[2]" && ret=0
+ __git_guard_bytes "$parts[3]" && ret=0
;;
(color)
compset -P '* '
@@ -3319,16 +3520,6 @@ __git_config_option-or-value () {
__git_guard_number 'number of days'
fi
;;
- (days+now)
- # TODO: This needs to be improved.
- if [[ -n $current ]]; then
- compadd - $current && ret=0
- elif [[ -n $parts[5] ]]; then
- compadd - $parts[5] && ret=0
- else
- __git_guard_number 'number of days'
- fi
- ;;
(diff.algorithm)
__git_config_values -- "$current" "$parts[5]" \
default:'basic greedy diff algorithm' \
@@ -3408,7 +3599,7 @@ __git_config_option-or-value () {
elif [[ -n $parts[5] ]]; then
compadd - $parts[5] && ret=0
else
- __git_guard_number 'integer'
+ __git_guard_number ${parts[3]:-'integer'}
fi
;;
(merge.conflictstyle)
@@ -3528,7 +3719,7 @@ __git_config_option-or-value () {
(*)
# TODO: Do we need to set up a _requested/_next_label?
declare -a action
- _description values expl "$parts[2]"
+ _description values expl "$parts[3]"
eval "action=($parts[4])"
"$action[1]" "$expl[@]" "${(@)action[2,-1]}" && ret=0
;;
@@ -3560,11 +3751,12 @@ _git-fast-export () {
'--import-marks-if-exists=[load marks from file if it exists]: :_files' \
'--fake-missing-tagger=[fake a tagger when tags lack them]' \
'--use-done-feature[start with a "feature done" stanza, and terminate with a "done" command]' \
- '--no-data[do not output blocb objects, instead referring to them via their SHA-1 hash]' \
+ "--no-data[skip output of blob objects, instead referring to them via their SHA-1 hash]" \
'--full-tree[output full tree for each commit]' \
'(--get --get-all)--name-only[show variable names only]' \
'*--refspec=[apply refspec to exported refs]:refspec' \
'--anonymize[anonymize output]' \
+ '*--anonymize-map[apply conversion in anonymized output]:from\:to' \
'--reference-excluded-parents[reference parents not in fast-export stream by object id]' \
'--show-original-ids[show original object ids of blobs/commits]' \
'--mark-tags[label tags with mark ids]' \
@@ -3580,8 +3772,8 @@ _git-fast-import () {
now\:"use current time and timezone"' \
'--done[terminate with error if there is no "done" command at the end of the stream]' \
'--force[force updating modified existing branches]' \
- '--max-pack-size=-[maximum size of each packfile]: : __git_guard_bytes' \
- '--big-file-threshold=-[maximum size of blob to create deltas for]: : __git_guard_bytes' \
+ '--max-pack-size=-[maximum size of each packfile]: : __git_guard_bytes -d unlimited size' \
+ '--big-file-threshold=-[maximum size of blob to create deltas for]: : __git_guard_bytes -d 512m size' \
'--depth=-[maximum delta depth for blob and tree deltification]: :__git_guard_number "maximum delta depth"' \
'--active-branches=-[maximum number of branches to maintain active at once]: :__git_guard_number "maximum number of branches"' \
'--export-marks=-[dump internal marks table when complete]: :_files' \
@@ -3691,10 +3883,9 @@ _git-reflog () {
case $line[1] in
(expire)
- # TODO: -n, --dry-run is undocumented.
_arguments -S \
- '(-n --dry-run)'{-n,--dry-run}'[undocumented]' \
- '--stale-fix[TODO\: provide a decent description for this option]' \
+ '(-n --dry-run)'{-n,--dry-run}"[don't actually prune any entries; show what would be pruned]" \
+ '--stale-fix[prune any reflog entries that point to "broken commits"]' \
'--expire=-[prune entries older than given time]: :__git_datetimes' \
'--expire-unreachable=-[prune entries older than given time and unreachable]: :__git_datetimes' \
'--all[prune all refs]' \
@@ -3703,9 +3894,8 @@ _git-reflog () {
'--verbose[output additional information]' && ret=0
;;
(delete)
- # TODO: -n, --dry-run is undocumented.
_arguments -C -S \
- '(-n --dry-run)'{-n,--dry-run}'[undocumented]' \
+ '(-n --dry-run)'{-n,--dry-run}"[dpn't update entries; show what would be done]" \
'--updateref[update ref with SHA-1 of top reflog entry after expiring or deleting]' \
'--rewrite[adjust reflog entries to ensure old SHA-1 points to new SHA-1 of previous entry after expiring or deleting]' \
'--verbose[output additional information]' \
@@ -3840,7 +4030,6 @@ _git-remote () {
(( $+functions[_git-repack] )) ||
_git-repack () {
- # TODO: --quiet is undocumented.
_arguments -s \
'(-A --unpack-unreachable)-a[pack all objects into a single pack]' \
'(-a -k --keep-unreachable)-A[pack all objects into a single pack, but unreachable objects become loose]' \
@@ -3861,7 +4050,9 @@ _git-repack () {
'--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]' \
- '--keep-pack=[ignore named pack]:pack'
+ '--keep-pack=[ignore named pack]:pack' \
+ '(-g --geometric)'{-g+,--geometric=}'[find a geometric progression with specified factor]:factor' \
+ '(-m --write-midx)'{-m,--write-midx}'[write a multi-pack index of the resulting packs]'
}
(( $+functions[_git-replace] )) ||
@@ -3923,7 +4114,6 @@ _git-blame () {
'--ignore-revs-file=[ignore revisions from file]:file:_files' \
'(--color-by-age)--color-lines[color redundant metadata from previous line differently]' \
'(--color-lines)--color-by-age[color lines by age]' \
- '--indent-heuristic[use indent-based heuristic to improve diffs]' \
$revision_options \
':: :__git_revisions' \
': :__git_cached_files' && ret=0
@@ -3946,12 +4136,18 @@ _git-blame () {
return ret
}
+(( $+functions[_git-bugreport] )) ||
+_git-bugreport() {
+ _arguments \
+ '(-o --output-directory)'{-o+,--output-directory=}'[specify a destination for the bugreport file]:directory:_directories' \
+ '(-s --suffix)'{-s+,--suffix=}'[specify a strftime format suffix for the filename]:format:_date_formats'
+}
+
(( $+functions[_git-cherry] )) ||
_git-cherry () {
- # TODO: --abbrev is undocumented.
_arguments -S $endopt \
'(-v --verbose)'{-v,--verbose}'[output additional information]' \
- '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \
+ '--abbrev=[use specified digits to display object names]:digits' \
':upstream commit:__git_commits' \
'::head commit:__git_commits' \
'::limit commit:__git_commits'
@@ -4015,7 +4211,7 @@ _git-help () {
'(-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 cli core-tutorial cvs-migration diffcore everyday glossary hooks ignore modules namespaces repository-layout revisions tutorial tutorial-2 workflows)"'
+ ': : _alternative commands:command:_git_commands "guides:git guide:(attributes cli core-tutorial cvs-migration diffcore everyday glossary hooks ignore modules namespaces repository-layout revisions tutorial tutorial-2 workflows)"'
}
(( $+functions[_git-instaweb] )) ||
@@ -4063,7 +4259,6 @@ _git-rerere () {
local curcontext=$curcontext state line ret=1
declare -A opt_args
- # TODO: --rerere-autoupdate is undocumented.
_arguments -C -S -s $endopt \
'--rerere-autoupdate[register clean resolutions in index]' \
': :->command' && ret=0
@@ -4352,7 +4547,8 @@ _git-send-email () {
'--8bit-encoding=[encoding to use for non-ASCII messages]: :__git_encodings' \
'--compose-encoding=[encoding to use for compose messages]: :__git_encodings' \
'--transfer-encoding=[specify transfer encoding to use]:transfer encoding:(quoted-printable 8bit base64)' \
- '--envelope-sender[specify the envelope sender used to send the emails]: :_email_addresses' \
+ '--envelope-sender=[specify the envelope sender used to send the emails]: :_email_addresses' \
+ '--sendmail-cmd=[specify command to run to send email]:command:_cmdstring' \
'--smtp-encryption=[specify encryption method to use]: :__git_sendemail_smtpencryption_values' \
'--smtp-domain=[specify FQDN used in HELO/EHLO]: :_domains' \
'--smtp-pass=[specify password to use for SMTP-AUTH]::password' \
@@ -4441,7 +4637,6 @@ _git-svn () {
case $line[1] in
(clone|dcommit|fetch|init|migrate|rebase|set-tree)
- # TODO: --ignore-refs is undocumented.
# TODO: --no-auth-cache is undocumented.
# TODO: --config-dir is undocumented.
opts+=(
@@ -4644,8 +4839,9 @@ _git-svn () {
;;
(rebase)
opts+=(
- '(-l --local)'{-l,--local}"[don't fetch remotely, rebase against the last fetched commit from SVN]"
- '(--preserve-merges -p)'{--preserve-merges,-p}'[try to recreate merges instead of ignoring them]'
+ '(-l --local)'{-l,--local}"[don't fetch remotely, rebase against the last fetched commit from SVN]"
+ '!--preserve-merges'
+ '(--rebase-merges -p)'{--rebase-merges,-p}'[try to recreate merges instead of ignoring them]'
)
;;
(reset)
@@ -4744,13 +4940,15 @@ _git-commit-graph() {
if [[ $words[2] = write ]]; then
args=( $progress
'(--split --size-multiple --max-commits --expire-time)--append[include all commits present in existing commit-graph file]'
- '(--append)--split[write the commit-graph as a chain of multiple commit-graph files]'
+ '--changed-paths[enable computation for changed paths]'
+ '(--append)--split=-[write the commit-graph as a chain of multiple commit-graph files]::strategy:(no-merge replace)'
'(--stdin-packs --stdin-commits)--reachable[walk commits starting at all refs]'
'(--reachable --stdin-commits)--stdin-packs[only walk objects in pack-indexes read from input]'
'(--reachable --stdin-packs)--stdin-commits[walk commits starting at commits read from input]'
'(--append)--size-multiple=:commits [2]'
'(--append)--max-commits=:commits'
'(--append)--expire-time=:date/time:__git_datetimes'
+ '--max-new-filters=[specify maximum number of changed-path bloom filters to compute]:'
)
elif [[ $words[2] = verify ]]; then
args=( $progress
@@ -4760,7 +4958,7 @@ _git-commit-graph() {
_arguments -S $endopt $args \
'--object-dir=[specify location of packfiles and commit-graph file]:directory:_directories' \
- '(-h)1:verb:(read verify write)'
+ '(-h)1:verb:(verify write)'
}
(( $+functions[_git-commit-tree] )) ||
@@ -4806,6 +5004,8 @@ _git-index-pack () {
_arguments \
'-v[display progress on stderr]' \
'-o[write generated pack index into specified file]: :_files' \
+ '(--no-rev-index)--rev-index[generate a reverse index corresponding to the given pack]' \
+ "(--rev-index)--no-rev-index[don't generate a reverse index corresponding to the given pack]" \
'--stdin[read pack from stdin and instead write to specified file]' \
$stdin_opts \
'--strict[die if the pack contains broken objects or links]' \
@@ -4826,8 +5026,6 @@ _git-merge-file () {
label_opt="*-L[label to use for the $ordinals[n_labels+1] file]:label"
fi
- # TODO: --marker-size in undocumented.
- # TODO: --diff3 is undocumented.
_arguments \
$label_opt \
'(-p --stdout)'{-p,--stdout}'[send merged file to standard output instead of overwriting first file]' \
@@ -4861,7 +5059,7 @@ _git-merge-index () {
(( $+functions[_git-mktag] )) ||
_git-mktag () {
- _message 'no arguments allowed; only accepts tags on standard input'
+ _arguments --no-strict
}
(( $+functions[_git-mktree] )) ||
@@ -4876,6 +5074,9 @@ _git-mktree () {
_git-multi-pack-index() {
_arguments \
'--object-dir=[specify location of git objects]:directory:_directories' \
+ '(--progress)--no-progress[turn progress off]' '!(--no-progress)--progress' \
+ '--stdin-packs[write a multi-pack index containing only pack index basenames provided on stdin]' \
+ '--refs-snapshot=[specify a file which contains a "refs snapshot" taken prior to repacking]:file:_files' \
'--batch-size=[during repack, select packs so as to have pack files of at least the specified size]:size' \
'1:verb:(write verify expire repack)'
}
@@ -4905,16 +5106,17 @@ _git-pack-objects () {
'--delta-base-offset[use delta-base-offset packing]' \
'--threads=-[specify number of threads for searching for best delta matches]: :__git_guard_number "number of threads"' \
'--non-empty[only create a package if it contains at least one object]' \
- '--revs[read revision arguments from standard input]' \
+ '(--stdin-packs)--revs[read revision arguments from standard input]' \
'(--revs)--unpacked[limit objects to pack to those not already packed]' \
- '(--revs)--all[include all refs as well as revisions already specified]' \
+ '(--revs --stdin-packs)--all[include all refs as well as revisions already specified]' \
'--reflog[include objects referred by reflog entries]' \
'--indexed-objects[include objects referred to by the index]' \
+ '(--revs --all --keep-unreachable --pack-loose-unreachable --unpack-unreachable)--stdin-packs[read packs from stdin]' \
'(: --max-pack-size)--stdout[output pack to stdout]' \
'--include-tag[include unasked-for annotated tags if object they reference is included]' \
- '(--unpack-unreachable)--keep-unreachable[keep unreachable ]' \
- '--pack-loose-unreachable[pack loose unreachable objects]' \
- '(--keep-unreachable)--unpack-unreachable=-[unpack unreachable objects newer than specified time]::time' \
+ '(--revs --stdin-packs --unpack-unreachable)--keep-unreachable[add objects unreachable from refs in packs named with --unpacked to resulting pack]' \
+ '(--revs --stdin-packs)--pack-loose-unreachable[pack unreachable loose objects]' \
+ '(--revs --stdin-packs --keep-unreachable)--unpack-unreachable=-[keep unreachable objects in loose form]::time' \
'--sparse[use sparse reachability algorithm]' \
'--include-tag[include tag objects that refer to objects to be packed]' \
$thin_opt \
@@ -4929,6 +5131,7 @@ _git-pack-objects () {
'--missing=[specify how missing objects are handled]:action:(error allow-any allow-promisor print)' \
"--exclude-promisor-objects[don't pack objects in promisor packfiles]" \
'--delta-islands[respect islands during delta compression]' \
+ '--uri-protocol=[exclude any configured uploadpack.blobpackfileuri with given protocol]:protocol' \
':base-name:_files'
}
@@ -5029,6 +5232,7 @@ _git-update-index () {
'(-q --unmerged --ignore-missing --refresh)--really-refresh[refresh index, unconditionally checking stat information]' \
'( --no-skip-worktree)--skip-worktree[set "skip-worktree" bit for given paths]' \
'(--skip-worktree )--no-skip-worktree[unset "skip-worktree" bit for given paths]' \
+ "--ignore-skip-worktree-entries[don't touch index-only entries]" \
'(-)'{-g,--again}'[run git-update-index on differing index entries]' \
'(-)--unresolve[restore "unmerged" or "needs updating" state of files]' \
'--info-only[only insert files object-IDs into index]' \
@@ -5209,6 +5413,14 @@ _git-for-each-ref () {
':: :_guard "([^-]?#|)" pattern'
}
+(( $+functions[_git-for-each-repo] )) ||
+_git-for-each-repo() {
+ _arguments -S \
+ '(-C --config)'{-C,--config=}'[specify config variable for list of paths]:config variable' \
+ ':git command:_git_commands' \
+ '*:: := _git'
+}
+
(( $+functions[_git-ls-files] )) ||
_git-ls-files () {
local no_empty_directory_opt=
@@ -5217,7 +5429,6 @@ _git-ls-files () {
no_empty_directory_opt="--no-empty-directory[don't list empty directories]"
fi
- # TODO: --resolve-undo is undocumented.
# TODO: Replace _files with something more intelligent based on seen options.
# TODO: Apply excludes like we do for git-clean.
_arguments -S -s $endopt \
@@ -5231,8 +5442,9 @@ _git-ls-files () {
'--eol[show line endings of files]' \
$no_empty_directory_opt \
'(-s --stage -u --unmerged --with-tree)'{-u,--unmerged}'[show unmerged files in output]' \
+ '--resolve-undo[show resolve-undo information]' \
'(-k --killed)'{-k,--killed}'[show killed files in output]' \
- '-z[use NUL termination on output]' \
+ '-z[separate paths with the NUL character]' \
'*'{-x,--exclude=-}'[skip files matching given pattern]:file pattern' \
'*'{-X,--exclude-from=-}'[skip files matching patterns in given file]: :_files' \
'*--exclude-per-directory=-[skip directories matching patterns in given file]: :_files' \
@@ -5243,8 +5455,9 @@ _git-ls-files () {
'(-v)-f[indicate status of each file using lowercase for fsmonitor clean files]' \
'--full-name[force paths to be output relative to the project top directory]' \
'--recurse-submodules[recurse through submodules]' \
- '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \
+ '--abbrev=[use specified digits to display object names]:digits' \
'--debug[show debugging data]' \
+ '--deduplicate[suppress duplicate entries]' \
'*:: :_files'
}
@@ -5275,10 +5488,10 @@ _git-ls-tree () {
'(-t)-d[do not show children of given tree (implies -t)]' \
'-r[recurse into subdirectories]' \
'-t[show tree entries even when going to recurse them]' \
- '(-l --long)'{-l,--long}'[show object size of blob entries]' \
+ '(-l --long --name-only --name-status)'{-l,--long}'[show object size of blob entries]' \
'-z[use NUL termination on output]' \
- '(--name-only --name-status)'{--name-only,--name-status}'[list only filenames, one per line]' \
- '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \
+ '(--name-only --name-status --abbrev)'{--name-only,--name-status}'[list only filenames, one per line]' \
+ '(--name-only --name-status)--abbrev=[use specified digits to display object names]:digits' \
'--full-name[output full path-names]' \
'(--full-name)--full-tree[do not limit listing to current working-directory]' \
': :__git_tree_ishs' \
@@ -5326,7 +5539,7 @@ _git-pack-redundant () {
'(:)--all[process all packs]' \
'--alt-odb[do not require objects to be present in local packs]' \
'--verbose[output some statistics to standard error]' \
- '(--all)*::packs:_files -g "*.pack(-.)"'
+ '(--all)*::pack:_files -g "*.pack(-.)"'
}
(( $+functions[_git-rev-list] )) ||
@@ -5381,8 +5594,9 @@ _git_rev-list_filters() {
}
(( $+functions[_git-show-index] )) ||
-_git-show-index () {
- _message 'no arguments allowed; accepts index file on standard input'
+_git-show-index() {
+ _arguments \
+ '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)'
}
(( $+functions[_git-show-ref] )) ||
@@ -5395,7 +5609,7 @@ _git-show-ref () {
'(-d --dereference)'{-d,--dereference}'[dereference tags into object IDs as well]' \
'(-s --hash)'{-s+,--hash=-}'[only show the SHA-1 hash, not the reference name]:: :__git_guard_number length' \
'--verify[enable stricter reference checking]' \
- '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \
+ '--abbrev=[use specified digits to display object names]:digits' \
'(-q --quiet)'{-q,--quiet}'[do not print any results]' \
'*: :_guard "([^-]?#|)" pattern' \
- exclude \
@@ -5424,6 +5638,7 @@ _git-verify-pack () {
_arguments -S -s $endopt \
'(-v --verbose)'{-v,--verbose}'[show objects contained in pack]' \
'(-s --stat-only)'{-s,--stat-only}'[do not verify pack contents; only display histogram of delta chain length]' \
+ '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)' \
'*:index file:_files -g "*.idx(-.)"'
}
@@ -5502,14 +5717,14 @@ _git-send-pack () {
'(-q --quiet)'{-q,--quiet}'[be more quiet]' \
'(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[specify path to git-receive-pack on remote side]:remote path' \
'--remote[specify remote name]:remote' \
- '--all[update all refs that exist locally]' \
+ '(*)--all[update all refs that exist locally]' \
'(-n --dry-run)'{-n,--dry-run}'[do everything except actually sending the updates]' \
'--mirror[mirror all refs]' \
'(-f --force)'{-f,--force}'[update remote orphaned refs]' \
"(--no-signed --signed)--sign=-[GPG sign the push]::signing enabled:(($^^sign))" \
'(--no-signed --sign)--signed[GPG sign the push]' \
"(--sign --signed)--no-signed[don't GPG sign the push]" \
- '--push-option=[specify option to transmit]:option' \
+ '*--push-option=[specify option to transmit]:option' \
'--progress[force progress reporting]' \
'--thin[send a thin pack]' \
'--atomic[request atomic transaction on remote side]' \
@@ -5517,6 +5732,7 @@ _git-send-pack () {
'--stdin[read refs from stdin]' \
'--helper-status[print status from remote helper]' \
'--force-with-lease=[require old value of ref to be at specified value]:refname\:expect' \
+ '--force-if-includes[require remote updates to be integrated locally]' \
': :__git_any_repositories' \
'*: :__git_remote_references'
}
@@ -5536,8 +5752,10 @@ _git-http-fetch () {
'-v[report what is downloaded]' \
'-w[write commit-id into the filename under "$GIT_DIR/refs/<filename>"]:filename' \
'--recover[recover from a failed fetch]' \
- '(1)--stdin[read commit ids and refs from standard input]' \
- ': :__git_commits' \
+ '(1 --packfile)--stdin[read commit ids and refs from standard input]' \
+ '!(1 --stdin)--packfile=:hash' \
+ '!--index-pack-args=:args' \
+ '1: :__git_commits' \
': :_urls'
}
@@ -5558,12 +5776,9 @@ _git-http-push () {
(( $+functions[_git-receive-pack] )) ||
_git-receive-pack () {
- # TODO: --advertise-refs is undocumented.
- # TODO: --stateless-rpc is undocumented.
_arguments -S -A '-*' $endopt \
'(-q --quiet)'{-q,--quiet}'[be quiet]' \
- '--advertise-refs[undocumented]' \
- '--stateless-rpc[undocumented]' \
+ '--stateless-rpc[quit after a single request/response exchange]' \
':directory to sync into:_directories'
}
@@ -5708,8 +5923,10 @@ _git-mailinfo () {
'(-u --encoding)--encoding=-[encode commit information in given encoding]: :__git_encodings' \
'-n[disable all charset re-coding of metadata]' \
'(-m --message-id)'{-m,--message-id}'[copy the Message-ID header at the end of the commit message]' \
+ '-n[disable charset re-coding of metadata]' \
'( --no-scissors)--scissors[remove everything in body before a scissors line]' \
'(--scissors )--no-scissors[do not remove everything in body before a scissors line]' \
+ '--quoted-cr=[specify action when quoted CR is found]:action [warn]:(nowarn warn strip)' \
'--no-inbody-headers[undocumented]' \
':message file:_files' \
':patch file:_files'
@@ -5910,6 +6127,7 @@ _git_commands () {
gui:'run portable graphical interface to git'
init:'create empty git repository or re-initialize an existing one'
log:'show commit logs'
+ maintenance:'run tasks to optimize Git repository data'
merge:'join two or more development histories together'
mv:'move or rename file, directory, or symlink'
notes:'add or inspect object notes'
@@ -5923,6 +6141,7 @@ _git_commands () {
rm:'remove files from the working tree and from the index'
shortlog:'summarize git log output'
show:'show various types of objects'
+ sparse-checkout:'initialize and modify the sparse-checkout'
stash:'stash away changes to dirty working directory'
status:'show working-tree status'
submodule:'initialize, update, or inspect submodules'
@@ -5946,6 +6165,7 @@ _git_commands () {
ancillary_interrogator_commands=(
blame:'show what revision and author last modified each line of a file'
+ bugreport:'collect information for user to file a bug report'
count-objects:'count unpacked objects and display their disk consumption'
difftool:'show changes using common diff tools'
fsck:'verify connectivity and validity of objects in database'
@@ -5980,7 +6200,7 @@ _git_commands () {
index-pack:'build pack index file for an existing packed archive'
merge-file:'run a three-way file merge'
merge-index:'run merge for files needing merging'
- mktag:'create tag object'
+ mktag:'create tag object with extra validation'
mktree:'build tree-object from git ls-tree formatted text'
multi-pack-index:'write and verify multi-pack-indexes'
pack-objects:'create packed archive of objects'
@@ -5999,6 +6219,7 @@ _git_commands () {
diff-index:'compare content and mode of blobs between index and repository'
diff-tree:'compare content and mode of blobs found via two tree objects'
for-each-ref:'output information on each ref'
+ for-each-repo:'run a git command on a list of repositories'
get-tar-commit-id:'extract commit ID from an archive created using git archive'
ls-files:'information about files in index/working directory'
ls-remote:'show references in a remote repository'
@@ -6046,8 +6267,8 @@ _git_commands () {
zstyle -a :completion:$curcontext: user-commands user_commands
local command
- for command in $_git_third_party_commands; do
- (( $+commands[git-${command%%:*}] )) && third_party_commands+=$command
+ for command in ${(k)_git_third_party_commands}; do
+ (( $+commands[git-${command}] )) && third_party_commands+=$command$_git_third_party_commands[$command]
done
local -a aliases
@@ -6207,6 +6428,16 @@ __git_merge_strategies () {
"git merge -s '' 2>&1")"}:#[Aa]vailable (custom )#strategies are: *}#[Aa]vailable (custom )#strategies are: }%.}:-octopus ours recursive resolve subtree}
}
+(( $+functions[_git_strategy_options] )) ||
+_git_strategy_options() {
+ _values "strategy option" ours theirs ignore-space-change \
+ ignore-all-space ignore-space-at-eol ignore-cr-at-eol \
+ renormalize no-renormalize \
+ 'find-renames::similarity threshold' \
+ subtree:path \
+ 'diff-algorithm:algorithm:(patience minimal histogram myers)'
+}
+
(( $+functions[__git_encodings] )) ||
__git_encodings () {
# TODO: Use better algorithm, as shown in iconv completer (separate it to a
@@ -6359,6 +6590,31 @@ __git_daemon_service () {
_describe -t services service services $*
}
+(( $+functions[_git_log_line_ranges] )) ||
+_git_log_line_ranges() {
+ local sep pos=start op=( / : )
+ if compset -P '*[^,^]:'; then
+ __git_tree_files ${PREFIX:-.} HEAD
+ else
+ compset -P 1 '*,' && pos=end
+ if compset -P '(^|):'; then
+ _message -e functions function
+ elif compset -P '(^|)/'; then
+ _message -e patterns regex
+ else
+ zstyle -s ":completion:${curcontext}:forms" list-separator sep || sep=--
+ sep=' -- '
+ sep="${(q)sep}"
+ _guard "[0-9]#" "$pos line number" && return
+ compset -P \^ || op+=( \^ )
+ _wanted forms expl form compadd -S '' -d "(
+ /\ $sep\ regex
+ :\ $sep\ function
+ ^\ $sep\ search\ from\ start\ of\ file )" $op
+ fi
+ fi
+}
+
(( $+functions[__git_log_decorate_formats] )) ||
__git_log_decorate_formats () {
declare -a log_decorate_formats
@@ -6716,14 +6972,12 @@ __git_heads_local () {
local f gitdir
declare -a heads
- heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads 2>/dev/null)"})
+ heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads refs/bisect refs/stash 2>/dev/null)"})
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
if __git_command_successful $pipestatus; then
for f in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
[[ -f $gitdir/$f ]] && heads+=$f
done
- [[ -f $gitdir/refs/stash ]] && heads+=stash
- [[ -f $gitdir/refs/bisect/bad ]] && heads+=bisect/bad
fi
__git_describe_commit heads heads-local "local head" "$@"
@@ -6847,6 +7101,16 @@ __git_recent_commits () {
return ret
}
+(( $+functions[_git_fixup] )) ||
+_git_fixup() {
+ local alts
+ alts=( 'commits: :__git_recent_commits' )
+ if ! compset -P '(amend|reword):'; then
+ alts+=( 'actions:action:compadd -S: amend reword' )
+ fi
+ _alternative $alts
+}
+
(( $+functions[__git_blob_objects] )) ||
__git_blob_objects () {
_guard '[[:xdigit:]](#c,40)' 'blob object name'
@@ -7084,27 +7348,34 @@ __git_files_relative () {
(( $+functions[__git_files] )) ||
__git_files () {
- local compadd_opts opts tag description gitcdup gitprefix files expl
+ local compadd_opts opts tag description gittoplevel gitprefix files expl
zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F:
zparseopts -D -E -a opts -- -cached -deleted -modified -others -ignored -unmerged -killed x+: --exclude+:
tag=$1 description=$2; shift 2
- gitcdup=$(_call_program gitcdup git rev-parse --show-cdup 2>/dev/null)
+ gittoplevel=$(_call_program toplevel git rev-parse --show-toplevel 2>/dev/null)
__git_command_successful $pipestatus || return 1
+ [[ -n $gittoplevel ]] && gittoplevel+="/"
gitprefix=$(_call_program gitprefix git rev-parse --show-prefix 2>/dev/null)
__git_command_successful $pipestatus || return 1
# TODO: --directory should probably be added to $opts when --others is given.
- local pref=$gitcdup$gitprefix$PREFIX
+ local pref=${(Q)${~PREFIX}}
+ [[ $pref[1] == '/' ]] || pref=$gittoplevel$gitprefix$pref
- # First allow ls-files to pattern-match in case of remote repository
- files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\*}:-.} 2>/dev/null)"})
+ # First allow ls-files to pattern-match in case of remote repository. Use the
+ # icase pathspec magic word to ensure that we support case-insensitive path
+ # completion for users with the appropriate matcher configuration
+ files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+:\(icase\)$pref\*}:-.} 2>/dev/null)"})
__git_command_successful $pipestatus || return
- # If ls-files succeeded but returned nothing, try again with no pattern
+ # If ls-files succeeded but returned nothing, try again with no pattern. Note
+ # that ls-files defaults to the CWD if not given a path, so if the file we
+ # were trying to add is in an *adjacent* directory, this won't return anything
+ # helpful either
if [[ -z "$files" && -n "$pref" ]]; then
files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- 2>/dev/null)"})
__git_command_successful $pipestatus || return
@@ -7206,7 +7477,6 @@ __git_changed_files () {
# which case it is relative to the repository root.
(( $+functions[__git_tree_files] )) ||
__git_tree_files () {
- local multi_parts_opts
local tree Path
integer at_least_one_tree_added
local -a tree_files compadd_opts
@@ -7219,11 +7489,12 @@ __git_tree_files () {
zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F:
- [[ "$1" == */ ]] && Path="$1" || Path="${1:h}/"
+ Path=${(M)1##(../)#}
+ [[ ${1##(../)#} = */* ]] && extra_args+=( -r )
shift
(( at_least_one_tree_added = 0 ))
- for tree in $*; do
- tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree -r ${(q)extra_args} --name-only -z ${(q)tree} 2>/dev/null)"})
+ for tree; do
+ tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree $extra_args --name-only -z ${(q)tree} $Path 2>/dev/null)"})
__git_command_successful $pipestatus && (( at_least_one_tree_added = 1 ))
done
@@ -7257,7 +7528,7 @@ __git_repositories () {
__git_local_repositories () {
local expl
- _wanted local-repositories expl 'local repositories' _directories
+ _wanted local-repositories expl 'local repository' _directories
}
(( $+functions[__git_repositories_or_urls] )) ||
@@ -7342,7 +7613,7 @@ __git_guard_number () {
(( $+functions[__git_guard_bytes] )) ||
__git_guard_bytes () {
- _guard '[[:digit:]]#([kKmMgG]|)' ${*:-size}
+ _numbers -u bytes ${*:-size} k m g
}
(( $+functions[__git_datetimes] )) ||
@@ -7375,8 +7646,31 @@ __git_setup_log_options () {
'( --no-follow)--follow[follow renames]'
'(--follow )--no-follow[do not follow renames]'
'--source[show which ref each commit is reached from]'
- '-L+[trace the evolution of a line range or regex within a file]:range'
+ '*-L+[trace evolution of line range, function or regex within a file]: :_git_log_line_ranges'
+ )
+}
+
+(( $+functions[__git_ws_error_highlight] )) ||
+__git_ws_error_highlight() {
+ _values -s , "kind of line" all default none context old new
+}
+
+(( $+functions[__git_color_moved] )) ||
+__git_color_moved() {
+ local -a __git_color_moved=(
+ no:"do not highlight 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"
)
+ _describe "mode" __git_color_moved
+}
+
+(( $+functions[__git_color_movedws] )) ||
+__git_color_movedws() {
+ _sequence compadd - no ignore-space-at-eol ignore-space-change ignore-all-space allow-indentation-change
}
(( $+functions[__git_setup_diff_options] )) ||
@@ -7425,13 +7719,8 @@ __git_setup_diff_options () {
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-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-color-moved-ws)--color-moved-ws=[configure how whitespace is ignored when performing move detection for --color-moved]:mode:_sequence compadd - no ignore-space-at-eol ignore-space-change ignore-all-space allow-indentation-change'
+ '(--color --no-color )--color-moved=-[color moved lines differently]::mode:__git_color_moved'
+ '(--no-color-moved-ws)--color-moved-ws=[configure how whitespace is ignored when performing move detection for --color-moved]:mode:__git_color_movedws'
"(--color-moved-ws)--no-color-moved-ws=[don't ignore whitespace when performing move detection]"
"--ita-invisible-in-index[hide 'git add -N' entries from the index]"
"!(--ita-invisible-in-index)--ita-visible-in-index"
@@ -7439,8 +7728,8 @@ __git_setup_diff_options () {
$exclusive_diff_options'--check[warn if changes introduce trailing whitespace or space/tab indents]'
'--full-index[show full object name of pre- and post-image blob]'
'(--full-index)--binary[in addition to --full-index, output binary diffs for git-apply]'
- '--ws-error-highlight=[specify where to highlight whitespace errors]: :_values -s , "kind of line" all default none context old new'
- '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length'
+ '--ws-error-highlight=[specify where to highlight whitespace errors]: :__git_ws_error_highlight'
+ '--abbrev=[use specified digits to display object names]:digits'
'(-B --break-rewrites)'{-B-,--break-rewrites=-}'[break complete rewrite changes into pairs of given size]:: :__git_guard_number size'
'(-M --find-renames)'{-M-,--find-renames=-}'[detect renames with given scope]:: :__git_guard_number size'
'(-C --find-copies)'{-C-,--find-copies=-}'[detect copies as well as renames with given scope]:: :__git_guard_number size'
@@ -7452,10 +7741,12 @@ __git_setup_diff_options () {
'--diff-filter=-[select certain kinds of files for diff]: :_git_diff_filters'
'-S-[look for differences that add or remove the given string]:string'
'-G-[look for differences whose added or removed line matches the given regex]:pattern'
- '--find-object=[look for differences that change the number of occurrences of the specified object]:object:__git_blobs'
'--pickaxe-all[when -S finds a change, show all changes in that changeset]'
'--pickaxe-regex[treat argument of -S as regular expression]'
'-O-[output patch in the order of glob-pattern lines in given file]: :_files'
+ '--rotate-to=[show the change in specified path first]:path:_directories'
+ '--skip-to=[skip the output to the specified path]:path:_directories'
+ '--find-object=[look for differences that change the number of occurrences of specified object]:object:__git_blobs'
'-R[do a reverse diff]'
'--relative=-[exclude changes outside and output relative to given directory]:: :_directories'
'(-a --text)'{-a,--text}'[treat all files as text]'
@@ -7463,9 +7754,10 @@ __git_setup_diff_options () {
'--ignore-cr-at-eol[ignore carriage-return at end of line]'
'(-b --ignore-space-change -w --ignore-all-space)'{-b,--ignore-space-change}'[ignore changes in amount of white space]'
'(-b --ignore-space-change -w --ignore-all-space)'{-w,--ignore-all-space}'[ignore white space when comparing lines]'
- '--ignore-blank-lines[do not show hunks that add or remove blank lines]'
+ '--ignore-blank-lines[ignore changes whose lines are all blank]'
+ \*{-I+,--ignore-matching-lines=}'[ignore changes whose lines all match regex]:regex'
'--no-indent-heuristic[disable heuristic that shifts diff hunk boundaries to make patches easier to read]'
- '--inter-hunk-context=[combine hunks closer than n lines]:n'
+ '--inter-hunk-context=[combine hunks closer than N lines]:number of lines'
'--output-indicator-new=[specify the character to indicate a new line]:character [+]'
'--output-indicator-old=[specify the character to indicate a old line]:character [-]'
'--output-indicator-context=[specify the character to indicate a context line]:character [ ]'
@@ -7479,11 +7771,8 @@ __git_setup_diff_options () {
'(--no-prefix)--dst-prefix=[use given prefix for destination]:prefix'
'--line-prefix=[prepend additional prefix to every line of output]:prefix'
'(--src-prefix --dst-prefix)--no-prefix[do not show any source or destination prefix]'
-
'(-c --cc)'{-c,--cc}'[combined diff format for merge commits]'
-
- # TODO: --output is undocumented.
- '--output[undocumented]:undocumented')
+ '--output=[output to a specific file]: :_files')
}
(( $+functions[__git_setup_diff_stage_options] )) ||
@@ -7500,13 +7789,15 @@ __git_setup_diff_stage_options () {
__git_format_placeholders() {
local sep
local -a disp names placeholders expl
- _describe -t formats format '( oneline:"commit-ids and subject of messages"
- short:"few headers and only subject of messages"
- medium:"most parts of messages"
- full:"all parts of commit messages"
- fuller:"like full and includes dates"
- email:"use email headers like From and Subject"
- raw:"the raw commits" )' -- '( format:"specify own format" )' -S ':' && return
+ _describe -t formats format '( oneline:"<hash> <title>"
+ short:"commit hash plus author and title headers"
+ medium:"like short plus author date header and full message"
+ full:"like medium with committer header instead of date"
+ fuller:"like full plus author and commit date headers"
+ reference:"<abbrev hash> (<title>, <short author date>)"
+ email:"email patch format"
+ mboxrd:"like email with From lines in message quoted with >"
+ raw:"entire commit object" )' -- '( format:"specify own format" )' -S ':' && return
compset -P 'format:'
compset -P '(%[^acgCG]|%?[^%]|[^%])#'
if compset -P '%C'; then
@@ -7672,7 +7963,7 @@ __git_setup_revision_options () {
'(--left-only --right-only --cherry-pick --cherry-mark --no-merges --merges --max-parents)--cherry[synonym for --right-only --cherry-mark --no-merges]'
'(-c --cc )--full-diff[show full commit diffs when using log -p, not only those affecting the given path]'
'--log-size[print log message size in bytes before the message]'
- '--use-mailmap[use mailmap file to map author and committer names and email]'
+ --{use-,}mailmap'[use mailmap file to map author and committer names and email]'
'--reflog[show all commits from reflogs]'
'--single-worktree[examine the current working tree only]'
@@ -7702,13 +7993,14 @@ __git_setup_merge_options () {
'(-n --no-stat)--stat[show a diffstat at the end of the merge]'
'(--stat -n --no-stat)'{-n,--no-stat}'[do not show diffstat at the end of the merge]'
'( --no-squash)--squash[merge, but do not commit]'
- '--signoff[add Signed-off-by:]'
+ '--autostash[automatically stash/stash pop before and after]'
+ '--signoff[add Signed-off-by: trailer]'
'(--squash )--no-squash[merge and commit]'
'--ff-only[refuse to merge unless HEAD is up to date or merge can be resolved as a fast-forward]'
'(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id'
"(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]"
- '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies'
- '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option'
+ '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies'
+ '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options'
'(--verify-signatures)--verify-signatures[verify the commits being merged or abort]'
'(--no-verify-signatures)--no-verify-signatures[do not verify the commits being merged]'
'(-q --quiet -v --verbose)'{-q,--quiet}'[suppress all output]'
@@ -7748,6 +8040,11 @@ __git_setup_fetch_options () {
'(-q --quiet)--progress[force progress reporting]'
'--show-forced-updates[check for forced-updates on all updated branches]'
'--set-upstream[set upstream for git pull/fetch]'
+ '--shallow-since=[deepen history of shallow repository based on time]:time' \
+ '*--shallow-exclude=[deepen history of shallow clone by excluding revision]:revision' \
+ '--deepen[deepen history of shallow clone]:number of commits' \
+ \*{-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' \
)
}
@@ -7938,6 +8235,8 @@ __git_diff-or-merge-tools () {
diffuse
ecmerge
emerge
+ examdiff
+ guiffy
gvimdiff
gvimdiff2
gvimdiff3
@@ -7951,6 +8250,7 @@ __git_diff-or-merge-tools () {
vimdiff
vimdiff2
vimdiff3
+ winmerge
xxdiff)
builtindifftools=($builtintools kompare)
@@ -8083,7 +8383,7 @@ _git() {
local -A git_aliases
local a k v
local endopt='!(-)--end-of-options'
- aliases=(${(0)"$(_call_program aliases git config -z --get-regexp '\^alias\.')"})
+ aliases=(${(0)"$(_call_program aliases git config -z --get-regexp '\^alias\\.')"})
for a in ${aliases}; do
k="${${a/$'\n'*}/alias.}"
v="${a#*$'\n'}"
@@ -8118,16 +8418,17 @@ _git() {
'(- :)--version[display version information]' \
'(- :)--help[display help message]' \
'-C[run as if git was started in given path]: :_directories' \
- '*-c[pass configuration parameter to command]: :->configuration' \
+ \*{-c,--config-env=}'[pass configuration parameter to command]: :->configuration' \
'--exec-path=-[path containing core git-programs]:: :_directories' \
'(: -)--man-path[print the manpath for the man pages for this version of Git and exit]' \
'(: -)--info-path[print the path where the info files are installed and exit]' \
'(: -)--html-path[display path to HTML documentation and exit]' \
'(-p --paginate -P --no-pager)'{-p,--paginate}'[pipe output into a pager]' \
'(-p --paginate -P --no-pager)'{-P,--no-pager}"[don't pipe git output into a pager]" \
- '--git-dir=-[path to repository]: :_directories' \
- '--work-tree=-[path to working tree]: :_directories' \
- '--namespace=-[set the Git namespace]:namespace' \
+ '--git-dir=[path to repository]: :_directories' \
+ '--work-tree=[path to working tree]: :_directories' \
+ '--namespace=[set the Git namespace]:namespace' \
+ '--super-prefix=[set a prefix which gives a path from above a repository down to its root]:path:_directories' \
'--bare[use $PWD as repository]' \
'--no-replace-objects[do not use replacement refs to replace git objects]' \
'--literal-pathspecs[treat pathspecs literally, rather than as glob patterns]' \
@@ -8140,7 +8441,8 @@ _git() {
;;
(option-or-argument)
curcontext=${curcontext%:*:*}:git-$words[1]:
- (( $+opt_args[--git-dir] )) && local -x GIT_DIR=$opt_args[--git-dir]
+ (( $+opt_args[--git-dir] )) && local -x GIT_DIR=${(Q)${~opt_args[--git-dir]}}
+ (( $+opt_args[--work-tree] )) && local -x GIT_WORK_TREE=${(Q)${~opt_args[--work-tree]}}
if ! _call_function ret _git-$words[1]; then
if [[ $words[1] = \!* ]]; then
words[1]=${words[1]##\!}
@@ -8173,7 +8475,7 @@ _git() {
}
# Load any _git-* definitions so that they may be completed as commands.
-declare -gUa _git_third_party_commands
+declare -gA _git_third_party_commands
_git_third_party_commands=()
local file input
@@ -8195,7 +8497,7 @@ for file in ${^fpath}/_git-*~(*~|*.zwc)(-.N); do
(( i++ ))
done < $file
- _git_third_party_commands+=$name$desc
+ _git_third_party_commands+=([$name]=$desc)
done
_git
diff --git a/Completion/Unix/Command/_gnupod b/Completion/Unix/Command/_gnupod
index f53ae6c59..22ccabb9d 100644
--- a/Completion/Unix/Command/_gnupod
+++ b/Completion/Unix/Command/_gnupod
@@ -30,8 +30,8 @@ case "$service" in
'(-b --set-bookmarkable)'{-b,--set-bookmarkable}'[set this song as bookmarkable (= Remember position)]'
--set-shuffleskip'[exclude this file in shuffle-mode]'
--set-compilation'[mark songs as being part of a compilation]'
- --min-vol-adj='[minimum volume adjustment allowed by ID3v2.4 RVA2 tag (range -100 to 100, default 0)]'
- --max-vol-adj='[maximum volume adjustment allowed by ID3v2.4 RVA2 tag (range -100 to 100, default 0)]'
+ --min-vol-adj='[minimum volume adjustment allowed by ID3v2.4 RVA2 tag]:adjustment (-100..100) [0]'
+ --max-vol-adj='[maximum volume adjustment allowed by ID3v2.4 RVA2 tag]:adjustment (-100..100) [0]'
--artwork='[use FILE as album cover]:artwork:_files'
'*:file to add:_files'
)
diff --git a/Completion/Unix/Command/_gnutls b/Completion/Unix/Command/_gnutls
index 6c9956b10..b9f91264d 100644
--- a/Completion/Unix/Command/_gnutls
+++ b/Completion/Unix/Command/_gnutls
@@ -37,6 +37,8 @@ case "$service" in
'--x509crlfile=[specify CRL file to use]:file:_files'
'*--x509keyfile=[specify X.509 key file to use]:file:_files'
'*--x509certfile=[specify X.509 certificate file to use]:file:_files'
+ '*--rawpkkeyfile=[specify private key file or URL to use]:file:_files'
+ '*--rawpkfile=[specify raw public-key file to use]:file:_files'
'(-l --list -p --port)'{-l,--list}'[print list of the supported algorithms/modes]'
'--keymatexport=[specify label used for exporting keying material]:label'
'--keymatexportsize=[specify size of the exported keying material]:size'
@@ -70,7 +72,8 @@ case "$service" in
'--fastopen[enable TCP Fast Open]'
"--print-cert[print peer's certificate in PEM format]"
"--save-cert=[save peer's certificate chain in the specified file in PEM format]:file:_files"
- "--save-ocsp=[save peer's OCSP status response in the provided file]:file:_files"
+ "(--save-ocsp-multi)--save-ocsp=[save peer's OCSP status response in the provided file]:file:_files"
+ "(--save-ocsp)--save-ocsp-multi=[save all peer's OCSP responses in the provided file]:file:_files"
'--save-server-trace=[save the server-side TLS message trace in the provided file]:file:_files'
'--save-client-trace=[save the client-side TLS message trace in the provided file]:file:_files'
'--dh-bits=[specify minimum number of bits allowed for DH]:bits'
@@ -93,6 +96,8 @@ case "$service" in
'--inline-commands-prefix=[change delimiter used for inline commands]:delimiter [^]'
'--fips140-mode[report status of FIPS140-2 mode in gnutls library]'
'--logfile=[redirect informational messages to a specific file]:file:_files'
+ '--waitresumption[block waiting for the resumption data under TLS1.3]'
+ '--ca-auto-retrieve[enable automatic retrieval of missing CA certificates]'
)
;;
@@ -109,6 +114,7 @@ case "$service" in
"--nodb[don't use a resumption database]"
'--http[act as an HTTP server]'
'--echo[act as an Echo server]'
+ "--crlf[don't replace CRLF by LF in Echo server mode]"
'(-a --disable-client-cert -r --require-client-cert)'{-a,--disable-client-cert}"[don't request a client certificate]"
'(-a --disable-client-cert -r --require-client-cert)'{-r,--require-client-cert}'[require a client certificate]'
'--verify-client-cert[if a client certificate is sent then verify it]'
@@ -144,7 +150,8 @@ case "$service" in
'--verify-crl[verify a CRL]'
'(--verify-email)--verify-hostname=[specify hostname to be used for certificate chain verification]:hostname:_hosts'
'(--verify-hostname)--verify-email=[specify email to be used for certificate chain verification]:email:_email_addresses'
- '--verify-purpose=[specify a purpose OID to be used for certificate chain verification]'
+ '--verify-purpose=[specify a purpose OID to be used for certificate chain verification]:purpose'
+ '--verify-profile=[specify a security level profile to be used for verification]:profile'
'--p7-sign[sign using a PKCS #7 structure]'
'--p7-detached-sign[sign using a detached PKCS #7 structure]'
"--no-p7-include-cert[don't include signer's certificate will in the cert list]"
diff --git a/Completion/Unix/Command/_go b/Completion/Unix/Command/_go
index 30a2bf88f..0b4b16dfa 100644
--- a/Completion/Unix/Command/_go
+++ b/Completion/Unix/Command/_go
@@ -15,4 +15,4 @@ case $service in
;;
esac
-_wanted files expl "input file" _files -g "$pat"
+_wanted files expl "input file" _files -g "$pat(-.)"
diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg
index b35693d1f..5d54865d5 100644
--- a/Completion/Unix/Command/_gpg
+++ b/Completion/Unix/Command/_gpg
@@ -173,7 +173,7 @@ fi
'--dump-options[show all options]'
)
-extra=( ${${${args#\([^\)]#\)}#\*}%%[:=\[]*} )
+extra=( ${${${args#\([^\)]#\)}#\*}%%[=:\[]*} )
extra=( ${allopts:|extra} )
_arguments -C -s -S -A "-*" $args $extra '*:args:->args' && ret=0
diff --git a/Completion/Unix/Command/_gprof b/Completion/Unix/Command/_gprof
index 3bb7a5765..a7e602fd5 100644
--- a/Completion/Unix/Command/_gprof
+++ b/Completion/Unix/Command/_gprof
@@ -3,8 +3,8 @@
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
-_arguments -C -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \
- -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name:->funcs' \
+_arguments -C -s -{a,b,c,D,h,i,l,L,r,s,T,v,w,x,y,z} \
+ -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,R,S,t,Z}:'function name:->funcs' \
'-I:directory:_dir_list' \
'-d-:debug level:' '-k:function names:->pair' \
'-m:minimum execution count:' \
diff --git a/Completion/Unix/Command/_gradle b/Completion/Unix/Command/_gradle
index 9a75daefb..a1d9381cb 100644
--- a/Completion/Unix/Command/_gradle
+++ b/Completion/Unix/Command/_gradle
@@ -1,9 +1,9 @@
#compdef gradle gradlew
local curcontext="$curcontext" ret=1 state state_descr line
-local gradle_inspect=yes cache_policy tag_order
+local gradle_inspect=yes cache_policy tag_order filter=
local -A opt_args
-local -a gradle_group_tasks gradle_all_tasks
+local -aU gradle_group_tasks gradle_all_tasks tasks
# Set the caching policy to invalidate cache if the build file is newer than the cache.
_gradle_caching_policy() {
@@ -78,35 +78,57 @@ if [[ $words[CURRENT] != -* ]]; then
local -a match mbegin mend
# Run gradle/gradlew and retrieve possible tasks.
for outputline in ${(f)"$($service --build-file $gradle_buildfile -q tasks --all)"}; do
- if [[ $outputline == [[:blank:]]#(#b)([[:alnum:]]##)' - '(*) ]]; then
+ # Subproject tasks are prefixed with one or more instances of [[:alnum:]]##\:
+ # Leaving out the prefix runs the task in all subprojects where it exists.
+ if [[ $outputline ==
+ [[:blank:]]#(#b)([[:alnum:]]##\:)#([[:alnum:]]##)' - '(*) ]]; then
# The descriptions of main tasks start at beginning of line, descriptions of
# secondary tasks are indented.
if [[ $outputline == [[:alnum:]]* ]]; then
- gradle_group_tasks+=( "$match[1]:$match[2]" )
+ gradle_group_tasks+=(
+ "$match[-2]:$match[-1]"
+ "${${(j::)match[1,-2]}//:/\:}:$match[-1]"
+ )
else
- gradle_all_tasks+=( "$match[1]:$match[2]" )
+ gradle_all_tasks+=(
+ "${${(j::)match[1,-2]}//:/\:}:$match[-1]"
+ )
fi
fi
done
_store_cache $cache_name gradle_group_tasks gradle_all_tasks
fi
+ filter=
+ zstyle -T ":completion:${curcontext}:tasks" prefix-needed &&
+ [[ $PREFIX != ([[:alnum:]]##\:)## ]] &&
+ filter+="*\:*"
if [[ $state == task ]]; then
_tags gradle_group gradle_all
while _tags; do
# Offer main tasks and secondary tasks in different tags.
- _requested gradle_group && _describe 'group tasks' gradle_group_tasks && ret=0
- _requested gradle_all && _describe 'secondary tasks' gradle_all_tasks && ret=0
+ if _requested gradle_group; then
+ tasks=( ${gradle_group_tasks:#$~filter} )
+ _describe -t tasks 'group task' tasks &&
+ ret=0
+ fi
+ if _requested gradle_all; then
+ tasks=( ${gradle_all_tasks:#$~filter} )
+ _describe -t tasks 'secondary task' tasks &&
+ ret=0
+ fi
(( ret )) || break
done
elif [[ $state == alltask ]]; then
# After '--exclude-task', we don't make a distinction between main tasks and
# secondary tasks.
- _describe 'all tasks' gradle_group_tasks -- gradle_all_tasks && ret=0
+ tasks=( ${gradle_group_tasks:#$~filter} ${gradle_all_tasks:#$~filter} )
+ _describe -t tasks 'task' tasks &&
+ ret=0
fi
fi
else
- _describe 'built-in tasks' '(
+ _describe 'built-in task' '(
"dependencies:Displays all dependencies declared in root project."
"dependencyInsight:Displays the insight into a specific dependency in root project."
"help:Displays a help message."
diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep
index 81516b08a..2dcbff4a3 100644
--- a/Completion/Unix/Command/_grep
+++ b/Completion/Unix/Command/_grep
@@ -1,6 +1,7 @@
-#compdef grep egrep fgrep bsdgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep bzgrep bzegrep bzfgrep -value-,GREP_OPTIONS,-default-
+#compdef grep egrep fgrep bsdgrep rgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep bzgrep bzegrep bzfgrep -value-,GREP_OPTIONS,-default-
-local arguments matchers command variant
+local command variant
+local -a arguments matchers
if [[ $service = *GREP_OPT* ]]; then
compset -q
@@ -27,6 +28,10 @@ if [[ $service != (|g|z|gz|bz)[ef]grep ]]; then
$matchers{--basic-regexp,-G}'[use basic regular expression]'
)
fi
+[[ $service = rgrep ]] || arguments+=(
+ '(--directories -d -r --recursive)'{--directories=,-d+}'[specify handling of directories]:action on directory:(read skip recurse)'
+ '(--recursive -r --dereference-recursive -R -d --directories)'{--recursive,-r}'[recurse subdirectories]'
+)
arguments+=(
'(--after-context -A)'{--after-context=,-A+}'[specify lines of trailing context]:lines'
@@ -37,7 +42,6 @@ arguments+=(
'(--byte-offset -b -c)'{--byte-offset,-b}'[print the byte offset with output lines]'
'(--text -a -I)--binary-files=[specify type to assume for binary files]:file type:(binary without-match text)'
'(--count -c --byte-offset -b --line-number -n)'{--count,-c}'[only print a count of matching lines]'
- '(--directories -d -r --recursive)'{--directories=,-d+}'[specify handling of directories]:action on directory:(read skip recurse)'
'(--devices -D)'{--devices=,-D+}'[specify handling of devices, FIFOs and sockets]:action on device:(read skip)'
'(1)*'{--regexp=,-e+}'[specify pattern]:pattern'
'(1)*'{--file=,-f+}'[specify pattern file]:file:_files'
@@ -53,11 +57,10 @@ arguments+=(
'(--line-number -n -c)'{--line-number,-n}'[prefix output with line numbers]'
'(--only-matching -o --files-with-matches -l --files-without-match -L)'{--only-matching,-o}'[show only matching part of line]'
'(--quiet --silent -q)'{--quiet,--silent,-q}'[suppress normal output]'
- '(--recursive -r --dereference-recursive -R -d --directories)'{--recursive,-r}'[recurse subdirectories]'
'*--include=[examine files matching specified pattern]:file pattern'
'*--exclude=[skip files matching specified pattern]:file pattern'
'*--exclude-dir=[skip directories matching specified pattern]:directory pattern'
- '(--no-messages -s)'{--no-messages,-s}'[suppress messages about unreadable]'
+ '(--no-messages -s)'{--no-messages,-s}'[suppress messages about unreadable or non-existent files]'
'(--version -V)'{--version,-V}'[display version info]'
'(--invert-match -v)'{--invert-match,-v}'[select non-matching lines]'
'(--word-regexp -w --line-regexp -x)'{--word-regexp,-w}'[force pattern to match only whole words]'
@@ -72,6 +75,12 @@ case $variant:$OSTYPE in
$matchers{--perl-regexp,-P}'[use perl regular expression]'
)
;|
+ *:openbsd*|unix:freebsd*)
+ arguments=( # argument to context is optional and after = only
+ ${arguments:#((#s)|*\))-(C|-context)*}
+ '(--context -C)'{--context=-,-C-}'[specify lines of context]::lines'
+ )
+ ;|
(gnu:*|gpl2:(free|net)bsd*))
arguments+=(
'*--exclude-from=[skip files matching pattern in specified file]:file:_files'
@@ -85,15 +94,15 @@ case $variant:$OSTYPE in
'(-Z --decompress -J --bz2decompress)'{-Z,--decompress}"[decompress gzip'ed input before searching]"
)
;|
- gpl2:darwin*)
+ (gpl2:darwin*|unix:freebsd*))
arguments+=(
- '(-p -S)-O[follow symlinks on the command line]'
- '(-O -S)-p[do not follow symlinks]'
- '(-O -p)-S[follow all symlinks]'
+ '(-p -S)-O[recurse symlinks on the command line]'
+ "!(-O -S)-p[don't recurse symlinks]"
+ '(-O -p)-S[recurse all symlinks]'
'*--include-dir=[only search directories matching specified pattern]:directory pattern'
)
;|
- (gnu:*|gpl2:netbsd*))
+ (gnu:*|gpl2:netbsd*|unix:freebsd*))
arguments+=(
'(--null -Z --no-filename -h)'{--null,-Z}'[print 0 byte after each filename]'
)
@@ -106,6 +115,15 @@ case $variant:$OSTYPE in
'(--recursive -r --dereference-recursive -R -d --directories)'{--dereference-recursive,-R}'[recurse subdirectories, following symlinks]'
)
;;
+ unix:freebsd*)
+ arguments+=(
+ '!(-U --binary --binary-files)'{-U,--binary}
+ '--mmap[use mmap(2) instead of read(2) to read input]'
+ )
+ [[ $service = rgrep ]] || arguments+=(
+ '(--recursive -r -d --directories)-R[recurse subdirectories]'
+ )
+ ;;
gpl2:*) arguments=( ${${arguments:#*\)-r}/\)-r/\)-R} ) ;;
*:openbsd*)
arguments=(
@@ -122,4 +140,3 @@ case $variant:$OSTYPE in
esac
_arguments -S -s $arguments[@]
-
diff --git a/Completion/Unix/Command/_growisofs b/Completion/Unix/Command/_growisofs
index 8f4da4030..206d2c2c7 100644
--- a/Completion/Unix/Command/_growisofs
+++ b/Completion/Unix/Command/_growisofs
@@ -270,7 +270,7 @@ else
'-sort[sort files on the image based on weights defined in the given file]:sort-weighting file:_files' \
'-sparc-label[set the sun disk-label-name used for the -sparc-boot option]:label' \
'-split-output[split the output image into several files ~1GiB in size]' \
- '-stream-media-size[enable streaming operation and set media size to given number of sectors]:media size in sectors' \
+ '-stream-media-size[enable streaming operation and set media size to given number of sectors]:media size (sectors)' \
'-stream-file-name[reserved for future use]:name' \
'-sunx86-boot[specify a comma-separated list of file-system images needed to make a bootable Solaris-x86-CD]:list' \
'-sunx86-label[specify the SVr4 disk-label-name for the SVr4 disk-label created with the -sunx86-boot option]:label' \
diff --git a/Completion/Unix/Command/_gzip b/Completion/Unix/Command/_gzip
index 42d4ae705..8354b34d4 100644
--- a/Completion/Unix/Command/_gzip
+++ b/Completion/Unix/Command/_gzip
@@ -9,10 +9,14 @@ files=( '*:files:->files' )
case "$service" in
unpigz|pigz)
pigz=(
- '(-K --zip)'{-K,--zip}'[compress to PKWare zip format]'
+ '(-A --alias)'{-A+,--alias=}'[specify filename to use in zip entry for stdin]:filename'
+ '(-C --comment)'{-C+,--comment=}'[put specified comment in the gzip or zip header]'
+ '(-H --huffman -U --rle)'{-H,--huffman}'[use only Huffman coding for compression]'
+ '(-U --rle -H --huffman)'{-U,--rle}'[use run-length encoding for compression]'
+ '(-K --zip -z --zlib)'{-K,--zip}'[compress to PKWare zip format]'
'(-b --blocksize)'{-b+,--blocksize}'[set compression block size]:size (KiB)'
'(-p --processes)'{-p,--processes}'[specify number of processes to use]'
- '(-z --zlib)'{-z,--zlib}'[compress to zlib (.zz) format]'
+ '(-z --zlib -K --zip)'{-z,--zlib}'[compress to zlib (.zz) format]'
'(-m --no-time)'{-m,--no-time}"[don't store/restore modification time in/from header]"
'(-M --time)'{-M,--time}"[store/restore modification time in/from header]"
'(--synchronous)-Y[force output file write to permanent storage]'
diff --git a/Completion/Unix/Command/_head b/Completion/Unix/Command/_head
index 1e968cc11..0771b1e4d 100644
--- a/Completion/Unix/Command/_head
+++ b/Completion/Unix/Command/_head
@@ -18,7 +18,13 @@ else
case $OSTYPE in
(freebsd*|darwin*|dragonfly*|netbsd*)
args+=( '(-n)-c+[display the first specified bytes]:number of bytes' )
- ;;
+ ;|
+ dragonfly*|netbsd*)
+ args+=(
+ '(-v)-q[never print headers giving file names]'
+ '(-q)-v[always print headers giving file names]'
+ )
+ ;;
esac
fi
@@ -26,20 +32,14 @@ _arguments -C -s -S $opts : $args '*:file:_files' && return 0
case $state in
(number)
- local mlt sign digit
- mlt='multiplier:multiplier:((b\:512 K\:1024 KB\:1000 M\:1024\^2'
- mlt+=' MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4))'
- sign='sign:sign:((-\:"print all but the last specified bytes/lines"'
- sign+=' +\:"print the first specified bytes/lines (default)"))'
- digit='digits:digit:(0 1 2 3 4 5 6 7 8 9)'
- if compset -P '(-|+|)[0-9]##'; then
- _alternative $mlt $digit && ret=0
- elif [[ -z $PREFIX ]]; then
- _alternative $sign $digit && ret=0
- elif compset -P '(+|-)'; then
- _alternative $digit && ret=0
- fi
- ;;
+ local alts
+ [[ -z $PREFIX ]] && alts=(
+ 'sign:sign:((-\:"print all but the last specified bytes/lines" +\:"print the first specified bytes/lines (default)"))'
+ )
+ compset -P '+'
+ alts+=( 'numbers: :_numbers -N $state_descr b\:512 K\:1024 KB\:1000 M\:1024\^2 MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4' )
+ _alternative $alts && ret=0
+ ;;
esac
return ret
diff --git a/Completion/Unix/Command/_imagemagick b/Completion/Unix/Command/_imagemagick
index 3afa108ae..b7671fe49 100644
--- a/Completion/Unix/Command/_imagemagick
+++ b/Completion/Unix/Command/_imagemagick
@@ -262,7 +262,10 @@ case "$service" in
_arguments -C -M 'm:{a-z}={A-Z}' \
'-adjoin[join images]' \
'-affine[drawing transform matrix]:matrix' \
+ '-alpha[set the alpha channel]:alpha' \
'-antialias[remove pixel aliasing]' \
+ '-authenticate[decrypt image with specified password]:password' \
+ '-attenuate[lessen (or intensify) when adding noise to an image]:value' \
'-append[append image sequence]' \
'-average[average image sequence]' \
'-background[specify background color]:color:_x_color' \
@@ -301,6 +304,7 @@ case "$service" in
'(-endian)+endian' \
'-enhance[enhance image]' \
'-equalize[histogram equalization]' \
+ '-features[analyze image features (e.g. contrast, correlation)]:distance' \
'-fill[specify color to use when filling a graphic primitive]:color:_x_color' \
'-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \
'-flatten[flatten a sequence of images]' \
@@ -315,12 +319,14 @@ case "$service" in
'-gravity:image gravity:(Center North NorthEast East SouthEast South SouthWest West NorthWest)' \
'-implode:implosion factor (0.0 - 99.9%%)' \
'-interlace:interlacing scheme:(None Line Plane Partition)' \
+ '-interpolative-resize[resize image using point sampled interpolation]:geometry' \
'-label:label string' \
'-layer:layer type:(Red Green Blue Matte)' \
'-linewidth:line width' \
'-loop:number of iterations (GIF animation)' \
'-map[single image colormap file]:picture file for colors:_imagemagick' \
'+map[all images colormap file]:picture file for colors:_imagemagick' \
+ '-mask[associate a mask with the image]:file:_files' \
'-matte[store matte channel]' \
'-modulate:<brightness>,<saturation>,<hue>' \
'-monochrome[transform to black and white]' \
@@ -352,6 +358,7 @@ case "$service" in
'-size:image size (<width>x<height>+<offset>)' \
'-solarize:solarization threshold' \
'-spread:neighborhood size' \
+ '-support[specify resize support]:support (>1.0 is blurry, < 1.0 is sharp)' \
'-swirl:swirl tightness' \
'-texture:background texture image:_imagemagick' \
'-threshold:threshold for maximum intensity' \
diff --git a/Completion/Unix/Command/_initctl b/Completion/Unix/Command/_initctl
index 2d7c2494b..b60bdbc5b 100644
--- a/Completion/Unix/Command/_initctl
+++ b/Completion/Unix/Command/_initctl
@@ -51,14 +51,14 @@ _initctl_known_events()
_initctl_multiple_known_events()
{
[[ ${#_initctl_events_list} -eq 0 ]] && _initctl_fillarray_events_args
- _values -s "," "Events" "$_initctl_events_list[@]"
+ _values -s "," "event" "$_initctl_events_list[@]"
}
# list KEY= arguments, generate array if necessary
_initctl_known_eventargs()
{
[[ ${#_initctl_eventargs_list} -eq 0 ]] && _initctl_fillarray_events_args
- _values "Argument Keys" "$_initctl_eventargs_list[@]"
+ _values "argument key" "$_initctl_eventargs_list[@]"
}
# describe and offer commands for initctl, then call matching completion function
@@ -82,7 +82,7 @@ _initctl_command()
)
if (( CURRENT == 1 )); then
- _describe -t command "initctl Commands" cmds
+ _describe -t command "initctl command" cmds
fi
local cmd=$words[1]
@@ -97,8 +97,8 @@ _initctl_startstop()
_arguments \
'--no-wait[do not wait for operation to complete before exiting]' \
"${common_args[@]}" \
- ':Upstart Jobs:_initctl_helper_jobs' \
- '*::Argument Keys:_initctl_known_eventargs'
+ ':upstart job:_initctl_helper_jobs' \
+ '*::argument key:_initctl_known_eventargs'
}
# completion for anything that takes one job
@@ -106,7 +106,7 @@ _initctl_argjob()
{
_arguments \
"${common_args[@]}" \
- ':Upstart Jobs:_initctl_helper_jobs' \
+ ':upstart job:_initctl_helper_jobs' \
'*::'
}
@@ -116,8 +116,8 @@ _initctl_emit()
_arguments \
'--no-wait[do not wait for event to finish before exiting]' \
"${common_args[@]}" \
- ':Events:_initctl_known_events' \
- '*::Argument Keys:_initctl_known_eventargs'
+ ':event:_initctl_known_events' \
+ '*::argument key:_initctl_known_eventargs'
}
# the fallback, just the options
@@ -133,7 +133,7 @@ _initctl_show-config()
_arguments \
"(-e --enumerate)"{-e,--enumerate}"[enumerate emit lines]" \
"${common_args[@]}" \
- '::Upstart Jobs:_initctl_helper_jobs' \
+ '::upstart job:_initctl_helper_jobs' \
'*::'
}
@@ -144,7 +144,7 @@ _initctl_check-config()
"(-i --ignore-events)"{-i,--ignore-events}"[list of comma-separated events to ignore]:Events:_initctl_multiple_known_events" \
"(-w --warn)"{-w,--warn}"[treat any unknown jobs or events as error]" \
"${common_args[@]}" \
- '::Upstart Jobs:_initctl_helper_jobs' \
+ '::upstart job:_initctl_helper_jobs' \
'*::'
}
@@ -157,7 +157,7 @@ _initctl()
'--system[talk via DBUS system bus instead of socket]'
'(-q --quiet)'{-q,--quiet}'[reduce output to errors only]'
'(-v --verbose)'{-v,--verbose}'[increase output to include informational messages]'
- '--dest=[D-Bus name for init, defaults to com.ubuntu.Upstart]'
+ '--dest=[specify D-Bus name for init]:D-Bus name [com.ubuntu.Upstart]'
'--help[display help and exit]'
'--version[output version information and exit]'
)
@@ -172,7 +172,7 @@ _initctl()
# depending on which command was used, call different completion functions
case $service in
initctl)
- _arguments "${common_args[@]}" '*::Initctl Commands:_initctl_command'
+ _arguments "${common_args[@]}" '*::initctl command:_initctl_command'
;;
start|stop|restart|reload|status)
_call_function ret _initctl_${cmd_completion_funcs[${service}]-${cmd_completion_default}}
diff --git a/Completion/Unix/Command/_install b/Completion/Unix/Command/_install
index 5ad84645e..364119961 100644
--- a/Completion/Unix/Command/_install
+++ b/Completion/Unix/Command/_install
@@ -106,7 +106,7 @@ case $state in
'a[symlinks use absolute path]'
'r[symlinks use relative path]'
)
- _values -S '' 'link flags' $tmp && ret=0
+ _values -S '' 'link flag' $tmp && ret=0
;;
esac
diff --git a/Completion/Unix/Command/_iostat b/Completion/Unix/Command/_iostat
index f5291a19b..1152b0d8b 100644
--- a/Completion/Unix/Command/_iostat
+++ b/Completion/Unix/Command/_iostat
@@ -128,10 +128,13 @@ case $OSTYPE:l in
'-c[display CPU utilization report]'
'-d[display device utilization report]'
'--dec=-[specify the number of decimal places to use]:decimal places [2]:(0 1 2)'
+ '-f[specify alternative directory to read device statistics from]:directory:_directories'
+ '+f[specify additional directory to read device statistics from]:directory:_directories'
'*-g[display statistics for a group of devices]:group name'
'-H[only display global statistics for group]'
'(--human)-h[human readable device utilization report]'
'--human[print sizes in human readable format]'
+ '--pretty[make report easier to read by a human]'
'-j[display persistent device name]:name type:(ID LABEL PATH UUID)'
'(-m)-k[display statistics in kB/s]'
'(-k)-m[display statistics in MB/s]'
diff --git a/Completion/Unix/Command/_java b/Completion/Unix/Command/_java
index ee0441d97..ff6e82645 100644
--- a/Completion/Unix/Command/_java
+++ b/Completion/Unix/Command/_java
@@ -24,18 +24,24 @@ javac)
'(-cp -classpath)'{-cp,-classpath}'[specify where to find user class files]:class path:->classpath' \
'-sourcepath[specify where to find input source files]:source path:->sourcepath' \
'-bootclasspath[override location of bootstrap class files]:bootstrap class path:->bootstrapclasspath' \
+ '-endorseddirs[override location of endorsed standards path]:path:->extdirs' \
'-extdirs[override location of installed extensions]:extensions directories:->extdirs' \
'-d[specify where to place generated class files]:directory:_files -/' \
'-encoding[specify character encoding used by source files]:encoding:->encoding' \
'-proc\:-[control annotation processing]:annotation processing:(none only)' \
'-processor[specify annotation processors to run]:class:_files' \
'-processorpath[specify where to find annotation processors]:directory:_directories' \
+ '-parameters[generate metadata for reflection on method parameters]' \
'-s[specify directory for generated source files]:directory:_directories' \
+ '-h[specify where to place generated native header files]:directory:_directories' \
'-source[provide source compatibility with specified release]:release:(1.{2..8} {5..8})' \
'-target[specify VM version]:release:(1.{1..5})' \
+ '-profile[check that API used is available in the specified profile]:profile' \
'(-)-help[print a synopsis of standard options]' \
'(-)-version[print version information]' \
'(-)-X[display information about non-standard options]' \
+ '-J-[pass flag directly to the runtime system]:flag' \
+ '-Werror[terminate compilation if warnings occur]' \
'*:java source file:_files -g \*.java\(-.\)' && return 0
;;
@@ -75,6 +81,7 @@ java)
'(- 1)-'{\?,help}'[print help message]' \
'(- 1)-X-[non-standard java option]:option' \
'(- 1)-jar[specify a program encapsulated as jar]:jar:_files -g \*.jar\(-.\)' \
+ '-splash\:-[show splash screen with specified image]:image:_files' \
'(-):class:_java_class -m main ${(kv)opt_args[(i)(-classpath|-cp)]}' \
'*::args:= _normal' \
&& return 0
@@ -90,15 +97,20 @@ javadoc)
'-help[print help message]' \
'-doclet[specify a doclet]:doclet:_java_class -t doclet ${(kv)opt_args[(i)-classpath]}' \
'-docletpath[specify a path to search doclet]:doclet path:->docletpath' \
- '-1.1[Javadoc 1.1 compatible output]' \
'-sourcepath[specify path for source files]:source path:->sourcepath' \
- '-classpath[specify path for user class files]:class path:->classpath' \
+ {-cp,-classpath}'[specify path for user class files]:class path:->classpath' \
+ '-exclude[specify a list of packages to exclude]:package list' \
+ '-subpackages[specify subpackages to recursively load]:subpackage list' \
+ '-breakiterator[compute first sentence with BreakIterator]' \
'-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \
+ '-source[provide source compatibility with specified release]:release' \
'-extdirs[specify directories for extensions]:extensions directories:->extdirs' \
'-verbose[print verbose messages]' \
'-locale[specify locale]:language_country_variant:' \
'-encoding[specify character encoding for source files]:encoding:->encoding' \
+ "-quiet[don't display status messages]" \
'-J-[specify java option]:java option:' \
+ '-X[print a synopsis of nonstandard options and exit]' \
'-d[specify destination directory]:destination directory:_files -/' \
'-use[display pages for use]' \
'-version[include @version text]' \
@@ -111,15 +123,27 @@ javadoc)
'-bottom[specify bottom text]:bottom text:' \
'-link[generate a link to external reference classes]:document URL:' \
'-linkoffline[generate a link for external reference class names]:document URL::package list URL:' \
+ '-excludedocfilessubdir[exclude any doc-files subdirectories with given name]:name:_directories' \
'-group[generate tables for each group]:group heading::package patterns:' \
- '-nodeprecated[do not document deprecated API]' \
- '-nodeprecatedlist[do not generate deprecated API list]' \
- '-notree[do not generate class and interface hierarchy]' \
- '-noindex[do not generate index]' \
- '-nohelp[do not generate help link]' \
- '-nonavbar[do not generate navigation bar]' \
+ "-nodeprecated[don't include @deprecated information]" \
+ '-noqualifier[exclude the list of qualifiers from the output]:qualifier list' \
+ "-nosince[don't include @since information]" \
+ "-notimestamp[don't include hidden time stamp]" \
+ "-nodeprecatedlist[don't generate deprecated API list]" \
+ "-notree[don't generate class and interface hierarchy]" \
+ "-noindex[don't generate index]" \
+ "-nohelp[don't generate help link]" \
+ "-nonavbar[don't generate navigation bar]" \
+ '-serialwarn[generate warning about @serial tag]' \
+ '*-tag[specify single argument custom tag]:tag' \
+ '-taglet[specify fully qualified name of Taglet to register]:taglet' \
+ '-tagletpath[specify path to Taglets]:path:_directories' \
+ '-charset[specify charset of generated documentation]:charset:->encoding' \
'-helpfile[specify alternative help link]:helpfile path/filename:' \
- '-stylesheet[specify alternative HTML style sheet]:stylesheet path/filename:' \
+ '-linksource[generate source in HTML]' \
+ '-sourcetab[specify the number of spaces each tab takes up in the source]:spaces' \
+ '-keywords[include HTML meta tags with package, class and member info]' \
+ '-stylesheetfile[specify alternative HTML style sheet]:stylesheet path/filename:_directories' \
'-docencoding[specify character encoding for output HTML files]:encoding:->encoding' \
'*:package name, source file or @list:->docsrc' && ret=0
;;
@@ -143,9 +167,11 @@ jar)
'f[specify archive file]' \
'v[verbose mode]' \
'(e)m[specify manifest file]' \
+ 'n[perform Pack200 normalization after creating a new archive]' \
'(m)e[specify class of for application entry point]' \
'0[store only without using ZIP compression]' \
- 'M[do not create manifest file]' \
+ "M[don't create manifest file]" \
+ "P[preserve leading / and .. components on file names]" \
'i[generate index information for specified jar files]' && return
else
jar_cmd="${words[2]#-}"
@@ -171,7 +197,7 @@ javah|javah_g)
'-help[print help message]' \
'-version[print version]' \
'-jni[JNI-style native method function prototypes]' \
- '-classpath[specify path for user class files]:class path:->classpath' \
+ {-cp,-classpath}'[specify path for user class files]:class path:->classpath' \
'-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \
'-old[generate old JDK1.0-style header files]' \
'-force[force output]' \
@@ -182,17 +208,19 @@ javah|javah_g)
javap)
_arguments -C \
'-help[print help message]' \
+ '-version[print version information]' \
+ {-v,-verbose}'[print additional information]' \
'-l[line and local variable tables]' \
- '-b[backward compatible to JDK1.1]' \
- '-public[only public classes and members]' \
- '-protected[only protected and public classes and members]' \
- '-package[only package, protected and public classes and members (default)]' \
- '-private[all classes and members]' \
+ '(-protected -package -p -private)-public[show only public classes and members]' \
+ '(-public -package -p -private)-protected[show only protected/public classes and members]' \
+ '(-public -protected -p -private)-package[show only package/protected/public classes and members (default)]' \
+ '(-public -package -protected -p -private)'{-p,-private}'[show all classes and members]' \
'-J-[specify java option]:java option:' \
- '-s[internal type signatures]' \
'-c[disassemble code]' \
- '-verbose[stack size, number of locals and args for methods]' \
- '-classpath[specify path for user class files]:class path:->classpath' \
+ '-s[print internal type signatures]' \
+ '-sysinfo[show system info (path, size, date, MD5 hash) of class being processed]' \
+ '-constants[show final constants]' \
+ {-cp,-classpath}'[specify path for user class files]:class path:->classpath' \
'-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \
'-extdirs[specify directories for extensions]:extensions directories:->extdirs' \
'*:class:_java_class ${(kv)opt_args[(i)-classpath]}' && return 0
diff --git a/Completion/Unix/Command/_joe b/Completion/Unix/Command/_joe
index 592c34a10..74b0bf1a3 100644
--- a/Completion/Unix/Command/_joe
+++ b/Completion/Unix/Command/_joe
@@ -36,4 +36,4 @@ _arguments \
'-linums[display line numbers before each line]' \
'-rdonly[make file read-only]' \
'-keymap[use an alternate section of joerc for keybindings]:keymap name' \
- '*:files:_files'
+ '*:file:_files'
diff --git a/Completion/Unix/Command/_killall b/Completion/Unix/Command/_killall
index 36accb2e0..3ddd36341 100644
--- a/Completion/Unix/Command/_killall
+++ b/Completion/Unix/Command/_killall
@@ -38,15 +38,9 @@ if _pick_variant psmisc=PSmisc unix --version; then
case $state in
(time)
- local -a units=( 's:seconds' 'm:minutes' 'h:hours' 'd:days'
- 'w:weeks' 'M:months' 'y:years' )
- if compset -P '[0-9]##(|.[0-9]#)'; then
- _alternative 'float-numbers:: _message "float number"' \
- 'units:: _describe unit units' && ret=0
- else
- _message 'float number and unit' && ret=0
- fi
- ;;
+ _numbers -fN age 's:seconds' 'm:minutes' 'h:hours' 'd:days' \
+ 'w:weeks' 'M:months' 'y:years'
+ ;;
esac
return ret
diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less
index cb71314a6..69f75fd0e 100644
--- a/Completion/Unix/Command/_less
+++ b/Completion/Unix/Command/_less
@@ -1,7 +1,7 @@
#compdef less -value-,LESS,-default- -value-,LESSCHARSET,-default-
-local curcontext="$curcontext" state line expl ret=1
-local -a files
+local curcontext="$curcontext" fgbg=foreground ret=1
+local -a state line expl files basic suf
case $service in
*LESSCHARSET*)
@@ -37,15 +37,15 @@ _arguments -S -s -A "[-+]*" \
'(-b --buffers)'{-b+,--buffers=}'[specify amount of buffer space used for each file]:buffer space (kilobytes)' \
'(-B --auto-buffers)'{-B,--auto-buffers}"[don't automatically allocate buffers for pipes]" \
'(-C --CLEAR-SCREEN -c --clear-screen)'{-c,--clear-screen}'[repaint screen instead of scrolling]' \
- '(-c --clear-screen -C --CLEAR-SCREEN)'{-C,--CLEAR-SCREEN}'[clear screen before repaints]' \
+ '!(-c --clear-screen)'{-C,--CLEAR-SCREEN} \
'(-d --dumb)'{-d,--dumb}'[suppress error message if terminal is dumb]' \
+ '*'{-D+,--color=}'[set screen colors]: :->colors' \
'(-e -E --quit-at-eof --QUIT-AT-EOF)'{-e,--quit-at-eof}'[exit the second time end-of-file is reached]' \
'(-e -E --quit-at-eof --QUIT-AT-EOF)'{-E,--QUIT-AT-EOF}'[exit when end-of-file is reached]' \
'(-f --force)'{-f,--force}'[force opening of non-regular files]' \
'(-F --quit-if-one-screen)'{-F,--quit-if-one-screen}'[exit if entire file fits on first screen]' \
'(-G --HILITE-SEARCH -g --hilite-search)'{-g,--hilite-search}'[highlight only one match for searches]' \
'(-g --hilite-search -G --HILITE-SEARCH)'{-G,--HILITE-SEARCH}'[disable highlighting of search matches]' \
- '--old-bot[revert to the old bottom of screen behavior]' \
'(-h --max-back-scroll)'{-h+,--max-back-scroll=}'[specify backward scroll limit]:backward scroll limit (lines)' \
'(-I --IGNORE-CASE -i --ignore-case)'{-i,--ignore-case}'[ignore case in searches that lack uppercase]' \
'(-i --ignore-case -I --IGNORE-CASE)'{-I,--IGNORE-CASE}'[ignore case in all searches]' \
@@ -80,21 +80,52 @@ _arguments -S -s -A "[-+]*" \
'--no-keypad[disable use of keypad terminal init string]' \
'(-y --max-forw-scroll)'{-y,--max-forw-scroll}'[specify forward scroll limit]' \
'(-z --window)'{-z+,--window=}'[specify scrolling window size]:lines' \
- '(-\" --quotes)'{-\"+,--quotes=}'[change quoting character]:quoting characters' \
+ '(-\" --quotes)'{'-\"+',--quotes=}'[change quoting character]:quoting characters' \
'(-~ --tilde)'{-~,--tilde}"[don't display tildes after end of file]" \
- '(-\# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \
+ '(-\# --shift)'{'-\#+',--shift=}"[specify amount to move when scrolling horizontally]:number" \
+ '--file-size[automatically determine the size of the input file]' \
+ '--incsearch[search file as each pattern character is typed in]' \
+ '--line-num-width=[set the width of line number field]:width [7]' \
'--follow-name[the F command changes file if the input file is renamed]' \
'--mouse[enable mouse input]' \
'--no-histdups[remove duplicates from command history]' \
'--rscroll=[set the character used to mark truncated lines]:character [>]' \
'--save-marks[retain marks across invocations of less]' \
+ '--status-col-width=[set the width of the -J status column]:width [2]' \
'--use-backslash[subsequent options use backslash as escape char]' \
+ '--use-color[enable colored text]' \
'--wheel-lines=[specify lines to move for each click of the mouse wheel]:lines' \
"$files[@]" && ret=0
if [[ -n "$state" ]]; then
case $state in
+ colors)
+ if compset -P 1 \?; then
+ [[ $IPREFIX[-1] != [a-z] ]] || compset -P 1 + || _describe 'color application' '( +:add\ to\ existing\ attribute )'
+ suf=( -S '' )
+ compset -P 1 '([-a-zA-Z]|*.)' && fgbg=background && suf=()
+ basic=( B:blue C:cyan G:green K:black M:magenta R:red W:white Y:yellow )
+ _describe -t colors "$fgbg color" \
+ "( -:default ${(j. .)${(@)basic/:/:light\ }} ${(Lj. .)basic} )" "$suf[@]" && ret=0
+ else
+ _describe 'text' '(
+ B:binary\ characters
+ C:control\ characters
+ E:errors\ and\ informational\ messages
+ M:mark\ letters\ in\ the\ status\ column
+ N:line\ numbers\ enabled\ via\ the\ -N\ option
+ P:prompts
+ R:the\ rscroll\ character
+ S:search\ results
+ W:the\ highlight\ enabled\ via\ the\ -w\ option
+ d:bold\ text
+ k:blinking\ text
+ s:standout\ text
+ u:underlined\ text
+ )' -S '' && ret=0
+ fi
+ ;;
prompts)
if compset -p 1; then
_message -e prompt
diff --git a/Completion/Unix/Command/_lldb b/Completion/Unix/Command/_lldb
index 0426f69f2..eae8e1d3a 100644
--- a/Completion/Unix/Command/_lldb
+++ b/Completion/Unix/Command/_lldb
@@ -6,12 +6,12 @@ typeset -a opts args
[[ $EUID = 0 || $_comp_priv_prefix[1] = sudo ]] && opts=( -a )
args=(
- '*'{-o+,--one-line=}'[run one-line lldb command after loading executable]:lldb command: '
- '*'{-s+,--source=}'[run lldb commands from a file after loading executable]:file:_files'
- '*'{-O+,--one-line-before-file=}'[run one-line lldb command before loading executable]:lldb command'
- '*'{-S+,--source-before-file=}'[run lldb commands from a file before loading executable]:file:_files'
- '(-k --one-line-on-crash)'{-k+,--one-line-on-crash=}'[run one-line lldb command if target crashes in batch mode]:lldb command'
- '(-K --source-on-crash)'{-K+,--source-on-crash=}'[run lldb commands from a file if target crashes in batch mode]:file:_files'
+ '*'{-o+,--one-line}'[run one-line lldb command after loading executable]:lldb command: '
+ '*'{-s+,--source}'[run lldb commands from a file after loading executable]:file:_files'
+ '*'{-O+,--one-line-before-file}'[run one-line lldb command before loading executable]:lldb command'
+ '*'{-S+,--source-before-file}'[run lldb commands from a file before loading executable]:file:_files'
+ '(-k --one-line-on-crash)'{-k+,--one-line-on-crash}'[run one-line lldb command if target crashes in batch mode]:lldb command'
+ '(-K --source-on-crash)'{-K+,--source-on-crash}'[run lldb commands from a file if target crashes in batch mode]:file:_files'
'(-b --batch)'{-b,--batch}'[run commands from -s -S -o -O and quit]'
'(-Q --source-quietly)'{-Q,--source-quietly}'[suppress output from -s, -S, -o or -O]'
'(-e --editor)'{-e,--editor}'[open source files using "external editor" mechanism]'
@@ -19,21 +19,21 @@ args=(
'(-X --no-use-colors)'{-X,--no-use-colors}'[do not use colors]'
'(-d --debug)'{-d,--debug}'[print extra information for debugging itself]'
'(-r --repl)'{-r,--repl}'[run lldb in REPL mode]'
- '(-l --script-language)'{-l+,--script-language=}'[use the specified scripting language]:language:(Python Perl Ruby Tcl)'
+ '(-l --script-language)'{-l+,--script-language}'[use the specified scripting language]:language:(Python Perl Ruby Tcl)'
- info
'(-)'{-h,--help}'[print the usage information]'
'(-)'{-v,--version}'[print the current version number]'
'(-)'{-P,--python-path}'[print path to the lldb.py file]'
- file
- '(-f --file)'{-f+,--file=}'[specify executable file to debug]:executable:_files -g "*(-*)"'
- '(-a --arch)'{-a+,--arch=}'[use the specified architecture]:arch'
- '(-c --core)'{-c+,--core=}'[specify core file to open]:core file:_files -g "*core*(-.)"'
+ '(-f --file)'{-f+,--file}'[specify executable file to debug]:executable:_files -g "*(-*)"'
+ '(-a --arch)'{-a+,--arch}'[use the specified architecture]:arch'
+ '(-c --core)'{-c+,--core}'[specify core file to open]:core file:_files -g "*core*(-.)"'
'*::executable and arguments:->exe_args'
- name
- '(-n --attach-name)'{-n+,--attach-name=}"[attach to the named process]: :_process_names $opts"
+ '(-n --attach-name)'{-n+,--attach-name}"[attach to the named process]: :_process_names $opts"
'(-w --wait-for)'{-w,--wait-for}'[wait for the specified process to launch]'
- pid
- '(-p --attach-pid)'{-p+,--attach-pid=}'[attach to the specified process]:pid:_pids'
+ '(-p --attach-pid)'{-p+,--attach-pid}'[attach to the specified process]:pid:_pids'
)
_arguments -C -s -S : $args && return 0
diff --git a/Completion/Unix/Command/_locale b/Completion/Unix/Command/_locale
index a7fd88f65..b2ee14ee0 100644
--- a/Completion/Unix/Command/_locale
+++ b/Completion/Unix/Command/_locale
@@ -28,6 +28,7 @@ elif [[ $OSTYPE == openbsd* ]]; then
specs=(
'(-m)-a[list all available locales]'
'(-a)-m[list all available charmaps]'
+ '(-a -m)1:name:(charmap)'
)
else
diff --git a/Completion/Unix/Command/_locate b/Completion/Unix/Command/_locate
index 23305f798..af07473b3 100644
--- a/Completion/Unix/Command/_locate
+++ b/Completion/Unix/Command/_locate
@@ -44,7 +44,7 @@ case $variant in
-u'[create slocate database starting at path /]'
-U'[create slocate database starting at given path]:directory:_files -/'
-c'[parse GNU locate updatedb with -u, -U]'
- -e'[exclude directories with -u, -U]:directories:_files -/'
+ -e'[exclude directories with -u, -U]: : _dir_list -s,'
-f'[exclude file system types from db with -u, -U]:file system:_file_systems'
-l'[security level]:level:(0 1)'
-q'[quiet mode]'
diff --git a/Completion/Unix/Command/_logger b/Completion/Unix/Command/_logger
new file mode 100644
index 000000000..0d47d2f03
--- /dev/null
+++ b/Completion/Unix/Command/_logger
@@ -0,0 +1,80 @@
+#compdef logger
+
+local variant ign
+local -a args common
+local -a priorities
+
+_pick_variant -r variant linux=util-linux busybox=BusyBox $OSTYPE -V
+
+priorities=( {kern,user,mail,daemon,auth,syslog,lpr,news,uucp,cron,authpriv,ftp,ntp,security,console,local{0..7}}.{emerg,panic,alert,crit,err,error,warn,warning,notice,info,debug} )
+args=( "(--id)-i[log the logger command's pid]" )
+common=(
+ '(-f --file --journald *)'{-f+,--file=}'[log contents of specified file]:file:_files'
+ '(-s --stderr)'{-s,--stderr}'[output message to standard error as well]'
+ '(-P --port)'{-P+,--port}'[use specified port for UDP or TCP connection]:port [514]:_ports'
+ '(-p --priority)'{-p+,--priority}'[mark message with specified priority]:priority:_multi_parts . priorities'
+ '(-t --tag)'{-t+,--tag}"[specify tag to mark log line with]:tag [$USER]"
+)
+
+case $variant in
+ (net|open)bsd*)
+ args+=( ${(M)common:#*\)-[fpst]*}
+ '-c[write the message to the console if unable to use syslogd(8)]'
+ )
+ ;|
+ dragonfly*|freebsd*)
+ args+=(
+ '(-6)-4[use IPv4 addresses only]'
+ '(-4)-6[use IPv6 addresses only]'
+ '-A[send the message to all addresses]'
+ )
+ ;|
+ darwin*|dragonfly*) args+=( ${(M)common:#*\)-[sfpt]*} ) ;|
+ freebsd*)
+ args+=( ${common:#*\)--*}
+ "-H+[set value for hostname in message header]:hostname [${HOST%%.*}]"
+ '-h+[write to specified remote syslog server or socket]: : _alternative
+ "hosts\:server\:_hosts"
+ "sockets\:socket\:_files -g \*\(=\)"'
+ '-S+[specify source address and port when using -h]: :_bind_addresses -0bh'
+ )
+ ;;
+ dragonfly*)
+ args+=( '-h+[write to specified remote syslog server]:server:_hosts' )
+ ;;
+ busybox) args=( ${(M)common:#*\)-[spt]*} ) ;; # no -i
+ solaris*) args+=( ${(M)common:#*\)-[fpt]*} ) ;;
+ netbsd*)
+ args+=(
+ '-d+[log this in the structured data (SD) field]:sd field'
+ '-m+[specify message ID used for the message]:message id'
+ '-n[open log file immediately]'
+ )
+ ;;
+ linux)
+ (( $#words > 2 )) && ign='!'
+ args+=( $common
+ "(-i)--id=-[log the given id, or otherwise the pid]::id [$$]:_pids"
+ '(* -e --skip-empty)'{-e,--skip-empty}"[don't log empty lines when processing files]"
+ '--no-act[do everything except the write the log]'
+ '--octet-count[use rfc6587 octet counting]'
+ '(*)--prio-prefix[look for a prefix on every line read from stdin]'
+ '(-S --size)'{-S+,--size=}'[specify maximum size for a single message]:size [1KiB]'
+ '(-n --server)'{-n+,--server=}'[write to specified remote syslog server]:server:_hosts'
+ '(-T --tcp -d --udp)'{-T,--tcp}'[use TCP only]'
+ '(-d --udp -T --tcp)'{-d,--udp}'[use UDP only]'
+ '(--rfc5424 --msgid --sd-id --sd-param)--rfc3164[use the obsolete BSD syslog protocol]'
+ '(--rfc3164)--rfc5424=-[use the syslog protocol (default for remote)]::without:_sequence compadd - notime notq nohost'
+ '(--rfc3164)*--sd-id=[specify rfc5424 structured data ID]:id'
+ '(--rfc3164)*--sd-param=[specify rfc5424 structured data name=value]:data'
+ '(--rfc3164)--msgid=[set rfc5424 message id field]:message id'
+ '(-u --socket)'{-u,--socket=}'[write to specified Unix socket]:socket:compadd -f -M "r\:|_=* r\:|=*" ${${(M)${(f)"$(</proc/net/unix)"}\:#* /*}##* }'
+ '--socket-errors=-[print connection errors when using Unix sockets]::state:(on off auto)'
+ '(* -f --file)--journald=-[write journald entry]::file:_files'
+ "${ign}(- *)"{-h,--help}'[display usage information]'
+ "${ign}(- *)"{-V,--version}'[display version information]'
+ )
+ ;;
+esac
+
+_arguments -s -S -A "-*" $args '*: :_guard "^-*" message'
diff --git a/Completion/Unix/Command/_lp b/Completion/Unix/Command/_lp
index e84d9ad04..ad7e97203 100644
--- a/Completion/Unix/Command/_lp
+++ b/Completion/Unix/Command/_lp
@@ -58,6 +58,9 @@ _lp_job_options()
'6:rotated 180 degrees')
_describe "orientation requested" desc_opts
;;
+ (job-sheets(|-*))
+ compadd "$@" /usr/share/cups/banners/*(:t)
+ ;;
(sides)
compadd "$@" one-sided two-sided-{long,short}-edge
;;
@@ -80,7 +83,7 @@ _lp_job_options()
"DuplexTumble:flip short side"
"DuplexNoTumble:flip long side"
"None")
- _describe "duplex options" desc_opts
+ _describe "duplex option" desc_opts
;;
(*)
@@ -100,11 +103,11 @@ _lp_job_options()
eq_suffix=(-S '=')
fi
- _description lpopts expl "generic printer options"
+ _description lpopts expl "generic printer option"
compadd "$expl[@]" $eq_suffix $lopts_with_args
compadd "$expl[@]" $lopts_no_args
- _description printeropts expl "printer specific options"
+ _description printeropts expl "printer specific option"
compadd "$expl[@]" $eq_suffix \
$(_call_program list-printer-options \
lpoptions $printer -l | cut -d/ -f1)
@@ -163,128 +166,128 @@ _lp()
case $service in
(lpq)
_arguments \
- '-E[Force encryption]' \
+ '-E[force encryption]' \
'-U:username (for connection to server):_users' \
'-h:alternate server:_hosts' \
- '(-a)-P+[Destination printer]:printers:_printers' \
- '(-P)-a[All printers]' \
- '-l[Long listing]' \
- '*:poll interval (+seconds):'
+ '(-a)-P+[destination printer]:printer:_printers' \
+ '(-P)-a[all printers]' \
+ '-l[long listing]' \
+ '*:poll interval (+seconds)'
;;
(lprm)
_arguments \
- '-E[Force encryption]' \
+ '-E[force encryption]' \
'-U:username (for connection to server):_users' \
'-h:alternate server:_hosts' \
- '-P+[Destination printer]:printers:_printers' \
- '*:job ids:_lp_list_jobs'
+ '-P+[destination printer]:printer:_printers' \
+ '*:job id:_lp_list_jobs'
;;
(lpoptions)
_arguments \
- '-E[Force encryption]' \
+ '-E[force encryption]' \
'-U:username (for connection to server):_users' \
'-h:alternate server:_hosts' \
- '(-p -l -r -x)-d+[Set default printer]:printers:_printers' \
- '(-l -x)*-o:job options:_lp_job_options' \
- '(-d -x)-p+[Destination printer for options]:printers:_printers' \
- '(-d -o -r -x)-l[List options]' \
+ '(-p -l -r -x)-d+[set default printer]:printer:_printers' \
+ '(-l -x)*-o:job option:_lp_job_options' \
+ '(-d -x)-p+[destination printer for options]:printer:_printers' \
+ '(-d -o -r -x)-l[list options]' \
'(-d -l -x)*-r:remove option:_lp_job_options' \
- '(-d -l -r -o)-x+[Remove all options]:printers:_printers'
+ '(-d -l -r -o)-x+[remove all options]:printer:_printers'
;;
(lpstat)
_arguments \
- '-E[Force encryption]' \
- '-R[Shows print job ranking]' \
+ '-E[force encryption]' \
+ '-R[shows print job ranking]' \
'-U:username (for connection to server):_users' \
- '-W:which jobs:(completed not-completed)' \
- '-a+[Show accepting state]:printers:_printers' \
- '-c:printer classes:' \
- '-d[Show current default destination]' \
+ '-W:which job:(completed not-completed)' \
+ '-a+[show accepting state]:printer:_printers' \
+ '-c:printer class' \
+ '-d[show current default destination]' \
'-h:hostname (alternate server):_hosts' \
- '-l[Long listing]' \
- '-o+[Destinations]:printers:_printers' \
- '-p+:printers:_printers' \
+ '-l[long listing]' \
+ '-o+[destinations]:printer:_printers' \
+ '-p+:printer:_printers' \
'-r[CUPS server running status]' \
- '-s[Status summary]' \
- '-t[All status info]' \
- '-u[List jobs by users]:users:_users' \
- '-v+[Show devices]:printers:_printers'
+ '-s[status summary]' \
+ '-t[all status info]' \
+ '-u[list jobs by users]:user:_users' \
+ '-v+[show devices]:printer:_printers'
;;
(lpr)
_arguments \
- '-E[Force encryption]' \
+ '-E[force encryption]' \
'-H:hostname (alternate server):_hosts' \
- '(-C -J -T)'-{C,J,T}':job name:' \
- '-P+[Destination printer]:printers:_printers' \
+ '(-C -J -T)'-{C,J,T}':job name' \
+ '-P+[destination printer]:printer:_printers' \
'-U:username (for connection to server):_users' \
- '-#[Copies]:copies (1--100):' \
- '-h[Disables banner printing]' \
- '-l[Raw file]' \
- '-m[Send an email on job completion]' \
- '*-o:print job options:_lp_job_options' \
- '-p[Format with shaded header incl. date, time etc.]' \
- '-q[Hold job for printing.]' \
- '-r[Delete files after printing]' \
- '*:PS/PDF files:_pspdf'
+ '-#[copies]:copies (1--100)' \
+ '-h[disables banner printing]' \
+ '-l[raw file]' \
+ '-m[send an email on job completion]' \
+ '*-o:print job option:_lp_job_options' \
+ '-p[format with shaded header incl. date, time etc.]' \
+ '-q[hold job for printing]' \
+ '-r[delete files after printing]' \
+ '*:PS/PDF file:_pspdf'
;;
(lp)
_arguments \
- '-E[Force encryption]' \
- '-U[Username (for connection to server)]:username:_users' \
+ '-E[force encryption]' \
+ '-U[username (for connection to server)]:username:_users' \
'-c[(OBSOLETE) copy to spool dir before printing]' \
- '-d+[Destination printer]:printers:_printers' \
+ '-d+[destination printer]:printer:_printers' \
'-h:hostname (alternate server):_hosts' \
- '-i[Job id to modify]:job id:' \
- '-m[Send an email on job completion]' \
- '-n[Copies]:copies (1--100):' \
- '*-o:print job options:_lp_job_options' \
- '-q[Job priority -- 1 (lowest) to 100 (highest)]:priority:' \
- "-s[Don't report resulting job IDs]" \
- '-t[Sets the job name]:job name:' \
- '-u[Job submission username]:username:_users' \
- '-H[Time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \
- '-P:page range list:' \
- '*:PS/PDF files:_pspdf'
+ '-i[job id to modify]:job id' \
+ '-m[send an email on job completion]' \
+ '-n[copies]:copies (1--100)' \
+ '*-o:print job option:_lp_job_options' \
+ '-q[job priority -- 1 (lowest) to 100 (highest)]:priority' \
+ "-s[don't report resulting job IDs]" \
+ '-t[set the job name]:job name' \
+ '-u[job submission username]:username:_users' \
+ '-H[time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \
+ '-P:page range list' \
+ '*:PS/PDF file:_pspdf'
;;
(lpinfo)
_arguments \
- '-E[Force encryption]' \
- '-U[Username (for connection to server)]:username:_users' \
+ '-E[force encryption]' \
+ '-U[username (for connection to server)]:username:_users' \
'-h:hostname (alternate server):_hosts' \
- '-l[Shows a "long" listing of devices or drivers]' \
- {--exclude-schemes,--include-schemes}'[Device/PPD schemes to filter from results]:scheme-list:' \
- '(-v --timeout)--device-id[IEEE-1284 device ID to match]:device-id-string:' \
- '(-v --timeout)--language:locale:' \
- '(-v --timeout)--product[Product to match]:name:' \
- '(-v --timeout)--make-and-model[Make and model to match]:name:' \
- '(-v --timeout)-m[List available drivers]' \
- '(-m --device-id --language --make-and-model --product)--timeout[Timeout when listing devices with -v]:timeout (seconds):' \
- '(-m --device-id --language --make-and-model --product)-v[List available devices]'
+ '-l[show a "long" listing of devices or drivers]' \
+ {--exclude-schemes,--include-schemes}'[device/PPD schemes to filter from results]:scheme-list' \
+ '(-v --timeout)--device-id[IEEE-1284 device ID to match]:device-id-string' \
+ '(-v --timeout)--language:locale' \
+ '(-v --timeout)--product[product to match]:name' \
+ '(-v --timeout)--make-and-model[make and model to match]:name' \
+ '(-v --timeout)-m[list available drivers]' \
+ '(-m --device-id --language --make-and-model --product)--timeout[timeout when listing devices with -v]:timeout (seconds)' \
+ '(-m --device-id --language --make-and-model --product)-v[list available devices]'
;;
(lpadmin)
_arguments \
- '-E[Force encryption/Enable destination]' \
- '-U[Username (for connection to server)]:username:_users' \
+ '-E[force encryption/enable destination]' \
+ '-U[username (for connection to server)]:username:_users' \
'-h:hostname (alternate server):_hosts' \
- '(-p -R -x -o)-d+[Default printer]:printers:_printers' \
- '(-d -x)-p+[Configure printer]:printers:_printers' \
- '(-p -R -d -o)-x+[Delete printer]:printers:_printers' \
- '(-x -d)-R[Name-default]:name-default:' \
- '-c:printer classes:' \
- '-m:model:' \
- '(-x -d)*-o:options:_lp_job_options' \
- '-r[Remove from class]:class:' \
- '-u[Access policy]:access policy:' \
- '-v[Device-uri of printer queue]:device-uri:' \
- '-D[Text description of destination]:info:' \
- '-L[Location of the printer]:location:' \
+ '(-p -R -x -o)-d+[default printer]:printer:_printers' \
+ '(-d -x)-p+[configure printer]:printer:_printers' \
+ '(-p -R -d -o)-x+[delete printer]:printer:_printers' \
+ '(-x -d)-R[name-default]:name-default' \
+ '-c:printer class' \
+ '-m:model' \
+ '(-x -d)*-o:option:_lp_job_options' \
+ '-r[remove from class]:class' \
+ '-u[access policy]:access policy' \
+ '-v[device-uri of printer queue]:device-uri' \
+ '-D[text description of destination]:info' \
+ '-L[location of the printer]:location' \
'-P[PPD file to use]:PPD file:_files "*.(#i)ppd(-.)"'
esac
}
diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls
index 1fd9383f5..df14e7e2c 100644
--- a/Completion/Unix/Command/_ls
+++ b/Completion/Unix/Command/_ls
@@ -196,7 +196,7 @@ else
'(-q --hide-control-chars)--show-control-chars'
'(- :)--help[display help information]'
'(- :)--version[display version information]'
- '*:files:_files'
+ '*:file:_files'
)
if [[ $OSTYPE = linux* ]]; then
arguments+=(
diff --git a/Completion/Unix/Command/_lsof b/Completion/Unix/Command/_lsof
index 754012e3b..8afb55e1d 100644
--- a/Completion/Unix/Command/_lsof
+++ b/Completion/Unix/Command/_lsof
@@ -34,7 +34,7 @@ _arguments -C -s -S $args \
'-f[inhibit listing of kernel file structure info]::info type:->file-structures' \
'+f[enable listing of kernel file structure info]::info type:->file-structures' \
'-F[select output fields]:fields:->fields' \
- '-g[select by process group id]::process group id' \
+ '-g[select by process group id]::process group id:_sequence -s , _pgids' \
'(*)*-i[select internet files]::address:->addresses' \
'-K+[select listing of tasks of processes]::value:((i\:ignore\ tasks))' \
'-k[specify kernel name list file]:kernel file:_files' \
diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks
index 0915765dc..42169c22a 100644
--- a/Completion/Unix/Command/_luarocks
+++ b/Completion/Unix/Command/_luarocks
@@ -34,8 +34,8 @@ local option_deps_modes='--deps-mode=[specify how to handle dependencies]:mode:_
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"}'
+ '--summary=[a short one-line description summary]:summary'
+ '--detailed=[a longer description string]:detailed description'
'--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: '
@@ -321,7 +321,7 @@ __luarocks_rock(){
continue
;;
(rockpack)
- alts+=(':rock file:{_files -g "*.src.rock(-.)"}')
+ alts+=( ':rock file:_files -g "*.src.rock(-.)"' )
shift 1
continue
;;
@@ -332,7 +332,7 @@ __luarocks_rock(){
;;
(installed)
tree="$2"
- alts+=(":local rock:{__luarocks_installed_rocks ${tree}}")
+ alts+=(":local rock: __luarocks_installed_rocks ${tree}")
if [[ -z "${tree}" ]]; then
shift
else
@@ -364,7 +364,7 @@ __luarocks_git_tags(){
local make_command_options=(
'--pack-binary-rock[produce a .rock file with the contents of compilation inside the current directory instead of installing it]'
'--keep[do not remove previously installed versions of the rock after building a new one]'
- '--branch=[override the `source.branch` field in the loaded rockspec]:NAME:{_message "branch name"}'
+ '--branch=[override the `source.branch` field in the loaded rockspec]:branch name'
)
local build_command_options=(
"${make_command_options[@]}"
@@ -375,8 +375,8 @@ local build_command_options=(
_luarocks_build(){
_arguments -A "-*" \
"${build_command_options[@]}" \
- '1: :{__luarocks_rock "rockspec" "external"}' \
- '2:: :{__luarocks_rock_version "external_or_local"}'
+ '1: : __luarocks_rock "rockspec" "external"' \
+ '2:: : __luarocks_rock_version "external_or_local"'
}
# arguments:
# - must: option
@@ -402,7 +402,7 @@ local doc_command_options=(
_luarocks_doc(){
_arguments \
"${doc_command_options[@]}" \
- "1: :{__luarocks_rock installed ${opt_args[--tree]}}"
+ "1: : __luarocks_rock installed ${opt_args[--tree]}"
}
# arguments:
# - must: external only rockspec
@@ -416,14 +416,14 @@ local download_command_options=(
_luarocks_download(){
_arguments -A "-*" \
"${download_command_options[@]}" \
- '1: :{__luarocks_rock "external"}' \
- '2:: :{__luarocks_rock_version "external_or_local"}'
+ '1: : __luarocks_rock "external"' \
+ '2:: : __luarocks_rock_version "external_or_local"'
}
# arguments:
# must: luarocks sub command
(( $+functions[_luarocks_help] )) ||
_luarocks_help(){
- _arguments '1: :__luarocks_command'
+ _arguments '1: : __luarocks_command'
}
(( $+functions[_luarocks_init] )) ||
@@ -446,7 +446,7 @@ _luarocks_install(){
# - must: rockspec file (first and last)
(( $+functions[_luarocks_lint] )) ||
_luarocks_lint(){
- _arguments '1:: :{__luarocks_rock "rockspec"}'
+ _arguments '1:: : __luarocks_rock "rockspec"'
}
# arguments:
# NOTE: receives only options
@@ -463,7 +463,7 @@ _luarocks_list(){
# NOTE: it's options were already described above.
(( $+functions[_luarocks_make] )) ||
_luarocks_make(){
- _arguments '1:: :{__luarocks_rock "rockspec"}'
+ _arguments '1:: : __luarocks_rock "rockspec"'
}
# arguments:
# - optional: .rockspec file / external rock
@@ -476,8 +476,8 @@ local new_version_command_options=(
_luarocks_new_version(){
_arguments -A "-*" \
"${new_version_command_options[@]}" \
- '1:: :{__luarocks_rock "external" "rockspec"}' \
- '2:: :{__luarocks_rock_version "external_or_local"}' \
+ '1:: : __luarocks_rock "external" "rockspec"' \
+ '2:: : __luarocks_rock_version "external_or_local"' \
'3:: :_urls'
}
# arguments:
@@ -524,8 +524,8 @@ local remove_command_options=(
_luarocks_remove(){
_arguments -A "-*" \
"${remove_command_options[@]}" \
- "1: :{__luarocks_rock installed ${opt_args[--tree]}}" \
- "2:: :{__luarocks_rock_version installed ${opt_args[--tree]}}"
+ "1: : __luarocks_rock installed ${opt_args[--tree]}" \
+ "2:: : __luarocks_rock_version installed ${opt_args[--tree]}"
}
# arguments:
# - must: string as a search query
@@ -558,8 +558,8 @@ local show_command_options=(
_luarocks_show(){
_arguments \
"${show_command_options[@]}" \
- "1: :{__luarocks_rock installed "${opt_args[--tree]}"}" \
- "2:: :{__luarocks_rock_version installed ${opt_args[--tree]}}"
+ "1: : __luarocks_rock installed "${opt_args[--tree]}"" \
+ "2:: : __luarocks_rock_version installed ${opt_args[--tree]}"
}
(( $+functions[_luarocks_test] )) ||
@@ -567,7 +567,7 @@ _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' \
+ '1: : __luarocks_rock' \
'*:arg'
}
@@ -581,7 +581,7 @@ local unpack_command_options=(
_luarocks_unpack(){
_arguments \
"${unpack_command_options[@]}" \
- '1: :{__luarocks_rock "rockpack" "external"}'
+ '1: : __luarocks_rock "rockpack" "external"'
}
# arguments:
# - must: rockspec file
@@ -595,7 +595,7 @@ local upload_command_options=(
_luarocks_upload(){
_arguments \
"${upload_command_options[@]}" \
- '1: :{__luarocks_rock "rockspec"}'
+ '1: : __luarocks_rock "rockspec"'
}
(( $+functions[_luarocks_which] )) ||
@@ -609,8 +609,8 @@ _luarocks_write_rockspec(){
"${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"}' \
+ '1::new rock name' \
+ '2:: : __luarocks_rock_version "new_rock"' \
'3:: :_urls'
}
diff --git a/Completion/Unix/Command/_lz4 b/Completion/Unix/Command/_lz4
index 2697c4d11..6676943c4 100644
--- a/Completion/Unix/Command/_lz4
+++ b/Completion/Unix/Command/_lz4
@@ -42,8 +42,8 @@ args=(
'(b t -k --keep)--rm[remove source file]'
'!(b t -c --stdout)--to-stdout'
+ b # Benchmark-mode options
- "(C c d t)-b-[benchmark file using specified compression level]::compression level:(${(j< >)levels//-/})"
- "(C c d t)-e-[specify upper compression level limit (with -b)]:compression level:(${(j< >)levels//-/})"
+ "(C c d t)-b-[benchmark file using specified compression level]:: :->levels"
+ "(C c d t)-e-[specify upper compression level limit (with -b)]: :->levels"
'(C c d t)-i-[specify minimum evaluation time (with -b)]:evaluation time (seconds)'
+ c # Compress-mode options
"(b d t ${(j< >)levels} -c0 -c1 -c2 -hc)"${^levels}
@@ -98,6 +98,11 @@ case $state in
_message 'no more arguments' && ret=0
fi
;;
+ levels)
+ _wanted levels expl 'compression level' \
+ compadd -o numeric - ${levels/#-/} \
+ && ret=0
+ ;;
esac
return ret
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index 21ed56184..ae91440f0 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -204,7 +204,7 @@ _make() {
;;
(debug)
- _values -s , 'debug options' \
+ _values -s , 'debug option' \
'(b v i j m)a[all debugging output]' \
'b[basic debugging output]' \
'(b)v[one level above basic]' \
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 7d55201e3..dba1d13dc 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -6,7 +6,6 @@
# - We assume that Linux distributions are using either man-db or mandoc
# - @todo Would be nice to support completing the initial operand as a section
# name (on non-Solaris systems)
-# - @todo We don't support the man-db syntax <name>.<section> (e.g., `ls.1`)
# - @todo We don't support the man-db feature of 'sub-pages' — that is, treating
# pairs of operands like `git diff` as `git-diff`
# - @todo Option exclusivity isn't super accurate
@@ -415,7 +414,7 @@ _man() {
}
_man_pages() {
- local pages sopt
+ local pages sopt tmp
# What files corresponding to manual pages can end in.
local suf='.((?|<->*|ntcl)(|.gz|.bz2|.z|.Z|.lzma))'
@@ -444,13 +443,20 @@ _man_pages() {
# `POSIX.1.5'.
[[ $variant = solaris* ]] && sopt='-s '
- if ((CURRENT > 1 || noinsert)) ||
- ! zstyle -t ":completion:${curcontext}:manuals.$sect_dirname" insert-sections
- then
- compadd "$@" - ${pages%$~suf}
- else
- compadd "$@" -P "$sopt$sect_dirname " - ${pages%$~suf}
+ if ! ((CURRENT > 1 || noinsert)); then
+ zstyle -s ":completion:${curcontext}:manuals.$sect_dirname" insert-sections tmp
fi
+ case "$tmp" in
+ prepend|true|on|yes|1)
+ compadd "$@" -P "$sopt$sect_dirname " - ${pages%$~suf}
+ ;;
+ suffix)
+ compadd "$@" -s ".$sect_dirname" - ${pages%$~suf}
+ ;;
+ *)
+ compadd "$@" - ${pages%$~suf}
+ ;;
+ esac
}
_man "$@"
diff --git a/Completion/Unix/Command/_md5sum b/Completion/Unix/Command/_md5sum
index 3dfcd6322..e0de826a7 100644
--- a/Completion/Unix/Command/_md5sum
+++ b/Completion/Unix/Command/_md5sum
@@ -45,6 +45,9 @@ args+=(
'(sum -w --status --warn)'{-w,--warn}'[warn about each improperly formatted checksum line]'
)
# Operands
-args+=( '*: :_files' )
+args+=(
+ + operand
+ '*: :_files'
+)
_arguments -s -S : $args
diff --git a/Completion/Unix/Command/_module b/Completion/Unix/Command/_module
index 2a4dba740..23cf0c589 100644
--- a/Completion/Unix/Command/_module
+++ b/Completion/Unix/Command/_module
@@ -85,7 +85,7 @@ _module_available_modules()
{
if [[ -n $MODULEPATH ]] && [[ ${+_available_modules} -eq 0 ]]
then
- _available_modules=(${$(find -L ${(e)=MODULEPATH//:/ } -type f -print 2>/dev/null | grep -v \\.version | sed -e 's,\('${${(e)=MODULEPATH//:/\/\\\|}%\\\|}'\),,g' -e 's,^/*,,g'):#*\~})
+ _available_modules=(${$(find -L ${(e)=MODULEPATH//:/ } -type f -print 2>/dev/null | grep -v \\.version | sed -e 's,\('${${(e)=MODULEPATH//:/\/\\\|}%\\\|}'\),,g' -e 's,^/*,,g' -e 's,\.lua$,,g'):#*\~})
fi
}
diff --git a/Completion/Unix/Command/_moosic b/Completion/Unix/Command/_moosic
index 54d768c8c..475a0c75c 100644
--- a/Completion/Unix/Command/_moosic
+++ b/Completion/Unix/Command/_moosic
@@ -216,7 +216,7 @@ _moosic_cmd_version() {
_moosic_song_files()
{
_arguments -A '-*' $main_opts $filelist_opts $auto_opts \
- '*:song files:_files'
+ '*:song file:_files'
}
_moosic_cmd_append() {
@@ -282,7 +282,7 @@ _moosic_cmd_stagger-merge() {
_moosic_cmd_interval-add() {
_arguments -A '-*' $main_opts $filelist_opts \
'1:interval:' \
- '*:song files:_files'
+ '*:song file:_files'
}
### REMOVING COMMANDS
diff --git a/Completion/Unix/Command/_mtr b/Completion/Unix/Command/_mtr
index 806e344d1..9a73cfbd4 100644
--- a/Completion/Unix/Command/_mtr
+++ b/Completion/Unix/Command/_mtr
@@ -4,6 +4,7 @@ _arguments -s -S \
'(H -F --filename)'{-F,--filename}'[read hostnames from a file]' \
'(H -6)-4[use IPv4 only]' \
'(H -4)-6[use IPv6 only]' \
+ '(H -I --interface)'{-I+,--interface=}'[use named network interface]: :_net_interfaces' \
'(H -a --address)'{-a+,--address=}'[bind outgoing packets to specific interface]:source IP:_hosts' \
'(H -f --first-ttl)'{-f+,--first-ttl=}'[specify TTL to start]:TTL [1]' \
'(H -m --max-ttl)'{-m+,--max-ttl=}'[specify maximum number of hops to probe]:hops [30]' \
@@ -17,7 +18,6 @@ _arguments -s -S \
'(H -Q --tos)'{-Q+,--tos=}'[specify type of service for IP header]:tos (0-255)' \
'(H -e --mpls)'{-e,--mpls}'[display ICMP MPLS information]' \
'(H -Z --timeout)'{-Z+,--timeout=}'[specify how long to keep probe sockets open before giving up on the connection]:timeout (seconds)' \
- '(H -M --mark)'{-M+,--mark=}'[mark each sent packet]:mark' \
'(H -r --report)'{-r,--report}'[report mode]' \
'(H -w --report-wide)'{-w,--report-wide}"[wide report mode\: don't truncate hostnames]" \
'(H -c --report-cycles)'{-c+,--report-cycles=}'[report cycles]:number of pings' \
diff --git a/Completion/Unix/Command/_mysql_utils b/Completion/Unix/Command/_mysql_utils
index f1ad97bcd..9f70687b0 100644
--- a/Completion/Unix/Command/_mysql_utils
+++ b/Completion/Unix/Command/_mysql_utils
@@ -187,7 +187,7 @@ _mysqladmin() {
_wanted databases expl "MySQL database" _mysql_databases && ret=0
;;
kill)
- _message -e ids 'thread ids'
+ _message -e ids 'thread id'
;;
password)
_message -e passwords 'new password'
@@ -220,8 +220,8 @@ _mysql_utils() {
)
_mysql_variables_opts=(
- '--max_allowed_packet[maximum allowed packet size]:packet size in bytes'
- '--net_buffer_length[network buffer length]:buffer length in bytes'
+ '--max_allowed_packet[maximum allowed packet size]:packet size (bytes)'
+ '--net_buffer_length[network buffer length]:buffer length (bytes)'
'--connect_timeout:timeout'
'--select_limit:limit'
'--max_join_size:size'
diff --git a/Completion/Unix/Command/_mysqldiff b/Completion/Unix/Command/_mysqldiff
index 4b46c86df..2515834e0 100644
--- a/Completion/Unix/Command/_mysqldiff
+++ b/Completion/Unix/Command/_mysqldiff
@@ -6,7 +6,7 @@ _mysqldiff () {
{-p{,1,2},--password{,1,2}=}':server password: ' \
{-u{,1,2},--user{,1,2}=}':server username:_mysql_users' \
{-s{,1,2},--socket{,1,2}=}':server socket:_directories' \
- {-d,--debug=}':debugging level (default 1):(1 2 3 4 5 6 7 8)' \
+ {-d,--debug=}':debugging level [1]:(1 2 3 4 5 6 7 8)' \
{-i,--tolerant}':ignore DEFAULT and formatting changes: ' \
{-k,--keep-old-tables}":don\'t output DROP TABLE commands: " \
{-n,--no-old-defs}"[don't output old defs as comments]" \
@@ -20,8 +20,8 @@ _mysqldiff () {
_mysql_db_or_file () {
_alternative \
- 'databases:MySQL databases:_mysql_databases' \
- 'files:MySQL database definition files:_files -g "*.(my|)sql(-.)"'
+ 'databases:MySQL database:_mysql_databases' \
+ 'files:MySQL database definition file:_files -g "*.(my|)sql(-.)"'
}
_mysql_utils
diff --git a/Completion/Unix/Command/_netstat b/Completion/Unix/Command/_netstat
index 94aa1688d..67133dc6c 100644
--- a/Completion/Unix/Command/_netstat
+++ b/Completion/Unix/Command/_netstat
@@ -5,10 +5,10 @@ local lopt='[show only listening sockets]'
local zopt='-z[reset statistic counters after displaying them]'
local popt='(-f)-p+[filter by protocol]:protocol:compadd -a plist'
local Iopt='(-i)-I+[show information about the specified interface]:interface:_net_interfaces'
-local set sel
+local set sel tblopt
local -A sets
local -a Mopts families flist plist args sockets extend interval verbose
-local -a {sel_,}{bpf,dhcp,groups,interfaces,masquerade,media,memory,multicast,pcb,queues,routing,statistics,wireless}
+local -a {sel_,}{bpf,dhcp,groups,interfaces,masquerade,media,memory,multicast,pcb,queues,rdomains,routing,statistics,wireless}
case $OSTYPE in
linux-gnu)
@@ -130,7 +130,7 @@ case $OSTYPE in
)
routing=( $families )
sel_memory=( '-m[display statistics recorded by the memory management routines]' )
- sel_interfaces+=( '(1 -a -f -i -p -s)-w+[display packet traffic at intervals]:interval (seconds)' )
+ sel_interfaces+=( '(1 -a -f -i -p -s -u)-w+[display packet traffic at intervals]:interval (seconds)' )
;|
darwin*|dragonfly*|(net|free)bsd*)
interfaces+=( '-a[show multicast addresses currently in use]' )
@@ -266,13 +266,15 @@ case $OSTYPE in
)
;;
openbsd*)
- sets+=( wireless '-W*' )
+ sets+=( wireless '-W*' rdomains '-R' )
+ sel_rdomains=( '-R[show all rdomains with associated interfaces and routing tables]' )
sel_wireless=( '-W+[display per-interface IEEE 802.11 wireless statistics]:interface' )
flist+=( local mpls )
- sockets+=( -l$lopt '-B[show buffer sizes for TCP sockets]' )
- routing+=(
+ tblopt='-T+[select an alternate routing table to query]:routing table:_routing_tables'
+ sockets+=( -l$lopt $tblopt '-B[show buffer sizes for TCP sockets]' )
+ routing+=( $Mopts $tblopt
+ '-A[show the internal addresses of the routing table]'
'-F[only show routes with gateway in the same address family as the destination]'
- '-T+[select an alternate routing table to query]:routing table'
)
interfaces+=(
'-c+[show specified number of updates, then exit]:count'
@@ -280,7 +282,8 @@ case $OSTYPE in
'-q[only show interfaces that have seen packets]'
'-t[show current value of the watchdog timer function]'
)
- statistics+=( $popt )
+ statistics+=( $popt '-r[display routing statistics]' )
+ groups+=( -n$nopt )
pcb+=( $Mopts $verbose )
;;
netbsd*)
@@ -300,6 +303,12 @@ case $OSTYPE in
memory+=( $Xopt) statistics+=( $Xopt )
pcb+=( $Mopts $popt )
;;
+ freebsd<13->.*)
+ sockets+=(
+ '-c[show TCP stack used for each session]'
+ '-C[show TCP congestion control algorithm and diagnostic]'
+ )
+ ;&
freebsd<11->.*)
routing+=( '-F+[show specified routing table]:routing table' )
bpf=( '-z[reset statistic counters after displaying them]' )
diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm
index 423fd3223..888f1ef87 100644
--- a/Completion/Unix/Command/_nm
+++ b/Completion/Unix/Command/_nm
@@ -53,7 +53,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu
'(-C)--demangle[decode symbol names]'
'(--format -P)-f+[specify output format]:format:(bsd sysv posix)'
'(- *)--usage[give a short usage message]'
- '(- *)-\\?[display help information]'
+ '(- *)-?[display help information]'
)
;;
binutils)
@@ -62,11 +62,12 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu
'!(--no-recurse-limit)--recurse-limit'
'--no-recurse-limit[disable demangling recursion limit]'
'(-f --format -P)-f+[specify output format]:format:(bsd sysv posix)'
- '(-C --no-demangle)--demangle=-[decode symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat rust dlang)'
+ '(-C --no-demangle)--demangle=-[decode symbol names]::style [auto]:(auto gnu lucid arm hp edg gnu-v3 java gnat rust dlang)'
+ '--ifunc-chars=[specify characters to use for indirect function symbols]:characters for global/local indirect function symbols [ii]'
'--plugin[load specified plugin]:plugin'
'--special-syms[include special symbols in the output]'
'--synthetic[display synthetic symbols as well]'
- "--target=[target object format]:targets:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })"
+ "--target=[target object format]:target:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })"
'--with-symbol-versions[display version strings after symbol names]'
)
;;
diff --git a/Completion/Unix/Command/_nmap b/Completion/Unix/Command/_nmap
index b3d3d488a..2a507baa3 100644
--- a/Completion/Unix/Command/_nmap
+++ b/Completion/Unix/Command/_nmap
@@ -17,7 +17,7 @@ _arguments -C \
'-h[show help information]' \
'*-o-[log results]:log format:->log-forms:log filename:_files' \
'--resume[resume cancelled scan]:log filename:_files' \
- '--append_output[append results to any log files]' \
+ '--append-output[append results to any log files]' \
'-iL[read target specifications from file]:file:_files' \
'-iR[scan random hosts]:num hosts' \
'-p[specify ports to try]:port numbers' \
@@ -26,24 +26,24 @@ _arguments -C \
'-S[specify source address]:address:_hosts' \
'-e[specify interface to use]:network interface:_net_interfaces' \
'-g[specify source port number]:port number' \
- '--data_length[add random data to packets]:data length' \
+ '--data-length[add random data to packets]:data length' \
'(-R)-n[skip reverse DNS to speed things up]' \
'(-n)-R[always do reverse DNS on targets]' \
"-r[don't randomize order in which ports are scanned]" \
'-ttl[specify IPv4 time to live for sent packets]' \
- '--randomize_hosts[scan hosts in random order]' \
+ '--randomize-hosts[scan hosts in random order]' \
'-M[specify maximum number of parallel TCP connects]:maximum TCP connects' \
- '--packet_trace[show all packets sent in tcpdump-like format]' \
- '--version_trace[show packets related to version scanning]' \
+ '--packet-trace[show all packets sent in tcpdump-like format]' \
+ '--version-trace[show packets related to version scanning]' \
'--datadir[specify directory containing data files]:directory:_directories' \
'-T[specify timing policy]:timing policy:(Paranoid Sneaky Polite Normal Aggressive Insane)' \
- '--host_timeout[specify maximum time for scanning a single host]:timeout (ms)' \
- '--max_rtt_timeout[maximum time for a probe response]:timeout (ms)' \
- '--min_rtt_timeout[minimum time to wait for a probe response]:time (ms)' \
- '--initial_rtt_timeout[specify initial probe timeout]:timeout (ms)' \
- '--max_parallelism[specify max number of scans to perform in parallel]:number' \
- '--min_parallelism[scan at least specified number of ports in parallel]:number' \
- '--scan_delay[specify minimum amount of time between probes]:delay (ms)' \
+ '--host-timeout[specify maximum time for scanning a single host]:timeout (ms)' \
+ '--max-rtt-timeout[maximum time for a probe response]:timeout (ms)' \
+ '--min-rtt-timeout[minimum time to wait for a probe response]:time (ms)' \
+ '--initial-rtt-timeout[specify initial probe timeout]:timeout (ms)' \
+ '--max-parallelism[specify max number of scans to perform in parallel]:number' \
+ '--min-parallelism[scan at least specified number of ports in parallel]:number' \
+ '--scan-delay[specify minimum amount of time between probes]:delay (ms)' \
'--interactive[go into interactive mode]' \
'*:host:_hosts' && ret=0
diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump
index 989cd3f0b..e2dde7e4c 100644
--- a/Completion/Unix/Command/_objdump
+++ b/Completion/Unix/Command/_objdump
@@ -67,7 +67,8 @@ case $variant in
'(-z --disassemble-zeroes)'{-z,--disassemble-zeroes}"[don't skip blocks of zeroes when disassembling]"
'--start-address=[only process data whose address is >= ADDR]:address'
- '--stop-address=[only process data whose address is <= ADDR]:address'
+ '--stop-address=[only process data whose address is < ADDR]:address'
+ "--no-addresses[don't print address alongside disassembly]"
'--prefix-addresses[print complete address alongside disassembly]'
'(--show-raw-insn --no-show-raw-insn)'--{,no-}show-raw-insn'[display hex alongside symbolic disassembly]'
'--insn-width=[display specified number of bytes on a single line with -d]:width (bytes)'
@@ -80,6 +81,7 @@ case $variant in
'--dwarf-start=[display DIEs at specified or deeper depth]:depth'
'--dwarf-check[perform additional dwarf internal consistency checks]'
'--ctf-parent=[use specified section as the CTF parent]:section'
+ '--visualize-jumps=-[visualize jumps by drawing ASCII art lines]::color:(color extended-color off)'
)
;;
elfutils)
@@ -165,6 +167,7 @@ case "$state" in
_values -s "" "dwarf section" \
"l[rawline]" "L[decodedline]" "i[info]" "a[abbrev]" "p[pubnames]" \
"r[aranges]" "m[macro]" "f[frames]" "F[frames-interp]" "s[str]" \
+ 'O[str-offsets]' \
"o[loc]" "R[ranges]" "t[pubtypes]" "U[trace_info]" "u[trace_abbrev]" \
"T[trace_aranges]" "g[gdb_index]" "A[addr]" "c[cu_index]" "k[links]" \
"K[follow-links]" && ret=0
@@ -172,7 +175,7 @@ case "$state" in
dwarf-names)
_sequence _wanted dwarf-sections expl "dwarf section" compadd - \
rawline decodedline info abbrev pubnames aranges macro frames \
- frames-interp str loc Ranges pubtypes gdb_index trace_info \
+ frames-interp str str-offsets loc Ranges pubtypes gdb_index trace_info \
trace_abbrev trace_aranges addr cu_index links follow-links && ret=0
;;
bfdnames)
@@ -184,7 +187,7 @@ case "$state" in
${=${(M)${(f)"$(_call_program targets objdump --help)"}##* supported architectures:*}##*: } && ret=0
;;
disassembler_options)
- _values -s , "disassembler options" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:# [^ ]*}# }%% *}" && ret=0
+ _values -s , "disassembler option" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:# [^ ]*}# }%% *}" && ret=0
;;
llvm_targets)
_values "target architecture" "${(z)${(@)${(f)$(_call_program targets
diff --git a/Completion/Unix/Command/_openstack b/Completion/Unix/Command/_openstack
index fcb704ac8..d55686b80 100644
--- a/Completion/Unix/Command/_openstack
+++ b/Completion/Unix/Command/_openstack
@@ -34,8 +34,6 @@ if (( ! $+_cache_openstack_clnt_opts )); then
typeset -gA _cache_openstack_clnt_opts
typeset -gA _cache_openstack_clnt_cmds
typeset -gA _cache_openstack_clnt_cmds_opts
- typeset -gA _cache_openstack_clnt_cmds_subcmds
- typeset -gA _cache_openstack_clnt_cmds_subcmd_opts
fi
local -a conn_opts
@@ -61,65 +59,78 @@ if [[ -n ${clnts_compl_new[(r)$service]} ]]; then
# Populate caches - clnt_outputs is command raw output used later
_cache_openstack_clnt_outputs[$service]=${:-"$($service ${(Q)conn_opts} complete 2>/dev/null)"}
_cache_openstack_clnt_opts[$service]=${${${${(M)${${${${=${(f)"$($service help 2>/dev/null)"}}/\[}/\]}/\;}:#-[-0-9A-Za-z]*}/,}/\.}%--os-}
- _cache_openstack_clnt_cmds[$service]=${${${${_cache_openstack_clnt_outputs[$service]}/* cmds=\'}/\'*}/complete}
fi
- local cmd subcmd
- # Determine the command
- for word in ${words:1}; do
- local s=${_cache_openstack_clnt_cmds[$service]}
- [[ $s[(wI)$word] -gt 0 ]] && cmd=$word && break
- done
- # Populate the subcommand cache
- if [[ -n $cmd && -z $_cache_openstack_clnt_cmds_subcmds[$service$cmd] ]]; then
- local t=cmds_${cmd//-/_}
- _cache_openstack_clnt_cmds_subcmds[$service$cmd]=${${${_cache_openstack_clnt_outputs[$service]}/* $t=\'}/\'*}
+
+ # get worlds left of the curser into an array
+ local -a left_words
+ left_words=(${=LBUFFER})
+
+ # if curser is directly at a word (no space at the end),
+ # exclude the last word to offer right matches
+ # the last word could be a partial match that is later checked (prefix-needed)
+ local partial=""
+ if [[ "${LBUFFER[-1]}" != " " ]]; then
+ partial=${(@)left_words[-1]}
+ left_words=(${(@)left_words[1,$#left_words-1]})
fi
- # Determine the subcommand
- if [[ -n $cmd ]]; then
- for word in ${words:2}; do
- local s=${_cache_openstack_clnt_cmds_subcmds[$service$cmd]}
- [[ $s[(wI)$word] -gt 0 ]] && subcmd=$word && break
- done
- # Populate subcommand option cache
- if [[ -n $subcmd && -z $_cache_openstack_clnt_cmds_subcmd_opts[$service${cmd}--$subcmd] ]]; then
- local t=cmds_${cmd//-/_}_${subcmd//-/_}
- _cache_openstack_clnt_cmds_subcmd_opts[$service${cmd}--$subcmd]=${${${_cache_openstack_clnt_outputs[$service]}/* $t=\'}/\'*}
- fi
+ # remove $service
+ left_words=(${left_words:1})
+
+ # filter out "help"
+ if [[ $left_words[1] == help ]]; then
+ left_words=(${(@)left_words[2,$#left_words]})
fi
- # Special treatment for the help command
- if [[ $cmd == help ]]; then
- if [[ $words[CURRENT-1] == $cmd && $words[CURRENT] != -* ]]; then
- # Offer commands
- [[ -n $_cache_openstack_clnt_cmds[$service] ]] && _values -w option ${(u)=_cache_openstack_clnt_cmds[$service]} && ret=0
- elif [[ $words[CURRENT-2] == $cmd && $words[CURRENT-1] != -* && $words[CURRENT] != -* ]]; then
- # Offer subcommands
- local cmd=$words[CURRENT-1]
- local t=cmds_${cmd//-/_}
- [[ -z $_cache_openstack_clnt_cmds_subcmds[$service$cmd] ]] && _cache_openstack_clnt_cmds_subcmds[$service$cmd]=${${${_cache_openstack_clnt_outputs[$service]}/* $t=\'}/\'*}
- [[ -n $_cache_openstack_clnt_cmds_subcmds[$service$cmd] ]] && _values -w option ${(u)=_cache_openstack_clnt_cmds_subcmds[$service$cmd]} && ret=0
- else
- # Handle help<TAB> properly
- _values -w option help && ret=0
- fi
- # Client options
- elif [[ -z $cmd && $words[CURRENT] == -* ]]; then
- _values -w option ${(u)=_cache_openstack_clnt_opts[$service]} && ret=0
- # Commands
- elif [[ -z $cmd ]]; then
- if [[ -z $_cache_openstack_clnt_cmds[$service] ]]; then
- _message "missing authentication options"
+
+ # filter out options (-*)
+ left_words=(${left_words//-*})
+
+ local -a subcmd_array cmds_array cache_key_array cache_values
+ subcmd_array=()
+ cmds_array=(cmds)
+ cache_key_array=(${service})
+ cache_values=()
+ local cache_key cmds
+ cache_key=""
+ cmds=""
+
+ # Check for matches one level at a time
+ # example: "" server create
+ for word in "" ${(@)left_words}; do # first loop second loop third loop
+ subcmd_array=(${(@)subcmd_array} ${word}) # () (server) (server create)
+ cmds_array=(${(@)cmds_array} ${word}) # (cmds) (cmds server) (cmds server create)
+ cmds=${${(j:_:)cmds_array}/-/_} # cmds cmds_openstack cmds_server_create
+ cache_key_array=(${(@)cache_key_array} ${word}) # (openstack) (openstack server) (openstack server create)
+ cache_key=${${(j:_:)cache_key_array}/-/_} # openstack openstack_server openstack_server_create
+
+ # lookup if current word is in cache_values of last elements
+ if [[ ${cache_values[(wI)${word}]} -gt 0 || $word == "" ]]; then
+ _cache_openstack_clnt_cmds[${cache_key}]=${${${_cache_openstack_clnt_outputs[${service}]}/* ${cmds}=\'}/\'*}
else
- _values -w option ${(u)=_cache_openstack_clnt_cmds[$service]} && ret=0
+ # unknown word: set cache_key to last cache_key and break
+ cache_key=${${(j:_:)${cache_key_array:0:${#cache_key_array}-1}}/-/_}
+ break
fi
- # Subcommands
- elif [[ -z $subcmd ]]; then
- [[ -n $_cache_openstack_clnt_cmds_subcmds[$service$cmd] ]] && _values -w option ${(u)=_cache_openstack_clnt_cmds_subcmds[$service$cmd]} && ret=0
- # Subcommand options
+ # set cache_values for next loop
+ cache_values=${_cache_openstack_clnt_cmds[${cache_key}]}
+ done
+
+ # Populate the command cache
+ if [[ -z $_cache_openstack_clnt_cmds[${cache_key}] ]]; then
+ _message "missing authentication options"
else
- { ! zstyle -T ":completion:${curcontext}:options" prefix-needed || [[ -prefix - ]] } && \
- [[ -n $_cache_openstack_clnt_cmds_subcmd_opts[$service${cmd}--$subcmd] ]] && _values -w option ${(u)=_cache_openstack_clnt_cmds_subcmd_opts[$service${cmd}--$subcmd]//\:/\\\:} && ret=0
+ # add global options to completion list if current word start with -*
+ local extra_opts
+ if [[ $words[CURRENT] == -* ]]; then;
+ extra_opts=${_cache_openstack_clnt_opts[$service]}
+ fi
+
+ { ! zstyle -T ":completion:${curcontext}:options" prefix-needed \
+ || [[ -n "${partial}" && ${${_cache_openstack_clnt_cmds[${cache_key}]}[(Iw)${partial}*]} -gt 0 || -prefix - ]] } \
+ && _values -w option ${(u)=_cache_openstack_clnt_cmds[${cache_key}]} ${(u)=extra_opts} \
+ && ret=0
fi
+
# Old style clients
elif [[ -n ${clnts_compl_old[(r)$service]} ]]; then
if [[ -z $_cache_openstack_clnt_cmds[$service] ]]; then
diff --git a/Completion/Unix/Command/_opustools b/Completion/Unix/Command/_opustools
new file mode 100644
index 000000000..1fd97798a
--- /dev/null
+++ b/Completion/Unix/Command/_opustools
@@ -0,0 +1,71 @@
+#compdef opusenc opusdec opusinfo
+
+case $service in
+ opusenc)
+ _arguments -S \
+ '1:input file:_files -g "*.(#i)(wav|flac|ogg|aif(|f))(-.)"' \
+ '2:output file:_files -g "*.(#i)opus(-.)"' \
+ '(- 1 *)'{-h,--help}'[show usage information]' \
+ '(- 1 *)'{-V,--version}'[show version information]' \
+ '(- 1 *)--help-picture[show help on attaching album art]' \
+ '--quiet[enable quiet mode]' \
+ '--bitrate[set target bitrate per channel]:target bitrate per channel (kbps) (6-256)' \
+ '--comp[set encoding complexity]:encoding complexity (1-10) [10]:(1 2 3 4 5 6 7 8 9 10)' \
+ '--cvbr[use constrained variable bitrate encoding]' \
+ '--downmix-mono[downmix to mono]' \
+ '--downmix-stereo[downmix to stereo (if >2 channels)]' \
+ '--expect-loss[set expected packet loss]:expected packet loss (%%) (0-100) [0]' \
+ '--framesize[set maximum frame size]:maximum frame size (milliseconds) [20]:(2.5 5 10 20 40 60)' \
+ '--hard-cbr[use hard constant bitrate encoding]' \
+ '--max-delay[set maximum container delay]:maximum container delay (milliseconds) (0-1000) [1000]' \
+ '--music[tune low bitrates for music (override automatic detection)]' \
+ '--no-phase-inv[disable use of phase inversion for intensity stereo]' \
+ '--speech[tune low bitrates for speech (override automatic detection)]' \
+ '--vbr[use variable bitrate encoding (default)]' \
+ '--album[set album or collection]:album or collection' \
+ '--date[set date of track]:date of track (YYYY, YYYY-MM, or YYYY-MM-DD):_dates -f "%F"' \
+ '--discard-comments[discard metadata when transcoding]' \
+ '--discard-pictures[discard pictures when transcoding]' \
+ '--padding[reserve extra bytes for metadata]:padding size (bytes) [512]' \
+ '--title[set track title]:track title' \
+ '--tracknumber[set track number]:track number' \
+ '*--artist[add artist or author]:artist or author' \
+ '*--comment[add an extra comment]:comment (tag=val)' \
+ '*--genre[add genre]:genre' \
+ '*--picture[attach album art]:album art:_files -g "*.(#i)(jp(|e)g|png|gif)(-.)"' \
+ '--ignorelength[ignore the data length in RIFF wav headers]' \
+ '--raw-bits[set bits per sample for raw input]:bits per sample [16]:(8 16 24)' \
+ '--raw-chan[set number of channels for raw input]:number of channels (1-255) [2]' \
+ '--raw-endianness[set endianness for raw input]:endianness:(("0"\:"big endian" "1"\:"little endian"))' \
+ '--raw-rate[set sampling rate for raw input]:sample rate (Hz) (100-768000) [48000]' \
+ '--raw[interpret input as raw PCM data without headers]' \
+ '--serial[force use of a specific stream serial number]:stream serial number' \
+ '--save-range[save check values for every frame to a file]:output for check values:_files' \
+ '--set-ctl-int[pass encoder control]:encoder control'
+ ;;
+ opusdec)
+ _arguments -S \
+ '1:input file:_files -g "*.(#i)opus(-.)"' \
+ '2::output file:_files -g "*.(#i)wav(-.)"' \
+ '(- 1 *)'{-h,--help}'[show usage information]' \
+ '(- 1 *)'{-V,--version}'[show version information]' \
+ '(- 1 *)--help-picture[show help on attaching album art]' \
+ '--quiet[enable quiet mode]' \
+ '--rate[force decoding at given sample rate]:sample rate (Hz) (8000-192000)' \
+ '--force-stereo[force decoding to stereo]' \
+ '--gain[adjust output volume]:gain (dB) (negative is quieter)' \
+ '--no-dither[do not dither 16-bit output]' \
+ '--float[output 32-bit floating-point samples]' \
+ '--force-wav[force RIFF wav header on output]' \
+ '--packet-loss[simulate random packet loss]:packet loss probability (%%) (0-100)' \
+ '--save-range[save check values for every frame to a file]:output for check values:_files'
+ ;;
+ opusinfo)
+ _arguments -s -S \
+ '(- 1 *)-h[show usage information]' \
+ '(- 1 *)-V[show version information]' \
+ '*-q[make the output quieter]' \
+ '*-v[make the output more verbose]' \
+ '*:opus file:_files -g "*.(#i)opus(-.)"'
+ ;;
+esac
diff --git a/Completion/Unix/Command/_pandoc b/Completion/Unix/Command/_pandoc
index 29d3724e0..b0fff80d6 100644
--- a/Completion/Unix/Command/_pandoc
+++ b/Completion/Unix/Command/_pandoc
@@ -1,130 +1,40 @@
#compdef pandoc
-# {{{ helper: cache policy for available formats and other variables
-(( $+functions[__pandoc_cache_policy] )) ||
-__pandoc_cache_policy(){
- local cache_file="$1"
- if [[ -f "${commands[pandoc]}" && -f "${cache_file}" ]]; then
- # if the manifest file is newer then the cache:
- if [[ "${commands[pandoc]}" -nt "${cache_file}" ]]; then
- return 0
- else
- return 1
- fi
+# input or output formats with optional extensions
+# required option: -T (input|output)
+(( $+functions[_pandoc_format] )) ||
+_pandoc_format() {
+ local -a inout expl
+ zparseopts -D -E - T:=inout
+ local format=${PREFIX%%(+|-)*}
+ if compset -P '*(+|-)'; then
+ local pm=${IPREFIX[-1]} # '+' or '-'
+ local -a extensions=(${${$(pandoc --list-extensions=$format):#$pm*}#(+|-)})
+ _wanted extensions expl 'extension' compadd -S '+' -r '-+ ' -a extensions
else
- return 0
+ local -a formats=( $(pandoc --list-$inout[2]-formats) )
+ _wanted formats expl 'format' compadd -S '+' -r '-+ ' -a formats
fi
}
-# }}}
-# {{{ choose a format among supported output format
-(( $+functions[_pandoc_output_format] )) ||
-_pandoc_output_format(){
- local update_policy
- zstyle -s ":completion:${curcontext}:" cache-policy update_policy
- if [[ -z "$update_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy
- fi
- if _cache_invalid pandoc_output_formats_simple; then
- output_formats_simple=($(pandoc --list-output-formats))
- _store_cache pandoc_output_formats_simple output_formats_simple
- else
- _retrieve_cache pandoc_output_formats_simple
- fi
- if _cache_invalid pandoc_output_formats_plus_extensible || _cache_invalid pandoc_output_formats_minus_extensible; then
- for f in ${output_formats_simple[*]}; do
- for e in $(pandoc --list-extensions=${f}); do
- if [[ "${e}" =~ '^\+' ]]; then
- output_formats_plus_extensible+=("${f}${e}")
- elif [[ "${e}" =~ '^\-' ]]; then
- output_formats_minus_extensible+=("${f}${e}")
- fi
- done
- done
- _store_cache pandoc_output_formats_minus_extensible output_formats_minus_extensible
- _store_cache pandoc_output_formats_plus_extensible output_formats_plus_extensible
- else
- _retrieve_cache pandoc_output_formats_minus_extensible
- _retrieve_cache pandoc_output_formats_plus_extensible
- fi
- _alternative \
- 'formats_plus:format:{_multi_parts "+" output_formats_plus_extensible}' \
- 'formats_minus:format:{_multi_parts -- "-" output_formats_minus_extensible}'
-}
-# }}}
-# {{{ choose a format among supported input format
-(( $+functions[_pandoc_input_format] )) ||
-_pandoc_input_format(){
- local update_policy
- zstyle -s ":completion:${curcontext}:" cache-policy update_policy
- if [[ -z "$update_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy
- fi
- if _cache_invalid pandoc_input_formats_simple; then
- input_formats_simple=($(pandoc --list-input-formats))
- _store_cache pandoc_input_formats_simple input_formats_simple
- else
- _retrieve_cache pandoc_input_formats_simple
- fi
- if _cache_invalid pandoc_input_formats_plus_extensible || _cache_invalid pandoc_input_formats_minus_extensible; then
- for f in ${input_formats_simple[*]}; do
- for e in $(pandoc --list-extensions=${f}); do
- if [[ "${e}" =~ '^\+' ]]; then
- input_formats_plus_extensible+=("${f}${e}")
- elif [[ "${e}" =~ '^\-' ]]; then
- input_formats_minus_extensible+=("${f}${e}")
- fi
- done
- done
- _store_cache pandoc_input_formats_minus_extensible input_formats_minus_extensible
- _store_cache pandoc_input_formats_plus_extensible input_formats_plus_extensible
- else
- _retrieve_cache pandoc_input_formats_minus_extensible
- _retrieve_cache pandoc_input_formats_plus_extensible
- fi
- _alternative \
- 'formats_plus:format:{_multi_parts "+" input_formats_plus_extensible}' \
- 'formats_minus:format:{_multi_parts -- "-" input_formats_minus_extensible}'
-}
-# }}}
-# {{{ choose a format among all supported formats
+
+# all supported formats
(( $+functions[_pandoc_all_formats] )) ||
_pandoc_all_formats(){
- local update_policy
- zstyle -s ":completion:${curcontext}:" cache-policy update_policy
- if [[ -z "$update_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy
- fi
- if _cache_invalid pandoc_input_formats_simple; then
- input_formats_simple=($(pandoc --list-input-formats))
- _store_cache pandoc_input_formats_simple input_formats_simple
- else
- _retrieve_cache pandoc_input_formats_simple
- fi
- if _cache_invalid pandoc_output_formats_simple; then
- output_formats_simple=($(pandoc --list-output-formats))
- _store_cache pandoc_output_formats_simple output_formats_simple
- else
- _retrieve_cache pandoc_output_formats_simple
- fi
- if _cache_invalid pandoc_all_formats; then
- all_formats=(${output_formats_simple} ${input_formats_simple})
- all_formats=($(sort -u <<<"${all_formats[*]}"))
- _store_cache pandoc_all_formats all_formats
- else
- _retrieve_cache pandoc_all_formats
- fi
- _describe "format" all_formats
+ local -a expl
+ local -aU formats
+ formats=( $(pandoc --list-input-formats) $(pandoc --list-output-formats) )
+ _wanted formats expl 'format' compadd -a formats
}
-# }}}
-# {{{ pdf engine choice
+
+# pdf engine choice
(( $+functions[_pandoc_pdf_engine] )) ||
_pandoc_pdf_engine(){
_alternative \
- 'engines:engine:{_values "engine" pdflatex lualatex xelatex wkhtmltopdf weasyprint prince context pdfroff}' \
- 'engine_files:engine:_files'
+ 'engines:engine:(pdflatex lualatex xelatex latexmk tectonic wkhtmltopdf weasyprint prince context pdfroff)' \
+ 'engine-executables:engine executable:_files -g "*(#q*)"'
}
-# }}}
-# {{{ options to pass to --pdf-engine command
+
+# options to pass to --pdf-engine command
(( $+functions[_pandoc_pdf_engine_opts] )) ||
_pandoc_pdf_engine_opts(){
local pdf_engine=${opt_args[--pdf-engine]}
@@ -133,123 +43,75 @@ _pandoc_pdf_engine_opts(){
_tex
;;
*)
- type _${pdf_engine} > /dev/null
- if [[ $? == 1 ]]; then
- _message "Options for ${pdf_engine}"
- fi
+ _message "Options for ${pdf_engine}"
;;
esac
}
-# }}}
-# {{{ choose data-dir
-(( $+functions[_pandoc_data_dir] )) ||
-_pandoc_data_dir(){
- _files -/
+
+# data-dir specified by --data-dir option, or the default dir
+_pandoc_default_dir() {
+ if (( $+opt_args[--data-dir] )); then
+ echo ${opt_args[--data-dir]:a}
+ else
+ # XXX Some versions of pandoc may output two user data directories:
+ # ~/.local/share/pandoc or ~/.pandoc
+ # Here we use only the first one.
+ pandoc --version | sed -ne 's/.*[Uu]ser data directory: \([^ ]*\).*/\1/p'
+ fi
}
-# }}}
-# {{{ choose template from data-dir
+
+# template file in $PWD or data-dir/templates/, or URL
(( $+functions[_pandoc_template] )) ||
_pandoc_template(){
- local update_policy
- zstyle -s ":completion:${curcontext}:" cache-policy update_policy
- if [[ -z "$update_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy
- fi
- if _cache_invalid pandoc_output_formats_simple; then
- output_formats_simple=($(pandoc --list-output-formats))
- _store_cache pandoc_output_formats_simple output_formats_simple
- else
- _retrieve_cache pandoc_output_formats_simple
- fi
- local data_dir=${opt_args[--data-dir]}
- if [[ -z $data_dir ]]; then
- if _cache_invalid pandoc_default_data_dir; then
- default_data_dir=$(pandoc --version | sed -ne 's/Default user data directory: \(.*\)/\1/p')
- _store_cache pandoc_default_data_dir default_data_dir
- else
- _retrieve_cache pandoc_default_data_dir
- fi
- data_dir=${default_data_dir}
- fi
- _pandoc_template_find_args="-name '*.'${output_formats_simple[1]}"
- for ((i = 2; i < ${#output_formats_simple[@]}; i++ )); do
- _pandoc_template_find_args=$_pandoc_template_find_args" -or -name '*.'${output_formats_simple[$i]}"
- done
- templates=($(eval find -L ${data_dir}/templates ${_pandoc_template_find_args} 2>/dev/null | sed -e 's/.*\///' -e 's/\.[^.]*$//'))
- if [[ -z "${templates}" ]]; then
- templates=default
- fi
- _describe 'templates from default data-dir' templates
+ # find output format from '-t format' or '-o xxx.format'
+ local format=${${(v)opt_args[(i)(-t|--to|-w|--write)]}%%(+|-)*}
+ [[ -z $format ]] && format=${(v)opt_args[(i)(-o|--output)]:e}
+ local pat="'*'" # or '*.*' ?
+ [[ -n $format ]] && pat="'*.$format(-.)'"
+ local template_dir=$(_pandoc_default_dir)/templates
+ _alternative \
+ "local-templates:local template:_files -g $pat" \
+ "data-dir-templates:template in data-dir:_files -W $template_dir -g $pat" \
+ 'urls: :_urls'
}
-# }}}
-# {{{ choose highlight-style
+
+# choose highlight-style
(( $+functions[_pandoc_highlight_style] )) ||
_pandoc_highlight_style(){
- local update_policy
- zstyle -s ":completion:${curcontext}:" cache-policy update_policy
- if [[ -z "$update_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy
- fi
- if _cache_invalid pandoc_highlighting_styles; then
- highlighting_styles=($(pandoc --list-highlight-styles))
- _store_cache pandoc_highlighting_styles highlighting_styles
- else
- _retrieve_cache pandoc_highlighting_styles
- fi
_alternative \
- 'styles:style:{_values "syntax builting style" ${highlighting_styles[*]}}' \
- 'style_files_here:style:{_files -g "*.theme"}'
+ 'styles:style:( $(pandoc --list-highlight-styles) )' \
+ 'style-files:style file:_files -g "*.theme(-.)"'
}
-# }}}
-# {{{ choose filter from specified or default data-dir
+
+# filter file in $PWD, data-dir/filters/ or $PATH
(( $+functions[_pandoc_filter] )) ||
_pandoc_filter(){
- local update_policy
- zstyle -s ":completion:${curcontext}:" cache-policy update_policy
- if [[ -z "$update_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy
- fi
- local data_dir=${opt_args[--data-dir]}
- if [[ -z $data_dir ]]; then
- if _cache_invalid pandoc_default_data_dir; then
- default_data_dir=$(pandoc --version | sed -ne 's/Default user data directory: \(.*\)/\1/p')
- _store_cache pandoc_default_data_dir default_data_dir
- else
- _retrieve_cache pandoc_default_data_dir
- fi
- data_dir=${default_data_dir}
- fi
- local filters_dir=$data_dir"/filters"
+ local filters_dir=$(_pandoc_default_dir)/filters
_alternative \
- 'local_filter:filter:{_files -g "*.lua"}' \
- 'data_dir_filter:filter:{_files -W filters_dir -g "*.lua"}'
+ 'local-filters:local filter:_files' \
+ 'data-dir-filters:filter in data-dir:_files -W filters_dir' \
+ 'commands: : _command_names -e'
}
-# }}}
-# {{{ choose lua filter from specified or default data-dir
+
+# lua filter in $PWD or data-dir/filters/
(( $+functions[_pandoc_lua_filter] )) ||
_pandoc_lua_filter(){
- local update_policy
- zstyle -s ":completion:${curcontext}:" cache-policy update_policy
- if [[ -z "$update_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy
- fi
- local data_dir=${opt_args[--data-dir]}
- if [[ -z $data_dir ]]; then
- if _cache_invalid pandoc_default_data_dir; then
- default_data_dir=$(pandoc --version | sed -ne 's/Default user data directory: \(.*\)/\1/p')
- _store_cache pandoc_default_data_dir default_data_dir
- else
- _retrieve_cache pandoc_default_data_dir
- fi
- data_dir=${default_data_dir}
- fi
- local filters_dir=$data_dir"/filters"
+ local filters_dir=$(_pandoc_default_dir)/filters
_alternative \
- 'local_filter:filter:{_files -g "(#q*)(.)"}' \
- 'data_dir_filter:filter:{_files -W filters_dir -g "(#q*)(.)"}'
- }
-# }}}
-# {{{ choose reference location
+ 'local-filters:local filter:_files -g "*.lua(-.)"' \
+ 'data-dir-filters:filter in data-dir:_files -W filters_dir -g "*.lua(-.)"'
+}
+
+# default file in $PWD or data-dir/defaults/
+(( $+functions[_pandoc_defaults_file] )) ||
+_pandoc_defaults_file() {
+ local defaults_dir=$(_pandoc_default_dir)/defaults
+ _alternative \
+ 'local-defaults:default file:_files -g "*.yaml(-.)"' \
+ 'data-dir-defaults:default in data-dir:_files -W defaults_dir -g "*.yaml(-.)"'
+}
+
+# choose reference location
(( $+functions[_pandoc_reference_location] )) ||
_pandoc_reference_location(){
local -a policies
@@ -260,49 +122,38 @@ _pandoc_reference_location(){
)
_describe 'location' policies
}
-# }}}
-# --base-header-level must be 1-5: https://github.com/jgm/pandoc/blob/34d8ffbcfc33b86766ff7229be4d8a0d1fbffb50/src/Text/Pandoc/App.hs#L867
-# {{{ choose top level division
+
+# choose top level division
(( $+functions[_pandoc_top_level_division] )) ||
_pandoc_top_level_division(){
_values 'top level division' default section chapter part
}
-# }}}
-# {{{ choose header levels
-(( $+functions[_pandoc_header_levels] )) ||
-_pandoc_header_levels(){
- _values -s , "number" 1 2 3 4 5 6
-}
-(( $+functions[_pandoc_header_level] )) ||
-_pandoc_header_level(){
- _values "number" 1 2 3 4 5 6
-}
-# }}}
-# {{{ choose email obfusication
+
+# choose email obfusication
(( $+functions[_pandoc_email_obfusication] )) ||
_pandoc_email_obfusication(){
local -a policies
policies=(
- 'none:(default) leaves mailto: links as they are'
+ 'none:leave mailto: links as they are'
'javascript:obfuscates them using JavaScript'
'references:obfuscates them by printing their letters as decimal or hexadecimal character references'
)
- _describe 'obfusication' policies
+ _describe 'obfuscation policy [none]' policies
}
-# }}}
-# {{{ choose wrapping policy
+
+# choose wrapping policy
(( $+functions[_pandoc_wrap] )) ||
_pandoc_wrap() {
local -a policies
policies=(
- 'auto:(default) wrap lines to the column width specified by --columns (default 72)'
+ 'auto:wrap lines to the column width specified by --columns (default 72)'
"none:don't wrap lines at all"
'preserve:attempt to preserve the wrapping from the source document'
)
- _describe 'policy' policies
+ _describe 'policy [auto]' policies
}
-# }}}
-# {{{ choose eol policy
+
+# choose eol policy
(( $+functions[_pandoc_eol] )) ||
_pandoc_eol() {
local -a policies
@@ -313,105 +164,107 @@ _pandoc_eol() {
)
_describe 'policy' policies
}
-# }}}
-# {{{ choose changes tracking policy
+
+# choose changes tracking policy
(( $+functions[_pandoc_track_changes] )) ||
_pandoc_track_changes() {
local -a policies
policies=(
- 'accept:(default) inserts all insertions, and ignores all deletions'
+ 'accept:insert all insertions, and ignore all deletions'
'reject:inserts all deletions and ignores insertions'
'all:puts in insertions, deletions, and comments, wrapped in spans with insertion, deletion, comment-start, and comment-end classes, respectively'
)
- _describe 'policy' policies
+ _describe 'policy [accept]' policies
}
-# }}}
# The real thing
-_arguments -C \
- {-f,-r,--from=,--read=}'[specify input format]:format:_pandoc_input_format' \
- {-t,-w,--to=,--write=}'[specify output format]:format:_pandoc_output_format' \
- {-o,--output=}'[write output to FILE instead of stdout]:file:_files' \
- '--data-dir=[specify the user data directory to search for pandoc data files]:dir:_pandoc_data_dir' \
- '--base-header-level=[specify the base level for headers (defaults to 1)]:number:_pandoc_header_level' \
- '--strip-empty-paragraphs[deprecated. Use the +empty_paragraphs extension instead]: :' \
- '--indented-code-classes=[classes to use for indented code blocks]:class:{_message "Classes separated with ,"}' \
- '*--filter=[specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written]:file:_pandoc_filter' \
- '*--lua-filter=[transform the document in a similar fashion as JSON filters (see --filter), but use pandoc'"'"'s built-in lua filtering system]:file:_pandoc_lua_filter' \
- {-p,--preserve-tabs}'[preserve tabs instead of converting them to spaces]: :' \
- '--tab-stop=[specify the number of spaces per tab (default is 4)]:number:{_message -r "choose a number equals to or greater then 1"}' \
+_arguments -s \
+ {-f+,-r+,--from=,--read=}'[specify input format]: :_pandoc_format -T input' \
+ {-t+,-w+,--to=,--write=}'[specify output format]: :_pandoc_format -T output' \
+ {-o+,--output=}'[write output to FILE instead of stdout]:file:_files' \
+ '--data-dir=[specify the user data directory to search for pandoc data files]:data directory:_files -/' \
+ {-d+,--defaults=}'[read default from YAML file]: :_pandoc_defaults_file' \
+ '--shift-heading-level-by=[shift heading levels by specified number]:positive or negative integer: ' \
+ '!--base-header-level=:number [1]:(1 2 3 4 5)' \
+ '!--strip-empty-paragraphs[deprecated. Use the +empty_paragraphs extension instead]' \
+ '--indented-code-classes=[classes to use for indented code blocks]:class list (comma-separated)' \
+ '--default-image-extension=[specify a default extension to use when image paths/URLs have no extension]:extension: ' \
+ '--file-scope[parse each file individually before combining for multifile documents]' \
+ {\*-F+,\*--filter=}'[specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written]: :_pandoc_filter' \
+ {\*-L+,\*--lua-filter=}"[transform the document by using pandoc's built-in lua filtering system]: :_pandoc_lua_filter" \
+ {\*-M+,\*--metadata=}'[set the metadata field KEY to the value VALUE]:key\:value: ' \
+ '*--metadata-file=[read metadata from file]:YAML or JSON file:_files' \
+ {-p,--preserve-tabs}'[preserve tabs instead of converting them to spaces]' \
+ '--tab-stop=[specify the number of spaces per tab]:spaces [4]' \
'--track-changes=[specifies what to do with insertions, deletions, and comments produced by the MS Word "Track Changes" feature]: :_pandoc_track_changes' \
- '--file-scope[parse each file individually before combining for multifile documents]: :' \
- '--extract-media=[extract images and other media contained in or linked from the source document to the path DIR]:dir:{_dir_list}' \
- {-s,--standalone}'[produce output with an appropriate header and footer]: :' \
+ '--extract-media=[extract media in source document to specified directory]:directory:_files -/' \
+ '--abbreviations=[specifies a custom abbreviations file]:file:_files ' \
+ {-s,--standalone}'[produce output with an appropriate header and footer]' \
'--template=[use FILE as a custom template for the generated document. Implies --standalone]: :_pandoc_template' \
- {\*-M,\*--metadata=}'[set the metadata field KEY to the value VALUE]:key\:value: ' \
- {\*-V,\*--variable=}'[set the variable KEY to the value VALUE]:key\:value: ' \
- '(- :)'{-D,--print-default-template=}'[print the system default template for an output]:format:_pandoc_output_format' \
+ {\*-V+,\*--variable=}'[set the variable KEY to the value VALUE]:key\:value: ' \
+ '(- :)'{-D+,--print-default-template=}'[print the system default template for an output]:format:( $(pandoc --list-output-formats) )' \
'(- :)--print-default-data-file=[print a system default data file]:file: ' \
- '(- :)--print-highlight-style=[prints a JSON version of a highlighting style]:style|file: ' \
- '--dpi=[specify the dpi (dots per inch) value for conversion from pixels to inch/centimeters and vice versa]:number: ' \
'--eol=[manually specify line endings (crlf|lf|native)]: :_pandoc_eol' \
+ '--dpi=[specify the dpi (dots per inch) value for conversion from pixels to inch/centimeters and vice versa]:number: ' \
'--wrap=[determine how text is wrapped in the output (the source code, not the rendered version)]: :_pandoc_wrap ' \
- '--columns=[specify length of lines in characters (default 72)]:number: ' \
- '--strip-comments[strip out HTML comments in the Markdown or Textile source]: : ' \
- {--toc,--table-of-contents}'[include an automatically generated table of contents]: : ' \
- '--toc-depth=[specify the number of section levels to include in the table of contents]:number:{_message -r "choose a number equals to or greater then 1"}' \
- '--no-highlight[disables syntax highlighting for code blocks and inlines]: : ' \
+ '--columns=[specify length of lines in characters]:length [72]' \
+ {--toc,--table-of-contents}'[include an automatically generated table of contents]' \
+ '--toc-depth=[specify the number of section levels to include in the table of contents]:number' \
+ '--strip-comments[strip out HTML comments in the Markdown or Textile source]' \
+ '--no-highlight[disables syntax highlighting for code blocks and inlines]' \
'--highlight-style=[specifies the coloring style to be used in highlighted source code]:style|file:_pandoc_highlight_style' \
- '--syntax-definition=[load a KDE XML syntax definition file]:file:{_files -g "*.xml"}' \
- {\*-H,\*--include-in-header=}'[include contents of FILE, verbatim, at the end of the header, implies --standalone]:file:_files' \
- {\*-B,\*--include-before-body=}'[include contents of FILE, verbatim, at the beginning of the document body, implies --standalone]:file:_files' \
- {\*-A,\*--include-end-body=}'[include contents of FILE, verbatim, at the end of the document body, implies --standalone]:file:_files' \
+ '(- :)--print-highlight-style=[prints a JSON version of a highlighting style]: :_pandoc_highlight_style' \
+ '--syntax-definition=[load a KDE XML syntax definition file]:file:_files -g "*.xml(-.)"' \
+ {\*-H+,\*--include-in-header=}'[include contents of FILE, verbatim, at the end of the header, implies --standalone]:file:_files' \
+ {\*-B+,\*--include-before-body=}'[include contents of FILE, verbatim, at the beginning of the document body, implies --standalone]:file:_files' \
+ {\*-A+,\*--include-end-body=}'[include contents of FILE, verbatim, at the end of the document body, implies --standalone]:file:_files' \
'--resource-path=[list of paths to search for images and other resources]:searchpath:_dir_list' \
'--request-header=[set the request header NAME to the value VAL when making HTTP requests]:name\:val: ' \
- '--self-contained[produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. Implies --standalone]: : ' \
- '--html-q-tags[use <q> tags for quotes in HTML]: : ' \
- '--ascii[use only ASCII characters in output, supported only for HTML and DocBook output]: : ' \
- '--reference-links[use reference-style links, rather than inline links]: : ' \
+ '--no-check-certificate[disable the certificate verification]' \
+ '--self-contained[produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. Implies --standalone]' \
+ '--html-q-tags[use <q> tags for quotes in HTML]' \
+ '--ascii[use only ASCII characters in output, supported only for HTML and DocBook output]' \
+ '--reference-links[use reference-style links, rather than inline links]' \
'--reference-location=[specify where footnotes (and references, if reference-links is set) are placed (block|section|document)]: :_pandoc_reference_location' \
- '--atx-headers[use ATX-style headers in Markdown and AsciiDoc output]: : ' \
+ '--markdown-headings[specify style for level1 and 2 headings in markdown output]:style [atx]:(setext atx)' \
+ '!--atx-headers[use ATX-style headers in Markdown and AsciiDoc output]' \
'--top-level-division=[treat top-level headers as the given division type in LaTeX, ConTeXt, DocBook, and TEI output]: :_pandoc_top_level_division' \
- {-N,--number-sections}'[number section headings in LaTeX, ConTeXt, HTML, or EPUB output]: : ' \
- '--number-offset=[offset for section headings in HTML output (ignored in other output formats)]: :_pandoc_header_levels' \
- '--listings[use the listings package for LaTeX code blocks]: : ' \
- {-i,--incremental}'[make list items in slide shows display incrementally (one by one)]: : ' \
- '--slide-level=[specifies that headers with the specified level create slides (for beamer, s5, slidy, slideous, dzslides)]: :_pandoc_header_levels' \
- '--section-divs[wrap sections in <section> tags (or <div> tags for html4)Use the section-divs package for LaTeX code blocks]: : ' \
+ {-N,--number-sections}'[number section headings in LaTeX, ConTeXt, HTML, or EPUB output]' \
+ '--number-offset=[offset for section headings in HTML output (ignored in other output formats)]:number[number,...] [0]' \
+ '--listings[use the listings package for LaTeX code blocks]' \
+ {-i,--incremental}'[make list items in slide shows display incrementally (one by one)]' \
+ '--slide-level=[specifies that headers with the specified level create slides (for beamer, s5, slidy, slideous, dzslides)]:slide level:(1 2 3 4 5 6)' \
+ '--section-divs[wrap sections in <section> tags (or <div> tags for html4)Use the section-divs package for LaTeX code blocks]' \
'--email-obfusication=[treat top-level headers as the given division type in LaTeX, ConTeXt, DocBook, and TEI output (none|javascript|references)]: :_pandoc_email_obfusication' \
- '--default-image-extension=[specify a default extension to use when image paths/URLs have no extension]:extension: ' \
'--id-prefix=[specify a prefix to be added to all identifiers and internal links in HTML and DocBook output]:string: ' \
- {-T,--title-prefix=}'[specify STRING as a prefix at the beginning of the title that appears in the HTML header]:string: ' \
- {\*-c,\*--css=}'[link to a CSS style sheet]:url: ' \
+ {-T+,--title-prefix=}'[specify STRING as a prefix at the beginning of the title that appears in the HTML header]:string: ' \
+ {\*-c+,\*--css=}'[link to a CSS style sheet]: :_urls' \
'--reference-doc=[use the specified file as a style reference in producing a docx or ODT file]:file: ' \
- '--epub-subdirectory=[specify the subdirectory in the OCF container that is to hold the EPUB-specific contents]:dir:{_files -/}' \
+ '--epub-subdirectory=[specify the subdirectory in the OCF container that is to hold the EPUB-specific contents]:directory:_files -/' \
'--epub-cover-image=[use the specified image as the EPUB cover]:file:_files' \
- '--epub-metadata=[look in the specified XML file for metadata for the EPUB]:file:{_files -g "*.xml"}' \
+ '--epub-metadata=[look in the specified XML file for metadata for the EPUB]:file:_files -g "*.xml(-.)"' \
'*--epub-embed-font=[embed the specified font in the EPUB]:file:_files ' \
- '--epub-chapter-level=[specify the header level at which to split the EPUB into separate "chapter" files]:number:_pandoc_header_level' \
+ '--epub-chapter-level=[specify the header level at which to split the EPUB into separate "chapter" files]:number:(1 2 3 4 5 6)' \
+ '--ipynb-output=[specify how to tread ipynb output cells]:method:(all none best)' \
'--pdf-engine=[use the specified engine when producing PDF output]:program:_pandoc_pdf_engine' \
'*--pdf-engine-opt=[use the given string as a command-line argument to the pdf-engine]:string:_pandoc_pdf_engine_opts' \
- '*--bibliography=[set the bibliography field in the document'"'"'s metadata to FILE]:file:{_files -g "*.{bib,bibtex,copac,json,yaml,enl,xml,wos,medline,mods,ris}"}' \
- '--csl=[set the csl field in the document'"'"'s metadata to FILE]:file:{_files -g "*.csl"}' \
+ "*--bibliography=[set the bibliography field in the document's metadata to specified file]:file:_files -g '*.(bib|bibtex|copac|json|yaml|enl|xml|wos|medline|mods|ris)(-.)'" \
+ "--csl=[set the csl field in the document's metadata to specified file]:file:_files -g '*.csl(-.)'" \
'--citation-abbreviations=[set the citation-abbreviations field in the document'"'"'s metadata to FILE]:file:_files' \
'--natbib[use natbib for citations in LaTeX output]' \
'--biblatex[use biblatex for citations in LaTeX output]' \
'--mathml[convert TeX math to MathML (in epub3, docbook4, docbook5, jats, html4 and html5)]' \
- '--webtex=[convert TeX formulas to <img> tags that link to an external script that converts formulas to images]::url: ' \
- '--mathjax=[use MathJax to display embedded TeX math in HTML output]::url: ' \
- '--katex=[use KaTeX to display embedded TeX math in HTML output]::url: ' \
- {-m,--latexmathml=,--asciimathml=}'[deprecated. Use the LaTeXMathML script to display embedded TeX math in HTML output]::url: ' \
- '--mimetex=[deprecated. Render TeX math using the mimeTeX CGI script, which generates an image for each TeX formula]::url: ' \
- '--jsmath=[deprecated. Use jsMath (the predecessor of MathJax) to display embedded TeX math in HTML output]::url: ' \
- '--gladtex[deprecated. Enclose TeX math in <eq> tags in HTML output]: : ' \
- '--abbreviations=[specifies a custom abbreviations file]:file:_files ' \
+ '--webtex=[convert TeX formulas to <img> tags that link to an external script that converts formulas to images]:: :_urls' \
+ '--mathjax=[use MathJax to display embedded TeX math in HTML output]:: :_urls' \
+ '--katex=[use KaTeX to display embedded TeX math in HTML output]:: :_urls' \
+ '--gladtex[Enclose TeX math in <eq> tags in HTML output]' \
'--trace[enable tracing]' \
'--dump-args[print information about command-line arguments to stdout, then exit]' \
'--ignore-args[ignore command-line arguments (for use in wrapper scripts)]' \
'--verbose[give verbose debugging output]' \
'--quiet[suppress warning messages]' \
'--fail-if-warnings[exit with error status if there are any warnings]' \
- '--log=[write log messages in machine-readable JSON format to FILE]:file:_file' \
+ '--log=[write log messages in machine-readable JSON format to FILE]:file:_files' \
'(- :)--bash-completion[generate a bash completion script]' \
'(- :)--list-input-formats[list supported input formats, one per line]' \
'(- :)--list-output-formats[list supported output formats, one per line]' \
diff --git a/Completion/Unix/Command/_patchutils b/Completion/Unix/Command/_patchutils
index 50ea3e4c4..a5f6441b1 100644
--- a/Completion/Unix/Command/_patchutils
+++ b/Completion/Unix/Command/_patchutils
@@ -85,6 +85,7 @@ case $service in
'(-H --with-filename -h --no-filename)'{-h,--no-filename}"[don't print the name of the patch file containing each patch]"
'(-f --file)'{-f+,--file=}'[read regular expressions from file]:file:_files'
'--output-matching=[display the matching hunk- or file-level diffs]:level:(hunk file)'
+ '--only-match=[restrict regex to matching removals, additions or modifications]:limit:(rem removals add additions mod modifications all)'
)
;;
splitdiff)
diff --git a/Completion/Unix/Command/_pbm b/Completion/Unix/Command/_pbm
index 62004f79e..8b5576c5f 100644
--- a/Completion/Unix/Command/_pbm
+++ b/Completion/Unix/Command/_pbm
@@ -740,7 +740,7 @@ ppmtomitsu)
_arguments \
'-sharpness:sharpness:(1 2 3 4)' \
'-enlarge:enlargement factor:(1 2 3)' \
- '-media:output media (default\: 1184x1350):((A\:1216x1350 A4\:1184x1452 AS\:1216x1650 A4S\:1184x1754))' \
+ '-media:output media [1184x1350]:((A\:1216x1350 A4\:1184x1452 AS\:1216x1650 A4S\:1184x1754))' \
'-copy:number of copies:(1 2 3 4 5 6 7 8 9)' \
-{dpi300,tiny} ':file:_pbm'
;;
diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce
index 0d007e3bc..a52ac1d06 100644
--- a/Completion/Unix/Command/_perforce
+++ b/Completion/Unix/Command/_perforce
@@ -1354,7 +1354,7 @@ _perforce_fstat_fields() {
${${${${(M)${(f)"$(_perforce_call_p4 help-fstat help fstat)"}:#[[:blank:]]#[a-zA-Z]##(|\#)[[:blank:]]##--*}##[[:blank:]]#}:#fstat *}//[[:blank:]]##--[[:blank:]]##/:}
)
compset -P '*[,[:blank:]]'
- _describe -t fstat-fields 'Perforce fstat fields' values -S, -q
+ _describe -t fstat-fields 'Perforce fstat field' values -S, -q
}
@@ -2551,7 +2551,7 @@ _perforce_cmd_logstat() {
(( $+functions[_perforce_cmd_logtail] )) ||
_perforce_cmd_logtail() {
_arguments -s : \
- '-b[specify block size, default 8192]:block size: ' \
+ '-b[specify block size]:block size [8192]' \
'-s[specify start offset]:offset: ' \
'-m[specify max blocks]:max blocks: '
}
@@ -2668,12 +2668,12 @@ _perforce_cmd_passwd() {
_perforce_cmd_ping() {
_arguments -s : \
'-c[specify count of messages]:count of messages: ' \
- '-t[specify total time of test]:time in seconds: ' \
+ '-t[specify total time of test]:time (seconds)' \
'-i[specify iterations for test]:number of iterations: ' \
'-f[transmit continuously without waiting for responses]' \
- '-p[specify pause between tests]:pause in seconds: ' \
- '-s[specify send size]:send size in octets: ' \
- '-r[specify receive size]:receive size in octets: '
+ '-p[specify pause between tests]:pause (seconds)' \
+ '-s[specify send size]:send size (octets)' \
+ '-r[specify receive size]:receive size (octets)'
}
@@ -2942,7 +2942,7 @@ _perforce_cmd_status() {
_perforce_cmd_sizes() {
_arguments -s : \
'-a[list all revisions in range]' \
- '-b[specify blocksize]:blocksize in bytes: ' \
+ '-b[specify blocksize]:blocksize (bytes)' \
'(-H)-h[print sizes in human-readable form (GiB)]' \
'(-h)-H[print sizes in human-readable form (GB)]' \
'-m[limit max files]:max files: ' \
diff --git a/Completion/Unix/Command/_perl b/Completion/Unix/Command/_perl
index 0914264fe..d7e8f1b51 100644
--- a/Completion/Unix/Command/_perl
+++ b/Completion/Unix/Command/_perl
@@ -1,14 +1,10 @@
#compdef perl
-#
-# zsh completion code for the Perl interpreter
-# Adam Spiers <adam@spiers.net>
-#
-# Completions currently based on Perl 5.14.1.
+
typeset -A opt_args
_perl () {
_arguments -s \
- '-0-[input record separator ($/)]:$/ in octal or hex (\0, if no argument)' \
+ '-0-[input record separator ($/)]:: :_perl_input_seps' \
'-a[autosplit mode with -n or -p (splits $_ into @F)]' \
'-C-[control some unicode features]: :_perl_unicode_flags' \
"-c[check syntax only (runs BEGIN and END blocks)]" \
@@ -24,7 +20,7 @@ _perl () {
'-h[list help summary]' \
'-i-[edit <> files in place (make backup if extension supplied)]:backup file extension: ' \
'*-I-[specify @INC/#include directory (may be used more than once)]:include path:_files -/' \
- '-l-[enable line ending processing, specifies line terminator]:output record separator in octal: ' \
+ '-l-[enable line ending processing, specifies line terminator]:: :_perl_output_seps' \
\*{-m,-M}"-[module.. executes \`use/no module...' before executing your script]:module:_perl_m_opt" \
"-n[assume 'while (<>) { ... }' loop around your script]" \
"-p[assume loop like -n but print line also like sed]" \
@@ -35,7 +31,7 @@ _perl () {
"-u[dump core after parsing script]" \
"-U[allow unsafe operations]" \
"-v[print version, patchlevel and license]" \
- "-V-[print perl configuration information]:configuration keys:_perl_config_vars" \
+ "-V-[print perl configuration information]:configuration key:_perl_config_vars" \
'( -W -X)-w[turn warnings on for compilation of your script (recommended)]' \
"(-w -X)-W[enable all warnings (ignores 'no warnings')]" \
"(-w -W )-X[disable all warnings (ignores 'use warnings')]" \
@@ -63,6 +59,27 @@ _perl_m_opt () {
fi
}
+_perl_input_seps() {
+ if [[ $#PREFIX -eq 1 && $PREFIX != [0-9a-zA-Z] ]]; then
+ # convert a non-octal or potential option character into octal representation
+ compadd -i "$IPREFIX" -U $(( [##8] ##$PREFIX ))
+ else
+ _describe -x -t separators "input record separator, $/ in octal or hex (\0, if no argument) [\n]" '(
+ 0:paragraph\ mode
+ 777:slurp\ whole\ input\ files
+ )' || _comp_mesg=yes
+ fi
+}
+
+_perl_output_seps() {
+ if [[ $#PREFIX -eq 1 && $PREFIX != [0-9a-zA-Z] ]]; then
+ # convert a non-octal or potential option character into octal representation
+ compadd -i "$IPREFIX" -U $(( [##8] ##$PREFIX ))
+ else
+ _message -e separators "output record separator, $\\ in octal or hex [$/]"
+ fi
+}
+
_perl_config_vars () {
if (( ! $+_perl_config_vars )); then
_perl_config_vars=( $(perl -MConfig -e 'print join("\n", keys %Config);') )
@@ -79,45 +96,49 @@ _perl_config_vars () {
}
_perl_unicode_flags () {
- _values -s '' 'unicode bitmask or flags' \
- 'I[ 1 STDIN is assumed to be in UTF-8]' \
- 'O[ 2 STDOUT will be in UTF-8]' \
- 'E[ 4 STDERR will be in UTF-8]' \
- 'S[ 7 I + O + E]' \
- 'i[ 8 UTF-8 is the default PerlIO layer for input streams]' \
- 'o[ 16 UTF-8 is the default PerlIO layer for output streams]' \
- 'D[ 24 i + o]' \
+ _values -s '' 'unicode bitmask or flag' \
+ '(S)I[ 1 STDIN is assumed to be in UTF-8]' \
+ '(S)O[ 2 STDOUT will be in UTF-8]' \
+ '(S)E[ 4 STDERR will be in UTF-8]' \
+ '(I O E)S[ 7 I + O + E]' \
+ '(D)i[ 8 UTF-8 is the default PerlIO layer for input streams]' \
+ '(D)o[ 16 UTF-8 is the default PerlIO layer for output streams]' \
+ '(i o)D[ 24 i + o]' \
'A[ 32 the @ARGV elements are expected to be strings encoded in UTF-8]' \
'L[ 64 make "IOEioA" conditional on the locale environment variables]' \
'a[256 set ${^UTF8CACHE} to -1, used for debugging]' \
}
_perl_debugging_flags () {
- _values -s '' 'debugging bitmask or flags' \
- 'p[ 1 Tokenizing and parsing (with v, displays parse stack)]' \
- 's[ 2 Stack snapshots (with v, displays all stacks)]' \
- 'l[ 4 Context (loop) stack processing]' \
- 't[ 8 Trace execution]' \
- 'o[ 16 Method and overloading resolution]' \
- 'c[ 32 String/numeric conversions]' \
- 'P[ 64 Print profiling info, preprocessor command for -P, source file input state]' \
- 'm[ 128 Memory and SV allocation]' \
- 'f[ 256 Format processing]' \
- 'r[ 512 Regular expression parsing and execution]' \
- 'x[ 1024 Syntax tree dump]' \
- 'u[ 2048 Tainting checks]' \
- 'U[ 4096 Unofficial, User hacking (reserved for private, unreleased use)]' \
- 'H[ 8192 Hash dump -- usurps values()]' \
- 'X[ 16384 Scratchpad allocation]' \
- 'D[ 32768 Cleaning up]' \
- 'S[ 66536 Thread synchronization]' \
- 'T[ 131072 Tokenising]' \
- 'R[ 262144 Include reference counts of dumped variables (eg when using -Ds)]' \
- 'J[ 524288 Do not s,t,P-debug (Jump over) opcodes within package DB]' \
- 'v[1048576 Verbose: use in conjunction with other flags]' \
- 'C[2097152 Copy On Write]' \
- 'A[4194304 Consistency checks on internal structures]' \
- 'q[8388608 quiet - currently only suppresses the "EXECUTING" message]' \
+ _values -s '' 'debug flag or bitmask' \
+ 'p[ 1 tokenizing and parsing (with v, display parse stack)]' \
+ 's[ 2 stack snapshots (with v, display all stacks)]' \
+ 'l[ 4 context (loop) stack processing]' \
+ 't[ 8 trace execution]' \
+ 'o[ 16 method and overload resolution]' \
+ 'c[ 32 string/numeric conversions]' \
+ 'P[ 64 print profiling info, source file input state]' \
+ 'm[ 128 memory and SV allocation]' \
+ 'f[ 256 format processing]' \
+ 'r[ 512 regular expression parsing and execution]' \
+ 'x[ 1024 syntax tree dump]' \
+ 'u[ 2048 tainting checks]' \
+ 'U[ 4096 unofficial, user hacking (reserved for private, unreleased use)]' \
+ 'X[ 16384 scratchpad allocation]' \
+ 'D[ 32768 cleaning up]' \
+ 'S[ 66536 Op slab allocation]' \
+ 'T[ 131072 tokenising]' \
+ 'R[ 262144 include reference counts of dumped variables (e.g. when using -Ds)]' \
+ "J[ 524288 show s,t,P-debug (don't jump over) on opcodes within package DB]" \
+ 'v[ 1048576 verbose: use in conjunction with other flags]' \
+ 'C[ 2097152 copy-on-write]' \
+ 'A[ 4194304 consistency checks on internal structures]' \
+ 'q[ 8388608 quiet - currently only suppresses the "EXECUTING" message]' \
+ 'M[ 16777216 trace smart match resolution]' \
+ 'B[ 33554432 dump subroutine definitions, including special blocks like BEGIN]' \
+ 'L[ 67108864 trace locale-related info]' \
+ 'i[134217728 trace PerlIO layer processing]' \
+ 'y[268435456 trace y///, tr/// compilation and execution]'
}
_perl "$@"
diff --git a/Completion/Unix/Command/_perldoc b/Completion/Unix/Command/_perldoc
index 3e58d5a50..b724d74ee 100644
--- a/Completion/Unix/Command/_perldoc
+++ b/Completion/Unix/Command/_perldoc
@@ -3,7 +3,7 @@
local curcontext="$curcontext" state line expl args ret=1
typeset -A opt_args
-args=( '*:Perl pod pages:->perl-pods' )
+args=( '*:Perl pod page:->perl-pods' )
if [[ $service = *PERLDOC* ]]; then
compset -q
@@ -46,7 +46,7 @@ case $state in
perl-pods)
if (( $+opt_args[-F] )); then
- _wanted files expl 'Perl modules and .pods' \
+ _wanted files expl 'Perl module or .pod' \
_files -g "*.(pod|pm)(-.)" && ret=0
else
_alternative \
diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep
index 3b4d082a7..9c3ddf039 100644
--- a/Completion/Unix/Command/_pgrep
+++ b/Completion/Unix/Command/_pgrep
@@ -5,8 +5,6 @@
# (which changed the behaviour of -f and added -a)
# - We don't really need to keep pgopts and pkopts separate, but it seems like
# it should make things a bit easier to follow
-# - @todo We could complete log-in classes given to -c
-# - @todo We could complete routing tables given to -T
local curcontext="$curcontext" state line ret=1 expl pgopts pkopts no
typeset -A opt_args
@@ -18,7 +16,7 @@ typeset -a arguments sig_arguments aopts
# overridden below
arguments=(
'-a[include process ancestors in match list]'
- '-c+[match only on specified login class]:login class'
+ '-c+[match only on specified login class]:login class:_login_classes'
'(-F --pidfile)'{-F+,--pidfile=}'[match only processes in specified PID file]:PID file:_files'
'(-f --full)'{-f,--full}'[match against full command line]'
'(-G --group)'{-G+,--group=}'[match only on specified real group IDs]: :_sequence _groups'
@@ -32,13 +30,15 @@ arguments=(
'(-M)-N+[extract name list from specified system]:system file:_files'
'(-o -n --oldest --newest)'{-n,--newest}'[match newest process]'
'(-o -n --oldest --newest)'{-o,--oldest}'[match oldest process]'
+ '(-O --older)'{-O+,--older=}'[select where older than specified age]:age (seconds)'
'(-P --parent)'{-P+,--parent=}'[match only on specified parent process IDs]: :->ppid'
'(-l)-q[suppress normal output]'
+ '(-r --runstates)'{-r+,--runstates}'[match runstates]:run state:compadd -S "" D I R S T t W X Z'
'-S[search also in system processes (kernel threads)]'
'(-s --session)'{-s+,--session=}'[match only on specified process session IDs]: :->sid'
# _signals is OK here - we do it differently below
'(ss)--signal=[specify signal to send to process]: :_signals -s'
- '-T+[match only on specified routing table]:routing table'
+ '-T+[match only on specified routing table]:routing table:_routing_tables'
'(-t --terminal)'{-t+,--terminal=}'[match only on specified controlling terminals]: :_sequence _ttys -do'
'(-U --uid)'{-U+,--uid=}'[match only on specified real user IDs]: :_sequence _users'
'(-u --euid)'{-u+,--euid=}'[match only on specified effective user IDs]: :_sequence _users'
@@ -62,8 +62,8 @@ arguments=(
case $OSTYPE in
linux*)
# Note: We deliberately exclude -v but not --inverse from pkill
- pgopts=acdFfGghLlnoPstUuVvwx-
- pkopts=ceFfGghLnoPstUuVx-
+ pgopts=acdFfGghLlnoOPrstUuVvwx-
+ pkopts=ceFfGghLnoOPstUuVx-
arguments=(
${arguments:#((#s)|*\))(\*|)-[acl]*}
'(-c --count)'{-c,--count}'[display count of matching processes]'
@@ -125,6 +125,10 @@ else
fi
fi
+if [[ $OSTYPE = dragonfly* ]]; then
+ arguments+=( '(-t)-T[match only processes associated with the current terminal]' )
+fi
+
arguments+=( $sig_arguments + o '*: :->pname' )
[[ $OSTYPE == linux* ]] || aopts+=( -A '*-' )
@@ -149,7 +153,7 @@ case $state in
_pgrep_sequence ppids 'parent process ID' ppid
;;
(pgid)
- _pgrep_sequence pgids 'process group ID' pgid
+ _sequence _pgids
;;
(projid)
_pgrep_sequence project-ids 'project ID' project
@@ -163,11 +167,21 @@ case $state in
(pname)
local ispat="pattern matching "
if (( ${+opt_args[-x]} )); then
- ispat=""
+ ispat+="full "
fi
if (( ${+opt_args[-f]} )); then
- _wanted process-args expl $ispat'process command line' \
- compadd ${${(f)"$(_call_program process-args ps -A -o args=)"}% *}
+ local -a opts=( -lf )
+ [[ $OSTYPE == linux* ]] && opts=( -a )
+ local -a matches=( ${(f)"$(
+ _call_program process-args pgrep ${(@q)opts} -- \
+ ${(q)${${:-$PREFIX$SUFFIX}:-.\*}}
+ )"} )
+ local -a displ=( "${${matches[@]//:/\:}[@]/ /:}" )
+ matches=( "${matches[@]##<-> }" )
+
+ local desc=$ispat'process command line'
+ _description process-args expl "$desc"
+ _describe -t process-args "$desc" displ matches "$@" -U "$expl[@]"
else
_wanted processes-names expl $ispat'process name' _process_names -a -t
fi
diff --git a/Completion/Unix/Command/_php b/Completion/Unix/Command/_php
index c4c4ab3e2..9a8f519b1 100644
--- a/Completion/Unix/Command/_php
+++ b/Completion/Unix/Command/_php
@@ -93,7 +93,7 @@ _php() {
+ '(hv)' # Help/version options; kept separate by convention
'(- 1 *)'{-h,--help}'[display help information]'
'(- 1 *)'{-v,--version}'[display version information]'
- '!(- 1 *)'{-\?,-\\\?,--usage}
+ '!(- 1 *)'{-\?,--usage}
+ '(im)' # Info/module options (exclusive with everything but -c/-n)
'(fi mc pb pf rf rn sc sv *)'{-i,--info}'[display configuration information (phpinfo())]'
diff --git a/Completion/Unix/Command/_ping b/Completion/Unix/Command/_ping
index 274204264..d36a0f3a9 100644
--- a/Completion/Unix/Command/_ping
+++ b/Completion/Unix/Command/_ping
@@ -11,7 +11,6 @@ case ${variant}:${${service#ping}:-4} in
args+=(
'-d[set SO_DEBUG on the socket]'
'-n[show network addresses as numbers]'
- '-M+[define mtu discovery]:mtu discovery:(do dont want)'
'-v[verbose output]'
)
;|
@@ -35,7 +34,7 @@ case ${variant}:${${service#ping}:-4} in
iputils:*|solaris:*|((free|net)bsd|darwin|dragonfly)*:4)
args+=( '-r[bypass normal routing tables]' )
;|
- iputils:*|((free|net)bsd|darwin|dragonfly)*:4)
+ (iputils|freebsd<13->.*):*|(freebsd<-12>.|netbsd|darwin|dragonfly)*:4)
args+=( '-a[audible bell for each packet]' )
;|
iputils:*|netbsd*:4|openbsd*)
@@ -49,6 +48,9 @@ case ${variant}:${${service#ping}:-4} in
(*bsd|darwin|dragonfly)*)
args+=( '-I+[specify source interface for multicast packets]:interface:_net_interfaces' )
;|
+ freebsd<13->.*|openbsd*)
+ args+=( '-H[try reverse-lookups of addresses]' )
+ ;|
freebsd*|darwin*|dragonfly*|netbsd*:6)
args+=( '-S+[specify source address]:source address' )
;|
@@ -58,10 +60,13 @@ case ${variant}:${${service#ping}:-4} in
(*bsd|darwin|dragonfly)*:4)
args+=( "-D[set the don't fragment bit]" )
;|
+ (freebsd|openbsd|darwin)*:6)
+ args+=( '-D[disable IPv6 fragmentation]' )
+ ;|
((free|net)bsd|darwin|dragonfly)*:4)
args+=( '-Q[somewhat quiet]')
;|
- freebsd*:6|darwin*:6|solaris*|netbsd*)
+ freebsd<-12>.*:6|darwin*:6|solaris*|netbsd*)
args+=(
'*-g+[specify gateway to use as the next hop to the destination]:gateway:_hosts'
)
@@ -71,10 +76,14 @@ case ${variant}:${${service#ping}:-4} in
;|
((free|net)bsd|darwin|dragonfly)*:6)
args+=(
- '-a+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)'
'-b+[set socket buffer size]:buffer size'
- '-H[try reverse-lookups of IPv6 addresses]'
'-N[probe node information multicast group address]'
+ )
+ ;|
+ (freebsd<-12>.|netbsd|darwin|dragonfly)*:6)
+ args+=(
+ '-a+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)'
+ '-H[try reverse-lookups of IPv6 addresses]'
'(-s)-t[generate ICMPv6 Node Information supported query types query]'
'(-s)-w[generate ICMPv6 Node Information DNS Name query]' '!(-s)-W'
)
@@ -91,30 +100,54 @@ case ${variant}:${${service#ping}:-4} in
'-N+[specify a next-hop router that the probe packet should go through]:router:_hosts'
)
;|
- (freebsd|darwin|dragonfly)*:4)
+ freebsd<13->.*:6|(freebsd|darwin|dragonfly)*:4)
args+=(
'-A[audible bell for no packet]'
+ '-t+[specify timeout after which ping exits]:deadline (seconds)'
+ '-W+[specify time to wait for a response]:wait time (ms)'
+ )
+ ;|
+ (freebsd|darwin|dragonfly)*:4)
+ args+=(
'-G+[specify maximum size for ICMP payload for sweeping pings]:size'
'-g+[specify minimum size for ICMP payload for sweeping pings]:size [0]'
'-h+[specify size increment for ICMP payload for sweeping pings]:size [1]'
'-M+[use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO]:ICMP:(mask time)'
'-m+[set IP Time to Live for outgoing packets]:ttl'
'-T+[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|openbsd|darwin)*:6)
- args+=( '-D[disable IPv6 fragmentation]' )
- ;|
- (freebsd|darwin)*:6)
+ (freebsd<-12>.*|darwin*):6)
args+=(
'-R[audible bell for no packet]'
'-r[audible bell for each packet]'
)
;|
- freebsd*:6)
+ (iputils|freebsd<13->.*):4)
+ args+=(
+ '(-F -N)-4[use IPv4 only]'
+ '-6[use IPv6 only]'
+ )
+ ;|
+ freebsd<13->.*:4)
+ args+=(
+ '-C+[add an 802.1p Ethernet Priority Code Point when sending a packet]:pcp:(-1 0 1 2 3 4 5 6 7)'
+ )
+ ;|
+ freebsd<13->.*:6)
+ args+=(
+ '*-e+[specify gateway to use as the next hop to the destination]:gateway:_hosts'
+ '-k+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)'
+ '(-s)-O[generate ICMPv6 Node Information supported query types query]'
+ '*-u[suppress fragmentation to minimum MTU]'
+ '(-s)-Y[generate ICMPv6 Node Information DNS Name query with old packet format]'
+ '(-s)-y[generate ICMPv6 Node Information DNS Name query]'
+ '-E[enable transport-mode IPsec encapsulated security payload]'
+ '-Z[enables transport-mode IPsec authentication header]'
+ )
+ ;|
+ freebsd<-12>.*:6)
args+=(
'-x+[specify time to wait for a response]:wait time (ms)'
'-X+[specify timeout after which ping exits]:deadline (seconds)'
@@ -154,19 +187,13 @@ case ${variant}:${${service#ping}:-4} in
;;
openbsd*)
args+=(
- '-H[try reverse-lookups of addresses]'
'-E[audible bell for no packet]'
'-e[audible bell for each packet]'
+ '-g[provide a visual display of packets received and lost]'
'-T+[change TOS value]:TOS value:(critical inetcontrol lowdelay netcontrol throughput reliability ef af cs)'
- '-V+[specify routing table to be used]:routing table'
+ '-V+[specify routing table to be used]:routing table:_routing_tables'
)
;;
- iputils:4)
- args+=(
- '(-F -N)-4[use IPv4 only]'
- '-6[use IPv6 only]'
- )
- ;|
iputils:*)
args+=(
'-A[adaptive]'
diff --git a/Completion/Unix/Command/_pip b/Completion/Unix/Command/_pip
new file mode 100644
index 000000000..bafc7f9e9
--- /dev/null
+++ b/Completion/Unix/Command/_pip
@@ -0,0 +1,213 @@
+#compdef -P pip[0-9.]#
+
+# To get completion of installable packages, do:
+# pip install pip-cache
+# and then run:
+# pip-cache update
+
+local curcontext="$curcontext" ret=1
+local -a state state_descr line
+local -A opt_args
+local python pip
+local -a args subcommands packages
+
+pip=${words[1]}
+python=${${pip}/pip/python}
+[[ $python == $pip ]] && python=python
+
+args=(
+ '(* : -)'{-h,--help}'[display usage information]'
+ '--isolated[ignore environment variables and user configuration]'
+ \*{-v,--verbose}'[give more output]'
+ \*{-q,--quiet}"[give less output]"
+ '--log=[specify log file where a complete record will be kept]:file:_files'
+ '--proxy=[specify a proxy]:proxy ([user\:passwd@]proxy.server\:port)'
+ '--retries=[specify maximum number of retries each connection should attempt]:retries [5]'
+ '--timeout=[set the socket timeout]:timeout (seconds) [15]'
+ '--exists-action=[specify action when a path already exists]:action:((s\:switch i\:ignore w\:wipe b\:backup a\:abort))'
+ '--cert=[specify path to alternate CA bundle]:path:_files'
+ '--client-cert=[specify path to SSL client certificate]:certificate file:_files'
+ '(--no-cache-dir)--cache-dir=[specify location to store the cache data]: :_directories'
+ '(--cache-dir)--no-cache-dir[disable the cache]'
+ "--disable-pip-version-check[don't check whether a new version of pip is available]"
+)
+
+subcommands=(
+ 'install:install packages'
+ 'download:download packages'
+ 'uninstall:uninstall packages'
+ 'freeze:output installed packages in requirements format'
+ 'list:list installed packages'
+ 'show:show information about installed packages'
+ 'check:verify installed packages have compatible dependencies'
+ 'search:search PyPI for packages'
+ 'wheel:build wheels from your requirements'
+ 'hash:compute hashes of package archives'
+ 'help:show available commands'
+)
+
+_arguments -C $args \
+ '(* : -)'{-V,--version}'[display version information]' \
+ ':subcommand:->subcommand' \
+ '*::options:->options' && ret=0
+
+case $state in
+ subcommand)
+ _describe -t subcommands 'pip subcommand' subcommands && ret=0
+ ;;
+
+ options)
+ curcontext="${curcontext%:*}-$words[2]:"
+
+ case $words[1] in
+ download|install|list|wheel)
+ args+=(
+ '--pre[include pre-release and development versions]'
+ '(-i --index-url)'{-i+,--index-url=}'[base URL of Python Package Index]:url:_urls'
+ '--extra-index-url=[extra URLs of package indexes to use in addition to --index-url]:url:_urls'
+ '--no-index[ignore package index (only looking at --find-links URLs instead)]'
+ '(-f --find-links)'{-f+,--find-links=}'[parse specified URL or HTML file for links to packages]:URL or file:_files -g "*.htm(|l)(-.)"'
+ '--process-dependency-links[enable the processing of dependency links]'
+ )
+ ;|
+ download|(un|)install|freeze|wheel)
+ args+=(
+ '(-r --requirement)'{-r+,--requirement=}'[all the packages listed in the given requirements file]:requirements file:_files -g "(requirement*|*.txt)(-.)"'
+ )
+ ;|
+ download|install|wheel)
+ args+=(
+ '!--use-wheel' '!--no-use-wheel'
+ "*--no-binary=[don't use binary packages]: :->package_list"
+ "*--only-binary=[don't use source packages]: :->package_list"
+ \*{-c+,--constraint=}'[constrain versions using the given constraints file]:constraints file:_files'
+ '(-e --editable)'{-e+,--editable=}'[install a package directly from a checkout]:directory or VCS+REPOS_URL[@REV]#egg=PACKAGE:_files -/'
+ '--src=[check out --editable packages into given directory]: :_directories'
+ '--ignore-requires-python[ignore the Requires-Python information]'
+ "--no-deps[don't install package dependencies]"
+ '(-b --build)'{-https://cloud.kiddleb+,--build=}'[specify directory to unpack packages into]: :_directories'
+ '--global-option=[extra global options to be supplied to the setup.py call before the install command]:options'
+ "--no-clean[don't clean up build directories]"
+ '--require-hashes[require a hash to check each requirement against]'
+ )
+ ;|
+
+ download)
+ args+=(
+ '(-d --dest)'{-d+,--dest=}'[download packages into given directory]: :_directories'
+ '--platform=[only download wheels compatible with platform]::platform'
+ '--python-version=[only download wheels compatible with specified Python interpreter version]:version'
+ '--implementation=[only download wheels compatible with specified Python implementation]:implementation:(pp jy cp ip py)'
+ )
+ ;;
+
+ install)
+ args+=(
+ '(-t --target)'{-t+,--target=}'[specify directory to install packages into]: :_directories'
+ '(-d --download)'{-d+,--download=}'[download packages into directory instead of installing them]: :_directories'
+ '(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]'
+ '--upgrade-strategy=[determine how dependency upgrading should be handled]:strategy:(eager only-if-needed)'
+ '--force-reinstall[when upgrading, reinstall all packages even if they are already up-to-date]'
+ '(-I --ignore-installed)'{-I,--ignore-installed}'[ignore installed packages]'
+ "--no-install[download and unpack all packages, but don't actually install them]"
+ "--no-download[don't download any packages, just install the ones already downloaded]"
+ '--install-option=[extra arguments to be supplied to the setup.py install command]:options'
+ '--user[install to the user install directory, typically ~/.local]'
+ '--egg[install as self contained egg file, like easy_install does]'
+ '--root=[install everything relative to this alternate root directory]: :_directories'
+ '--strip-file-prefix=[strip given prefix from script paths in wheel RECORD]:prefix'
+ '--prefix=[specify installation prefix where lib, bin and other top-level folders are placed]: :_directories'
+ '(--no-compile)--compile[compile py files to pyc]'
+ "(--compile)--no-compile[don't compile py files to pyc]"
+ '*:package name:->packages_or_dirs'
+ )
+ ;;
+
+ uninstall)
+ args+=(
+ '(-y --yes)'{-y,--yes}"[don't ask for confirmation of uninstall deletions]"
+ ':installed package:->installed_packages'
+ )
+ ;;
+
+ freeze)
+ args+=(
+ '(-f --find-links)'{-f+,--find-links=}'[specify URL to look for packages at]:url:_urls'
+ '(-l --local)'{-l,--local}"[if in a virtualenv that has global access, don't list globally-installed packages]"
+ '--user[only output packages installed in user-site]'
+ '--all[include pip, setuptools, distribute and wheel in output]'
+ )
+ ;;
+
+ hash)
+ args+=(
+ '(-a --algorithm)'{-a+,--algorithm=}'[specify hash algorithm]:algorithm:(sha256 sha384 sha512)'
+ '*: :_files'
+ )
+ ;;
+
+ list)
+ args+=(
+ '(-o --outdated -u --uptodate)'{-o,--outdated}'[list outdated packages (excluding editables)]'
+ '(-u --uptodate -o --outdated)'{-u,--uptodate}'[list uptodated packages (excluding editables)]'
+ '(-e --editable)'{-e,--editable}'[list editable projects]'
+ '(-l --local)'{-l,--local}"[if in a virtualenv that has global access, don't list globally-installed packages]"
+ '--user[only output packages installed in user-site]'
+ '--format=[select the output format]:format [legacy]:(legacy columns freeze json)'
+ '--not-required[list packages that are not dependencies of installed packages]'
+ )
+ ;;
+
+ show)
+ args+=(
+ '(-f --files)'{-f,--files}'[show the full list of installed files for each package]'
+ ':installed package:->installed_packages'
+ )
+ ;;
+
+ search)
+ args+=(
+ '(-i --index)'{-i+,--index=}'[specify base URL of Python Package Index]:URL:_urls'
+ )
+ ;;
+
+ wheel)
+ args+=(
+ '(-w --wheel-dir)'{-w+,--wheel-dir=}"[build wheels into given directory]: :_directories"
+ "--build-option=[extra arguments to be supplied to 'setup.py bdist_wheel']:options"
+ )
+ ;;
+
+ help)
+ _describe -t subcommands 'pip subcommand' subcommands
+ return
+ ;;
+
+ *) args+=( '*: :_default' ) ;;
+ esac
+
+ _arguments -s -S $args && ret=0
+
+ case $state in
+ package_list)
+ packages=( ${(f)"$(_call_program packages pip-cache pkgnames)"} )
+ _sequence _wanted packages expl package compadd - -a packages && ret=0
+ ;;
+
+ packages_or_dirs)
+ [[ -prefix - ]] || packages=( ${(f)"$(_call_program packages pip-cache pkgnames)"} )
+ _alternative \
+ 'all-packages:package:compadd -a packages' \
+ 'directories:directory with setup.py:_directories' && ret=0
+ ;;
+
+ installed_packages)
+ packages=( $(_call_program fetch-installed \
+ "env COMP_WORDS='pip uninstall' COMP_CWORD=2 PIP_AUTO_COMPLETE=1 $pip") )
+ _wanted installed-packages expl 'installed package' compadd -a packages && ret=0
+ ;;
+ esac
+ ;;
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_pkginfo b/Completion/Unix/Command/_pkginfo
index 6c71082ef..eca9e057e 100644
--- a/Completion/Unix/Command/_pkginfo
+++ b/Completion/Unix/Command/_pkginfo
@@ -1,22 +1,18 @@
#compdef pkginfo
-_pkginfo() {
- _arguments -s \
- '(-q -r -x)-l[long listing]' \
- '(-l -r -x)-q[quiet mode]' \
- '(-l -q -x)-r[relocation base]' \
- '(-l -q -r)-x[extracted listing]' \
- '-c[category]:category: ' \
- '-a[architecture]:architecture: ' \
- '-v[version]:version: ' \
- - set1 \
- '(-p)-i[select completely installed packages]' \
- '(-i)-p[select partially installed packages]' \
- '-R[root path]:root path:_files -/' \
- '*:package instance:_pkg_instance --_opts installed:set1--R' \
- - set2 \
- '-d[device]:device file:_files' \
- '*:package instance:_pkg_instance --_opts uninstalled:set2--d'
-}
-
-_pkginfo "$@"
+_arguments -s \
+ '(-q -r -x)-l[long listing]' \
+ '(-l -r -x)-q[quiet mode]' \
+ '(-l -q -x)-r[relocation base]' \
+ '(-l -q -r)-x[extracted listing]' \
+ '-c[category]:category' \
+ '-a[architecture]:architecture' \
+ '-v[version]:version' \
+ - set1 \
+ '(-p)-i[select completely installed packages]' \
+ '(-i)-p[select partially installed packages]' \
+ '-R[root path]:root path:_files -/' \
+ '*:package instance:_pkg_instance --_opts installed:set1--R' \
+ - set2 \
+ '-d[device]:device file:_files' \
+ '*:package instance:_pkg_instance --_opts uninstalled:set2--d'
diff --git a/Completion/Unix/Command/_pkgrm b/Completion/Unix/Command/_pkgrm
index 25a950221..1191a2d1f 100644
--- a/Completion/Unix/Command/_pkgrm
+++ b/Completion/Unix/Command/_pkgrm
@@ -1,20 +1,16 @@
#compdef pkgrm
-_pkgrm() {
- _arguments -s \
- '-Y[select packages by category]:category: ' \
- - set1 \
- '-n[non-interactive mode]' \
- '-v[trace all scripts]' \
- '-a[admin file]:admin file:_files' \
- "-A[force removal of all files]" \
- "-M[don't use vfstab file]" \
- '-R[root path]:root path:_files -/' \
- '-V[alternate vfstab file]:vfstab file:_files' \
- '*:package instance:_pkg_instance --_opts installed:set1--R' \
- - set2 \
- '-s[spool package]:spool directory:_files -/' \
- '*:package instance:_pkg_instance --_opts spooled:set2--s'
-}
-
-_pkgrm "$@"
+_arguments -s \
+ '-Y[select packages by category]:category' \
+ - set1 \
+ '-n[non-interactive mode]' \
+ '-v[trace all scripts]' \
+ '-a[admin file]:admin file:_files' \
+ "-A[force removal of all files]" \
+ "-M[don't use vfstab file]" \
+ '-R[root path]:root path:_files -/' \
+ '-V[alternate vfstab file]:vfstab file:_files' \
+ '*:package instance:_pkg_instance --_opts installed:set1--R' \
+ - set2 \
+ '-s[spool package]:spool directory:_files -/' \
+ '*:package instance:_pkg_instance --_opts spooled:set2--s'
diff --git a/Completion/Unix/Command/_pr b/Completion/Unix/Command/_pr
new file mode 100644
index 000000000..2aeeb13b3
--- /dev/null
+++ b/Completion/Unix/Command/_pr
@@ -0,0 +1,103 @@
+#compdef pr
+
+local curcontext=$curcontext variant msg ret=1
+local -a state state_descr line specs optA
+typeset -A opt_args
+
+# take care of '+FIRST_PAGE[:LAST_PAGE]' (GNU) or '+FIRST_PAGE' (POSIX)
+if _pick_variant -r variant gnu=GNU $OSTYPE --version; then
+ msg='FIRST_PAGE[:LAST_PAGE]'
+else
+ msg='first page'
+fi
+
+if [[ $words[CURRENT] = +* ]]; then
+ _message "$msg" && return
+fi
+
+if (( ! ${words[(I)+[0-9]*]} )); then
+ # if +number is not on the command line
+ specs=( '(hv)--pages=[specify first and last page numbers]: : _message $msg' )
+fi
+
+# common specs
+specs+=(
+ '(hv -a --across)'{-a,--across}'[with multi-column output, print columns across rather than down]'
+ '(hv -d --double-space)'{-d,--double-space}'[double space the output]'
+ '(hv -e --expand-tabs)'{-e-,--expand-tabs=-}'[expand tab (or specified char) with specified number of spaces]::number of spaces [8]:->char_number'
+ '(hv -h --header -t --omit-header)'{-h+,--header=}'[specify text used in header]:header: '
+ '(hv -i --output-tabs)'{-i-,--output-tabs=-}'[replace specified number of spaces with tab (or specified char)]::number of spaces [8]:->char_number'
+ '(hv -l --length)'{-l+,--length=}'[specify the page length]:number of lines [66]: '
+ '(hv -m --merge)'{-m,--merge}'[print all files in parallel, one in each column]'
+ '(hv -n --number-lines)'{-n-,--number-lines=-}'[number lines with specified separator and width]::number of digits [5]:->char_number'
+ '(hv -o --indent)'{-o+,--indent=}'[specify left margin]:margin [0]: '
+ '(hv -r -no-file-warnings)'{-r,--no-file-warnings}'[omit warning when a file cannot be opened]'
+ '(hv -s --separator)'{-s-,--separator=-}'[specify column separator character]:character [tab]: '
+ '(hv -t --omit-header -h --header)'{-t,--omit-header}'[omit page headers and trailers]'
+ '(hv -w --width)'{-w+,--width=}'[specify page width for multi-column output]:number of characters [72]: '
+ '(hv)*: :_files'
+)
+# XXX: pr accepts -2 -3 -4 ... for specifying the number of columns.
+# Here we offer only -2 and -3, and do so only if there is no
+# -2 -3 -4 ... or --columns on the command line.
+if (( ! ${words[(I)-([0-9]##*|-columns*)]} )); then
+ specs+=( {-2,-3}'[specify number of columns]' )
+fi
+
+if [[ $variant = gnu ]]; then
+ # GNU coreutils 8.32
+ specs+=(
+ '(hv -c --show-control-chars)'{-c,--show-control-chars}'[use hat (^G) and octal backslash notation]'
+ '(hv -D --date-format)'{-D+,--date-format=}'[specify format for the header date]: :_date_formats'
+ '(hv -f -F --form-feed)'{-f,-F,--form-feed}'[use form feeds instead of newlines to separate pages]'
+ '(hv -J --join-lines)'{-J,--join-lines}'[merge full lines in multi-column output]'
+ '(hv -N --first-line-number)'{-N+,--first-line-number=}'[specify the line number of the 1st line]:number: '
+ '(hv -S --sep-string)'{-S-,--sep-string=-}'[specify column separator string]:string: '
+ '(hv -T --omit-pagination)'{-T,--omit-pagination}'[omit page headers and trailers, eliminate any pagination]'
+ '(hv -v --show-nonprinting)'{-v,--show-nonprinting}'[use octal backslash notation]'
+ '(hv -W --page-width)'{-W+,--page-width=}'[specify page width always]:number of characters [72]: '
+ )
+ if (( ! ${words[(I)-[0-9]##*]} )); then
+ # if -2 -3 -4 ... are not on the command line
+ specs+=(
+ '(hv)--columns=[specify number of columns]:number of columns: '
+ + hv
+ '(- *)--help[display help and exit]'
+ '(- *)--version[output version information and exit]'
+ )
+ fi
+else
+ specs=( ${specs:#(|*\))--*} ) # remove long options
+ case $variant in
+ freebsd*|dragonfly*|darwin*|netbsd*)
+ specs+=(
+ '(-f)-F[use form feeds instead of newlines to separate pages]'
+ '(-F)-f[same as -F but pause before the 1st page if stdout is terminal]'
+ '-p[pause before each page if stdout is terminal]'
+ )
+ ;|
+ freebsd*|dragonfly*|darwin*)
+ specs+=( '-L+[specify locale to use]: :_locales' )
+ ;;
+ openbsd*)
+ specs+=( '(-f -F)'{-f,-F}'[use form feeds instead of newlines to separate pages]' )
+ ;;
+ esac
+ optA=( -A '[-+]?*' ) # a single '-' is a valid file name (stdin)
+fi
+
+_arguments -C -s -S $optA : $specs && ret=0
+
+case $state in
+ char_number)
+ # argument for option -e (and -i, -n) can be -e. -e10 or -e.10
+ # where . is any non-digit character
+ if compset -p 1; then
+ _message "$state_descr" && ret=0
+ else
+ _message "a character [tab] (optional), and $state_descr" && ret=0
+ fi
+ ;;
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps
index 98dcd1cd0..9b54cbcc6 100644
--- a/Completion/Unix/Command/_ps
+++ b/Completion/Unix/Command/_ps
@@ -236,8 +236,8 @@ else
[[ -z "$state" ]] && return ret
fi
-_values -s '' -S ' ' 'options' $bsd && ret=0
-_values -S ' ' 'options' $bsdarg && ret=0
+_values -s '' -S ' ' 'option' $bsd && ret=0
+_values -S ' ' 'option' $bsdarg && ret=0
if [[ -z $pids ]]; then
_pids && ret=0
fi
diff --git a/Completion/Unix/Command/_ptx b/Completion/Unix/Command/_ptx
new file mode 100644
index 000000000..12f1d2c9a
--- /dev/null
+++ b/Completion/Unix/Command/_ptx
@@ -0,0 +1,54 @@
+#compdef ptx
+
+local -a specs optA
+
+# common specs
+specs=(
+ '(hv -b --break-file)'{-b+,--break-file=}'[use characters in specified file as word separators]:break file:_files'
+ '(hv -f --ignore-case)'{-f,--ignore-case}'[fold lower case to upper case for sorting]'
+ '(hv -g --gap-size)'{-g+,--gap-size=}'[specify gap size between output fields]:number of chars [3]: '
+ '(hv -i --ignore-file)'{-i+,--ignore-file=}'[ignore keywords listed in specified file]:ignore file:_files'
+ '(hv -o --only-file)'{-o+,--only-file=}'[use only the keywords listed in specified file]:only file:_files'
+ '(hv -r --references)'{-r,--references}'[first field of each line is a reference]'
+ '(hv -w --width)'{-w+,--width=}'[specify page width, reference excluded]:number of characters [72]: '
+)
+
+if _pick_variant gnu=GNU unix --version; then
+ # GNU coreutils 8.32
+ specs+=(
+ '(hv -A --auto-reference)'{-A,--auto-reference}'[output automatically generated references]'
+ '(hv -G --traditional)'{-G,--traditional}"[behave more like System V 'ptx']"
+ '(hv -F --flag-truncation)'{-F+,--flag-truncation=}'[specify string for flagging line truncations]:string [/]: '
+ '(hv -M --macro-name)'{-M+,--macro-name=}"[specify macro name to use instead of 'xx']:macro name: "
+ '(hv)-O[generate output as roff directives]'
+ '(hv -R --right-side-refs)'{-R,--right-side-refs}'[put references at right, not counted in -w]'
+ '(hv -S --sentence-regexp)'{-S+,--sentence-regexp=}'[specify regexp for end of lines/sentences]:regexp: '
+ '(hv)-T[generate output as TeX directives]'
+ '(hv -W --word-regexp -b --break-file)'{-W+,--word-regexp=}'[specify regexp to match each keyword]:regexp: '
+ '(hv)--format=[specify the output format]:format:(roff tex)'
+ !{-t,--typeset-mode}'[not implemented]'
+ + hv
+ '(: * -)--help[display help and exit]'
+ '(: * -)--version[output version information and exit]'
+ )
+ if (( $words[(I)(-G|--traditional)] )); then
+ specs+=( + arg '1:input file:_files' '2:output file:_files' )
+ else
+ specs+=( + arg '(-G --traditional)*:input file:_files' )
+ fi
+else
+ # The only non-GNU implementation I can find is the one in
+ # heirloom-doctools. FreeBSD has a package for this.
+ specs=( ${specs:#(|*\))--*} ) # remove long options
+ # remove '+' from -b+ -g+ -i+ -o+ -w+
+ local MATCH MBEGIN MEND
+ specs=( ${specs/(#m)-[bgiow]+/$MATCH[1,-2]} )
+ specs+=(
+ '-t[prepare output for typesetter]'
+ '1:input file:_files'
+ '2:output file:_files'
+ )
+ optA=( -A '-?*' ) # a single '-' is a valid file name (stdin)
+fi
+
+_arguments -s -S $optA : $specs
diff --git a/Completion/Unix/Command/_pv b/Completion/Unix/Command/_pv
index 68f8e8586..d02d3a35d 100644
--- a/Completion/Unix/Command/_pv
+++ b/Completion/Unix/Command/_pv
@@ -25,7 +25,7 @@ _arguments -s -S $args \
'(-q --quiet)'{-q,--quiet}"[don't output any transfer information at all, useful with -L]" \
'(-W --wait)'{-W,--wait}'[display nothing until first byte transferred]' \
'(-D --delay-start -R --remote)'{-D+,--delay-start=}'[display nothing until delay has passed]:delay (seconds)' \
- '(-s --size)'{-s+,--size=}'[set estimated data size]:size (bytes):->size-unit' \
+ '(-s --size)'{-s+,--size=}'[set estimated data size]: :_numbers -u bytes size K M G T' \
'(-l --line-mode -R --remote)'{-l,--line-mode}'[count lines instead of bytes]' \
'(-0 --null -l --line-mode)'{-0,--null}'[lines are null-terminated]' \
'(-i --interval)'{-i+,--interval=}'[update every after specified interval]:interval (seconds) [1]' \
@@ -34,8 +34,8 @@ _arguments -s -S $args \
'(-N --name)'{-N+,--name=}'[prefix visual information with given name]:name' \
'(-f --force -R --remote)'{-f,--force}'[output even if standard error is not a terminal]' \
'(-c --cursor -R --remote)'{-c,--cursor}'[use cursor positioning escape sequences]' \
- '(-L --rate-limit)'{-L+,--rate-limit=}'[limit transfer rate]:rate (bytes per second):->size-unit' \
- '(-B --buffer-size)'{-B+,--buffer-size=}'[use a buffer size of given size]:size (bytes):->size-unit' \
+ '(-L --rate-limit)'{-L+,--rate-limit=}'[limit transfer rate]: :_numbers -u "bytes per second" rate K M G T' \
+ '(-B --buffer-size)'{-B+,--buffer-size=}'[use a buffer size of given size]: :_numbers -u bytes size K M G T' \
'(-C --no-splice)'{-C,--no-splice}'[never use splice(), always use read/write]' \
'(-R --remote)*'{-E,--skip-errors}"[skip read errors in input${Edesc}]" \
'(-S --stop-at-size -R --remote)'{-S,--stop-at-size}'[stop after --size bytes have been transferred]' \
@@ -70,18 +70,6 @@ case $state in
_pids $suf && ret=0
fi
;;
- size-unit)
- if compset -P '<->'; then
- _tags values units
- else
- _tags values
- fi
- while _tags; do
- _requested values && _message -e values "$state_descr" && ret=0
- _requested units expl unit compadd -o nosort - K M G T && ret=0
- (( ret )) || break
- done
- ;;
esac
return ret
diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python
index f10106f9b..e5bac18bb 100644
--- a/Completion/Unix/Command/_python
+++ b/Completion/Unix/Command/_python
@@ -1,7 +1,7 @@
#compdef -P python[0-9.]#
# Python 2.7
-# Python 3.4
+# Python 3.9
local curcontext="$curcontext" state state_descr line
typeset -A opt_args
@@ -11,7 +11,9 @@ if _pick_variant python3=Python\ 3 python2 --version; then
args=(
'(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
'(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
+ '--check-hash-based-pycs[configure how Python evaluates up-to-dateness of hash-based .pyc files]:mode:(always default never)'
"-I[isolate Python from the user's environment]"
+ '-q[do not print version and copyright messages]'
'-X[set implementation-specific option]:option'
)
else
@@ -37,7 +39,8 @@ _arguments -C -s -S "$args[@]" \
"-s[don't add user site directory to sys.path]" \
"-S[don't imply 'import site' on initialization]" \
'-u[unbuffered binary stdout and stderr]' \
- '-v[verbose (trace import statements)]' \
+ '(-vv)-v[trace module initialization and cleanup]' \
+ '(-v)-vv[in addition to -v, trace all files checked when searching for a module]' \
'(1 * -)-V[display version information]' \
'-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \
'-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \
diff --git a/Completion/Unix/Command/_qemu b/Completion/Unix/Command/_qemu
index 3c21c3e74..7bc02c30c 100644
--- a/Completion/Unix/Command/_qemu
+++ b/Completion/Unix/Command/_qemu
@@ -6,7 +6,7 @@ _qemu_log_items () {
[[ $hline[1] = Log ]] && continue
opts=($opts "${hline[1]}[${hline[2,-1]}]")
done
- _values -s , 'log items' $opts
+ _values -s , 'log item' $opts
}
local _qemu_machines
@@ -19,8 +19,8 @@ _arguments \
'-boot[specify which image to boot from]:boot device:((a\:floppy\ image\ a c\:hard\ disk d\:cdrom))' \
'-snapshot[write to temporary files instead of disk image files]' \
'-no-fd-bootchk[disable boot sig checking for floppies in Bochs BIOS]' \
- '-m[virtual RAM size (default=128)]:megs:' \
- '-smp[set the number of CPUs (default=1)]:number of CPUs:' \
+ '-m[specify virtual RAM size]:size (MB) [128]' \
+ '-smp[set the number of CPUs]:number of CPUs [1]' \
'-nographic[disable graphical output]' \
'-vnc[listen on VNC display]:display:' \
'-k[use keyboard layout]:keyboard layout language:(ar de-ch es fo fr-ca hu ja mk no pt-br sv da en-gb et fr fr-ch is lt nl pl ru th de en-us fi fr-be hr it lv nl-be pt sl tr)' \
@@ -45,7 +45,7 @@ _arguments \
'-s[wait gdb connection to port 1234]' \
'-p[change gdb connection port]:port:_ports' \
'-S[do not start CPU at startup]' \
- '-d[output log in /tmp/qemu.log]:log items:_qemu_log_items' \
+ '-d[output log in /tmp/qemu.log]:log item:_qemu_log_items' \
'-hdachs[force hard disk 0 geometry (usually qemu can guess it)]:hd0 geometry c,h,s:' \
'-vga[select video card type]:card type:(std cirrus vmware qxl xenfb none)' \
'-no-acpi[disable ACPI]' \
diff --git a/Completion/Unix/Command/_quilt b/Completion/Unix/Command/_quilt
index 76dda222f..01f8cfb83 100644
--- a/Completion/Unix/Command/_quilt
+++ b/Completion/Unix/Command/_quilt
@@ -6,6 +6,8 @@ local verbose='(-h)-v[verbose, more user friendly output]'
local color='(-h)--color=[use syntax coloring]:color:(always auto never)'
local pstyle='(-h)-p+[select patch style]:patch style:((0\:exclude\ top-level\ directory 1\:use\ .orig\ on\ top-level\ directory ab\:use\ a\ or\ b\ as\ top-level\ directory))'
local -a pform rcfile
+local k
+
pform=(
'(-U -c -C -h)-u[create a unified diff]'
'(-u -c -C -h)-U+[create a unified diff with num lines of context]:lines'
@@ -34,25 +36,92 @@ _quilt_unapplied() {
_arguments $help \
'--trace[run the command in bash trace mode]' \
- '--quiltrc=[use the specified configuration file]:files:_files' \
+ '--quiltrc=[use the specified configuration file]:file:_files' \
'--version[print the version number and exit]' \
- ':quilt command:(add annotate applied delete diff edit files fold fork graph
- grep header import mail new next patches pop previous push refresh remove
- rename revert series setup snapshot top unapplied upgrade)' \
+ ':quilt command:->cmd' \
'*:: :->subcmd' && return
-[[ -z $state ]] && return 1
+case $state in
+ ('')
+ return 1
+ ;;
+
+ (cmd)
+ # Divide the subcommands to categories. The categorization is our own;
+ # it's not based on any preexisting categorization in the quilt docs.
+ local -a manip=(
+ add:'add files to a patch'
+ delete:'remove a patch from the series'
+ edit:'add files to the topmost patch and open them in $EDITOR'
+ fold:'integrate an external patch into the topmost patch'
+ fork:'replace the topmost patch with a copy'
+ import:'add external patches to the series'
+ new:'add an empty patch to the series'
+ refresh:'update a patch with in-tree edits'
+ remove:'remove files from a given patch'
+ rename:"change a patch's name"
+ )
+ local -a tree=(
+ pop:'unapply a patch to the tree'
+ push:'apply a patch to the tree'
+ revert:'discard in-tree changes to files in a given patch'
+ )
+ local -a other=(
+ grep:'print file lines matching pattern'
+ header:"print or change a patch's prologue"
+ mail:'send patches by email'
+ setup:'initialize a source tree'
+ snapshot:'save a snapshot of the tree to diff against'
+ upgrade:'upgrade quilt metadata'
+ )
+ local -a interrogate=(
+ annotate:'show which patches modify which lines'
+ applied:'print the list of patches up to a given patch'
+ diff:'print differences between files'
+ files:'print the list of files that a given patch changes'
+ graph:'generate a patches dependency graph'
+ next:'print the name of the patch that follows a given patch'
+ patches:'print the list of patches that touch a given file'
+ previous:'print the name of the patch that precedes a given patch'
+ series:'print the list of all patches'
+ top:'print the name of the last applied patch'
+ unapplied:'print the list of patches following a given patch'
+ )
+ local -A cmdtypes=(
+ [manip]='series manipulator commands'
+ [tree]='tree manipulator commands'
+ [other]='other commands'
+ [interrogate]='series interrogator commands'
+ )
+ local ret=1
+ _tags ${cmdtypes// /-}
+ while _tags; do
+ for k in ${(ok)cmdtypes}; do
+ if _requested ${cmdtypes[$k]// /-}
+ then
+ _describe -t ${cmdtypes[$k]// /-} ${cmdtypes[$k]} $k &&
+ ret=0
+ fi
+ done
+ done
+ return ret
+ ;;
+
+ (subcmd)
+ ;;
+esac
+
rcfile=( ${opt_args[--quiltrc]:+--quiltrc=${opt_args[--quiltrc]}} )
case $words[1] in
add)
_arguments -S $help \
'-P+[specify patch to add files to]:patch:_quilt_applied' \
- '*:files:_files' && return
+ '*:file:_files' && return
;;
annotate)
_arguments $help \
'-P[stop checking for changes at the specified rather than the topmost patch]:patch:_quilt_series' \
- ':files:_files' && return
+ ':file:_files' && return
;;
applied) _arguments $help ':quilt series:_quilt_series' && return ;;
delete)
@@ -73,9 +142,9 @@ case $words[1] in
'(-P -z)--snapshot[diff against snapshot]' \
'--diff=[use the specified utility for generating the diff]:diff utility:_command_names -e' \
'--sort[sort files by name]' \
- '*:files:_files' && return
+ '*:file:_files' && return
;;
- edit) _arguments $help '*:files:_files' && return ;;
+ edit) _arguments $help '*:file:_files' && return ;;
files)
_arguments -s $help $verbose \
'-a[list all files in all applied patches]' \
@@ -118,14 +187,14 @@ case $words[1] in
'-P+[patch filename to use inside quilt]:quilt select patch filename: ' \
'-f[overwrite/update existing patches]' \
'-d+[header resolution when overwriting in existing patch]:resolution:((a\:all\ headers n\:new\ headers o\:old\ headers))' \
- '*:files:_files' && return
+ '*:file:_files' && return
;;
mail)
_arguments $help \
'(-h -M)-m[introduction text to use]:introduction text' \
'(-h -m)-M[read introduction text from file]:file:_files' \
'--prefix=[use an alternate prefix in the bracketed part of the subjects generated]:quilt select prefix: ' \
- '--mbox=[store all messages in the specified file in mbox format]:files:_files' \
+ '--mbox=[store all messages in the specified file in mbox format]:file:_files' \
'--send[send the messages directly]' \
'--sender=[specify envelope sender address to use]:sender:_email_addresses -c' \
'--from=[from header]:address:_email_addresses' \
@@ -133,13 +202,13 @@ case $words[1] in
'*--to=[append a recipient to the To header]:recipient:_email_addresses' \
'*--cc=[append a recipient to the Cc header]:recipient:_email_addresses' \
'*--bcc=[append a recipient to the Bcc header]:recipient:_email_addresses' \
- '--signature=[append specified signature file to messages]:files:_files' \
+ '--signature=[append specified signature file to messages]:file:_files' \
'--reply-to=[add reply address to message]:address:_email_addresses' \
'*:patch:_quilt_series' && return
;;
new) _arguments $help $pstyle ':patch name' && return ;;
next) _arguments $help ':patch:_quilt_series' && return ;;
- patches) _arguments -S $help $verbose $color '*:files:_files' && return ;;
+ patches) _arguments -S $help $verbose $color '*:file:_files' && return ;;
pop)
_arguments -s $help $verbose \
'-a[remove all applied patches]' \
@@ -184,7 +253,7 @@ case $words[1] in
revert)
_arguments $help \
'-P[revert changes in the named patch]:patch:_quilt_series' \
- '*:files:_files' && return
+ '*:file:_files' && return
;;
series) _arguments $help $verbose $color && return ;;
setup)
@@ -192,7 +261,9 @@ case $words[1] in
'-d[specify path prefix for resulting source tree]:prefix:_files -W / -P /' \
'--sourcedir[specify location of package sources]:directory:_directories' \
'--fuzz=[set the maximum fuzz factor]:factor' \
- ':files:_files' && return
+ '(--fast)--slow[use the original, slow method to process the spec file]' \
+ '(--slow)--fast[use an alternative, faster method to process the spec file]' \
+ ':file:_files' && return
;;
snapshot) _arguments $help '-d[only remove current snapshot]' && return ;;
unapplied) _arguments $help ':patch:_quilt_series' && return ;;
diff --git a/Completion/Unix/Command/_rake b/Completion/Unix/Command/_rake
index 8814edaa5..10d621991 100644
--- a/Completion/Unix/Command/_rake
+++ b/Completion/Unix/Command/_rake
@@ -37,7 +37,9 @@ case "$state" in
;;
target)
local -a targets
- targets=( ${${(f)"$(_call_program targets $words[1] -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/${${match[1]}//:/\\:}:${match[2]:l}} )
+ local all
+ zstyle -t ":completion:${curcontext}:targets" extended && all=-A
+ targets=( ${${(f)"$(_call_program targets $words[1] $all -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/${${match[1]}//:/\\:}:${match[2]:l}} )
if (( ! ${targets[(I)rake aborted!]} )) then
_describe -t targets 'rake target' targets && ret=0
else
diff --git a/Completion/Unix/Command/_rar b/Completion/Unix/Command/_rar
index 68982be60..d1d381974 100644
--- a/Completion/Unix/Command/_rar
+++ b/Completion/Unix/Command/_rar
@@ -4,6 +4,8 @@ local common expl
common=(
'-ad[append archive name to destination path]'
+ '-ad1[create a separate folder for files unpacked from each archive]'
+ "-ad2[like -ad1 but use archives' own folders]"
'-ap[set path inside archive]'
'-av\-[disable authenticity verification check]'
'-c\-[disable comments show]'
@@ -13,6 +15,7 @@ common=(
'-dh[open shared files]'
'-ep[exclude paths from name]'
'-f[freshen files]'
+ '-idn[hide archived names]'
'-idp[disable percentage display]'
'-ierr[send all messages to stderr]'
'-inul[disable all messages]'
@@ -27,6 +30,7 @@ common=(
'-tb+[process files modified before a date]:date (YYYYMMDDHHMMSS)'
'-tn+[process files newer than a specified time]:time'
'-to+[process files older than a specified time]:time'
+ '-ts-[save or restore time]:time:((m\:modification c\:change a\:access p\:preserve))'
'-u[update files]'
'-v[create volumes with size autodetection or list all volumes]'
'-ver[file version control]'
diff --git a/Completion/Unix/Command/_rclone b/Completion/Unix/Command/_rclone
index 40f06e0ba..a2e3429f5 100644
--- a/Completion/Unix/Command/_rclone
+++ b/Completion/Unix/Command/_rclone
@@ -62,7 +62,7 @@ _arguments -C \
'--backup-dir[make backups into hierarchy based at specified directory]:directory:_directories' \
'--bind[specify socal address to bind to for outgoing connections]:IPv4, IPv6 or name' \
'--buffer-size[specify in memory buffer size when reading files for each --transfer]:size [16M]' \
- '--bwlimit[specify bandwidth limit]:BwTimetable (kBytes/s or b|k|M|G suffix)' \
+ '--bwlimit[specify bandwidth limit]: :_numbers -u kBytes/s limit b k M G' \
'--cache-dir[specify directory rclone will use for caching]:directory [~/.cache/rclone]:_directories' \
'--checkers[specify number of checkers to run in parallel]:number [8]': \
'(-c --checksum)'{-c,--checksum}'[skip based on checksum & size, not mod-time & size]' \
@@ -79,7 +79,7 @@ _arguments -C \
'--dump-bodies[dump HTTP headers and bodies - may contain sensitive info]' \
'--dump-headers[dump HTTP headers - may contain sensitive info]' \
'--exclude[exclude files matching pattern]:stringArray' \
- '--exclude-from[read exclude patterns from file]:files:_files' \
+ '--exclude-from[read exclude patterns from file]:file:_files' \
'--exclude-if-present[exclude directories if filename is present]:string' \
'--fast-list[use recursive list if available]' \
'--files-from[read list of source-file names from file]:file:_files' \
@@ -99,15 +99,15 @@ _arguments -C \
'--log-format[specify comma separated list of log format options]:string ["date,time"]' \
'--log-level[specify log level]:string [NOTICE]:(DEBUG INFO NOTICE ERROR)' \
'--low-level-retries[number of low level retries to do]:int [10]' \
- '--max-age[only transfer files younger than this in s or suffix ms|s|m|h|d|w|M|y]:duration [default off]' \
+ '--max-age[only transfer files younger than specified age]: :_numbers -u seconds age ms\:milliseconds \:s\:seconds m\:minutes h\:hours d\:days w\:weeks M\:months y\:years' \
'--max-backlog[maximum number of objects in sync or check backlog]:int [10000]' \
'--max-delete[when synchronizing, limit the number of deletes]:delete limit [-1]' \
'--max-depth[limit the recursion depth]:depth [-1]' \
- '--max-size[only transfer files smaller than this in k or suffix b|k|M|G]:int [default off]' \
+ '--max-size[only transfer files smaller than specified size]: :_numbers -u kBytes size \:k M G' \
'--max-transfer[maximum size of data to transfer]:int [default off]' \
'--memprofile[write memory profile to file]:file:_files' \
- '--min-age[only transfer files older than this in s or suffix ms|s|m|h|d|w|M|y]:duration [default off]' \
- '--min-size[only transfer files bigger than this in k or suffix b|k|M|G]:int [default off]' \
+ '--min-age[only transfer files older than specified age]: :_numbers -u seconds age ms\:milliseconds \:s\:seconds m\:minutes h\:hours d\:days w\:weeks M\:months y\:years' \
+ '--min-size[only transfer files bigger than specified size]: :_numbers -u kBytes size \:k M G' \
'--modify-window[specify max time delta to be considered the same]:duration [1ns]' \
'--multi-thread-cutoff[use multi-threaded downloads for files above specified size]:size (250M)' \
'--multi-thread-streams[specify max number of streams to use for multi-threaded downloads]:number (4)' \
@@ -339,8 +339,8 @@ _arguments -C \
if [[ $state == 'files_or_remotes' ]]; then
remotes=( $(_call_program rclone-remotes rclone listremotes) )
_alternative \
- "remote:rclone-remotes:compadd -a remotes" \
- "file:files:_files" && ret=0
+ "rclone-remotes:remote:compadd -a remotes" \
+ "files:file:_files" && ret=0
fi
return ret
diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf
index 42094742e..fc0fb7ce1 100644
--- a/Completion/Unix/Command/_readelf
+++ b/Completion/Unix/Command/_readelf
@@ -18,7 +18,7 @@ args=(
'(-c --archive-index)'{-c,--archive-index}'[show symbol/file index in an archive]'
\*{-x,--hex-dump=}"[dump contents of specified section as bytes]:section:($sections)"
\*{-p,--string-dump=}"[dump contents of specified section as strings]:section:($sections)"
- '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o R t U u T g A c k K)'
+ '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o O R t U u T g A c k K)'
'--debug-dump=[show the contents of DWARF2 debug sections]::section:(rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges addr cu_index links follow-links)'
'(-I --histogram)'{-I,--histogram}'[show histogram of bucket list lengths]'
'(-W --wide)'{-W,--wide}'[allow output width to exceed 80 characters]'
@@ -43,8 +43,19 @@ case $variant in
'--dyn-syms[show dynamic symbol table]'
)
;|
+ elfutils|elftoolchain)
+ args+=(
+ '(-z --decompress)'{-z,--decompress}'[show compression information; decompress before dumping data]'
+ )
+ ;|
binutils)
args+=(
+ '!(-C --demangle)--no-demangle'
+ '(--demangle)-C[decode symbol names]'
+ '(-C)--demangle=-[decode symbol names]::style [auto]:(auto gnu lucid arm hp edg gnu-v3 java gnat)'
+ '!(--no-recurse-limit)--recurse-limit'
+ '--no-recurse-limit[disable demangling recursion limit]'
+ '(-L --lint --enable-checks)'{-L,--lint,--enable-checks}'[display warning messages for possible problems]'
\*{-R,--relocated-dump=}"[dump contents of specified section as relocated bytes]:section:($sections)"
"--dwarf-depth=[don't show DIEs at greater than specified depth]:depth"
'--dwarf-start=[show DIEs starting at specified depth or deeper]:depth'
@@ -52,6 +63,7 @@ case $variant in
'--ctf-parent=[use specified section as the CTF parent]:section'
'--ctf-symbols=[use specified section as the CTF external symbol table]:section'
'--ctf-strings=[use specified section as the CTF external string table]:section'
+ '(-T --silent-truncation)'{-T,--silent-truncation}"[if a symbol name is truncated, don't add ... suffix]"
)
;;
elfutils)
@@ -60,7 +72,6 @@ case $variant in
'--elf-section[used specified section as ELF input data]::section'
'(-e --exception)'{-e,--exception}'[show sections for exception handling]'
'(-N --numeric-addresses)'{-N,--numeric-addresses}"[don't find symbol names for addresses in DWARF data]"
- '(-z --decompress)'{-z,--decompress}'[show compression information; decompress before dumping data]'
'(--symbols)-s[show symbol table]'
'(-s)--symbols=-[show symbol table]::section:(.dynsym .symtab)'
'(--notes)-n[show core notes (if present)]'
diff --git a/Completion/Unix/Command/_renice b/Completion/Unix/Command/_renice
index cbdac8cae..3b0457348 100644
--- a/Completion/Unix/Command/_renice
+++ b/Completion/Unix/Command/_renice
@@ -12,7 +12,7 @@ else
_describe -o option opts && ret=0
case ${(v)words[(I)-?]} in
- -g) _message -e pgids 'process group ID' && ret=0 ;;
+ -g) _pgids && ret=0 ;;
-u) _users && ret=0 ;;
*) _pids && ret=0;;
esac
diff --git a/Completion/Unix/Command/_ri b/Completion/Unix/Command/_ri
index 070f46ac2..4d5a72985 100644
--- a/Completion/Unix/Command/_ri
+++ b/Completion/Unix/Command/_ri
@@ -6,26 +6,29 @@ typeset -A opt_args
_arguments -C \
'(- *)'{-h,--help}'[print help information and exit]' \
'(- *)'{-v,--version}'[display the version of ri]' \
- '*'{-d,--doc-dir}'[directory to search for documentation]:ri doc directory:_files -/' \
- '(-f --fmt --format)'{-f,--fmt,--format}'[format to use when displaying output]:output format:(ansi bs html plain simple)' \
+ '*'{-d+,--doc-dir=}'[directory to search for documentation]:ri doc directory:_directories' \
+ '(-f --format)'{-f+,--format=}'[format to use when displaying output]:output format [bs]:(ansi bs markdown rdoc)' \
'(-T --no-pager)'{-T,--no-pager}'[send output directly to stdout]' \
- '(-i, --interactive)'{-i,--interactive}'[interactive mode]' \
+ '(-i --interactive)'{-i,--interactive}'[interactive mode]' \
+ '(-a --all)'{-a,--all}'[show all documentation for a class or module]' \
+ '(-l --list)'{-l,--list}'[list classes ri knows about]' \
'--list-doc-dirs[list the directories from which ri will source documentation]' \
- '(-w --width)'{-w,--width}'[set the width of the output]:output width:' \
- '--no-standard-docs[do not include documentation from the Ruby standard library, site_lib, installed gems, or ~/.rdoc]' \
- '(--no-use-cache --use-cache)--'{no-,}'use-cache[whether or not to use ri'\''s cache]' \
- '(--no-system --system)--'{no-,}'system[include documentation from Ruby'\''s standard library]' \
+ '(-w --width)'{-w+,--width=}'[set the width of the output]:output width [72]' \
+ '(-l --list)--server=-[run RDoc server on the given port]::port [8214]:_ports' \
+ "--no-standard-docs[don't include documentation from the Ruby standard library, site_lib, installed gems, or ~/.rdoc]" \
+ '(--no-use-cache --use-cache)--'{no-,}"use-cache[whether or not to use ri's cache]" \
+ '(--no-system --system)--'{no-,}"system[include documentation from Ruby's standard library]" \
'(--no-site --site)--'{no-,}'site[include documentation from libraries installed in site_lib]' \
'(--no-gems --gems)--'{no-,}'gems[include documentation from RubyGems]' \
'(--no-home --home)--'{no-,}'home[include documentation stored in ~/.rdoc]' \
- '*:ri name:->ri-name' && ret=0
+ '--profile[run with the Ruby profiler]' \
+ '--dump=[dump data from an ri cache or data file]:cache:_files' \
+ '*:ri name:->ri-name' && return
if [[ "$state" = ri-name ]]; then
local -a ri_dirs ri_ext ri_names ri_wants ri_names
local class_dir esc_name dir curtag tag descr expl
- ret=1
-
if "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e 1 >/dev/null 2>&1; then
# Old-style Ruby 1.8.x RI
ri_dirs=( ${(f)"$(_call_program ri-names "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e '"o = RI::Options.instance; o.parse(ARGV); o.path.each { |p| puts p }"' -- ${(kv)opt_args[(I)-d|--doc-dir|--(system|site|gems|home)]})"} )
diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm
index ea9190de2..e66b77fa4 100644
--- a/Completion/Unix/Command/_rm
+++ b/Completion/Unix/Command/_rm
@@ -69,7 +69,7 @@ _arguments -C -s -S $opts \
case $state in
(file)
- line[CURRENT]=()
+ (( CURRENT > 0 )) && line[CURRENT]=()
line=( ${line//(#m)[\[\]()\\*?#<>~\^\|]/\\$MATCH} )
_files -F line && ret=0
;;
diff --git a/Completion/Unix/Command/_route b/Completion/Unix/Command/_route
index 06cca8d99..95df6d936 100644
--- a/Completion/Unix/Command/_route
+++ b/Completion/Unix/Command/_route
@@ -135,7 +135,7 @@ case $OSTYPE in
openbsd*)
subcmds+=( exec 'execute a command with alternate routing table' )
args+=(
- '-T+[select specified alternate routing table]:table id'
+ '-T+[select specified alternate routing table]:routing table:_routing_tables'
)
modifiers+=(
-sa
diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync
index 56efd7b13..eb906e974 100644
--- a/Completion/Unix/Command/_rsync
+++ b/Completion/Unix/Command/_rsync
@@ -71,31 +71,41 @@ _rsync_info() {
local opts
opts=( ${${(M)${(f)"$(_call_program values $words[1] --info=help)"}:#*Mention*}/ ##Me/[me} )
(( $#opts )) && opts=( '(ALL NONE HELP)'${^opts}\] )
- _values -s , 'info options' $opts ALL NONE HELP
+ _values -s , 'info option' $opts ALL NONE HELP
}
_rsync_debug() {
local opts
opts=( ${${(M)${(f)"$(_call_program values $words[1] --debug=help)"}:#*Debug*}/ ##De/[de} )
(( $#opts )) && opts=( '(ALL NONE HELP)'${^opts}\] )
- _values -s , 'debug options' $opts ALL NONE HELP
+ _values -s , 'debug option' $opts ALL NONE HELP
}
_rsync_files() {
_alternative "files:file:_files" "remote-files:remote file:_rsync_remote_files"
}
+_rsync_users_groups() {
+ local -a suf
+ if compset -P '*:'; then
+ _groups
+ else
+ compset -S ':*' || suf=( -qS ':' )
+ _users $suf
+ fi
+}
+
_rsync() {
_arguments -s \
'*'{-v,--verbose}'[increase verbosity]' \
{--no-v,--no-verbose}'[turn off --verbose]' \
- '--bwlimit=[limit I/O bandwidth]:limit (KiB per second)' \
+ '--bwlimit=[limit I/O bandwidth]: :_numbers -f -u "KiB per second" -d 1g limit B K M G T P' \
'--outbuf=[set output buffering]:buffering:(none line block)' \
'--port=[specify alternate port number]:port:(873)' \
'--address=[bind to the specified address]:bind address:_bind_addresses' \
'--log-file-format=[log updates using specified format]:format' \
'--log-file=[log what rsync is doing to the specified file]:file:_files' \
- '(-T --temp-dir)'{-T,--temp-dir=}'[create temporary files in specified directory]:directory:_directories' \
+ '(-T --temp-dir)'{-T+,--temp-dir=}'[create temporary files in specified directory]:directory:_directories' \
'--sockopts=[specify custom TCP options]' \
'(-4 -6 --ipv4 --ipv6)'{-4,--ipv4}'[prefer IPv4]' \
'(-4 -6 --ipv4 --ipv6)'{-6,--ipv6}'[prefer IPv6]' \
@@ -104,11 +114,12 @@ _rsync() {
'--config=[specify alternate rsyncd.conf file]:file:_files' \
'--daemon[run as an rsync daemon]' \
'--detach[detach from the parent]' \
- '(-M --dparam)'{-M,--dparam=}'[override global daemon config parameter]:config parameter' \
+ '(-M --dparam)'{-M+,--dparam=}'[override global daemon config parameter]:config parameter' \
'--no-detach[do not detach from the parent]' \
- client \
'(-)--help[display help information]' \
'*: :_rsync_files' \
+ '--stderr=[change stderr output mode]:output mode [errors]:(errors all client)' \
'(-q --quiet)'{-q,--quiet}'[suppress non-error messages]' \
'--no-motd[suppress the daemon message-of-the-day output]' \
'(-c --checksum)'{-c,--checksum}'[skip based on checksums, not mod-time & size]' \
@@ -121,7 +132,7 @@ _rsync() {
{--no-implied-dirs,--no-i-d}'[do not send implied dirs with --relative]' \
'(-b --backup)'{-b,--backup}'[make backups into hierarchy at indicated directory]' \
'--backup-dir=[make backups into specified directory]:backup directory:_directories' \
- '--suffix=[set backup suffix]:suffix:(\~)' \
+ '--suffix=[set backup suffix]:suffix [~]' \
'(-u --update)'{-u,--update}'[skip files that are newer on the receiving side]' \
'--inplace[update destination files in-place]' \
'(--append-verify)--append[append data onto shorter files]' \
@@ -131,6 +142,7 @@ _rsync() {
'--fake-super[use xattrs to save all file attributes]' \
'(-d --dirs)'{-d,--dirs}'[transfer directories without recursing]' \
{--no-d,--no-dirs}'[turn off --dirs]' \
+ "--mkpath[create the destination's path component]" \
'(-l --links)'{-l,--links}'[copy symlinks as symlinks]' \
{--no-l,--no-links}'[turn off --links]' \
'(-L --copy-links)'{-L,--copy-links}'[transform symlinks into referent file/dir]' \
@@ -142,6 +154,7 @@ _rsync() {
'(-K --keep-dirlinks)'{-K,--keep-dirlinks}'[treat symlinked dir on receiver as dir]' \
'(-p --perms -E --executability)'{-p,--perms}'[preserve permissions]' \
{--no-p,--no-perms}'[turn off --perms]' \
+ '--fileflags[preserve file-flags (aka chflags)]' \
'(-E --executability)'{-E,--executability}'[preserve executability]' \
'(-o --owner)'{-o,--owner}'[preserve owner]' \
{--no-o,--no-owner}'[turn off --owner]' \
@@ -150,22 +163,25 @@ _rsync() {
'(--devices --specials)-D[same as --devices --specials]' \
'(-D)--devices[preserve devices]' \
'--no-devices[turn off --devices]' \
- '--copy-devices[copy device contents as regular file]' \
'(-D)--specials[preserve special files]' \
'--no-specials[turn off --specials]' \
'--no-D[turn off --devices and --specials]' \
- '(-t --times)'{-t,--times}'[preserve times]' \
+ '(-t --times)'{-t,--times}'[preserve modification times]' \
{--no-t,--no-times}'[turn off --times]' \
+ \*{-U,--atimes}'[preserve access (use) times]' \
+ '--open-noatime[avoid changing the atime on opened files]' \
+ '(--crtimes -N)'{--crtimes,-N}'[preserve create times (newness)]' \
'(-O --omit-dir-times)'{-O,--omit-dir-times}'[omit directories when preserving times]' \
'(-J --omit-link-times)'{-J,--omit-link-times}'[omit symlinks when preserving times]' \
- '--chmod[change destination permissions]:mods' \
+ '--chmod=[change destination permissions]:permissions' \
'(-S --sparse)'{-S,--sparse}'[handle sparse files efficiently]' \
+ '--write-devices[write to devices as files (implies --inplace)]' \
'(-n --dry-run)'{-n,--dry-run}'[show what would have been transferred]' \
'(-W --whole-file)'{-W,--whole-file}'[copy files whole (without delta-transfer algorithm)]' \
{--no-W,--no-whole-file}'[turn off --whole-file]' \
- '--checksum-choice=[choose the checksum algorithms]:algorithm:_sequence -n 2 compadd - auto md4 md5 none' \
+ '(--cc --checksum-choice)'{--cc,--checksum-choice}'=[choose the checksum algorithms]:algorithm:_sequence -n 2 compadd - auto md4 md5 none' \
'(-x --one-file-system)'{-x,--one-file-system}"[don't cross filesystem boundaries]" \
- '(-B --block-size)'{-B,--block-size=}'[force a fixed checksum block-size]:block size' \
+ '(-B --block-size)'{-B+,--block-size=}'[force a fixed checksum block-size]: :_numbers -f -u bytes -d 1g "block size" B K M G T P' \
'(-e --rsh)'{-e+,--rsh=}'[specify the remote shell to use]:remote-shell command:(rsh ssh)' \
'--rsync-path=[specify path to rsync on the remote machine]:remote command' \
'--ignore-existing[ignore files that already exist on receiving side]' \
@@ -179,10 +195,14 @@ _rsync() {
'(--del --delete-before --delete-during --delete-after)--delete-delay[receiver deletes after transfer]' \
'--delete-excluded[also delete excluded files on the receiving side]' \
'--ignore-errors[delete even if there are I/O errors]' \
- '--force[force deletion of directories even if not empty]' \
- '--max-delete=[do not delete more than NUM files]:number' \
- '--max-size=[do not transfer any file larger than specified size]:number' \
+ --force{,-delete}'[force deletion of directories even if not empty]' \
+ '--force-change[affect user-/system-immutable files/dirs]' \
+ '--force-uchange[affect user-immutable files/dirs]' \
+ '--force-schange[affect system-immutable files/dirs]' \
+ "--max-delete=[don't delete more than NUM files]: :_numbers -f -u bytes size B K M G T P" \
+ "--max-size=[don't transfer any file larger than specified size]: :_numbers -f -u bytes size B K M G T P" \
'--min-size=[do not transfer any file smaller than specified size]:number' \
+ '--max-alloc=[set limit to individual memory allocation]: :_numbers -f -u bytes -d 1g size B K M G T P' \
'(-P)--partial[keep partially transferred files]' \
'--no-partial[turn off --partial]' \
'--partial-dir=[put a partially transferred file into specified directory]:directory:_directories' \
@@ -201,10 +221,11 @@ _rsync() {
'(--compare-dest --link-dest)*--copy-dest=[like --compare-dest, but also includes copies of unchanged files]:directory:_directories' \
'(--compare-dest --copy-dest)*--link-dest=[hardlink to files in specified directory hierarchy when unchanged]:directory:_directories' \
'(-z --compress)'{-z,--compress}'[compress file data during the transfer]' \
- '--compress-level=[explicitly set compression level]:number' \
+ '(--zc --compress-choice)'{--zc,--compress-choice}'=[override the automatic negotiation of the compression algorithm]:algorithm:(zstd lz4 zlibx zlib none)' \
+ '(--zl --compress-level)'{--zl,--compress-level}'=[explicitly set compression level]:number' \
'--skip-compress=[skip compressing files with a listed suffix]:suffixes' \
'(-C --cvs-exclude)'{-C,--cvs-exclude}'[auto-ignore files the same way CVS does]' \
- '*'{-f=,--filter=}'[add a file-filtering rule]:rule' \
+ '*'{-f+,--filter=}'[add a file-filtering rule]:rule' \
'*-F[same as --filter="dir-merge /.rsync-filter", repeated: --filter="- .rsync-filter"]' \
'--exclude-from=[read exclude patterns from specified file]:file:_files' \
'*--exclude=[exclude files matching pattern]:pattern' \
@@ -213,6 +234,7 @@ _rsync() {
'--files-from=[read list of source-file names from specified file]:file:_files' \
'(-0 --from0)'{-0,--from0}'[all *-from file lists are delimited by nulls]' \
'(-s --protect-args)'{-s,--protect-args}'[no space-splitting; only wildcard special-chars]' \
+ '--copy-as=[specify user & optional group for the copy]:user:_rsync_users_groups' \
'--version[print version number]' \
'*'{-h,--human-readable}'[output numbers in a human-readable format]' \
'--blocking-io[use blocking I/O for the remote shell]' \
@@ -227,23 +249,24 @@ _rsync() {
'--out-format=[output updates using specified format]:format' \
'--password-file=[read daemon-access password from file]:file:_files' \
'--list-only[list the files instead of copying them]' \
+ '--stop-after=[stop copying after specified time has elapsed]:time (minutes)' \
+ '--stop-at=[stop copying when specified point in time is reached]:date/time (YYYY-MM-DDTHH\:MM):_dates -F -S "T"' \
'(--only-write-batch)--write-batch=[write a batched update to the specified file]:file:_files' \
'(--write-batch)--only-write-batch=[like --write-batch but w/o updating destination]:file:_files' \
'--protocol=[force an older protocol version to be used]:number' \
'--info=[fine-grained informational verbosity]:info option:_rsync_info' \
'--debug=[fine-grained debug verbosity]:debug option:_rsync_debug' \
- '--msgs2stderr[special output handling for debugging]' \
+ '!(--stderr)--msgs2stderr' \
'--munge-links[munge symlinks to make them safer, but unusable]' \
'--ignore-missing-args[ignore missing source args without error]' \
'--delete-missing-args[delete missing source args from destination]' \
'(--usermap --chown)--usermap=[custom username mapping]:comma-separated mappings' \
'(--groupmap --chown)--groupmap=[custom groupname mapping]:comma-separated mappings' \
- '(--usermap --groupmap --chown)--chown=[simple username/groupname mapping]:user and/or group' \
- '*'{-M=,--remote-option=}'[send option to the remote side only]:option string' \
+ '(--usermap --groupmap --chown)--chown=[simple username/groupname mapping]:user and/or group:_rsync_users_groups' \
+ '*'{-M+,--remote-option=}'[send option to the remote side only]:option string' \
'--preallocate[preallocate the full length of new files]' \
'--iconv=[request charset conversion of filenames]:number' \
'--checksum-seed=:number' \
- "--noatime[don't alter atime when opening source files]" \
'--read-batch=[read a batched update from the specified file]:file:_files'
}
diff --git a/Completion/Unix/Command/_ruby b/Completion/Unix/Command/_ruby
index 3ed25a3f0..0e1f5dbc0 100644
--- a/Completion/Unix/Command/_ruby
+++ b/Completion/Unix/Command/_ruby
@@ -15,13 +15,13 @@ all=(
common=(
'*-I+[specify $LOAD_PATH directory (may be used more than once)]:library directory:_files -/'
'-w[turn warnings on for your script]'
- '-W-[set warning level]:warning level:((0\:silent 1\:medium 2\:verbose))'
+ '-W-[set warning level]:warning level:((0\:silent 1\:medium 2\:verbose \\\:deprecated \\\:experimental))'
'(-)1:ruby script:_files -g "*.rb(-.)"'
'*::script argument:= ->normal'
)
opts=(
- '-0-[specify record separator]:input record separator in octal [default \0]'
+ '-0-[specify record separator]:input record separator in octal [\0]'
'-a[autosplit mode with -n or -p (splits $_ into $F)]'
'-c[check syntax only]'
'-C+[cd to directory before executing your script]:directory:_files -/'
@@ -35,7 +35,7 @@ opts=(
'(-n)-p[assume loop like -n but print line also like sed]'
'-s[enable some switch parsing for switches after script name]'
'-S[look for the script using PATH environment variable]'
- '-T-[turn on tainting checks]::taint level [1]:((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))'
+ '!-T-[turn on tainting checks]::taint level [1]:((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))'
'(--verbose)-v[print version number, then turn on verbose mode]'
'(-v)--verbose[turn on verbose mode and disable script from stdin]'
'-x-[strip off text before #!ruby line and perhaps cd to directory]:directory:_files -/'
@@ -49,11 +49,11 @@ opts=(
'--jit[enable jit with default options]'
'--jit-warnings[enable printing JIT warnings]'
'--jit-debug[enable JIT debugging (very slow)]'
- '--jit-wait[wait until JIT compilation is finished every time (for testing)]'
+ '--jit-wait[wait until JIT compilation finishes every time (for testing)]'
'--jit-save-temps[save JIT temporary files]'
'--jit-verbose=-[print JIT logs of level num or less to stderr]:maximum log level [0]'
- '--jit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:number [1000]'
- '--jit-min-calls=-[specify number of calls to trigger JIT]:calls [5]'
+ '--jit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:number [100]'
+ '--jit-min-calls=-[specify number of calls to trigger JIT]:calls [10000]'
)
irb=(
diff --git a/Completion/Unix/Command/_runit b/Completion/Unix/Command/_runit
index 81ba26a44..5c22cc54e 100644
--- a/Completion/Unix/Command/_runit
+++ b/Completion/Unix/Command/_runit
@@ -19,7 +19,7 @@ _sv_commands() {
'kill':'send SIGKILL if service is running'
'exit':'send SIGTERM and SIGCONT if service is running. Do not restart service.'
)
- _describe -t commands "sv commands" sv_ary -V sv_commands
+ _describe -t commands "sv command" sv_ary -V sv_commands
}
_sv_lsb() {
@@ -41,7 +41,7 @@ _sv_lsb() {
}
_sv_additional() {
- _describe -t additional-commands "sv additional commands" '("check:check status of service")' -V sv_addl_comm
+ _describe -t additional-commands "sv additional command" '("check:check status of service")' -V sv_addl_comm
}
local curcontext="$curcontext" state line
@@ -68,6 +68,6 @@ case $state in
)
sv_services=( ${sv_services#$svdir/} )
- _describe -t services "sv services" sv_services
+ _describe -t services "sv service" sv_services
;;
esac
diff --git a/Completion/Unix/Command/_samba b/Completion/Unix/Command/_samba
index 775543794..6c7a64e18 100644
--- a/Completion/Unix/Command/_samba
+++ b/Completion/Unix/Command/_samba
@@ -96,7 +96,7 @@ case $service in
smbstatus)
_arguments -s -S $args \
{-b,--brief}'[brief output]' \
- '(-v --verbose)'(-v,--verbose)'[be verbose]' \
+ '(-v --verbose)'{-v,--verbose}'[be verbose]' \
'(-d --debuglevel)'{-d+,--debuglevel=}'[specify debug level]:debug level:(0 1 2 3 4 5 6 7 8 9 10)' \
'(-u --user)'{-u+,--user=}'[specify user to restrict information to]:user:_users' \
'(-B --byterange)'{-B,--byterange}'[include byte range locks]' \
diff --git a/Completion/Unix/Command/_scons b/Completion/Unix/Command/_scons
index 2c620cc1a..77fe6dfb0 100644
--- a/Completion/Unix/Command/_scons
+++ b/Completion/Unix/Command/_scons
@@ -19,7 +19,7 @@ _arguments -s -S \
'(-)-'{h,-help}'[display defined usage information]' \
'(-)-'{H,-help-options}'[display usage information]' \
'(-i -ignore-errors)-'{i,-ignore-errors}'[ignore errors from build actions]' \
- \*{-I,--include-dir=}'[add directory to search Python modules]:directories:_directories' \
+ \*{-I,--include-dir=}'[add directory to search Python modules]:directory:_directories' \
'(--implicit-deps-changed --implicit-deps-unchanged)--implicit-cache[cache scanned dependencies]' \
'(--implicit-cache --implicit-deps-changed)--implicit-deps-changed[rescan dependencies]' \
'(--implicit-cache --implicit-deps-unchanged)--implicit-deps-unchanged[ignore changes to scanned dependencies]' \
diff --git a/Completion/Unix/Command/_script b/Completion/Unix/Command/_script
index ac3bf3973..7a3960be0 100644
--- a/Completion/Unix/Command/_script
+++ b/Completion/Unix/Command/_script
@@ -4,14 +4,19 @@ local args hlp="-h --help -V --version"
if [[ $service = scriptreplay ]]; then
_arguments -S -s \
- "(1 -t --timing $hlp)"{-t+,--timing=}'[specify file containing timing output]:timing file:_files' \
- "(2 -s --typescript $hlp)"{-s+,--typescript=}'[specify file containing terminal output]:typescript file:_files' \
+ "(1 -t --timing -T --log-timing $hlp)"{-t+,-T+,--timing=,--log-timing=}'[specify file containing timing output]:timing file:_files' \
+ "(-I --log-in -B --log-io $hlp)"{-I+,--log-in=}'[specify file containing terminal input]:file:_files' \
+ "(2 -s --typescript -B --log-io $hlp)"{-s+,-O+,--typescript=,--log-out=}'[specify file containing terminal output]:typescript file:_files' \
+ "(-B --log-io -I --log-in -s -O --typescript --log-out $hlp)"{-B,--log-io}'[specify file containing terminal input and output]' \
+ "($hlp)--summary[display overview about recorded session and exit]" \
"(3 -d --divisor $hlp)"{-d+,--divisor=}'[speed up replay]:factor' \
"(-m --maxdelay $hlp)"{-m+,--maxdelay=}'[set maximum delay between updates]:delay (seconds)' \
+ "(-x --stream $hlp)"{-x+,--stream=}'[specify stream type]:name:(out in signal or info)' \
+ "(-c --cr-mode $hlp)"{-c+,--cr-mode=}'[specify CR char mode]:mode:(auto never always)' \
'(- *)'{-h,--help}'[display help information]' \
'(- *)'{-V,--version}'[display version information]' \
"(-t --timing $hlp):timing file:_files" \
- "(-s --typescript $hlp):typescript file:_files" \
+ "(-s --typescript -O --log-out $hlp):typescript file:_files" \
"(-d --divisor $hlp): :_guard '[0-9.]#' 'timing divisor'"
return
fi
@@ -19,12 +24,18 @@ fi
case $OSTYPE in
linux*)
args=( -S
- "(-a --append $hlp)"{-a,--append}'[append output]'
+ "(-I --log-in $hlp)"{-I,--log-in}'[log stdin to file]:file:_files'
+ "(-O --log-out $hlp)"{-O,--log-out}'[log stdout to file]:file:_files'
+ "(-B --log-io $hlp)"{-B,--log-io}'[log stdin and stdout to file]:file:_files'
+ "(-T --log-timing -t --timing $hlp)"{-T+,--log-timing=}'[log timing information to file]:file:_files'
+ "(-m --logging-format $hlp)"{-m+,--logging-format=}'[specify log file format]:format:(classic advanced)'
+ "(-a --append $hlp)"{-a,--append}'[append to the log file]'
"(-c --command $hlp)"{-c,--command=}'[run specified command instead of a shell]:command:_cmdstring'
"(-e --return $hlp)"{-e,--return}'[return exit status of the child process]'
"(-f --flush $hlp)"{-f,--flush}'[flush output after each write]'
+ "(-E --echo $hlp)"{-E+,--echo=}'[echo input]:when:(auto always never)'
"($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)'
+ "(-o --output-limit $hlp)"{-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]'
diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed
index 73227901e..79a010c92 100644
--- a/Completion/Unix/Command/_sed
+++ b/Completion/Unix/Command/_sed
@@ -109,10 +109,10 @@ else
)
;|
openbsd*|freebsd*|netbsd*|dragonfly*) args+=( '(-r -E)'-r$extended ) ;|
- darwin*|freebsd*|netbsd*|openbsd*) args+=( '-i+'$inplace ) ;|
- darwin*|freebsd*|netbsd*) args+=( '-l[make output line buffered]' ) ;|
- freebsd*) args+=( '-u[disable data buffering]' ) ;|
- freebsd*|netbsd*)
+ darwin*|freebsd*|netbsd*|openbsd*|dragonfly*) args+=( '-i+'$inplace ) ;|
+ darwin*|freebsd*|netbsd*|dragonfly*) args+=( '-l[make output line buffered]' ) ;|
+ freebsd*|dragonfly*) args+=( '-u[disable data buffering]' ) ;|
+ freebsd*|netbsd*|dragonfly*)
args+=(
'-I+[edit files in-place, treating all files as a single input stream]:: :_guard "^(*[@/; \\\]*|?(#c6,)|-*)" "suffix for backup"'
)
diff --git a/Completion/Unix/Command/_setfacl b/Completion/Unix/Command/_setfacl
index 5c573a581..14be49d95 100644
--- a/Completion/Unix/Command/_setfacl
+++ b/Completion/Unix/Command/_setfacl
@@ -3,11 +3,11 @@
if _pick_variant cygwin=cygwin unix --version; then
# cygwin 1.5.25
_arguments -s -S \
- '(-d, --delete)'{-d,--delete}'[delete one or more specified ACL entries]:ACL entry:' \
- '(-f, --file)'{-f,--file}'[set ACL entries for FILE to ACL entries read from a ACL_FILE]:ACL file:_files' \
- '(-m, --modify)'{-m,--modify}'[modify one or more specified ACL entries]:ACL entry:' \
- '(-r, --replace)'{-r,--replace}'[replace mask entry with maximum permissions needed for the file group class]' \
- '(-s, --substitute)'{-s,--substitute}'[substitute specified ACL entries for the \[ACL of FILE\]]:ACL entry:' \
+ '(-d --delete)'{-d,--delete}'[delete one or more specified ACL entries]:ACL entry' \
+ '(-f --file)'{-f,--file}'[set ACL entries for FILE to ACL entries read from a ACL_FILE]:ACL file:_files' \
+ '(-m --modify)'{-m,--modify}'[modify one or more specified ACL entries]:ACL entry' \
+ '(-r --replace)'{-r,--replace}'[replace mask entry with maximum permissions needed for the file group class]' \
+ '(-s --substitute)'{-s,--substitute}'[substitute specified ACL entries for the \[ACL of FILE\]]:ACL entry' \
'(- *)'{-h,--help}'[output usage information and exit]' \
'(- *)'{-v,--version}'[output version information and exit]' \
'*: :_files'
diff --git a/Completion/Unix/Command/_sh b/Completion/Unix/Command/_sh
index 39d299c58..f0f18d4bb 100644
--- a/Completion/Unix/Command/_sh
+++ b/Completion/Unix/Command/_sh
@@ -1,14 +1,36 @@
#compdef sh ash csh dash ksh ksh88 ksh93 mksh oksh pdksh rc tcsh yash
-if (( CURRENT == ${words[(i)-c]} + 1 )); then
- _cmdstring
-else
- local n=${words[(b:2:i)[^-]*]}
- if (( n <= CURRENT )); then
- compset -n $n
- _alternative \
- 'files:file:_files' \
- 'commands:command:_normal' && return 0
- fi
- _default
-fi
+local bourne argv0
+local -a args all_opts=( -{{0..9},{A..Z},{a..z}} )
+
+[[ $service == (csh|?csh|fish|rc) ]] || bourne=1
+
+# Bourne-style shells support +x variants
+# @todo Uncomment when workers/45422 is fixed
+# (( bourne )) && all_opts+=( ${all_opts/#-/+} )
+# Bourne-style shells take argv[0] as the second argument to -c
+(( bourne )) && argv0=':argv[0]:'
+
+# All of the recognised shells support at least these arguments
+args=(
+ "(1 -)-c[execute specified command string]: :_cmdstring$argv0"
+ '-e[exit immediately on non-zero return]'
+ '-i[act as interactive shell]'
+ '-l[act as login shell]'
+ '-x[print command trace]'
+ '1:script file:_files'
+ '*:: :_files'
+)
+# Bourne-style shells support -o/+o option. Not all of them support -ooption in
+# the same argument, but we'll allow it here for those that do
+(( bourne )) && args+=(
+ '-o+[set specified option]:option:'
+ '+o+[unset specified option]:option:'
+)
+# Since this is a generic function we don't know what other options these shells
+# support, but we don't want them to break the ones listed above, so we'll just
+# ignore any other single-alphanumeric option. Obviously this doesn't account
+# for long options
+args+=( '!'${^${all_opts:#(${(~j<|>)${(@M)${(@M)args#(*[\*\)]|)[+-]?}%[+-]?}})}} )
+
+_arguments -s -S -A '-*' : $args
diff --git a/Completion/Unix/Command/_sqlite b/Completion/Unix/Command/_sqlite
index 0f03c61c1..7ef3c6daa 100644
--- a/Completion/Unix/Command/_sqlite
+++ b/Completion/Unix/Command/_sqlite
@@ -22,7 +22,7 @@ options+=(
)
output_modes=( column HTML line list )
-(( $+sqlite3 )) && output_modes+=( ascii csv quote )
+(( $+sqlite3 )) && output_modes+=( ascii box csv json markdown quote table tabs )
exclusive=( $^dashes-${^output_modes:l} )
for display_opt in $output_modes ; do
# finagle the description to match the way SQLite's -help formats them
@@ -54,6 +54,7 @@ options+=(
$^dashes'-memtrace[trace all memory allocations and deallocations]'
$^dashes'-mmap[set default mmap size]:size'
$^dashes'-newline[set output row separator]:separator [\n]'
+ $^dashes'-nofollow[refuse to open symbolic links to database files]'
$^dashes'-pagecache[specify size and number of slots for page cache memory]:size (bytes): :slots'
$^dashes'-readonly[open the database read-only]'
$^dashes'-stats[print memory stats before each finalize]'
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 0775590e6..2385272f1 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -4,12 +4,13 @@
_ssh () {
local curcontext="$curcontext" state line expl suf arg ret=1
- local args sigargs common common_transfer algopt tmp p1 file cmn cmds sdesc tdesc
- typeset -A opt_args
+ local args sigargs common common_transfer options algopt tmp p1 file cmn cmds sdesc tdesc
+ typeset -A opt_args tsizes
common=(
'(-6)-4[force ssh to use IPv4 addresses only]'
'(-4)-6[force ssh to use IPv6 addresses only]'
+ '-A[enable forwarding of the authentication agent connection]'
'-C[compress data]'
'-c+[select encryption cipher]:encryption cipher:->ciphers'
'-F+[specify alternate config file]:config file:_files'
@@ -32,7 +33,6 @@ _ssh () {
ssh)
(( $+words[(r)-[^-]#t*] )) && tdesc=' even if there is no controlling tty'
_arguments -C -s \
- '(-a)-A[enable forwarding of the authentication agent connection]' \
'(-A)-a[disable forwarding of authentication agent connection]' \
'-B+[bind to specified interface before attempting to connect]:interface:_net_interfaces' \
'(-P)-b+[specify interface to transmit on]:bind address:_bind_addresses' \
@@ -81,9 +81,19 @@ _ssh () {
'*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0
;;
ssh-add)
- [[ $OSTYPE == darwin* ]] && args=(
- '-A[add identities from keychain]'
- '-K[update keychain when adding/removing identities]'
+ if [[ $OSTYPE != darwin* || $APPLE_SSH_ADD_BEHAVIOR == openssh ]]; then
+ args=(
+ '-K[load resident keys from a FIDO authenticator]'
+ )
+ else
+ [[ ${APPLE_SSH_ADD_BEHAVIOR:-macos} == macos ]] && args=(
+ '-A[add identities from keychain]'
+ '-K[update keychain when adding/removing identities]'
+ )
+ fi
+ [[ $OSTYPE == darwin<20->.* ]] && args+=(
+ '--apple-load-keychain[add identities from keychain]'
+ '--apple-use-keychain[update keychain when adding/removing identities]'
)
_arguments -s : $args \
'-c[identity is subject to confirmation via SSH_ASKPASS]' \
@@ -92,14 +102,16 @@ _ssh () {
$algopt \
'-e+[remove keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \
'-k[load plain private keys only and skip certificates]' \
+ '-K[load resident keys from a FIDO authenticator]' \
'-L[list public key parameters of all identities in the agent]'\
'-l[list all identities]' \
'-m+[specify minimum remaining signatures before maximum is changed]:number' \
'-M+[specify maximum number of signatures]:number' \
+ '-S+[use specified library when adding FIDO authenticator-hosted keys]:library:_files' \
'-s+[add keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \
'-t+[set maximum lifetime for identity]:maximum lifetime (in seconds or time format):' \
"-T[test usability of identity files' private keys]:*:public key file:_files -g '*.pub(-.)'" \
- '-v[verbose mode]' \
+ '*-v[verbose mode]' \
'-q[be quiet after a successful operation]' \
'-X[unlock the agent]' \
'-x[lock the agent with a password]' \
@@ -125,13 +137,42 @@ _ssh () {
# options can be in any order but use ! to limit those shown for the first argument
(( CURRENT == 2 )) && p1='!'
args=( '!-z:number' )
+ options=(
+ application
+ 'challenge\:path\:_files'
+ device
+ no-touch-required
+ resident
+ user
+ verify-required
+ 'write-attestation\:path\:_files'
+ )
sdesc='certify keys with CA key'
- (( $+words[(r)-I] )) && args=( '-z[specify serial number]:serial number' )
+ if (( $+words[(r)-[IhUDnV]*] )); then
+ args=( '-z[specify serial number]:serial number' )
+ options=(
+ clear critical\:name extension\:name force-command\:command\:_cmdstring
+ no-agent-forwarding no-port-forwarding no-pty no-user-rc no-x11-forwarding
+ permit-agent-forwarding permit-port-forwarding permit-pty permit-user-rc
+ permit-x11-forwarding source-address\:source\ address
+ )
+ fi
(( $+words[(r)-[ku]] )) && args=( '-z[specify version number]:version number' ) &&
sdesc='specify CA public key file'
file=key
(( $+words[(r)-[FHR]] )) && file=known_hosts
- (( $+words[(r)-T] )) && file=input
+ if (( $+words[(r)-M*] )); then
+ file=input
+ args+=( '*:output file:_files' )
+ options=(
+ lines:number
+ 'start-line\:line number'
+ checkpoint\:file:_files
+ 'memory\:size (mbytes)'
+ 'start\:start point (hex-value)'
+ generator\:value
+ )
+ fi
(( $+words[(r)-A] )) && file='prefix for host key'
if (( $+words[(r)-[kIQ]] )); then
file=krl
@@ -139,8 +180,9 @@ _ssh () {
fi
if (( arg = $words[(I)-Y*] )); then
[[ $words[arg] = -Y?* ]] || (( arg++ ))
- case $words[arg] in
- check*|verify)
+ case ${words[arg]#-Y} in
+ ^find-*) sigargs+=( "$p1-n+[specify namespace]:namespace" ) ;|
+ check*|find*|verify)
sigargs+=( "$p1-s+[specify signature file]:signature file:-files" )
;|
sign) sigargs+=( '*:file:_files' ) ;;
@@ -153,51 +195,60 @@ _ssh () {
;;
esac
fi
- cmds=( -p -i -e -y -c -l -B -D -F -H -R -r -G -T -s -L -A -k -Q -Y ) # basic commands
- cmn=( -b -P -N -C -l -m -v ) # options common to many basic commands (except -f which is common to most)
- cms=( -E -q -t -g -M -S -a -J -j -K -W -I -h -n -O -V -u -U ) # options specific to one basic command
+ cmds=( -p -i -e -y -c -l -B -D -F -H -K -R -r -M -s -L -A -k -Q -Y ) # basic commands
+ cmn=( -a -b -P -N -C -l -m -O -v -w -Z ) # options common to many basic commands (except -f which is common to most)
+ cms=( -E -q -t -g -M -I -h -n -V -u -U ) # options specific to one basic command
+ tsizes=(
+ dsa 1024
+ ecdsa '256 384 521' # values appear in key names as listed with ssh -Q key - 521 really is correct
+ rsa '1024 2048 4096'
+ )
_arguments -s $args \
- "(${${(@)cmds:#-G}} -P ${${(@)cms:#-[MS]}})-b+[specify number of bits in key]:bits in key" \
+ "${p1}(${${(@)cmds:#-[pcKAO]}} ${${(@)cms:#-[t]}} -O)-a+[specify number of rounds]:rounds [16]" \
+ "(${${(@)cmds:#-M}} -P ${${(@)cms:#-[MS]}})-b+[specify number of bits in key]:bits in key [2048]:"'compadd ${expl\:/-X/-x} ${_comp_mesg\:=-} ${=tsizes[${opt_args[create--t]\:-rsa}]}' \
"$p1(${${(@)cmds:#-[pc]}} -b $cms)-P+[provide old passphrase]:old passphrase" \
"(${${(@)cmds:#-p}} -v ${${(@)cms:#-[qt]}})-N+[provide new passphrase]:new passphrase" \
"(${${(@)cmds:#-c}} -v $cms)-C+[provide new comment]:new comment" \
- "(-D -G -M -S -I -h -n -O -V -A)-f+[$file file]:$file file:_files" \
+ "(-D -I -h -n -V -A)-f+[$file file]:$file file:_files" \
"$p1(${${(@)cmds:#-[FE]}} ${${(@)cmn:#-v}} ${${(@)cms:#-E}})-l[show fingerprint of key file]" \
"$p1(${${(@)cmds:#-[iep]}} $cms)-m+[specify conversion format]:format [RFC4716]:(PEM PKCS8 RFC4716)" \
+ "$p1*-O+[specify a key/value option]: : _values 'option' $options" \
"(${${(@)cmds:#-[lGT]}} ${${(@)cmn:#-[bv]}} -f)*-v[verbose mode]" \
+ "$p1(${${(@)cmds:#-K}} -P ${${(@)cms:#-[qt]}})-w+[specify library used when creating FISO authenticator-hosted keys]:library:_files -g '*.(so|dylib)(|.<->)(-.)'" \
+ "$p1(${${(@)cmds:#-p}} -l ${${(@)cms:#-[qt]}})-Z+[specify encryption cipher to use when writing a private key file]:cipher:compadd - $(_call_program ciphers ssh -Q cipher)" \
- '(commands)' \
- "(-b -l -C -v)-p[change passphrase of private key file]" \
- '(-b -l -P -N -C -v)-i[import key to OpenSSH format]' \
- '(-b -l -P -N -C -v)-e[export key to SECSH file format]' \
+ "(-b -l -C -O -v -w)-p[change passphrase of private key file]" \
+ "(${${(@)cmn:#-m}})-i[import key to OpenSSH format]" \
+ "(${${(@)cmn:#-m}})-e[export key to SECSH file format]" \
"($cmn)-y[get public key from private key]" \
- '(-b -l -N -m -v)-c[change comment in private and public key files]' \
+ "(${${(@)cmn:#-[aCP]}})-c[change comment in private and public key files]" \
"($cmn)-B[show the bubblebabble digest of key]" \
"(-)-D+[download key stored in smartcard reader]:reader" \
"(${${(@)cmn:#-[lv]}})-F+[search for host in known_hosts file]:host:_ssh_hosts" \
"($cmn)-H[hash names in known_hosts file]" \
+ "(${${(@)cmn:#-[aw]}} -f)-K[download resident keys from a FIDO authenticator]" \
"($cmn)-R+[remove host from known_hosts file]:host:_ssh_hosts" \
+ "(${${(@)cmn:#-O}})-M+[moduli generation]:action:((
+ generate\:generate\ candidates\ for\ DH-GEX\ moduli
+ screen\:screen\ candidates\ for\ DH-GEX\ moduli
+ ))" \
"($cmn)-L[print the contents of a certificate]" \
- "($cmn -l)-A[generate host keys for all key types]" \
+ "(${${(@)cmn:#-a}})-A[generate host keys for all key types]" \
"($cmn)-Q[test whether keys have been revoked in a KRL]" \
+ "($cmn)-Y+[signature action]:action:((
+ find-principals\:find\ the\ principal\ associated\ with\ the\ public\ key\ of\ a\ signature
+ sign\:sign\ a\ file\ using\ SSH\ key
+ verify\:verify\ a\ signature\ generated\ using\ the\ sign\ option
+ check-novalidate\:check\ signature\ structure
+ ))" \
- finger \
"$p1($cmn)$algopt" \
- create \
'(-P -l)-q[silence ssh-keygen]' \
- "(-P -l)-t+[specify the type of the key to create]:key type:(rsa dsa ecdsa ed25519)" \
+ "(-P -l)-t+[specify the type of the key to create]:key type:(rsa dsa ecdsa ed25519 ecdsa-sk ed25519-sk)" \
- dns \
"($cmn)-r[print DNS resource record]:hostname:_hosts" \
"$p1($cmn)-g[use generic DNS format]" \
- - primes \
- "(-P -N -C -l -m -f)-G+[generate candidates for DH-GEX moduli]:output file:_files" \
- "$p1(-P -N -C -l -m -f)-M+[specify amount of memory to use for generating DH-GEX moduli]:memory (MB)" \
- "$p1(-P -N -C -l -m -f)-S+[specify start point]:start point (hex)" \
- - screen \
- "(${${(@)cmn:#-v}})-T+[screen candidates for DH-GEX moduli]:output file:_files" \
- "${p1}(${${(@)cmn:#-v}})-a+[specify number of rounds]:rounds" \
- "${p1}(${${(@)cmn:#-v}})-J[exit after screening specified number of lines]" \
- "${p1}(${${(@)cmn:#-v}})-j+[start screening at the specified line number]:line number" \
- "${p1}(${${(@)cmn:#-v}})-K+[write the last line processed to file]:file:_files" \
- "${p1}(${${(@)cmn:#-v}})-W[specify desired generator]:generator" \
- certify \
"($cmn)-s[$sdesc]:CA key:_files" \
"$p1($cmn -f -k -u)-I+[specify key identifier to include in certificate]:key id" \
@@ -205,21 +256,10 @@ _ssh () {
"$p1($cmn -f -k -u -D)-U[indicate that CA key is held by ssh-agent]" \
"$p1($cmn -f -k -u -U)-D+[indicate the CA key is stored in a PKCS#11 token]:PKCS11 shared library:_files -g '*.(so|dylib)(|.<->)(-.)'" \
"$p1($cmn -f -k -u)-n+[specify user/host principal names to include in certificate]:principals" \
- "$p1($cmn -f -k -u)*-O+[specify a certificate option]: : _values 'option'
- clear critical\:name extension\:name force-command\:command\:_cmdstring
- no-agent-forwarding no-port-forwarding no-pty no-user-rc no-x11-forwarding
- permit-agent-forwarding permit-port-forwarding permit-pty permit-user-rc
- permit-x11-forwarding source-address\:source\ address" \
"$p1($cmn -f -u)-V+[specify certificate validity interval]:interval" \
"($cmn -I -h -n -D -O -U -V)-k[generate a KRL file]" \
"$p1($cmn -I -h -n -D -O -U -V)-u[update a KRL]" \
- signature \
- "($cmn)-Y+[signature action]:action:((
- sign\:sign\ a\ file\ using\ SSH\ key
- verify\:verify\ a\ signature\ generated\ using\ the\ sign\ option
- check-novalidate\:check\ signature\ structure
- ))" \
- "$p1-n+[specify namespace]:namespace" \
$sigargs
return
;;
@@ -244,6 +284,7 @@ _ssh () {
'-b+[specify batch file to read]:batch file:_files' \
'-D+[connect directly to a local sftp server]:sftp server path' \
'-f[request that files be flushed immediately after transfer]' \
+ '-N[disable implicit quiet mode set by -b]' \
'-R+[specify number of outstanding requests]:number of requests [64]' \
'-s+[specify SSH2 subsystem or path to sftp server on the remote host]:subsystem/path' \
'1:file:->rfile' '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0
@@ -269,8 +310,8 @@ _ssh () {
if compset -P 1 '*='; then
case "${IPREFIX#-o}" in
(#i)(ciphers|macs|kexalgorithms|hostkeyalgorithms|pubkeyacceptedkeytypes|hostbasedkeytypes)=)
- if ! compset -P +; then
- _wanted append expl 'append to default' compadd + && ret=0
+ if ! compset -P '[+-]'; then
+ _wanted prefix expl 'relative to default' compadd - + - && ret=0
fi
;;
esac
@@ -366,7 +407,7 @@ _ssh () {
state=dynforward
;;
(#i)kbdinteractivedevices=*)
- _values -s , 'keyboard-interactive authentication methods' \
+ _values -s , 'keyboard-interactive authentication method' \
'bsdauth' 'pam' 'skey' && ret=0
;;
(#i)(kexalgorithms|gssapikexalgorithms)=*)
@@ -475,7 +516,7 @@ _ssh () {
else
# old options are after the empty "\"-line
_wanted values expl 'configure file option' \
- compadd -M 'm:{a-z}={A-Z}' -q -S '=' - \
+ compadd -M 'm:{a-z}={A-Z} r:[^A-Z]||[A-Z]=* r:|=*' -q -S '=' - \
AddKeysToAgent \
AddressFamily \
BatchMode \
diff --git a/Completion/Unix/Command/_stat b/Completion/Unix/Command/_stat
index 03b4552de..03abe88a3 100644
--- a/Completion/Unix/Command/_stat
+++ b/Completion/Unix/Command/_stat
@@ -29,7 +29,7 @@ case $variant in
'(-n)-N[never show names of files]'
'-o[print file modes in octal rather than decimal]'
'-r[print raw data]'
- '-s[print mode, UID, GID, and times as strings]'
+ '(-o)-s[print mode, UID, GID, and times as strings]'
'(-T)-t[always show type names]'
'(-t)-T[never show type names]'
'*: :_files'
diff --git a/Completion/Unix/Command/_stdbuf b/Completion/Unix/Command/_stdbuf
index a18938ee1..4b7d98ba0 100644
--- a/Completion/Unix/Command/_stdbuf
+++ b/Completion/Unix/Command/_stdbuf
@@ -7,7 +7,9 @@ short=( -e -i -o )
long=( --error --input --output )
buf=( err in out )
-opt='[set initial buffering for std${buf[i]}]:mode or size:((0\:unbuffered L\:line\ buffered'
+opt='[set initial buffering for std${buf[i]}]: : _alternative
+ "sizes\: \: _numbers -u bytes size k M G"
+ "modes\:mode\:((0\:unbuffered L\:line\ buffered'
if _pick_variant gnu=GNU freebsd --version; then
gnu=1
args=(
@@ -17,7 +19,7 @@ if _pick_variant gnu=GNU freebsd --version; then
else
opt+=' B\:fully\ buffered'
fi
-opt+='))'
+opt+='))"'
for ((i=1;i<=3;i++)); do
args+=( "(${long[i]})${short[i]}+${(e)opt}" )
diff --git a/Completion/Unix/Command/_strings b/Completion/Unix/Command/_strings
index af95af52f..685daa286 100644
--- a/Completion/Unix/Command/_strings
+++ b/Completion/Unix/Command/_strings
@@ -45,7 +45,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu
elfutils)
args+=(
'(- *)--usage[display a short usage message]'
- '(- *)-\\?[display help information]'
+ '(- *)-?[display help information]'
)
;;
esac
diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip
index e7f3418d7..3e1a6b698 100644
--- a/Completion/Unix/Command/_strip
+++ b/Completion/Unix/Command/_strip
@@ -32,6 +32,7 @@ if _pick_variant gnu=GNU solaris --version; then
"--no-merge-notes[don't attempt to remove redundant notes]"
'*'{-K+,--keep-symbol=}'[keep given symbol]:symbol name'
'*'{-N+,--strip-symbol=}'[strip given symbol]:symbol name'
+ "*--keep-section=[don't strip given section]:section"
'(*)-o+[output file]:output file:_files'
'(-p --preserve-dates)'{-p,--preserve-dates}'[preserve access and modification dates]'
'(-w --wildcard)'{-w,--wildcard}'[permit wildcards in symbol names]'
diff --git a/Completion/Unix/Command/_su b/Completion/Unix/Command/_su
index 032f867f4..1af751a17 100644
--- a/Completion/Unix/Command/_su
+++ b/Completion/Unix/Command/_su
@@ -35,7 +35,7 @@ case $OSTYPE in
;|
*bsd*|dragonfly*)
args+=(
- '-c+[use settings from specified login class]:class'
+ '-c+[use settings from specified login class]:class:_login_classes'
)
;|
freebsd*) args+=( '-s[set the MAC label]' ) ;;
@@ -63,6 +63,12 @@ if (( $words[(i)-] < CURRENT )); then
norm=2
fi
+# This is set so that _command_names will understand that we're completing for
+# a privileged command, but _call_program won't actually prepend anything to
+# commands if gain-privileges is enabled (which would be undesirable here since
+# su always prompts for a password). We delay setting it until this point so it
+# doesn't cause issues for the check above
+local -a _comp_priv_prefix=( '' )
_arguments $args ${(e)first} "*:shell arguments:= ->rest" && return
usr=${${(Q)line[norm]}/--/root}
diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index a1e9109de..8fc46a292 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -1,4 +1,4 @@
-#compdef svn svnlite=svn svnadmin svnadmin-static=svnadmin
+#compdef svn svnlite=svn svnadmin svnadmin-static=svnadmin svnliteadmin=svnadmin
_svn () {
local curcontext="$curcontext" state line expl ret=1
@@ -68,7 +68,6 @@ _svn () {
;;
args)
local cmd args usage idx
- typeset -gHA _cache_svn_status _cache_svn_mtime
cmd="${${(k)_svn_cmds[(R)*:$words[1]:*]}:-${(k)_svn_cmds[(i):$words[1]:]}}"
if (( $#cmd )); then
@@ -123,7 +122,7 @@ _svn () {
case $cmd in;
(add)
args+=(
- '*:file:_files -g "*(e:_svn_uncontrolled:)"'
+ '*:file: _svn_modified "addable"'
)
;;
(auth)
@@ -141,17 +140,17 @@ _svn () {
(commit)
args=(
${args/(#b)(*--file*):arg:/$match[1]:file:_files}
- '*:file:_files -g "*(e:_svn_status:)"'
+ '*:file: _svn_modified "committable"'
)
;;
(delete)
args+=(
- '*:file:_files -g ".svn(/e:_svn_deletedfiles:)"'
+ '*:file:_files -g "*(e:_svn_controlled:)"'
)
;;
(diff)
args+=(
- '*: : _alternative "files:file:_files -g \*\(e:_svn_status:\)" "urls:URL:_svn_urls"'
+ '*: : _alternative "files:file: _svn_modified revertable" "urls:URL:_svn_urls"'
)
;;
(help)
@@ -201,7 +200,7 @@ _svn () {
;;
(revert)
args+=(
- '*:file:_files -g "(.svn|*)(/e:_svn_deletedfiles:,e:_svn_status:)"'
+ '*:file: _svn_modified "revertable"'
)
;;
(x-unshelve)
@@ -351,50 +350,76 @@ _svn_controlled() {
# because 1.6 has been deprecated for 8 years and EOL for 6 years, we opt to DTRT
# for >=1.7. Therefore:
- # TODO: Reimplement this function and _svn_uncontrolled for svn>=1.7.
+ # TODO: Reimplement this function for svn>=1.7.
# (Use 'svn st' or 'svn info', not 'svn ls')
return 0
}
-(( $+functions[_svn_uncontrolled] )) ||
-_svn_uncontrolled() {
- # TODO: See comments in _svn_controlled
- return 0
-}
-
(( $+functions[_svn_conflicts] )) ||
_svn_conflicts() {
- () { (( $# > 0 )) } $REPLY.(mine|r<->)(NY1)
+ # ### These strings are actually translatable
+ #
+ # The asterisks are to support an optional extension; see
+ # "preserved-conflict-file-exts" in ~/.subversion/config.
+ () { (( $# > 0 )) } $REPLY.(mine|r<->|working*|merge-left*|merge-right*)(NY1)
}
-(( $+functions[_svn_deletedfiles] )) ||
-_svn_deletedfiles() {
- # Typical usage would be _files -g '.svn(/e:_svn_deletedfiles:)'
- local cont controlled
- reply=( )
- [[ $REPLY = (*/|).svn ]] || return
- controlled=( $REPLY/text-base/*.svn-base(N:r:t) )
- for cont in ${controlled}; do
- [[ -e $REPLY:h/$cont ]] || reply+=( ${REPLY%.svn}$cont )
- done
-}
+(( $+functions[_svn_modified] )) ||
+_svn_modified() {
+ setopt localoptions extendedglob
+
+ local depth dir expl maybe_quiet partial_word space=' '
-(( $+functions[_svn_status] )) ||
-_svn_status() {
- local dir=$REPLY:h
- local pat="${1:-([ADMR~]|?M)}"
+ local svn_context=$1
- zmodload -F zsh/stat b:zstat 2>/dev/null
- local key="$(zstat +device $dir):$(zstat +inode $dir)"
- local mtime="$(zstat +mtime $dir/.svn/entries)"
+ local partial_word=${(Q)words[CURRENT]}
+ if [[ -z $partial_word ]]; then
+ dir="./"
+ elif [[ -d $partial_word ]]; then
+ dir=$partial_word
+ else
+ dir=${partial_word:h}
+ fi
- if (( ! $+_cache_svn_status[$key] || _cache_svn_mtime[$key] != mtime )); then
- _cache_svn_status[$key]="$(_call_program files svn status -N $dir)"
- _cache_svn_mtime[$key]="$mtime"
+ if zstyle -T ":completion:${curcontext}:${curtag}" verbose; then
+ depth=infinity
+ else
+ depth=immediates
fi
- (( ${(M)#${(f)_cache_svn_status[$key]}:#(#s)${~pat}*$REPLY} ))
+ if [[ $svn_context = addable ]]; then
+ maybe_quiet=""
+ else
+ maybe_quiet="-q"
+ fi
+
+ local -a status_lines
+ # Run 'status'
+ status_lines=( ${(f)"$(_call_program modified-files "svn status $maybe_quiet --depth=${(q)depth} -- ${(q)dir}")"} )
+ # Filter to only the right set of statuses
+ case $svn_context in
+ (committable)
+ status_lines=( ${(M)status_lines:#(#s)([ADMR]?|?M)${space}???${space}${space}*} )
+ ;;
+ (revertable)
+ status_lines=( ${(M)status_lines:#(#s)([ACDMR~!]?|?[CM])${space}????${space}*} )
+ ;;
+ (addable)
+ # The 'D' is just in case there's an unversioned file of the same name as the deleted file
+ status_lines=( ${(M)status_lines:#(#s)[?ID]${space}${space}???${space}${space}*} )
+ ;;
+ esac
+ # Strip the 7 status-letter columns and the column of spaces
+ status_lines=( ${status_lines#????????} )
+ # Strip one leading space. This is in case `svn status` ever adds another
+ # column. If that hasn't happened and you're reading this comment because
+ # the following line broke your use of filenames that start with a literal
+ # space, well, nice to meet you! I didn't know you existed.
+ status_lines=( ${status_lines#${space}} )
+
+ _wanted svn-modified expl 'modified files in svn' \
+ compadd - "${status_lines[@]}"
}
(( $+functions[_svn_remote_paths] )) ||
diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo
index 41e32cbae..29e5e6d75 100644
--- a/Completion/Unix/Command/_sudo
+++ b/Completion/Unix/Command/_sudo
@@ -2,9 +2,9 @@
setopt localoptions extended_glob
-local environ e cmd
-local -a args
-local -a _comp_priv_prefix
+local environ e cmd cpp
+local -a args _comp_priv_prefix
+local -A opt_args
zstyle -a ":completion:${curcontext}:" environ environ
@@ -14,7 +14,9 @@ done
args=(
'(-A --askpass)'{-A,--askpass}'[use a helper program for password prompting]'
+ '(-B --bell)'{-B,--bell}'[ring bell when prompting]'
'(-C --close-from)'{-C+,--close-from=}'[close file descriptors]:lowest fd to close'
+ '(-D --chdir)'{-D+,--chdir=}'[change the working directory before running command]:directory:_directories'
'(-g --group)'{-g+,--group=}'[run command as the specified group name or ID]:group:_groups'
'(-)'{-h,--help}'[display help message and exit]'
'(-h --host)'{-h+,--host=}'[run command on host]:host:_hosts'
@@ -23,6 +25,7 @@ args=(
\*{-l,--list}"[list user's privileges or check a specific command]"
'(-n --non-interactive)'{-n,--non-interactive}'[non-interactive mode, no prompts are used]'
'(-p --prompt)'{-p+,--prompt=}'[use the specified password prompt]:prompt'
+ '(-R --chroot)'{-R+,--chroot=}'[change the root directory before running command]:directory:_directories'
'(-r --role)'{-r+,--role=}'[create SELinux security context with specified role]: :_selinux_roles'
'(-S --stdin)'{-S,--stdin}'[read password from standard input]'
'(-t --type)'{-t+,--type=}'[create SELinux security context with specified type]: :_selinux_types'
@@ -42,6 +45,10 @@ if [[ $service = sudoedit ]] || (( $words[(i)-e] < $words[(i)^(*sudo|-[^-]*)] ))
args=( -A "-*" $args '!(-V --version -h --help)-e' '*:file:_files' )
else
cmd="$words[1]"
+ cpp='_comp_priv_prefix=(
+ $cmd -n
+ ${(kv)opt_args[(I)(-[ugHEP]|--(user|group|set-home|preserve-env|preserve-groups))]}
+ )'
args+=(
'(-e --edit 1 *)'{-e,--edit}'[edit files instead of running a command]' \
'(-s --shell)'{-s,--shell}'[run shell as the target user; a command may also be specified]' \
@@ -51,8 +58,8 @@ else
'(-E -i --login -s --shell -e --edit)--preserve-env=-[preserve user environment when running command]::environment variable:_sequence _parameters -g "*export*"' \
'(-H --set-home -i --login -s --shell -e --edit)'{-H,--set-home}"[set HOME variable to target user's home dir]" \
'(-P --preserve-groups -i -login -s --shell -e --edit)'{-P,--preserve-groups}"[preserve group vector instead of setting to target's]" \
- '(-)1:command: _command_names -e'
- '*::arguments:{ _comp_priv_prefix=( $cmd -n ${(kv)opt_args[(I)(-[ugHEP]|--(user|group|set-home|preserve-env|preserve-groups))]} ) ; _normal }'
+ "(-)1: :{ $cpp; _command_names -e }"
+ "*:: :{ $cpp; _normal }"
)
fi
diff --git a/Completion/Unix/Command/_surfraw b/Completion/Unix/Command/_surfraw
index f945f1ca9..d153cd493 100644
--- a/Completion/Unix/Command/_surfraw
+++ b/Completion/Unix/Command/_surfraw
@@ -20,11 +20,11 @@ case $state in
subcmd)
args=(
'-help[display help information]'
- '*:string:_guard "^-*" "search string"'
+ '*: :_guard "^-*" "search string"'
)
case "$words[1]" in
ask|cia|cnn|deblogs|excite|filesearching|foldoc|happypenguin|slashdot|slinuxdoc|sundocs|sunsolve|xxx)
- _message -e string 'search string'
+ _message -e strings 'search string'
;;
alioth)
_arguments $args \
@@ -64,10 +64,10 @@ case $state in
'*:search string' && ret=0
;;
ctan)
- _arguments $args \
- '-name[search by filename]' \
- '-desc[search descriptions (default)]'\
- '-doc[search documentation]'
+ _arguments $args \
+ '-name[search by filename]' \
+ '-desc[search descriptions (default)]'\
+ '-doc[search documentation]'
;;
currency)
_arguments \
@@ -164,8 +164,8 @@ case $state in
'-doc[view PTS documentation]' && ret=0
;;
debsec)
- _message -e string 'package name, bug number or CVE ID'
- ;;
+ _message -e strings 'package name, bug number or CVE ID'
+ ;;
deja)
_arguments $args \
'-results=-:[number of results to return]' \
@@ -183,7 +183,7 @@ case $state in
;;
ebay)
_arguments $args \
- '-country=-:country:(com de uk fr)' \
+ '-country=-:country:(com de uk fr)' \
'-results=-:[number of results to return]:number' && ret=0
;;
etym)
@@ -220,7 +220,7 @@ case $state in
_deb_packages avail && ret=0
;;
fsfdir)
- _arguments $args
+ _arguments $args
;;
google)
_arguments $args \
@@ -229,19 +229,19 @@ case $state in
'-search=-:topic:(bsd linux mac unclesam)' && ret=0
;;
gutenberg)
- _arguments $args \
- '-title[search titles (default)]'
- '-author[search authors]'
- '-num[search etext numbers]'
- ;;
+ _arguments $args \
+ '-title[search titles (default)]'
+ '-author[search authors]'
+ '-num[search etext numbers]'
+ ;;
imdb)
_arguments $args \
'-category=-:category:(All Titles MyMovies People Characters Quotes Bios Plots)' && ret=0
;;
ixquick)
- _arguments $args \
- '-search=-:search type:(web pics)' \
- '-lang=-:language:(english dansk deutsch espanol francais italiano nederlands norsk polski portugues suomi svenska turkce jiantizhongwen nihongo fantizhengwen hangul)'
+ _arguments $args \
+ '-search=-:search type:(web pics)' \
+ '-lang=-:language:(english dansk deutsch espanol francais italiano nederlands norsk polski portugues suomi svenska turkce jiantizhongwen nihongo fantizhengwen hangul)'
;;
jake)
_arguments $args \
@@ -261,9 +261,9 @@ case $state in
'-head=:display headlines:(on off)' \
'-grid=:show results in grid:(on off)' \
'-spell=:spelling tolerance:(off standard force)' \
- '*:dictionary word:->dictword' && ret=0
+ '*:dictionary word:->words' && ret=0
- [[ "$state" = dictword ]] && _wanted words expl 'dictionary word' \
+ [[ "$state" = words ]] && _wanted words expl 'dictionary word' \
compadd $(look "${PREFIX}") && ret=0
;;
netbsd|openbsd)
@@ -386,20 +386,20 @@ case $state in
:URL:_urls && ret=0
;;
wayback)
- _arguments $args \
- '-syear=-[start search from this year]:year' \
- '-smonth=-:[start search from this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \
- '-sday=-[start search from this day]:number' \
- '-eyear=-[end search in this year]:year' \
- '-emonth=-[end search in this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \
- '-eday=-[end search in this day]:number' \
- '-list[list all pages that match search criteria]' \
- '-dups[show dups]' \
- '-compare[compare pages]' \
- '-pdf[show as PDF]' \
- '-alias=-[how to handle site aliases]:alias:(merge show hide)' \
- '-redir=-[how to handle redirections]:redir:(hide flag show)' \
- '-type=-[file type to search for]:type:(image audio video binary text pdf)'
+ _arguments $args \
+ '-syear=-[start search from this year]:year' \
+ '-smonth=-:[start search from this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \
+ '-sday=-[start search from this day]:number' \
+ '-eyear=-[end search in this year]:year' \
+ '-emonth=-[end search in this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \
+ '-eday=-[end search in this day]:number' \
+ '-list[list all pages that match search criteria]' \
+ '-dups[show dups]' \
+ '-compare[compare pages]' \
+ '-pdf[show as PDF]' \
+ '-alias=-[how to handle site aliases]:alias:(merge show hide)' \
+ '-redir=-[how to handle redirections]:redir:(hide flag show)' \
+ '-type=-[file type to search for]:type:(image audio video binary text pdf)'
;;
wetandwild)
_arguments \
@@ -422,14 +422,32 @@ case $state in
'-results=-[specify number of results to return]:number' && ret=0
;;
yubnub)
- _message -e command 'Yubnub Command'
+ _message -e commands 'Yubnub Command'
+ ;;
+ *)
+ _message -e strings 'search string'
;;
esac
;;
elvi)
- _wanted elvi expl elvi compadd \
- ${${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##--*}%:*} && ret=0
+ local -UT XDG_CONFIG_DIRS xdg_config_dirs
+ local it
+ # list the applets
+ set -- ${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##-- *}
+ shift # the first line is a header: remove it
+ # then list the bookmarks
+ for it in \
+ $^xdg_config_dirs/surfraw/bookmarks(Nr) \
+ /etc/xdg/surfraw/bookmarks(Nr) \
+ /etc/surfraw.bookmarks(Nr) \
+ ${XDG_CONFIG_HOME-$HOME/.config}/surfraw/bookmarks(Nr) \
+ $HOME/.surfraw.bookmarks(Nr)
+ do
+ read -d'\0' it < $it
+ set -- "$@" ${${(f)it}%%[[:space:]]*}
+ done
+ _wanted elvi expl elvi compadd "$@" && ret=0
;;
-esac
+esac
return ret
diff --git a/Completion/Unix/Command/_tail b/Completion/Unix/Command/_tail
index 3bfbe37ca..e54a0b06e 100644
--- a/Completion/Unix/Command/_tail
+++ b/Completion/Unix/Command/_tail
@@ -43,7 +43,7 @@ else
'(-v)-q[never output headers giving file names]'
)
;|
- (netbsd*)
+ (dragonfly*|netbsd*)
args+=( '(-q)-v[always output headers giving file names]' )
;;
esac
@@ -53,20 +53,14 @@ _arguments -C -s -S $opts : $args '*:file:_files' && return
case $state in
(number)
- local mlt sign digit
- mlt='multipliers:multiplier:((b\:512 K\:1024 KB\:1000 M\:1024\^2'
- mlt+=' MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4))'
- sign='signs:sign:((+\:"start at the specified byte/line"'
- sign+=' -\:"output the last specified bytes/lines (default)"))'
- digit='digits:digit:(0 1 2 3 4 5 6 7 8 9)'
- if compset -P '(-|+|)[0-9]##'; then
- _alternative $mlt $digit && ret=0
- elif [[ -z $PREFIX ]]; then
- _alternative $sign $digit && ret=0
- elif compset -P '(+|-)'; then
- _alternative $digit && ret=0
- fi
- ;;
+ local alts
+ [[ -z $PREFIX ]] && alts=(
+ 'sign:sign:((-\:"print all but the last specified bytes/lines" +\:"print the first specified bytes/lines (default)"))'
+ )
+ compset -P '+'
+ alts+=( 'numbers: :_numbers -N $state_descr b\:512 K\:1024 KB\:1000 M\:1024\^2 MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4' )
+ _alternative $alts && ret=0
+ ;;
esac
return ret
diff --git a/Completion/Unix/Command/_tex b/Completion/Unix/Command/_tex
index 9943fe10c..f1428c494 100644
--- a/Completion/Unix/Command/_tex
+++ b/Completion/Unix/Command/_tex
@@ -26,4 +26,4 @@ _arguments : \
'-8bit[make all characters printable by default]' \
'-help[display this help and exit]' \
'-version[output version information and exit]' \
- '*:TeX or LaTeX file:_files -g "*.(tex|TEX|texinfo|texi)(-.)"'
+ '*:TeX or LaTeX file:_files -g "*.(tex|TEX|texinfo|texi|dtx)(-.)"'
diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo
index b356ddbe7..2f5d0f91f 100644
--- a/Completion/Unix/Command/_texinfo
+++ b/Completion/Unix/Command/_texinfo
@@ -36,14 +36,14 @@ local -A opt_args infodirs
case $service in
info)
cmd=${words[1]}
- _arguments -C -s \
+ _arguments -C -s -S \
'(-a --all)'{-a,--all}'[use all matching manuals]' \
'(: -)'{-k+,--apropos=}'[look up string in indices]:search string: ' \
\*{-d+,--directory=}'[add directory to infopath]:info dir:_files -/' \
'--dribble=[record keystrokes]:file with keystrokes:_files' \
- '(-f --file 1)'{-f+,--file=}'[specify Info manual to visit]:info manual:->infofiles' \
+ '(-f --file 1)'{-f+,--file=}'[specify Info manual to visit]:info manual:->infofiles+' \
'(: - -h --help)'{-h,--help}'[display usage]' \
- '(-o --output -O)--index-search=[go directly to node if found]:search string: ' \
+ '(-o --output -O)--index-search=[search for matching index entry]:search string:->index-entries' \
'(--index-search -o --output -O)'{-o+,--output=}'[dump selected nodes to filename]:filename:_files -g "*(-.)"' \
'--init-file=[specify initialisation file]:file:_files' \
'(-n --node)'{-n+,--node=}'[specify nodes in first visited Info file]:node:->nodes' \
@@ -289,7 +289,11 @@ if [[ -n $state ]]; then
items=( ${${${(M)${(f)"$(_call_program menu-items info -o-)"}:#(#s)\* *: \(*}#??}%%\)*} )
files+=( ${items##*\(} )
tags=( info-files )
- if [[ $state != infofiles ]]; then
+ if [[ $state = infofiles+ && $PREFIX$SUFFX = */* ]]; then
+ # local files allowed
+ tags+=(files)
+ fi
+ if [[ $state != infofiles* ]]; then
tags+=( menu-items )
items=( ${items%:*} )
fi
@@ -301,6 +305,13 @@ if [[ -n $state ]]; then
tags+=( info-nodes )
fi
items=( ${${${(M)${(f)"$(_call_program menu-items info -o- $file)"}:#(#s)\* *::*}%%::*}#??} )
+ elif [[ $state = index-entries ]]; then
+ if [[ -n $file ]]; then
+ tags=( index-entries )
+ items=( ${${${(M)${(f)"$(_call_program index-entries info -o- --all --index-search= $file)"}:#(#s)\* *:*}%%:*}#??} )
+ else
+ _message -e index-entries $state_descr
+ fi
fi
_tags $tags
@@ -308,7 +319,9 @@ if [[ -n $state ]]; then
while _tags; do
_requested info-files expl 'info file' compadd $suf -M 'm:{a-zA-Z}={A-Za-z}' -a files && ret=0
_requested menu-items expl 'menu item' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a items && ret=0
+ _requested -x index-entries expl 'index entry' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a items && ret=0
_requested info-nodes expl 'node' compadd -M 'm:{a-zA-Z}={A-Za-z}' ${nodes#*:} && ret=0
+ _requested files expl 'file' && _files -g '*.info(|.gz|.bz2)'
(( ret )) || break
done
diff --git a/Completion/Unix/Command/_tidy b/Completion/Unix/Command/_tidy
index 3998ccdb3..35ceb7e51 100644
--- a/Completion/Unix/Command/_tidy
+++ b/Completion/Unix/Command/_tidy
@@ -12,7 +12,7 @@ opts=( ${(M)opts:#*:*} )
_arguments -s -A "-*" --$^opts \
'(-indent -i)'{-indent,-i}'[indent element content]' \
- '-wrap[wrap text at the specified <column> (default is 68)]:column:' \
+ '-wrap[wrap text at the specified column]:column [68]' \
'(-upper -u)'{-upper,-u}'[force tags to upper case (default is lower case)]' \
'(-clean -c)'{-clean,-c}'[replace FONT, NOBR and CENTER tags by CSS]' \
'(-bare -b)'{-bare,-b}'[strip out smart quotes and em dashes, etc.]' \
diff --git a/Completion/Unix/Command/_tiff b/Completion/Unix/Command/_tiff
index da55b541c..ef12777de 100644
--- a/Completion/Unix/Command/_tiff
+++ b/Completion/Unix/Command/_tiff
@@ -59,6 +59,7 @@ tiff2pdf)
'-s+[set document subject, overrides image image description default]:subject' \
'-k+[set document keywords]:keywords' \
'-b[set PDF "Interpolate" user preference]' \
+ '-m+[set memory allocation limit]:limit (MiB)' \
'(- :)-h[display usage information]' \
':input file:_files -g "*.(#i)tif(|f)(-.)"'
;;
@@ -83,6 +84,7 @@ tiff2ps)
'-i+[enable/disable (Nz/0) pixel interpolation]:state [enabled]:((0\:disable 1\:enable))' \
'-l+[set the left margin]:margin (inches)' \
'-m[use "imagemask" operator instead of "image"]' \
+ '-M+[set memory allocation limit]:limit (MiB)' \
'-o+[set initial TIFF directory (file offset)]:file offset (bytes)' \
'(-e)-p[generate non-Encapsulated PostScript]' \
'-O+[specify output file]:output file:_files -g "*.(#i)(|e)ps(-.)"' \
@@ -121,6 +123,7 @@ tiffcp)
'-i[ignore read errors]' \
'-b+[specify bias (dark) monochrome image to be subtracted from all others]:file:_files' \
'-,=-[specify substitute character for image indices]:character [,]' \
+ '-m+[set memory allocation limit]:limit (MiB)' \
'-r+[specify rows per strip]:rows per strip' \
'-w+[specify output tile width]:output tile width' \
'-l+[specify output tile length]:output tile length' \
diff --git a/Completion/Unix/Command/_timeout b/Completion/Unix/Command/_timeout
index 5c27bee47..c041283ac 100644
--- a/Completion/Unix/Command/_timeout
+++ b/Completion/Unix/Command/_timeout
@@ -2,8 +2,8 @@
local args
-if [[ $service = g* || $OSTYPE != *bsd* ]]; then
- # GNU coreutils as opposed to Free/NetBSD implementation
+if [[ $service = g* || $OSTYPE != *(freebsd|netbsd|openbsd)* ]]; then
+ # GNU coreutils or DFly as opposed to Free/Net/OpenBSD implementation
args=(
'(-v --verbose)'{-v,--verbose}'[indicate when signal is sent upon timeout]'
'(- *)--help[display usage information]'
@@ -15,6 +15,6 @@ _arguments -S -A "-" $args \
'--preserve-status[always exit with the same status as command even if it times out]' \
"--foreground[don't propagate timeout to the command children]" \
'(-s --signal)'{-s,--signal}'[specify the signal to send on timeout]:signal:_signals' \
- '(-k --kill-after)'{-k,--kill-after}'[followup first signal with SIGKILL if command persists after specified time]:time:time' \
- '1: :_guard "[0-9.]#([smhd]|)" duration' \
+ '(-k --kill-after)'{-k,--kill-after}'[followup first signal with SIGKILL if command persists after specified time]:time' \
+ '1: :_numbers -f -u seconds duration :s:seconds m:minutes h:hours d:days' \
'*:::command:_normal'
diff --git a/Completion/Unix/Command/_tla b/Completion/Unix/Command/_tla
index 1e4cdd8d9..ec7e76d44 100644
--- a/Completion/Unix/Command/_tla
+++ b/Completion/Unix/Command/_tla
@@ -45,8 +45,8 @@ _tla_revisions () { _arch_namespace tla 4 "$argv[@]" }
(( $+functions[_tla_local_revisions] )) ||
_tla_local_revisions () {
local expl1 expl2 tree_version=`$TLA tree-version`
- _description -V applied-patches expl1 "patches from this version"
- _description -V other-patches expl2 "patches from other versions"
+ _description -V applied-patches expl1 "patch from this version"
+ _description -V other-patches expl2 "patch from other versions"
compadd "$expl1[@]" `$TLA logs`
compadd "$expl2[@]" `$TLA logs --full $($TLA log-versions | grep -v $tree_version)`
# This is incredibly slow.
@@ -73,7 +73,7 @@ _tla_config () {
if [[ -d "$root/configs" ]]; then
configdir=("$root/configs")
- _description files expl '%Bconfig file%b'
+ _description files expl 'config file'
_files -W configdir "$expl[@]" && ret=0
else
_message -e messages "No configs/ directory in tree whose root is $root"
@@ -90,7 +90,7 @@ _tla_limit () { #presently only does push-mirror style limits
if [ $archive ]; then
if [[ $PREFIX != *--* ]]; then
- _description -V categories expl "categories in $archive"
+ _description -V categories expl "category in $archive"
compadd -q -S -- "$expl[@]" `$TLA categories -A $archive`
else
_tla_namespace_branches 3
@@ -107,7 +107,7 @@ _tla_tree_or_rev () {
_tla_libraries () {
local libraries expl
libraries=($(_call_program tla $TLA my-revision-library))
- _description -V libraries expl "revision libraries"
+ _description -V libraries expl "revision library"
compadd "$expl[@]" -a libraries
}
@@ -128,7 +128,7 @@ _tla_log_versions () {
else
logs=($(_call_program tla $TLA logs))
fi
- _description -V versions expl "log versions"
+ _description -V versions expl "log version"
compadd "$expl[@]" -a logs
}
@@ -278,12 +278,12 @@ methods=(
cmd_tagging_method=($cmd_id_tagging_method)
local cmd_add cmd_add_id cmd_add_tag
-cmd_add=('*:files to add:_files')
+cmd_add=('*:file to add:_files')
cmd_add_id=($cmd_add)
cmd_add_tag=($cmd_add)
local cmd_delete cmd_delete_id cmd_delete_tag
-cmd_delete=('*:files to delete:_files')
+cmd_delete=('*:file to delete:_files')
cmd_delete_id=($cmd_delete)
cmd_delete_tag=($cmd_delete)
@@ -312,7 +312,7 @@ cmd_changeset=(
':ORIG:_files -/'
':MOD:_files -/'
':DEST:_files -/'
- '*:files:_files'
+ '*:file:_files'
)
cmd_mkpatch=("$cmd_changeset[@]")
@@ -328,7 +328,7 @@ local cmd_make_archive
cmd_make_archive=('::name:' ':location:_files -/')
local cmd_archive_setup
-cmd_archive_setup=('*:versions:_tla_branches --trailing-dashes')
+cmd_archive_setup=('*:version:_tla_branches --trailing-dashes')
local cmd_make_category
cmd_make_category=(':category:_tla_archives -S /')
@@ -344,7 +344,7 @@ cmd_import=('::version:_tla_versions')
cmd_imprev=($cmd_import)
local cmd_commit cmd_cmtrev
-cmd_commit=('::version:_tla_versions' ':separator:(--)' '*:files:_files')
+cmd_commit=('::version:_tla_versions' ':separator:(--)' '*:file:_files')
cmd_cmtrev=($cmd_commit)
local cmd_get cmd_getrev
@@ -619,7 +619,7 @@ _tla_main () {
local -U cmds
help=(${(f)"$($TLA help)"})
cmds=(${${${${(M)help:#* :*}/ #: #/:}%% ##}## #})
- arguments=(':commands:(($cmds))')
+ arguments=(':command:(($cmds))')
fi
_arguments -S -A '-*' \
{"${hide_short}(: -)-V",'(: -)--version'}'[display version]' \
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index b564c955d..844af58fc 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -125,7 +125,9 @@ _tmux_aliasmap=(
# status line
confirm confirm-before
+ menu display-menu
display display-message
+ popup display-popup
# buffers
clearhist clear-history
@@ -167,17 +169,19 @@ _tmux-attach-session() {
_arguments -s \
'-c+[specify working directory for the session]:directory:_directories' \
'-d[detach other clients attached to target session]' \
+ '-f+[set client flags]: :_tmux_client_flags' \
'-r[put the client into read-only mode]' \
'-t+[specify target session]:target session: __tmux-sessions-separately' \
- "-E[don't apply update-environment option]"
+ "-E[don't apply update-environment option]" \
+ '-x[with -d, send SIGHUP to the parent of the attached client]'
}
_tmux-bind-key() {
[[ -n ${tmux_describe} ]] && print "bind a key to a command" && return
_arguments -s -A "-*" \
- '-c[bind to command mode instead of normal mode]' \
'-n[make the binding work without the need for the prefix key]' \
'-r[the key may repeat]' \
+ '-N+[attach a note to the key]:note' \
'-T+[specify key table for the binding]:key table' \
'1:key' \
'*:::template:= _tmux'
@@ -186,6 +190,8 @@ _tmux-bind-key() {
_tmux-break-pane() {
[[ -n ${tmux_describe} ]] && print "break a pane from an existing into a new window" && return
_arguments -s \
+ '(-b)-a[move window to next index after]' \
+ '(-a)-b[move window to next index before]' \
"-d[don't make the new window become the active one]" \
'-F+[specify output format]:format:__tmux-formats' \
'-P[print information of new window after it has been created]' \
@@ -202,7 +208,8 @@ _tmux-capture-pane() {
'-C[escape non-printable characters as octal \\ooo]' \
'-e[include escape sequences for attributes etc]' \
'-E[specify last line to capture]:line number (- means last line)' \
- '-J[join wrapped lines and preserve trailing space]' \
+ '(-N)-J[join wrapped lines and preserve trailing space]' \
+ '(-J)-N[preserve trailing space]' \
'-q[ignore errors when trying to access alternate screen]' \
'(-b)-p[print data to stdout]' \
'-P[only capture beginnings of as-yet incomplete escape sequences]' \
@@ -214,8 +221,11 @@ _tmux-choose-buffer() {
[[ -n ${tmux_describe} ]] && print "put a pane into buffer choice mode" && return
_arguments -s \
'-N[start without the preview]' \
+ '-Z[zoom the pane]' \
+ '-r[reverse sort order]' \
'-F+[specify format for each list item]:format:__tmux-formats' \
'-f+[filter items]:filter format:__tmux-formats' \
+ '-K+[specify format for each shortcut key]:format:__tmux-formats' \
'-O+[initial sort order]:order:(time name size)' \
'-t+[specify target window]:session:__tmux-windows' \
'*:::template:= _tmux'
@@ -225,8 +235,11 @@ _tmux-choose-client() {
[[ -n ${tmux_describe} ]] && print "put a window into client choice mode" && return
_arguments -s \
'-N[start without the preview]' \
+ '-Z[zoom the pane]' \
+ '-r[reverse sort order]' \
'-F+[specify format for each list item]:format:__tmux-formats' \
'-f+[filter items]:filter format:__tmux-formats' \
+ '-K+[specify format for each shortcut key]:format:__tmux-formats' \
'-O+[initial sort order]:order:(time name size)' \
'-t+[specify target window]:session:__tmux-windows' \
'*:::template:= _tmux'
@@ -237,8 +250,11 @@ _tmux-choose-tree() {
_arguments -s \
'-G[include all sessions in any session groups in the tree rather than only the first]' \
'-N[start without the preview]' \
+ '-Z[zoom the pane]' \
+ '-r[reverse sort order]' \
'-F+[specify format for each list item]:format:__tmux-formats' \
'-f+[filter items]:filter format:__tmux-formats' \
+ '-K+[specify format for each shortcut key]:format:__tmux-formats' \
'-O+[initial sort order]:order:(time name size)' \
'-s[choose among sessions]' \
'-t+[specify target window]:session:__tmux-windows' \
@@ -260,11 +276,14 @@ _tmux-command-prompt() {
[[ -n ${tmux_describe} ]] && print "open the tmux command prompt in a client" && return
_arguments -s \
'-1[only accept one key press]' \
- '-N' \
+ '-k[only accept one key press and translate it to a key name]' \
+ '-N[accept only numeric key presses]' \
'-i[execute the command every time the prompt input changes]' \
'-I+[specify list of initial inputs]:initial-text (comma-separated list)' \
'-p+[specify list of prompts]:prompts (comma-separated list)' \
'-t+[specify target client]:client:__tmux-clients' \
+ '(-W)-T[prompt is for a target - tab complete as appropriate]' \
+ '(-T)-W[prompt is for a window - tab complete as appropriate]' \
'*:::template:= _tmux'
}
@@ -279,11 +298,25 @@ _tmux-confirm-before() {
_tmux-copy-mode() {
[[ -n ${tmux_describe} ]] && print "enter copy mode" && return
_arguments -s \
+ '-s+[specify source pane]:pane:__tmux-panes' \
'-t+[specify target pane]:pane:__tmux-panes' \
+ '-e[scrolling to the bottom should exit copy mode]' \
+ '-H[hide the position indicator in the top right]' \
+ '-q[cancel copy mode and any other modes]' \
'-u[scroll up one page]' \
'-M[begin a mouse drag]'
}
+_tmux-customize-mode() {
+ [[ -n ${tmux_describe} ]] && print "enter customize mode" && return
+ _arguments -s \
+ '-F+[specify format for each item in the tree]:format:__tmux-formats' \
+ '-f+[specify initial filter]:filter:__tmux-formats' \
+ '-N[start without the option information]' \
+ '-t+[specify target pane]:pane:__tmux-panes' \
+ '-Z[zoom the pane]'
+}
+
_tmux-delete-buffer() {
[[ -n ${tmux_describe} ]] && print "delete a paste buffer" && return
_arguments '-b+[specify target buffer name]:buffer:__tmux-buffers'
@@ -299,16 +332,48 @@ _tmux-detach-client() {
'-t+[specify target client]:client:__tmux-clients'
}
+_tmux-display-menu() {
+ [[ -n ${tmux_describe} ]] && print "display a menu" && return
+ local curcontext="$curcontext" ret=1
+ local -a state line expl
+ _arguments -C -s -S -A "-*" \
+ '-c+[specify target client]:client:__tmux-clients' \
+ "-O[don't close menu if mouse is released without making a selection]" \
+ '-t+[specify target pane]:pane:__tmux-panes' \
+ '-T+[specify title]:title' \
+ '-x+[specify horizontal position]: : _alternative "columns\: \:_guard \[0-9\]\# column" "positions\:position\:((R\:right P\:bottom M\:mouse W\:window))"' \
+ '-y+[specify vertical position]: : _alternative "rows\: \:_guard \[0-9\]\# row" "positions\:position\:((P\:left M\:mouse S\:status\ line))"' \
+ '*::: :->options' && ret=0
+
+ if [[ -n $state ]]; then
+ case $(( CURRENT % 3 )) in
+ 1) _message -e menu-options 'menu option' ;;
+ 2) _message -e keys 'shortcut key' ;;
+ 0)
+ compset -q
+ words=( menu "$words[@]" )
+ (( CURRENT++ ))
+ _tmux && ret=0
+ ;;
+ esac
+ fi
+
+ return ret
+}
+
_tmux-display-message() {
[[ -n ${tmux_describe} ]] && print "display a message in the status line" && return
_arguments -s -S -A "-*" \
'(-p -F :)-a[list the format variables and their values]' \
+ '-I[forward any input read from stdin to the target pane]' \
+ '-N[ignore key presses and only close after the delay]' \
'-c+[specify target client]:client:__tmux-clients' \
+ '-d+[time to display message]:delay (milliseconds)' \
'(-a)-p[print message to stdout]' \
'-t+[specify target pane]:pane:__tmux-panes' \
'(-a)-F+[specify output format]:format:__tmux-formats' \
- '(-a)-v[prints verbose logging as the format is parsed]' \
- ':message'
+ '(-a)-v[print verbose logging as the format is parsed]' \
+ ':message:__tmux-formats'
}
_tmux-display-panes() {
@@ -320,9 +385,26 @@ _tmux-display-panes() {
'*:::command:= _tmux'
}
+_tmux-display-popup() {
+ [[ -n ${tmux_describe} ]] && print "display a popup box over a pane" && return
+ _arguments -s \
+ '-C[close any popup on the client]' \
+ '-c+[specify target client]:client:__tmux-clients' \
+ '-d+[specify working directory for the command]:directory:_directories' \
+ '-E[close the popup when the command exits]' \
+ '-w+[specify width]:width' \
+ '-h+[specify height]:height' \
+ '-t+[specify target pane]:pane:__tmux-panes' \
+ '-x+[specify horizontal position]:position' \
+ '-y+[specify vertical position]:position' \
+ ':shell command:_cmdstring'
+}
+
_tmux-find-window() {
[[ -n ${tmux_describe} ]] && print "search for a pattern in windows" && return
_arguments -s \
+ '-i[ignore case]' \
+ '-r[use regular expression matching]' \
'-C[match visible contents]' \
'-N[match window name]' \
'-T[match window title]' \
@@ -354,13 +436,15 @@ _tmux-if-shell() {
_tmux-join-pane() {
[[ -n ${tmux_describe} ]] && print "split a pane and move an existing one into the new space" && return
+ # -p removed from documentation but still works, or use -l and append %
_arguments -s \
'-b[join source pane left of or above target pane]' \
"-d[don't make the new window become the active one]" \
+ '(-l)-f[span the full size]' \
'-h[split horizontally]' \
'-v[split vertically]' \
- "-l+[define new pane's size]: :_guard '[0-9]#' 'numeric value'" \
- "-p+[define new pane's size in percent]: :_guard '[0-9]#' 'numeric value'" \
+ "(-p)-l[define new pane's size]:size" \
+ "!(-f -l)-p+:size (percentage)" \
'-s+[specify source pane]:pane:__tmux-panes' \
'-t+[specify target pane]:pane:__tmux-panes'
}
@@ -397,6 +481,7 @@ _tmux-last-pane() {
_arguments -s \
'-d[disable input to the pane]' \
'-e[enable input to the pane]' \
+ '-Z[keep window zoomed if it was zoomed]' \
'-t+[specify session]:session:__tmux-sessions'
}
@@ -408,6 +493,8 @@ _tmux-last-window() {
_tmux-link-window() {
[[ -n ${tmux_describe} ]] && print "link a window to another" && return
_arguments -s \
+ '(-b)-a[move window to next index after destination window]' \
+ '(-a)-b[move window to next index before destination window]' \
"-d[don't make the new window become the active one]" \
'-k[kill the target window if it exists]' \
'-s+[specify source window]:window:__tmux-windows' \
@@ -416,7 +503,9 @@ _tmux-link-window() {
_tmux-list-buffers() {
[[ -n ${tmux_describe} ]] && print "list paste buffers of a session" && return
- _arguments '-F+[specify output format]:format:__tmux-formats'
+ _arguments \
+ '-F+[specify output format]:format:__tmux-formats' \
+ '-f+[filter items]:filter format:__tmux-formats'
}
_tmux-list-clients() {
@@ -428,12 +517,16 @@ _tmux-list-clients() {
_tmux-list-commands() {
[[ -n ${tmux_describe} ]] && print "list supported sub-commands" && return
- _arguments '-F+[specify format]:format'
+ _arguments '-F+[specify format]:format:__tmux-formats' '1:sub-command:_tmux'
}
_tmux-list-keys() {
[[ -n ${tmux_describe} ]] && print "list all key-bindings" && return
_arguments -s \
+ '-1[list only the first matching key]' \
+ '-a[list the command for keys that do have a note]' \
+ '-N[list only keys with attached notes]' \
+ '-P+[specify a prefix to print before each key]:prefix' \
'-T+[specify key table]:key table'
}
@@ -448,12 +541,15 @@ _tmux-list-panes() {
_arguments -s $args \
'-a[list all panes the server possesses]' \
'-F+[specify output format]:format:__tmux-formats' \
+ '-f+[filter items]:filter format:__tmux-formats' \
'-s[if specified, -t chooses a session]'
}
_tmux-list-sessions() {
[[ -n ${tmux_describe} ]] && print "list sessions managed by server" && return
- _arguments '-F+[specify output format]:format:__tmux-formats'
+ _arguments \
+ '-F+[specify output format]:format:__tmux-formats' \
+ '-f+[filter items]:filter format:__tmux-formats'
}
_tmux-list-windows() {
@@ -461,6 +557,7 @@ _tmux-list-windows() {
_arguments -s \
'-a[list all windows the tmux server possesses]' \
'-F[specify output format]:format:__tmux-formats' \
+ '-f+[filter items]:filter format:__tmux-formats' \
'-t+[specify session]:session:__tmux-sessions'
}
@@ -468,6 +565,8 @@ _tmux-load-buffer() {
[[ -n ${tmux_describe} ]] && print "load a file into a paste buffer" && return
_arguments -A "-*" -S \
'-b+[specify target buffer name]:buffer:__tmux-buffers' \
+ '-t+[specify target client]:client:__tmux-clients' \
+ '-w[also send the buffer to the clipboard using the xterm escape sequence]' \
'1:file:_files'
}
@@ -487,21 +586,14 @@ _tmux-lock-session() {
}
_tmux-move-pane() {
- [[ -n ${tmux_describe} ]] && print "move a pane into a new space" && return
- _arguments -s \
- '-b[join source pane left of or above target pane]' \
- "-d[don't make the new window become the active one]" \
- '-h[split horizontally]' \
- '-v[split vertically]' \
- "-l+[define new pane's size]:numeric value" \
- "-p+[define new pane's size in percent]:numeric value" \
- '-s+[specify source pane]:pane:__tmux-panes' \
- '-t+[specify target pane]:pane:__tmux-panes'
+ _tmux-join-pane "$@"
}
_tmux-move-window() {
[[ -n ${tmux_describe} ]] && print "move a window to another" && return
_arguments -s \
+ '(-b)-a[move window to next index after destination window]' \
+ '(-a)-b[move window to next index before destination window]' \
"-d[don't make the new window become the active one]" \
'-k[kill the target window if it exists]' \
'-s+[specify source window]:window:__tmux-windows' \
@@ -512,31 +604,37 @@ _tmux-move-window() {
_tmux-new-session() {
[[ -n ${tmux_describe} ]] && print "create a new session" && return
_arguments -s -A "-*" -S \
- '-A[attach to existing session if it already exists]' \
'-c+[specify working directory for the session]:directory:_directories' \
+ '-A[attach to existing session if it already exists]' \
"-d[don't attach new session to current terminal]" \
- "-D[in case of -A behave like attach-session's -d]" \
+ "-D[with -A, detach other clients attached to session]" \
"-E[don't apply update-environment option]" \
+ '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \
'-F+[specify output format]:format:__tmux-formats' \
+ '-f+[specify client flags]: :_tmux_client_flags' \
'-n+[specify initial window name]:window name' \
'-P[print information about new session after it is created]' \
'-s+[name the session]:session name:__tmux-sessions' \
'-t+[specify target session]:session:__tmux-sessions' \
'-x[specify width]:width' \
'-y[specify height]:height' \
+ '-X[with -D, send SIGHUP to the parent of the attached client]' \
'*:: :_cmdambivalent'
}
_tmux-new-window() {
[[ -n ${tmux_describe} ]] && print "create a new window" && return
_arguments -s -A "-*" -S \
- '-a[insert new window at next free index from -t]' \
+ '(-b)-a[insert new window at next index after target]' \
+ '(-a)-b[insert new window at next index before target]' \
'-c+[specify working directory for the session]:directory:_directories' \
- "-d[don't make the new window become the active one]" \
+ '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \
+ "(-S)-d[don't make the new window become the active one]" \
'-F+[specify output format]:format:__tmux-formats' \
'-k[destroy it if the specified window exists]' \
'-n+[specify a window name]:window name' \
'-P[print information about new window after it is created]' \
+ '(-d)-S[select window if name already exists]' \
'-t+[specify target window]:window:__tmux-windows' \
'*:: :_cmdambivalent'
}
@@ -588,10 +686,13 @@ _tmux-previous-window() {
_tmux-refresh-client() {
[[ -n ${tmux_describe} ]] && print "refresh a client" && return
- _arguments -s -S -A "-*" \
+ _arguments -s -A "-*" -S \
+ '-B+[set a subscription to a format for a control mode client]:subscription' \
+ '-A+[allow a control mode client to trigger actions on a pane]:pane:__tmux-panes -P% -S\:' \
'-C+[set the width and height of a control client]:width,height' \
'-c[reset so that the position follows the cursor]' \
'-D[move visible portion of window down]' \
+ '-f+[set client flags]:flag:_tmux_client_flags' \
'-L[move visible portion of window left]' \
'-l[request clipboard from the client and store it in a new paste buf using xterm(1) escape sequence]' \
"-S[only update the client's status bar]" \
@@ -624,6 +725,7 @@ _tmux-resize-pane() {
'-R[resize to the right]' \
'-U[resize upward]' \
'-t+[specify target pane]:pane:__tmux-panes' \
+ '-T[trim lines below the cursor position and moves lines out of the history to replace them]' \
'-x+[specify width]:width' \
'-y+[specify height]:height' \
'-Z[toggle zoom of pane]' \
@@ -649,6 +751,7 @@ _tmux-respawn-pane() {
[[ -n ${tmux_describe} ]] && print "reuse a pane in which a command has exited" && return
_arguments -s -A "-*" -S \
'-c+[specify a new working directory for the pane]:directory:_directories' \
+ '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \
'-k[kill window if it is in use]' \
'-t+[specify target pane]:pane:__tmux-pane' \
':command:_cmdambivalent'
@@ -658,6 +761,7 @@ _tmux-respawn-window() {
[[ -n ${tmux_describe} ]] && print "reuse a window in which a command has exited" && return
_arguments -s -A "-*" -S \
'-c+[specify a new working directory for the window]:directory:_directories' \
+ '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \
'-k[kill window if it is in use]' \
'-t+[specify target window]:window:__tmux-windows' \
':command:_cmdambivalent'
@@ -668,15 +772,28 @@ _tmux-rotate-window() {
_arguments -s \
'-D[rotate downward]' \
'-U[rotate upward]' \
+ '-Z[keep the window zoomed if it was zoomed]' \
'-t+[specify target window]:window:__tmux-windows'
}
_tmux-run-shell() {
[[ -n ${tmux_describe} ]] && print "execute a command without creating a new window" && return
- _arguments -s -A "-*" -S \
- '-b[run shell command in background]' \
+ local curcontext="$curcontext" ret=1
+ local -a state line expl
+ _arguments -C -s -A "-*" -S \
+ '-b[run command in background]' \
+ '(1)-C[run a tmux command]' \
+ '-d+[specify delay before starting the command]:delay (seconds)' \
'-t+[specify target pane]:pane:__tmux-panes' \
- ':command:_cmdstring'
+ '(2)1:command:_cmdstring' \
+ '2:tmux command:->tmux-commands' && ret=0
+
+ if [[ -n $state ]]; then
+ compset -q
+ words=( run "$words[@]" )
+ (( CURRENT++ ))
+ _tmux && ret=0
+ fi
}
_tmux-save-buffer() {
@@ -699,6 +816,7 @@ _tmux-select-layout() {
_tmux-select-pane() {
[[ -n ${tmux_describe} ]] && print "make a pane the active one in the window" && return
+ # -P and -g have been removed from the documentation in tmux 3 but still work
_arguments -s \
'-D[move to the pane below target]' \
'-d[disable input to the pane]' \
@@ -710,6 +828,7 @@ _tmux-select-pane() {
'-m[set marked pane]' \
'-R[move to the pane right of target]' \
'-U[move to the pane above target]' \
+ '-Z[keep the window zoomed if it was zoomed]' \
'-P+[set pane style]:style:__tmux-style' \
'-T+[set the pane title]:title' \
'-t+[specify target pane]:pane:__tmux-panes'
@@ -728,7 +847,9 @@ _tmux-select-window() {
_tmux-send-keys() {
[[ -n ${tmux_describe} ]] && print "send key(s) to a window" && return
_arguments -s -A "-*" -S \
- '-l[disable key name lookup and send data literally]' \
+ '(-H)-l[disable key name lookup and send data literally]' \
+ '-F[expand formats in arguments where appropriate]' \
+ '(-l)-H[interpret key as hexadecimal number for an ASCII character]' \
'-R[reset terminal state]' \
'-M[pass through a mouse event]' \
'-X[send a command into copy mode]' \
@@ -755,6 +876,8 @@ _tmux-set-buffer() {
'-a[append to rather than overwriting target buffer]' \
'-b+[specify target buffer index]:pane:__tmux-buffers' \
'-n+[specify new buffer name]:buffer-name' \
+ '-t+[specify target client]:client:__tmux-clients' \
+ '-w[also send the buffer to the clipboard using the xterm escape sequence]' \
':data'
}
@@ -764,7 +887,9 @@ _tmux-set-environment() {
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
_arguments -C -s -A "-*" -S : \
+ '-F[expand value as a format]' \
'(-t)-g[modify global environment]' \
+ '-h[mark the variable as hidden]' \
'(-u)-r[remove variable before starting new processes]' \
'(-r)-u[unset a variable]' \
'(-g)-t[specify target session]:target session:__tmux-sessions' \
@@ -801,8 +926,10 @@ _tmux-set-option() {
'-o[prevent setting of an option that is already set]' \
'-q[suppress errors about unknown or ambiguous options]' \
'-u[unset a non-global option]' \
- '-w[change window (not session) options]' \
- '-s[change server (not session) options]' \
+ '-U[unset a pane option across all panes in the window]' \
+ '(-w -s)-p[change pane (no session) options]' \
+ '(-p -s)-w[change window (not session) options]' \
+ '(-p -w)-s[change server (not session) options]' \
'-t+[specify target session]:target session:__tmux-sessions' \
'*:: :->name_or_value' && ret=0
@@ -835,8 +962,11 @@ _tmux-set-window-option() {
_tmux-set-hook() {
[[ -n ${tmux_describe} ]] && print "set a hook to a command" && return
_arguments -s \
+ '-a[append to hook]' \
'(-R)-g[add hook to global list]' \
'(-g -u)-R[run hook immediately]' \
+ '(-w)-p[set pane hooks]' \
+ '(-p)-w[set window hooks]' \
'(-R)-u[unset a hook]' \
'-t+[specify target session]:session:__tmux-sessions' \
':hook name:_tmux_hooks' \
@@ -847,6 +977,8 @@ _tmux-show-hooks() {
[[ -n ${tmux_describe} ]] && print "show the global list of hooks" && return
_arguments -s -S -A "-*" \
'-g[show global list of hooks]' \
+ '(-w)-p[show pane hooks]' \
+ '(-p)-w[show window hooks]' \
'-t+[specify target session]:session:__tmux-sessions' \
}
@@ -862,6 +994,7 @@ _tmux-show-environment() {
typeset -A opt_args
_arguments -C -A "-*" -s : \
'(-t)-g[show global environment]' \
+ '-h[show hidden variables]' \
'-s[format output as Bourne shell commands]' \
'(-g)-t+[specify target session]:target session:__tmux-sessions' \
'1:: :->name' && ret=0
@@ -888,11 +1021,14 @@ _tmux-show-options() {
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
_arguments -C -s : \
+ '-A[include options inherited from a parent set]' \
+ '-H[include hooks]' \
'-g[show global options]' \
'-q[suppress errors about unknown or ambiguous options]' \
- '-s[show server options]' \
'-v[show only the option value, not the name]' \
- '-w[show window options]' \
+ '(-s -w)-p[show pane (not session) options]' \
+ '(-p -w)-s[show server (not session) options]' \
+ '(-p -s)-w[show window (not session) options]' \
'-t+[specify target session]:target session:__tmux-sessions' \
'*:: :->name_or_value' && ret=0
@@ -921,22 +1057,29 @@ _tmux-show-window-options() {
_tmux-source-file() {
[[ -n ${tmux_describe} ]] && print "execute tmux commands from a file" && return
_arguments \
+ '-F[expand path as a format]' \
+ '-n[file is parsed but no commands are executed]' \
"-q[don't report error if path doesn't exist]" \
+ '-v[show parsed commands and line numbers if possible]' \
'*:path:_directories'
}
_tmux-split-window() {
[[ -n ${tmux_describe} ]] && print "splits a pane into two" && return
+ # -p removed from documentation but still works, or use -l and append %
_arguments -s \
'-b[create new pane left of or above target pane]' \
"-d[don't make the new window become the active one]" \
+ '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \
'-F+[specify output format]:format:__tmux-formats' \
- '-f[create new pane spanning full window width or height]' \
+ '(-l)-f[create new pane spanning full window width or height]' \
'-h[split horizontally]' \
'-v[split vertically]' \
- "-l[define new pane's size]:size" \
- "-p[define new pane's size in percent]:size (percentage)" \
+ "(-p)-l[define new pane's size]:size" \
+ "!(-f -l)-p+:size (percentage)" \
'-t+[specify target pane]:pane:__tmux-panes' \
+ '-Z[zoom the pane]' \
+ '(:)-I[create empty pane and forward stdin to it]' \
':command:_cmdambivalent'
# Yes, __tmux-panes is correct here. The behaviour was changed
# in recent tmux versions and makes more sense. Except that
@@ -959,6 +1102,7 @@ _tmux-swap-pane() {
_arguments -s \
'-D[move pane down]' \
'-U[move pane up]' \
+ '-Z[keep the window zoomed if it was zoomed]' \
"-d[don't change the active pane]" \
'-s+[specify source pane]:pane:__tmux-panes' \
'-t+[specify destination pane]:pane:__tmux-panes'
@@ -981,6 +1125,7 @@ _tmux-switch-client() {
'-n[move client to next session]' \
'-p[move client to previous session]' \
'-r[toggle read-only flag of client]' \
+ '-Z[keep the window zoomed if it was zoomed]' \
'-t+[specify target window]:window:__tmux-windows'
}
@@ -993,6 +1138,7 @@ _tmux-unbind-key() {
_arguments -C -s \
'-a[remove all key bindings]' \
'-n[remove a non-prefix binding]' \
+ '-q[prevent errors being returned]' \
'-T[specify key table]:key table' \
'*:: :->boundkeys'
@@ -1042,7 +1188,7 @@ function __tmux-buffers() {
fi
buffers=( ${${(f)"$(command tmux 2> /dev/null list-buffers "${bopts[@]}")"}/:[ $'\t']##/:} )
- _describe -t buffers 'buffers' buffers
+ _describe -t buffers 'buffer' buffers
}
function __tmux-bound-keys() {
@@ -1050,14 +1196,14 @@ function __tmux-bound-keys() {
local -a keys
keys=( ${${${${(f)"$(command tmux 2> /dev/null list-keys "$@")"}/:[ $'\t']##/:}/(#s)[ $'\t']##/}/(#s):/\\:} )
- _describe -t keys 'keys' keys
+ _describe -t keys 'key' keys
}
function __tmux-clients() {
local expl
local -a clients
clients=( ${${(f)"$(command tmux 2> /dev/null list-clients)"}/:[ $'\t']##/:} )
- _describe -t clients 'clients' clients
+ _describe -t clients 'client' clients
}
function __tmux-environment-variables() {
@@ -1093,7 +1239,7 @@ function __tmux-environment-variables() {
descriptions+=( "${k//:/\\:}:$v" )
done
# TODO: this if/else is because '_describe ${hint:+"-x"}' prints the "No matches" error in addition to the message.
- local msg="${dash_g[1]:+"global "}environment variables${hint}"
+ local msg="${dash_g[1]:+"global "}environment variable${hint}"
if _describe -t parameters $msg descriptions; then
:
elif [[ -n $hint ]]; then
@@ -1311,6 +1457,11 @@ _tmux_hooks() {
'post-hooks:command post-hook:compadd - after-${_tmux_aliasmap}'
}
+_tmux_client_flags() {
+ _values -s , flag active-pane ignore-size no-output \
+ 'pause-after:time (seconds)' read-only wait-exit
+}
+
function __tmux-get-optarg() {
local opt="$1"
local -i i
@@ -1535,23 +1686,18 @@ function __tmux-options-complete() {
}
function __tmux-panes() {
- local expl line
+ local expl line orig="$IPREFIX"
local -i num
local -a panes opts
- compset -P '*.'
- if [[ -n ${IPREFIX} ]]; then
- opts=( -t "${IPREFIX%.}" )
- else
- opts=( )
- fi
+ compset -P '*.' && opts=( -t "${${IPREFIX%.}#$orig}" )
num=0
command tmux 2> /dev/null list-panes "${opts[@]}" | while IFS= read -r line; do
panes+=( $(( num++ )):${line//:/} )
done
- _describe -t panes 'panes' panes "$@"
+ _describe -t panes 'pane' panes "$@"
if [[ ${IPREFIX} != *. ]]; then
- _wanted windows expl 'windows' __tmux-windows -S.
+ _wanted windows expl 'window' __tmux-windows -S.
fi
}
@@ -1576,14 +1722,14 @@ function __tmux-server-options() {
function __tmux-sessions() {
local -a sessions
sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
- _describe -t sessions 'sessions' sessions "$@"
+ _describe -t sessions 'session' sessions "$@"
}
function __tmux-sessions-attached() {
local -a sessions
sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
sessions=( ${(M)sessions:#*"(attached)"} )
- _describe -t sessions 'attached sessions' sessions "$@"
+ _describe -t sessions 'attached session' sessions "$@"
}
# Complete attached-sessions and detached-sessions as separate tags.
@@ -1599,8 +1745,8 @@ function __tmux-sessions-separately() {
_tags detached-sessions attached-sessions
# Placing detached before attached means the default behaviour of this
# function better suits its only current caller, _tmux-attach-session().
- _requested detached-sessions && _describe -t detached-sessions 'detached sessions' detached_sessions "$@" && ret=0
- _requested attached-sessions && _describe -t attached-sessions 'attached sessions' attached_sessions "$@" && ret=0
+ _requested detached-sessions && _describe -t detached-sessions 'detached session' detached_sessions "$@" && ret=0
+ _requested attached-sessions && _describe -t attached-sessions 'attached session' attached_sessions "$@" && ret=0
return ret
}
@@ -1672,9 +1818,9 @@ function __tmux-windows() {
opts=( )
fi
wins=( ${${(M)${(f)"$(command tmux 2> /dev/null list-windows "${opts[@]}")"}:#<->*}/:[ $'\t']##/:} )
- _describe -t windows 'windows' wins "$@"
+ _describe -t windows 'window' wins "$@"
if [[ ${IPREFIX} != *: ]]; then
- _wanted sessions expl 'sessions' __tmux-sessions -S:
+ _wanted sessions expl 'session' __tmux-sessions -S:
fi
}
@@ -1689,10 +1835,13 @@ _tmux() {
'-2[force using 256 colours]' \
'-c[execute a shell command]:command name:_command_names' \
'-C[start tmux in control mode. -CC disables echo]' \
+ "-D[don't start the tmux server as a daemon]" \
'-f[specify configuration file]:tmux config file:_files -g "*(-.)"' \
'-l[behave like a login shell]' \
'-L[specify socket name]:socket name:__tmux-socket-name' \
+ "-N[don't start the server even if the command would normally do so]" \
'-S[specify socket path]:server socket:_path_files -g "*(=,/)"' \
+ '-T+[set terminal features for the client]: : _values -s , 256 clipboard ccolour cstyle extkeys focus margins mouse overline rectfill RGB strikethrough sync title usstyle' \
'-u[force using UTF-8]' \
'-v[request verbose logging]' \
'-V[report tmux version]' \
@@ -1703,11 +1852,11 @@ _tmux() {
if (( CURRENT == 1 )); then
zstyle -s ":completion:${curcontext}:subcommands" mode mode || mode='both'
if [[ ${mode} == 'commands' ]]; then
- _describe -t subcommands 'tmux commands' _tmux_commands && ret=0
+ _describe -t subcommands 'tmux command' _tmux_commands && ret=0
elif [[ ${mode} == 'aliases' ]]; then
- _describe -t subcommands 'tmux aliases' _tmux_aliases && ret=0
+ _describe -t subcommands 'tmux alias' _tmux_aliases && ret=0
else
- _describe -t subcommands 'tmux commands and aliases' _tmux_commands -- _tmux_aliases && ret=0
+ _describe -t subcommands 'tmux command or alias' _tmux_commands -- _tmux_aliases && ret=0
fi
else
tmuxcommand="${words[1]}"
diff --git a/Completion/Unix/Command/_todo.sh b/Completion/Unix/Command/_todo.sh
index 287c9ff78..99b6bb695 100644
--- a/Completion/Unix/Command/_todo.sh
+++ b/Completion/Unix/Command/_todo.sh
@@ -55,21 +55,26 @@ case $state in
"append:adds to item on line NUMBER the text TEXT."
"archive:moves done items from todo.txt to done.txt."
"command:run internal commands only"
+ "deduplicate:removes duplicate lines from todo.txt."
"del:deletes the item on line NUMBER in todo.txt."
"depri:remove prioritization from item"
+ "done:marks task(s) on line ITEM# as done in todo.txt"
"do:marks item on line NUMBER as done in todo.txt."
"help:display help"
"list:displays all todo items containing TERM(s), sorted by priority."
"listall:displays items including done ones containing TERM(s)"
+ "listaddons:lists all added and overridden actions in the actions directory."
"listcon:list all contexts"
"listfile:display all files in .todo directory"
"listpri:displays all items prioritized at PRIORITY."
+ "listproj:lists all the projects in todo.txt."
"move:move item between files"
"prepend:adds to the beginning of the item on line NUMBER text TEXT."
"pri:adds or replace in NUMBER the priority PRIORITY (upper case letter)."
"replace:replace in NUMBER the TEXT."
"remdup:remove exact duplicates from todo.txt."
"report:adds the number of open and done items to report.txt."
+ "showhelp:list the one-line usage of all built-in and add-on actions."
)
_describe -t todo-commands 'todo.sh command' cmdlist
;;
@@ -98,7 +103,7 @@ case $state in
fi
;;
- (depri|do|dp)
+ (depri|do|dp|done)
nextstate=item
;;
diff --git a/Completion/Unix/Command/_top b/Completion/Unix/Command/_top
index 652432166..692df790d 100644
--- a/Completion/Unix/Command/_top
+++ b/Completion/Unix/Command/_top
@@ -64,7 +64,6 @@ case $OSTYPE in
'-I[do not display idle processes]'
'-i[interactive mode]'
'-n[non-interactive mode (identical to batch mode)]'
- '-o+[sort process display by the specified field]:field:( $fields )'
'-p+[filter by the specified pid]: :_pids'
'-q[renice top to -20]'
'-S[show system processes]'
@@ -80,6 +79,7 @@ case $OSTYPE in
'-j[display the jail ID]'
'-t[do not display the top process]'
'-m+[specify statistic type]:type:(( cpu\:default io ))'
+ '-o+[sort process display by the specified field]:field:( $fields )'
'-P[per-cpu CPU usage statistics]'
'(1 -)-v[write version number and exit]'
'-w[display approximate swap usage]'
@@ -89,10 +89,14 @@ case $OSTYPE in
);;
openbsd*)
fields+=( command )
+ order=( '-:reverse order' )
specs+=(
'-1[combine CPU statistic into one line]'
+ '-t[show the routing table instead of the wait channel]'
'-C[show command arguments as well as process name]'
'-g+[filter processes by the specified string]:string'
+ '-o+[sort process display by the specified field]:field:->sortkey'
+ '-T+[filter processes by the specified routing table]:routing table:_routing_tables'
'-U+[filter processes by the specified user]: :_users -M "L\:|-="'
);;
darwin*)
diff --git a/Completion/Unix/Command/_tput b/Completion/Unix/Command/_tput
index a3b4e949c..abba3e8c0 100644
--- a/Completion/Unix/Command/_tput
+++ b/Completion/Unix/Command/_tput
@@ -14,5 +14,5 @@ esac
_arguments : \
$args - set3 \
'(-S -V)-T+[terminal type]:terminal type:_terminals' \
- '1:terminal capabilities:( init reset longname ${(k)terminfo} )' \
+ '1:terminal capability:( init reset longname ${(k)terminfo} )' \
'*:capability parameters:{ [[ $words[1] != (init|reset|longname) ]] && _message parameter }'
diff --git a/Completion/Unix/Command/_transmission b/Completion/Unix/Command/_transmission
index 8a4bebec3..a640f3dd7 100644
--- a/Completion/Unix/Command/_transmission
+++ b/Completion/Unix/Command/_transmission
@@ -6,17 +6,17 @@
local exclusive_auth_options='(-n --auth -ne --authenv -N --netrc)'
local general_options=(
{-d,--debug}'[enable debugging mode]'
- $exclusive_auth_options{-n-,--auth=}'[set the username and password for authentication]:username\:password: '
+ $exclusive_auth_options{-n+,--auth=}'[set the username and password for authentication]:username\:password: '
$exclusive_auth_options{-ne,--authenv}'[set the authentication information from the TR_AUTH environment variable]'
- $exclusive_auth_options{-N-,--netrc=}'[set the authentication information from a netrc file]:file:_files'
+ $exclusive_auth_options{-N+,--netrc=}'[set the authentication information from a netrc file]:file:_files'
'--find[tell Transmission where to look for the current torrents'"'"' data]'
)
# `general_actions`: *actions* that can be specified when a specific set of torrents is either specified or either not
local general_actions=(
- '(- :)'{-gsr,--global-seedratio}'[all torrents, unless overridden by a per-torrent setting, should seed until a specific ratio]:ratio:{_message "ratio in kB/sec"}'
+ '(- :)'{-gsr,--global-seedratio}'[all torrents, unless overridden by a per-torrent setting, should seed until a specific ratio]:ratio (kB/s)'
'(- :)'{-GSR,--no-global-seedratio}'[all torrents, unless overridden by a per-torrent setting, should seed regardless of ratio]'
'(- :)'{-pr,--peers}'[set the maximum number of peers]:number: '
- '(- :)'{-d-,--downlimit=}'[limit the maximum download speed to limit kB/s]:limit:{_message "limit in kB/sec"}'
+ '(- :)'{-d+,--downlimit=}'[limit the maximum download speed to limit kB/s]:limit (kB/s)'
'(- :)'{-D,--no-downlimit}'[disable download speed limits]'
)
# `global_only_actions`: *actions* that can be specified only when no specific torrent is specified
@@ -27,12 +27,12 @@ local global_only_actions=(
'(- :)'{-asu,--alt-speed-uplimit}'[limit the alternate upload speed to limit kilobytes per second]'
'(- :)'{-asc,--alt-speed-scheduler}'[use the scheduled on/off times]'
'(- :)'{-asc,--not-alt-speed-scheduler}'[don'"'"'t use the scheduled on/off times]'
- '(- :)--alt-speed-time-begin[time to start using the alt speed limits]:hhmm:_transmission-remote_time'
- '(- :)--alt-speed-time-end[time to stop using the alt speed limits]:hhmm:_transmission-remote_time'
+ '(- :)--alt-speed-time-begin[time to start using the alt speed limits]:time (HHMM)'
+ '(- :)--alt-speed-time-end[time to stop using the alt speed limits]:time (HHMM)'
'(- :)--alt-speed-days[set the number of days on which to enable the speed scheduler]:days:_transmission-remote_days'
'(- :)--torrent-done-script[specify a file to run each time a torrent finishes]:script:_files'
'(- :)--no-torrent-done-script[don'"'"'t run any script when a torrent finishes]'
- '(- :)'{-e-,--cache=}'[set the session'"'"'s maximum memory cache size in MiB]:size (MiB):'
+ '(- :)'{-e+,--cache=}'[set the session'"'"'s maximum memory cache size in MiB]:size (MiB):'
'(- :)'{-er,--encryption-required}'[encrypt all peer connections]'
'(- :)'{-ep,--encryption-preferred}'[prefer encrypted peer connections]'
'(- :)'{-et,--encryption-tolerated}'[prefer unencrypted peer connections]'
@@ -42,7 +42,7 @@ local global_only_actions=(
{-t,--torrent=}'[set the current torrent(s) for use by subsequent options]:torrent:_transmission-remote_torrent'
'(- :)'{-si,--session-info}'[list session information from the server]'
'(- :)'{-st,--session-stats}'[list statistical information from the server]'
- {-a-,--add=}'[add torrents to transmission]:filename\|url:_transmission-remote_add'
+ {-a+,--add=}'[add torrents to transmission]:filename\|url:_transmission-remote_add'
'(- :)'{-l,--list}'[list all torrents]'
'(- :)'{-p,--port}'[set the port for use when listening for incoming peer connections]:port:'
'(- :)--start-paused[start added torrents paused]'
@@ -51,7 +51,7 @@ local global_only_actions=(
'(- :)'{-M,--no-portmap}'[disable portmapping]'
'(- :)'{-o,--dht}'[enable distributed hash table]'
'(- :)'{-O,--no-dht}'[disable distributed hash table]'
- '(- :)'{-u,--uplimit}'[limit the maximum upload speed to limit kB/s]:limit:{_message "limit in kB/sec"}'
+ '(- :)'{-u,--uplimit}'[limit the maximum upload speed to limit kB/s]:limit (kB/s)'
'(- :)'{-U,--no-uplimit}'[disable upload speed limits]'
'(- :)--utp[enable uTP for peer connections]'
'(- :)--no-utp[disable uTP for peer connections]'
@@ -65,9 +65,9 @@ local global_only_actions=(
)
# `torrent_add_options`: *options* that can be used only when *adding* a torrent
local torrent_add_options=(
- '(-C --no-incomplete-dir)'{-c-,--incomplete-dir=}'[when adding new torrents, store their contents in directory until the torrent is done]:dir:{_files -/}'
+ '(-C --no-incomplete-dir)'{-c+,--incomplete-dir=}'[when adding new torrents, store their contents in directory until the torrent is done]:directory:_directories'
'(-c --incomplete-dir)'{-C,--no-incomplete-dir}'[don'"'"'t store incomplete torrents in a different directory]'
- {-w-,--download-dir=}'[when used in conjunction with --add, set the new torrent'"'"'s download folder]:dir:{_files -/}'
+ {-w+,--download-dir=}"[when used in conjunction with --add, set the new torrent's download directory]:directory:_directories"
)
# `torrent_action_only_actions`: *actions* that can be specified only when explicitly selecting a specific set of torrents
local torrent_action_only_actions=(
@@ -81,15 +81,15 @@ local torrent_action_only_actions=(
{-it,--info-trackers}'[list the specified torrent'"'"'s trackers]'
'--trash-torrent[delete torrents after adding]'
'--no-trash-torrent[do not delete torrents after adding]'
- {-td-,--tracker-add=}'[add a tracker to a torrent]:tracker:_urls'
- {-tr-,--tracker-remove=}'[remove a tracker from a torrent]:tracker_id:_transmission-remote_torrent_tracker_id'
+ {-td+,--tracker-add=}'[add a tracker to a torrent]:tracker:_urls'
+ {-tr+,--tracker-remove=}'[remove a tracker from a torrent]:tracker_id:_transmission-remote_torrent_tracker_id'
{-s,--start}'[start the current torrent(s)]'
{-S,--stop}'[stop the current torrent(s) from downloading or seeding]'
{-r,--remove}'[remove the current torrent(s) without deleting the downloaded data]'
{-rad,--remove-and-delete}'[remove the current torrent(s) and delete the downloaded data]'
'--reannounce[reannounce the current torrent(s)]'
- '--move[move the current torrents'"'"' data from their current locations to the specified directory]:{_files -/}'
- {-sr-,--seedratio=}'[let the current torrent(s) seed until a specific ratio]:ratio:{_message "ratio in kB/sec"}'
+ "--move[move the current torrents' data from their current locations to the specified directory]:directory:_directories"
+ {-sr+,--seedratio=}'[let the current torrent(s) seed until a specific ratio]:ratio'
{-SR,--no-seedratio}'[let the current torrent(s) use the global seedratio settings]'
{-hl,--honor-session}'[make the current torrent(s) honor the session limits]'
{-HL,--no-honor-session}'[make the current torrent(s) not honor the session limits]'
@@ -97,19 +97,13 @@ local torrent_action_only_actions=(
{-Bn,--bandwidth-normal}'[give this torrent the bandwidth left over by high priority torrents]'
{-Bl,--bandwidth-low}'[give this torrent the bandwidth left over by high and normal priority torrents]'
{-ph,--priority-high}'[try to download the specified file(s) first]:torrent_file:_transmission-remote_torrent_priority_not_high'
- {-pn,--priority-normal}'[try to download the specified files normally.]:torrent_file:_transmission-remote_torrent_priority_not_normal'
+ {-pn,--priority-normal}'[try to download the specified files normally]:torrent_file:_transmission-remote_torrent_priority_not_normal'
{-pl,--priority-low}'[try to download the specified files last]:torrent_file:_transmission-remote_torrent_priority_not_low'
{-v,--verify}'[verify the current torrent(s)]'
)
# helper functions
-# complete argument specified after global only action: `--alt-speed-time-begin`
-# completes time in HHMM format
-(( $+functions[_transmission-remote_time] )) ||
-_transmission-remote_time(){
- _message "time in format HHMS"
-}
# complete argument specified after global only action: `--alt-speed-days`
# completes days in a list such as "2,4-6".
(( $+functions[_transmission-remote_days] )) ||
@@ -120,7 +114,7 @@ _transmission-remote_days(){
(( $+functions[_transmission-remote_add] )) ||
_transmission-remote_add(){
_alternative \
- 'args:torrent:_files -g ".torrent"' \
+ 'args:torrent:_files -g ".torrent(-.)"' \
'args:url:_urls'
}
# complete torrents
diff --git a/Completion/Unix/Command/_truncate b/Completion/Unix/Command/_truncate
new file mode 100644
index 000000000..117be9702
--- /dev/null
+++ b/Completion/Unix/Command/_truncate
@@ -0,0 +1,69 @@
+#compdef truncate
+
+local curcontext=$curcontext variant rs ret=1
+local -a state state_descr line specs optA
+typeset -A opt_args
+
+_pick_variant -r variant gnu=GNU $OSTYPE --version
+[[ $variant != gnu ]] && rs='-r -s' # -r/-s mutually exclusive
+
+# common specs
+specs=(
+ '(hv -c --no-create)'{-c,--no-create}'[do not create any files]'
+ "(hv $rs -r --reference)"{-r+,--reference=}'[base size on the specified file]:reference file:_files'
+ "(hv $rs -s --size)"{-s+,--size=}'[set or adjust the file size by specified bytes]:size:->size'
+ '(hv)*: :_files'
+)
+
+case $variant in
+ gnu) # GNU coreutils 8.32
+ specs+=(
+ '(hv -o --io-blocks)'{-o,--io-blocks}'[treat the specified size as number of IO blocks instead of bytes]'
+ + 'hv'
+ '(- *)--help[display help and exit]'
+ '(- *)--version[output version information and exit]'
+ )
+ ;;
+ *) # FreeBSD/DragonFly
+ specs=( ${specs:#(|*\))--*} ) # remove long options
+ optA=( -A '-*' )
+ ;;
+esac
+
+_arguments -C -s -S : $specs && ret=0
+
+case $state in
+ size)
+ local unit=bytes
+ (( ${#opt_args[(I)(-o|--io-blocks)]} )) && unit=blocks
+ local -a suffix=( K:1024 M G T )
+ local -a prefix=( '+:extend by' '-:reduce by' )
+ local prefix_char='[-+]'
+ case $variant in
+ gnu|freebsd*)
+ prefix+=( '/:round down to multiple of' '%:round up to multiple of' )
+ ;|
+ gnu)
+ suffix=( K:1024 KB:1000 {M,G,T,P,E,Z,Y}{,B} )
+ prefix+=( '<:at most' '>:at least' )
+ prefix_char='([-+/%]|\\[<>])'
+ ;;
+ freebsd*)
+ prefix_char='[-+/%]'
+ ;;
+ esac
+ local -a numbers=( _numbers -u $unit size $suffix )
+
+ if compset -P "$prefix_char"; then
+ $numbers && ret=0
+ elif (( ${#opt_args[(I)(-r|--reference)]} )); then
+ # prefix is required if the reference file is given
+ _describe -t 'prefixes' 'prefix' prefix && ret=0
+ else
+ _alternative "prefixes:prefix:((${(@q)prefix}))" \
+ "sizes: :$numbers" && ret=0
+ fi
+ ;;
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_uname b/Completion/Unix/Command/_uname
index 31af91eb7..c58f2edfd 100644
--- a/Completion/Unix/Command/_uname
+++ b/Completion/Unix/Command/_uname
@@ -62,12 +62,21 @@ else
'-v[print detailed operating system version]'
)
case $OSTYPE in
- freebsd*|dragonfly*) args+=( '-i[print kernel ident]' ) ;|
- freebsd<10->.*)
+ freebsd*|dragonfly*)
args+=(
- '-K[print FreeBSD kernel version]'
- '-U[print FreeBSD user environment version]'
+ '-i[print kernel ident]'
+ '-K[print kernel version]'
+ '-U[print user environment version]'
)
+ ;|
+ dragonfly*)
+ args+=(
+ '-P[write ABI string for dports / pkgng, including odd-to-even version-munging]'
+ '-PP[write ABI string for dports / pkgng, without version-munging]'
+ )
+ ;;
+ freebsd<13->.*)
+ args+=( "-b[print kernel's linker-generated build-id]" )
;;
solaris*)
args+=(
diff --git a/Completion/Unix/Command/_uniq b/Completion/Unix/Command/_uniq
index 97f73b3ac..e123a94cd 100644
--- a/Completion/Unix/Command/_uniq
+++ b/Completion/Unix/Command/_uniq
@@ -23,8 +23,9 @@ args=(
if ! _pick_variant gnu=Free\ Soft unix --version; then
local optchars="cdufs"
if [[ "$OSTYPE" == (darwin|dragonfly|freebsd|openbsd)* ]]; then
- optchars="${optchars}i"
+ optchars+=i
fi
+ [[ $OSTYPE = freebsd* ]] && optchars+=D
args=( ${(M)args:#(|\*)(|\(*\))-[$optchars]*} )
fi
diff --git a/Completion/Unix/Command/_unison b/Completion/Unix/Command/_unison
index 2a3333742..91fa57e5b 100644
--- a/Completion/Unix/Command/_unison
+++ b/Completion/Unix/Command/_unison
@@ -6,7 +6,7 @@ typeset -A opt_args
_arguments \
'-auto[automatically accept default (nonconflicting) actions]' \
'-batch[batch mode\: ask no questions at all]' \
- '-doc[show documentation]:topics:(about people lists status copying ack install tutorial basics failures running ssh news all topics)' \
+ '-doc[show documentation]:topic:(about people lists status copying ack install tutorial basics failures running ssh news all topics)' \
'-follow[add a pattern to the follow list]:pattern:' \
'-force[force changes from this replica to the other]:replica:' \
'-group[synchronize group attributes]' \
@@ -84,9 +84,6 @@ _arguments \
'*:profile:->profile'
if [[ $state == profile ]]; then
- local -a profiles
-
- profiles=( ~/.unison/*.prf(N) )
- (( $#profiles )) && \
- compadd "$@" - ${${profiles#~/.unison/}%.prf}
+ local -a profiles=( ${UNISON:-~/.unison}/*.prf(N:t:r) )
+ compadd "$@" -a profiles
fi
diff --git a/Completion/Unix/Command/_units b/Completion/Unix/Command/_units
index bea77ae67..6d86f4dc3 100644
--- a/Completion/Unix/Command/_units
+++ b/Completion/Unix/Command/_units
@@ -40,10 +40,12 @@ local -a testfiles
testfiles=(
/usr/share/units.dat # GNU on Fedora
/usr/share/units/units.dat # on gentoo
- /usr/share/misc/units.dat # on Debian
+ /usr/share/units/definitions.units # on Debian, units 2.00 and newer
/usr/local/share/units.dat # GNU DIY install
/usr/share/lib/unittab # Solaris
- /usr/share/misc/units.lib # BSD
+ /usr/share/misc/units.lib # OpenBSD [as of 2020]; also FreeBSD 9.1
+ /usr/share/misc/definitions.units # FreeBSD 12.1
+ /usr/share/misc/units.dat # on Debian, units 1.88 and older
)
datfile=${opt_args[-f]:-${opt_args[--file]}}
diff --git a/Completion/Unix/Command/_user_admin b/Completion/Unix/Command/_user_admin
index c7e1efc80..db1c977ad 100644
--- a/Completion/Unix/Command/_user_admin
+++ b/Completion/Unix/Command/_user_admin
@@ -54,7 +54,7 @@ case ${service%???}:${(M)service%???}:$OSTYPE in
;|
user:*:(net|open)bsd*)
args+=(
- '-L[specify login class]:login class'
+ '-L[specify login class]:login class:_login_classes'
'-p+[specify encrypted password]:encrypted password'
)
;|
diff --git a/Completion/Unix/Command/_vcsh b/Completion/Unix/Command/_vcsh
deleted file mode 100644
index 00aed7d28..000000000
--- a/Completion/Unix/Command/_vcsh
+++ /dev/null
@@ -1,89 +0,0 @@
-#compdef vcsh
-
-function __vcsh_repositories () {
- local -a repos
- repos=( ${(f)"$(_call_program repositories vcsh list)"} )
- _describe -t repositories 'repository' repos
-}
-
-function _vcsh-clone () {
- _default #TODO
-}
-
-local func
-for func in help init list list-tracked pull push version; do
- _vcsh-$func() { _nothing }
-done
-for func in delete enter list-tracked-by upgrade write-gitignore; do
- _vcsh-$func() { (( CURRENT == 2 )) && __vcsh_repositories }
-done
-
-function _vcsh-rename () {
- case $CURRENT in
- 2) __vcsh_repositories ;;
- 3) _message "new repository name" ;;
- *) _nothing ;;
- esac
-}
-
-function _vcsh-run () {
- (( CURRENT == 2 )) && __vcsh_repositories
- if (( CURRENT >= 3 )); then
- words=( "${(@)words[3,-1]}" )
- (( CURRENT -= 2 ))
- _complete
- fi
-}
-
-function _vcsh () {
- local curcontext="${curcontext}" ret=1
- local state vcshcommand
- local -a args subcommands
-
- subcommands=(
- "clone:clone an existing repository"
- "delete:delete an existing repository"
- "enter:enter repository; spawn new <\$SHELL>"
- "help:display help"
- "init:initialize an empty repository"
- "list:list all local vcsh repositories"
- "list-tracked:list all files tracked by vcsh"
- "list-tracked-by:list files tracked by a repository"
- "pull:pull from all vcsh remotes"
- "rename:rename a repository"
- "run:run command with <\$GIT_DIR> and <\$GIT_WORK_TREE> set"
- "upgrade:upgrade repository to currently recommended settings"
- "version:print version information"
- "which:find <substring> in name of any tracked file"
- "write-gitignore:write .gitignore.d/<repo> via git ls-files"
- )
-
- args=(
- '-c[source <file> prior to other configuration files]:config files:_path_files'
- '-d[enable debug mode]'
- '-v[enable verbose mode]'
- '*:: :->subcommand_or_options_or_repo'
- )
-
- _arguments -C ${args} && ret=0
-
- if [[ ${state} == "subcommand_or_options_or_repo" ]]; then
- if (( CURRENT == 1 )); then
- _describe -t subcommands 'vcsh sub-commands' subcommands && ret=0
- __vcsh_repositories && ret=0
- else
- vcshcommand="${words[1]}"
- if ! (( ${+functions[_vcsh-$vcshcommand]} )); then
- # There is no handler function, so this is probably the name
- # of a repository. Act accordingly.
- _dispatch git git && ret=0
- else
- curcontext="${curcontext%:*:*}:vcsh-${vcshcommand}:"
- _call_function ret _vcsh-${vcshcommand}
- fi
- fi
- fi
- return ret
-}
-
-_vcsh "$@"
diff --git a/Completion/Unix/Command/_vi b/Completion/Unix/Command/_vi
new file mode 100644
index 000000000..6201299a2
--- /dev/null
+++ b/Completion/Unix/Command/_vi
@@ -0,0 +1,47 @@
+#compdef ex vi view
+
+local -a args
+
+if _pick_variant vim='(N|)VIM' vi --version; then
+ _vim
+ return
+fi
+
+args=(
+ '-c+[execute command on the first file loaded]:command:'
+ '-r[recover the named files]'
+ '-t+[start editing at the specified tag]:tag:'
+ '-w+[set window size to specified number of lines]:lines:'
+ '*: :_files'
+)
+
+[[ $service != view ]] && args+=(
+ '-R[set readonly]'
+)
+
+[[ $service == ex ]] && args+=(
+ '-s[enter batch mode]'
+ '-v[start in vi mode]'
+)
+
+case $OSTYPE in
+ *bsd*|dragonfly*)
+ args+=(
+ "-F[don't copy the entire file on start]"
+ '-S[set the secure option]'
+ )
+ [[ $service != ex ]] && args+=(
+ '-e[start in ex mode]'
+ )
+ ;|
+ netbsd*)
+ args+=(
+ '-G[start in gtags mode]'
+ )
+ [[ $service == vi ]] && args+=(
+ '-l[set the lisp and showmatch options]'
+ )
+ ;;
+esac
+
+_arguments -s -S -A '-*' : $args
diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim
index d9dc1a5b3..5c6054e70 100644
--- a/Completion/Unix/Command/_vim
+++ b/Completion/Unix/Command/_vim
@@ -27,9 +27,8 @@ arguments=(
'-D[debugging mode]'
'-n[no swap file (memory only)]'
{-r,-L}'[list swap files and exit or recover from a swap file]::swap file:_vim_files -g "*.sw?(-.)"'
- '( -H -F)-A[start in Arabic mode]'
- '(-A -F)-H[start in Hebrew mode]'
- '(-A -H )-F[start in Farsi mode]'
+ '(-H)-A[start in Arabic mode]'
+ '(-A)-H[start in Hebrew mode]'
'-u[use given vimrc file instead of default .vimrc]:config:->config'
"--noplugin[don't load plugin scripts]"
'-o-[number of windows to open (default: one for each file)]::window count: '
@@ -99,8 +98,11 @@ fi
[[ $service != *view ]] && arguments+='-R[readonly mode]'
[[ $service = *g* ]] || (( ${words[(I)-g]} )) && arguments+=(
'(--nofork -f)'{--nofork,-f}'[do not detach the GUI version from the shell]'
+ '(-background -bg)'{-background,-bg}'[use specified color for the background]:color:_x_color'
+ '(-foreground -fg)'{-foreground,-fg}'[use specified color for normal text]:color:_x_color'
'-font:font:_xft_fonts'
'-geometry:geometry:_x_geometry'
+ '-iconic[start vim iconified]'
'(-rv -reverse)'{-rv,-reverse}'[use reverse video]'
'-display:display:_x_display'
'--role[set unique role to identify main window]:role'
diff --git a/Completion/Unix/Command/_vmstat b/Completion/Unix/Command/_vmstat
index f3ac1af14..e05bc88bc 100644
--- a/Completion/Unix/Command/_vmstat
+++ b/Completion/Unix/Command/_vmstat
@@ -8,6 +8,7 @@ case $OSTYPE in
'(-t --timestamp)'{-t,--timestamp}'[show timestamp]'
'(-n --one-header)'{-n,--one-header}'[do not redisplay header]'
'(-S --unit)'{-S+,--unit=}'[specify unit for displayed sizes]:unit prefix [K]:((k\:1000 K\:1024 m\:1000000 M\:1048576))'
+ '(-C --full-cache)'{-C,--full-cache}'[add further cache lines to main cache]'
'1: :_guard "[0-9]#" "interval (seconds)"' '2:count'
+ '(action)' \
'(- :)'{-h,--help}'[display help information]'
diff --git a/Completion/Unix/Command/_w b/Completion/Unix/Command/_w
index 8fb4154c7..69751c5e5 100644
--- a/Completion/Unix/Command/_w
+++ b/Completion/Unix/Command/_w
@@ -11,6 +11,7 @@ case $OSTYPE in
'(H -o --old-style -s --short)'{-o,--old-style}'[old style output format]'
'(H -s --short -o --old-style)'{-s,--short}'[use short output format]'
'(H -u --no-current)'{-u,--no-current}'[ignore the username while figuring out the current process and cpu times]'
+ '(H -n --no-truncat)'{-n,--no-truncat}'[non-truncated listing (large)]'
+ H
'(-)--help[display help information]'
'(-)'{-V,--version}'[display version information]'
diff --git a/Completion/Unix/Command/_w3m b/Completion/Unix/Command/_w3m
index 6e83a6781..de425cfb1 100644
--- a/Completion/Unix/Command/_w3m
+++ b/Completion/Unix/Command/_w3m
@@ -1,14 +1,12 @@
#compdef w3m
-# w3m version w3m/0.5.1
-
local curcontext="$curcontext" state line expl ret=1
typeset -A opt_args
_arguments -C \
'-t[set tab width]:tab width:' \
'-r[ignore backspace effect]' \
- '-l[specify number of preserved lines]:number of lines (default 10000):' \
+ '-l[specify number of preserved lines]:number of lines [10000]' \
'-I[document charset]:charset:->charset' \
'-O[display/output charset]:charset:->charset' \
'( -s -j)-e[EUC-JP]' \
@@ -21,7 +19,7 @@ _arguments -C \
'(-B *)-v[visual startup mode]' \
'-M[monochrome display]' \
'-N[open URL of command line on each new tab]' \
- '-F[automatically render frame]' \
+ '-F[automatically render frames]' \
'-cols[specify column width (used with -dump)]:column width' \
'-ppc[specify the number of pixels per character (4.0...32.0)]:number of pixels (4.0...32.0):' \
'-ppl[specify the number of pixels per line (4.0...64.0)]:number of pixels (4.0...64.0):' \
@@ -34,17 +32,17 @@ _arguments -C \
'-header[insert string as a header]:header:' \
'+-[goto specified line]:line number:_guard "[0-9]#" "line number"' \
'-num[show line number]' \
+ '-session[use specified session]:id' \
"-no-proxy[don't use proxy]" \
'(-6)-4[IPv4 only (-o dns_order=4)]' \
'(-4)-6[IPv6 only (-o dns_order=6)]' \
"-no-mouse[don't use mouse]" \
'(-no-cookie)-cookie[use cookie]' \
"(-cookie)-no-cookie[don't use cookie]" \
- '-pauth[proxy authentication]:user\:pass:->pauth' \
- '(-no-graph)-graph[use graphic character]' \
- "(-graph)-no-graph[don't use graphic character]" \
+ '(-no-graph)-graph[use DEC special graphics for border of table and menu]' \
+ '(-graph)-no-graph[use ASCII character for border of table and menu]' \
'-S[squeeze multiple blank lines]' \
- '-W[toggle wrap search mode]' \
+ '-W[toggle search wrap mode]' \
"-X[don't use termcap init/deinit]" \
'-title=[set buffer name to terminal title string]:terminal:_terminals' \
'*-o[assign value to config option]:option=value:->option' \
@@ -84,7 +82,7 @@ case "$state" in
_alternative \
'files:file:_files -g "*.x#html(-.)"' \
'urls:URL:_urls' \
- 'bookmarks:bookmarks:compadd -a bookmarks' \
+ 'bookmarks:bookmark:compadd -a bookmarks' \
'history:history:compadd -a w3mhistory' && ret=0
;;
option)
@@ -97,14 +95,6 @@ case "$state" in
_describe -t options 'option' options "$suf[@]" && ret=0
fi
;;
- pauth)
- if compset -P 1 '*:'; then
- _message -e passwords 'password'
- else
- compset -S ':*' || suf=( -S ':' )
- _users "$suf[@]" && ret=0
- fi
- ;;
esac
return ret
diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget
index 49c8e8b01..50fd7791a 100644
--- a/Completion/Unix/Command/_wget
+++ b/Completion/Unix/Command/_wget
@@ -34,6 +34,8 @@ _arguments -C -s \
'(--server-response -S)'{--server-response,-S}'[print server response]' \
"--spider[don't download anything]" \
'(--timeout -T)'{--timeout=,-T+}'[set all timeout values]:timeout (seconds)' \
+ '--dns-servers=[specify DNS servers to query]:DNS server:_sequence _hosts' \
+ '--bind-dns-address=[bind DNS resolver to specified address]:hostname or IP on local host' \
'(--timeout -T)--dns-timeout=[set the DNS lookup timeout]:DNS lookup timeout (seconds)' \
'(--timeout -T)--connect-timeout=[set the connect timeout]:connect timeout (seconds)' \
'(--timeout -T)--read-timeout=[set the read timeout]:read timeout (seconds)' \
@@ -107,7 +109,7 @@ _arguments -C -s \
"--ca-directory=[specify dir where hash list of CA's are stored]:directory:_directories" \
'--crl-file=[specify file with bundle of CRLs]:file:_files' \
'--pinnedpubkey=:file:_files' \
- '!--random-file=:file:_files' \
+ '--random-file[specify file with random data for seeding generator]:file:_files' \
'--egd-file=[specify filename of EGD socket]:file:_files' \
'--ciphers=[set the priority string (GnuTLS) or cipher list string (OpenSSL) directly]:string' \
'--no-hsts[disable HSTS]' \
@@ -137,7 +139,7 @@ _arguments -C -s \
'(--reject -R)'{--reject=,-R+}'[specify rejected extensions]:extensions' \
--{accept,reject}-regex=:regex '--regex-type=:regex type:(posix pcre)' \
'(--domains -D)'{--domains=,-D+}'[specify accepted domains]:domains:_domains' \
- '--exclude-domains=:rejected domains:_domains' \
+ '--exclude-domains=:rejected domain:_sequence _domains' \
'--follow-ftp' \
'--follow-tags=:HTML tags:' \
'--ignore-tags=[specify ignored HTML tags]:HTML tags' \
diff --git a/Completion/Unix/Command/_wiggle b/Completion/Unix/Command/_wiggle
index 0a2f0c0cb..1d747a479 100644
--- a/Completion/Unix/Command/_wiggle
+++ b/Completion/Unix/Command/_wiggle
@@ -1,15 +1,17 @@
#compdef wiggle
-local fns='-m --merge -d --diff -x --extract'
+local fns='-m --merge -d --diff -x --extract -B --browse'
_arguments \
"($fns -1 -2 -3)"{-m,--merge}'[select the merge function]' \
"($fns -3 3)"{-d,--diff}'[display differences between files]' \
"($fns 2 3)"{-x,--extract}'[extract one branch of a patch or merge file]' \
'(-w --words -l --lines)'{-w,--words}'[make operations and display word based]' \
- '(-l --lines -w --words)'{-l,--lines}'[make operations and display line based]' \
+ '(-l --lines -w --words --non-space)'{-l,--lines}'[make operations and display line based]' \
+ '(-l --lines)--non-space[words are separated by spaces]' \
'(-p --patch)'{-p,--patch}'[treat last named file as a patch]' \
'(-r --replace)'{-r,--replace}'[replace original file with merged output]' \
+ '--no-backup[never save original file (as name.porig)]' \
'(-R --reverse -x --extract)'{-R,--reverse}'[swap the files or revert changes]' \
'(-2 -3 -m --merge)-1[select branch]' \
'(-1 -3 -m --merge)-2[select branch]' \
diff --git a/Completion/Unix/Command/_xargs b/Completion/Unix/Command/_xargs
index f21784ef1..8e23a04bb 100644
--- a/Completion/Unix/Command/_xargs
+++ b/Completion/Unix/Command/_xargs
@@ -25,7 +25,7 @@ case $variant in
'-R[specify maximum arguments that -I will replace in]:replacements'
)
;|
- freebsd*|netbsd*)
+ freebsd*|netbsd*|dragonfly*)
args+=(
'-S[space that -I can use for replacements]:size (bytes) [255]'
)
diff --git a/Completion/Unix/Command/_xmlsoft b/Completion/Unix/Command/_xmlsoft
index 487974fdb..08b123e54 100644
--- a/Completion/Unix/Command/_xmlsoft
+++ b/Completion/Unix/Command/_xmlsoft
@@ -45,7 +45,7 @@ case $service in
'--encoding[the input document character encoding]:encoding:(${encoding[@]})' \
'*--param[pass a parameter,value pair]:name::value (xpath expression)' \
'*--stringparam[pass a parameter]:name::value' \
- '--path[provide a set of paths for resources]:paths:_files -/' \
+ '--path[provide a set of paths for resources]:path:_dir_list' \
'--nonet[refuse to fetch DTDs or entities over network]' \
'--nowrite[refuse to write to any file or resource]' \
'--nomkdir[refuse to create directories]' \
@@ -70,7 +70,7 @@ case $service in
'--noent[substitute entity references by their value]' \
'--noenc[ignore any encoding specified inside the document]' \
"(--output -o)--noout[don't output the result tree]" \
- '--path[provide a set of paths for resources]:paths:_files -/' \
+ '--path[provide a set of paths for resources]:path:_dir_list' \
'--load-trace[print trace of all external entities loaded]' \
'--nonet[refuse to fetch DTDs or entities over network]' \
'--nocompact[do not generate compact text nodes]' \
@@ -80,6 +80,7 @@ case $service in
'(--dtdvalid --relaxng --schema)--postvalid[do a posteriori validation, i.e after parsing]' \
'(--postvalid --relaxng --schema --dtdvalidfpi)--dtdvalid[do a posteriori validation against a given DTD]:DTD:_webbrowser' \
'(--postvalid --relaxng --schema --dtdvalid)--dtdvalidfpi[as --dtdvalid but specify DTD with public identifier]:DTD identifier' \
+ '--quiet[be quiet when successful]' \
'--timing[print some timings]' \
'(--noout --output -o)'{--output,-o}'[save to a given file]:output file:_files' \
'--repeat[repeat 100 times, for timing or profiling]' \
@@ -98,7 +99,7 @@ case $service in
'--format[reformat/reindent the input]' \
'--encode[output in the given encoding]:encoding:(${encoding[@]})' \
'--dropdtd[remove the DOCTYPE of the input docs]' \
- "--pretty[pretty-print in a particular style]:style:((0\:don't\ pretty\ print 1\:reformat 2\:add\ whitespace))" \
+ "--pretty[pretty-print in a particular style]:style:((0\:don\'t\ pretty\ print 1\:reformat 2\:add\ whitespace))" \
'--c14n[save in W3C canonical format]' \
'--c14n11[save in W3C canonical format v1.1 (with comments)]' \
'--exc-c14n[save in W3C exclusive canonical format]' \
diff --git a/Completion/Unix/Command/_xmms2 b/Completion/Unix/Command/_xmms2
index 525d5177c..ca2383b2f 100644
--- a/Completion/Unix/Command/_xmms2
+++ b/Completion/Unix/Command/_xmms2
@@ -43,7 +43,7 @@ _xmms2_command() {
)
if (( CURRENT == 1 )); then
- _describe -t command "xmms2 commands" xmms2_cmds
+ _describe -t command "xmms2 command" xmms2_cmds
else
local curcontext="$curcontext"
fi
@@ -63,7 +63,7 @@ _xmms2_command() {
fi
done
- _values -s ' ' 'playlist items' ${(On)playlistitems}
+ _values -s ' ' 'playlist item' ${(On)playlistitems}
}
@@ -84,7 +84,7 @@ _xmms2_mlib() {
)
if (( CURRENT == 2 )); then
- _describe -t command "xmms2 mlib commands" mlib_cmds
+ _describe -t command "xmms2 mlib command" mlib_cmds
else
local curcontext="$curcontext"
fi
@@ -107,7 +107,7 @@ _xmms2_playlist() {
remove:"Remove a playlist"
)
if (( CURRENT == 2 )); then
- _describe -t command "xmms2 playlist commands" playlist_cmds
+ _describe -t command "xmms2 playlist command" playlist_cmds
else
local curcontext="$curcontext"
fi
@@ -121,14 +121,14 @@ _xmms2_playlist() {
_xmms2_playlist_load() {
local list
list=($(xmms2 playlist list))
- _describe -t command "xmms2 playlists" list
+ _describe -t command "xmms2 playlist" list
}
_xmms2_playlist_remove() {
local list
list=($(xmms2 playlist list))
- _describe -t command "xmms2 playlists" list
+ _describe -t command "xmms2 playlist" list
}
@@ -146,7 +146,7 @@ _xmms2_coll() {
attr:"Get/set an attribute for a saved collection"
)
if (( CURRENT == 2 )); then
- _describe -t command "xmms2 collection commands" coll_cmds
+ _describe -t command "xmms2 collection command" coll_cmds
else
local curcontext="$curcontext"
fi
@@ -160,7 +160,7 @@ _xmms2_coll() {
_xmms2_coll_helper() {
local list
list=($(xmms2 coll list))
- _describe -t command "xmms2 playlists" list
+ _describe -t command "xmms2 playlist" list
}
_xmms2_coll_rename() {
diff --git a/Completion/Unix/Command/_xxd b/Completion/Unix/Command/_xxd
index 3a8efd664..31d26ab64 100644
--- a/Completion/Unix/Command/_xxd
+++ b/Completion/Unix/Command/_xxd
@@ -39,6 +39,7 @@ arguments=(
{-g+,-groupsize}'[specify the number of octets per group]: :_guard "[0-9]#" "number of octets per group"'
{-l+,-len}'[specify number of octets to output]: :_guard "[0-9]#" "number of octets to output"'
{-o+,-offset}'[add specified offset to displayed file position]:offset'
+ '-d[show offset in decimal instead of hex]'
{-s,-skip,-seek}'[specify file offset to dump from]: :_guard "[0-9]#" "file offset to dump from (absolute or relative)"'
': :_files'
diff --git a/Completion/Unix/Command/_yafc b/Completion/Unix/Command/_yafc
index 1e0a601a1..946c0b4ce 100644
--- a/Completion/Unix/Command/_yafc
+++ b/Completion/Unix/Command/_yafc
@@ -32,7 +32,7 @@ _yafc_bookmarks() {
if [[ -f $bkmfile ]]; then
local -a bkms expl
bkms=(${${${(M)"${(f)$(<$bkmfile)}":#machine*alias ##\'*\' #}##machine*alias ##\'}%%\' #}) #" vim syntax goes crazy
- _wanted bookmarks expl 'bookmarks' compadd "$@" -a - bkms
+ _wanted bookmarks expl 'bookmark' compadd "$@" -a - bkms
fi
}
diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs
index 814358bc7..be4a64b33 100644
--- a/Completion/Unix/Command/_zfs
+++ b/Completion/Unix/Command/_zfs
@@ -1,553 +1,1350 @@
-#compdef zfs
-# Synced with the S11U1 man page
-
-_zfs() {
- local context state line expl implementation
- typeset -A opt_args
- local -a subcmds rw_properties rw_propnames ro_properties create_properties
- local -a share_nfs_ro_properties share_nfs_rw_properties
- local -a share_smb_ro_properties share_smb_rw_properties
- local -a share_ro_properties share_rw_properties
- local -a difffields delegatable_perms
-
- _pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris
-
- subcmds=(
- "create" "destroy" "clone" "promote" "rename" "snapshot"
- "rollback" "list" "set" "get" "inherit" "mount" "unmount"
- "share" "unshare" "send" "receive" "allow" "unallow"
- "upgrade" "userspace" "groupspace" "hold" "holds" "release"
- "diff" "key" "help"
- )
-
- [[ $OSTYPE == freebsd<7->.* ]] && subcmds+=(jail unjail)
-
- share_nfs_ro_properties=(
- "share.nfs.all"
- )
-
- share_nfs_rw_properties=(
- "share.nfs:value:(on off)"
- "share.nfs.aclok:value:(on off)"
- "share.nfs.acflfab:value:(on off)"
- "share.nfs.anon:uid:"
- "share.nfs.charset.euc-cn:access-list:"
- "share.nfs.charset.euc-jpms:access-list:"
- "share.nfs.charset.euc-kr:access-list:"
- "share.nfs.charset.euc-tw:access-list:"
- "share.nfs.charset.iso8859-1:access-list:"
- "share.nfs.charset.iso8859-2:access-list:"
- "share.nfs.charset.iso8859-5:access-list:"
- "share.nfs.charset.iso8859-6:access-list:"
- "share.nfs.charset.iso8859-7:access-list:"
- "share.nfs.charset.iso8859-8:access-list:"
- "share.nfs.charset.iso8859-9:access-list:"
- "share.nfs.charset.iso8859-13:access-list:"
- "share.nfs.charset.iso8859-15:access-list:"
- "share.nfs.charset.koi8-r:access-list:"
- "share.nfs.index:file:_files"
- "share.nfs.log:nfslog.conf tag:"
- "share.nfs.nosub:value:(on off)"
- "share.nfs.nosuid:value:(on off)"
- "share.nfs.public:value:(on off)"
- "share.nfs.sec:security-mode-list:"
- "share.nfs.sec.default.none:access-list:"
- "share.nfs.sec.default.ro:access-list:"
- "share.nfs.sec.default.root:access-list:"
- "share.nfs.sec.default.root_mapping:uid:"
- "share.nfs.sec.default.rw:access-list:"
- "share.nfs.sec.default.window:seconds"
- "share.nfs.sec.dh.none:access-list:"
- "share.nfs.sec.dh.ro:access-list:"
- "share.nfs.sec.dh.root:access-list:"
- "share.nfs.sec.dh.root_mapping:uid:"
- "share.nfs.sec.dh.rw:access-list:"
- "share.nfs.sec.dh.window:seconds"
- "share.nfs.sec.krb5.none:access-list:"
- "share.nfs.sec.krb5.ro:access-list:"
- "share.nfs.sec.krb5.root:access-list:"
- "share.nfs.sec.krb5.root_mapping:uid:"
- "share.nfs.sec.krb5.rw:access-list:"
- "share.nfs.sec.krb5.window:seconds"
- "share.nfs.sec.krb5i.none:access-list:"
- "share.nfs.sec.krb5i.ro:access-list:"
- "share.nfs.sec.krb5i.root:access-list:"
- "share.nfs.sec.krb5i.root_mapping:uid:"
- "share.nfs.sec.krb5i.rw:access-list:"
- "share.nfs.sec.krb5i.window:seconds"
- "share.nfs.sec.krb5p.none:access-list:"
- "share.nfs.sec.krb5p.ro:access-list:"
- "share.nfs.sec.krb5p.root:access-list:"
- "share.nfs.sec.krb5p.root_mapping:uid:"
- "share.nfs.sec.krb5p.rw:access-list:"
- "share.nfs.sec.krb5p.window:seconds"
- "share.nfs.sec.none.none:access-list:"
- "share.nfs.sec.none.ro:access-list:"
- "share.nfs.sec.none.root:access-list:"
- "share.nfs.sec.none.root_mapping:uid:"
- "share.nfs.sec.none.rw:access-list:"
- "share.nfs.sec.none.window:seconds"
- "share.nfs.sec.sys.none:access-list:"
- "share.nfs.sec.sys.ro:access-list:"
- "share.nfs.sec.sys.root:access-list:"
- "share.nfs.sec.sys.root_mapping:uid:"
- "share.nfs.sec.sys.rw:access-list:"
- "share.nfs.sec.sys.window:seconds"
- )
-
- share_smb_ro_properties=(
- "share.smb.all"
- )
-
- share_smb_rw_properties=(
- "share.smb:value:(on off)"
- "share.smb.ad-container"
- "share.smb.abe"
- "share.smb.csc:value:(disabled manual auto vdo)"
- "share.smb.catia:value:(on off)"
- "share.smb.dfsroot:value:(on off)"
- "share.smb.guestok:value:(on off)"
- "share.smb.ro:access-list:"
- "share.smb.rw:access-list:"
- "share.smb.none:access-list:"
- )
-
- share_ro_properties=(
- "share.all"
- "share.fs"
- "share.name"
- "share.point"
- "share.protocols"
- "share.state"
- $share_nfs_ro_properties
- $share_smb_ro_properties
- )
-
- share_rw_properties=(
- "share.desc:description:"
- "share.noauto:value:(on off)"
- "share.path:path:"
- $share_nfs_rw_properties
- $share_smb_rw_properties
- )
-
- # TODO: userused@ and groupused@ could have more extensive handling
- ro_properties=(
- "name" "type" "creation" "used" "available" "referenced"
- "compressratio" "mounted" "origin" "usedbychildren"
- "usedbydataset" "usedbyrefreservation" "usedbysnapshots"
- "defer_destroy" "userused@" "userrefs" "groupused@"
- "keychangedate" "keystatus" "rekeydate"
- $share_ro_properties
- )
-
- # TODO: Be cleverer about what values can be set. Is there any way to
- # set the sorting for *size properties to false by default?
- rw_properties=(
- "aclinherit:value:(discard noallow restricted passthrough passthrough-x)"
- "atime:value:(on off)"
- "canmount:value:(on off noauto)"
- "checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)"
- "compression:value:(on off lzjb lz4 gzip gzip-{1..9} zle)"
- "copies:value:(1 2 3)"
- "dedup:value:(on off verify sha256 sha256,verify)"
- "devices:value:(on off)"
- "encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)"
- "exec:value:(on off)"
- "groupquota@:value:" # TODO: complete group=size|none
- "keysource:value:_zfs_keysource_props"
- "logbias:value:(latency throughput)"
- "mlslabel:value:(none)" # TODO: list sensitivity labels
- "mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}"
- "multilevel:value:(on off)"
- "nbmand:value:(on off)"
- "primarycache:value:(all none metadata)"
- "quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}"
- "readonly:value:(on off)"
- "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
- "refquota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refquota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refquota' compadd none; fi}"
- "refreservation:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refreservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refreservation' compadd none; fi}"
- "reservation:value:{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == reservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'reservation' compadd none; fi}"
- "rstchown:value:(on off)"
- "secondarycache:value:(all none metadata)"
- "setuid:value:(on off)"
- "shadow:value:" # TODO: complete URI|none
- "share:share properties:"
- "snapdir:value:(hidden visible)"
- "sync:value:(standard always disabled)"
- "userquota@:value:" # TODO: complete user=size|none
- "version:value:(1 2 3 4 current)"
- "volsize:value:" # <size>
- "vscan:value:(on off)"
- "xattr:value:(on off)"
- "zoned:value:(on off)"
- $share_rw_properties
- )
-
- if [[ "$OSTYPE" == "linux-gnu" ]]; then
- rw_properties+=("acltype:value:(off noacl posixacl)")
- elif [[ "$implementation" == "solaris" ]]; then
- rw_properties+=("aclmode:value:(discard mask passthrough)")
- else
- rw_properties+=("aclmode:value:(discard groupmask passthrough restricted)")
- fi
-
-
- create_properties=(
- $rw_properties
- "casesensitivity:value:(sensitive insensitive mixed)"
- "normalization:value:(none formC formD formKC formKD)"
- "utf8only:value:(on off)"
- "volblocksize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
- )
-
- delegatable_perms=(
- "allow" "clone" "create" "destroy" "diff" "hold" "key"
- "keychange" "mount" "promote" "receive" "release" "rename"
- "rollback" "send" "share" "snapshot"
- "groupused" "userused" "userprop"
- ${create_properties%%:*}
- )
-
- rw_propnames=( ${rw_properties%%:*} )
-
- difffields=(
- object parent size links linkschange name oldname user group
- ctime mtime atime crtime
- )
-
- if [[ $service == "zfs" ]]; then
- _arguments -C -A "-*" \
- '-\?[Help]' \
- '*::command:->subcmd' && return 0
-
- if (( CURRENT == 1 )); then
- _wanted commands expl "zfs subcommand" compadd -a subcmds
- return
- fi
- service="$words[1]"
- curcontext="${curcontext%:*}=$service:"
- fi
-
- case $service in
- ("create")
- _arguments -A "-*" \
- '-p[Create parent datasets]' \
- '*-o[Set initial properties]:property:_values -s , "property" $create_properties' \
- - set1 \
- ':filesystem:_zfs_dataset -t fs -e "parent dataset"' \
- - set2 \
- '-s[Create sparse volume]' \
- '-b[Set volblocksize]:blocksize:' \
- '-V[Set size]:size:' \
- ':volume:_zfs_dataset -t fs -e "parent dataset"'
- ;;
-
- ("destroy")
- _arguments -A "-*" \
- '-r[Recursively destroy all children]' \
- '-R[Recursively destroy all dependents]' \
- - set1 \
- '-d[delete or mark deferred]' \
- ':snapshot:_zfs_dataset -t snap' \
- - set2 \
- '-f[Force unmounts]' \
- ':filesystem/volume/snapshot:_zfs_dataset -t fs -t vol'
- ;;
-
- (snap(|shot))
- _arguments -A "-*" \
- '-r[Recursively snapshot all descendant datasets]' \
- '*-o[Set property]:property:_values -s , "property" $create_properties' \
- ':filesystem/volume:_zfs_dataset -t fs -t vol -S@'
- ;;
-
- ("rollback")
- _arguments -A "-*" \
- '-r[Recursively destroy more recent snapshots]' \
- '-R[Recursively destroy more recent snapshots and clones]' \
- '-f[Force unmounts]' \
- ':snapshot:_zfs_dataset -t snap'
- ;;
-
- ("clone")
- # XXX needs to bail if there are no snapshots
- _arguments -A "-*" \
- '-p[Create parent datasets]' \
- '-K[Create encryption key]' \
- '*-o[Set property]:property:_values -s , "property" $create_properties' \
- ':snapshot:_zfs_dataset -t snap' \
- ':filesystem/volume:_zfs_dataset -t fs -e "parent dataset"'
- ;;
-
- ("promote")
- _arguments \
- ':filesystem:_zfs_dataset -t clone' \
- ;;
-
- ("rename")
- _arguments -A "-*" \
- '(-r)-p[Create parent datasets]' \
- '(-p)-r[Recursively rename snapshots of all descendent datasets]' \
- ':dataset:_zfs_dataset -r1' \
- ':dataset:_zfs_dataset -r2'
- ;;
-
- ("list")
- _arguments -A "-*" \
- '-r[Recursively display children]' \
- '-H[Scripting mode]' \
- '-d[Depth]:value:' \
- '-o[Properties to list]:property:_values -s , "property" $ro_properties $rw_propnames' \
- '*-s[Sort key (ascending)]:property:_values "property" $ro_properties $rw_propnames' \
- '*-S[Sort key (descending)]:property:_values "property" $ro_properties $rw_propnames' \
- '-t[Dataset types to list]:dataset type:_values -s , "dataset type" all filesystem snapshot volume' \
- '*:filesystem/volume/snapshot/path:_zfs_dataset -p'
- ;;
-
- ("set")
- _arguments \
- '-r[Recursively apply value]' \
- ':property:_values -s , "property" $rw_properties' \
- '*:filesystem/volume:_zfs_dataset -t fs -t vol'
- ;;
-
- ("get")
- _arguments -A "-*" \
- "-r[Recursively display children's properties]" \
- '-d[Depth]:value:' \
- '-H[Scripting mode]' \
- '-p[Display numbers exactly]' \
- '-s[Specify sources]:source:_values -s , "source" local default inherited temporary none' \
- '-o[Specify fields]:field:_values -s , "field" name property value source' \
- ':property:_values -s , "property" $ro_properties $rw_propnames all' \
- '*:filesystem/volume/snapshot:_zfs_dataset'
- ;;
-
- ("inherit")
- _arguments -A "-*" \
- '-r[Recursively inherit property for all children]' \
- '-S[Revert to received property value]' \
- ':property:_values -s , "property" $ro_properties $rw_properties' \
- '*:filesystem/volume:_zfs_dataset -t fs -t vol'
- ;;
-
- ("userspace"|"groupspace")
- _arguments -A "-*" \
- '-n[Print numeric ID]' \
- '-i[Translate SID to POSIX ID]' \
- '-H[Tab-delimited output with no headers]' \
- '-p[Parseable mode]' \
- '-o[Properties to list]:property:_values -s , "property" type name used quota' \
- '*-s[Sort key (ascending)]:property:_values "property" type name used quota' \
- '*-S[Sort key (descending)]:property:_values "property" type name used quota' \
- '-t[Types to list]:type:_values -s , "type" all posixuser smbuser posixgroup smbgroup' \
- '*:filesystem/volume/snapshot:_zfs_dataset'
- ;;
-
- ("mount")
- _arguments -A "-*" \
- '-o[Mount options]:mount options:_values -s , "option" {,no}{devices,exec,setuid} ro rw' \
- '-O[Overlay mount]' \
- '-v[Report mount progress]' \
- - set1 \
- ':filesystem:_zfs_dataset -t fs' \
- - set2 \
- '-a[Mount all available ZFS filesystems]'
- ;;
-
- ("unmount")
- _arguments -A "-*" \
- - set1 \
- '-f[Force unmount]' \
- ':filesystem:_zfs_dataset -t fs -t mtpt' \
- - set2 \
- '-a[Unmount all ZFS filesystems]'
- ;;
-
- ("share")
- _arguments -A "-*" \
- - set1 \
- '-a[Share all available ZFS filesystems]' \
- - set2 \
- '-r[Share filesystems recursively]' \
- ':filesystem:_zfs_dataset -t fs' \
- - set3 \
- '*-o[Create a share with these properties]:property:_values -w "share properties" $share_rw_properties' \
- '-u[Create a share without sharing it]' \
- ':filesystem:_zfs_dataset -t fs' \
- - set4 \
- ':filesystem:_zfs_dataset -t fs -t mtpt -t share'
- ;;
-
- ("unshare")
- _arguments -A "-*" \
- - set1 \
- '-a[Unshare all shared ZFS filesystems]' \
- - set2 \
- '-r[Unshare filesystems recursively]' \
- ':filesystem:_zfs_dataset -t fs' \
- - set3 \
- ':filesystem:_zfs_dataset -t fs -t mtpt -t share'
- ;;
-
- ("send")
- _arguments -A "-*" \
- '-b' \
- '-i[Generate an incremental stream]:snapshot:_zfs_dataset -t snap' \
- '-D[Perform dedup processing]' \
- '-p[Send properties]' \
- '-v[Verbose]' \
- - set1 \
- '-I[Generate an incremental stream with intermediary snapshots]:snapshot:_zfs_dataset -t snap' \
- '-R[Generate a replication stream package]' \
- ':snapshot:_zfs_dataset -t snap' \
- - set2 \
- '-c[Create a self-contained stream]' \
- '-r[Generate a recursive stream package]' \
- ':snapshot:_zfs_dataset -t snap'
- ;;
-
- ("receive")
- _arguments -A "-*" \
- '-v[Verbose]' \
- '-n[Do not receive the stream]' \
- '-F[Force a rollback if necessary]' \
- '-u[Filesystem is not mounted]' \
- '-o[Include property change in the stream]::' \
- '-x[Exclude property change from the stream]:property:' \
- - set1 \
- ':filesystem/volume/snapshot:_zfs_dataset' \
- - set2 \
- '(-e)-d[Set path prefix from stream, excluding only pool name]' \
- '(-d)-e[Set path prefix from stream, using last path element]' \
- '-:filesystem:_zfs_dataset -t fs'
- ;;
-
- ("allow")
- _arguments -A "-*" \
- '(1 -g -e -c -s)-u[delegate to user]:user:_users' \
- '(1 -u -e -c -s)-g[delegate to group]:group:_groups' \
- '(1 -g -u -c -s)-e[delegate to everyone]' \
- '(1 -u -g -e -l -d -s)-c[set permissions for newly-created descendant filesystems]' \
- '(1 -u -g -e -l -d -c)-s[define or modify permission sets]:permission set' \
- '(1 -c -s)-l[allow for named dataset]' \
- '(1 -c -s)-d[allow for descendent datasets]' \
- '1::filesystem/volume:_zfs_dataset -t fs -t vol' \
- ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
- ':filesystem/volume:_zfs_dataset -t fs -t vol' \
- ;;
-
- ("unallow")
- _arguments -A "-*" \
- '-r[Recursive removal]' \
- - set1 \
- '-s[Remove permissions from or delete a permission set]:permission set:' \
- ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
- ':filesystem/volume:_zfs_dataset -t fs -t vol' \
- - set2 \
- '(-g)-u[User]:user:_users' \
- '(-u)-g[Group]:group:_groups' \
- '-l[Allow for named dataset]' \
- '-d[Allow for descendent datasets]' \
- ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
- ':filesystem/volume:_zfs_dataset -t fs -t vol' \
- - set3 \
- '-e[Everyone]' \
- '-l[Allow for named dataset]' \
- '-d[Allow for descendent datasets]' \
- ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
- ':filesystem/volume:_zfs_dataset -t fs -t vol' \
- - set4 \
- '-c[Create-time permissions]' \
- ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
- ':filesystem/volume:_zfs_dataset -t fs -t vol'
- ;;
-
- ("upgrade")
- _arguments -A "-*" \
- - set1 \
- '-v[Verbose]' \
- - set2 \
- '-a[Upgrade all filesystems on all pools]' \
- '-r[Upgrade descendent filesystems, too]' \
- '-V[Upgrade to specified version]:version:(1 2)' \
- - set3 \
- '-r[Upgrade descendent filesystems, too]' \
- '-V[Upgrade to specified version]:version:(1 2)' \
- ':filesystem:_zfs_dataset -t fs'
- ;;
-
- ("hold")
- _arguments -A "-*" \
- '-r[Apply hold recursively]' \
- ':tag:' \
- ':snapshot:_zfs_dataset -t snap'
- ;;
-
- ("holds")
- _arguments -A "-*" \
- '-r[List holds recursively]' \
- ':snapshot:_zfs_dataset -t snap'
- ;;
-
- ("release")
- _arguments -A "-*" \
- '-r[Release holds recursively]' \
- ':tag:' \
- ':snapshot:_zfs_dataset -t snap'
- ;;
-
- ("diff")
- _arguments -A "-*" \
- '-F[Add column for filetype character]' \
- '-H[Parseable output]' \
- '-e[Only show new and changed files]' \
- '*-o[Show fields]:field:_values "field" $difffields' \
- '-t[Add column for ctime]' \
- - set1 \
- ':snapshot:_zfs_dataset -t snap' \
- ':snapshot or filesystem:_zfs_dataset -t snap -t fs' \
- - set2 \
- '-E[Show difference from empty]' \
- ':snapshot or filesystem:_zfs_dataset -t snap -t fs'
- ;;
-
- ("key")
- _arguments -A "-*" \
- - set1 \
- '-a[Apply to all datasets in all pools]' \
- '(-u -K -f)-l[Load the encryption key]' \
- '(-l -K)-u[Unload the encryption key]' \
- '(-l -u -f)-K[Create a new data encryption key]' \
- '(-l -K)-f[Unmount the dataset before unloading the encryption key]' \
- '-r[Apply recursively]' \
- ':filesystem or volume:_zfs_dataset -t fs -t vol' \
- - set2 \
- '-c[Change the encryption key]' \
- '-o[Change a property]:property:_zfs_keysource_props' \
- ':filesystem or volume:_zfs_dataset -t fs -t vol'
- ;;
-
- ("jail"|"unjail")
- _arguments \
- '1: : _jails' \
- '2:filesystem:_zfs_dataset -t fs'
- ;;
-
- ("help")
- _arguments -A "-*" \
- - set1 \
- ':command:($subcmds $delegatable_perms $ro_properties ${rw_properties%%:*} properties)' \
- - set2 \
- '-l[Display property information]' \
- ': :(properties)'
- ;;
-
- (*)
- _message "unknown zfs subcommand: $service"
- ;;
- esac
-}
-
-_zfs "$@"
+#compdef zfs zdb zpool
+
+local curcontext="$curcontext" implementation nm="$compstate[nmatches]"
+local -a state curstate line state_descr expl alts args
+typeset -A opt_args val_args
+local MATCH MBEGIN MEND
+local -a subcmds
+local -a share_nfs_ro_properties share_nfs_rw_properties
+local -a share_smb_ro_properties share_smb_rw_properties
+local -a share_ro_properties share_rw_properties
+local -a difffields delegatable_perms key_properties
+local -a ds_types sum_algorithms comp_algorithms dedup_algorithms
+
+local -a ds_propnames ro_ds_props rw_ds_props ci_ds_props # dataset properties
+local -a po_propnames ro_po_props rw_po_props ci_po_props # pool properties
+
+_pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris
+
+ds_types=( filesystem snapshot volume all )
+sum_algorithms=( on off fletcher2 fletcher4 sha256 )
+comp_algorithms=( on off lzjb lz4 gzip gzip-{1..9} zle )
+dedup_algorithms=( on off verify sha256 sha256,verify )
+
+ro_po_props=( # readonly
+ 'all[all properties]'
+ 'allocated[space allocated]'
+ 'capacity[space used (percentage)]'
+ 'dedupratio[deduplication ratio]'
+ 'free[space unallocated]'
+ 'health[health status]'
+ 'size[total size]'
+)
+ci_po_props=( # only set at create or import
+ 'altroot[alternate root directory]:path:_directories'
+ 'guid[unique identifier]:identifier'
+ 'readonly[whether the pool can be modified]:value:(on off)'
+)
+rw_po_props=(
+ 'autoexpand[automatic pool expansion]:value:(on off)'
+ 'autoreplace[automatic device replacement]:value:(on off)'
+ 'bootfs[default bootable dataset]:dataset:_zfs_dataset'
+ 'cachefile[pool configuration cache file location]:value'
+ 'dedupditto[threshold for number of copies]:value [0]'
+ 'delegation[delegated administration]:value:(on off)'
+ 'failmode[failure-mode behavior]:value:(wait continue panic)'
+ "listshares[show shares in 'zfs list']:value:(on off)"
+ "listsnaps[show snapshots in 'zfs list']:value:(on off)"
+ 'version[pool version]:version'
+)
+
+# TODO: userused@ and groupused@ could have more extensive handling
+ro_ds_props=(
+ name type creation space used available referenced compressratio mounted
+ origin usedbychildren usedbydataset usedbyrefreservation usedbysnapshots
+ defer_destroy userused@ userrefs groupused@ keystatus
+)
+ci_ds_props=(
+ 'casesensitivity:value:(sensitive insensitive mixed)'
+ 'normalization:value:(none formC formD formKC formKD)'
+ 'utf8only:value:(on off)'
+)
+rw_ds_props=(
+ 'aclinherit:value:(discard noallow restricted passthrough passthrough-x)'
+ 'atime:value:(on off)'
+ 'canmount:value:(on off noauto)'
+ "checksum:value:($sum_algorithms)"
+ "compression:value:($comp_algorithms)"
+ 'copies:value:(1 2 3)'
+ "dedup:value:($dedup_algorithms)"
+ 'devices:value:(on off)'
+ 'encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)'
+ 'exec:value:(on off)'
+ 'groupquota@'
+ 'logbias:value:(latency throughput)'
+ "mountpoint: : _alternative \
+ 'properties:property:(none legacy)' \
+ 'paths:mountpoint:_directories -W / -P /'"
+ 'multilevel:value:(on off)'
+ 'nbmand:value:(on off)'
+ 'primarycache:value:(all none metadata)'
+ 'quota: :->quotas'
+ 'readonly:value:(on off)'
+ 'recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)'
+ 'refquota: :->quotas'
+ "refreservation: : _alternative \
+ 'sizes: :_numbers -M \"m:{a-zA-Z}={A-Za-z}\" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \
+ 'properties:property:(auto none)'"
+ 'reservation: :->quotas'
+ 'rstchown:value:(on off)'
+ 'secondarycache:value:(all none metadata)'
+ 'setuid:value:(on off)'
+ 'shadow:value' # TODO: complete URI|none
+ 'share:share properties'
+ 'snapdir:value:(hidden visible)'
+ 'sync:value:(standard always disabled)'
+ 'userquota@'
+ 'version:value'
+ 'volsize:size:_numbers -M "m:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}'
+)
+
+case $service:$implementation in
+ *:openzfs)
+ ds_types+=( bookmark )
+ sum_algorithms+=( noparity sha512 skein edonr )
+ comp_algorithms+=( zstd zstd-{1..19} zstd-fast zstd-fast-{{1..9}{,0},100,500,1000} )
+ dedup_algorithms+=( {sha512,skein}{,\,verify} edonr,verify )
+ share_rw_properties=( sharesmb:option sharenfs:option )
+ ro_po_props+=(
+ 'expandsize[uninitialized space within the pool]'
+ 'fragmentation[amount of fragmentation in the pool]'
+ 'freeing[amount of space remaining to be reclaimed]'
+ 'used[amount of storage space used within the pool]'
+ 'load_guid[unique identifier generated when pool is loaded]'
+ )
+ ci_po_props+=(
+ 'ashift[pool sector size exponent]:exponent:((9\:512 10\:1024 11\:2048 12\:4096 13\:8192 14\:16384 15\:32768 16\:65536))'
+ )
+ rw_po_props+=(
+ 'autotrim[periodically trim recently freed space]:value:(on off)'
+ 'comment[text string that is available even if the pool becomes faulted]:value'
+ 'multihost[perform pool activity check during import]:value:(on off)'
+ )
+ rw_ds_props+=(
+ 'aclmode:value:(discard groupmask passthrough restricted)'
+ 'acltype:value:(off noacl nfsv4 posix posixacl)'
+ 'mlslabel:value:(none)' # TODO: list sensitivity labels
+ 'redundant_metadata:value:(all most)'
+ 'vscan:value:(on off)'
+ 'xattr:value:(on off dir sa)'
+ "filesystem_limit: :{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ -prefix n ]]; then compadd none; else _message -e limits 'number or none'; fi}"
+ "snapshot_limit: :{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ -prefix n ]]; then compadd none; else _message -e limits 'number or none'; fi}"
+ 'volmode:mode:((
+ default\:use\ system-wide\ tunable
+ full\:expose\ as\ block\ devices
+ geom\:expose\ as\ block\ devices
+ dev\:hide\ partitions
+ none\:not\ exposed\ outside\ zfs
+ ))'
+ )
+ ro_ds_props+=(
+ createtxg clones filesystem_count guid logicalreferenced logicalused
+ receive_resume_token refcompressratio snapshot_count volblocksize written
+ )
+ delegatable_perms=(
+ bookmark load-key change-key userobjquota userobjused groupobjquota
+ groupobjused projectused projectquota projectobjused projectobjquota
+ )
+ ;|
+ *:solaris)
+ ds_types+=( share )
+ sum_algorithms+=( sha256+mac )
+ share_nfs_ro_properties=( share.nfs.all )
+ share_nfs_rw_properties=(
+ 'share.nfs:value:(on off)'
+ 'share.nfs.aclok:value:(on off)'
+ 'share.nfs.aclfab:value:(on off)'
+ 'share.nfs.anon:uid'
+ 'share.nfs.charset.'{cp932,euc-{cn,jpns,kr,tw},iso8859-{1,2,5,6,7,8,9,13,15},koi8-r,shift_jis}':access-list'
+ 'share.nfs.index:file:_files'
+ 'share.nfs.labeled:value:(on off)'
+ 'share.nfs.noaclfab:value:(on off)'
+ 'share.nfs.log:nfslog.conf tag'
+ 'share.nfs.nosub:value:(on off)'
+ 'share.nfs.nosuid:value:(on off)'
+ 'share.nfs.public:value:(on off)'
+ 'share.nfs.sec:security-mode-list'
+ 'share.nfs.sec.'{default,dh,krb5{,i,p},none,sys}.{ro,root,rw}':access-list'
+ 'share.nfs.sec.'{default,dh,krb5{,i,p},none,sys}.root_mapping':uid'
+ 'share.nfs.sec.'{default,dh,krb5{,i,p},none,sys}.window':credential lifetime (seconds)'
+ 'share.nfs.sec.sys.resvport:value:(on off)'
+ )
+ share_smb_ro_properties=( share.smb.all )
+ share_smb_rw_properties=(
+ 'share.smb:value:(on off)'
+ 'share.smb.abe'
+ 'share.smb.ad-container'
+ 'share.smb.catia:value:(on off)'
+ 'share.smb.csc:value:(disabled manual auto vdo)'
+ 'share.smb.dfsroot:value:(on off)'
+ 'share.smb.encrypt:value:(on off)'
+ 'share.smb.guestok:value:(on off)'
+ 'share.smb.oplocks:value:(disabled enabled)'
+ 'share.smb.cont_avail:value:(on off)'
+ 'share.smb.'{none,ro,rw}':access-list'
+ )
+ share_ro_properties=(
+ share.all share.fs share.name share.point share.protocols share.state
+ $share_nfs_ro_properties $share_smb_ro_properties
+ )
+ share_rw_properties=(
+ 'share.desc:description'
+ 'share.auto:value:(on off)'
+ 'share.autoname:value'
+ 'share.nfs.cksum:value'
+ 'share.path:path'
+ $share_nfs_rw_properties $share_smb_rw_properties
+ )
+ ro_po_props+=(
+ 'lastscrub[start time of the last successful scrub]'
+ )
+ rw_po_props+=(
+ 'clustered[pool is imported as a global pool in Oracle Solaris Cluster]:value:(on off)'
+ 'scrubinternal[time interval between scheduled scrubs]:interval'
+ )
+ ro_ds_props+=( keychangedate rekeydate effective{read,write}limit )
+ rw_ds_props+=(
+ 'aclmode:value:(discard mask passthrough)'
+ "defaultreadlimit: : _alternative \
+ 'sizes: :_guard \[0-9\]\#\(\|\[BKMGTPEZ\]\) size\ \(bytes\ per\ second\)' \
+ 'properties:property:(none)'"
+ "defaultwritelimit: : _alternative \
+ 'sizes: :_guard \[0-9\]\#\(\|\[BKMGTPEZ\]\) size\ \(bytes\ per\ second\)' \
+ 'properties:property:(none)'"
+ 'defaultuserquota:->quotas'
+ 'defaultgroupquota: :->quotas'
+ 'keysource:value:->keysources'
+ )
+ ci_ds_props+=(
+ 'volblocksize:value:compadd -o nosort 512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M'
+ )
+ difffields=(
+ object parent size links linkschange name oldname user group
+ ctime mtime atime crtime mountpoint dataset_name
+ )
+ delegatable_perms=( key keychange )
+ ;|
+ zfs:openzfs)
+ subcmds+=(
+ bookmark change-key load-key program project projectspace redact
+ unload-key wait
+ )
+ ;|
+ zpool:openzfs)
+ subcmds+=(
+ checkpoint events labelclear initialize reopen resilver sync trim wait
+ version
+ )
+ ;|
+ zfs:solaris)
+ subcmds+=( key help )
+ ;|
+ zpool:solaris)
+ subcmds+=( help label monitor )
+ ;|
+
+ zfs:*)
+ subcmds+=(
+ create destroy clone promote rename snapshot rollback list set get
+ inherit mount unmount share unshare send receive allow unallow upgrade
+ userspace groupspace hold holds release diff
+ )
+ [[ $OSTYPE = freebsd<7->.* ]] && subcmds+=( jail unjail )
+ ;;
+ zpool:*)
+ subcmds+=(
+ add attach clear create destroy detach export get history import iostat
+ list offline online reguid remove replace scrub set split status upgrade
+ )
+ ;;
+esac
+
+case $OSTYPE in
+ solaris*)
+ rw_ds_props+=( 'zoned:value:(on off)' )
+ ;;
+ freebsd*)
+ [[ $OSTYPE = freebsd<-12>.* ]] && subcmds+=( remap )
+ rw_ds_props+=( 'jailed:value:(on off)' )
+ ;;
+ linux-gnu)
+ rw_ds_props+=( 'relatime:value:(on off)' )
+ ci_ds_props+=(
+ {,fs,def,root}'context:SELinux context:_selinux_contexts'
+ )
+ ;;
+esac
+
+delegatable_perms+=(
+ allow clone create destroy diff hold key keychange mount promote receive
+ release rename rollback send share snapshot groupquota groupused userprop
+ userused ${ci_ds_props%%:*}
+)
+
+key_properties=(
+ 'keylocation:location [prompt]:_files -P file\:// -W /'
+ 'keyformat:format:(raw hex passphrase)'
+ 'pbkdf2iters:iterations [350000]'
+)
+
+ro_ds_props+=( $share_ro_properties )
+rw_ds_props+=( $share_rw_properties )
+ci_ds_props+=( $rw_ds_props )
+
+ds_propnames=( ${rw_ds_props%%:*} )
+po_propnames=( ${ro_po_props%%:*} ${ci_po_props%%:*} ${rw_po_props%%:*} )
+
+
+case $service in
+ zfs|zpool)
+ _arguments -C -A "-*" \
+ '-?[display usage information]' \
+ '*::command:->subcmd' && return 0
+
+ if (( CURRENT == 1 )); then
+ _wanted commands expl "subcommand" compadd -a subcmds
+ return
+ fi
+ curcontext="${curcontext%:*}-$words[1]:"
+ ;;
+ zdb)
+ if [[ $implementation = openzfs ]]; then
+ args=(
+ '-mm[also display free space histogram associated with each metaslab]'
+ {-mmm,-MM}'[display more free space information]'
+ {-mmmm,-MMM}'[display every spacemap record]'
+ '-DD[display a histogram of deduplication statistics]'
+ '-DDD[display deduplication statistics independently for each table]'
+ '-DDDD[dump the contents of the deduplication tables describing duplicate blocks]'
+ '-DDDDD[also dump the contents of the deduplication tables describing unique blocks]'
+ '-E+[decode and display block from a given embedded block pointer]:word'
+ '(-l)-ll+[like -l but display L2ARC log blocks]:device:_files'
+ '(-l -ll)-lll+[like -l but display every configuration, unique or not]:device:_files'
+ "-q[don't print labels (with -l)]"
+ '-k[examine the checkpointed state of the pool]'
+ '-M[display the offset, spacemap, and free space of each metaslab]' \
+ '-O+[look up the specified path inside of the dataset]:dataset:_zfs_dataset:path:_files'
+ '-o+[set the given global libzpool variable]:variable'
+ '-r+[copy the specified path inside of the dataset to the specified destination]:dataset:_zfs_dataset:path:_files:destination:_files'
+ '-x+[copy all blocks accessed to files in the specified directory]:directory:_directories'
+ '-V[attempt verbatim import]'
+ '-Y[attempt all possible combinations when reconstructing indirect split blocks]'
+ '-y[perform validation for livelists that are being deleted]'
+ )
+ else
+ args=(
+ '-?[display usage information]'
+ '-M+[dump MOS contents]:contents: _values -s , raw_config all objset dir pool_props metaslab sync_bplist dtl config spares l2cache history errlog_scrub errlog_last bpmap-vdev bpmap_defer_obj dtl-scan ddt2'
+ '-r[dump datasets recursively]'
+ '-z[report zombies only]'
+ '-V[verify DDT xtree block data]'
+ "-a[don't import l2arc cache data]"
+ '-f[attempt to force import (with -e)]'
+ '-w+[specify directory to save shadow copy of all accessed disk locations]: :_directories'
+ '-x+[set kernel tunable]:tunable'
+ '-G[dump the contents of the zfs_dbgmsg buffer before exiting]'
+ '-I[limit the number of outstanding checksum I/Os to the specified value]'
+ )
+ fi
+ _arguments -A "-*" -S $args \
+ '(-C)-b[display block statistics]' \
+ '(-C)*-c[verify checksum of metadata blocks]' \
+ '(-b -c -d)-C[display configuration information]' \
+ '(-C)*-d[display dataset information]' \
+ '-h[display pool history]' \
+ '-i[display intent log (ZIL) information]' \
+ '-l+[read the vdev labels from the specified device]:device:_files' \
+ '-m[display the offset, spacemap, and free space of each metaslab]' \
+ '-s[report statistics on zdb I/O]' \
+ '*-u[also display the uberblocks on the device (with -l)]' \
+ '*-v[enable verbose output]' \
+ '-D[display deduplication statistics]' \
+ '-S[simulate the effects of deduplication, displaying constructed DDT as with -DD]' \
+ '-L[disable leak detection and the loading of space maps]' \
+ '-R+[read and display a block from the specified device]:device' \
+ "-A[don't abort should any assertion fail]" \
+ "-AA[enable panic recovery]" \
+ '-F[try progressively older transactions until pool is readable]' \
+ '-U+[specify cache file to use]:cache file [/etc/zfs/zpool.cache]:_files' \
+ '-X[attempt "extreme" transaction rewind]' \
+ '-e[operate on an exported pool]' \
+ '-p[specify path under which to search for devices (with -e)]:path:_files' \
+ '-P[use exact (parsable) numeric output]' \
+ '-t+[specify the highest transaction to use when searching for uberblocks]:transaction' \
+ '1:pool:_zfs_pool'
+ return
+ ;;
+esac
+
+case $service:$words[1] in
+ zfs:create)
+ [[ $implementation = openzfs ]] && args=(
+ '-P[print machine-parsable verbose information about the created dataset]'
+ '-n[do a dry-run, no dataset will be created]'
+ '-v[print verbose information about the created dataset]'
+ )
+ _arguments -C -A "-*" -S $args \
+ '-p[create parent datasets]' \
+ '*-o+[set initial propertyvalue]:property:->create-properties' \
+ - set1 \
+ ':filesystem:_zfs_dataset -t fs -e "parent dataset"' \
+ - set2 \
+ '-s[create sparse volume]' \
+ '-b+[set volblocksize]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes blocksize \:B {k,M,G,T,P,E,Z}{,B}' \
+ '-V+[set size]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size \:B {k,M,G,T,P,E,Z}{,B}' \
+ ':volume:_zfs_dataset -t fs -e "parent dataset"'
+ ;;
+
+ zfs:destroy)
+ if [[ $implementation = openzfs ]]; then
+ args=(
+ '-n[do a dry-run, no data will be deleted]'
+ '-p[print machine-parsable verbose information about the deleted data]'
+ '-v[print verbose information about the deleted data]'
+ )
+ else
+ args=( '-s[destroy snapshots synchronously - only return when blocks freed]' )
+ fi
+ _arguments -A "-*" -S $args \
+ '-r[recursively destroy all children]' \
+ '-R[recursively destroy all dependents]' \
+ '(-f)-d[delete or mark deferred]' \
+ '(-d)-f[force unmounts]' \
+ ':dataset:_zfs_dataset -t fs -t vol ${=${opt_args[(i)-f]:--t snap}:/-f/} ${=${opt_args[(i)-*]:--t bookmark}:/-?/}'
+ ;;
+
+ zfs:snap(|shot))
+ _arguments -C -A "-*" -S \
+ '-r[recursively snapshot all descendant datasets]' \
+ '*-o+[set property]:property:->create-properties' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol -S@'
+ ;;
+
+ zfs:rollback)
+ _arguments -A "-*" -S \
+ '-r[recursively destroy more recent snapshots]' \
+ '-R[recursively destroy more recent snapshots and clones]' \
+ '-f[force unmounts]' \
+ ':snapshot:_zfs_dataset -t snap'
+ ;;
+
+ zfs:clone)
+ [[ $implementation = solaris ]] && args+=(
+ '-K[create encryption key]'
+ )
+ _arguments -C -A "-*" -S $args \
+ '-p[create parent datasets]' \
+ '*-o+[set property]:property:->create-properties' \
+ ':snapshot:_zfs_dataset -t snap' \
+ ':filesystem/volume:_zfs_dataset -t fs -e "parent dataset"'
+ ;;
+
+ zfs:promote)
+ _arguments \
+ ':filesystem:_zfs_dataset -t clone' \
+ ;;
+
+ zfs:rename)
+ [[ $implementation = openzfs ]] && args=(
+ '(-r -u)-f[force unmount any filesystems]'
+ "(-r -f)-u[don't remount file systems during rename]"
+ )
+ _arguments -A "-*" -S $args \
+ '(-r)-p[create parent datasets]' \
+ '(-p -u -f)-r[recursively rename snapshots of all descendent datasets]' \
+ ':dataset:_zfs_dataset -r1' \
+ ':dataset:_zfs_dataset -r2'
+ ;;
+
+ zfs:bookmark)
+ _arguments \
+ ':snapshot or bookmark:_zfs_dataset -t snap -t bookmark' \
+ ':bookmark'
+ ;;
+
+ zfs:program)
+ _arguments -A "-*" -S \
+ '-j[display channel program output in JSON format]' \
+ '-n[execute a read-only channel program]' \
+ '-t+[limit the number of Lua instructions to execute]:instruction limit' \
+ '-m+[specify memory limit]:memory limit (bytes) [10MB]' \
+ ':pool:_zfs_pool' \
+ ':script:_files' \
+ '*: :_default'
+ ;;
+
+ zfs:list)
+ if [[ $implementation = solaris ]]; then
+ args=( '-I+[specify dataset states to display instead of normal datasets]:dataset state:_sequence compadd - receiving resumable hidden all' )
+ else
+ args=( '-p[use exact (parsable) numeric output]' )
+ fi
+ _arguments -A "-*" -S $args \
+ '(-d)-r[recursively display children]' \
+ '-H[suppress printing of headers]' \
+ '(-r)-d+[depth]:value' \
+ '-o+[specify properties to list]: :_values -s , "property" $ro_ds_props $ds_propnames' \
+ '*-s+[specify sort key (ascending)]: :_values "property" $ro_ds_props $ds_propnames' \
+ '*-S+[specify sort key (descending)]: :_values "property" $ro_ds_props $ds_propnames' \
+ '-t+[specify dataset types to list]: :_values -s , "dataset type" $ds_types' \
+ '*:filesystem/volume/snapshot/path:_zfs_dataset -p'
+ ;;
+
+ zfs:set)
+ [[ $implementation = solaris ]] && args=(
+ '-r[recursively apply value]' \
+ )
+ _arguments -C -A "-*" -S $args \
+ ':property:->set-properties' \
+ '*:filesystem/volume:_zfs_dataset -t fs -t vol'
+ ;;
+
+ zfs:get)
+ if [[ $implementation == openzfs ]]; then
+ args=( '-t+[specify dataset types to display]: :_values -s , "dataset type" $ds_types' )
+ else
+ args=( '-e[expand property sublists to any depth]' )
+ fi
+ _arguments -A "-*" -S $args \
+ "(-d)-r[recursively display children's properties]" \
+ '(-r)-d+[depth]:value' \
+ '-H[suppress printing of headers]' \
+ '-p[use exact (parsable) numeric output]' \
+ '-s+[specify sources]: :_values -s , "source" local default inherited received temporary none' \
+ '-o+[specify fields]: :_values -s , "field" name property received value source' \
+ ':property:_values -s , "property" $ro_ds_props $ds_propnames all' \
+ '*:filesystem/volume/snapshot:_zfs_dataset'
+ ;;
+
+ zfs:inherit)
+ _arguments -C -A "-*" -S \
+ '-r[recursively inherit property for all children]' \
+ '-S[revert to received property value]' \
+ ':property:_values "property" $ro_ds_props ${rw_ds_props%%:*}' \
+ '*:filesystem/volume:_zfs_dataset -t fs -t vol'
+ ;;
+
+ zfs:remap)
+ _arguments \
+ ':filesystem or volume:_zfs_dataset -t fs -t vol'
+ ;;
+
+ zfs:upgrade)
+ _arguments -A "-*" -S \
+ '(- :)-v[display supported ZFS versions]' \
+ '(-v :)-a[upgrade all filesystems on all pools]' \
+ '(-v)-r[upgrade descendent filesystems, too]' \
+ '(-v)-V+[upgrade to specified version]:version' \
+ '(-a -v):filesystem:_zfs_dataset -t fs'
+ ;;
+
+ zfs:(user|group)space)
+ args=(
+ '-n[print numeric ID]'
+ '-i[translate SID to POSIX ID]'
+ )
+ ;& # fall-through
+ zfs:projectspace)
+ [[ $implementation = solaris ]] && args+=(
+ '(- *)'{-h,--help}'[display usage information]'
+ )
+ _arguments -A "-*" -S $args \
+ '-H[suppress printing of headers, tab-delimit columns]' \
+ '-p[use exact (parsable) numeric output]' \
+ '-o+[specify properties to list]:property:_values -s , "property" type name used quota' \
+ '*-s+[specify sort key (ascending)]: :_values "property" type name used quota' \
+ '*-S+[specify sort key (descending)]: :_values "property" type name used quota' \
+ '-t+[specify types to list]:type:_values -s , "type" all posixuser smbuser posixgroup smbgroup' \
+ '*:filesystem/volume/snapshot:_zfs_dataset'
+ ;;
+
+ zfs:project)
+ _arguments -A "-*" -S \
+ '(-r -C -k -p -s)-d[act on the directory project ID and inherit flag, not its children]' \
+ '(-d)-r[act on subdirectories recursively]' \
+ '(-0 -c -d -s)-C[clear project inherit flag and/or ID on the file(s) or directories]' \
+ '(-0 -c -d -p -s)-k[keep the project ID unchanged]' \
+ '(-k -C -s)-c[check project ID and inherit flag on the file(s) or directories]' \
+ '(-k -C -s)-0[print file name with a trailing NUL instead of newline]' \
+ '(-k)-p+[specify project ID]:project ID' \
+ '(-0 -c -k -C)-s[set project inherit flag on the given file(s) or directories]' \
+ '*:file:_files'
+ ;;
+
+ zfs:mount)
+ [[ $OSTYPE != freebsd* ]] && args=( '-O[overlay mount]' )
+ [[ $implementation = openzfs ]] && args+=(
+ '-l[load keys for encrypted filesystems as they are being mounted]'
+ )
+ _arguments -A "-*" -S $args \
+ '-o+[specify temporary file system options]: :_values -s , "option" {,no}{atime,dev,exec,relatime,suid,xattr} ro rw' \
+ '-v[report mount progress]' \
+ '-f[force mount]' \
+ '(:)-a[mount all available ZFS filesystems]' \
+ '(-a):filesystem:_zfs_dataset -t fs'
+ ;;
+
+ zfs:u(|n)mount)
+ [[ $implementation = openzfs ]] && args+=(
+ '-u[unload keys for any unmounted encryption roots]'
+ )
+ _arguments -A "-*" -S $args \
+ '-f[force unmount]' \
+ '(:)-a[unmount all ZFS filesystems]' \
+ '(-a):dataset or mountpoint:_zfs_dataset -t fs -t mtpt'
+ ;;
+
+ zfs:share)
+ [[ $implementation = solaris ]] && args=(
+ - set2 \
+ '-r[share filesystems recursively]' \
+ ':dataset:_zfs_dataset -t fs' \
+ - set3 \
+ '*-o+[create a share with specified properties]: :_values -w "share properties" $share_rw_properties' \
+ '-u[create a share without sharing it]' \
+ ':dataset:_zfs_dataset -t fs' \
+ )
+ _arguments -A "-*" -S \
+ - set1 \
+ '-a[share all available ZFS filesystems]' \
+ $args \
+ - set4 \
+ ':dataset or mountpoint:_zfs_dataset -t fs -t mtpt -t share'
+ ;;
+
+ zfs:unshare)
+ [[ $implementation = solaris ]] && args=(
+ - set2
+ '-r[unshare filesystems recursively]'
+ ':filesystem:_zfs_dataset -t fs'
+ )
+ _arguments -A "-*" -S $args \
+ - set1 \
+ '-a[unshare all shared ZFS filesystems]' \
+ - set3 \
+ ':filesystem:_zfs_dataset -t fs -t mtpt -t share'
+ ;;
+
+ zfs:send)
+ if [[ $implementation = openzfs ]]; then
+ args=(
+ '(-L --large-block)'{-L,--large-block}'[generate a stream which may contain blocks larger than 128KB]'
+ '(-P --parsable)'{-P,--parsable}'[print machine-parsable verbose information about the stream generated]'
+ '(-e --embed)'{-e,--embed}'[more compact stream for blocks stored with the embedded_data feature]'
+ '(-c --compressed)'{-c,--compressed}'[more compact stream for compressed blocks]'
+ '(-h --holds)'{-h,--holds}'[send snapshot holds]'
+ '-V[set the process title to a per-second report of how much data has been send]'
+ '-t[create a send stream that resumes an interrupted receive]:resume token'
+ '(-w --raw)'{-w,--raw}'[keep encrypted data exactly as it exists on disk]'
+ - redact
+ '(-h -V -t -w --raw)--redact[generate a redacted send stream]'
+ - saved
+ '(-S --saved)'{-S,--saved}'[generate stream from partially received dataset]'
+ )
+ else
+ args=(
+ '-w+[send compressed filesystem blocks as compressed in the stream]:compression:(compress none)'
+ '-m+[limit amount of memory used by deduplication processing]: :_numbers -u bytes "memory size" K M G'
+ '-s+[set stream options]:token:(streamsize check nocheck memsize)'
+ '-C[read a receive checkpoint from stdin]'
+ '-c[create a self-contained stream]'
+ '(-R)-r[generate a recursive stream package]'
+ )
+ fi
+ _arguments -A "-*" -S \
+ '-b[send only received property values]' \
+ '(-I)-i[generate an incremental stream]:snapshot:_zfs_dataset -t snap' \
+ '-D[perform dedup processing]' \
+ "-n[don't send the stream]" \
+ '-p[send properties]' \
+ '-v[verbose]' \
+ '(-i)-I[generate an incremental stream with intermediary snapshots]:snapshot:_zfs_dataset -t snap' \
+ '(-r)-R[generate a replication stream package]' \
+ ':snapshot:_zfs_dataset -t snap -t bookmark' \
+ $args
+ ;;
+
+ zfs:redact)
+ _arguments \
+ ':snapshot:_zfs_dataset -t snap' \
+ ':bookmark:_zfs_dataset -t bookmark' \
+ ':redaction snapshot:_zfs_dataset -t snap'
+ ;;
+
+ zfs:(receive|recv))
+ if [[ $implementation = openzfs ]]; then
+ args=(
+ '-h[skip the receive of holds]'
+ '-s[if the receive is interrupted, save the partially received state]'
+ '(- set2)-A[abort an interrupted zfs recv -s, deleting its saved partially received state]'
+ )
+ [[ $OSTYPE != linux* ]] && args+=(
+ '-M[force an unmount of the file system while receiving a snapshot]'
+ )
+ else
+ args=( '(-)-C[write a receive checkpoint to stdout]' )
+ fi
+ _arguments -A "-*" -S $args \
+ '-v[verbose]' \
+ "-n[don't receive the stream]" \
+ '-F[force a rollback if necessary]' \
+ '-u[filesystem is not mounted]' \
+ '-o[include property change in the stream]:property' \
+ '-x[exclude property change from the stream]:property' \
+ - set1 \
+ ':filesystem/volume/snapshot:_zfs_dataset' \
+ - set2 \
+ '(-e)-d[set path prefix from stream, excluding only pool name]' \
+ '(-d)-e[set path prefix from stream, using last path element]' \
+ ':filesystem:_zfs_dataset -t fs'
+ ;;
+
+ zfs:allow)
+ _arguments -C -A "-*" -S \
+ '(-g -e -c -s)-u[delegate to user]' \
+ '(-u -e -c -s)-g[delegate to group]' \
+ '(1 -g -u -c -s)-e[delegate to everyone]' \
+ '(1 -u -g -e -l -d -s)-c[set permissions for newly-created descendant filesystems]' \
+ '(-u -g -e -l -d -c)-s[define or modify permission sets]:permission set' \
+ '(-c -s)-l[allow for named dataset]' \
+ '(-c -s)-d[allow for descendent datasets]' \
+ '1: :->first' \
+ ':permission list:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol'
+
+ if [[ -n $state ]]; then
+ case $opt_args[(I)-[ugs]] in
+ ^-[ug]) alts+=( 'permission-sets: :_guard "(|@*)" "permission set"' ) ;|
+ ^-[gs]) alts+=( 'users:user:_users' ) ;|
+ ^-[us]) alts+=( 'groups:group:_groups' ) ;|
+ '')
+ alts+=(
+ 'all:everyone:(everyone)'
+ 'filesystems:filesystem/volume:_zfs_dataset -t fs -t vol'
+ )
+ ;;
+ esac
+ _alternative $alts
+ fi
+ ;;
+
+ zfs:unallow)
+ _arguments -A "-*" -S \
+ '-r[recursive removal]' \
+ '(-e -g -s -c)-u[user]' \
+ '(-e -u -s -c)-g[group]' \
+ '(1 -g -u -s -c)-e[everyone]' \
+ '(1 -u -g -e -s -l -d)-c[create-time permissions]' \
+ '(-e -u -g -c)-s[remove permissions from or delete a permission set]:permission set' \
+ '(-c -s)-l[allow for named dataset]' \
+ '(-c -s)-d[allow for descendent datasets]' \
+ '1: :->first' \
+ '::permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+ ':filesystem/volume:_zfs_dataset -t fs -t vol'
+
+ if [[ -n $state ]]; then
+ case $opt_args[(I)-[ugs]] in
+ ^-[ug]) alts+=( 'permission-sets: :_guard "(|@*)" "permission set"' ) ;|
+ ^-[gs]) alts+=( 'users:user:_users' ) ;|
+ ^-[us]) alts+=( 'groups:group:_groups' ) ;|
+ '') alts+=( 'all:everyone:(everyone)' ) ;;
+ esac
+ _alternative $alts
+ fi
+ ;;
+
+ zfs:hold)
+ _arguments -A "-*" -S \
+ '-r[apply hold recursively]' \
+ ':tag' \
+ ':snapshot:_zfs_dataset -t snap'
+ ;;
+
+ zfs:holds)
+ [[ $implementation = openzfs ]] && args=(
+ '-H[suppress printing of headers, tab-delimit columns]'
+ )
+ [[ $OSTYPE = freebsd<-12>.* ]] && args+=(
+ # features were lost with the openzfs rebase
+ '-p[use exact (parsable) numeric output]'
+ '(-r)-d+[depth]:value'
+ )
+ _arguments -A "-*" -S $args \
+ '(-d)-r[list holds recursively]' \
+ ':snapshot:_zfs_dataset -t snap'
+ ;;
+
+ zfs:release)
+ _arguments -A "-*" -S \
+ '-r[release holds recursively]' \
+ ':tag' \
+ ':snapshot:_zfs_dataset -t snap'
+ ;;
+
+ zfs:diff)
+ [[ $implementation = solaris ]] && args=(
+ '(-E)-e[only show new and changed files, no deleted]'
+ '*-o+[show specified fields]:field:_values "field" $difffields'
+ '-q[silence warnings for missing snapshots on recursive datasets]'
+ '-N[enumerate new child datasets (with -r)]'
+ '(1 -e)-E[show difference from empty]'
+ )
+ _arguments -A "-*" -S $args \
+ '-F[add column for filetype character, similar to ls(1)]' \
+ '-H[suppress printing of headers and arrows, tab-delimit columns]' \
+ '-t[add column for ctime]' \
+ '(-E)1:snapshot:_zfs_dataset -t snap' \
+ '2:snapshot or filesystem:_zfs_dataset -t snap -t fs'
+ ;;
+
+ zfs:wait)
+ _arguments -A "-*" -S \
+ '-t[specify background activity]:activity:(deleteq)' \
+ ':filesystem:_zfs_dataset'
+ ;;
+
+ zfs:key)
+ _arguments -C -A "-*" -S \
+ '-t+[only apply to given dataset type]: :_values -s , "dataset type" $ds_types' \
+ '(-u -c -K -f -o)-l[load the encryption key]' \
+ "(-u -c -K -f -o)-M[don't mount file systems after loading their keys]" \
+ "(-u -c -K -f -o)-S[don't share file systems after loading their keys]" \
+ '(-l -c -K -o -M -S)-u[unload the encryption key]' \
+ '(-l -c -K -o -M -S)-f[force unmount the dataset before unloading the encryption key]' \
+ '(-l -u -K -f -M -S)-c[change the encryption key]' \
+ '(-l -u -K -f -M -S)-o+[change a property]:property:->keysources' \
+ '(-l -c -u -f -o -M -S)-K[create a new data encryption key]' \
+ '(1 -r)-a[apply to all datasets in all pools]' \
+ '(-a)-r[apply recursively]' \
+ ':filesystem or volume:_zfs_dataset -t fs -t vol'
+ ;;
+
+ zfs:load-key)
+ _arguments -A "-*" -S \
+ "-L+[specify location of user's encryption key]:key location [prompt]:_files -P file\:// -W /" \
+ '(:)-a[load keys for all encryption roots in all imported pools]' \
+ '-n[do a dry-run, simply check that the provided key is correct]' \
+ '-r[load keys for datasets recursively]' \
+ '(-a):filesystem or volume:_zfs_dataset -t fs -t vol'
+ ;;
+
+ zfs:unload-key)
+ _arguments -A "-*" -S \
+ '(:)-a[unload keys for all encryption roots in all imported pools]' \
+ '-r[unload keys for datasets recursively]' \
+ '(-a):filesystem or volume:_zfs_dataset -t fs -t vol'
+ ;;
+
+ zfs:change-key)
+ _arguments -A "-*" -S \
+ '(-o)-i[make filesystem inherit key from its parent]' \
+ '-l[ensure key is loaded before attempting to change it]' \
+ '(-i)*-o+[change encryption key property]: :_values -s , "property" $key_properties' \
+ ':filesystem or volume:_zfs_dataset -t fs -t vol'
+ ;;
+
+ zfs:jail|zfs:unjail)
+ _arguments \
+ '1: : _jails' \
+ '2:filesystem:_zfs_dataset -t fs'
+ ;;
+
+ zfs:help)
+ _arguments -A "-*" -S \
+ - set1 \
+ ':command:($subcmds $delegatable_perms $ro_ds_props ${rw_ds_props%%:*} properties)' \
+ - set2 \
+ '(2)-l[display property information]' \
+ ':help topic:(property)' \
+ ':property:($delegatable_perms $ro_ds_props ${rw_ds_props%%:*})'
+ ;;
+
+ zpool:help)
+ _arguments -A "-*" -S \
+ - commands \
+ ':command:($subcmds)' \
+ - properties \
+ '(2)-l[display property information]' \
+ ':help topic:(property)' \
+ ':property:(${po_propnames%%\[*})'
+ ;;
+
+ zpool:add)
+ if [[ $implementation = openzfs ]]; then
+ args=(
+ '-g[display vdev, GUIDs instead of the normal device names]'
+ '-L[display real paths for vdevs resolving all symbolic links]'
+ '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"' \
+ '-P[display real paths for vdevs instead of only the last component of the path]'
+ )
+ elif [[ $implementation = solaris ]]; then
+ args=( '-l[display configuration in /dev/chassis location form]' )
+ fi
+ _arguments -A "-*" -S $args \
+ '-f[force use of in-use devices]' \
+ '-n[display configuration without modifying pool]' \
+ ':pool:_zfs_pool' \
+ '*:virtual device:->virtual-devices'
+ ;;
+
+ zpool:attach)
+ if [[ $implementation = openzfs ]]; then
+ args=(
+ '-w[wait until new device has finished resilvering before returning]'
+ '-s[reconstruct sequentially to restore redundancy as quickly as possible]'
+ '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"'
+ )
+ fi
+ _arguments -A "-*" -S $args \
+ '-f[force attach, even if in use]' \
+ ':pool:_zfs_pool' \
+ ':virtual device:->pool-devices' \
+ ':virtual device:->disk-devices'
+ ;;
+
+ zpool:checkpoint)
+ _arguments -A "-*" -S \
+ '(-d --discard)'{-d,--discard}'[discard an existing checkpoint from the pool]' \
+ '(-w --wait)'{-w,--wait}'[wait until the checkpoint has finished being discarded before returning]' \
+ ':pool:_zfs_pool'
+ ;;
+
+ zpool:clear)
+ [[ $implementation = solaris ]] && args=(
+ '-f[ignore fmadm acquit and fmadm repair failures]'
+ )
+ _arguments -C -A "-*" -S $args \
+ '-F[discard transactions to allow pool opening]' \
+ '-n[with -F, check if discarding transactions would work]' \
+ '-X[(undocumented) extreme rewind of transactions]' \
+ ':pool:_zfs_pool' \
+ '*:virtual device:->pool-devices'
+ ;;
+
+ zpool:create)
+ if [[ $implementation = openzfs ]]; then
+ args=(
+ "-d[don't enable any features on the new pool]"
+ )
+ else
+ args=(
+ '-B[create EFI boot partition on whole disks]'
+ '-l[display configuration in /dev/chassis location form]'
+ "-N[create pool but don't mount or share]"
+ )
+ fi
+ _arguments -C -A "-*" -S $args \
+ '-o+[set pool property at creation time]:property:->newpool-properties' \
+ '-O+[set dataset property at creation time]:property:->create-properties' \
+ '-f[force use of in-use devices]' \
+ '-n[display configuration without creating pool]' \
+ '-R+[use alternate root]:alternate root:_directories' \
+ '-m+[set mountpoint for root dataset]:mountpoint' \
+ '-t+[use a temporary pool name]:pool name' \
+ ':pool :_guard "^-*" "pool name"' \
+ '*: :->virtual-devices'
+ ;;
+
+ zpool:destroy)
+ _arguments -A "-*" -S \
+ '-f[force active datasets to be unmounted]' \
+ ':pool:_zfs_pool'
+ ;;
+
+ zpool:detach)
+ _arguments -C \
+ ':pool:_zfs_pool' \
+ ':virtual device:->pool-devices'
+ ;;
+
+ zpool:events)
+ _arguments -A "-*" -S \
+ '(- 1)-c[clear all previous events]' \
+ '-f[follow mode - continue running, showing new events]' \
+ '-H[suppress headers and tab-delimit fields]' \
+ '-v[print the entire payload for each event]' \
+ '(-c)1:pool:_zfs_pool'
+ ;;
+
+ zpool:export)
+ [[ $implementation = openzfs ]] && args=( '(*)-a[export all pools]' )
+ _arguments -A "-*" -S $args \
+ '-f[forcefully unmount all datasets]' \
+ '*:pool:_zfs_pool'
+ ;;
+
+ zpool:get)
+ [[ $implementation = solaris ]] && args=(
+ '-s+[specify sources to display]: :_values -s "source" local default none'
+ )
+ _arguments -A "-*" -S $args \
+ '-H[suppress headers and tab-delimit fields]' \
+ '-p[display numbers in parseable (exact) values]' \
+ '-o+[specify fields to display]: : _values -s , field name property value source' \
+ ':property:_values -s , "property" $po_propnames' \
+ '*:pool:_zfs_pool'
+ ;;
+
+ zpool:history)
+ _arguments -A "-*" -S \
+ '-i[display internal events]' \
+ '-l[long format]' \
+ '*:pool:_zfs_pool'
+ ;;
+
+ zpool:import)
+ # TODO: -o should complete mount options, too
+ if [[ $implementation = openzfs ]]; then
+ args=(
+ '-t[new pool name is temporary]'
+ '-l[request encryption keys for all encrypted datasets]'
+ '--rewind-to-checkpoint[rewind pool to the checkpointed state]'
+ '-s[scan using the default search path]'
+ '(-F -X)-T[specify the txg to use for rollback]'
+ )
+ else
+ args=(
+ '(-a)-t+[use a temporary pool name]:pool name'
+ '-l[display configuration in /dev/chassis location form]'
+ )
+ fi
+ _arguments -C -A "-*" -S $args \
+ '(1 2 -t)-a[search for and import all pools found]' \
+ '-D[destroyed pools only]' \
+ '(-d)*-c+[use cache file]:cache file:_files' \
+ '(-c -D)*-d+[search for devices or files in directory]:directory:_files -/' \
+ '-F[recovery mode: discard transactions if required]' \
+ '-X[(undocumented) extreme rewind of transactions]' \
+ '!-V' \
+ '-f[force import]' \
+ '-m[ignore missing log devices]' \
+ '-N[import pool without mounting any filesystems]' \
+ "-n[with -F; don't perform input]" \
+ '-R+[specify alternate root]:alternate root:_files -/' \
+ '-o+[set pool or dataset property]:property:->import-properties' \
+ '1:pool name or id:_zfs_pool' \
+ '2::new pool name'
+ ;;
+
+ zpool:initialize)
+ _arguments -A "-*" -S \
+ '(-s --suspend -c --cancel)'{-c,--cancel}'[cancel initializing on specified devices]' \
+ '(-s --suspend -c --cancel)'{-s,--suspend}'[suspend initializing on specified devices]' \
+ '(-w --wait)'{-w,--wait}'[wait until devices have finished initializing before returning]' \
+ ':pool:_zfs_pool' \
+ '*:device:pool-devices'
+ ;;
+
+ zpool:iostat)
+ if [[ $implementation = openzfs ]]; then
+ args=(
+ '-c[run scripts on each vdev]:script:_files -W "($ZPOOL_SCRIPTS_PATH /etc/zfs/zpool.d ~/.zpool.d)"'
+ '-g[display vdev GUIDs instead of normal device names]'
+ '-H[suppress headers and tab-delimit fields]'
+ '-L[display real paths for vdevs resolving all symbolic links]'
+ '-n[print headers only once]'
+ '-p[display numbers in parsable (exact) values and times in nanoseconds]'
+ '-P[display full paths for vdevs instead of only the last component of the path]'
+ "-r[print request size histograms for the leaf vdev's IO]"
+ '-y[omit statistics since boot]'
+ '-w[display latency histograms]'
+ '-l[include average latency statistics]'
+ '-q[include active queue statistics]'
+ )
+ else
+ args=( '-l[display configuration in /dev/chassis location form]' )
+ fi
+ _arguments -A "-*" -S $args \
+ '-T+[display a timestamp]:format:((d\:standard u\:internal))' \
+ '-v[verbose statistics]' \
+ '*::pool:_zfs_pool' \
+ '::interval' \
+ '::count'
+ ;;
+
+ zpool:label)
+ _arguments -C -A "-*" -S \
+ '(-c)*-d+[specify path in which to search for devices or files]:path:_directories' \
+ '(-d)-c+[read configuration from specified cache file]:cache file:_files' \
+ '(-R)-C[clear ZFS metadata on an inactive pool or device]' \
+ '(-C)-R[recover ZFS metadata for a pool]' \
+ '1::pool:_zfs_pool' \
+ '2:device:->pool-devices'
+ ;;
+
+ zpool:labelclear)
+ _arguments -A "-*" -S \
+ '-f[treat exported or foreign devices as inactive]' \
+ '*:virtual device:_files'
+ ;;
+
+ zpool:list)
+ [[ $implementation = openzfs ]] && args=(
+ '-g[display vdev GUIDs instead of normal device names]'
+ '-L[display real paths for vdevs resolving all symbolic links]'
+ '-p[display numbers in parsable (exact) values]'
+ '-P[display full paths for vdevs instead of only the last component of the path]'
+ '-v[report usage statistics for individual vdevs within the pool]'
+ )
+ _arguments -A "-*" -S $args \
+ '-H[suppress headers and tab-delimit fields]' \
+ '-T+[display a timestamp]:format:((d\:standard u\:internal))' \
+ '-o+[specify fields to list]: :_values -s , "field" $po_propnames' \
+ '::pool:_zfs_pool'
+ ;;
+
+ zpool:monitor)
+ _arguments -A "-*" -S \
+ '-t+[specify provider]:provider:(send receive scrub resilver ddtmigrate destroy)' \
+ '-o+[specify fields]: :_values -s , field done other pctdone pool provider speed starttime tag timeleft timestmp total' \
+ '-T+[display a timestamp]:format:((d\:standard u\:internal))' \
+ '-p[use machine-parseable output format]' \
+ '1:pool:_zfs_pool' \
+ '2:interval' \
+ '3:count'
+ ;;
+
+ zpool:offline)
+ [[ $implementation = openzfs ]] && args=(
+ '-f[force disk into faulted state]'
+ )
+ _arguments -C -A "-*" -S $args \
+ '-t[offline until next reboot]' \
+ ':pool:_zfs_pool' \
+ '*:virtual device:->pool-devices'
+ ;;
+
+ zpool:online)
+ _arguments -C -A "-*" -S \
+ '-e[expand device to use all available space]' \
+ ':pool:_zfs_pool' \
+ '*:virtual device:->pool-devices'
+ ;;
+
+ zpool:reopen)
+ _arguments -A "-*" -S \
+ "-n[don't restart an in-progress scrub operation]" \
+ '1:pool:_zfs_pool'
+ ;;
+
+ zpool:reguid)
+ _zfs_pool
+ ;;
+
+ zpool:remove)
+ [[ $implementation = openzfs ]] && args=(
+ '(-s)-w[wait until removal has completed before returning]'
+ )
+ _arguments -C -A "-*" -S $args \
+ "(-s)-n[don't perform the removal, display mapping table memory use]" \
+ '(-s)-p[with -n, display numbers in parseable (exact) values]' \
+ '(- *)-s[stop and cancel an in-progress removal]' \
+ '1:pool:_zfs_pool' \
+ '*:device:->pool-devices'
+ ;;
+
+ zpool:replace)
+ [[ $implementation = openzfs ]] && args=(
+ '-w[wait until replacement has completed before returning]'
+ '-s[reconstruct sequentially to restore redundancy as quickly as possible]'
+ '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"'
+ )
+ _arguments -A "-*" -S $args \
+ '-f[force attach, even if in use]' \
+ ':pool:_zfs_pool' \
+ ':virtual device:_files' \
+ '::virtual device:_files'
+ ;;
+
+ zpool:(resilver|sync))
+ _arguments \
+ '*:pool:_zfs_pool'
+ ;;
+
+ zpool:scrub)
+ [[ $implementation = openzfs ]] && args=(
+ '(-s)-p[pause scrubbing]'
+ '-w[wait until scrub has completed before returning]'
+ )
+ _arguments -A "-*" -S $args \
+ '(-p)-s[stop scrubbing]' \
+ '*:pool:_zfs_pool'
+ ;;
+
+ zpool:set)
+ _arguments -C -A "-*" -S \
+ ':property:->set-pool-properties' \
+ '*:pool:_zfs_pool'
+ ;;
+
+ zpool:split)
+ if [[ $implementation = solaris ]]; then
+ args=( '-l[display configuration in /dev/chassis location form]' )
+ else
+ args=(
+ '-g[display vdev GUIDs instead of normal device names]'
+ '-L[display real paths for vdevs resolving all symbolic links]'
+ '-l[request encryption keys for encrypted datasets]'
+ '-P[display full paths for vdevs instead of only the last component of the path]'
+ )
+ fi
+ _arguments -C -A "-*" -S $args \
+ '-R+[specify alternate root]:alternate root:_files -/' \
+ '-n[display configuration without splitting]' \
+ '-o+[set pool or dataset property]:property:->import-properties' \
+ ':pool name or id:_zfs_pool' \
+ ':new pool name' \
+ '*:virtual device:->pool-devices'
+ ;;
+
+ zpool:status)
+ if [[ $implementation = openzfs ]]; then
+ args=(
+ '-D[display a histogram of deduplication statistics]'
+ '-c[run scripts on each vdev]:script:_files -W "($ZPOOL_SCRIPTS_PATH /etc/zfs/zpool.d ~/.zpool.d)"'
+ '-i[display vdev initialization status]'
+ '-g[display vdev GUIDs instead of the normal device names]'
+ '-L[display real paths for vdevs resolving all symbolic links]'
+ '-p[display numbers in parsable (exact) values and times in nanoseconds]'
+ '-P[display full paths for vdevs instead of only the last component of the path]'
+ '-s[display the number of leaf VDEV slow IOs]'
+ '-t[display vdev TRIM status]'
+ )
+ else
+ args=( '-l[display configuration in /dev/chassis location form]' )
+ fi
+ _arguments -A "-*" -S $args\
+ '-v[verbose information]' \
+ '-x[show only unhealthy pools]' \
+ '-T+[display a timestamp]:format:((d\:standard u\:internal))' \
+ '*::pool:_zfs_pool' \
+ ':: :_guard "[0-9]#" interval' \
+ ':: :_guard "[0-9]#" count'
+ ;;
+
+ zpool:trim)
+ _arguments -C -A "-*" -S \
+ '(-d --secure)'{-d,--secure}'[initiate a secure TRIM]' \
+ '(-r --rate)'{-r,--rate}'[set rate at which the TRIM operation progresses]:rate (bytes per second)' \
+ '(-c --cancel)'{-c,--cancel}'[cancel trimming]' \
+ '(-s --suspend)'{-s,--suspend}'[suspend trimming]' \
+ '(-w --wait)'{-w,--wait}'[wait until devices are done being trimmed]' \
+ '1:pool:_zfs_pool' \
+ '*:device:->pool-devices'
+ ;;
+
+ zpool:upgrade)
+ _arguments -A "-*" -S \
+ '(- *)-v[display ZFS versions and descriptions]'
+ "(-v)-V+[upgrade to given version]:version" \
+ '(-v *)-a[upgrade all pools]' \
+ '(-a -v)*:pool:_zfs_pool'
+ ;;
+
+ zpool:wait)
+ _arguments -A "-*" -S \
+ '-H[suppress printing of headers, tab-delimit columns]' \
+ '-P[use exact (parsable) numeric output]' \
+ '-t+[specify background activity]: : _values -s , activity discard free initialize replace remove resilver scrub trim' \
+ '-T+[display a timestamp]:format:((d\:standard u\:internal))' \
+ ':pool:_zfs_pool' \
+ ':interval'
+ ;;
+
+ *)
+ _default
+ ;;
+esac
+
+while (( $#state )); do
+ curstate=$state
+ state=()
+ case $curstate in
+ virtual-devices)
+ local -a vdevtypes
+ vdevtypes=( mirror raidz{,1,2,3} spare log cache )
+ if [[ $implementation = openzfs ]]; then
+ vdevtypes+=( draid{,1,2,3} dedup special )
+ else
+ vdevtypes+=( meta )
+ fi
+ # cache can't be a mirror
+ [[ $words[CURRENT-1] != cache ]] && alts=(
+ 'vdev-types:vdev type:compadd -a vdevtypes'
+ )
+ [[ -prefix / ]] || alts+=(
+ 'disk-vdevs:disk vdev:_files -g "*(-%)" -W /dev'
+ )
+ _alternative $alts 'file-vdevs:file vdev:_files -W / -P /'
+ ;;
+
+ pool-devices)
+ local -a devices
+ devices=( ${${${(M)${(f)"$(_call_program devices zpool status $line[1])"}:#$'\t' *}##[[:blank:]]#}%%[[:blank:]]*} )
+ if (( $#devices )); then
+ _description devices expl "$state_descr"
+ compadd "$expl[@]" -a devices
+ break
+ fi
+ ;& # fall-through if we found none
+
+ disk-devices)
+ [[ -prefix / ]] || alts=(
+ 'disk-vdevs:disk vdev:_files -g "*(-%)" -W /dev'
+ )
+ _alternative $alts 'file-vdevs:file vdev:_files -W / -P /'
+ ;;
+
+ keysources)
+ local -a suf
+
+ compset -S ",*" || suf=(-S ,)
+ if compset -P 1 "*,"; then
+ _alternative \
+ 'zfs-keylocator-prompt:"prompt" locator:(prompt)' \
+ 'zfs-keylocator-file:file locator:_files' \
+ 'zfs-keylocator-pkcs11: : _message -e zfs-keylocator-pkcs11 "PKCS#11 locator"' \
+ 'zfs-keylocator-https: : _message -e zfs-keylocator-https "HTTPS URL locator"'
+ else
+ _description keysource-formats expl "keysource format"
+ compadd $suf -q "$expl[@]" "$@" raw hex passphrase
+ fi
+ ;;
+
+ quotas)
+ _alternative \
+ 'sizes: :_numbers -M "m:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \
+ 'properties:property:(none)'
+ ;;
+
+ import-properties) args=( $ci_ds_props $rw_ds_props $ci_po_props ) ;|
+ create-properties) args=( $ci_ds_props ) ;|
+ set-properties) args=( $rw_ds_props ) ;|
+ newpool-properties) args=( $rw_po_props $ci_po_props ) ;|
+ set-pool-properties) args=( $rw_po_props ) ;|
+
+ *-properties)
+ if compset -P 1 '(#m)*@'; then
+ if compset -P 1 '*='; then
+ case $MATCH in
+ *quota@) _alternative \
+ 'sizes: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size \:B {k,M,G,T,P,E,Z}{,B}' \
+ 'properties:property:(none)'
+ ;;
+ esac
+ else
+ case $MATCH in
+ user*@) _users -S = ;;
+ group*@) _groups -S = ;;
+ project*@) _message -e projects project ;;
+ esac
+ fi
+ else
+ _wanted values expl "$state_descr" compadd -S@ ${${(M)args:#*@}%@}
+ _values -C "$state_descr" ${args:#*@}
+ fi
+ ;;
+ esac
+done
+
+[[ nm -ne "$compstate[nmatches]" ]]
diff --git a/Completion/Unix/Command/_zip b/Completion/Unix/Command/_zip
index bc9aab1a5..cfa51be36 100644
--- a/Completion/Unix/Command/_zip
+++ b/Completion/Unix/Command/_zip
@@ -115,7 +115,7 @@ case $service in
'(-U)-UU[ignore any Unicode fields]' \
'-W[modify pattern matching so only ** matches /]' \
'-\:[allow extraction outside of extraction base directory]' \
- '-\\\^[allow control characters in extracted entries]' \
+ '-^[allow control characters in extracted entries]' \
'-i[include the following names]:*-*:pattern' \
'-x[exclude the following names]:*-*:pattern' \
"(-p -f -u -l -t -z -n -o -j -C -X -q -qq -a -aa -v -L -M)1:zip file:_files -g '(#i)*.(zip|xpi|[ejw]ar)(-.)'" \
diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool
deleted file mode 100644
index d9c2caa52..000000000
--- a/Completion/Unix/Command/_zpool
+++ /dev/null
@@ -1,311 +0,0 @@
-#compdef zpool
-# Synced with the S11U1 man page
-
-_zpool() {
- local context state line expl implementation
- local -a subcmds fields ro_props rw_props versions create_properties_dataset
-
- _pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris
-
- subcmds=(
- create destroy add remove list iostat status online
- offline clear attach detach replace scrub import export
- upgrade history get set split help
- )
-
- if [[ $implementation = openzfs ]] && [[ $OSTYPE != solaris* ]]; then
- subcmds+=( labelclear initialize )
- fi
-
- versions=(
- ${${${(M)"${(f)$(_call_program versions zpool upgrade -v)}":#[[:space:]]#<->*}##[[:space:]]}%%[[:space:]]*}
- )
-
- ro_props=(
- "all[All properties]"
- "allocated[Space allocated]"
- "capacity[Space used (percentage)]"
- "dedupratio[Deduplication ratio]"
- "free[Space unallocated]"
- "guid[Unique identifier]"
- "health[Health status]"
- "size[Total size]"
- )
-
- rw_props=(
- "altroot[Alternate root directory]:value:"
- "autoexpand[Automatic pool expansion]:value:(on off)"
- "autoreplace[Automatic device replacement]:value:(on off)"
- "bootfs[Default bootable dataset]:value:"
- "cachefile[Pool configuration cache file location]:value:"
- "dedupditto[Threshold for number of copies]:value:"
- "delegation[Delegated administration]:value:(on off)"
- "failmode[Failure-mode behavior]:value:(wait continue panic)"
- "listshares[Show shares in 'zfs list']:value:(on off)"
- "listsnaps[Show snapshots in 'zfs list']:value:(on off)"
- "readonly[Controls whether the pool can be modified]:value:(on off)"
- "version[Pool version]:version:($versions)"
- )
-
- fields=( ${ro_props%%:*} ${rw_props%%:*} )
-
- create_properties_dataset=(
- "aclinherit:value:(discard noallow restricted passthrough passthrough-x)"
- "aclmode:value:(discard mask passthrough)"
- "atime:value:(on off)"
- "canmount:value:(on off noauto)"
- "checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)"
- "compression:value:(on off lzjb gzip gzip-{1..9} zle)"
- "copies:value:(1 2 3)"
- "dedup:value:(on off verify sha256 sha256,verify)"
- "devices:value:(on off)"
- "encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)"
- "exec:value:(on off)"
- "groupquota@:value:" # TODO: complete group=size|none
- "keysource:value:_zfs_keysource_props"
- "logbias:value:(latency throughput)"
- "mlslabel:value:(none)" # TODO: list sensitivity labels
- "mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}"
- "nbmand:value:(on off)"
- "primarycache:value:(all none metadata)"
- "quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}"
- "readonly:value:(on off)"
- "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
- "refquota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refquota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refquota' compadd none; fi}"
- "refreservation:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refreservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refreservation' compadd none; fi}"
- "reservation:value:{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == reservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'reservation' compadd none; fi}"
- "rstchown:value:(on off)"
- "secondarycache:value:(all none metadata)"
- "setuid:value:(on off)"
- "shadow:value:" # TODO: complete URI|none
- "share:share properties:"
- "sharenfs:value:(on off)"
- "sharesmb:value:(on off)"
- "snapdir:value:(hidden visible)"
- "sync:value:(standard always disabled)"
- "userquota@:value:" # TODO: complete user=size|none
- "version:value:(1 2 3 4 current)"
- "volsize:value:" # <size>
- "vscan:value:(on off)"
- "xattr:value:(on off)"
- "zoned:value:(on off)"
- )
-
- if [[ $service == "zpool" ]]; then
- _arguments -C \
- '-\?[show help information]' \
- '1:subcommand:compadd -a subcmds' \
- '*:: :->subcmd' && return
-
- service="$words[1]"
- curcontext="${curcontext%:*}-$service:"
- fi
-
- case $service in
- (help)
- _arguments -A "-*" \
- - set1 \
- ':command/property:($subcmds ${fields%%\[*} properties)' \
- - set2 \
- '-l[Display property information]' \
- ': :(properties)'
- ;;
-
- (clear)
- _arguments -A "-*" \
- '-F[Discard transactions to allow pool opening]' \
- '-f[Ignore fmadm acquit and fmadm repair failures]' \
- '-n[With -F, check if discarding transactions would work]' \
- ':pool name:_zfs_pool' \
- '*:virtual device:_files'
- ;;
-
- (create)
- # TODO: investigate better vdev handling
- _arguments -A "-*" \
- '-B[Create EFI boot partition on whole disks]' \
- '-o[Set pool property at creation time]:property:_values -s , "property" $rw_props' \
- '-O[Set dataset property at creation time]:property:_values -s , "property" $create_properties_dataset' \
- '-f[Force use of in-use devices]' \
- '-l[Display configuration in /dev/chassis location form]' \
- '-n[Display configuration without creating pool]' \
- '-R[Use alternate root]:alternate root:_files -/' \
- '-m[Set mountpoint for root dataset]:mountpoint:' \
- ':pool name:' \
- '*:virtual device:_files'
- ;;
-
- (destroy)
- _arguments -A "-*" \
- '-f[Force active datasets to be unmounted]' \
- ':pool name:_zfs_pool'
- ;;
-
- (add)
- _arguments -A "-*" \
- '-f[Force use of in-use devices]' \
- '-l[Display configuration in /dev/chassis location form]' \
- '-n[Display configuration without modifying pool]' \
- ':pool name:_zfs_pool' \
- '*:virtual device:_files'
- ;;
-
- (list)
- _arguments \
- '-H[Scripted mode]' \
- '-T[timestamp]:value:(u d)' \
- '-o[Fields to list]:field:_values -s , "field" $fields' \
- '::pool name:_zfs_pool'
- ;;
-
- (initialize)
- _arguments -A "-*" \
- '(-c --cancel)'{-c,--cancel}'[cancel initializing on specified devices]' \
- '(-s --suspend)'{-s,--suspend}'[suspend initializing on specified devices]' \
- ':pool name:_zfs_pool' \
- '*:device:_files'
- ;;
-
- (iostat)
- _arguments -A "-*" \
- '-l[Display configuration in /dev/chassis location form]' \
- '-T[timestamp]:value:(u d)' \
- '-v[Verbose statistics]' \
- '*::pool name:_zfs_pool' \
- '::interval:' \
- '::count:'
- ;;
-
- (labelclear)
- _arguments -A "-*" \
- '-f[treat exported or foreign devices as inactive]' \
- '*:virtual device:_files'
- ;;
-
- (status)
- _arguments -A "-*" \
- '-l[Display configuration in /dev/chassis location form]' \
- '-v[Verbose information]' \
- '-x[Show only unhealthy pools]' \
- '-T[timestamp]:value:(u d)' \
- '*::pool name:_zfs_pool'
- ;;
-
- (offline)
- _arguments -A "-*" \
- '-t[Offline until next reboot]' \
- ':pool name:_zfs_pool' \
- '*:virtual device:_files'
- ;;
-
- (online)
- _arguments \
- '-e[Expand device to use all available space]' \
- ':pool name:_zfs_pool' \
- '*:virtual device:_files'
- ;;
-
- (attach)
- # TODO: first device should choose first from existing.
- _arguments \
- '-f[Force attach, even if in use]' \
- ':pool name:_zfs_pool' \
- ':virtual device:_files' \
- ':virtual device:_files'
- ;;
-
- (detach)
- _arguments \
- ':pool name:_zfs_pool' \
- ':virtual device:_files'
- ;;
-
- (replace)
- _arguments -A "-*" \
- '-f[Force attach, even if in use]' \
- ':pool name:_zfs_pool' \
- ':virtual device:_files' \
- '::virtual device:_files'
- ;;
-
- (scrub)
- _arguments -A "-*" \
- '-s[Stop scrubbing]' \
- '*:pool name:_zfs_pool'
- ;;
-
- (export)
- _arguments -A "-*" \
- '-f[Forcefully unmount all datasets]' \
- '*:pool name:_zfs_pool'
- ;;
-
- (import)
- # TODO: -o should complete mount options, too
- _arguments -A "-*" \
- '-D[Destroyed pools]' \
- '(-d)*-c[Use cache file]:cache file:_files' \
- '(-c -D)*-d[Search for devices or files in directory]:directory:_files -/' \
- '-F[Recovery mode: discard transactions if required]' \
- '-f[Force import]' \
- '-l[Display configuration in /dev/chassis location form]' \
- '-m[Ignore missing log devices]' \
- '-N[Import pool without mounting any filesystems]' \
- '-n[With -F; do not perform input]' \
- '-R[Alternate root]:alternate root:_files -/' \
- '-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \
- - set1 \
- '*:pool name or id:_zfs_pool' \
- '::new pool name:' \
- - set2 \
- '-N[Do not mount any filesystems]' \
- '-a[All pools]'
- ;;
-
- (get)
- _arguments -A "-*" \
- ':property:_values -s , "property" $fields' \
- '*:pool name:_zfs_pool'
- ;;
-
- (set)
- _arguments -A "-*" \
- ':property:_values -s , "property" $rw_props' \
- '*:pool name:_zfs_pool'
- ;;
-
- (split)
- _arguments -A "-*" \
- '-R[Alternate root]:alternate root:_files -/' \
- '-l[Display configuration in /dev/chassis location form]' \
- '-n[Display configuration without splitting]' \
- '-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \
- ':pool name or id:_zfs_pool' \
- ':new pool name:' \
- '*::virtual device:_files -/'
- ;;
-
- (upgrade)
- _arguments -A "-*" \
- - set1 \
- '-v[Display ZFS versions and descriptions]' \
- - set2 \
- "-V[Upgrade to given version]:version:($versions)" \
- '-a[Upgrade all pools]' \
- '*:pool name:_zfs_pool'
- ;;
-
- (history)
- _arguments -A "-*" \
- '-i[Display internal events]' \
- '-l[Long format]' \
- '*:pool name:_zfs_pool'
- ;;
-
- (*)
- _message "unknown zpool subcommand: $service"
- ;;
- esac
-}
-
-_zpool "$@"
diff --git a/Completion/Unix/Type/_bpf_filters b/Completion/Unix/Type/_bpf_filters
index 54e2172c9..b744b1ab4 100644
--- a/Completion/Unix/Type/_bpf_filters
+++ b/Completion/Unix/Type/_bpf_filters
@@ -63,7 +63,7 @@ compquote suf
# protocol or field: it is one, the other or both but not neither
_regex_arguments _bpf /$'[^\0]#\0'/ \( \
- /$'(not[ \0]#|![ \0]#|(\\\\|)\\([ \0]#)'/ ':operators:operator:(not ()' \# \
+ /$'(not[ \0]#|![ \0]#|(\\\\|)\\([ \0]#)'/ ':operators:operator:(not \()' \# \
\(\
\(\
\(\
diff --git a/Completion/Unix/Type/_date_formats b/Completion/Unix/Type/_date_formats
index 889a95779..55af7c591 100644
--- a/Completion/Unix/Type/_date_formats
+++ b/Completion/Unix/Type/_date_formats
@@ -1,6 +1,6 @@
#autoload
-local flag
+local flag ret=1
local -aU specs
local -A exclusion
@@ -106,5 +106,7 @@ for flag in ${(s..)PREFIX#%}; do
done
_describe -t date-format-specifier 'date format specifier' specs \
- -p "${(Q)PREFIX:-%}" -S ''
+ -p "${(Q)PREFIX:-%}" -S '' && ret=0
[[ $1 == zsh ]] && _message -e date-format-precision 'precision for %%. (1-9)'
+
+return ret
diff --git a/Completion/Unix/Type/_diff_options b/Completion/Unix/Type/_diff_options
index 440913dff..dfa9889f2 100644
--- a/Completion/Unix/Type/_diff_options
+++ b/Completion/Unix/Type/_diff_options
@@ -70,9 +70,7 @@ if _pick_variant -r variant -c $cmd gnu=GNU unix -v || [[ $OSTYPE = freebsd<12->
'(-E --ignore-tab-expansion)'{-E,--ignore-tab-expansion}'[ignore changes due to tab expansion]'
'(-Z --ignore-trailing-space)'{-Z,--ignore-trailing-space}'[ignore white space at line end]'
"($ofwuc $oss -F --show-function-line)"{-F+,--show-function-line=}'[show the most recent line matching regex]:regex'
- "($ofwy $ouc --width -W)"{--width=,-W+}'[set size of line]:number of characters per line'
"($ofwy $ouc)--left-column[output only left column of common lines]"
- "($ofwy $ouc)--suppress-common-lines[do not output common lines]"
"($ofwg $ouc $oss)--old-group-format=[set old group format]:old group format"
"($ofwg $ouc $oss)--new-group-format=[set new group format]:new group format"
"($ofwl $ouc $oss)--unchanged-line-format=[set unchanged line format]:unchanged line format"
@@ -80,8 +78,6 @@ if _pick_variant -r variant -c $cmd gnu=GNU unix -v || [[ $OSTYPE = freebsd<12->
'(--from-file)--to-file=[compare all operands to specified file]:to file:_files' \
'--color=-[use colors in output]::when [auto]:(never always auto)'
'--palette=[specify colors to use]:color:_diff_palette'
- "($of $ouc)--side-by-side[output in two columns]"
- "($of $ouc)-y[output in two columns]"
)
else
args+=( '!--speed-large-files' )
@@ -128,6 +124,9 @@ if _pick_variant -r variant -c $cmd gnu=GNU unix -v || [[ $OSTYPE = freebsd<12->
'(-S --starting-file)'{-S+,--starting-file=}'[set first file in comparison]:start with file:_files' \
'--horizon-lines=[set number of lines to keep in prefix and suffix]:number of horizon lines' \
'(-d --minimal)'{-d,--minimal}'[try to find a smaller set of changes]' \
+ "($of $ouc)"{-y,--side-by-side}'[output in two columns]' \
+ "($ofwy $ouc)--suppress-common-lines[don't output common lines]" \
+ "($ofwy $ouc --width -W)"{--width=,-W+}'[set size of line]:number of characters per line' \
"$@"
else
of='-c -e -f'
diff --git a/Completion/Unix/Type/_email_addresses b/Completion/Unix/Type/_email_addresses
index 8a5877a9c..d5f175a79 100644
--- a/Completion/Unix/Type/_email_addresses
+++ b/Completion/Unix/Type/_email_addresses
@@ -69,7 +69,7 @@ _email-ldap() {
fi
done
compstate[insert]=menu
- _wanted email-ldap expl 'matching names' \
+ _wanted email-ldap expl 'matching name' \
compadd -U -i "$IPREFIX" -I "$ISUFFIX" "$@" -a - ali
}
diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files
index 6adaa8154..f03b4a148 100644
--- a/Completion/Unix/Type/_files
+++ b/Completion/Unix/Type/_files
@@ -1,6 +1,7 @@
#compdef -redirect-,-default-,-default-
local -a match mbegin mend
+local -a subtree
local ret=1
# Look for glob qualifiers. This is duplicated from _path_files because
@@ -91,7 +92,10 @@ for def in "$pats[@]"; do
pat="${${sdef%%:${tag}*}//\\:/:}"
if [[ "$sdef" = *:${tag}:* ]]; then
+ # If the file-patterns spec includes a description, use it and give the
+ # group/description options from it precedence over passed in parameters.
descr="${(Q)sdef#*:${tag}:}"
+ end=
else
if (( $opts[(I)-X] )); then
descr=
@@ -107,27 +111,30 @@ for def in "$pats[@]"; do
while _next_label "$tag" expl "$descr"; do
_comp_ignore=( $_comp_ignore $ign )
if [[ -n "$end" ]]; then
- if _path_files -g "$pat" "$opts[@]" "$expl[@]"; then
- ret=0
- elif [[ $PREFIX$SUFFIX != */* ]] && zstyle -a ":completion:${curcontext}:$tag" recursive-files rfiles; then
- local subtree
- for rfile in $rfiles; do
- if [[ $PWD/ = ${~rfile} ]]; then
- if [[ -z $subtree ]]; then
- subtree=( **/*(/) )
- fi
- for prepath in $subtree; do
- oprefix=$PREFIX
- PREFIX=$prepath/$PREFIX
- _path_files -g "$pat" "$opts[@]" "$expl[@]" && ret=0
- PREFIX=$oprefix
- done
- break
- fi
- done
- fi
+ expl=( "$opts[@]" "$expl[@]" )
else
- _path_files "$expl[@]" -g "$pat" "$opts[@]" && ret=0
+ expl+=( "$opts[@]" )
+ fi
+
+ if _path_files -g "$pat" "$expl[@]"; then
+ ret=0
+ elif [[ $PREFIX$SUFFIX != */* ]] && \
+ zstyle -a ":completion:${curcontext}:$tag" recursive-files rfiles
+ then
+ for rfile in $rfiles; do
+ if [[ $PWD/ = ${~rfile} ]]; then
+ if [[ -z $subtree ]]; then
+ subtree=( **/*(/) )
+ fi
+ for prepath in $subtree; do
+ oprefix=$PREFIX
+ PREFIX=$prepath/$PREFIX
+ _path_files -g "$pat" "$expl[@]" && ret=0
+ PREFIX=$oprefix
+ done
+ break
+ fi
+ done
fi
done
(( ret )) || break
diff --git a/Completion/Unix/Type/_find_net_interfaces b/Completion/Unix/Type/_find_net_interfaces
index 3f5db6b9a..06238b11c 100644
--- a/Completion/Unix/Type/_find_net_interfaces
+++ b/Completion/Unix/Type/_find_net_interfaces
@@ -22,11 +22,17 @@ case $OSTYPE in
darwin*|freebsd*|dragonfly*) net_intf_list=( $(ifconfig -l) ) ;;
irix*) net_intf_list=( ${${${(f)"$(/usr/etc/netstat -i)"}%% *}[2,-1]} ) ;;
*)
- # linux's deprecated ifconfig may truncate long interface names
- net_intf_list=( $(_call_program interfaces "ifconfig -a 2>/dev/null | sed -n 's/^\([^ :]*\).*/\1/p'") )
+ if (( $+commands[ip] )); then
+ # if ip is available, we can also show altnames
+ net_intf_list=( $(_call_program interfaces "ip link | sed -ne 's/^[0-9]\+: \([^:@]\+\).*/\1/p;t; s/^[\ ]\+altname \(.\+\)\$/\1/p'") )
+ else
+ # linux's deprecated ifconfig may truncate long interface names
+ net_intf_list=( $(_call_program interfaces "ifconfig -a 2>/dev/null | sed -n 's/^\([^ :]*\).*/\1/p'") )
+ fi
+
if (( ${#net_intf_list} == 0 )) && [[ -d /proc/sys/net/ipv4/conf ]]; then
# On linux we used to use the following as the default, without /sys/class/net/*.
- # However, we now use ifconfig since it finds additional devices such
+ # However, we now use ip or ifconfig since it finds additional devices such
# as tunnels. So only do this if that didn't work.
typeset -gU net_intf_list
net_intf_list=( /proc/sys/net/ipv4/conf/*~*(all|default)(N:t) /sys/class/net/*(N:t) )
diff --git a/Completion/Unix/Type/_path_commands b/Completion/Unix/Type/_path_commands
index 66795ae0f..4d5a6c5af 100644
--- a/Completion/Unix/Type/_path_commands
+++ b/Completion/Unix/Type/_path_commands
@@ -87,18 +87,19 @@ fi
# 'if' block move up to the "_command_names -" branch of _command_names?
if [[ -o path_dirs ]]; then
local -a path_dirs
- path_dirs=(${^path}/*(/N:t))
- (( ${#path_dirs} )) &&
- _wanted path-dirs expl 'directory in path' compadd "$@" -a path_dirs && ret=0
if [[ $PREFIX$SUFFIX = */* ]]; then
+ path_dirs=( ${path:#.} )
# Find command from path, not hashed
- _wanted commands expl 'external command' _path_files -W path -g '*(*)' &&
- ret=0
+ _wanted commands expl 'external command' _path_files -W path_dirs -g '*(-*)' && ret=0
+ else
+ path_dirs=(${^path}/*(/N:t))
+ (( ${#path_dirs} )) &&
+ _wanted path-dirs expl 'directory in path' compadd "$@" -S / -a path_dirs && ret=0
fi
fi
-return $ret
+return ret
}
_path_commands "$@"
diff --git a/Completion/Unix/Type/_perl_modules b/Completion/Unix/Type/_perl_modules
index d27a7f7af..3e11de9ea 100644
--- a/Completion/Unix/Type/_perl_modules
+++ b/Completion/Unix/Type/_perl_modules
@@ -60,10 +60,11 @@ _perl_modules () {
with_pod=_with_pod
fi
- local perl=${words[1]%doc} perl_modules
- if whence $perl >/dev/null; then
+ local perl perl_modules
+ if [[ $service == (perl|perldoc) ]] && whence -- ${${(Q)words[1]}%doc} >/dev/null; then
+ perl=$_
perl_modules=_${${perl//[^[:alnum:]]/_}#_}_modules$with_pod
- elif (( ${+commands[perl]} )); then
+ elif whence perl > /dev/null; then
perl=perl
perl_modules=_perl_modules$with_pod
else
@@ -81,8 +82,8 @@ _perl_modules () {
else
local inc libdir new_pms
- if [[ ${+perl} -eq 1 ]]; then
- inc=( $( $perl -e 'print "@INC"' ) )
+ if [[ -n $perl ]]; then
+ inc=( $( _call_program perl-inc ${(q)perl}$' -e \'print "@INC"\'' ) )
else
# If perl isn't there, one wonders why the user's trying to
# complete Perl modules. Maybe her $path is wrong?
diff --git a/Completion/Unix/Type/_pgids b/Completion/Unix/Type/_pgids
new file mode 100644
index 000000000..25d0c4af0
--- /dev/null
+++ b/Completion/Unix/Type/_pgids
@@ -0,0 +1,5 @@
+#autoload
+
+local expl
+
+_wanted pgids expl 'process group ID' compadd "$@" - ${(un)$(_call_program pgids ps -A -o pgid=)}
diff --git a/Completion/Unix/Type/_remote_files b/Completion/Unix/Type/_remote_files
index 3fa5779c8..93e1b7f43 100644
--- a/Completion/Unix/Type/_remote_files
+++ b/Completion/Unix/Type/_remote_files
@@ -4,13 +4,16 @@
# key-based authentication with no passwords or a running ssh-agent to work.
#
# Usage:
-# _remote_files [-/] [-g glob] [-h host] -- <cmd> [<cmd options>]
+# _remote_files [-/] [-g glob] [-h host] [-W dir] -- <cmd> [<cmd options>]
#
# Options:
# - -/: only complete directories
# - -g: specify a pattern to match against files
# p, = and * glob qualifiers supported
# - -h: specify the remote host, default is ${IPREFIX%:}
+# - -W: specify the parent directory to list files from,
+# default is the home directory
+#
#
# Commands:
# - ssh: Additional options for non-interactive use are automatically added
@@ -30,12 +33,12 @@
# There should be coloring based on all the different ls -F classifiers.
local expl rempat remfiles remdispf remdispd args cmd suf ret=1
local -a args cmd_args
-local glob host
+local glob host dir dirprefix
if zstyle -T ":completion:${curcontext}:files" remote-access; then
# Parse options to _remote_files. Stops at the first "--".
- zparseopts -D -E -a args / g:=glob h:=host
+ zparseopts -D -E -a args / g:=glob h:=host W:=dir
(( $#host)) && shift host || host="${IPREFIX%:}"
args=( ${argv[1,(i)--]} )
@@ -53,9 +56,13 @@ if zstyle -T ":completion:${curcontext}:files" remote-access; then
cmd_args=( "$@" )
fi
+ if (( $#dir )); then
+ dirprefix=${dir}/
+ fi
+
if [[ -z $QIPREFIX ]]
- then rempat="${PREFIX%%[^./][^/]#}\*"
- else rempat="${(q)PREFIX%%[^./][^/]#}\*"
+ then rempat="${dirprefix}${PREFIX%%[^./][^/]#}\*"
+ else rempat="${dirprefix}${(q)PREFIX%%[^./][^/]#}\*"
fi
# remote filenames
@@ -78,12 +85,15 @@ if zstyle -T ":completion:${curcontext}:files" remote-access; then
remdispf=( ${(M)remdispf:#${~glob[2]}} )
fi
+ local -a autoremove
+ [[ -o autoremoveslash ]] && autoremove=(-r "/ \t\n\-")
+
_tags remote-files
while _tags; do
while _next_label remote-files expl ${suf:-remote directory}; do
[[ -n $suf ]] &&
compadd "$args[@]" "$expl[@]" -d remdispf -- ${(q)remdispf%[*=|]} && ret=0
- compadd ${suf:+-S/} -r "/ \t\n\-" "$args[@]" "$expl[@]" -d remdispd \
+ compadd ${suf:+-S/} $autoremove "$args[@]" "$expl[@]" -d remdispd \
-- ${(q)remdispd%/} && ret=0
done
(( ret )) || return 0
diff --git a/Completion/Unix/Type/_ssh_hosts b/Completion/Unix/Type/_ssh_hosts
index e20142cfd..a4a08ad91 100644
--- a/Completion/Unix/Type/_ssh_hosts
+++ b/Completion/Unix/Type/_ssh_hosts
@@ -19,11 +19,24 @@ fi
if [[ -r $config ]]; then
local key line host
local -a lines=("${(@f)$(<"$config")}") 2>/dev/null
- while (($#lines)); do
- IFS=$'=\t ' read -r key line <<<"${lines[1]}"
+ local -a match_args
+ local idx=1
+ while (( idx <= $#lines )); do
+ IFS=$'=\t ' read -r key line <<<"${lines[idx]}"
+ if [[ "$key" == ((#i)match) ]]; then
+ match_args=(${(z)line})
+ while [[ $#match_args -ge 2 ]]; do
+ if [[ "${match_args[1]}" == (#i)(canonical|final|(|original)host) ]]; then
+ key="Host"
+ line="${match_args[2]//,/ }"
+ break
+ fi
+ shift 2 match_args
+ done
+ fi
case "$key" in
((#i)include)
- lines[1]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;;
+ lines[idx]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;;
((#i)host(|name))
for host in ${(z)line}; do
case $host in
@@ -31,7 +44,7 @@ if [[ -r $config ]]; then
(*) config_hosts+=("$host") ;;
esac
done ;&
- (*) shift lines;;
+ (*) (( ++idx ));;
esac
done
if (( ${#config_hosts} )); then
diff --git a/Completion/Unix/Type/_tar_archive b/Completion/Unix/Type/_tar_archive
index e8ddb1e59..bc49c4a3a 100644
--- a/Completion/Unix/Type/_tar_archive
+++ b/Completion/Unix/Type/_tar_archive
@@ -20,8 +20,10 @@ if [[ "$1" = *[urtx]* ]]; then
_files "$expl[@]" -g '*.(tar|TAR).bz2(-.)'
elif [[ "$1" = *J* ]]; then
_files "$expl[@]" -g '*.(tar|TAR).(lzma|xz)(-.)'
- elif [[ "$_cmd_variant[$service]" == (gnu|libarchive) ]]; then
- _files "$expl[@]" -g '*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|)|(tbz|tgz|txz))(-.)'
+ elif [[ "$_cmd_variant[$service]" == gnu ]]; then
+ _files "$expl[@]" -g '*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|.zst|lzo|)|(tbz|tgz|txz|tzst|taz|taZ|tz2|tbz2|tlz))(-.)'
+ elif [[ "$_cmd_variant[$service]" == libarchive ]]; then
+ _files "$expl[@]" -g '*.((tar|TAR|cpio)(.gz|.GZ|.Z|.bz2|.lzma|.xz|.zst|lzo|)|(tbz|tgz|txz|tzst|tzo|taz|tbz2|tz2|tlz|tZ|7z|ar|iso|deb|cab|lha|mtree|rar|warc|xar|zip))(-.)'
else
_files "$expl[@]" -g '*.(tar|TAR)(-.)'
fi
diff --git a/Completion/Unix/Type/_time_zone b/Completion/Unix/Type/_time_zone
index cd924bbc7..c437252a8 100644
--- a/Completion/Unix/Type/_time_zone
+++ b/Completion/Unix/Type/_time_zone
@@ -6,4 +6,4 @@ if (( ! $+_zoneinfo_dirs )); then
_zoneinfo_dirs=( /usr/{share,lib,share/lib}/{zoneinfo*,locale/TZ}(/) )
fi
-_wanted time-zones expl 'time zone' _files -W _zoneinfo_dirs "$@" -
+_wanted time-zones expl 'time zone' _files -g '[A-Z]*' -W _zoneinfo_dirs "$@" -
diff --git a/Completion/Unix/Type/_urls b/Completion/Unix/Type/_urls
index 5d4990442..f9cdd58cd 100644
--- a/Completion/Unix/Type/_urls
+++ b/Completion/Unix/Type/_urls
@@ -103,7 +103,7 @@ case "$scheme" in
bookmark)
if [[ -f "$urls/$scheme/${(Q)PREFIX}${(Q)SUFFIX}" &&
-s "$urls/$scheme/${(Q)PREFIX}${(Q)SUFFIX}" ]]; then
- _wanted -C bookmark bookmarks expl bookmarks \
+ _wanted -C bookmark bookmarks expl bookmark \
compadd "$@" -U - \
"$ipre$(<"$urls/$scheme/${(Q)PREFIX}${(Q)SUFFIX}")" && ret=0
else
diff --git a/Completion/Unix/Type/_zfs_dataset b/Completion/Unix/Type/_zfs_dataset
index 6bef04e45..7edcfd5d7 100644
--- a/Completion/Unix/Type/_zfs_dataset
+++ b/Completion/Unix/Type/_zfs_dataset
@@ -11,10 +11,12 @@ local expl_type
# -t takes arguments (what kinds of datasets) and can appear multiple times
zparseopts -D -E e:=expl_type_arr p=paths_allowed r1=rsrc r2=rdst t+:=type
-[[ -n $type[(r)fs] ]] && typearg=( filesystem )
-[[ -n $type[(r)vol] ]] && typearg=( $typearg volume )
-[[ -n $type[(r)snap] ]] && typearg=( $typearg snapshot )
-[[ -n $type[(r)share] ]] && typearg=( $typearg share )
+[[ -n $type[(r)fs] ]] && typearg=( filesystem )
+[[ -n $type[(r)vol] ]] && typearg+=( volume )
+[[ -n $type[(r)snap] ]] && typearg+=( snapshot )
+[[ -n $type[(r)share] && $implementation = solaris ]] && typearg+=( share )
+[[ -n $type[(r)bookmark] && $implementation = openzfs ]] &&
+ typearg+=( bookmark )
if [[ -n $typearg ]]; then
typearg=( -t ${(j:,:)typearg} )
# We know we're in zfs list if paths_allowed is non-empty.
@@ -58,14 +60,14 @@ if [[ ${#rdst} -gt 0 ]]; then
fi
if [[ -n $type[(r)clone] ]]; then
- datasetlist=( ${="$(zfs list -H -o name,origin -t filesystem 2>/dev/null | awk "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} )
+ datasetlist=( ${(f)"$(zfs list -H -o name,origin -t filesystem 2>/dev/null | awk -F$'\t' "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} )
else
- datasetlist=( ${="$(zfs list -H -o name $typearg 2>/dev/null)":#no datasets available} )
+ datasetlist=( ${(f)"$(zfs list -H -o name $typearg 2>/dev/null)":#no datasets available} )
fi
expl_type=${typearg[2,-1]//,/\/}
if [[ -n $type[(r)mtpt] ]]; then
- mlist=( ${="$(zfs list -H -o mountpoint $typearg 2>/dev/null)":#no mountpoints available} )
+ mlist=( ${(f)"$(zfs list -H -o mountpoint $typearg 2>/dev/null)":#no mountpoints available} )
datasetlist=( $datasetlist $mlist )
expl_type="$expl_type/mountpoint"
fi
@@ -74,4 +76,5 @@ if [[ -n $expl_type_arr[2] ]]; then
expl_type=$expl_type_arr[2]
fi
-_wanted dataset expl "$expl_type" _multi_parts "$@" -q / datasetlist
+_description datasets expl "$expl_type"
+_multi_parts "$@" "$expl[@]" -q / datasetlist
diff --git a/Completion/Unix/Type/_zfs_keysource_props b/Completion/Unix/Type/_zfs_keysource_props
deleted file mode 100644
index 01f63257a..000000000
--- a/Completion/Unix/Type/_zfs_keysource_props
+++ /dev/null
@@ -1,15 +0,0 @@
-#autoload
-
-local -a suf
-local expl
-
-compset -S ",*" || suf=(-S ,)
-if compset -P 1 "*,"; then
- _alternative "zfs-keylocator-prompt:\"prompt\" locator:(prompt)" \
- "zfs-keylocator-file:file locator:_path_files" \
- "zfs-keylocator-pkcs11:PKCS#11 locator: " \
- "zfs-keylocator-https:HTTPS URL locator: "
-else
- _description format expl "keysource format"
- compadd $suf -q "$expl[@]" "$@" raw hex passphrase
-fi
diff --git a/Completion/X/Command/_code b/Completion/X/Command/_code
index b725b2a17..76cd3dd19 100644
--- a/Completion/X/Command/_code
+++ b/Completion/X/Command/_code
@@ -4,7 +4,7 @@ local arguments
arguments=(
'(-d --diff)'{-d,--diff}'[compare two files with each other]:file to compare:_files:file to compare with:_files'
- \*{-a,--add}'[add specified directory to the last active window.]:directory:_directories'
+ \*{-a,--add}'[add specified directory to the last active window]:directory:_directories'
'(-g --goto)'{-g,--goto}'[open a file at the path on the specified line and column position]:file\:line[\:column]:_files -r \:'
'(-n --new-window -r --reuse-window)'{-n,--new-window}'[open a new window]'
'(-n --new-window -r --reuse-window)'{-r,--reuse-window}'[open a file or directory in the last active window]'
diff --git a/Completion/X/Command/_gnome-gv b/Completion/X/Command/_gnome-gv
index 25de6fadf..b1b66e2a4 100644
--- a/Completion/X/Command/_gnome-gv
+++ b/Completion/X/Command/_gnome-gv
@@ -1,6 +1,6 @@
#compdef gnome-gv ggv
_arguments \
- '(--help)-\\?[help]' \
+ '(--help)-?[help]' \
'(--windows)-w[number of empty windows]:number:' \
'*:file: _pspdf -z' --
diff --git a/Completion/X/Command/_gv b/Completion/X/Command/_gv
index cde8a1c1a..9b11ad31c 100644
--- a/Completion/X/Command/_gv
+++ b/Completion/X/Command/_gv
@@ -28,8 +28,11 @@ _arguments \
'(--portrait --seascape --upsidedown)--landscape' \
'(--portrait --landscape --upsidedown)--seascape' \
'(--portrait --landscape --seascape)--upsidedown' \
- --{help,spartan} \
-{h,v} \
+ -{,-}{help,version} \
+ -{,-}{spartan,widgetless,presentation,fullscreen} \
+ -{,-}{infoSilent,infoErrors,infoAll} \
+ -{,-}'password=:password:' \
'--arguments=:ghostscript arguments:' \
'--page=:label of first page:' \
'--media=:page size:(Letter Legal Statement Tabloid Ledger Folio Quarto 10x14 Executive A3 A4 A5 B4 B5)' \
diff --git a/Completion/X/Command/_kdeconnect b/Completion/X/Command/_kdeconnect
index ffb7f5774..ee186690c 100644
--- a/Completion/X/Command/_kdeconnect
+++ b/Completion/X/Command/_kdeconnect
@@ -10,7 +10,7 @@ _arguments \
'--id-only[make --list-devices or --list-available print only the devices id, to ease scripting]' \
'--refresh[search for devices in the network and re-establish connections]' \
'(--pair --unpair)--pair[request pairing with the specified device]' \
- '--ring[find the device by ringing it.]' \
+ '--ring[find the device by ringing it]' \
'(--pair --unpair)--unpair[stop pairing to the specified device]' \
'(--ping --ping-msg)--ping[send a ping to the device]' \
'(--ping --ping-msg)--ping-msg[send a ping to the device with the specified message]:message' \
diff --git a/Completion/X/Command/_mozilla b/Completion/X/Command/_mozilla
index 64f4d9450..0be25b8d3 100644
--- a/Completion/X/Command/_mozilla
+++ b/Completion/X/Command/_mozilla
@@ -95,7 +95,7 @@ if [[ "$state" = "remote" ]]; then
;;
*)
compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}"
- _wanted commands expl 'remote commands' \
+ _wanted commands expl 'remote command' \
compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \
remote_commands && ret=0
;;
diff --git a/Completion/X/Command/_mplayer b/Completion/X/Command/_mplayer
index a913960fe..1f99a1789 100644
--- a/Completion/X/Command/_mplayer
+++ b/Completion/X/Command/_mplayer
@@ -131,13 +131,13 @@ case "$state" in
;;
audio-drivers)
vals=( help ${${${(f)"$(_call_program audio-drivers mplayer -ao help 2>/dev/null)"}[(r) *,-1]#?}/ /:} )
- _describe -t audio-drivers 'audio drivers' vals && ret=0
+ _describe -t audio-drivers 'audio driver' vals && ret=0
;;
audio-codec-families)
compset -P '*,'
compset -S ',*'
vals=( help ${${${(f)"$(_call_program audio-codec-families mplayer -afm help 2>/dev/null)"}[(r) [^:]#,-1]## ##}/ ##/:} )
- _describe -t audio-codec-families 'audio drivers' vals && ret=0
+ _describe -t audio-codec-families 'audio driver' vals && ret=0
;;
audio-plugins)
_values -s : 'audio output plugin' \
@@ -154,7 +154,7 @@ case "$state" in
;;
video-drivers)
vals=( help ${${${(f)"$(_call_program video-drivers mplayer -vo help 2>/dev/null)"}[(r) *,-1]#?}/ /:} )
- _describe -t video-drivers 'video drivers' vals && ret=0
+ _describe -t video-drivers 'video driver' vals && ret=0
;;
video-output-plugins)
vals=( help ${${${${(f)"$(_call_program video-output-plugins mplayer -vop help 2>/dev/null)"}[(r) *,-1]}/ /}/ #: /:} )
diff --git a/Completion/X/Command/_netscape b/Completion/X/Command/_netscape
index e1d02ae90..78b2da649 100644
--- a/Completion/X/Command/_netscape
+++ b/Completion/X/Command/_netscape
@@ -52,7 +52,7 @@ if [[ "$state" = "remote" ]]; then
;;
*)
compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}"
- _wanted commands expl 'remote commands' \
+ _wanted commands expl 'remote command' \
compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \
remote_commands && ret=0
;;
diff --git a/Completion/X/Command/_pdftk b/Completion/X/Command/_pdftk
index b8c43f754..b26deb15f 100644
--- a/Completion/X/Command/_pdftk
+++ b/Completion/X/Command/_pdftk
@@ -24,7 +24,7 @@ case $words[CURRENT-1] in
(allow)
#_description permissions expl "permission"
#compadd $expl \
- _values -s , permissions \
+ _values -s , permission \
Printing DegradedPrinting ModifyContents Assembly CopyContents \
ScreenReaders ModifyAnnotations FillIn AllFeatures
;;
@@ -34,13 +34,11 @@ case $words[CURRENT-1] in
;;
(fill_form)
- _description files expl 'FDF and XFDF files'
- _files "$@" $expl -g '(#i)*.(fdf|xfdf)'
+ _wanted files expl 'FDF or XFDF file' _files -g '(#i)*.(fdf|xfdf)(-.)'
;;
((multibackground|background|stamp|multistamp|output))
- _description files expl 'PDF files'
- _files "$@" $expl -g '(#i)*.pdf'
+ _pdf
;;
(update_info)
@@ -53,11 +51,11 @@ case $words[CURRENT-1] in
esac && return 0
if [[ -n $words[(r)(${(j:|:)operations})] ]]; then
- _description options expl "options"
+ _description options expl "option"
compadd $@ $expl $opts
else
_tags files operations
_alternative \
- 'files:PDF files:_pdfwithhandle' \
- "operations:operations:($operations)"
+ 'files:PDF file:_pdfwithhandle' \
+ "operations:operation:($operations)"
fi
diff --git a/Completion/X/Command/_sublimetext b/Completion/X/Command/_sublimetext
index 1243d2779..5382e5dbc 100644
--- a/Completion/X/Command/_sublimetext
+++ b/Completion/X/Command/_sublimetext
@@ -8,6 +8,8 @@ _arguments -s -S : \
'(-a -n --add --new-window)'{-n,--new-window}'[open new window]' \
'--project[load specified project]:project file:_files' \
'(-s --stay)'{-s,--stay}'[keep application activated]' \
+ '--safe-mode[launch using sandboxed (clean) environment]' \
+ '--launch-or-new-window[only open new window if application is open]' \
'(: -)'{-v,--version}'[display version information]' \
'(-w --wait)'{-w,--wait}'[wait for files to close]' \
'*:file or directory:_files'
diff --git a/Completion/X/Command/_urxvt b/Completion/X/Command/_urxvt
index 661897c3a..2d7c09579 100644
--- a/Completion/X/Command/_urxvt
+++ b/Completion/X/Command/_urxvt
@@ -43,8 +43,8 @@ _x_arguments \
'-sl:save lines' \
'-embed:window id to embed terminal in:_x_window' \
'-pty-fd:file descriptor of pty to use' \
- '-w:external border in pixels' \
- '-b:internal border in pixels' \
+ {-bw,-w}':external border (pixels)' \
+ '-b:internal border (pixels)' \
'-lsp:number of extra pixels between rows' \
'-letsp:letter spacing adjustment' \
'-mod:meta modifier:_x_modifier' \
diff --git a/Completion/X/Command/_vnc b/Completion/X/Command/_vnc
index d60616f21..7d818cfe7 100644
--- a/Completion/X/Command/_vnc
+++ b/Completion/X/Command/_vnc
@@ -65,10 +65,10 @@ case $service in
'-rfbauth[use authentication on RFB protocol]:passwd-file:_files' \
'-httpd[serve files via HTTP from here]:dir:_files -/' \
'-httpport[port for HTTP]:port:' \
- '-deferupdate[time in ms to defer updates (default 40)]:time (ms):' \
+ '-deferupdate[specify time to defer updates by]:time (ms) [40]' \
'-economictranslate[less memory-hungry translation]' \
'-lazytight[disable "gradient" filter in tight encoding]' \
- '-desktop[VNC desktop name (default x11)]:name:' \
+ '-desktop[specify VNC desktop name]:name [x11]' \
'-alwaysshared[always treat new clients as shared]' \
'-nevershared[never treat new clients as shared]' \
"-dontdisconnect[don't disconnect existing clients for new non-shared connections]" \
@@ -86,7 +86,7 @@ case $service in
;;
*vncviewer)
_xt_arguments -shared -viewonly -fullscreen -bgr233 -owncmap -truecolour \
- '-encodings:encodings:_values -s " " encoding copyrect hextile corre rre raw' \
+ '-encodings: :_values -s " " encoding copyrect hextile corre rre raw' \
'-depth:depth' \
'-passwd:file:_files' \
'(1)-listen:display number' \
diff --git a/Completion/X/Command/_xauth b/Completion/X/Command/_xauth
index 14dfc8400..22ebffecd 100644
--- a/Completion/X/Command/_xauth
+++ b/Completion/X/Command/_xauth
@@ -41,7 +41,7 @@ while [[ -n "$state" ]]; do
group) _message -e ids 'group-id';;
data) _message -e values 'hexdata';;
*)
- _wanted options expl 'xauth generate options' \
+ _wanted options expl 'xauth generate option' \
compadd trusted untrusted timeout group data && ret=0
;;
esac
diff --git a/Completion/X/Command/_xdvi b/Completion/X/Command/_xdvi
index d55c99485..c33e67bcc 100644
--- a/Completion/X/Command/_xdvi
+++ b/Completion/X/Command/_xdvi
@@ -9,7 +9,7 @@ _xt_arguments \
'-cr:cursor color:_x_color' \
'-debug:debugging bitmask:((1\:bitmaps 2\:dvi\ translation 4\:pk\ reading 8\:batch\ operation 16\:events 32\:file\ opening 64\:PostScript\ communication 128\:Kpathsea\ statistics 256\:Kpathsea\ hash\ table\ lookups 512\:Kpathsea\ path\ definitions 1024\:Kpathsea\ path\ expansion 2048\:Kpathsea\ searches))' \
'-density:font shrink density' \
- '-gamma:anti-aliasing factor (default 1.0)' \
+ '-gamma:anti-aliasing factor [1.0]' \
-grid{1,2,3}':grid color:_x_color' \
'-gspalette:Ghostscript palette:(Color Greyscale Monochrome)' \
'-hl:page highlight color:_x_color' \
diff --git a/Completion/X/Command/_xinput b/Completion/X/Command/_xinput
new file mode 100644
index 000000000..2bbadd65a
--- /dev/null
+++ b/Completion/X/Command/_xinput
@@ -0,0 +1,139 @@
+#compdef xinput
+
+local curcontext="$curcontext" xinput=${words[1]} desc subcmd out ret=1
+local match mbegin mend
+local -a state state_descr line args cmds ids names disp expl
+local -A opt_args
+
+cmds=(
+ 'get-feedbacks:display device feedbacks'
+ 'set-ptr-feedback:change pointer acceleration (or feedback) parameters '
+ 'set-integer-feedback:change value of an integer device feedback'
+ 'get-button-map:get the button mapping of a device'
+ 'set-button-map:change the button mapping of a device'
+ set-pointer
+ "set-mode:set a device's mode"
+ 'list:list input devices or device features'
+ "query-state:query a device's state"
+ 'test:perpetual display of extended events from a device'
+ 'create-master:create a new pair of master devices on an XI2-enabled server'
+ 'remove-master:remove a master and its paired master device'
+ 'reattach:reattach a slave to a master'
+ 'float:remove a slave from its current master device'
+ 'set-cp:set the ClientPointer for the client owning window to master'
+ 'test-xi2:perpetual display of XI2 events'
+ 'map-to-output:restrict movements of the absolute device to an RandR crtc'
+ 'list-props:list properties that can be set for a device'
+ set-int-prop set-float-prop set-atom-prop
+ 'watch-props:perpetual display of property changes'
+ 'delete-prop:delete a property from a device'
+ 'set-prop:set a property to a given value'
+ 'disable:disable a device'
+ 'enable:enable a device'
+ 'help:display usage information'
+ 'version:display version information for program and server'
+)
+
+if (( CURRENT == 2 )); then
+ if [[ -prefix - ]]; then
+ cmds=( --$^cmds )
+ desc=option
+ else
+ desc=command
+ fi
+ _describe -t ${desc}s $desc cmds -M 'r:|-=* r:|=*'
+ return
+fi
+
+subcmd=${words[2]#--}
+curcontext="${curcontext%:*}-$subcmd:"
+
+args=( '1:device:->devices' )
+case $subcmd in
+ (set|delete)-*prop) args+=( '2:property:->properties' ) ;|
+ set-*prop) args+=( '*:value' ) ;|
+ set-ptr-feedback) args+=( '2:threshold' '3:num' '4:denom' ) ;;
+ set-integer-feedback) args+=( '2:feedback id' '3:value' ) ;;
+ set-button-map)
+ args+=( '*:::button mapping:compadd -F words -o numeric {1..12}' )
+ ;;
+ set-pointer) args+=( '2:x index' '3:y index' ) ;;
+ set-mode) args+=( '2:mode:(ABSOLUTE RELATIVE)' ) ;;
+ list) args+=( '(-)--short' '(-)--long' '(-)--name-only' '(-)--id-only' ) ;;
+ test) args+=( '-proximity' ) ;;
+ create-master)
+ args=(
+ '1:prefix'
+ '2:send core events [1]:((0\:false 1\:true))'
+ '3:enable [1]:((0\:false 1\:true))'
+ )
+ ;;
+ remove-master)
+ args=(
+ '1:master:->devices'
+ '2:slave setting:(Floating AttachToMaster)'
+ '3:pointer master:->devices'
+ '4:keyboard master:->devices'
+ )
+ ;;
+ reattach) args=( '1:slave:->devices' '2:master:->devices' ) ;;
+ float) args=( '1:slave:->devices' ) ;;
+ set-cp) args=( '1:window:_x_window' '2:device:->devices' ) ;;
+ test-xi2) args+=( '--root[select events on the root window only]' ) ;;
+ map-to-output) args+=( '2:output:->outputs' ) ;;
+ list-props) args=( '*:device:->devices' ) ;;
+ set-int-prop) args+=( '3:format:compadd -o numeric 8 16 32' ) ;;
+ set-prop)
+ args+=(
+ '--type=-:type:(atom float int)'
+ '--format=-:format:compadd -o numeric 8 16 32'
+ )
+ ;;
+ help|version) _message 'no more arguments'; return 1 ;;
+esac
+
+shift words
+(( CURRENT-- ))
+_arguments -C -A "-*" $args && ret=0
+
+case $state in
+ devices)
+ _description input-devices expl $state_descr
+
+ ids=( ${${(f)"$(_call_program input-devices $xinput list --id-only)"}#? } )
+ names=( ${${(f)"$(_call_program input-devices $xinput list --name-only)"}#? } )
+ disp=( ${(f)"$(_call_program input-devices $xinput list --short)"} )
+
+ if [[ $PREFIX$SUFFIX = [^-]*[^0-9]* ]]; then
+ # match based on the names but insert IDs
+ compadd "$expl[@]" -M 'b:=* m:{[:lower:]}={[:upper:]}' -D ids -D disp -a names
+ compadd "$expl[@]" -U -ld disp -a ids && ret=0
+
+ zstyle -s ":completion:${curcontext}:input-devices" insert-ids out || out=menu
+ case "$out" in
+ menu) compstate[insert]=menu ;;
+ single) [[ $#ids -ne 1 && $compstate[insert] != menu ]] &&
+ compstate[insert]= ;;
+ *) [[ ${#:-$PREFIX$SUFFIX} -gt ${#compstate[unambiguous]} ]] &&
+ compstate[insert]=menu ;;
+ esac
+ else
+ compadd "$expl[@]" -M 'B:0=' -o nosort -ld disp -a ids && ret=0
+ fi
+ ;;
+ properties)
+ _description input-properties expl 'property'
+ disp=( ${${${${(M)${(f)"$(_call_program input-properties
+ $xinput list-props $line[1]
+ )"}:#[[:blank:]]*}##[[:blank:]]#}%%:*}:/(#b)(*) \((<->)\)/$match[2]:$match[1]}
+ )
+ _describe -t input-properties $state_descr disp -o numeric && ret=0
+ ;;
+ outputs)
+ _description outputs expl 'output'
+ compadd "$expl[@]" - ${${(M)${(f)"$(_call_program outputs
+ xrandr)"}:#* connected*}%% *} && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/X/Command/_xournal b/Completion/X/Command/_xournal
index 066ef55f5..c36210c26 100644
--- a/Completion/X/Command/_xournal
+++ b/Completion/X/Command/_xournal
@@ -2,5 +2,5 @@
local expl
-_description files expl 'PDF and Xournal files'
+_description files expl 'PDF or Xournal file'
_files "$@" "$expl[@]" -g '*.(#i){xoj,pdf}(-.)'
diff --git a/Completion/X/Command/_xrandr b/Completion/X/Command/_xrandr
index 67045b33d..2551e1958 100644
--- a/Completion/X/Command/_xrandr
+++ b/Completion/X/Command/_xrandr
@@ -1,6 +1,6 @@
#compdef xrandr
-local curcontext="$curcontext" state line expl
+local curcontext="$curcontext" state line expl state_descr
typeset -A opt_args
_arguments -C \
@@ -36,6 +36,7 @@ _arguments -C \
'*--set:property:(Backlight scaling\ mode):value:->value' \
'*--scale:output scaling:' \
'*--transform:transformation matrix:' \
+ '*--filter:mode:(nearest bilinear)' \
'*--off[disable the output]' \
'*--crtc:crtc to use:' \
'*--panning:panning:' \
@@ -47,8 +48,8 @@ _arguments -C \
"*--addmode:output:->outputs:name" \
"*--delmode:output:->outputs:name" \
'--listproviders' \
- '--setprovideroutputsource:provider: :source' \
- '--setprovideroffloadsink:provider: :sink' \
+ '--setprovideroutputsource:provider:->providers:source:->providers' \
+ '--setprovideroffloadsink:provider:->providers:sink:->providers' \
'--listmonitors' \
'--listactivemonitors' \
'--setmonitor:name' \
@@ -75,4 +76,8 @@ case $state in
_wanted modes expl mode compadd \
${(Mun)$(_call_program modes xrandr):#[0-9]##x[0-9]##} && return 0
;;
+ providers)
+ local -a xrandr_providers=(${(f)"$(_call_program providers xrandr --listproviders)"})
+ _wanted xrandr-providers expl $state_descr compadd ${${xrandr_providers}[2,-1]##*:} && return 0
+ ;;
esac
diff --git a/Completion/X/Command/_xset b/Completion/X/Command/_xset
index b35a6466b..adda47f01 100644
--- a/Completion/X/Command/_xset
+++ b/Completion/X/Command/_xset
@@ -91,8 +91,8 @@ _regex_arguments _xset_parse \
\( "/(blank|noblank|expose|noexpose|default|on|activate|reset)$nul/" \
':option-s:screen saver:(blank noblank expose noexpose default on activate reset off)' \
\| "/off$nul/" \( "/off$nul/" ':option-s-off-period:period off:(off)' \| \) \
- \| "/[0-9]##$nul/" ':option-s-timeout:length:' \
- \( "/[0-9]##$nul/" ':option-s-period:period:' \
+ \| "/[0-9]##$nul/" ':option-s-timeout: :_numbers -u seconds length' \
+ \( "/[0-9]##$nul/" ':option-s-period: :_numbers -u seconds period' \
\| \) \
\| \) \
\| "/-r$nul/" "$guard" \
diff --git a/Completion/X/Command/_xterm b/Completion/X/Command/_xterm
index 6d98985e7..180c2eb21 100644
--- a/Completion/X/Command/_xterm
+++ b/Completion/X/Command/_xterm
@@ -3,7 +3,7 @@
_xt_arguments \
-+{132,ah,ai,aw,bc,bdc,cb,cjk_width,cm,cn,cu,dc,fbb,fbx,fullscreen,hf,hm,hold,ie,im,itc,j,k8,l,lc,ls,maximized,mb,mesg,mk_width,nul,pc,pob,rvc,rw,s,samename,sb,sf,si,sk,sm,sp,t,u8,uc,ulc,ulit,ut,vb,wc,wf} \
-{version,help,leftbar,rightbar,C} \
- '-report-'{charclass,colors,fonts} \
+ '-report-'{charclass,colors,fonts,icons,xres} \
'-T:title' \
'-b:inner border size:' \
'-baudrate:rate [38400]' \
diff --git a/Completion/X/Type/_x_color b/Completion/X/Type/_x_color
index 960eae6d3..845a35686 100644
--- a/Completion/X/Type/_x_color
+++ b/Completion/X/Type/_x_color
@@ -10,25 +10,28 @@
local expl
-if (( ! $+_color_cache )); then
+if (( ! $+_cache_x_colors )); then
+ typeset -ga _cache_x_colors
local file
# Cache of color names doesn't exist yet, create it.
zstyle -s ":completion:${curcontext}:colors" path file
if [[ -n "$file" ]]; then
- _color_cache=( "${(@)${(@f)$(< $file)}[2,-1]##* }" )
+ _cache_x_colors=( "${(@)${(@f)$(< $file)}[2,-1]##* }" )
+ elif (( $+commands[showrgb] )); then
+ _cache_x_colors=( "${(@)${(@)${(@f)$(_call_program colors showrgb)}[2,-1]##* }:#* *}" )
else
file=( /usr/{lib,{{X11R6,openwin},local{,/X11{,R6}}}/lib}/X11/rgb.txt(N) )
(( $#file )) &&
- _color_cache=( "${(@)${(@)${(@f)$(< $file[1])}[2,-1]##* }:#* *}" )
+ _cache_x_colors=( "${(@)${(@)${(@f)$(< $file[1])}[2,-1]##* }:#* *}" )
fi
# Stupid default value.
- (( $#_color_cache )) || _color_cache=(white black gray red blue green)
+ (( $#_cache_x_colors )) || _cache_x_colors=(white black gray red blue green)
fi
_wanted colors expl 'color specification' compadd "$@" -M \
- 'm:{a-z}={A-Z} m:-=\ r:[^ A-Z0-9]||[ A-Z0-9]=* r:|=*' -a - _color_cache
+ 'm:{a-z}={A-Z} m:-=\ r:[^ A-Z0-9]||[ A-Z0-9]=* r:|=*' -a - _cache_x_colors
diff --git a/Completion/Zsh/Command/_bindkey b/Completion/Zsh/Command/_bindkey
index 81ae69974..df9c8f225 100644
--- a/Completion/Zsh/Command/_bindkey
+++ b/Completion/Zsh/Command/_bindkey
@@ -27,7 +27,7 @@ _arguments -C -s -S \
'(-l -L -d -D -A -N -m -p -r *)-s[bind each in-string to each out-string]:*:key string' \
'(-e -v -a -M -l -L -d -D -A -N -m -p)-R[interpret in-strings as ranges]' \
'(-l -L -d -A -N -m -p -r -s):in-string' \
- '(-l -L -d -A -N -m -p -r -s)*::widgets:_widgets' && ret=0
+ '(-l -L -d -A -N -m -p -r -s)*::widget:_widgets' && ret=0
case $state in
keymap)
diff --git a/Completion/Zsh/Command/_compadd b/Completion/Zsh/Command/_compadd
index 781fa2af8..4456cf71e 100644
--- a/Completion/Zsh/Command/_compadd
+++ b/Completion/Zsh/Command/_compadd
@@ -1,47 +1,94 @@
-#compdef compadd
+#compdef compadd -P _*
-local curcontext="$curcontext" state line ret=1
+local curcontext="$curcontext" ret=1
+local -a state line args
typeset -A opt_args
-_arguments -C -s -S -A "-*" \
- '-P+[specify prefix]:prefix' \
- '-S+[specify suffix]:suffix' \
- '-p+[specify hidden prefix]:hidden prefix' \
- '-s+[specify hidden suffix]:hidden suffix' \
- '-i+[specify ignored prefix]:ignored prefix' \
- '-I+[specify ignored suffix]:ignored suffix' \
- '(-k)-a[matches are elements of specified arrays]' \
- '(-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]' \
+args=(
+ '-P+[specify prefix]:prefix'
+ '-S+[specify suffix]:suffix'
+ '-p+[specify hidden prefix]:hidden prefix'
+ '-s+[specify hidden suffix]:hidden suffix'
+ '-i+[specify ignored prefix]:ignored prefix'
+ '-I+[specify ignored suffix]:ignored suffix'
'-o[specify order for matches by match string not by display string]:: : _values -s , order
"match[order by match not by display string]"
"nosort[matches are pre-ordered]"
"numeric[order numerically]"
- "reverse[order backwards]"' \
- '(-1 -E)-J+[specify match group]:group' \
- '!-V+:group' \
- '(-J -E)-1[remove only consecutive duplicates from group]' \
- '-2[preserve all duplicates]' \
- '(-x)-X[specify explanation]:explanation' \
- '(-X)-x[specify unconditional explanation]:explanation' \
- '-q[make suffix autoremovable]' \
- '-r+[specify character class for suffix autoremoval]:character class' \
- '-R+[specify function for suffix autoremoval]:function:_functions' \
- '-f[mark matches as being files]' \
- '-e[mark matches as being parameters]' \
- '-W[specify location for matches marked as files]' \
- '-F+[specify array of ignore patterns]:array:_parameters -g "*array*"' \
- '-Q[disable quoting of possible completions]' \
- '*-M[specify matching specifications]' \
- '-n[hide matches in completion listing]' \
- '-U[disable internal matching of completion candidates]' \
- '-O+[populate array with matches instead of adding them]:array:_parameters -g "*array*"' \
- '-A+[populate array with expanded matches instead of adding them]:array:_parameters -g "*array*"' \
- '-D+[delete elements from array corresponding to non-matching candidates]:array:_parameters -g "*array*"' \
- '-C[add special match that expands to all other matches]' \
- '(-1 -J)-E+[add specified number of display only matches]:number' \
- '*:candidate:->candidates' && ret=0
+ "reverse[order backwards]"'
+ '(-1 -E)-J+[specify match group]:group'
+ '!-V+:group'
+ '(-J -E)-1[remove only consecutive duplicates from group]'
+ '-2[preserve all duplicates]'
+ '(-x)-X[specify explanation]:explanation'
+ '(-X)-x[specify unconditional explanation]:explanation'
+ '-q[make suffix autoremovable]'
+ '-r+[specify character class for suffix autoremoval]:character class'
+ '-R+[specify function for suffix autoremoval]:function:_functions'
+ '-F+[specify array of ignore patterns]:array:_parameters -g "*array*"'
+ '-Q[disable quoting of possible completions]'
+ '*-M[specify matching specifications]'
+ '-n[hide matches in completion listing]'
+ '-O+[populate array with matches instead of adding them]:array:_parameters -g "*array*"'
+ '-A+[populate array with expanded matches instead of adding them]:array:_parameters -g "*array*"'
+ '*-D+[delete elements from array corresponding to non-matching candidates]:array:_parameters -g "*array*"'
+)
+
+case $service in
+ compadd|_(path_|)files)
+ args+=(
+ '-W[specify location for matches marked as files]'
+ )
+ ;|
+ compadd)
+ args+=(
+ '(-k)-a[matches are elements of specified arrays]'
+ '(-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]'
+ '-f[mark matches as being files]'
+ '-e[mark matches as being parameters]'
+ '-C[add special match that expands to all other matches]'
+ '(-1 -J)-E+[add specified number of display only matches]:number'
+ '-U[disable internal matching of completion candidates]'
+ '*:candidate:->candidates'
+ )
+ ;;
+ _dates)
+ args=( ${args:#([(][^)]##\)|)-[12noOAD]*}
+ '-f[specify format for matches]:format:_date_formats'
+ '-F[select a future rather than past date]'
+ )
+ ;;
+ _(path_|)files)
+ args=( ${args:#([(][^)]##\)|)-[OAD]*}
+ '-g+[specify file glob pattern]:glob pattern'
+ '-/[complete only directories]'
+ )
+ ;;
+ _parameters)
+ args+=(
+ '-g+[specify pattern to filter parameter type by]:pattern'
+ )
+ ;;
+ _pids)
+ args+=( '-m+[pattern to filter process command line by]:pattern' )
+ ;;
+ _process_names)
+ args+=(
+ '-a[include all processes]'
+ '-t[use truncated process names]'
+ )
+ ;;
+ _sys_calls)
+ args+=(
+ '-a[add "all" as an additional match]'
+ '-n[add "none" as an additional match]'
+ )
+ ;;
+esac
+
+_arguments -C -s -S -A "-*" $args && ret=0
if [[ -n $state ]]; then
if (( $+opt_args[-a] )); then
diff --git a/Completion/Zsh/Command/_disable b/Completion/Zsh/Command/_disable
index 52b82a6e9..da3803039 100644
--- a/Completion/Zsh/Command/_disable
+++ b/Completion/Zsh/Command/_disable
@@ -7,10 +7,10 @@ sali_arr=(${(k)saliases})
func_arr=(${(k)functions})
_arguments -C -s -A "-*" -S \
- "(-f -r -s -p)-a[act on regular or global aliases]:*:regular or global aliases:compadd -k ali_arr" \
- "(-a -r -s -p)-f[act on functions]:*:functions:compadd -k func_arr" \
- "(-a -f -s -p)-r[act on reserved words]:*:reserved-words:compadd -k reswords" \
- "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:compadd -k sali_arr" \
- "(-a -f -r -s)-p[act on pattern characters]:*:pattern characters:compadd -k patchars" \
+ "(-f -r -s -p)-a[act on regular or global aliases]:*:regular or global alias:compadd -k ali_arr" \
+ "(-a -r -s -p)-f[act on functions]:*:function:compadd -k func_arr" \
+ "(-a -f -s -p)-r[act on reserved words]:*:reserved-word:compadd -k reswords" \
+ "(-a -f -r -p)-s[act on suffix aliases]:*:suffix alias:compadd -k sali_arr" \
+ "(-a -f -r -s)-p[act on pattern characters]:*:pattern character:compadd -k patchars" \
'-m[treat arguments as patterns]' \
"*:builtin command:(${(k)builtins})"
diff --git a/Completion/Zsh/Command/_enable b/Completion/Zsh/Command/_enable
index 9410651b7..b62619d89 100644
--- a/Completion/Zsh/Command/_enable
+++ b/Completion/Zsh/Command/_enable
@@ -7,10 +7,10 @@ sali_arr=(${(k)dis_saliases})
func_arr=(${(k)dis_functions})
_arguments -C -s -A "-*" -S \
- "(-f -r -s -p)-a[act on regular or global aliases]:*:aliases:compadd -k ali_arr" \
- "(-a -r -s -p)-f[act on functions]:*:functions:compadd -k func_arr" \
- "(-a -f -s -p)-r[act on reserved words]:*:reserved-words:compadd -k dis_reswords" \
- "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:compadd -k sali_arr" \
- "(-a -f -r -s)-p[act on pattern characters]:*:pattern characters:compadd -k dis_patchars" \
+ "(-f -r -s -p)-a[act on regular or global aliases]:*:alias:compadd -k ali_arr" \
+ "(-a -r -s -p)-f[act on functions]:*:function:compadd -k func_arr" \
+ "(-a -f -s -p)-r[act on reserved words]:*:reserved-word:compadd -k dis_reswords" \
+ "(-a -f -r -p)-s[act on suffix aliases]:*:suffix alias:compadd -k sali_arr" \
+ "(-a -f -r -s)-p[act on pattern characters]:*:pattern character:compadd -k dis_patchars" \
'-m[treat arguments as patterns]' \
"*:builtin command:(${(k)dis_builtins})"
diff --git a/Completion/Zsh/Command/_fc b/Completion/Zsh/Command/_fc
index dd014e7d7..80e570c5d 100644
--- a/Completion/Zsh/Command/_fc
+++ b/Completion/Zsh/Command/_fc
@@ -59,7 +59,8 @@ case $service in
;;
*)
_arguments "$fc_common[@]" "$fc_hist[@]" "$fc_r" \
- '(-A -R -W -a -l -n -d -f -E -i -r -t -D -p -P)-e+[specify editor to invoke]:editor to invoke:_command_names -e' \
+ '(-A -R -W -a -l -n -d -f -E -i -r -t -D -p -P -s)-e+[specify editor to invoke]:editor to invoke:_command_names -e' \
+ '(-A -R -W -a -l -n -d -f -E -i -r -t -D -p -P -e)-s[re-execute command without invoking editor (like -e-)]' \
'(-a -l -L -m -e -r -n -d -f -t -E -i -R -D -A -W -p -P *)-'{\
'R[read history from file]',\
'A[append history to file]',\
diff --git a/Completion/Zsh/Command/_sched b/Completion/Zsh/Command/_sched
index e8ff5ab87..888708684 100644
--- a/Completion/Zsh/Command/_sched
+++ b/Completion/Zsh/Command/_sched
@@ -10,7 +10,7 @@ if [[ CURRENT -eq 2 ]]; then
else
disp=()
fi
- [[ -z $lines ]] || _wanted jobs expl 'scheduled jobs' \
+ [[ -z $lines ]] || _wanted jobs expl 'scheduled job' \
compadd "$disp[@]" - {1..$#lines}
return
else
diff --git a/Completion/Zsh/Command/_strftime b/Completion/Zsh/Command/_strftime
index 0849f1c85..a57a76ce4 100644
--- a/Completion/Zsh/Command/_strftime
+++ b/Completion/Zsh/Command/_strftime
@@ -1,14 +1,16 @@
#compdef strftime
-local ret=1 expl
+local expl two='epoch time'
+
+if (( words[(I)-r] )); then
+ two='date string'
+fi
_arguments -S -A '-*' -s \
+ '-n[omit trailing newline]' \
'-q[run quietly]' \
'(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)' \
+ "2:$two" \
'3:nanoseconds' \
-&& ret=0
-
-return ret
diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset
index ae33ae539..058842378 100644
--- a/Completion/Zsh/Command/_typeset
+++ b/Completion/Zsh/Command/_typeset
@@ -1,6 +1,6 @@
#compdef autoload declare export functions integer float local readonly typeset
-local expl state line func i use curcontext="$curcontext"
+local expl state state_descr line func i use curcontext="$curcontext" ret=1
local fopts="-f -k -z +k +z"
local popts="-A -E -F -L -R -T -Z -a -g -h -H -i -l -r -x"
local -A allargs opt_args
@@ -69,8 +69,8 @@ case ${service} in
allargs[i]='-i+[specify arithmetic base for output]:: :_guard "[0-9]#" base' \
;;
readonly) use="${use/r/}" ;;
- local) use="${use/[fkz]/}" ;&
- export) use="${${use//[gkz]/}/x/}" ;;
+ local) use="${use//[fgkz]/}" ;;
+ export) use="${use//[fgkxz]/}" ;;
esac
[[ -z "${words[(r)-*[aA]*]}" ]] || func=p
@@ -79,38 +79,38 @@ esac
# This function uses whacky features of _arguments which means we
# need to look for options to the command beforehand.
local onopts offopts
-onopts=${(j..)${${words[1,CURRENT-1]:#^-*}##-}}
+onopts=${(j..)${${words[1,CURRENT-1]:#^-[^-]*}##-}}
offopts=${(j..)${${words[1,CURRENT-1]:#^+*}##+}}
for ((i=1;i<=$#use;++i)); do
args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[dUurRtT]]:+$func}]} )
done
-_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq'
+_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq' && ret=0
if [[ "$state" = vars_eq ]]; then
if [[ $func = f ]]; then
if (( $+opt_args[+M] || ( $+opt_args[-M] && $+opt_args[-m] ) )); then
_wanted functions expl 'math function' compadd -F line - \
- ${${${(f)"$(functions -M)"}##*-M }%% *}
+ ${${${(f)"$(functions -M)"}##*-M }%% *} && ret=0
elif (( $+opt_args[-M] )); then
_arguments ':new math function:_functions' \
":minimum arguments${(k)opt_args[-s]:+:(1)}" \
":maximum arguments${(k)opt_args[-s]:+:(1)}" \
- ':shell function:_functions'
+ ':shell function:_functions' && ret=0
elif (( $+opt_args[-w] )); then
- _wanted files expl 'zwc file' _files -g '*.zwc(-.)'
+ _wanted files expl 'zwc file' _files -g '*.zwc(-.)' && ret=0
elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then
- if [[ $PREFIX[1] = [/~] ]]; then
+ if [[ ${"${(e)PREFIX}"[1]} = [/~] ]] && _files; then
# Autoload by absolute path
- _files
+ ret=0
else
args=(${^fpath}/*(-.:t))
# Filter out functions already loaded or marked for autoload.
local -a funckeys
funckeys=(${(k)functions})
args=(${args:|funckeys})
- _wanted functions expl 'shell function' compadd -a args
+ _wanted functions expl 'shell function' compadd -a args && ret=0
fi
elif [[ -n $onopts$offopts ]]; then
if [[ -n $offopts ]]; then
@@ -127,22 +127,23 @@ if [[ "$state" = vars_eq ]]; then
[[ $PREFIX != [_.]* ]]; then
args=(${args:#_*})
fi
- _wanted functions expl 'shell functions' compadd -a args
+ _wanted functions expl 'shell function' compadd -a args && ret=0
else
- _functions
+ _functions && ret=0
fi
elif [[ "$PREFIX" = *\=* ]]; then
compstate[parameter]="${PREFIX%%\=*}"
compset -P 1 '*='
- _value
+ _value && ret=0
elif (( $+opt_args[-a] || $+opt_args[-A] )); then
- _parameters -q
+ _parameters -q && ret=0
elif (( $+opt_args[-T] )); then
_arguments \
':scalar parameter:_parameters -g "*scalar*" -q -S "="' \
':array parameter:_parameters -g "*array*"' \
- ':separator character'
+ ':separator character' && ret=0
else
- _parameters -q -S '='
+ _parameters -q -S '=' && ret=0
fi
fi
+return ret
diff --git a/Completion/Zsh/Command/_zed b/Completion/Zsh/Command/_zed
index 6b68fadf0..f84993d73 100644
--- a/Completion/Zsh/Command/_zed
+++ b/Completion/Zsh/Command/_zed
@@ -1,10 +1,16 @@
-#compdef zed fned
+#compdef zed fned histed
case $service in
(fned) _arguments -S : ':shell function:_functions';;
+(histed) _arguments -S : \
+ '1:history file:_files' \
+ '2:history size: ';;
(zed) _arguments -S : \
- '(- 2):file:_files' \
- '(1):shell function:_functions' \
- '(1)-x+[specify spaces to use for indentation in function expansion]:spaces' \
- '(1)-f[edit function]';;
+ '(-h 1 3 4)-f[edit function]' \
+ '(-h 1 3 4)-x+[specify spaces to use for indentation in function expansion]:spaces' \
+ '(-f -x 1 2)-h[edit history]' \
+ '(- 2 3 4)1:file:_files' \
+ '(3 4)2:shell function:_functions' \
+ '3:history file:_files -g "*(D)"' \
+ '4:history size';;
esac
diff --git a/Completion/Zsh/Command/_zle b/Completion/Zsh/Command/_zle
index e01d0a943..0b8ef7a15 100644
--- a/Completion/Zsh/Command/_zle
+++ b/Completion/Zsh/Command/_zle
@@ -51,11 +51,11 @@ case "$state[1]" in
;;
(widget*)
_wanted -C "$context[1]" widgets expl "${state_descr[1]:-widget}" _widgets && ret=0
- ;&
- (function)
- [[ $state[1] != *function ]] || # Handle fall-through
+ ;|
+ (*function)
_wanted -C "$context[1]" functions expl 'widget shell function' \
- compadd -M 'r:|-=* r:|=*' -k functions && ret=0
+ compadd -M 'r:|-=* r:|=*' -k functions &&
+ ret=0
;;
(comp-widget)
_wanted -C "$context[1]" widgets expl 'completion widget' \
diff --git a/Completion/Zsh/Command/_zmodload b/Completion/Zsh/Command/_zmodload
index 3416d50c6..f3e38c0f6 100644
--- a/Completion/Zsh/Command/_zmodload
+++ b/Completion/Zsh/Command/_zmodload
@@ -23,7 +23,7 @@ _arguments -n -C -S -s \
'(-e -u)-L[output in the form of calls to zmodload]' \
'(-b -c -d -I -f -F -P -l -m -A -R)-p[autoload module for parameters]' \
'(-u -b -c -d -p -f -A -R)-P[array param for features]:array name:_parameters' \
- '(-)*:params:->params' && ret=0
+ '(-)*:param:->params' && ret=0
[[ $state = params ]] || return ret
@@ -66,7 +66,7 @@ else
while _tags; do
_requested builtins expl 'builtin command' \
compadd "$@" -k builtins && ret=0
- _requested loadedmodules expl 'loaded modules' \
+ _requested loadedmodules expl 'loaded module' \
compadd -k 'modules[(R)loaded]' && ret=0
_requested files expl 'module file' \
_files -W module_path -g '*.(dll|s[ol]|bundle)(:r)' && ret=0
diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle
index 7db73c0c0..0c81c2f2e 100644
--- a/Completion/Zsh/Command/_zstyle
+++ b/Completion/Zsh/Command/_zstyle
@@ -5,9 +5,6 @@ local nm=$compstate[nmatches] taglist patterns contexts MATCH
integer MBEGIN MEND
typeset -A opt_args styles
-_vcs_info_hooks() {
- compadd - ${functions[(I)+vi-*]#+vi-}
-}
# Assoc array of styles; the values give the possible top-level
# contexts:
# c completion
@@ -65,6 +62,7 @@ styles=(
ignore-parents c:ignorepar
ignored-patterns c:
insert-ids c:insert-ids
+ insert-sections c:insert-sections
insert-tab c:bool
insert-unambiguous c:insunambig
keep-prefix c:keep-prefix
@@ -103,6 +101,7 @@ styles=(
preserve-prefix c:preserve-prefix
range c:
recent-dirs-insert c:recent-dirs-insert
+ recursive-files c:
regular c:bool
rehash c:bool
remote-access c:bool
@@ -113,7 +112,7 @@ styles=(
show-ambiguity c:
show-completer c:bool
single-ignored c:single-ignored
- sort c:bool
+ sort c:sort-order
special-dirs c:sdirs
squeeze-slashes c:bool
stop c:stop
@@ -145,6 +144,7 @@ styles=(
cursor e:
edit-buffer e:bool
edit-previous e:bool
+ editor e:
insert-kept e:
leave-cursor e:bool
match e:
@@ -218,7 +218,7 @@ taglist=(
)
# Be careful with the context arguments here. They like to masquerade.
-_arguments -C \
+_arguments -C -A '-*' \
'(: -)-L[output in form of zstyle commands]:pattern for context patterns:->metapatterns:style:->metastyles' \
'(: -)-d[delete style definitions]:verbatim context pattern:->patterns:*:styles:->pstyles' \
'(: -)-e[value is evaluated when style is looked up]:context pattern:->contexts:style:->styles:*:command:_cmdstring' \
@@ -229,7 +229,7 @@ _arguments -C \
'(: -)-t[test a style, returning false if it'\''s undefined]:context name:->contexts:style:->styles:*:strings to test presence of: ' \
'(: -)-T[test a style, returning true if it'\''s undefined]:context name:->contexts:style:->styles:*:strings to test presence of: ' \
'(: -)-m[pattern-match values of a style]:context name:->contexts:style:->styles:pattern: ' \
- '(-):context pattern:->contexts' '(-):style:->styles' '(-)*:argument:->style-arg'
+ ':context pattern:->contexts' ':style:->styles' '*:argument:->style-arg'
while (( $#state )); do
case "$state[1]" in
@@ -412,14 +412,15 @@ while (( $#state )); do
;;
(function)
- _wanted control-function expl 'control function' \
+ _wanted control-functions expl 'control function' \
compadd predict-on all-matches
;;
(functions)
- _wanted comp-widget expl 'completion widget' \
- compadd $suf - all-matches complete-debug complete-tag \
- correct-word expand-word expand-alias-word history-words
+ _wanted comp-widgets expl 'completion widget' \
+ compadd $suf -M 'r:|-=* r:|=*' - all-matches complete-debug complete-tag \
+ correct-word expand-word expand-alias-word history-words \
+ ${${${(M)${(f)"$(_call_program comp-widgets zle -l)"}:#*-C*}:#_*}/ -C*}
;;
(user-host-port)
@@ -490,7 +491,7 @@ while (( $#state )); do
elif compset -P '*:'; then
_message -e tags tag
else
- _message -e patterns 'glob patterns'
+ _message -e patterns 'glob pattern'
fi
;;
@@ -524,6 +525,11 @@ while (( $#state )); do
compadd - menu single longer
;;
+ (insert-sections)
+ _wanted values expl 'where to insert man page section' \
+ compadd - true false prepend suffix
+ ;;
+
(fake-files)
_message -e fakes 'prefix and names'
;;
@@ -571,6 +577,10 @@ while (( $#state )); do
_message -e separators 'separator string'
;;
+ (sort-order)
+ _wanted sort-orders expl 'sort order' compadd -F line - true false match nosort numeric reverse
+ ;;
+
(max-matches-width)
_message -e numbers 'maximum display width for matches'
;;
@@ -659,7 +669,7 @@ while (( $#state )); do
'p[name of top-most patch (applied-string)]' \
'u[number of unapplied patches (unapplied-string)]' \
'n[number of applied patches]' \
- 'c[number of unapplied patches.]' \
+ 'c[number of unapplied patches]' \
'a[number of all patches]' \
'g[names of active mq guards (hg backend)]' \
'G[number of active mq guards (hg backend)]'
diff --git a/Completion/Zsh/Context/_brace_parameter b/Completion/Zsh/Context/_brace_parameter
index 6960cec9b..66be4f7cd 100644
--- a/Completion/Zsh/Context/_brace_parameter
+++ b/Completion/Zsh/Context/_brace_parameter
@@ -140,8 +140,9 @@ if [[ $PREFIX = *'${('[^\)]# ]]; then
flags+=("m:count number of character code points in padding calculation")
fi
flags+=(
- "#:evaluate as numeric expression"
+ "#:interpret numeric expression as character code"
"@:prevent double-quoted joining of arrays"
+ "*:enable extended globs for pattern"
"A:assign as an array parameter"
"a:sort in array index order (with O to reverse)"
"b:backslash quote pattern characters only"
@@ -155,7 +156,8 @@ if [[ $PREFIX = *'${('[^\)]# ]]; then
"i:sort case-insensitively"
"k:substitute keys of associative arrays"
"L:lower case all letters"
- "n:sort decimal integers numerically"
+ "n:sort positive decimal integers numerically"
+ "-:sort decimal integers numerically"
"o:sort in ascending order (lexically if no other sort option)"
"O:sort in descending order (lexically if no other sort option)"
"P:use parameter value as name of parameter for redirected lookup"
diff --git a/Completion/Zsh/Context/_subscript b/Completion/Zsh/Context/_subscript
index 0c9a89ad5..25cedd193 100644
--- a/Completion/Zsh/Context/_subscript
+++ b/Completion/Zsh/Context/_subscript
@@ -1,6 +1,8 @@
#compdef -subscript-
-local expl ind osuf=']' flags sep
+local expl ind osuf flags sep
+
+[[ $ISUFFIX = *\]* ]] || osuf=\]
if [[ "$1" = -q ]]; then
compquote osuf
@@ -78,7 +80,7 @@ elif compset -P '\('; then
);;
esac
- _values -s '' 'subscript flags' $flags
+ _values -s '' 'subscript flag' $flags
elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
local suf MATCH MBEGIN MEND
local -a keys
diff --git a/Completion/Zsh/Context/_zcalc_line b/Completion/Zsh/Context/_zcalc_line
index 50fb8c17c..ab8e42df9 100644
--- a/Completion/Zsh/Context/_zcalc_line
+++ b/Completion/Zsh/Context/_zcalc_line
@@ -16,7 +16,7 @@ _zcalc_line_escapes() {
"function:define math function (also \:func or \:f)"
)
cmds=("\:"${^cmds})
- _describe -t command-escapes "command escapes" cmds -Q
+ _describe -t command-escapes "command escape" cmds -Q
}
_zcalc_line() {
diff --git a/Completion/Zsh/Function/__arguments b/Completion/Zsh/Function/__arguments
new file mode 100644
index 000000000..af7710971
--- /dev/null
+++ b/Completion/Zsh/Function/__arguments
@@ -0,0 +1,44 @@
+#compdef _arguments
+
+# Dear reader: This function is called "__arguments" and is the completion
+# function for the completion function _arguments. This function, however, is
+# not the completion function _arguments. If you're looking for the function
+# _arguments, then you've come to the wrong place.
+#
+# _arguments is a completion utility function. It is called by completion
+# functions for command-line tools.
+#
+# __arguments is a completion function for _arguments. It runs when one does
+# `_arguments -<TAB>' at the shell prompt to jog one's memory about _arguments'
+# option flags.
+#
+# _arguments is in documented in the manual. If you were looking for its
+# source code, that'd be either in ../../../Completion/Base/Utility/_arguments
+# or in ./_arguments, depending on where you're reading this file.
+#
+# __arguments takes no arguments.
+
+if (( ${words[(i)--]} < CURRENT )); then
+ # "Deriving spec forms from the help output"
+ _arguments : \
+ '*-i[specify option name exclude patterns]:option name exclude pattern' \
+ '*-s[specify option aliases]:pattern and replacement as "(this that)"' \
+ '*:helpspec (pattern\:message\:action)'
+else
+ _arguments -A '-([AMO]*|[0CRSWnsw])' : \
+ '!-n[set $NORMARG]' \
+ '-s[enable single-letter option stacking (-x -y == -xy)]' \
+ '-w[(rarely needed) enable single-letter option stacking with arguments (-x X -y == -xy X)]' \
+ '-W[(rarely needed) enable single-letter option stacking with arguments in the same word (-x X -y == -xXy)]' \
+ "-C[modify \$curcontext for \`->action' (instead of \$context)]" \
+ "-R[when \`->action' matches, return 300]" \
+ "-S[honour \`--' as end-of-options guard]" \
+ "-A[do not complete options after non-options]:pattern matching unknown options (e.g., '-*')" \
+ '-O[pass elements of array variable to function calls in actions]:array variable name:_parameters -g array' \
+ "-M[specify matchspec for completing option names and values]:matchspec for completing option names and values [ 'r\\:|[_-]=* r\\:|=*' ]" \
+ '-0[have ${(v)opt_args} be NUL-joined rather than colon-escaped and colon-joined]' \
+ "--[derive optspecs from \`\${command} --help' output]" \
+ '1::optional delimiter:(\:)' \
+ '*:spec (e.g., "(-t --to)"*{-t+,--to=}"[specify recipient]\:recipient'\''s address\:_email_addresses)'
+ # TODO: doesn't support "Specifying Multiple Sets of Arguments"
+fi
diff --git a/Completion/Zsh/Function/_add-zle-hook-widget b/Completion/Zsh/Function/_add-zle-hook-widget
index f108d1868..c0bd77819 100644
--- a/Completion/Zsh/Function/_add-zle-hook-widget
+++ b/Completion/Zsh/Function/_add-zle-hook-widget
@@ -26,9 +26,12 @@ _add-zle-hook-widget() {
local context state state_descr line
typeset -A opt_args
_arguments -s -w -S : \
- '(-D)-d[remove HOOK from the array]' \
- '(-d)-D[interpret HOOK as pattern to remove from the array]' \
- {-U,-z,-k}"[passed to 'autoload']" \
+ "(-d -D -U -z -k)-L[output in form of 'zstyle' commands]" \
+ '(-L -D -U -z -k)-d[remove HOOK from the array]' \
+ '(-L -d -U -z -k)-D[interpret HOOK as pattern to remove from the array]' \
+ '(-L -d -D)-U[suppress alias expansion for functions]' \
+ '(-L -d -D -k)-z[mark function for zsh-style autoloading]' \
+ '(-L -d -D -z)-k[mark function for ksh-style autoloading]' \
':hook type:_add-zle-hook-widget_types' \
':widget:_add-zle-hook-widget_widgets'
}
diff --git a/Completion/Zsh/Function/_add-zsh-hook b/Completion/Zsh/Function/_add-zsh-hook
index e8ae97052..5b1ff0e42 100644
--- a/Completion/Zsh/Function/_add-zsh-hook
+++ b/Completion/Zsh/Function/_add-zsh-hook
@@ -3,7 +3,7 @@
_add-zsh-hook_hooks() {
local expl
if (( $+opt_args[-d] )); then
- _wanted functions expl "installed hooks" compadd -a - "$line[1]_functions" && return 0
+ _wanted functions expl "installed hook" compadd -a - "$line[1]_functions" && return 0
else
_functions && return 0
fi
@@ -14,9 +14,12 @@ _add-zsh-hook() {
local context state state_descr line
typeset -A opt_args
_arguments -s -w -S : \
- '(-D)-d[remove HOOK from the array]' \
- '(-d)-D[interpret HOOK as pattern to remove from the array]' \
- {-U,-z,-k}"[passed to 'autoload']" \
+ "(-d -D -U -z -k)-L[output in form of 'typeset' commands]" \
+ '(-L -D -U -z -k)-d[remove HOOK from the array]' \
+ '(-L -d -U -z -k)-D[interpret HOOK as pattern to remove from the array]' \
+ '(-L -d -D)-U[suppress alias expansion for functions]' \
+ '(-L -d -D -k)-z[mark function for zsh-style autoloading]' \
+ '(-L -d -D -z)-k[mark function for ksh-style autoloading]' \
':hook class:(chpwd precmd preexec periodic zshaddhistory zshexit zsh_directory_name)' \
':hook function:_add-zsh-hook_hooks'
}
diff --git a/Completion/Zsh/Function/_vcs_info b/Completion/Zsh/Function/_vcs_info
new file mode 100644
index 000000000..fdb28de6a
--- /dev/null
+++ b/Completion/Zsh/Function/_vcs_info
@@ -0,0 +1,31 @@
+#compdef vcs_info_hookadd vcs_info_hookdel
+
+local -a hook_types=(
+ gen-applied-string
+ gen-hg-bookmark-string
+ gen-mqguards-string
+ gen-unapplied-string
+ no-vcs
+ post-backend
+ post-quilt
+ pre-addon-quilt
+ pre-get-data
+ set-branch-format
+ set-hgrev-format
+ set-message
+ set-patch-format
+ start-up
+)
+
+local -a specs
+case $service in
+ (vcs_info_hookdel)
+ specs=( '-a[remove all occurrences, not just the first]' )
+ ;;
+esac
+
+# TODO: for vcs_info_hookdel complete only functions installed for that hook
+_arguments : \
+ $specs \
+ ":hook type:($hook_types)" \
+ '*:hook function:_vcs_info_hooks'
diff --git a/Completion/Zsh/Function/_zargs b/Completion/Zsh/Function/_zargs
index f974ab646..94a35e3a5 100644
--- a/Completion/Zsh/Function/_zargs
+++ b/Completion/Zsh/Function/_zargs
@@ -18,17 +18,17 @@ case $numeofs in
#zargs arguments
arguments=(
'(--eof -e)'{--eof=,-e+}'[change the end-of-input-args string from "--" to eof-str]'
- '(--exit, -x)'{--exit,-x}'[exit if the size (see --max-chars) is exceeded]'
+ '(--exit -x)'{--exit,-x}'[exit if the size (see --max-chars) is exceeded]'
'--help[print summary and exit]'
- '(--interactive, -p)'{--interactive,-p}'[prompt before executing each command line]'
- '(--max-args, -n)'{--max-args=,-n+}'[use at most max-args arguments per command line]'
- '(--max-chars, -s)'{--max-chars=,-s+}'[use at most max-chars characters per command line]'
- '(--max-lines, -l)'{--max-lines=,-l+}'[use at most max-lines of the input-args per command line]'
- '(--max-procs, -P)'{--max-procs=,-P+}'[run up to max-procs command lines in the background at once]'
- '(--no-run-if-empty, -r)'{--no-run-if-empty,-r}'[do nothing if there are no input arguments before the eof-str]'
- '(--null, -0)'{--null,-0}'[split each input-arg at null bytes, for xargs compatibility]'
- '(--replace, -i)'{--replace=,-i}'[substitute replace-str in the initial-args by each initial-arg]'
- '(--verbose, -t)'{--verbose,-t}'[print each command line to stderr before executing it]'
+ '(--interactive -p)'{--interactive,-p}'[prompt before executing each command line]'
+ '(--max-args -n)'{--max-args=,-n+}'[use at most max-args arguments per command line]'
+ '(--max-chars -s)'{--max-chars=,-s+}'[use at most max-chars characters per command line]'
+ '(--max-lines -l)'{--max-lines=,-l+}'[use at most max-lines of the input-args per command line]'
+ '(--max-procs -P)'{--max-procs=,-P+}'[run up to max-procs command lines in the background at once]'
+ '(--no-run-if-empty -r)'{--no-run-if-empty,-r}'[do nothing if there are no input arguments before the eof-str]'
+ '(--null -0)'{--null,-0}'[split each input-arg at null bytes, for xargs compatibility]'
+ '(--replace -i)'{--replace=,-i}'[substitute replace-str in the initial-args by each initial-arg]'
+ '(--verbose -t)'{--verbose,-t}'[print each command line to stderr before executing it]'
'--version[print the version number of zargs and exit]'
)
_arguments -S -s $arguments[@] && ret=0
diff --git a/Completion/Zsh/Type/_command_names b/Completion/Zsh/Type/_command_names
index cd630b7a4..12cbd69c1 100644
--- a/Completion/Zsh/Type/_command_names
+++ b/Completion/Zsh/Type/_command_names
@@ -4,7 +4,7 @@
# complete only external commands and executable files. This and a
# `-' as the first argument is then removed from the arguments.
-local args defs ffilt
+local args defs expl ffilt
zstyle -t ":completion:${curcontext}:commands" rehash && rehash
@@ -16,8 +16,12 @@ defs=(
'commands:external command:_path_commands'
)
-[[ -n "$path[(r).]" || $PREFIX = */* ]] &&
- defs+=( 'executables:executable file:_files -g \*\(-\*\)' )
+if [[ -n "$path[(r).]" || $PREFIX = */* ]]; then
+ defs+=( 'executables:executable file:_files -g \*\(-\*\)' )
+else
+ # this is ignored but exists to facilitate the use of the fake style
+ _description executables expl 'executable file'
+fi
if [[ "$1" = -e ]]; then
shift
@@ -41,11 +45,24 @@ fi
args=( "$@" )
local -a cmdpath
-if zstyle -a ":completion:${curcontext}" command-path cmdpath &&
- [[ $#cmdpath -gt 0 ]]
-then
+
+zstyle -a ":completion:${curcontext}" command-path cmdpath
+
+# Using the current PATH doesn't necessarily make sense when completing commands
+# to tools like sudo, which might set a different one. A common issue is that
+# /**/sbin appear in the PATH used by the tool, but not in the one used by the
+# unprivileged user who calls it. To do the right thing in the most common
+# cases, we'll simply ensure that the sbin variants always appear here when not
+# otherwise overridden (bash-completion's _sudo does something similar)
+if (( ! $#cmdpath && $#_comp_priv_prefix )); then
+ cmdpath=( $path ${path/%\/bin//sbin} )
+ cmdpath=( ${(u)^cmdpath}(/-N) )
+fi
+
+if (( $#cmdpath )); then
local -a +h path
local -A +h commands
- path=( $cmdpath )
+ path=( $cmdpath:A )
fi
+
_alternative -O args "$defs[@]"
diff --git a/Completion/Zsh/Type/_globflags b/Completion/Zsh/Type/_globflags
index 13ef14c17..d24e8f2a7 100644
--- a/Completion/Zsh/Type/_globflags
+++ b/Completion/Zsh/Type/_globflags
@@ -5,18 +5,26 @@
local ret=1
local -a flags
+local preprefix=$IPREFIX
-if compset -P a; then
- _message -e number 'errors'
- return
-elif compset -P q; then
+compset -P '([ilIUubBmMcq]|a(|<->))##'
+# make sure to not consider anything before the '#'
+preprefix=${IPREFIX[$#preprefix,-1]}
+if [[ $preprefix = *\#q* ]]; then
_globquals
return
-elif compset -P 'c[0-9]##,'; then
- _message -e number 'max repetitions'
+elif [[ $preprefix = *q* ]]; then
+ _message 'q flag has to be specified by itself'
return
-elif compset -P c; then
- _message -e number 'repetitions (min or exact)'
+elif [[ $preprefix = *a(|<->) ]]; then
+ _message -e number 'errors'
+ if [[ $preprefix = *a ]]; then
+ return
+ else
+ compset -P '<->'
+ fi
+elif [[ $preprefix = *\#c ]]; then
+ _message -e range 'repetitions (min,max) or (exact)'
return
fi
@@ -35,13 +43,20 @@ flags=(
'm:set reference to entire matched data'
'M:deactivate m flag'
)
-
+flags=( ${flags:#[$preprefix[(R)\#,-1]]*} )
+if [[ $IPREFIX != *'#' ]]; then
+ flags=( ${flags:#[se]*} )
+fi
_describe -t globflags "glob flag" flags -Q -S ')' && ret=0
flags=(
'a:approximate matching'
'q:introduce glob qualifier'
'c:match repetitions of preceding pattern'
)
+flags=( ${flags:#[$preprefix[(R)\#,-1]]*} )
+if [[ $IPREFIX != *'#' ]]; then
+ flags=( ${flags:#[cq]*} )
+fi
_describe -t globflags "glob flag" flags -Q -S '' && ret=0
return ret
diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals
index 915f97c1c..bc3165eba 100644
--- a/Completion/Zsh/Type/_globquals
+++ b/Completion/Zsh/Type/_globquals
@@ -127,16 +127,14 @@ while [[ -n $PREFIX ]]; do
alts+=( "time-specifiers:time specifier:compadd -E 0 -d tdisp -S '' -a tmatch" )
fi
if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then
- sdisp=( before exactly since )
- smatch=( - '' + )
if zstyle -t ":completion:${curcontext}:senses" verbose; then
zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=--
default=" [default exactly]"
- sdisp=( "- $sep before" "+ $sep since" )
- smatch=( - + )
+ sdisp=( "+ $sep before (older files)" "- $sep since (newer files)" )
+ smatch=( + - )
else
sdisp=( before exactly since )
- smatch=( - '' + )
+ smatch=( + '' - )
fi
alts+=( "senses:sense${default}:compadd -E 0 -d sdisp -S '' -a smatch" )
fi
diff --git a/Completion/Zsh/Type/_parameters b/Completion/Zsh/Type/_parameters
index eaad3ca9d..b5da45c58 100644
--- a/Completion/Zsh/Type/_parameters
+++ b/Completion/Zsh/Type/_parameters
@@ -6,18 +6,44 @@
# If you specify a -g option with a pattern, the pattern will be used to
# restrict the type of parameters matched.
-local expl pattern fakes faked tmp pfilt
-
if compset -P '*:'; then
_history_modifiers p
return
fi
-pattern=(-g \*)
+local i pfilt
+local -i nm=$compstate[nmatches]
+local -a expl pattern=( -g \* ) normal described verbose faked fakes tmp
+
+zstyle -t ":completion:${curcontext}:parameters" prefix-needed &&
+ [[ $PREFIX != [_.]* ]] &&
+ pfilt='[^_.]'
+_description parameters expl parameter
zparseopts -D -K -E g:=pattern
-fakes=()
-faked=()
+if zstyle -t ":completion:${curcontext}:parameters" extra-verbose; then
+ described=(
+ "${(@M)${(@k)parameters[(R)$~pattern[2]~*(hideval|local|special)*]}:#$~pfilt*}"
+ )
+ compadd "$@" "$expl[@]" -D described -a - described
+ if (( $#described )); then
+ # Normally, calling typeset without flags would print the values of its
+ # arguments. However, inside a function, it instead declare its arguments
+ # as local variables and outputs nothing. Thus, to force it print out
+ # parameter values, we pass it the -m flag.
+ verbose=(
+ ${${${(f@)"$( typeset -m ${(@b)described} )"}/=/:}[@]//'\'/'\\'}
+ )
+ _describe -t parameters parameter verbose "$@" "$expl[@]"
+ fi
+
+ normal=(
+ "${(@M)${(@k)parameters[(R)$~pattern[2]~^(*(hideval|special)*)~*local*]}:#$~pfilt*}"
+ )
+else
+ normal=( "${(@M)${(@k)parameters[(R)$~pattern[2]~*local*]}:#$~pfilt*}" )
+fi
+
if zstyle -a ":completion:${curcontext}:" fake-parameters tmp; then
for i in "$tmp[@]"; do
if [[ "$i" = *:* ]]; then
@@ -27,13 +53,7 @@ if zstyle -a ":completion:${curcontext}:" fake-parameters tmp; then
fi
done
fi
+compadd "$@" "$expl[@]" - "$normal[@]" "${(@)fakes:|described}" \
+ "${(@)${(@)${(@M)faked:#${~pattern[2]}}%%:*}:|described}"
-zstyle -t ":completion:${curcontext}:parameters" prefix-needed && \
- [[ $PREFIX != [_.]* ]] && \
- pfilt='[^_.]'
-
-_wanted parameters expl parameter \
- compadd "$@" -Q - \
- "${(@M)${(@k)parameters[(R)${pattern[2]}~*local*]}:#${~pfilt}*}" \
- "$fakes[@]" \
- "${(@)${(@M)faked:#${~pattern[2]}}%%:*}"
+(( compstate[nmatches] > nm ))
diff --git a/Completion/Zsh/Type/_ps1234 b/Completion/Zsh/Type/_ps1234
index cf1982219..0ea2cdda9 100644
--- a/Completion/Zsh/Type/_ps1234
+++ b/Completion/Zsh/Type/_ps1234
@@ -38,7 +38,7 @@ if compset -P '%[FK]'; then
)
_description -V ansi-colors expl 'ansi color'
- grp="$expl[expl[(i)-V]+1]"
+ grp="$expl[expl[(i)-J]+1]"
print -v ccol -f "($grp)=%s=%s" ${(kv)ansi}
_comp_colors+=( $ccol )
compadd "$expl[@]" $suf $pre -k ansi && ret=0
@@ -48,10 +48,10 @@ if compset -P '%[FK]'; then
(( cols = $terminfo[colors] - 1 ))
(( cols = cols > 255 ? 255 : cols ))
_description -V terminal-colors expl 'terminal color'
- grp="$expl[expl[(i)-V]+1]"
+ grp="$expl[expl[(i)-J]+1]"
compadd "$expl[@]" $suf $pre {0..$cols}
for c in {0..$cols}; do
- _comp_colors+=( "($grp)=${c}=${${$(print -P "%F{$c}")#?\[}%m}" )
+ _comp_colors+=( "($grp)=${c}=${${${(%):-%F{$c\}}#?\[}%m}" )
done
else
_message -e terminal-colors "number"
diff --git a/Completion/Zsh/Type/_vcs_info_hooks b/Completion/Zsh/Type/_vcs_info_hooks
new file mode 100644
index 000000000..bad915000
--- /dev/null
+++ b/Completion/Zsh/Type/_vcs_info_hooks
@@ -0,0 +1,2 @@
+#autoload
+compadd - ${functions[(I)+vi-*]#+vi-}
diff --git a/Completion/bashcompinit b/Completion/bashcompinit
index 02290a16f..adb659ca1 100644
--- a/Completion/bashcompinit
+++ b/Completion/bashcompinit
@@ -10,7 +10,7 @@ _bash_complete() {
(( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT-1]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX ))
(( COMP_CWORD = CURRENT - 1))
- COMP_WORDS=( $words )
+ COMP_WORDS=( "${words[@]}" )
BASH_VERSINFO=( 2 05b 0 1 release )
savejobstates=( ${(kv)jobstates} )
@@ -24,9 +24,10 @@ _bash_complete() {
if [[ ${argv[${argv[(I)filenames]:-0}-1]} = -o ]]; then
compset -P '*/' && matches=( ${matches##*/} )
compset -S '/*' && matches=( ${matches%%/*} )
- compadd -Q -f "${suf[@]}" -a matches && ret=0
+ compadd -f "${suf[@]}" -a matches && ret=0
else
- compadd -Q "${suf[@]}" -a matches && ret=0
+ compadd "${suf[@]}" - "${(@)${(Q@)matches}:#*\ }" && ret=0
+ compadd -S ' ' - ${${(M)${(Q)matches}:#*\ }% } && ret=0
fi
fi
diff --git a/Completion/compdump b/Completion/compdump
index e0dc8b805..6daf92f9f 100644
--- a/Completion/compdump
+++ b/Completion/compdump
@@ -16,7 +16,7 @@
emulate -L zsh
setopt extendedglob noshglob
-typeset _d_file _d_f _d_bks _d_line _d_als _d_files _d_name _d_tmp
+typeset _d_file _d_f _d_fd _d_bks _d_line _d_als _d_files _d_name _d_tmp
_d_file=${_comp_dumpfile-${0:h}/compinit.dump}.$HOST.$$
[[ $_d_file = //* ]] && _d_file=${_d_file[2,-1]}
@@ -33,44 +33,45 @@ if [[ -n "$_comp_secure" ]]; then
(( $#_d_wdirs )) && _d_files=( "${(@)_d_files:#(${(j:|:)_d_wdirs})/*}" )
fi
-print "#files: $#_d_files\tversion: $ZSH_VERSION" > $_d_file
+exec {_d_fd}>$_d_file
+print "#files: $#_d_files\tversion: $ZSH_VERSION" >& $_d_fd
# Dump the arrays _comps, _services and _patcomps. The quoting
# hieroglyphics ensure that a single quote inside a variable is itself
# correctly quoted.
-print "\n_comps=(" >> $_d_file
+print "\n_comps=(" >& $_d_fd
for _d_f in ${(ok)_comps}; do
print -r - "${(qq)_d_f}" "${(qq)_comps[$_d_f]}"
-done >> $_d_file
-print ")" >> $_d_file
+done >& $_d_fd
+print ")" >& $_d_fd
-print "\n_services=(" >> $_d_file
+print "\n_services=(" >& $_d_fd
for _d_f in ${(ok)_services}; do
print -r - "${(qq)_d_f}" "${(qq)_services[$_d_f]}"
-done >> $_d_file
-print ")" >> $_d_file
+done >& $_d_fd
+print ")" >& $_d_fd
-print "\n_patcomps=(" >> $_d_file
+print "\n_patcomps=(" >& $_d_fd
for _d_f in ${(ok)_patcomps}; do
print -r - "${(qq)_d_f}" "${(qq)_patcomps[$_d_f]}"
-done >> $_d_file
-print ")" >> $_d_file
+done >& $_d_fd
+print ")" >& $_d_fd
_d_tmp="_postpatcomps"
-print "\n_postpatcomps=(" >> $_d_file
+print "\n_postpatcomps=(" >& $_d_fd
for _d_f in ${(ok)_postpatcomps}; do
print -r - "${(qq)_d_f}" "${(qq)_postpatcomps[$_d_f]}"
-done >> $_d_file
-print ")" >> $_d_file
+done >& $_d_fd
+print ")" >& $_d_fd
-print "\n_compautos=(" >> $_d_file
+print "\n_compautos=(" >& $_d_fd
for _d_f in "${(ok@)_compautos}"; do
print -r - "${(qq)_d_f}" "${(qq)_compautos[$_d_f]}"
-done >> $_d_file
-print ")" >> $_d_file
+done >& $_d_fd
+print ")" >& $_d_fd
-print >> $_d_file
+print >& $_d_fd
# Now dump the key bindings. We dump all bindings for zle widgets
# whose names start with a underscore.
@@ -90,15 +91,15 @@ zle -lL |
print -r - ${_d_line}
_d_bks+=(${_d_line[3]})
fi
- done >> $_d_file
+ done >& $_d_fd
bindkey |
while read -rA _d_line; do
if [[ ${_d_line[2]} = (${(j.|.)~_d_bks}) ]]; then
print -r "bindkey '${_d_line[1][2,-2]}' ${_d_line[2]}"
fi
- done >> $_d_file
+ done >& $_d_fd
-print >> $_d_file
+print >& $_d_fd
# Autoloads: look for all defined functions beginning with `_' (that also
@@ -109,7 +110,7 @@ _d_als=($^fpath/(${(o~j.|.)$(typeset +fm '_*')})(N:t))
# print them out: about five to a line looks neat
integer _i=5
-print -n autoload -Uz >> $_d_file
+print -n autoload -Uz >& $_d_fd
while (( $#_d_als )); do
if (( ! $+_compautos[$_d_als[1]] )); then
print -n " $_d_als[1]"
@@ -119,19 +120,20 @@ while (( $#_d_als )); do
fi
fi
shift _d_als
-done >> $_d_file
+done >& $_d_fd
-print >> $_d_file
+print >& $_d_fd
local _c
for _c in "${(ok@)_compautos}"; do
- print "autoload -Uz $_compautos[$_c] $_c" >> $_d_file
+ print "autoload -Uz $_compautos[$_c] $_c" >& $_d_fd
done
-print >> $_d_file
+print >& $_d_fd
-print "typeset -gUa _comp_assocs" >> $_d_file
-print "_comp_assocs=( ${(qq)_comp_assocs} )" >> $_d_file
+print "typeset -gUa _comp_assocs" >& $_d_fd
+print "_comp_assocs=( ${(qq)_comp_assocs} )" >& $_d_fd
+exec {_d_fd}>&-
mv -f $_d_file ${_d_file%.$HOST.$$}
diff --git a/Completion/compinit b/Completion/compinit
index f0f8421df..5cb527fac 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -60,6 +60,10 @@
# the end). This takes the dumpfile as an argument. -d (with the
# default dumpfile) is now the default; to turn off dumping use -D.
+# If the dumpfile is being regenerated and you don't know why, you can use
+# the -w flag to see if it was because -D was passed, zsh version mismatched,
+# or number of files in $fpath differed.
+
# The -C flag bypasses both the check for rebuilding the dump file and the
# usual call to compaudit; the -i flag causes insecure directories found by
# compaudit to be ignored, and the -u flag causes all directories found by
@@ -71,9 +75,9 @@ emulate -L zsh
setopt extendedglob
typeset _i_dumpfile _i_files _i_line _i_done _i_dir _i_autodump=1
-typeset _i_tag _i_file _i_addfiles _i_fail=ask _i_check=yes _i_name
+typeset _i_tag _i_file _i_addfiles _i_fail=ask _i_check=yes _i_name _i_why
-while [[ $# -gt 0 && $1 = -[dDiuC] ]]; do
+while [[ $# -gt 0 && $1 = -[dDiuCw] ]]; do
case "$1" in
-d)
_i_autodump=1
@@ -99,6 +103,10 @@ while [[ $# -gt 0 && $1 = -[dDiuC] ]]; do
_i_check=
shift
;;
+ -w)
+ _i_why=1
+ shift
+ ;;
esac
done
@@ -157,6 +165,7 @@ _comp_options=(
NO_posixidentifiers
NO_shwordsplit
NO_shglob
+ NO_typesettounset
NO_warnnestedvar
NO_warncreateglobal
)
@@ -320,7 +329,7 @@ compdef() {
# and probably do autoloading.
func="$1"
- [[ -n "$autol" ]] && autoload -Uz "$func"
+ [[ -n "$autol" ]] && autoload -rUz "$func"
shift
case "$type" in
@@ -442,7 +451,7 @@ typeset _i_wdirs _i_wfiles
_i_wdirs=()
_i_wfiles=()
-autoload -Uz compaudit
+autoload -RUz compaudit
if [[ -n "$_i_check" ]]; then
typeset _i_q
if ! eval compaudit; then
@@ -458,19 +467,17 @@ Ignore insecure $_i_q and continue [y] or abort compinit [n]? "; then
return 1
fi
- _i_wfiles=()
- _i_wdirs=()
- else
- (( $#_i_wfiles )) && _i_files=( "${(@)_i_files:#(${(j:|:)_i_wfiles%.zwc})}" )
- (( $#_i_wdirs )) && _i_files=( "${(@)_i_files:#(${(j:|:)_i_wdirs%.zwc})/*}" )
fi
+ fpath=(${fpath:|_i_wdirs})
+ (( $#_i_wfiles )) && _i_files=( "${(@)_i_files:#(${(j:|:)_i_wfiles%.zwc})}" )
+ (( $#_i_wdirs )) && _i_files=( "${(@)_i_files:#(${(j:|:)_i_wdirs%.zwc})/*}" )
fi
typeset -g _comp_secure=yes
fi
fi
# Make sure compdump is available, even if we aren't going to use it.
-autoload -Uz compdump compinstall
+autoload -RUz compdump compinstall
# If we have a dump file, load it.
@@ -484,11 +491,28 @@ if [[ -f "$_comp_dumpfile" ]]; then
then
builtin . "$_comp_dumpfile"
_i_done=yes
+ elif [[ _i_why -eq 1 ]]; then
+ print -nu2 "Loading dump file skipped, regenerating"
+ local pre=" because: "
+ if [[ _i_autodump -ne 1 ]]; then
+ print -nu2 $pre"-D flag given"
+ pre=", "
+ fi
+ if [[ $_i_line[2] -ne $#_i_files ]]; then
+ print -nu2 $pre"number of files in dump $_i_line[2] differ from files found in \$fpath $#_i_files"
+ pre=", "
+ fi
+ if [[ $ZSH_VERSION != $_i_line[4] ]]; then
+ print -nu2 $pre"zsh version changed from $_i_line[4] to $ZSH_VERSION"
+ fi
+ print -u2
fi
else
builtin . "$_comp_dumpfile"
_i_done=yes
fi
+elif [[ _i_why -eq 1 ]]; then
+ print -u2 "No existing compdump file found, regenerating"
fi
if [[ -z "$_i_done" ]]; then
typeset -A _i_test
@@ -512,7 +536,7 @@ if [[ -z "$_i_done" ]]; then
fi
;;
(\#autoload)
- autoload -Uz "$_i_line[@]" ${_i_name}
+ autoload -rUz "$_i_line[@]" ${_i_name}
[[ "$_i_line" != \ # ]] && _compautos[${_i_name}]="$_i_line"
;;
esac
@@ -544,6 +568,6 @@ if [[ ${_i_line[2]} = expand-or-complete ]] &&
fi
unfunction compinit compaudit
-autoload -Uz compinit compaudit
+autoload -RUz compinit compaudit
return 0
diff --git a/Completion/openSUSE/Command/_hwinfo b/Completion/openSUSE/Command/_hwinfo
index aac0a05ad..7dff82805 100644
--- a/Completion/openSUSE/Command/_hwinfo
+++ b/Completion/openSUSE/Command/_hwinfo
@@ -5,7 +5,7 @@ _arguments \
'--version[show libhd version]' \
'--short[just a short listing]' \
'--log[write info to logfile]:logfile:_files' \
- '--debug[set debuglevel]:debuglevels:(1 2 3 4 5 6 7 8 9)' \
+ '--debug[set debuglevel]:debug level:(1 2 3 4 5 6 7 8 9)' \
'--dump-db[dump hardware data base, 0: external, 1: internal]:dumpdb:(0 1)' \
'--bios' \
'--block' \
diff --git a/Completion/openSUSE/Command/_zypper b/Completion/openSUSE/Command/_zypper
index 25a32c3f1..3f3402bd9 100644
--- a/Completion/openSUSE/Command/_zypper
+++ b/Completion/openSUSE/Command/_zypper
@@ -65,17 +65,17 @@ _zypper() {
_all_repos() {
local -a repos
repos=( $(zypper -q lr | tail -n +3 | cut -d'|' -f 2) )
- _describe -t repos 'Available repositories' repos && return
+ _describe -t repos 'available repository' repos && return
}
_enabled_repos() {
repos=( $(zypper -x lr | grep 'enabled="1"' | cut -d\" -f 2) )
- _describe -t repos 'Available repositories' repos && return
+ _describe -t repos 'available repository' repos && return
}
_disabled_repos() {
repos=( $(zypper -x lr | grep 'enabled="0"' | cut -d\" -f 2) )
- _describe -t repos 'Available repositories' repos && return
+ _describe -t repos 'available repository' repos && return
}
_zypper_cmd_do() {
@@ -107,7 +107,7 @@ _zypper_cmd_do() {
case ${words[CURRENT - 1]} in
--from)
repos=( $(zypper -x lr | grep 'enabled="1"' | cut -d\" -f 2) )
- _describe -t repos 'Available repositories' repos && return
+ _describe -t repos 'available repository' repos && return
;;
(--enable|-e)
case $cmd in
@@ -128,7 +128,7 @@ _zypper_cmd_do() {
case $cmd in
(if|info|se|search|in|install)
types=( pattern srcpackage package patch )
- _describe -t types 'Package types' types && return
+ _describe -t types 'package type' types && return
;;
esac
;;
@@ -143,7 +143,7 @@ _zypper_cmd_do() {
;;
(in|install)
local expl
- _description files expl 'RPM files'
+ _description files expl 'RPM file'
_files "$expl[@]" -g '*.(#i)rpm(.)'
;;
esac
diff --git a/Config/version.mk b/Config/version.mk
index d397f13ba..bf14a2eb2 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.8.1
-VERSION_DATE='February 12, 2022'
+VERSION=5.8.1.2-test
+VERSION_DATE='April 9, 2022'
diff --git a/Doc/Makefile.in b/Doc/Makefile.in
index 5a6a705ff..23e5fc7e2 100644
--- a/Doc/Makefile.in
+++ b/Doc/Makefile.in
@@ -69,6 +69,7 @@ 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 \
Zsh/mod_termcap.yo Zsh/mod_terminfo.yo \
+Zsh/mod_watch.yo \
Zsh/mod_zftp.yo Zsh/mod_zle.yo Zsh/mod_zleparameter.yo \
Zsh/mod_zprof.yo Zsh/mod_zpty.yo Zsh/mod_zselect.yo \
Zsh/mod_zutil.yo
diff --git a/Doc/Zsh/arith.yo b/Doc/Zsh/arith.yo
index c152bf48d..bc3e35ad5 100644
--- a/Doc/Zsh/arith.yo
+++ b/Doc/Zsh/arith.yo
@@ -20,7 +20,7 @@ The tt(let) builtin command takes arithmetic expressions as arguments; each
is evaluated separately. Since many of the arithmetic operators, as well
as spaces, require quoting, an alternative form is provided: for any
command which begins with a `tt(LPAR()LPAR())', all the characters until a
-matching `tt(RPAR()RPAR())' are treated as a quoted expression and
+matching `tt(RPAR()RPAR())' are treated as a double-quoted expression and
arithmetic expansion performed as for an argument of tt(let). More
precisely, `tt(LPAR()LPAR())var(...)tt(RPAR()RPAR())' is equivalent to
`tt(let ")var(...)tt(")'. The return status is 0 if the arithmetic value
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index ada69c99a..1d74f0c17 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -105,7 +105,13 @@ For each var(name) with a corresponding var(value), define an alias
with that value. A trailing space in var(value) causes the next word
to be checked for alias expansion. If the tt(-g) flag is present,
define a global alias; global aliases are expanded even if they do not
-occur in command position.
+occur in command position:
+
+example(% perldoc --help 2>&1 | grep 'built-in functions'
+ -f Search Perl built-in functions
+% alias -g HG='--help 2>&1 | grep'
+% perldoc HG 'built-in functions'
+ -f Search Perl built-in functions)
If the tt(-s) flag is present, define a suffix alias: if the command
word on a command line is in the form `var(text)tt(.)var(name)', where
@@ -730,7 +736,7 @@ findex(fc)
cindex(history, editing)
cindex(editing history)
redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ ))ifnztexi( )))
-xitem(tt(fc) [ tt(-e) var(ename) ] [ tt(-LI) ] [ tt(-m) var(match) ] [ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ])
+xitem(tt(fc) [ tt(-e) var(ename) ] [ tt(-s) ] [ tt(-LI) ] [ tt(-m) var(match) ] [ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ])
xitem(tt(fc -l )[ tt(-LI) ] [ tt(-nrdfEiD) ] [ tt(-t) var(timefmt) ] [ tt(-m) var(match) ])
xitem(SPACES()[ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ])
xitem(tt(fc -p )[ tt(-a) ] [ var(filename) [ var(histsize) [ var(savehistsize) ] ] ])
@@ -750,15 +756,16 @@ specifies the most recent event beginning with the given string. All
substitutions var(old)tt(=)var(new), if any, are then performed on the
text of the events.
-In addition to the number range,
+The range of events selected by numbers can be narrowed further by the
+following flags.
startsitem()
sitem(tt(-I))(restricts to only internal events (not from tt($HISTFILE)))
sitem(tt(-L))(restricts to only local events (not from other shells, see
tt(SHARE_HISTORY) in ifzman(zmanref(zshoptions))\
ifnzman(noderef(Description of Options)) -- note that tt($HISTFILE) is
considered local when read at startup))
-sitem(tt(-m))(takes the first argument as a pattern (should be quoted) and
-only the history events matching this pattern are considered)
+sitem(tt(-m))(takes the first argument as a pattern (which should be
+quoted) and only the history events matching this pattern are considered)
endsitem()
If var(first) is not specified, it will be set to -1 (the most recent
@@ -777,6 +784,7 @@ the parameter tt(EDITOR) is used; if that is not set a builtin default,
usually `tt(vi)' is used. If var(ename) is `tt(-)', no editor is invoked.
When editing is complete, the edited command is executed.
+The flag `tt(-s)' is equivalent to `tt(-e -)'.
The flag tt(-r) reverses the order of the events and the
flag tt(-n) suppresses event numbers when listing.
@@ -886,6 +894,10 @@ without affecting the other. A typical idiom is that var(oldfn) is the
name of a library shell function which is then redefined to call
tt(newfn), thereby installing a modified version of the function.
+em(The )tt(-M)em( and )tt(+M)em( flags)
+cindex(defining mathematical functions)
+cindex(functions, defining mathematical)
+
Use of the tt(-M) option may not be combined with any of the options
handled by tt(typeset -f).
@@ -907,9 +919,55 @@ expressions. The name of the function in tt($0) is var(mathfn) (not
var(shellfn) as would usually be the case), provided the option
tt(FUNCTION_ARGZERO) is in effect. The positional parameters in the shell
function correspond to the arguments of the mathematical function call.
-The result of the last arithmetical expression evaluated
-inside the shell function (even if it is a form that normally only returns
-a status) gives the result of the mathematical function.
+
+The result of the last arithmetical expression evaluated inside the shell
+function gives the result of the mathematical function. This is not limited to
+arithmetic substitutions of the form tt($+LPAR()+LPAR())var(...)tt(+RPAR()+RPAR()),
+but also includes arithmetical expressions evaluated in any other way, including
+by the tt(let) builtin,
+by tt(+LPAR()+LPAR())var(...)tt(+RPAR()+RPAR()) statements,
+and even
+by the tt(return) builtin
+and
+by array subscripts.
+Therefore, care must be taken not to use syntactical constructs that perform
+arithmetic evaluation after evaluating what is to be the result of the function.
+For example:
+
+findex(zmath_cube)
+findex(cube)
+example(# WRONG
+zmath_cube+LPAR()+RPAR() {
+ (( $1 * $1 * $1 ))
+ return 0
+}
+functions -M cube 1 1 zmath_cube
+print $(( cube+LPAR()3+RPAR() )))
+
+This will print `tt(0)' because of the tt(return).
+
+Commenting the tt(return) out would lead to a different problem: the
+tt(+LPAR()+LPAR())var(...)tt(+RPAR()+RPAR()) statement would become
+the last statement in the function, so the em(return status) (tt($?)) of the
+function would be non-zero (indicating failure) whenever the em(arithmetic
+result) of the function would happen to be zero (numerically):
+
+example(# WRONG
+zmath_cube+LPAR()+RPAR() {
+ (( $1 * $1 * $1 ))
+}
+functions -M cube 1 1 zmath_cube
+print $(( cube+LPAR()0+RPAR() )))
+
+Instead, the tt(true) builtin can be used:
+
+example(# RIGHT
+zmath_cube+LPAR()+RPAR() {
+ (( $1 * $1 * $1 ))
+ true
+}
+functions -M cube 1 1 zmath_cube
+print $(( cube+LPAR()3+RPAR() )))
If the additional option tt(-s) is given to tt(functions -M), the
argument to the function is a single string: anything between the
@@ -917,6 +975,12 @@ opening and matching closing parenthesis is passed to the function as a
single argument, even if it includes commas or white space. The minimum
and maximum argument specifiers must therefore be 1 if given. An empty
argument list is passed as a zero-length string.
+Thus, the following string function takes a single argument, including
+the commas, and prints 11:
+
+example(stringfn+LPAR()RPAR() { (( $#1 )); true }
+functions -Ms stringfn
+print $(( stringfn+LPAR()foo,bar,rod+RPAR() )))
tt(functions -M) with no arguments lists all such user-defined functions in
the same form as a definition. With the additional option tt(-m) and
@@ -928,19 +992,6 @@ additional option tt(-m) the arguments are treated as patterns and
all functions whose var(mathfn) matches the pattern are removed. Note
that the shell function implementing the behaviour is not removed
(regardless of whether its name coincides with var(mathfn)).
-
-For example, the following prints the cube of 3:
-
-example(zmath_cube+LPAR()RPAR() { (( $1 * $1 * $1 )) }
-functions -M cube 1 1 zmath_cube
-print $(( cube+LPAR()3+RPAR() )))
-
-The following string function takes a single argument, including
-the commas, so prints 11:
-
-example(stringfn+LPAR()RPAR() { (( $#1 )) }
-functions -Ms stringfn
-print $(( stringfn+LPAR()foo,bar,rod+RPAR() )))
)
module(getcap)(zsh/cap)
findex(getln)
@@ -975,7 +1026,8 @@ vindex(OPTARG, use of)
The first option to be examined may be changed by explicitly assigning
to tt(OPTIND). tt(OPTIND) has an initial value of tt(1), and is
normally set to tt(1) upon entry to a shell function and restored
-upon exit (this is disabled by the tt(POSIX_BUILTINS) option). tt(OPTARG)
+upon exit. (The tt(POSIX_BUILTINS) option disables this, and also changes
+the way the value is calculated to match other shells.) tt(OPTARG)
is not reset and retains its value from the most recent call to
tt(getopts). If either of tt(OPTIND) or tt(OPTARG) is explicitly
unset, it remains unset, and the index or option argument is not
@@ -1062,6 +1114,24 @@ The tt(-Z) option replaces the shell's argument and environment space with
the given string, truncated if necessary to fit. This will normally be
visible in tt(ps) (manref(ps)(1)) listings. This feature is typically
used by daemons, to indicate their state.
+
+Full job control is only available in the top-level interactive shell,
+not in commands run in the left hand side of pipelines or within
+the tt(LPAR())var(...)tt(RPAR()) construct. However, a snapshot
+of the job state at that point is taken, so it is still possible
+to use the tt(jobs) builtin, or any parameter providing job information.
+This gives information about the state of jobs at the point the subshell
+was created. If background processes are created within the subshell,
+then instead information about those processes is provided.
+
+For example,
+
+example(sleep 10 & # Job in background
+LPAR() # Shell forks
+jobs # Shows information about "sleep 10 &"
+sleep 5 & # Process in background (no job control)
+jobs # Shows information about "sleep 5 &"
+RPAR())
)
findex(kill)
cindex(killing jobs)
@@ -1184,14 +1254,6 @@ Same as tt(typeset), except that the options tt(-g), and
tt(-f) are not permitted. In this case the tt(-x) option does not force
the use of tt(-g), i.e. exported variables will be local to functions.
)
-findex(log)
-vindex(watch, use of)
-cindex(watching users)
-cindex(users, watching)
-item(tt(log))(
-List all users currently logged in who are affected by
-the current setting of the tt(watch) parameter.
-)
findex(logout)
item(tt(logout) [ var(n) ])(
Same as tt(exit), except that it only works in a login shell.
@@ -1442,7 +1504,7 @@ findex(read)
vindex(IFS, use of)
redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ ))ifnztexi( )))
xitem(tt(read )[ tt(-rszpqAclneE) ] [ tt(-t) [ var(num) ] ] [ tt(-k) [ var(num) ] ] [ tt(-d) var(delim) ])
-item(SPACES()[ tt(-u) var(n) ] [ var(name)[tt(?)var(prompt)] ] [ var(name) ... ])(
+item(SPACES()[ tt(-u) var(n) ] [ [var(name)][tt(?)var(prompt)] ] [ var(name) ... ])(
vindex(REPLY, use of)
vindex(reply, use of)
Read one line and break it into fields using the characters
@@ -1576,7 +1638,13 @@ cindex(functions, returning from)
item(tt(return) [ var(n) ])(
Causes a shell function or `tt(.)' script to return to
the invoking script with the return status specified by
-an arithmetic expression var(n). If var(n)
+an arithmetic expression var(n).
+For example, the following prints `tt(42)':
+
+example(() { integer foo=40; return "foo + 2" }
+echo $?)
+
+If var(n)
is omitted, the return status is that of the last command
executed.
@@ -1587,7 +1655,7 @@ will return to whatever it was previously processing; with a non-zero
status, the shell will behave as interrupted except that the return
status of the trap is retained. Note that the numeric value of the signal
which caused the trap is passed as the first argument, so the statement
-`tt(return $((128PLUS()$1)))' will return the same status as if the signal
+`tt(return "128PLUS()$1")' will return the same status as if the signal
had not been trapped.
)
module(sched)(zsh/sched)
@@ -1836,7 +1904,8 @@ unfreezing the tty does not guarantee settings made on the
command line are preserved. Strings of commands run between
editing the command line will see a consistent tty state.
See also the shell variable tt(STTY) for a means of initialising
-the tty before running external commands.
+the tty before running external commands and/or freezing the tty
+around a single command.
)
findex(type)
item(tt(type) [ tt(-wfpamsS) ] var(name) ...)(
@@ -1865,7 +1934,11 @@ ifnzman(noderef(Local Parameters))\
retain their special attributes when made local.
For each var(name)tt(=)var(value) assignment, the parameter
-var(name) is set to var(value).
+var(name) is set to var(value). If the assignment is omitted and var(name)
+does em(not) refer to an existing parameter, a new parameter is intialized
+to empty string, zero, or empty array (as appropriate), em(unless) the
+shell option tt(TYPESET_TO_UNSET) is set. When that option is set,
+the parameter attributes are recorded but the parameter remains unset.
If the shell option tt(TYPESET_SILENT) is not set, for each remaining
var(name) that refers to a parameter that is already set, the name and
@@ -1933,7 +2006,7 @@ a set of three normal command line arguments to tt(typeset) after
expansion. Hence it is not possible to assign to multiple arrays by
this means.
-Note that each interface to any of the commands my be disabled
+Note that each interface to any of the commands may be disabled
separately. For example, `tt(disable -r typeset)' disables the reserved
word interface to tt(typeset), exposing the builtin interface, while
`tt(disable typeset)' disables the builtin. Note that disabling the
@@ -2294,7 +2367,7 @@ findex(umask)
cindex(umask)
item(tt(umask) [ tt(-S) ] [ var(mask) ])(
The umask is set to var(mask). var(mask) can be either
-an octal number or a symbolic value as described in manref(chmod)(1).
+an octal number or a symbolic value as described in the manref(chmod)(1) man page.
If var(mask) is omitted, the current value is printed. The tt(-S)
option causes the mask to be printed as a symbolic value. Otherwise,
the mask is printed as an octal number. Note that in
diff --git a/Doc/Zsh/calsys.yo b/Doc/Zsh/calsys.yo
index c20c87e61..a8fd876a5 100644
--- a/Doc/Zsh/calsys.yo
+++ b/Doc/Zsh/calsys.yo
@@ -478,7 +478,7 @@ item(tt(calendar_add) [ tt(-BL) ] var(event) ...)(
Adds a single event to the calendar in the appropriate location.
The event can contain multiple lines, as described in
ifnzman(noderef(Calendar File and Date Formats))\
-ifzman(the section Calendar File Format above).
+ifzman(the section `Calendar File Format' above).
Using this function ensures that the calendar file is sorted in date
and time order. It also makes special arrangements for locking
the file while it is altered. The old calendar is left in a file
diff --git a/Doc/Zsh/compat.yo b/Doc/Zsh/compat.yo
index f1be15fee..4d3567d45 100644
--- a/Doc/Zsh/compat.yo
+++ b/Doc/Zsh/compat.yo
@@ -30,8 +30,7 @@ tt(PROMPT2),
tt(PROMPT3),
tt(PROMPT4),
tt(psvar),
-tt(status),
-tt(watch).
+tt(status).
vindex(ENV, use of)
The usual zsh startup/shutdown scripts are not executed. Login shells
@@ -74,3 +73,9 @@ tt(PROMPT_SUBST)
and
tt(SINGLE_LINE_ZLE)
options are set if zsh is invoked as tt(ksh).
+
+Please note that, whilst reasonable efforts are taken to address
+incompatibilities when they arise, zsh does not guarantee complete
+emulation of other shells, nor POSIX compliance. For more information on
+the differences between zsh and other shells, please refer to chapter 2
+of the shell FAQ, uref(https://www.zsh.org/FAQ/).
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index c2d20ca40..584ede441 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -49,7 +49,7 @@ Styles modify various operations of the completion system, such as
output formatting, but also what kinds of completers are used (and in
what order), or which tags are examined. Styles may accept arguments
and are manipulated using the tt(zstyle) command described in
-ifzman(see zmanref(zshmodules))\
+ifzman(zmanref(zshmodules))\
ifnzman(noderef(The zsh/zutil Module)).
In summary, tags describe em(what) the completion objects are, and style
@@ -190,7 +190,7 @@ tt(compinit) will ask if the completion system should really be used. To
avoid these tests and make all files found be used without asking, use the
option tt(-u), and to make tt(compinit) silently ignore all insecure files
and directories use the option tt(-i). This security check is skipped
-entirely when the tt(-C) option is given.
+entirely when the tt(-C) option is given, provided the dumpfile exists.
findex(compaudit)
The security check can be retried at any time by running the function
@@ -322,15 +322,15 @@ item(tt(-array-value-))(
The right hand side of an array-assignment
(`var(name)tt(=LPAR())var(...)tt(RPAR())')
)
-kindex(-brace-parameter-, completion context)
-item(tt(-brace-parameter-))(
-The name of a parameter expansion within braces (`tt(${)var(...)tt(})')
-)
kindex(-assign-parameter-, completion context)
item(tt(-assign-parameter-))(
The name of a parameter in an assignment, i.e. on the left hand side of
an `tt(=)'
)
+kindex(-brace-parameter-, completion context)
+item(tt(-brace-parameter-))(
+The name of a parameter expansion within braces (`tt(${)var(...)tt(})')
+)
kindex(-command-, completion context)
item(tt(-command-))(
A word in command position
@@ -658,8 +658,8 @@ ifnzman(noderef(Bindable Commands)).
When looking up styles the completion system uses full context names,
including the tag. Looking up the value of a style therefore consists of
two things: the context, which is matched to the most specific (best
-fitting) style pattern, and the name of the style itself, which must be
-matched exactly. The following examples demonstrate that style patterns
+fitting) pattern, and the name of the style itself, which must be
+matched exactly. The following examples demonstrate that patterns
may be loosely defined for styles that apply broadly, or as tightly
defined as desired for styles that apply in narrower circumstances.
@@ -673,7 +673,7 @@ example(zstyle ':completion:*' verbose yes)
in a startup file (probably tt(.zshrc)).
This gives the tt(verbose) style the value tt(yes) in every
context inside the completion system, unless that context has a more
-specific definition. It is best to avoid giving the context as `tt(*)'
+specific definition. It is best to avoid giving the pattern as `tt(*)'
in case the style has some meaning outside the completion system.
Many such general purpose styles can be configured simply by using the
@@ -710,15 +710,21 @@ as tt(menu) and tt(list-rows-first).
Note that the order in which styles are em(defined) does not matter; the
style mechanism uses the most specific possible match for a particular
-style to determine the set of values. More precisely, strings are
+style to determine the set of values. Strings are
preferred over patterns (for example, `tt(:completion::complete:::foo)' is
more specific than `tt(:completion::complete:::*')), and longer patterns are
-preferred over shorter patterns.
-
-A good rule of thumb is that any completion style pattern that needs to
-include more than one wildcard (tt(*)) and that does not end in a tag
-name, should include all six colons (tt(:)), possibly surrounding
-additional wildcards.
+preferred over the pattern `tt(*)'. See
+ifzman(zmanref(zmodules))ifnzman(noderef(The zsh/zutil Module))
+for details.
+
+Context patterns that use something other than a wildcard (tt(*)) to match the
+middle parts of the context DASH()- the var(completer), var(command), and
+var(argument) in
+tt(:completion:)var(function)tt(:)var(completer)tt(:)var(command)tt(:)var(argument)tt(:)var(tag)
+DASH()- should include all six colons (tt(:)) explicitly. Without this,
+a pattern such as tt(:completion:*:foo:*) could match tt(foo) against a
+component other than the intended one (for example, against var(completer) when
+a match against var(command) was intended).
Style names like those of tags are arbitrary and depend on the completion
function. However, the following two sections list some of the most
@@ -885,14 +891,14 @@ kindex(indexes, completion tag)
item(tt(indexes))(
for array indexes
)
-kindex(jobs, completion tag)
-item(tt(jobs))(
-for jobs (as listed by the `tt(jobs)' builtin)
-)
kindex(interfaces, completion tag)
item(tt(interfaces))(
for network interfaces
)
+kindex(jobs, completion tag)
+item(tt(jobs))(
+for jobs (as listed by the `tt(jobs)' builtin)
+)
kindex(keymaps, completion tag)
item(tt(keymaps))(
for names of zsh keymaps
@@ -916,14 +922,14 @@ directory when completing arguments of tt(cd) and related builtin
commands (compare tt(path-directories)) DASH()- when the tt(cdpath)
array is unset, tt(directories) is used instead
)
-kindex(manuals, completion tag)
-item(tt(manuals))(
-for names of manual pages
-)
kindex(mailboxes, completion tag)
item(tt(mailboxes))(
for e-mail folders
)
+kindex(manuals, completion tag)
+item(tt(manuals))(
+for names of manual pages
+)
kindex(maps, completion tag)
item(tt(maps))(
for map names (e.g. NIS maps)
@@ -973,11 +979,6 @@ kindex(other-accounts, completion tag)
item(tt(other-accounts))(
used to look up the tt(users-hosts) style
)
-kindex(other-files, completion tag)
-item(tt(other-files))(
-for the names of any non-directory files. This is used instead
-of tt(all-files) when the tt(list-dirs-first) style is in effect.
-)
kindex(packages, completion tag)
item(tt(packages))(
for packages (e.g. tt(rpm) or installed tt(Debian) packages)
@@ -1388,6 +1389,12 @@ components after the first ambiguous one will also be added. This means
that the resulting string is the longest unambiguous string possible.
However, menu completion can be used to cycle through all matches.
)
+kindex(extra-verbose, completion style)
+item(tt(extra-verbose))(
+If set, the completion listing is more verbose at the cost of
+a probable decrease in completion speed. Completion performance
+will suffer if this style is set to `true'.
+)
kindex(fake, completion style)
item(tt(fake))(
This style may be set for any completion context. It
@@ -1523,9 +1530,10 @@ If no `tt(:)var(tag)' is given the `tt(files)' tag will be used.
The var(tag) may also be followed by an optional second colon and a
description, which will be used for the `tt(%d)' in the value of
the tt(format) style (if that is set) instead of the default
-description supplied by the completion function. If the description
-given here contains itself a `tt(%d)', that is replaced with the
-description supplied by the completion function.
+description supplied by the completion function. The inclusion
+of a description also gives precedence to associated options such as
+for completion grouping so it can be used where files should be
+separated.
For example, to make the tt(rm) command first complete only names of
object files and then the names of all files if there is no matching
@@ -1547,6 +1555,15 @@ all files using the pattern `tt(*)' at the first step and stops when it
sees this pattern. Note also it will never try a pattern more than once
for a single completion attempt.
+To separate directories into a separate group from the files but still
+complete them at the first attempt, a description needs to be given.
+Note that directories need to be explicitly excluded from the
+globbed-files because `tt(*)' will match directories. For grouping, it
+is also necessary to set the tt(group-name) style.
+
+example(zstyle ':completion:*' file-patterns \
+ '%p+LPAR()^-/RPAR():globbed-files *(-/):directories:location')
+
During the execution of completion functions, the tt(EXTENDED_GLOB)
option is in effect, so the characters `tt(#)', `tt(~)' and `tt(^)' have
special meanings in the patterns.
@@ -1641,6 +1658,15 @@ ifzman(zmanref(zshmodules))\
ifnzman(noderef(The zsh/zutil Module))\
.
)
+kindex(gain-privileges, completion style)
+item(tt(gain-privileges))(
+If set to tt(true), this style enables the use of commands like tt(sudo)
+or tt(doas) to gain extra privileges when retrieving information for
+completion. This is only done when a command such as tt(sudo) appears on
+the command-line. To force the use of, e.g. tt(sudo) or to override any
+prefix that might be added due to tt(gain-privileges), the tt(command)
+style can be used with a value that begins with a hyphen.
+)
kindex(glob, completion style)
item(tt(glob))(
This is used by the tt(_expand) completer. If
@@ -1679,6 +1705,9 @@ example(zstyle ':completion:*' group-name '')
All matches for which no group name is defined will be put in a group
named tt(-default-).
+
+To display the group name in the output, see the tt(format) style (q.v.)
+under the tt(descriptions) tag.
)
kindex(group-order, completion style)
item(tt(group-order))(
@@ -1784,12 +1813,6 @@ Excluded values act in a similar fashion to values of the
tt(ignored-patterns) style, so they can be restored to consideration by
the tt(_ignored) completer.
)
-kindex(extra-verbose, completion style)
-item(tt(extra-verbose))(
-If set, the completion listing is more verbose at the cost of
-a probable decrease in completion speed. Completion performance
-will suffer if this style is set to `true'.
-)
kindex(ignored-patterns, completion style)
item(tt(ignored-patterns))(
A list of patterns; any trial completion matching one of the patterns
@@ -1826,6 +1849,28 @@ be unsuccessful until that point. If the value is any other
string, menu completion will be started when the string typed by the
user is longer than the common prefix to the corresponding IDs.
)
+kindex(insert-sections, completion style)
+item(tt(insert-sections))(
+This style is used with tags of the form `tt(manuals.)var(X)' when
+completing names of manual pages. If set and the var(X) in the tag name matches
+the section number of the page being completed, the section number is inserted
+along with the page name. For example, given
+
+example(zstyle ':completion:*:manuals.*' insert-sections true)
+
+tt(man ssh_<TAB>) may be completed to tt(man 5 ssh_config).
+
+The value may also be set to one of `tt(prepend)', or `tt(suffix)'.
+`tt(prepend)' behaves the same as `true' as in the above example, while
+`tt(suffix)' would complete tt(man ssh_<TAB>) as tt(man ssh_config.5).
+
+This is especially useful in conjunction with tt(separate-sections), as
+it ensures that the page requested of tt(man) corresponds to the one
+displayed in the completion listing when there are multiple pages with the
+same name (e.g., tt(printf+LPAR()1+RPAR()) and tt(printf+LPAR()3+RPAR())).
+
+The default for this style is `false'.
+)
kindex(insert-tab, completion style)
item(tt(insert-tab))(
If this is set to `true', the completion system will
@@ -1864,15 +1909,6 @@ In the case of the tt(_match) completer, the style may also be set to
the string `tt(pattern)'. Then the pattern on the line is left
unchanged if it does not match unambiguously.
)
-kindex(gain-privileges, completion style)
-item(tt(gain-privileges))(
-If set to tt(true), this style enables the use of commands like tt(sudo)
-or tt(doas) to gain extra privileges when retrieving information for
-completion. This is only done when a command such as tt(sudo) appears on
-the command-line. To force the use of, e.g. tt(sudo) or to override any
-prefix that might be added due to tt(gain-privileges), the tt(command)
-style can be used with a value that begins with a hyphen.
-)
kindex(keep-prefix, completion style)
item(tt(keep-prefix))(
This style is used by the tt(_expand) completer. If it is `true', the
@@ -1888,6 +1924,13 @@ The behaviour of tt(_expand) when this style is `true' is to cause tt(_expand)
to give up when a single expansion with the restored prefix is the same
as the original; hence any remaining completers may be called.
)
+kindex(known-hosts-files)
+item(tt(known-hosts-files))(
+This style should contain a list of files to search for host names and
+(if the tt(use-ip) style is set) IP addresses in a format compatible with
+ssh tt(known_hosts) files. If it is not set, the files
+tt(/etc/ssh/ssh_known_hosts) and tt(~/.ssh/known_hosts) are used.
+)
kindex(last-prompt, completion style)
item(tt(last-prompt))(
This is a more flexible form of the tt(ALWAYS_LAST_PROMPT) option.
@@ -1899,13 +1942,6 @@ previous line if this style is `true' for all types of match. Note
that unlike the tt(ALWAYS_LAST_PROMPT) option this is independent of the
numeric argument.
)
-kindex(known-hosts-files)
-item(tt(known-hosts-files))(
-This style should contain a list of files to search for host names and
-(if the tt(use-ip) style is set) IP addresses in a format compatible with
-ssh tt(known_hosts) files. If it is not set, the files
-tt(/etc/ssh/ssh_known_hosts) and tt(~/.ssh/known_hosts) are used.
-)
kindex(list, completion style)
item(tt(list))(
This style is used by the tt(_history_complete_word) bindable command.
@@ -1945,11 +1981,10 @@ obtained by setting the style to an empty string (i.e. tt('')).
)
kindex(list-dirs-first, completion style)
item(tt(list-dirs-first))(
-This is used by file completion. If set, directories to be completed
-are listed separately from and before completion for other files,
-regardless of tag ordering. In addition, the tag tt(other-files)
-is used in place of tt(all-files) for the remaining files, to indicate
-that no directories are presented with that tag.
+This is used by file completion and corresponds to a particular
+setting of the tt(file-patterns) style.
+If set, the default directories to be completed
+are listed separately from and before completion for other files.
)
kindex(list-grouped, completion style)
item(tt(list-grouped))(
@@ -2004,6 +2039,12 @@ This style is tested in the same way as the tt(list-packed) style and
determines whether matches are to be listed in a rows-first fashion as
if the tt(LIST_ROWS_FIRST) option were set.
)
+kindex(list-separator, completion style)
+item(tt(list-separator))(
+The value of this style is used in completion listing to separate the
+string to complete from a description when possible (e.g. when
+completing options). It defaults to `tt(-)tt(-)' (two hyphens).
+)
kindex(list-suffixes, completion style)
item(tt(list-suffixes))(
This style is used by the function that completes filenames. If it is
@@ -2011,12 +2052,6 @@ This style is used by the function that completes filenames. If it is
typed pathname components, all ambiguous components will be shown.
Otherwise, completion stops at the first ambiguous component.
)
-kindex(list-separator, completion style)
-item(tt(list-separator))(
-The value of this style is used in completion listing to separate the
-string to complete from a description when possible (e.g. when
-completing options). It defaults to `tt(-)tt(-)' (two hyphens).
-)
kindex(local, completion style)
item(tt(local))(
This is for use with functions that complete URLs for which the
@@ -2445,7 +2480,7 @@ For example,
example(zstyle ':completion:*' recursive-files '*/zsh/*')
If the current directory is tt(/home/pws/zsh/Src), then
-tt(zle_tr)em(TAB) can be completed to tt(Zle/zle_tricky.c).
+tt(zle_tr<TAB>) can be completed to tt(Zle/zle_tricky.c).
)
kindex(regular, completion style)
item(tt(regular))(
@@ -2502,12 +2537,13 @@ kindex(separate-sections, completion style)
item(tt(separate-sections))(
This style is used with the tt(manuals) tag when completing names of
manual pages. If it is `true', entries for different sections are
-added separately using tag names of the form `tt(manual.)var(X)',
+added separately using tag names of the form `tt(manuals.)var(X)',
where var(X) is the section number. When the tt(group-name) style is
also in effect, pages from different sections will appear separately.
This style is also used similarly with the tt(words) style when
completing words for the dict command. It allows words from different
-dictionary databases to be added separately.
+dictionary databases to be added separately. See also tt(insert-sections).
+
The default for this style is `false'.
)
kindex(show-ambiguity, completion style)
@@ -3584,8 +3620,18 @@ described using the var(spec)s which are of the form:
`var(tag)tt(:)var(descr)tt(:)var(action)'. The var(tag)s are offered using
tt(_tags) and if the tag is requested, the var(action) is executed with the
given description var(descr). The var(action)s are those accepted
-by the tt(_arguments) function (described below), excluding the
-`tt(->)var(state)' and `tt(=)var(...)' forms.
+by the tt(_arguments) function (described below), with the following
+exceptions:
+startitemize()
+itemiz(\
+The `tt(->)var(state)' and `tt(=)var(...)' forms are not supported.
+)
+itemiz(\
+The `tt(LPAR()LPAR()a\:bar b\:baz)tt(RPAR()RPAR())' form does not need
+the colon to be escaped, since the var(spec)s have no colon-separated fields
+after the var(action).
+)
+enditemize()
For example, the var(action) may be a simple function call:
@@ -3715,6 +3761,12 @@ The default var(matchspec) allows partial word completion after `tt(_)' and
var(matchspec) is:
example(tt(r:|[_-]=* r:|=*))
)
+item(tt(-0))(
+When populating values of the `tt(opt_args)' associative array, don't
+backslash-escape colons and backslashes and use NUL rather than colon for
+joining multiple values. This option is described in more detail below, under
+the heading em(var(spec)s: actions).
+)
enditem()
em(var(spec)s: overview)
@@ -3887,6 +3939,7 @@ specific contexts: on the first call `tt(_arguments $global_options)' is
used, and on subsequent calls `tt(_arguments !$^global_options)'.
em(var(spec)s: actions)
+COMMENT(If you change this section title, change the references to it in running text.)
In each of the forms above the var(action) determines how
completions should be generated. Except for the `tt(->)var(string)'
@@ -4008,9 +4061,21 @@ the normal arguments from the command line, i.e. the words from the
command line after the command name excluding all options and their
arguments. Options are stored in the associative array
`tt(opt_args)' with option names as keys and their arguments as
-the values. For options that have more than one argument these are
-given as one string, separated by colons. All colons and backslashes
-in the original arguments are preceded with backslashes.
+the values. By default, all colons and backslashes in the value are escaped
+with backslashes, and if an option has multiple arguments (for example, when
+using an var(optspec) of the form `tt(*)var(optspec)'), they are joined with
+(unescaped) colons. However, if the tt(-0) option was passed, no backslash
+escaping is performed, and multiple values are joined with NUL bytes. For
+example, after `tt(zsh -o foo:foo -o bar:bar -o <TAB>)', the contents of
+`tt(opt_args)' would be
+
+example(typeset -A opt_args=( [-o]='foo\:foo:bar\:bar:' ))
+
+by default, and
+
+example(typeset -A opt_args=( [-o]=$'foo:foo\x00bar:bar\x00' ))
+
+if tt(_arguments) had been called with the tt(-0) option.
The parameter `tt(context)' is set when returning to the calling function
to perform an action of the form `tt(->)var(string)'. It is set to an
@@ -4223,7 +4288,7 @@ The last two descriptions say what should be completed as
arguments. The first describes the first argument as a
`var(postscript file)' and makes files ending in `tt(ps)' or `tt(eps)'
be completed. The last description gives all other arguments the
-description `var(page numbers)' but does not offer completions.
+description `var(page number)' but does not offer completions.
)
findex(_cache_invalid)
item(tt(_cache_invalid) var(cache_identifier))(
@@ -4349,6 +4414,15 @@ Include the leading underscore (`tt(_)') in the matches.
)
enditem()
)
+findex(_default)
+item(tt(_default))(
+This function corresponds to the tt(-default-) special context which is
+applied where no completion is defined. It is useful to call it under
+certain error conditions such as completion after an unrecognised
+subcommand. This applies the concept of graceful degradation to the
+completion system, allowing it to fallback on basic completion of
+commonly useful things like filenames.
+)
findex(_describe)
redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ @ @ ))ifnztexi( )))
xitem(tt(_describe )[tt(-12JVx)] [ tt(-oO) | tt(-t) var(tag) ] var(descr) var(name1) [ var(name2) ] [ var(opt) ... ])
@@ -4422,8 +4496,22 @@ not contain an explanation string to be displayed above the matches.
If tt(_description) is called with more than three arguments,
the additional var(spec)s should be of the form `var(char)tt(:)var(str)'.
These supply escape sequence replacements for the tt(format) style:
-every appearance of `tt(%)var(char)' will be
-replaced by var(string).
+every appearance of `tt(%)var(char)' will be replaced by var(string).
+If no additional var(spec)s are given but the description in var(descr)
+conforms to a common form then further escape sequences are set for
+elements of that description. These elements correspond to a default
+value (`tt(%o)'), the units (`tt(%m)') range of acceptable values
+(`tt(%r)') and the remaining initial part of the description (`tt(%h)').
+The form the description takes consists of specifying the units and
+range in parentheses and the default value in square brackets, for
+example:
+
+example(_description times expl 'timeout (seconds) (0-60) [20]')
+
+It is possible to use tt(zformat) conditional expressions when styling
+these elements. So, for example, to add `tt(default:)' as a tag but only
+when there is a default value to show, the tt(format) style might
+include `tt(%(o.default: %o.))'.
If the tt(-x) option is given, the description will be passed to
tt(compadd) using the tt(-x) option instead of the default tt(-X). This
@@ -4699,6 +4787,69 @@ checked. If it is set completion is terminated at that point even if
no matches have been found. This is the same effect as in the
tt(-first-) context.
)
+findex(_numbers)
+item(tt(_numbers) [ var(option) ... ] [ var(description) ] [ var(suffix) ... ])(
+This can be used where a number is followed by a suffix to indicate the units.
+The unit suffixes are completed and can also be included in the description
+used when completion is invoked for the preceding number.
+
+In addition to common tt(compadd) options, tt(_numbers) accepts the following
+options:
+
+startitem()
+item(tt(-t) var(tag))(
+Specify a tag to use instead of the default of tt(numbers).
+)
+item(tt(-u) var(units))(
+Indicate the default units for the number, e.g. tt(bytes).
+)
+item(tt(-l) var(min))(
+Specify the lowest possible value for the number.
+)
+item(tt(-m) var(max))(
+Specify the highest possible value for the number.
+)
+item(tt(-d) var(default))(
+Specify the default value.
+)
+item(tt(-N))(
+Allow negative numbers. This is implied if the range includes a negative.
+)
+item(tt(-f))(
+Allow decimal numbers.
+)
+enditem()
+
+Where a particular suffix represents the default units for a number, it
+should be prefixed with a colon. Additionally, suffixes can be followed
+by a colon and a description. So for example, the following allows the
+age of something to be specified, either in seconds or with an optional
+suffix with a longer unit of time:
+
+example(_numbers -u seconds age :s:seconds m:minutes h:hours d:days)
+
+It is typically helpful for units to be presented in order of magnitude
+when completed. To facilitate this, the order in which they are given
+is preserved.
+
+When the tt(format) style is looked up with the tt(descriptions) tag or
+the tag specified with tt(-t), the list of suffixes is available as a
+`tt(%x)' escape sequence. This is in addition to the usual sequences
+documented under the tt(format) style. The form this list takes can also
+be configured. To this end, the tt(format) style is first looked up with
+the tag tt(unit-suffixes). The retrieved format is applied to each
+suffix in turn and the results are then concatenated to form the
+completed list. For the tt(unit-suffixes) format, `tt(%x)' expands to
+the individual suffix and `tt(%X)' to its description. tt(%d)' indicates
+a default suffix and can be used in a condition. The index and reverse
+index are set in `tt(%i)' and `tt(%r)' respectively and are useful for
+text included only with the first and last suffixes in the list. So for
+example, the following joins the suffixes together as a comma-separated
+list:
+
+example(zstyle ':completion:*:unit-suffixes' format '%x%(r::,)')
+)
+
findex(_options)
item(tt(_options))(
This can be used to complete the names of shell options. It provides a
@@ -5244,7 +5395,11 @@ matches with the given description:
example(local expl
_wanted tag expl 'description' \
- compadd matches...)
+ compadd -- var(match1) var(match2)...)
+
+See also the use of tt(_wanted) in the example function in
+ifzman(the subsection `Dynamic named directories' in zmanref(zshexpn))\
+ifnzman(noderef(Dynamic named directories)).
Note that, as for tt(_requested), the var(command) must be able to
accept options to be passed down to tt(compadd).
@@ -5284,7 +5439,6 @@ in the tt(_comp_caller_options) associative array. Option names, spelled
in lowercase without underscores, are mapped to one or other of the
strings `tt(on)' and `tt(off)'.
)
-
item(tt(_comp_priv_prefix))(
Completion functions such as tt(_sudo) can set the tt(_comp_priv_prefix)
array to a command prefix that may then be used by tt(_call_program) to
@@ -5292,6 +5446,8 @@ match the privileges when calling programs to generate matches.
)
enditem()
+vindex(compprefuncs, use of)
+vindex(comppostfuncs, use of)
Two more features are offered by the tt(_main_complete) function. The
arrays tt(compprefuncs) and tt(comppostfuncs) may contain
names of functions that are to be called immediately before or after
diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo
index 0b98d07b2..d32a0702f 100644
--- a/Doc/Zsh/compwid.yo
+++ b/Doc/Zsh/compwid.yo
@@ -39,7 +39,7 @@ using the tt(bindkey) builtin command defined in the tt(zsh/zle) module
ifzman(see zmanref(zshzle))\
ifnzman(noderef(Zsh Line Editor))\
), typing that key will call the shell function `tt(completer)'. This
-function is responsible for generating the possible matches using the
+function is responsible for generating completion matches using the
builtins described below. As with other ZLE widgets, the function is
called with its standard input closed.
@@ -213,7 +213,7 @@ The string of an exact match if one was found, otherwise unset.
)
vindex(ignored, compstate)
item(tt(ignored))(
-The number of words that were ignored because they matched one of the
+The number of completions that were ignored because they matched one of the
patterns given with the tt(-F) option to the tt(compadd) builtin
command.
)
@@ -309,8 +309,7 @@ will be used in the same way as the value of tt(LISTMAX).
)
vindex(nmatches, compstate)
item(tt(nmatches))(
-The number of matches generated and accepted by the completion code so
-far.
+The number of matches added by the completion code so far.
)
vindex(old_insert, compstate)
item(tt(old_insert))(
@@ -346,7 +345,8 @@ value of a parameter assignment.
vindex(pattern_insert, compstate)
item(tt(pattern_insert))(
Normally this is set to tt(menu), which specifies that menu completion will
-be used whenever a set of matches was generated using pattern matching. If
+be used whenever a set of matches was generated using tt(pattern_match)
+(see below). If
it is set to any other non-empty string by the user and menu completion is
not selected by other option settings, the code will instead insert any
common prefix for the generated matches as with normal completion.
@@ -362,7 +362,7 @@ command line will be treated as patterns; if it is `tt(*)', then
additionally a wildcard `tt(*)' is assumed at the cursor position; if
it is empty or unset, metacharacters will be treated literally.
-Note that the matcher specifications given to the tt(compadd) builtin
+Note that the match specifications given to the tt(compadd) builtin
command are not used if this is set to a non-empty string.
)
vindex(quote, compstate)
@@ -456,17 +456,16 @@ xitem(SPACES()[tt(-V) var(group-name) ] [ tt(-o) [ var(order) ] ])
xitem(SPACES()[tt(-r) var(remove-chars) ] [ tt(-R) var(remove-func) ])
xitem(SPACES()[tt(-D) var(array) ] [ tt(-O) var(array) ] [ tt(-A) var(array) ])
xitem(SPACES()[tt(-E) var(number) ])
-item(SPACES()[tt(-M) var(match-spec) ] [ tt(-)tt(-) ] [ var(words) ... ])(
+item(SPACES()[tt(-M) var(match-spec) ] [ tt(-)tt(-) ] [ var(completions) ... ])(
This builtin command can be used to add matches directly and control
all the information the completion code stores with each possible
-match. The return status is zero if at least one match was added and
+completion. The return status is zero if at least one match was added and
non-zero if no matches were added.
-The completion code breaks the string to complete into seven fields in
-the order:
+The completion code breaks each match into seven fields in the order:
-indent(var(<ipre><apre><hpre><word><hsuf><asuf><isuf>))
+indent(var(<ipre><apre><hpre><body><hsuf><asuf><isuf>))
The first field
is an ignored prefix taken from the command line, the contents of the
@@ -474,12 +473,12 @@ tt(IPREFIX) parameter plus the string given with the tt(-i)
option. With the tt(-U) option, only the string from the tt(-i)
option is used. The field var(<apre>) is an optional prefix string
given with the tt(-P) option. The var(<hpre>) field is a string
-that is considered part of the match but that should not be shown when
+that is considered part of the match but that should not be shown when
listing completions, given with the tt(-p) option; for example,
functions that do filename generation might specify
-a common path prefix this way. var(<word>) is the part of the match that
-should appear in the list of completions, i.e. one of the var(words) given
-at the end of the tt(compadd) command line. The suffixes var(<hsuf>),
+a common path prefix this way. var(<body>) is the part of the match that
+should appear in the list of matches shown to the user.
+The suffixes var(<hsuf>),
var(<asuf>) and var(<isuf>) correspond to the prefixes var(<hpre>),
var(<apre>) and var(<ipre>) and are given by the options tt(-s), tt(-S) and
tt(-I), respectively.
@@ -488,52 +487,52 @@ The supported flags are:
startitem()
item(tt(-P) var(prefix))(
-This gives a string to be inserted before the given var(words). The
+This gives a string to be inserted before each match. The
string given is not considered as part of the match and any shell
metacharacters in it will not be quoted when the string is inserted.
)
item(tt(-S) var(suffix))(
-Like tt(-P), but gives a string to be inserted after the match.
+Like tt(-P), but gives a string to be inserted after each match.
)
item(tt(-p) var(hidden-prefix))(
-This gives a string that should be inserted into the command line before the
+This gives a string that should be inserted before each
match but that should not appear in the list of matches. Unless the
tt(-U) option is given, this string must be matched as part of the string
on the command line.
)
item(tt(-s) var(hidden-suffix))(
-Like `tt(-p)', but gives a string to insert after the match.
+Like `tt(-p)', but gives a string to insert after each match.
)
item(tt(-i) var(ignored-prefix))(
-This gives a string to insert into the command line just before any
+This gives a string to insert just before any
string given with the `tt(-P)' option. Without `tt(-P)' the string is
-inserted before the string given with `tt(-p)' or directly before the
+inserted before the string given with `tt(-p)' or directly before each
match.
)
item(tt(-I) var(ignored-suffix))(
Like tt(-i), but gives an ignored suffix.
)
item(tt(-a))(
-With this flag the var(words) are taken as names of arrays and the
-possible matches are their values. If only some elements of the
-arrays are needed, the var(words) may also contain subscripts, as in
+With this flag the var(completions) are taken as names of arrays and the
+actual completions are their values. If only some elements of the
+arrays are needed, the var(completions) may also contain subscripts, as in
`tt(foo[2,-1])'.
)
item(tt(-k))(
-With this flag the var(words) are taken as names of associative arrays
-and the possible matches are their keys. As for tt(-a), the
+With this flag the var(completions) are taken as names of associative arrays
+and the actual completions are their keys. As for tt(-a), the
var(words) may also contain subscripts, as in `tt(foo[(R)*bar*])'.
)
item(tt(-d) var(array))(
-This adds per-match display strings. The var(array) should contain one
-element per var(word) given. The completion code will then display the
-first element instead of the first var(word), and so on. The
+This adds per-completion display strings. The var(array) should contain one
+element per var(completion) given. The completion code will then display the
+first element instead of the first var(completion), and so on. The
var(array) may be given as the name of an array parameter or directly
as a space-separated list of words in parentheses.
-If there are fewer display strings than var(words), the leftover
-var(words) will be displayed unchanged and if there are more display
-strings than var(words), the leftover display strings will be silently
+If there are fewer display strings than var(completions), the leftover
+var(completions) will be displayed unchanged and if there are more display
+strings than var(completions), the leftover display strings will be silently
ignored.
)
item(tt(-l))(
@@ -556,7 +555,8 @@ by the tt(-d) option). This is the default if `tt(-o)' is specified but
the var(order) argument is omitted.
)
item(tt(nosort))(
-This specifies that the matches are pre-sorted and their order should be
+This specifies that the var(completions)
+are pre-sorted and their order should be
preserved. This value only makes sense alone and cannot be combined with any
others.
)
@@ -570,7 +570,7 @@ Arrange the matches backwards by reversing the sort ordering.
enditem()
)
item(tt(-J) var(group-name))(
-Gives the name of the group of matches the words should be stored in.
+Gives the name of the group that the matches should be stored in.
)
item(tt(-V) var(group-name))(
Like tt(-J) but naming an unsorted group. This option is identical to
@@ -616,13 +616,13 @@ produce unexpected results. If arbitrary text is to be passed in a
description, it can be escaped using e.g. tt(${my_str//\%/%%}).
)
item(tt(-x) var(message))(
-Like tt(-X), but the var(message) will be printed even if there are no
+Like tt(-X), but the var(message) will be printed even if there are no
matches in the group.
)
item(tt(-q))(
-The suffix given with tt(-S) will be automatically removed if
+The suffix given with tt(-S) will be automatically removed if
the next character typed is a blank or does not insert anything, or if
-the suffix consists of only one character and the next character typed
+the suffix consists of only one character and the next character typed
is the same character.
)
item(tt(-r) var(remove-chars))(
@@ -644,8 +644,8 @@ automatically added space will be removed when one of the characters in the
list is typed.
)
item(tt(-R) var(remove-func))(
-This is another form of the tt(-r) option. When a suffix
-has been inserted and the completion accepted, the function
+This is another form of the tt(-r) option. When a match
+has been accepted and a suffix has been inserted, the function
var(remove-func) will be called after the next character typed. It is
passed the length of the suffix as an argument and can use the special
parameters available in ordinary (non-completion) zle widgets (see
@@ -654,7 +654,7 @@ ifnzman(noderef(Zsh Line Editor))\
) to analyse and modify the command line.
)
item(tt(-f))(
-If this flag is given, all of the matches built from var(words) are
+If this flag is given, all of the matches built from the var(completions) are
marked as being the names of files. They are not required to be actual
filenames, but if they are, and the option tt(LIST_TYPES) is set, the
characters describing the types of the files in the completion lists will
@@ -668,15 +668,14 @@ the tt(AUTO_PARAM_SLASH) and tt(AUTO_PARAM_KEYS) options be used for
the matches.
)
item(tt(-W) var(file-prefix))(
-This string is a pathname that will be
-prepended to each of the matches formed by the given var(words) together
+This string is a pathname that will be prepended to each match together
with any prefix specified by the tt(-p) option to form a complete filename
for testing. Hence it is only useful if combined with the tt(-f) flag, as
the tests will not otherwise be performed.
)
item(tt(-F) var(array))(
-Specifies an array containing patterns. Words matching one of these
-patterns are ignored, i.e. not considered to be possible matches.
+Specifies an array containing patterns. var(completions) that match one of
+these patterns are ignored, that is, not considered to be matches.
The var(array) may be the name of an array parameter or a list of
literal patterns enclosed in parentheses and quoted, as in `tt(-F "(*?.o
@@ -684,8 +683,8 @@ literal patterns enclosed in parentheses and quoted, as in `tt(-F "(*?.o
taken as the patterns.
)
item(tt(-Q))(
-This flag instructs the completion
-code not to quote any metacharacters in the words when inserting them
+This flag instructs the completion
+code not to quote any metacharacters in the matches when inserting them
into the command line.
)
item(tt(-M) var(match-spec))(
@@ -696,47 +695,50 @@ between them to form the specification string to use.
Note that they will only be used if the tt(-U) option is not given.
)
item(tt(-n))(
-Specifies that the words added are to be used as possible
-matches, but are not to appear in the completion listing.
+Specifies that matching var(completions) are to be added to the set of
+matches, but are not to be listed to the user.
)
item(tt(-U))(
-If this flag is given, all words given will be accepted and no matching
+If this flag is given, all var(completions) are added
+to the set of matches and no matching
will be done by the completion code. Normally this is used in
functions that do the matching themselves.
)
item(tt(-O) var(array))(
-If this option is given, the var(words) are em(not) added to the set of
-possible completions. Instead, matching is done as usual and all of the
-var(words) given as arguments that match the string on the command line
+If this option is given, the var(completions) are em(not) added to the set of
+matches. Instead, matching is done as usual and all of the
+var(completions) that match
will be stored in the array parameter whose name is given as var(array).
)
item(tt(-A) var(array))(
-As the tt(-O) option, except that instead of those of the var(words) which
+As the tt(-O) option, except that instead of those of the var(completions)
+which
match being stored in var(array), the strings generated internally by the
-completion code are stored. For example,
-with a matching specification of `tt(-M "L:|no=")', the string `tt(nof)'
-on the command line and the string `tt(foo)' as one of the var(words), this
+completion code are stored. For example,
+with a match specification of `tt(-M "L:|no=")', a current word of `tt(nof)'
+and var(completions) of `tt(foo)', this
option stores the string `tt(nofoo)' in the array, whereas the tt(-O)
option stores the `tt(foo)' originally given.
)
item(tt(-D) var(array))(
-As with tt(-O), the var(words) are not added to the set of possible
-completions. Instead, the completion code tests whether each var(word)
-in turn matches what is on the line. If the var(n)th var(word) does not
+As with tt(-O), the var(completions) are not added to the set of matches.
+Instead, whenever the var(n)th var(completion) does not
match, the var(n)th element of the var(array) is removed. Elements
-for which the corresponding var(word) is matched are retained.
+for which the corresponding var(completion) matches are retained.
+This option can be used more than once to remove elements from multiple
+arrays.
)
item(tt(-C))(
This option adds a special match which expands to all other matches
when inserted into the line, even those that are added after this
option is used. Together with the tt(-d) option it is possible to
-specify a string that should be displayed in the list for this special
-match. If no string is given, it will be shown as a string containing
-the strings that would be inserted for the other matches, truncated to
+specify a string that should be displayed in the list for this special
+match. If no string is given, it will be shown as a string containing
+the strings that would be inserted for the other matches, truncated to
the width of the screen.
)
item(tt(-E) var(number))(
-This option adds var(number) empty matches after the var(words) have
+This option adds var(number) empty matches after matching var(completions) have
been added. An empty match takes up space in completion listings but
will never be inserted in the line and can't be selected with menu
completion or menu selection. This makes empty matches only useful to
@@ -751,7 +753,7 @@ added.
xitem(tt(-))
item(tt(-)tt(-))(
This flag ends the list of flags and options. All arguments after it
-will be taken as the words to use as matches even if they begin with
+will be taken as the var(completions) even if they begin with
hyphens.
)
enditem()
@@ -788,7 +790,7 @@ Without the optional var(number), the longest match is taken, but
if var(number) is given, anything up to the var(number)th match is
moved. If the var(number) is negative, the var(number)th longest
match is moved. For example, if tt(PREFIX) contains the string
-`tt(a=b=c)', then tt(compset -P '*\=') will move the string `tt(a=b=)'
+`tt(a=b=c)', then tt(compset -P '*\=') will move the string `tt(a=b=)'
into the tt(IPREFIX) parameter, but tt(compset -P 1 '*\=') will move only
the string `tt(a=)'.
)
@@ -801,7 +803,7 @@ As tt(-P), but match the last portion of tt(SUFFIX) and transfer the
matched portion to the front of the value of tt(ISUFFIX).
)
item(tt(-n) var(begin) [ var(end) ])(
-If the current word position as specified by the parameter tt(CURRENT)
+If the current word position as specified by the parameter tt(CURRENT)
is greater than or equal to var(begin), anything up to the
var(begin)th word is removed from the tt(words) array and the value
of the parameter tt(CURRENT) is decremented by var(begin).
@@ -824,7 +826,7 @@ point to the same word in the changed array.
If the optional pattern var(end-pat) is also given, and there is an
element in the tt(words) array matching this pattern, the parameters
are modified only if the index of this word is higher than the one
-given by the tt(CURRENT) parameter (so that the matching word has
+given by the tt(CURRENT) parameter (so that the matching word has
to be after the cursor). In this case, the words starting with the one
matching tt(end-pat) are also removed from the tt(words)
array. If tt(words) contains no word matching var(end-pat), the
@@ -833,7 +835,7 @@ testing and modification is performed as if it were not given.
item(tt(-q))(
The word
currently being completed is split on spaces into separate words,
-respecting the usual shell quoting conventions. The
+respecting the usual shell quoting conventions. The
resulting words are stored in the tt(words) array, and tt(CURRENT),
tt(PREFIX), tt(SUFFIX), tt(QIPREFIX), and tt(QISUFFIX) are modified to
reflect the word part that is completed.
@@ -885,7 +887,7 @@ item(tt(-suffix) [ var(number) ] var(pattern))(
true if the test for the tt(-S) option of tt(compset) would succeed.
)
item(tt(-after) var(beg-pat))(
-true if the test of the tt(-N) option with only the var(beg-pat) given
+true if the test of the tt(-N) option with only the var(beg-pat) given
would succeed.
)
item(tt(-between) var(beg-pat end-pat))(
@@ -896,270 +898,286 @@ enditem()
texinode(Completion Matching Control)(Completion Widget Example)(Completion Condition Codes)(Completion Widgets)
sect(Completion Matching Control)
-It is possible by use of the
-tt(-M) option of the tt(compadd) builtin command to specify how the
-characters in the string to be completed (referred to here as the
-command line) map onto the characters in the list of matches produced by
-the completion code (referred to here as the trial completions). Note
-that this is not used if the command line contains a glob pattern and
-the tt(GLOB_COMPLETE) option is set or the tt(pattern_match) of the
-tt(compstate) special association is set to a non-empty string.
+When the user invokes completion, the current em(word) on the command line
+(that is, the word the cursor is currently on) is used to generate a em(match
+pattern). Only those em(completions) that match the pattern are offered to the
+user as em(matches).
-The var(match-spec) given as the argument to the tt(-M) option (see
+The default match pattern is generated from the current word by either
+
+startitemize()
+itemiz(\
+appending a `tt(*)' (matching any number of characters in a completion)
+em(or,)\
+)
+itemiz(\
+if the shell option tt(COMPLETE_IN_WORD) is set, inserting a `tt(*)' at the
+cursor position.\
+)
+enditemize()
+
+This narrow pattern can be broadened selectively by passing a em(match
+specification) to the tt(compadd) builtin command through its tt(-M) option
+(see
ifzman(`Completion Builtin Commands' above)\
ifnzman(noderef(Completion Builtin Commands))\
-) consists of one or more matching descriptions separated by
-whitespace. Each description consists of a letter followed by a colon
-and then the patterns describing which character sequences on the line match
-which character sequences in the trial completion. Any sequence of
-characters not handled in this fashion must match exactly, as usual.
-
-The forms of var(match-spec) understood are as follows. In each case, the
-form with an upper case initial character retains the string already
-typed on the command line as the final result of completion, while with
-a lower case initial character the string on the command line is changed
-into the corresponding part of the trial completion.
+). A match specification consists of one or more var(matchers) separated by
+whitespace. Matchers in a match specification are applied one at a time, from
+left to right. Once all matchers have been applied, completions are compared
+to the final match pattern and non-matching ones are discarded.
+
+startitemize()
+itemiz(\
+Note that the tt(-M) option is ignored if the current word contains a glob
+pattern and the shell option tt(GLOB_COMPLETE) is set or if the
+tt(pattern_match) key of the special associative array tt(compstate) is set to
+a non-empty value (see
+ifzman(`Completion Special Parameters' above)\
+ifnzman(noderef(Completion Special Parameters))\
+).\
+)
+itemiz(\
+Users of the \
+ifzman(completion system (see zmanref(zshcompsys))) \
+ifnzman(noderef(Completion System)) \
+should generally not use the tt(-M) option directly, but rather use the
+tt(matcher-list) and tt(matcher) styles (see the subsection em(Standard Styles)
+in
+ifzman(\
+the documentation for COMPLETION SYSTEM CONFIGURATION in zmanref(zshcompsys))\
+ifnzman(noderef(Completion System Configuration))\
+).\
+)
+enditemize()
+
+Each matcher consists of
+
+startitemize()
+itemiz(a case-sensitive letter)
+itemiz(a `tt(:)',)
+itemiz(one or more patterns separated by pipes (`tt(|)'),)
+itemiz(an equals sign (`tt(=)'), and)
+itemiz(another pattern.)
+enditemize()
+
+The patterns before the `tt(=)' are used to match substrings of the current
+word. For each matched substring, the corresponding part of the match pattern
+is broadened with the pattern after the `tt(=)', by means of a logical tt(OR).
+
+Each pattern in a matcher cosists of either
+
+startitemize()
+itemiz(the empty string or)
+itemiz(a sequence of
+
+startitemize()
+itemiz(literal characters (which may be quoted with a `tt(\)'),)
+itemiz(question marks (`tt(?)'),)
+itemiz(\
+bracket expressions (`tt([...])'; see the subsection em(Glob Operators) in
+ifnzman(noderef(Filename Generation))\
+ifzman(the documentation for GLOB OPERATORS in zmanref(zshexpn))\
+), and/or\
+)
+itemiz(brace expressions (see below).)
+enditemize()
+)
+enditemize()
+
+Other shell patterns are not allowed.
+
+A brace expression, like a bracket expression, consists of a list of
+
+startitemize()
+itemiz(literal characters,)
+itemiz(ranges (`tt(0-9)'), and/or)
+itemiz(character classes (`tt([:)var(name)tt(:])').)
+enditemize()
+
+However, they differ from each other as follows:
+
+startitemize()
+itemiz(\
+A brace expression is delimited by a pair of braces (`tt({...})').\
+)
+itemiz(\
+Brace expressions do not support negations. That is, an initial
+`tt(!)' or `tt(^)' has no special meaning and will be interpreted as a literal
+character.\
+)
+itemiz(\
+When a character in the current word matches the var(n)th pattern in a brace
+expression, the corresponding part of the match pattern is broadened only with
+the var(n)th pattern of the brace expression on the other side of the `tt(=)',
+if there is one; if there is no brace expression on the other side, then this
+pattern is the empty string. However, if either brace expression has more
+elements than the other, then the excess entries are simply ignored. When
+comparing indexes, each literal character or character class counts as one
+element, but each range is instead expanded to the full list of literal
+characters it represents. Additionally, if on em(both) sides of the
+`tt(=)', the var(n)th pattern is `tt([:upper:])' or `tt([:lower:])', then these
+are expanded as ranges, too.\
+)
+enditemize()
+
+Note that, although the matching system does not yet handle multibyte
+characters, this is likely to be a future extension. Hence, using
+`tt([:upper:])' and `tt([:lower:])' is recommended over
+`tt(A-Z)' and `tt(a-z)'.
+
+Below are the different forms of matchers supported. Each em(uppercase) form
+behaves exactly like its lowercase counterpart, but adds an additional step
+em(after) the match pattern has filtered out non-matching completions: Each of
+a match's substrings that was matched by a subpattern from an uppercase matcher
+is replaced with the corresponding substring of the current word. However,
+patterns from em(lowercase) matchers have higher weight: If a substring of the
+current word was matched by patterns from both a lowercase and an uppercase
+matcher, then the lowercase matcher's pattern wins and the corresponding part
+of the match is not modified.
+
+Unless indicated otherwise, each example listed assumes tt(COMPLETE_IN_WORD) to
+be unset (as it is by default).
startitem()
-xitem(tt(m:)var(lpat)tt(=)var(tpat))
-item(tt(M:)var(lpat)tt(=)var(tpat))(
-Here, var(lpat) is a pattern that matches on the command line,
-corresponding to var(tpat) which matches in the trial completion.
-)
-xitem(tt(l:)var(lanchor)tt(|)var(lpat)tt(=)var(tpat))
-xitem(tt(L:)var(lanchor)tt(|)var(lpat)tt(=)var(tpat))
-xitem(tt(l:)var(lanchor)tt(||)var(ranchor)tt(=)var(tpat))
-xitem(tt(L:)var(lanchor)tt(||)var(ranchor)tt(=)var(tpat))
-xitem(tt(b:)var(lpat)tt(=)var(tpat))
-item(tt(B:)var(lpat)tt(=)var(tpat))(
-These letters are for patterns that are anchored by another pattern on
-the left side. Matching for var(lpat) and var(tpat) is as for tt(m) and
-tt(M), but the pattern var(lpat) matched on the command line must be
-preceded by the pattern var(lanchor). The var(lanchor) can be blank to
-anchor the match to the start of the command line string; otherwise the
-anchor can occur anywhere, but must match in both the command line and
-trial completion strings.
-
-If no var(lpat) is given but a var(ranchor) is, this matches the gap
-between substrings matched by var(lanchor) and var(ranchor). Unlike
-var(lanchor), the var(ranchor) only needs to match the trial
-completion string.
-
-The tt(b) and tt(B) forms are similar to tt(l) and tt(L) with an empty
-anchor, but need to match only the beginning of the word on the command line
-or trial completion, respectively.
-)
-xitem(tt(r:)var(lpat)tt(|)var(ranchor)tt(=)var(tpat))
-xitem(tt(R:)var(lpat)tt(|)var(ranchor)tt(=)var(tpat))
-xitem(tt(r:)var(lanchor)tt(||)var(ranchor)tt(=)var(tpat))
-xitem(tt(R:)var(lanchor)tt(||)var(ranchor)tt(=)var(tpat))
-xitem(tt(e:)var(lpat)tt(=)var(tpat))
-item(tt(E:)var(lpat)tt(=)var(tpat))(
-As tt(l), tt(L), tt(b) and tt(B), with the difference that the command
-line and trial completion patterns are anchored on the right side.
-Here an empty var(ranchor) and the tt(e) and tt(E) forms force the
-match to the end of the command line or trial completion string.
+xitem(tt(m:)var(word-pat)tt(=)var(match-pat))
+item(tt(M:)var(word-pat)tt(=)var(match-pat))(
+
+For each substring of the current word that matches var(word-pat), broaden the
+corresponding part of the match pattern to additionally match var(match-pat).
+
+startitem()
+item(Examples:)(
+
+tt(m:{[:lower:]}={[:upper:]}) lets any lower case character in the current word
+be completed to itself or its uppercase counterpart. So, the completions
+`tt(foo)', `tt(FOO)' and `tt(Foo)' will are be considered matches for the word
+`tt(fo)'.
+
+tt(M:_=) inserts every underscore from the current word into each match, in the
+same relative position, determined by matching the substrings around it. So,
+given a completion `tt(foo)', the word `tt(f_o)' will be completed to the match
+`tt(f_oo)', even though the latter was not present as a completion.
)
-item(tt(x:))(
-This form is used to mark the end of matching specifications:
-subsequent specifications are ignored. In a single standalone list
-of specifications this has no use but where matching specifications
-are accumulated, such as from nested function calls, it can allow one
-function to override another.
+enditem()
+)
+xitem(tt(b:)var(word-pat)tt(=)var(match-pat))
+xitem(tt(B:)var(word-pat)tt(=)var(match-pat))
+xitem(tt(e:)var(word-pat)tt(=)var(match-pat))
+item(tt(E:)var(word-pat)tt(=)var(match-pat))(
+
+For each consecutive substring at the tt(b:)eginning or tt(e:)nd of the current
+word that matches var(word-pat), broaden the corresponding part of the match
+pattern to additionally match var(match-pat).
+
+startitem()
+item(Examples:)(
+
+`tt(b:-=+)' lets any number of minuses at the start of the current word be
+completed to a minus or a plus.
+
+`tt(B:0=)' adds all zeroes at the beginning of the current word to the
+beginning of each match.
)
enditem()
+)
+xitem(tt(l:)tt(|)var(word-pat)tt(=)var(match-pat))
+xitem(tt(L:)tt(|)var(word-pat)tt(=)var(match-pat))
+xitem(tt(R:)var(word-pat)tt(|)tt(=)var(match-pat))
+item(tt(r:)var(word-pat)tt(|)tt(=)var(match-pat))(
-Each var(lpat), var(tpat) or var(anchor) is either an empty string or
-consists of a sequence of literal characters (which may be quoted with a
-backslash), question marks, character classes, and correspondence
-classes; ordinary shell patterns are not used. Literal characters match
-only themselves, question marks match any character, and character
-classes are formed as for globbing and match any character in the given
-set.
-
-Correspondence classes are defined like character classes, but with two
-differences: they are delimited by a pair of braces, and negated classes
-are not allowed, so the characters tt(!) and tt(^) have no special
-meaning directly after the opening brace. They indicate that a range of
-characters on the line match a range of characters in the trial
-completion, but (unlike ordinary character classes) paired according to
-the corresponding position in the sequence. For example, to make any
-ASCII lower case letter on the line match the corresponding upper case
-letter in the trial completion, you can use `tt(m:{a-z}={A-Z})'
-(however, see below for the recommended form for this). More
-than one pair of classes can occur, in which case the first class before
-the tt(=) corresponds to the first after it, and so on. If one side has
-more such classes than the other side, the superfluous classes behave
-like normal character classes. In anchor patterns correspondence classes
-also behave like normal character classes.
-
-The standard `tt([:)var(name)tt(:])' forms described for standard shell
-patterns (see
-ifnzman(noderef(Filename Generation))\
-ifzman(the section FILENAME GENERATION in zmanref(zshexpn)))
-may appear in correspondence classes as well as normal character
-classes. The only special behaviour in correspondence classes is if
-the form on the left and the form on the right are each one of
-tt([:upper:]), tt([:lower:]). In these cases the
-character in the word and the character on the line must be the same up
-to a difference in case. Hence to make any lower case character on the
-line match the corresponding upper case character in the trial
-completion you can use `tt(m:{[:lower:]}={[:upper:]})'. Although the
-matching system does not yet handle multibyte characters, this is likely
-to be a future extension, at which point this syntax will handle
-arbitrary alphabets; hence this form, rather than the use of explicit
-ranges, is the recommended form. In other cases
-`tt([:)var(name)tt(:])' forms are allowed. If the two forms on the left
-and right are the same, the characters must match exactly. In remaining
-cases, the corresponding tests are applied to both characters, but they
-are not otherwise constrained; any matching character in one set goes
-with any matching character in the other set: this is equivalent to the
-behaviour of ordinary character classes.
-
-The pattern var(tpat) may also be one or two stars, `tt(*)' or
-`tt(**)'. This means that the pattern on the command line can match
-any number of characters in the trial completion. In this case the
-pattern must be anchored (on either side); in the case of a single
-star, the var(anchor) then determines how much of the trial completion
-is to be included DASH()- only the characters up to the next appearance of
-the anchor will be matched. With two stars, substrings matched by the
-anchor can be matched, too.
-
-Examples:
-
-The keys of the tt(options) association defined by the tt(parameter)
-module are the option names in all-lower-case form, without
-underscores, and without the optional tt(no) at the beginning even
-though the builtins tt(setopt) and tt(unsetopt) understand option names
-with upper case letters, underscores, and the optional tt(no). The
-following alters the matching rules so that the prefix tt(no) and any
-underscore are ignored when trying to match the trial completions
-generated and upper case letters on the line match the corresponding
-lower case letters in the words:
-
-example(compadd -M 'L:|[nN][oO]= M:_= M:{[:upper:]}={[:lower:]}' - \
- ${(k)options} )
-
-The first part says that the pattern `tt([nN][oO])' at the beginning
-(the empty anchor before the pipe symbol) of the string on the
-line matches the empty string in the list of words generated by
-completion, so it will be ignored if present. The second part does the
-same for an underscore anywhere in the command line string, and the
-third part uses correspondence classes so that any
-upper case letter on the line matches the corresponding lower case
-letter in the word. The use of the upper case forms of the
-specification characters (tt(L) and tt(M)) guarantees that what has
-already been typed on the command line (in particular the prefix
-tt(no)) will not be deleted.
-
-Note that the use of tt(L) in the first part means that it matches
-only when at the beginning of both the command line string and the
-trial completion. I.e., the string `tt(_NO_f)' would not be
-completed to `tt(_NO_foo)', nor would `tt(NONO_f)' be completed to
-`tt(NONO_foo)' because of the leading underscore or the second
-`tt(NO)' on the line which makes the pattern fail even though they are
-otherwise ignored. To fix this, one would use `tt(B:[nN][oO]=)'
-instead of the first part. As described above, this matches at the
-beginning of the trial completion, independent of other characters or
-substrings at the beginning of the command line word which are ignored
-by the same or other var(match-spec)s.
-
-The second example makes completion case insensitive. This is just
-the same as in the option example, except here we wish to retain the
-characters in the list of completions:
-
-example(compadd -M 'm:{[:lower:]}={[:upper:]}' ... )
-
-This makes lower case letters match their upper case counterparts.
-To make upper case letters match the lower case forms as well:
-
-example(compadd -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' ... )
-
-A nice example for the use of tt(*) patterns is partial word
-completion. Sometimes you would like to make strings like `tt(c.s.u)'
-complete to strings like `tt(comp.source.unix)', i.e. the word on the
-command line consists of multiple parts, separated by a dot in this
-example, where each part should be completed separately DASH()- note,
-however, that the case where each part of the word, i.e. `tt(comp)',
-`tt(source)' and `tt(unix)' in this example, is to be completed from
-separate sets of matches
-is a different problem to be solved by the implementation of the
-completion widget. The example can be handled by:
-
-example(compadd -M 'r:|.=* r:|=*' \
- - comp.sources.unix comp.sources.misc ...)
-
-The first specification says that var(lpat) is the empty string, while
-var(anchor) is a dot; var(tpat) is tt(*), so this can match anything
-except for the `tt(.)' from the anchor in
-the trial completion word. So in `tt(c.s.u)', the matcher sees `tt(c)',
-followed by the empty string, followed by the anchor `tt(.)', and
-likewise for the second dot, and replaces the empty strings before the
-anchors, giving `tt(c)[tt(omp)]tt(.s)[tt(ources)]tt(.u)[tt(nix)]', where
-the last part of the completion is just as normal.
-
-With the pattern shown above, the string `tt(c.u)' could not be
-completed to `tt(comp.sources.unix)' because the single star means
-that no dot (matched by the anchor) can be skipped. By using two stars
-as in `tt(r:|.=**)', however, `tt(c.u)' could be completed to
-`tt(comp.sources.unix)'. This also shows that in some cases,
-especially if the anchor is a real pattern, like a character class,
-the form with two stars may result in more matches than one would like.
-
-The second specification is needed to make this work when the cursor is
-in the middle of the string on the command line and the option
-tt(COMPLETE_IN_WORD) is set. In this case the completion code would
-normally try to match trial completions that end with the string as
-typed so far, i.e. it will only insert new characters at the cursor
-position rather than at the end. However in our example we would like
-the code to recognise matches which contain extra characters after the
-string on the line (the `tt(nix)' in the example). Hence we say that the
-empty string at the end of the string on the line matches any characters
-at the end of the trial completion.
-
-More generally, the specification
-
-example(compadd -M 'r:|[.,_-]=* r:|=*' ... )
-
-allows one to complete words with abbreviations before any of the
-characters in the square brackets. For example, to
-complete tt(veryverylongfile.c) rather than tt(veryverylongheader.h)
-with the above in effect, you can just type tt(very.c) before attempting
-completion.
-
-The specifications with both a left and a right anchor are useful to
-complete partial words whose parts are not separated by some
-special character. For example, in some places strings have to be
-completed that are formed `tt(LikeThis)' (i.e. the separate parts are
-determined by a leading upper case letter) or maybe one has to
-complete strings with trailing numbers. Here one could use the simple
-form with only one anchor as in:
-
-example(compadd -M 'r:|[[:upper:]0-9]=* r:|=*' LikeTHIS FooHoo 5foo123 5bar234)
-
-But with this, the string `tt(H)' would neither complete to `tt(FooHoo)'
-nor to `tt(LikeTHIS)' because in each case there is an upper case
-letter before the `tt(H)' and that is matched by the anchor. Likewise,
-a `tt(2)' would not be completed. In both cases this could be changed
-by using `tt(r:|[[:upper:]0-9]=**)', but then `tt(H)' completes to both
-`tt(LikeTHIS)' and `tt(FooHoo)' and a `tt(2)' matches the other
-strings because characters can be inserted before every upper case
-letter and digit. To avoid this one would use:
-
-example(compadd -M 'r:[^[:upper:]0-9]||[[:upper:]0-9]=** r:|=*' \
- LikeTHIS FooHoo foo123 bar234)
-
-By using these two anchors, a `tt(H)' matches only upper case `tt(H)'s that
-are immediately preceded by something matching the left anchor
-`tt([^[:upper:]0-9])'. The effect is, of course, that `tt(H)' matches only
-the string `tt(FooHoo)', a `tt(2)' matches only `tt(bar234)' and so on.
-
-When using the completion system (see
-ifzman(zmanref(zshcompsys))\
+If there is a substring at the tt(l:)eft or tt(r:)ight edge of the current word
+that matches var(word-pat), then broaden the corresponding part of the match
+pattern to additionally match var(match-pat).
+
+For each tt(l:), tt(L:), tt(r:) and tt(R:) matcher (including the ones below),
+the pattern var(match-pat) may also be a `tt(*)'. This matches any number of
+characters in a completion.
+
+startitem()
+item(Examples:)(
+
+`tt(r:|=*)' appends a `tt(*)' to the match pattern, even when
+tt(COMPLETE_IN_WORD) is set and the cursor is not at the end of the current
+word.
+
+If the current word starts with a minus, then `tt(L:|-=)' will prepend it to
+each match.
+)
+enditem()
+)
+xitem(tt(l:)var(anchor)tt(|)var(word-pat)tt(=)var(match-pat))
+xitem(tt(L:)var(anchor)tt(|)var(word-pat)tt(=)var(match-pat))
+xitem(tt(r:)var(word-pat)tt(|)var(anchor)tt(=)var(match-pat))
+item(tt(R:)var(word-pat)tt(|)var(anchor)tt(=)var(match-pat))(
+
+For each substring of the current word that matches var(word-pat) and has on
+its tt(l:)eft or tt(r:)ight another substring matching var(anchor), broaden the
+corresponding part of the match pattern to additionally match var(match-pat).
+
+Note that these matchers (and the ones below) modify only what is matched by
+var(word-pat); they do not change the matching behavior of what is matched by
+var(anchor) (or var(coanchor); see the matchers below). Thus, unless its
+corresponding part of the match pattern has been modified, the anchor in the
+current word has to match literally in each completion, just like any other
+substring of the current word.
+
+If a matcher includes at least one anchor (which includes the matchers with two
+anchors, below), then var(match-pat) may also be `tt(*)' or `tt(**)'. `tt(*)'
+can match any part of a completion that does not contain any substrings
+matching var(anchor), whereas a `tt(**)' can match any part of a completion,
+period. (Note that this is different from the behavior of `tt(*)' in the
+anchorless forms of `tt(l:)' and `tt(r:)' and and also different from `tt(*)'
+and `tt(**)' in glob expressions.)
+
+startitem()
+item(Examples:)(
+
+`tt(r:|.=*)' makes the completion `tt(comp.sources.unix)' a match for the word
+`tt(..u)' DASH()- but em(not) for the word `tt(.u)'.
+
+Given a completion `tt(-)tt(-foo)', the matcher `tt(L:--|no-=)' will complete
+the word `tt(-)tt(-no-)' to the match `tt(-)tt(-no-foo)'.
+)
+enditem()
+)
+xitem(tt(l:)var(anchor)tt(||)var(coanchor)tt(=)var(match-pat))
+xitem(tt(L:)var(anchor)tt(||)var(coanchor)tt(=)var(match-pat))
+xitem(tt(r:)var(coanchor)tt(||)var(anchor)tt(=)var(match-pat))
+item(tt(R:)var(coanchor)tt(||)var(anchor)tt(=)var(match-pat))(
+
+For any two consecutive substrings of the current word that match var(anchor)
+and var(coanchor), in the order given, insert the pattern var(match-pat)
+between their corresponding parts in the match pattern.
+
+Note that, unlike var(anchor), the pattern var(coanchor) does not change what
+`tt(*)' can match.
+
+startitem()
+item(Examples:)(
+
+`tt(r:?||[[:upper:]]=*)' will complete the current word `tt(fB)' to
+`tt(fooBar)', but it will not complete it to `tt(fooHooBar)' (because `tt(*)'
+here cannot match anything that includes a match for `tt([[:upper:]])), nor
+will it complete `tt(B)' to `tt(fooBar)' (because there is no character in the
+current word to match var(coanchor)).
+
+Given the current word `tt(pass.n)' and a completion `tt(pass.byname)', the
+matcher `tt(L:.||[[:alpha:]]=by)' will produce the match `tt(pass.name)'.
+)
+enditem()
+)
+item(tt(x:))(
+
+Ignore this matcher and all matchers to its right.
+
+This matcher is used to mark the end of a match specification. In a single
+standalone list of matchers, this has no use, but where match specifications
+are concatenated, as is often the case when using the
+ifzman(completion system (see zmanref(zshcompsys)))\
ifnzman(noderef(Completion System))\
-), users can define match specifications that are to be used for
-specific contexts by using the tt(matcher) and tt(matcher-list)
-styles. The values for the latter will be used everywhere.
+, it can allow one match specification to override another.
+)
+enditem()
texinode(Completion Widget Example)()(Completion Matching Control)(Completion Widgets)
sect(Completion Widget Example)
@@ -1180,5 +1198,5 @@ matches, e.g.:
example(complete-files LPAR()RPAR() { compadd - * })
-This function will complete files in the current directory matching the
+This function will complete files in the current directory matching the
current word.
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index c6bf745b7..0ef59dbc9 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -347,7 +347,7 @@ as the var(hook) argument.
var(widgetname) is the name of a ZLE widget. If no options are given this
is added to the array of widgets to be invoked in the given hook context.
Widgets are invoked in the order they were added, with
-example(tt(zle )var(widgetname)tt( -Nw -- "$@"))
+example(tt(zle )var(widgetname)tt( -Nw -f "nolast" -- "$@"))
vindex(WIDGET, in hooks)
Note that this means that the `tt(WIDGET)' special parameter tracks the
@@ -465,7 +465,7 @@ allows you to edit the list of directories, one per line. The
list can be edited to any extent you like; no sanity checking is
performed. Completion is available. No quoting is necessary (except for
newlines, where I have in any case no sympathy); directories are in
-unabbreviated from and contain an absolute path, i.e. they start with tt(/).
+unabbreviated form and contain an absolute path, i.e. they start with tt(/).
Usually the first entry should be left as the current directory.
)
item(tt(-p ')var(pattern)tt('))(
@@ -598,7 +598,7 @@ changes to descendant directories; earlier directories on the
list are not pruned. For example, changing from ~pws/yet/another
to ~pws/some/other/dir does not cause ~pws to be pruned.
)
-item(tt(pattern:var(pattern)))(
+item(tt(pattern:)var(pattern))(
Gives a zsh pattern for directories that should not be
added to the recent list (if not already there). This element
can be repeated to add different patterns. For example,
@@ -660,7 +660,7 @@ sect(Abbreviated dynamic references to directories)
The dynamic directory naming system is described in the subsection
em(Dynamic named directories) of
-ifzman(the section em(Filename Expansion) in zmanref(expn))\
+ifzman(the section em(Filename Expansion) in zmanref(zshexpn))\
ifnzman(noderef(Filename Expansion)). In this, a reference to
tt(~[)var(...)tt(]) is expanded by a function found by the hooks
mechanism.
@@ -708,7 +708,7 @@ that the wrapper function gets. This configuration is described below.
Then arrange for the wrapper to be run as a zsh_directory_name hook:
-example(autoload -Uz add-zsh-hook zsh_diretory_name_generic zdn_mywrapper
+example(autoload -Uz add-zsh-hook zsh_directory_name_generic zdn_mywrapper
add-zsh-hook -U zsh_directory_name zdn_mywrapper)
subsect(Configuration)
@@ -1159,7 +1159,7 @@ This is used by the Perforce backend (tt(p4)) to decide if it should
contact the Perforce server to find out if a directory is managed
by Perforce. This is the only reliable way of doing this, but runs
the risk of a delay if the server name cannot be found. If the
-server (more specifically, the tt(host)tt(:)tt(port) pair describing the
+server (more specifically, the var(host)tt(:)var(port) pair describing the
server) cannot be contacted, its name is put into the associative array
tt(vcs_info_p4_dead_servers) and is not contacted again during the session
until it is removed by hand. If you do not set this style, the tt(p4)
@@ -1177,7 +1177,7 @@ If there are two different ways of gathering
information, you can select the simpler one by setting this style to true;
the default is to use the not-that-simple code, which is potentially a lot
slower but might be more accurate in all possible cases. This style is
-used by the tt(bzr) and tt(hg) backends. In the case of tt(hg) it will invoke
+used by the tt(bzr), tt(hg), and tt(git) backends. In the case of tt(hg) it will invoke
the external hexdump program to parse the binary dirstate cache file; this
method will not return the local revision number.
)
@@ -1236,7 +1236,7 @@ item(tt(get-unapplied))(
This boolean style controls whether a backend should attempt to gather a list
of unapplied patches (for example with Mercurial Queue patches).
-Used by the tt(quilt) and tt(hg) backends.
+Used by the tt(quilt), tt(hg), and tt(git) backends.
)
enditem()
@@ -1318,7 +1318,7 @@ tt(%Q) expando.
item(tt(%Q))(
Quilt series information.
When quilt is used (either in `addon' mode or as a `standalone' backend),
-this expando is set to quilt series' tt(patch-format) string.
+this expando is set to the quilt series' tt(patch-format) string.
The tt(set-patch-format) hook and tt(nopatch-format) style are honoured.
See ifzman(tt(Quilt Support))ifnzman(noderef(vcs_info Quilt Support)) below for details.
@@ -1328,7 +1328,8 @@ enditem()
In tt(branchformat) these replacements are done:
startsitem()
-sitem(tt(%b))(The branch name.)
+sitem(tt(%b))(The branch name. For tt(hg), the branch name can include a
+topic name.)
sitem(tt(%r))(The current revision number or the tt(hgrevformat) style for
tt(hg).)
endsitem()
@@ -1403,7 +1404,7 @@ a directory that holds quilt's patches needs to be found. That directory is
configurable via the `tt(QUILT_PATCHES)' environment variable. If that
variable exists its value is used, otherwise the value `tt(patches)' is
assumed. The value from tt($QUILT_PATCHES) can be overwritten using the
-`tt(quilt-patches)' style. (Note: you can use tt(vcs_info) to keep the value
+`tt(quilt-patch-dir)' style. (Note: you can use tt(vcs_info) to keep the value
of tt($QUILT_PATCHES) correct all the time via the tt(post-quilt) hook).
When the directory in question is found, quilt is assumed to be active. To
@@ -1509,7 +1510,7 @@ below for details.
)
findex(vcs_info_lastmsg)
item(tt(vcs_info_lastmsg))(
-Outputs the last tt(${vcs_info_msg_*_}) value.
+Outputs the current values of tt(${vcs_info_msg_*_}).
Takes into account the value of the tt(use-prompt-escapes) style in
tt(':vcs_info:formats:command:-all-'). It also only prints tt(max-exports)
values.
@@ -1651,16 +1652,28 @@ Called in the tt(git) (with tt(stgit) or during rebase or merge), and tt(hg)
is generated; the tt(use-quilt) zstyle must be true for tt(quilt) (the tt(mq)
and tt(stgit) backends are active by default).
-This hook gets the names of all applied patches which tt(vcs_info) collected
-so far in the opposite order, which means that the first argument is the
+The arguments to this hook describe applied patches
+in the opposite order, which means that the first argument is the
top-most patch and so forth.
+When the patches' log messages can be extracted, those are embedded
+within each argument after a space, so each argument is of the form
+`var(patch-name) var(first line of the log message)', where var(patch-name)
+contains no whitespace. The tt(mq) backend passes arguments of
+the form `var(patch name)', with possible embedded spaces, but without
+extracting the patch's log message.
+
When setting tt(ret) to non-zero, the string in
tt(${hook_com[applied-string]}) will be
available as tt(%p) in the tt(patch-format) and tt(nopatch-format) styles.
This hook is, in concert with tt(set-patch-format), responsible for
tt(%)-escaping that value for use in the prompt.
(See ifzman(the bf(Oddities) section)ifnzman(noderef(vcs_info Oddities)).)
+
+COMMENT(This paragraph is repeated above/below)\
+The tt(quilt) backend passes to this hook the inputs
+tt(${hook_com[quilt-patches-dir]}) and, if it has been
+determined, tt(${hook_com[quilt-pc-dir]}).
)
item(tt(gen-unapplied-string))(
Called in the tt(git) (with tt(stgit) or during rebase), and tt(hg) (with
@@ -1668,15 +1681,22 @@ 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 order, which means that the first argument is
+in order, which means that the first argument is
the patch next-in-line to be applied and so forth.
+The format of each argument is as for tt(gen-applied-string), above.
+
When setting tt(ret) to non-zero, the string in
tt(${hook_com[unapplied-string]}) will be available as tt(%u) in the
tt(patch-format) and tt(nopatch-format) styles.
This hook is, in concert with tt(set-patch-format), responsible for
tt(%)-escaping that value for use in the prompt.
(See ifzman(the bf(Oddities) section)ifnzman(noderef(vcs_info Oddities)).)
+
+COMMENT(This paragraph is repeated above/below)\
+The tt(quilt) backend passes to this hook the inputs
+tt(${hook_com[quilt-patches-dir]}) and, if it has been
+determined, tt(${hook_com[quilt-pc-dir]}).
)
item(tt(gen-mqguards-string))(
Called in the tt(hg) backend when tt(guards-string) is generated; the
@@ -1759,6 +1779,11 @@ This hook is, in concert with the tt(gen-applied-string) or
tt(gen-unapplied-string) hooks if they are defined, responsible for
tt(%)-escaping the final tt(patch-format) value for use in the prompt.
(See ifzman(the bf(Oddities) section)ifnzman(noderef(vcs_info Oddities)).)
+
+COMMENT(This paragraph is repeated above/below)\
+The tt(quilt) backend passes to this hook the inputs
+tt(${hook_com[quilt-patches-dir]}) and, if it has been
+determined, tt(${hook_com[quilt-pc-dir]}).
)
item(tt(set-message))(
Called each time before a `tt(vcs_info_msg_)var(N)tt(_)' message is set.
@@ -1826,16 +1851,28 @@ If you do use tt(use-simple), please report if it does `the-right-thing[tm]'.
Display the revision number in yellow for tt(bzr) and tt(svn):
example(zstyle ':vcs_info:(svn|bzr):*' \
+ branchformat '%b%%F{yellow}:%r')
+
+The doubled percent sign is explained in
+ifzman(the bf(Oddities) section)ifnzman(noderef(vcs_info Oddities)).
+
+Alternatively, one can use the raw colour codes directly:
+
+example(zstyle ':vcs_info:(svn|bzr):*' \
branchformat '%b%{'${fg[yellow]}'%}:%r')
-If you want colors, make sure you enclose the color codes in tt(%{)var(...)tt(%})
+Normally when a variable is interpolated into a format string, the variable
+needs to be tt(%)-escaped. In this example we skipped that because we assume
+the value of tt(${fg[yellow]}) doesn't contain any tt(%) signs.
+
+Make sure you enclose the color codes in tt(%{)var(...)tt(%})
if you want to use the string provided by tt(vcs_info) in prompts.
Here is how to print the VCS information as a command (not in a prompt):
-example(alias vcsi='vcs_info command; vcs_info_lastmsg')
+example(vcsi+LPAR()+RPAR() { vcs_info interactive; vcs_info_lastmsg })
This way, you can even define different formats for output via
-tt(vcs_info_lastmsg) in the 'tt(:vcs_info:*:command:*)' namespace.
+tt(vcs_info_lastmsg) in the 'tt(:vcs_info:*:interactive:*)' namespace.
Now as promised, some code that uses hooks:
say, you'd like to replace the string `svn' by `subversion' in
@@ -1919,7 +1956,7 @@ subsect(Installation)
You should make sure all the functions from the tt(Functions/Prompts)
directory of the source distribution are available; they all begin with
-the string `tt(prompt_)' except for the special function`tt(promptinit)'.
+the string `tt(prompt_)' except for the special function `tt(promptinit)'.
You also need the `tt(colors)' and `tt(add-zsh-hook)' functions from
tt(Functions/Misc).
All these functions may already be installed on your system; if not,
@@ -2019,27 +2056,30 @@ setopts (tt(promptbang), etc.) are turned on, all other prompt-related
options are turned off. The tt(prompt_opts) array preserves setopts even
beyond the scope of tt(localoptions), should your function need that.
)
-item(Modify precmd and preexec)(
-Use of tt(add-zsh-hook) is recommended. The tt(precmd) and tt(preexec)
-hooks are automatically adjusted if the prompt theme changes or is
-disabled.
+item(Modify hooks)(
+Use of tt(add-zsh-hook) and tt(add-zle-hook-widget) is recommended (see
+the bf(Manipulating Hook Functions) section above).
+All hooks that follow the naming pattern tt(prompt_)var(theme)tt(_)var(hook)
+are automatically removed when the prompt theme changes or is disabled.
)
item(Declare cleanup)(
If your function makes any other changes that should be undone when the
theme is disabled, your setup function may call
+
example(prompt_cleanup var(command))
+
where var(command) should be suitably quoted. If your theme is ever
disabled or replaced by another, var(command) is executed with tt(eval).
You may declare more than one such cleanup hook.
)
item(Define preview)(
-Define or autoload a function tt(prompt_var(name)_preview) to display
+Define or autoload a function tt(prompt_)var(name)tt(_preview) to display
a simulated version of your prompt. A simple default previewer is
defined by tt(promptinit) for themes that do not define their own.
This preview function is called by `tt(prompt -p)'.
)
item(Provide help)(
-Define or autoload a function tt(prompt_var(name)_help) to display
+Define or autoload a function tt(prompt_)var(name)tt(_help) to display
documentation or help text for your theme.
This help function is called by `tt(prompt -h)'.
)
@@ -2316,8 +2356,8 @@ directly.
)
tindex(bracketed-paste-magic)
item(tt(bracketed-paste-magic))(
-The tt(bracketed-paste) widget (see ifzman(subsection Miscellaneous in
-zmanref(zshzle))ifnzman(noderef(Miscellaneous) in noderef(Zle Widgets)))
+The tt(bracketed-paste) widget (see ifzman(the subsection `Miscellaneous' in
+zmanref(zshzle))ifnzman(noderef(Miscellaneous) in noderef(Standard Widgets)))
inserts pasted text literally into the editor buffer rather than interpret
it as keystrokes. This disables some common usages where the self-insert
widget is replaced in order to accomplish some extra processing. An
@@ -2471,6 +2511,12 @@ item(tt(edit-command-line))(
Edit the command line using your visual editor, as in tt(ksh).
example(bindkey -M vicmd v edit-command-line)
+
+The editor to be used can also be specified using the tt(editor) style in
+the context of the widget. It is specified as an array of command and
+arguments:
+
+example(zstyle :zle:edit-command-line editor gvim -f)
)
tindex(expand-absolute-path)
item(tt(expand-absolute-path))(
@@ -3159,7 +3205,7 @@ investigate the command word found. The default is tt(whence -c).
tindex(zcalc-auto-insert)
item(tt(zcalc-auto-insert))(
This function is useful together with the tt(zcalc) function described in
-ifzman(the section Mathematical Functions)\
+ifzman(the section `Mathematical Functions')\
ifnzman(noderef(Mathematical Functions)).
It should be bound to a key representing a binary operator such
as `tt(PLUS())', `tt(-)', `tt(*)' or `tt(/)'. When running in zcalc,
@@ -3559,7 +3605,8 @@ Calling tt(zsh-mime-setup) with the option
tt(-v) causes verbose output to be shown during the setup operation.
The system respects the tt(mailcap) flags tt(needsterminal) and
-tt(copiousoutput), see manref(mailcap)(4).
+tt(copiousoutput); see manref(mailcap)(4) or manref(mailcap)(5)
+(the man page's name varies across platforms).
The functions use the following styles, which are defined with the
tt(zstyle) builtin command (\
@@ -3632,7 +3679,7 @@ types even if they are executable. As this example shows, the complete
file name is matched against the pattern, regardless of how the file
was passed to the handler. The file is resolved to a full path using
the tt(:P) modifier described in
-ifzman(the subsection Modifiers in zmanref(zshexpn))\
+ifzman(the subsection `Modifiers' in zmanref(zshexpn))\
ifnzman(noderef(Modifiers));
this means that symbolic links are resolved where possible, so that
links into other file systems behave in the correct fashion.
@@ -4264,6 +4311,12 @@ Same as tt(zed -f). This function does not appear in the zsh
distribution, but can be created by linking tt(zed) to the name tt(fned)
in some directory in your tt(fpath).
)
+findex(histed)
+item(tt(histed) [ [ var(name) ] var(size) ])(
+Same as tt(zed -h). This function does not appear in the zsh
+distribution, but can be created by linking tt(zed) to the name tt(histed)
+in some directory in your tt(fpath).
+)
findex(is-at-least)
item(tt(is-at-least) var(needed) [ var(present) ])(
Perform a greater-than-or-equal-to comparison of two strings having the
@@ -4297,7 +4350,7 @@ See also the tt(pager), tt(prompt) and tt(rprompt) styles below.
findex(regexp-replace)
item(tt(regexp-replace) var(var) var(regexp) var(replace))(
Use regular expressions to perform a global search and replace operation
-on a variable. POSIX extended regular expressions are used,
+on a variable. POSIX extended regular expressions (ERE) are used,
unless the option tt(RE_MATCH_PCRE) has been set, in which case
Perl-compatible regular expressions are used
(this requires the shell to be linked against the tt(pcre)
@@ -4315,6 +4368,9 @@ and arithmetic expressions which will be replaced: in particular, a
reference to tt($MATCH) will be replaced by the text matched by the pattern.
The return status is 0 if at least one match was performed, else 1.
+
+Note that if using POSIX EREs, the tt(^) or word boundary operators
+(where available) may not work properly.
)
findex(run-help)
item(tt(run-help) var(cmd))(
@@ -4355,6 +4411,7 @@ directory. These must be autoloaded, or placed as executable scripts in
your search path, in order to be found and used by tt(run-help).
startitem()
+findex(run-help-btrfs)
findex(run-help-git)
findex(run-help-ip)
findex(run-help-openssl)
@@ -4362,14 +4419,16 @@ findex(run-help-p4)
findex(run-help-sudo)
findex(run-help-svk)
findex(run-help-svn)
-xitem(run-help-git)
-xitem(run-help-ip)
-xitem(run-help-openssl)
-xitem(run-help-p4)
-xitem(run-help-sudo)
-xitem(run-help-svk)
+xitem(tt(run-help-btrfs))
+xitem(tt(run-help-git))
+xitem(tt(run-help-ip))
+xitem(tt(run-help-openssl))
+xitem(tt(run-help-p4))
+xitem(tt(run-help-sudo))
+xitem(tt(run-help-svk))
item(tt(run-help-svn))(
Assistant functions for the
+tt(btrfs),
tt(git),
tt(ip),
tt(openssl),
@@ -4464,12 +4523,13 @@ counts the number of arguments passed to each execution of var(command),
em(including) any var(arg) list. Also, any time tt(-i) or tt(-I) is used,
each var(input) is processed separately as if by `tt(-L) tt(1)'.
-For details of the other tt(zargs) options, see zmanref(xargs) (but note
+For details of the other tt(zargs) options, see the manref(xargs)(1) man page (but note
the difference in function between tt(zargs) and tt(xargs)) or run
tt(zargs) with the tt(-)tt(-help) option.
)
findex(zed)
xitem(tt(zed) [ tt(-f) [ tt(-x) var(num) ] ] var(name))
+xitem(tt(zed) [ tt(-h) [ var(name) ] var(size) ])
item(tt(zed -b))(
This function uses the ZLE editor to edit a file or function.
@@ -4484,7 +4544,14 @@ the given number of spaces; `tt(-x 2)' is consistent with the layout
of functions distributed with the shell.
Without tt(-f), var(name) is the path name of the file to edit, which need
-not exist; it is created on write, if necessary.
+not exist; it is created on write, if necessary. With tt(-h), the file is
+presumed to contain history events.
+
+When no file name is provided for tt(-h) the current shell history is edited
+in place. The history is renumbered when zed exits successfully.
+
+When editing history, multi-line events must have a trailing backslash on
+every line before the last.
While editing, the function sets the main keymap to tt(zed) and the
vi command keymap to tt(zed-vicmd). These will be copied from the existing
@@ -4500,16 +4567,20 @@ suitable for putting into a startup file. Note that, if rerun,
this will overwrite the existing tt(zed) and tt(zed-vicmd) keymaps.
Completion is available, and styles may be set with the context prefix
-`tt(:completion:zed)'.
-
-A zle widget tt(zed-set-file-name) is available. This can be called by
-name from within zed using `tt(\ex zed-set-file-name)' (note, however, that
-because of zed's rebindings you will have to type tt(^j) at the end instead
-of the return key), or can be bound to a key in either of the tt(zed) or
-tt(zed-vicmd) keymaps after `tt(zed -b)' has been run. When the widget is
-called, it prompts for a new name for the file being edited. When zed
-exits the file will be written under that name and the original file will
-be left alone. The widget has no effect with `tt(zed -f)'.
+`tt(:completion:zed:)'.
+
+findex(zed-set-file-name)
+A zle widget tt(zed-set-file-name) is available. This can be called
+by name from within zed using `tt(\ex zed-set-file-name)' or can be
+bound to a key in either of the tt(zed) or tt(zed-vicmd) keymaps after
+`tt(zed -b)' has been run. When the widget is called, it prompts for
+a new name for the file being edited. When zed exits the file will be
+written under that name and the original file will be left alone. The
+widget has no effect when invoked from `tt(zed -f)'. The completion
+context is changed to `tt(:completion:zed-set-file-name:)'. When editing
+the current history with `tt(zed -h)', the history is first updated and
+then the file is written, but the global setting of tt(HISTFILE) is not
+altered.
While tt(zed-set-file-name) is running, zed uses the keymap
tt(zed-normal-keymap), which is linked from the main keymap in effect
@@ -4551,7 +4622,7 @@ the same result, the destination was an existing regular file and tt(-f)
was not given) causes the entire function to abort without doing
anything.
-In addition to pattern replacement, the variable tt($f) can be referrred
+In addition to pattern replacement, the variable tt($f) can be referred
to in the second (replacement) argument. This makes it possible to
use variable substitution to alter the argument; see examples below.
diff --git a/Doc/Zsh/exec.yo b/Doc/Zsh/exec.yo
index 5f79967de..2b3d29500 100644
--- a/Doc/Zsh/exec.yo
+++ b/Doc/Zsh/exec.yo
@@ -14,9 +14,20 @@ a shell builtin by that name, the builtin is invoked.
vindex(path, use of)
Otherwise, the shell searches each element of tt($path) for a
-directory containing an executable file by that name. If the
-search is unsuccessful, the shell prints an error message and returns
-a nonzero exit status.
+directory containing an executable file by that name.
+
+If execution fails: an error message is printed, and one of the
+following values is returned.
+
+startsitem()
+sitem(127)(The search was unsuccessful. The error message is
+`tt(command not found:) var(cmd)'.)
+sitem(126)(The executable file has insufficient permissions, is a
+directory or special file, or is not a script and is in a format
+unrecognized by the operating system. The exact conditions and error
+message are operating system-dependent; see
+manref(execve)(2).)
+endsitem()
If execution fails because the file is not in executable format,
and the file is not a directory, it is assumed to be a shell
@@ -29,10 +40,6 @@ not handle this executable format in the kernel.
If no external command is found but a function tt(command_not_found_handler)
exists the shell executes this function with all
command line arguments. The return status of the function becomes the
-status of the command. If the function wishes to mimic the
-behaviour of the shell when the command is not found, it should
-print the message `tt(command not found:) var(cmd)' to standard error
-and return status 127. Note that the handler is executed in a
+status of the command. Note that the handler is executed in a
subshell forked to execute an external command, hence changes to
directories, shell parameters, etc. have no effect on the main shell.
-
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index c129b4228..bbacc6ae4 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -84,7 +84,7 @@ vindex(histchars, use of)
A history expansion begins with the first character of the tt(histchars)
parameter, which is `tt(!)' by default, and may occur anywhere on the
command line, including inside double quotes (but not inside single quotes
-tt('...') or C-style quotes tt($'...') nor when escaped with a backslash).
+tt('...') or C-style quotes tt($'...') nor when escaped with a backslash).
The first character is followed by an optional event designator
(ifzman(see )noderef(Event Designators)) and then an optional word
@@ -287,8 +287,10 @@ expansion.
)
item(tt(P))(
Turn a file name into an absolute path, like tt(realpath+LPAR()3+RPAR()).
-The resulting path will be absolute, have neither `tt(.)' nor `tt(..)' components,
-and refer to the same directory entry as the input filename.
+The resulting path will be absolute,
+will refer to the same directory entry as the input filename,
+and none of its components will be symbolic links or equal to
+`tt(.)' or `tt(..)'.
Unlike tt(realpath+LPAR()3+RPAR()), non-existent trailing components are
permitted and preserved.
@@ -494,7 +496,7 @@ which treats var(arg) as a file name and replaces it with the file's
contents.
The tt(=) form is useful as both the tt(/dev/fd) and the named pipe
-implementation of tt(<LPAR())var(...)tt(RPAR()) have drawbacks. In
+implementation of tt(<LPAR())var(...)tt(RPAR()) have drawbacks. In
the former case, some programmes may automatically close the file
descriptor in question before examining the file on the command line,
particularly if this is necessary for security reasons such as when the
@@ -509,7 +511,7 @@ information using a pipe, so that programmes that expect to lseek
Also note that the previous example can be more compactly and
efficiently written (provided the tt(MULTIOS) option is set) as:
-example(tt(paste <LPAR()cut -f1) var(file1)tt(RPAR() <LPAR()cut -f3) var(file2)tt(RPAR()) ifzman(\
+example(tt(paste <LPAR()cut -f1) var(file1)tt(RPAR() <LPAR()cut -f3) var(file2)tt(RPAR()) ifzman(\
)tt(> >LPAR())var(process1)tt(RPAR() > >LPAR())var(process2)tt(RPAR()))
The shell uses pipes instead of FIFOs to implement the latter
@@ -870,7 +872,8 @@ of the string tt($-) and the array tt($*) respectively. If
tt(POSIX_IDENTIFIERS) is set, then braces are required for
the tt(#) to be treated in this fashion.
)
-item(tt(${^)var(spec)tt(}))(
+xitem(tt(${^)var(spec)tt(}))
+item(tt(${^^)var(spec)tt(}))(
pindex(RC_EXPAND_PARAM, toggle)
cindex(array expansion style, rc)
cindex(rc, array expansion style)
@@ -893,7 +896,8 @@ happening later. If word splitting is also in effect the
tt($var[)var(N)tt(]) may themselves be split into different list
elements.
)
-item(tt(${=)var(spec)tt(}))(
+xitem(tt(${=)var(spec)tt(}))
+item(tt(${==)var(spec)tt(}))(
pindex(SH_WORD_SPLIT, toggle)
cindex(field splitting, sh style, parameter)
cindex(sh, field splitting style, parameter)
@@ -909,7 +913,8 @@ Note that splitting is applied to var(word) in the assignment forms
of var(spec) em(before) the assignment to var(name) is performed.
This affects the result of array assignments with the tt(A) flag.
)
-item(tt(${~)var(spec)tt(}))(
+xitem(tt(${~)var(spec)tt(}))
+item(tt(${~~)var(spec)tt(}))(
pindex(GLOB_SUBST, toggle)
Turn on the tt(GLOB_SUBST) option for the evaluation of
var(spec); if the `tt(~)' is doubled, turn it off. When this option is
@@ -963,16 +968,17 @@ following flags are supported:
startitem()
item(tt(#))(
-Evaluate the resulting words as numeric expressions and output the
-characters corresponding to the resulting integer. Note that this form is
-entirely distinct from use of the tt(#) without parentheses.
+Evaluate the resulting words as numeric expressions and interpret
+these as character codes. Output the corresponding characters. Note
+that this form is entirely distinct from use of the tt(#) without
+parentheses.
If the tt(MULTIBYTE) option is set and the number is greater than 127
(i.e. not an ASCII character) it is treated as a Unicode character.
)
item(tt(%))(
Expand all tt(%) escapes in the resulting words in the same way as in
-prompts (see
+prompts (see
ifzman(EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\
ifnzman(noderef(Prompt Expansion))). If this flag is given twice,
full prompt expansion is done on the resulting words, depending on the
@@ -1092,22 +1098,31 @@ Convert all letters in the result to lower case.
item(tt(n))(
Sort decimal integers numerically; if the first differing
characters of two test strings are not digits, sorting
-is lexical. Integers with more initial zeroes
-are sorted before those with fewer or none. Hence the array `tt(foo1 foo02
+is lexical. `tt(+)' and `tt(-)' are not treated specially; they are treated as
+any other non-digit. Integers with more initial zeroes
+are sorted before those with fewer or none. Hence the array `tt(foo+24 foo1 foo02
foo2 foo3 foo20 foo23)' is sorted into the order shown.
May be combined with `tt(i)' or `tt(O)'.
)
+item(tt(-))(
+As tt(n), but a leading minus sign indicates a negative decimal
+integer. A leading minus sign not followed by an integer does not trigger
+numeric sorting.
+Note that `tt(+)' signs are not handled specially (this may change in the
+future).
+)
item(tt(o))(
Sort the resulting words in ascending order; if this appears on its
own the sorting is lexical and case-sensitive (unless the locale
renders it case-insensitive). Sorting in ascending order is the
default for other forms of sorting, so this is ignored if combined
-with `tt(a)', `tt(i)' or `tt(n)'.
+with `tt(a)', `tt(i)', `tt(n)' or `tt(-)'.
)
item(tt(O))(
Sort the resulting words in descending order; `tt(O)' without `tt(a)',
-`tt(i)' or `tt(n)' sorts in reverse lexical order. May be combined
-with `tt(a)', `tt(i)' or `tt(n)' to reverse the order of sorting.
+`tt(i)', `tt(n)' or `tt(-)' sorts in reverse lexical order. May be
+combined with `tt(a)', `tt(i)', `tt(n)' or `tt(-)' to reverse the
+order of sorting.
)
item(tt(P))(
This forces the value of the parameter var(name) to be interpreted as a
@@ -1191,6 +1206,11 @@ for readonly parameters
item(tt(tag))(
for tagged parameters
)
+item(tt(tied))(
+for parameters tied to another parameter in the manner of tt(PATH)
+(colon-separated list) and tt(path) (array), whether these are
+special parameters or user-defined with `tt(typeset -T)'
+)
item(tt(export))(
for exported parameters
)
@@ -1377,16 +1397,29 @@ i.e. tt("${(@s.:.)line}").
item(tt(Z:)var(opts)tt(:))(
As tt(z) but takes a combination of option letters between a following
pair of delimiter characters. With no options the effect is identical
-to tt(z). tt(LPAR()Z+PLUS()c+PLUS()RPAR())
+to tt(z). The following options are available:
+
+startitem()
+item(tt(LPAR()Z+PLUS()c+PLUS()RPAR()))(
causes comments to be parsed as a string and retained; any field in the
resulting array beginning with an unquoted comment character is a
-comment. tt(LPAR()Z+PLUS()C+PLUS()RPAR()) causes comments to be parsed
+comment.
+)
+item(tt(LPAR()Z+PLUS()C+PLUS()RPAR()))(
+causes comments to be parsed
and removed. The rule for comments is standard: anything between a word
starting with the third character of tt($HISTCHARS), default tt(#), up to
-the next newline is a comment. tt(LPAR()Z+PLUS()n+PLUS()RPAR()) causes
+the next newline is a comment.
+)
+item(tt(LPAR()Z+PLUS()n+PLUS()RPAR()))(
+causes
unquoted newlines to be treated as ordinary whitespace, else they are
treated as if they are shell code delimiters and converted to
-semicolons. Options are combined within the same set of delimiters,
+semicolons.
+)
+enditem()
+
+Options are combined within the same set of delimiters,
e.g. tt(LPAR()Z+PLUS()Cn+PLUS()RPAR()).
)
item(tt(_:)var(flags)tt(:))(
@@ -1398,7 +1431,7 @@ error, and the flag itself has no effect.
enditem()
The following flags are meaningful with the tt(${)...tt(#)...tt(}) or
-tt(${)...tt(%)...tt(}) forms. The tt(S) and tt(I) flags may also be
+tt(${)...tt(%)...tt(}) forms. The tt(S), tt(I), and tt(*) flags may also be
used with the tt(${)...tt(/)...tt(}) forms.
startitem()
@@ -1464,6 +1497,10 @@ will remove the same matches as for `tt(#)', but in reverse order, and the
form using `tt(%%)' will remove the same matches as for `tt(##)' in reverse
order.
)
+item(tt(*))(
+Enable tt(EXTENDED_GLOB) for substitution via tt(${)...tt(/)...tt(}) or
+tt(${)...tt(//)...tt(}).
+)
item(tt(B))(
Include the index of the beginning of the match in the result.
)
@@ -1483,7 +1520,9 @@ Include the unmatched portion in the result (the em(R)est).
enditem()
subsect(Rules)
-
+cindex(parameter expansion rules)
+cindex(rules, parameter expansion)
+cindex(substitution, parameter, rules)
Here is a summary of the rules for substitution; this assumes that braces
are present around the substitution, i.e. tt(${)var(...)tt(}). Some particular
examples are given below. Note that the Zsh Development Group accepts
@@ -1681,6 +1720,7 @@ expression) and replaced with the corresponding value, with internal flags
enditem()
subsect(Examples)
+cindex(parameter expansion, examples)
The flag tt(f) is useful to split a double-quoted substitution line by
line. For example, tt(${(f)"$LPAR()<)var(file)tt(RPAR()"})
substitutes the contents of var(file) divided so that each line is
@@ -1698,7 +1738,7 @@ This produces the result tt(b). First, the inner substitution
tt("${foo}"), which has no array (tt(@)) flag, produces a single word
result tt("bar baz"). The outer substitution tt("${(@)...[1]}") detects
that this is a scalar, so that (despite the `tt((@))' flag) the subscript
-picks the first character.
+picks the first character.
)
item(tt("${${(@)foo}[1]}"))(
This produces the result `tt(bar)'. In this case, the inner substitution
@@ -1732,7 +1772,7 @@ sect(Command Substitution)
cindex(command substitution)
cindex(substitution, command)
A command enclosed in parentheses preceded by a dollar sign, like
-`tt($LPAR())...tt(RPAR())', or quoted with grave
+`tt($LPAR())...tt(RPAR())', or quoted with grave
accents, like `tt(`)...tt(`)', is replaced with its standard output, with
any trailing newlines deleted.
If the substitution is not enclosed in double quotes, the
@@ -1823,7 +1863,7 @@ has similar effects.
To combine brace expansion with array expansion, see the
tt(${^)var(spec)tt(}) form described
-ifzman(in the section Parameter Expansion)\
+ifzman(in the section `Parameter Expansion')\
ifnzman(in noderef(Parameter Expansion))
above.
@@ -1858,11 +1898,18 @@ The tt(PUSHD_MINUS)
option exchanges the effects of `tt(~PLUS())' and `tt(~-)' where they are
followed by a number.
+startmenu()
+menu(Dynamic named directories)
+menu(Static named directories)
+menu(`=' expansion)
+menu(Notes)
+endmenu()
+
+texinode(Dynamic named directories)(Static named directories)()(Filename Expansion)
subsect(Dynamic named directories)
cindex(directories, named, dynamic)
cindex(named directories, dynamic)
cindex(dynamic named directories)
-
If the function tt(zsh_directory_name) exists, or the shell variable
tt(zsh_directory_name_functions) exists and contains an array of
function names, then the functions are used to implement dynamic
@@ -1952,6 +1999,7 @@ example(zsh_directory_name+LPAR()RPAR() {
return 0
})
+texinode(Static named directories)(`=' expansion)(Dynamic named directories)(Filename Expansion)
subsect(Static named directories)
cindex(directories, named, static)
cindex(named directories, static)
@@ -1978,6 +2026,7 @@ i.e. either the directory name or the full path; the name is used
if they are the same length.
The parameters tt($PWD) and tt($OLDPWD) are never abbreviated in this fashion.
+texinode(`=' expansion)(Notes)(Static named directories)(Filename Expansion)
subsect(`=' expansion)
If a word begins with an unquoted `tt(=)'
@@ -1987,8 +2036,9 @@ name of a command. If a command
exists by that name, the word is replaced
by the full pathname of the command.
+texinode(Notes)()(`=' expansion)(Filename Expansion)
subsect(Notes)
-
+cindex(filename expansion, notes)
Filename expansion is performed on the right hand side of a parameter
assignment, including those appearing after commands of the
tt(typeset) family. In this case, the right hand side will be treated
@@ -2033,6 +2083,7 @@ No filename generation pattern
matches the files `tt(.)' or `tt(..)'. In other instances of pattern
matching, the `tt(/)' and `tt(.)' are not treated specially.
subsect(Glob Operators)
+cindex(glob operators)
startitem()
item(tt(*))(
Matches any string, including the null string.
@@ -2103,7 +2154,8 @@ is not sensitive to the locale:
startitem()
item(tt([:IDENT:]))(
The character is allowed to form part of a shell identifier, such
-as a parameter name
+as a parameter name; this test respects the tt(POSIX_IDENTIFIERS)
+option
)
item(tt([:IFS:]))(
The character is used as an input field separator, i.e. is contained in the
@@ -2263,6 +2315,8 @@ within `tt([[)...tt(]])'), a `tt(/)' is not special; and `tt(/)' is also
not special after a `tt(~)' appearing outside parentheses in a filename
pattern.
subsect(Globbing Flags)
+cindex(globbing flags)
+cindex(glob flags)
There are various flags which affect any text to their right up to the
end of the enclosing group or to the end of the pattern; they require
the tt(EXTENDED_GLOB) option. All take the form
@@ -2427,7 +2481,7 @@ qualifiers are also not applied in ordinary pattern matching.
)
item(tt(u))(
Respect the current locale in determining the presence of multibyte
-characters in a pattern, provided the shell was compiled with
+characters in a pattern, provided the shell was compiled with
tt(MULTIBYTE_SUPPORT). This overrides the tt(MULTIBYTE)
option; the default behaviour is taken from the option. Compare tt(U).
(Mnemonic: typically multibyte characters are from Unicode in the UTF-8
@@ -2457,6 +2511,8 @@ searched for all files which match, so that a pattern of the form
tt(LPAR()#i)tt(RPAR()/foo/bar/...) is potentially slow.
subsect(Approximate Matching)
+cindex(approximate matching)
+cindex(matching, approximate)
When matching approximately, the shell keeps a count of the errors found,
which cannot exceed the number specified in the
tt(LPAR()#a)var(num)tt(RPAR()) flags. Four types of error are recognised:
@@ -2522,6 +2578,8 @@ approximate match. It is best to place the tt((#a1)) after any path
segments which are known to be correct.
subsect(Recursive Globbing)
+cindex(recursive globbing)
+cindex(globbing, recursive)
A pathname component of the form `tt(LPAR())var(foo)tt(/RPAR()#)'
matches a path consisting of zero or more directories
matching the pattern var(foo).
@@ -2674,18 +2732,18 @@ expected, if combined with a `tt(=)', the value given must match the
file-modes exactly, with a `tt(PLUS())', at least the bits in the
given number must be set in the file-modes, and with a `tt(-)', the
bits in the number must not be set. Giving a `tt(?)' instead of a
-octal digit anywhere in the number ensures that the corresponding bits
+octal digit anywhere in the number ensures that the corresponding bits
in the file-modes are not checked, this is only useful in combination
with `tt(=)'.
If the qualifier `tt(f)' is followed by any other character anything
-up to the next matching character (`tt([)', `tt({)', and `tt(<)' match
+up to the next matching character (`tt([)', `tt({)', and `tt(<)' match
`tt(])', `tt(})', and `tt(>)' respectively, any other character
matches itself) is taken as a list of comma-separated
var(sub-spec)s. Each var(sub-spec) may be either an octal number as
described above or a list of any of the characters `tt(u)', `tt(g)',
`tt(o)', and `tt(a)', followed by a `tt(=)', a `tt(PLUS())', or a
-`tt(-)', followed by a list of any of the characters `tt(r)', `tt(w)',
+`tt(-)', followed by a list of any of the characters `tt(r)', `tt(w)',
`tt(x)', `tt(s)', and `tt(t)', or an octal digit. The first list of
characters specify which access rights are to be checked. If a `tt(u)'
is given, those for the owner of the file are used, if a `tt(g)' is
@@ -2694,7 +2752,7 @@ of other users, and the `tt(a)' says to test all three groups. The
`tt(=)', `tt(PLUS())', and `tt(-)' again says how the modes are to be
checked and have the same meaning as described for the first form
above. The second list of characters finally says which access rights
-are to be expected: `tt(r)' for read access, `tt(w)' for write access,
+are to be expected: `tt(r)' for read access, `tt(w)' for write access,
`tt(x)' for the right to execute the file (or to search a directory),
`tt(s)' for the setuid and setgid bits, and `tt(t)' for the sticky
bit.
@@ -2703,7 +2761,7 @@ Thus, `tt(*(f70?))' gives the files for which the owner has read,
write, and execute permission, and for which other group members have
no rights, independent of the permissions for other users. The pattern
`tt(*(f-100))' gives all files for which the owner does not have
-execute permission, and `tt(*(f:gu+w,o-rx:))' gives the files for which
+execute permission, and `tt(*(f:gu+w,o-rx:))' gives the files for which
the owner and the other members of the group have at least write
permission, and for which other users don't have read or execute
permission.
@@ -2824,7 +2882,9 @@ negates all qualifiers following it
)
item(tt(-))(
toggles between making the qualifiers work on symbolic links (the
-default) and the files they point to
+default) and the files they point to, if any; any symbolic link for
+whose target the `tt(stat)' system call fails (whatever the cause of the
+failure) is treated as a file in its own right
)
item(tt(M))(
sets the tt(MARK_DIRS) option for the current pattern
@@ -2854,18 +2914,26 @@ matches in directory traversal order will be considered.
Implies tt(oN) when no tt(o)var(c) qualifier is used.
)
item(tt(o)var(c))(
-specifies how the names of the files should be sorted. If var(c) is
-tt(n) they are sorted by name; if it is tt(L) they
-are sorted depending on the size (length) of the files; if tt(l)
-they are sorted by the number of links; if tt(a), tt(m), or tt(c)
-they are sorted by the time of the last access, modification, or
-inode change respectively; if tt(d), files in subdirectories appear before
+specifies how the names of the files should be sorted. The following values
+of var(c) sort in the following ways:
+
+startsitem()
+sitem(tt(n))(By name.)
+sitem(tt(L))(By the size (length) of the files.)
+sitem(tt(l))(By number of links.)
+sitem(tt(a))(By time of last access, youngest first.)
+sitem(tt(m))(By time of last modification, youngest first.)
+sitem(tt(c))(By time of last inode change, youngest first.)
+sitem(tt(d))(By directories: files in subdirectories appear before
those in the current directory at each level of the search DASH()- this is best
combined with other criteria, for example `tt(odon)' to sort on names for
-files within the same directory; if tt(N), no sorting is performed.
-Note that tt(a), tt(m), and tt(c) compare
-the age against the current time, hence the first name in the list is the
-youngest file. Also note that the modifiers tt(^) and tt(-) are used,
+files within the same directory.)
+sitem(tt(N))(No sorting is performed.)
+xitem(tt(e)var(string))
+sitem(tt(+)var(cmd))(Sort by shell code (see below).)
+endsitem()
+
+Note that the modifiers tt(^) and tt(-) are used,
so `tt(*(^-oL))' gives a list of all files sorted by file size in descending
order, following any symbolic links. Unless tt(oN) is used, multiple order
specifiers may occur to resolve ties.
@@ -2885,8 +2953,8 @@ repeated, but note that the maximum number of sort operators of any kind
that may appear in any glob expression is 12.
)
item(tt(O)var(c))(
-like `tt(o)', but sorts in descending order; i.e. `tt(*(^oc))' is the
-same as `tt(*(Oc))' and `tt(*(^Oc))' is the same as `tt(*(oc))'; `tt(Od)'
+like `tt(o)', but sorts in descending order; i.e. `tt(*+LPAR()^o)var(c)tt(+RPAR())' is the
+same as `tt(*+LPAR()O)var(c)tt(+RPAR())' and `tt(*+LPAR()^O)var(c)tt(+RPAR())' is the same as `tt(*+LPAR()o)var(c)tt(+RPAR())'; `tt(Od)'
puts files in the current directory before those in subdirectories at each
level of the search.
)
@@ -2894,7 +2962,7 @@ item(tt([)var(beg)[tt(,)var(end)]tt(]))(
specifies which of the matched filenames should be included in the
returned list. The syntax is the same as for array
subscripts. var(beg) and the optional var(end) may be mathematical
-expressions. As in parameter subscripting they may be negative to make
+expressions. As in parameter subscripting they may be negative to make
them count from the last match backward. E.g.: `tt(*(-OL[1,3]))'
gives a list of the names of the three largest files.
)
diff --git a/Doc/Zsh/func.yo b/Doc/Zsh/func.yo
index d500a78ae..12db3f56a 100644
--- a/Doc/Zsh/func.yo
+++ b/Doc/Zsh/func.yo
@@ -206,13 +206,14 @@ findex(hook functions)
For the functions below, it is possible to define an array that has the
same name as the function with `tt(_functions)' appended. Any element in
such an array is taken as the name of a function to execute; it is executed
-in the same context and with the same arguments as the basic function. For
+in the same context and with the same arguments and same initial value of tt($?)
+as the basic function. For
example, if tt($chpwd_functions) is an array containing the values
`tt(mychpwd)', `tt(chpwd_save_dirstack)', then the shell attempts to
execute the functions `tt(chpwd)', `tt(mychpwd)' and
`tt(chpwd_save_dirstack)', in that order. Any function that does not exist
is silently ignored. A function found by this mechanism is referred to
-elsewhere as a `hook function'. An error in any function causes subsequent
+elsewhere as a em(hook function). An error in any function causes subsequent
functions not to be run. Note further that an error in a tt(precmd) hook
causes an immediately following tt(periodic) function not to run (though
it may run at the next opportunity).
@@ -275,7 +276,7 @@ the history file. In case of a conflict, the first non-zero status
value is taken.
A hook function may call `tt(fc -p) var(...)' to switch the history
-context so that the history is saved in a different file from the
+context so that the history is saved in a different file from
that in the global tt(HISTFILE) parameter. This is handled specially:
the history context is automatically restored after the processing
of the history line is finished.
diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index e028c8512..f8f4ada86 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -288,7 +288,9 @@ for each selection until a break or end-of-file is encountered.
cindex(subshell)
item(tt(LPAR()) var(list) tt(RPAR()))(
Execute var(list) in a subshell. Traps set by the tt(trap) builtin
-are reset to their default values while executing var(list).
+are reset to their default values while executing var(list); an
+exception is that ignored signals will continue to be ignored
+if the option tt(POSIXTRAPS) is set.
)
item(tt({) var(list) tt(}))(
Execute var(list).
@@ -357,7 +359,7 @@ deliberately left unspecified, because historically there was a mismatch between
the documented and implemented behaviours. Cf. 20076, 21734/21735, 45075.)
)
findex(function)
-xitem(tt(function) var(word) ... [ tt(()) ] [ var(term) ] tt({) var(list) tt(}))
+xitem(tt(function) [ tt(-T) ] var(word) ... [ tt(()) ] [ var(term) ] tt({) var(list) tt(}))
xitem(var(word) ... tt(()) [ var(term) ] tt({) var(list) tt(}))
item(var(word) ... tt(()) [ var(term) ] var(command))(
where var(term) is one or more newline or tt(;).
@@ -367,6 +369,17 @@ are usually only useful for setting traps.
The body of the function is the var(list) between
the tt({) and tt(}). See noderef(Functions).
+The options of tt(function) have the following meanings:
+
+startitem()
+item(-T)(
+Enable tracing for this function, as though with tt(functions -T). See the
+documentation of the tt(-f) option to the tt(typeset) builtin, in
+ifzman(zmanref(zshbuiltins))\
+ifnzman(noderef(Shell Builtin Commands)).
+)
+enditem()
+
If the option tt(SH_GLOB) is set for compatibility with other shells, then
whitespace may appear between the left and right parentheses when
there is a single var(word); otherwise, the parentheses will be treated as
@@ -417,6 +430,8 @@ else the end of the test will not be recognized. For the
tt(for), tt(repeat), tt(case) and tt(select) commands no such special form
for the arguments is necessary, but the other condition (the special form
of var(sublist) or use of the tt(SHORT_LOOPS) option) still applies.
+The tt(SHORT_REPEAT) option is available to enable the short version only
+for the tt(repeat) command.
startitem()
item(tt(if) var(list) tt({) var(list) tt(}) [ tt(elif) var(list) tt({) var(list) tt(}) ] ... [ tt(else {) var(list) tt(}) ])(
@@ -558,6 +573,11 @@ position (if it could be the first word of a simple command),
or if the alias is global.
If the replacement text ends with a space, the next word in the shell input
is always eligible for purposes of alias expansion.
+
+It is an error for the function name, var(word), in the sh-compatible function
+definition syntax `var(word) tt(+LPAR()+RPAR()) ...' to be a word that resulted
+from alias expansion, unless the tt(ALIAS_FUNC_DEF) option is set.
+
findex(alias, use of)
cindex(aliases, global)
An alias is defined using the tt(alias) builtin; global aliases
@@ -584,6 +604,15 @@ word, e.g. tt(\foo). Any form of quoting works, although there is
nothing to prevent an alias being defined for the quoted form such as
tt(\foo) as well.
+In particular, note that quoting must be used when using tt(unalias) to remove
+global aliases:
+
+example(% alias -g foo=bar
+% unalias foo
+unalias: no such hash table element: bar
+% unalias \foo
+% )
+
When tt(POSIX_ALIASES) is set, only plain unquoted strings are eligible
for aliasing. The tt(alias) builtin does not reject ineligible aliases,
but they are not expanded.
@@ -634,26 +663,6 @@ a problem in shell scripts, functions, and code executed with `tt(source)'
or `tt(.)'. Consequently, use of functions rather than aliases is
recommended in non-interactive code.
-Note also the unhelpful interaction of aliases and function definitions:
-
-example(alias func='noglob func'
-func+LPAR()RPAR() {
- echo Do something with $*
-})
-
-Because aliases are expanded in function definitions, this causes the
-following command to be executed:
-
-example(noglob func+LPAR()RPAR() {
- echo Do something with $*
-})
-
-which defines tt(noglob) as well as tt(func) as functions with the
-body given. To avoid this, either quote the name tt(func) or use the
-alternative function definition form `tt(function func)'. Ensuring the
-alias is defined after the function works but is problematic if the
-code fragment might be re-executed.
-
texinode(Quoting)()(Aliasing)(Shell Grammar)
sect(Quoting)
cindex(quoting)
diff --git a/Doc/Zsh/intro.yo b/Doc/Zsh/intro.yo
index 75d25ce27..474e537c2 100644
--- a/Doc/Zsh/intro.yo
+++ b/Doc/Zsh/intro.yo
@@ -45,7 +45,7 @@ zsh most closely resembles bf(ksh) but includes many enhancements. It
does not provide compatibility with POSIX or other shells in its
default operating mode: see
ifnzman(the section noderef(Compatibility))\
-ifzman(the section Compatibility below).
+ifzman(the section `Compatibility' below).
Zsh has command line editing, builtin spelling correction, programmable
command completion, shell functions (with autoloading), a history
diff --git a/Doc/Zsh/jobs.yo b/Doc/Zsh/jobs.yo
index 70559f2d8..3ab0698ae 100644
--- a/Doc/Zsh/jobs.yo
+++ b/Doc/Zsh/jobs.yo
@@ -111,7 +111,7 @@ cindex(jobs, disowning)
cindex(disowning jobs)
findex(disown, use of)
To avoid having the shell terminate the running jobs, either
-use the bf(nohup) command (see manref(nohup)(1))
+use the manref(nohup)(1) command
or the tt(disown) builtin.
sect(Signals)
The tt(INT) and tt(QUIT) signals for an invoked
@@ -135,4 +135,4 @@ ifzman(the section PROCESS SUBSTITUTION in the zmanref(zshexpn) manual page)\
ifnzman(noderef(Process Substitution)), and the handler processes for
multios, see
ifzman(the section MULTIOS in the zmanref(zshmisc) manual page)\
-ifnzman(the section Multios in noderef(Redirection)).
+ifnzman(the section em(Multios) in noderef(Redirection)).
diff --git a/Doc/Zsh/manmodmenu.yo b/Doc/Zsh/manmodmenu.yo
index 53c0e01c9..e91a5ce3d 100644
--- a/Doc/Zsh/manmodmenu.yo
+++ b/Doc/Zsh/manmodmenu.yo
@@ -27,6 +27,7 @@ menu(The zsh/system Module)
menu(The zsh/net/tcp Module)
menu(The zsh/termcap Module)
menu(The zsh/terminfo Module)
+menu(The zsh/watch Module)
menu(The zsh/zftp Module)
menu(The zsh/zle Module)
menu(The zsh/zleparameter Module)
diff --git a/Doc/Zsh/manual.yo b/Doc/Zsh/manual.yo
index 119849e4c..dc4d6ed07 100644
--- a/Doc/Zsh/manual.yo
+++ b/Doc/Zsh/manual.yo
@@ -108,6 +108,8 @@ Zsh Line Editor
menu(Keymaps)
menu(Zle Builtins)
menu(Zle Widgets)
+menu(User-Defined Widgets)
+menu(Standard Widgets)
menu(Character Highlighting)
Completion Widgets
@@ -196,7 +198,7 @@ produce a nicely formatted printed manual.
item(The HTML manual)(
An HTML version of this manual is available at the Zsh web site via:
-uref(http://zsh.sourceforge.net/Doc/).
+uref(https://zsh.sourceforge.io/Doc/).
(The HTML version is produced with bf(texi2html), which may be obtained
from uref(http://www.nongnu.org/texi2html/). The command is
diff --git a/Doc/Zsh/metafaq.yo b/Doc/Zsh/metafaq.yo
index c123a7cea..c780808e3 100644
--- a/Doc/Zsh/metafaq.yo
+++ b/Doc/Zsh/metafaq.yo
@@ -10,12 +10,12 @@ endmenu()
texinode(Author)(Availability)()(Introduction)
sect(Author)
cindex(author)
-Zsh was originally written by Paul Falstad tt(<pf@zsh.org>).
-Zsh is now maintained by the members of the zsh-workers mailing
-list tt(<zsh-workers@zsh.org>). The development is currently
-coordinated by Peter Stephenson tt(<pws@zsh.org>). The coordinator
-can be contacted at tt(<coordinator@zsh.org>), but matters relating to
-the code should generally go to the mailing list.
+Zsh was originally written by Paul Falstad. Zsh is now maintained by
+the members of the zsh-workers mailing list tt(<zsh-workers@zsh.org>).
+The development is currently coordinated by Peter Stephenson
+tt(<pws@zsh.org>). The coordinator can be contacted at
+tt(<coordinator@zsh.org>), but matters relating to the code should
+generally go to the mailing list.
texinode(Availability)(Mailing Lists)(Author)(Introduction)
sect(Availability)
Zsh is available from the following HTTP and anonymous FTP site.
@@ -25,17 +25,16 @@ cindex(acquiring zsh by FTP)
cindex(availability of zsh)
nofill(uref(ftp://ftp.zsh.org/pub/)
uref(https://www.zsh.org/pub/))
-)
The up-to-date source code is available via Git from Sourceforge. See
uref(https://sourceforge.net/projects/zsh/) for details. A summary of
instructions for the archive can be found at
-uref(http://zsh.sourceforge.net/).
+uref(https://zsh.sourceforge.io/).
texinode(Mailing Lists)(The Zsh FAQ)(Availability)(Introduction)
sect(Mailing Lists)
cindex(mailing lists)
-Zsh has 3 mailing lists:
+Zsh has several mailing lists:
startitem()
item(tt(<zsh-announce@zsh.org>))(
@@ -48,6 +47,12 @@ User discussions.
item(tt(<zsh-workers@zsh.org>))(
Hacking, development, bug reports and patches.
)
+item(tt(<zsh-security@zsh.org>))(
+Private mailing list (the general public cannot subscribe to it) for discussing
+bug reports with security implications, i.e., potential vulnerabilities.
+
+If you find a security problem in zsh itself, please mail this address.
+)
enditem()
To subscribe or unsubscribe, send mail
@@ -69,12 +74,11 @@ bf(zsh-users). All submissions to bf(zsh-users) are automatically
forwarded to bf(zsh-workers).
If you have problems subscribing/unsubscribing to any of the mailing
-lists, send mail to tt(<listmaster@zsh.org>). The mailing lists are
-maintained by Karsten Thygesen tt(<karthy@kom.auc.dk>).
+lists, send mail to tt(<listmaster@zsh.org>).
The mailing lists are archived; the archives can be accessed via the
administrative addresses listed above. There is also a hypertext
-archive, maintained by Geoff Wing tt(<gcw@zsh.org>), available at
+archive available at
uref(https://www.zsh.org/mla/).
texinode(The Zsh FAQ)(The Zsh Web Page)(Mailing Lists)(Introduction)
sect(The Zsh FAQ)
@@ -82,12 +86,11 @@ Zsh has a list of Frequently Asked Questions (FAQ), maintained by
Peter Stephenson tt(<pws@zsh.org>). It is regularly posted to the
newsgroup bf(comp.unix.shell) and the bf(zsh-announce) mailing list.
The latest version can be found at any of the Zsh FTP sites, or at
-uref(http://www.zsh.org/FAQ/). The contact address for FAQ-related matters
+uref(https://www.zsh.org/FAQ/). The contact address for FAQ-related matters
is tt(<faqmaster@zsh.org>).
texinode(The Zsh Web Page)(The Zsh Userguide)(The Zsh FAQ)(Introduction)
sect(The Zsh Web Page)
-Zsh has a web page which is located at uref(https://www.zsh.org/). This is
-maintained by Karsten Thygesen tt(<karthy@zsh.org>), of SunSITE Denmark.
+Zsh has a web page which is located at uref(https://www.zsh.org/).
The contact address for web-related matters is tt(<webmaster@zsh.org>).
texinode(The Zsh Userguide)(See Also)(The Zsh Web Page)(Introduction)
sect(The Zsh Userguide)
@@ -95,6 +98,6 @@ A userguide is currently in preparation. It is intended to complement the
manual, with explanations and hints on issues where the manual can be
cabbalistic, hierographic, or downright mystifying (for example, the word
`hierographic' does not exist). It can be viewed in its current state at
-uref(http://zsh.sourceforge.net/Guide/). At the time of writing, chapters
+uref(https://zsh.sourceforge.io/Guide/). At the time of writing, chapters
dealing with startup files and their contents and the new completion system
were essentially complete.
diff --git a/Doc/Zsh/mod_curses.yo b/Doc/Zsh/mod_curses.yo
index 6e4831abe..e2d5690e2 100644
--- a/Doc/Zsh/mod_curses.yo
+++ b/Doc/Zsh/mod_curses.yo
@@ -157,7 +157,7 @@ input. This is only available with the ncurses library; mouse handling
can be detected by checking for the exit status of `tt(zcurses mouse)' with
no arguments. If a mouse
button is clicked (or double- or triple-clicked, or pressed or released with
-a configurable delay from being clicked) then tt(kparam) is set to the string
+a configurable delay from being clicked) then var(kparam) is set to the string
tt(MOUSE), and var(mparam) is set to an array consisting of the
following elements:
startitem()
diff --git a/Doc/Zsh/mod_datetime.yo b/Doc/Zsh/mod_datetime.yo
index da65a9bbd..853656128 100644
--- a/Doc/Zsh/mod_datetime.yo
+++ b/Doc/Zsh/mod_datetime.yo
@@ -6,8 +6,8 @@ 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) [ var(nanoseconds) ] ] )
-item(tt(strftime) tt(-r) [ tt(-q) ] [ tt(-s) var(scalar) ] var(format) var(timestring) )(
+xitem(tt(strftime) [ tt(-s) var(scalar) | tt(-n) ] var(format) [ var(epochtime) [ var(nanoseconds) ] ] )
+item(tt(strftime) tt(-r) [ tt(-q) ] [ tt(-s) var(scalar) | tt(-n) ] var(format) var(timestring) )(
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
@@ -18,6 +18,9 @@ ifzman(the section EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\
ifnzman(noderef(Prompt Expansion)) are also available.
startitem()
+item(tt(-n))(
+Suppress printing a newline after the formatted string.
+)
item(tt(-q))(
Run quietly; suppress printing of all error messages described below.
Errors for invalid var(epochtime) values are always printed.
diff --git a/Doc/Zsh/mod_mapfile.yo b/Doc/Zsh/mod_mapfile.yo
index 640beeb12..9d8f07214 100644
--- a/Doc/Zsh/mod_mapfile.yo
+++ b/Doc/Zsh/mod_mapfile.yo
@@ -13,7 +13,7 @@ value is the content of the file. The value is treated identically to any
other text coming from a parameter. The value may also be assigned to, in
which case the file in question is written (whether or not it originally
existed); or an element may be unset, which will delete the file in
-question. For example, `tt(vared mapfile[myfile])' works as expected,
+question. For example, `tt(vared 'mapfile[myfile]')' works as expected,
editing the file `tt(myfile)'.
When the array is accessed as a whole, the keys are the names of files in
diff --git a/Doc/Zsh/mod_newuser.yo b/Doc/Zsh/mod_newuser.yo
index 92a64a013..7937e43c3 100644
--- a/Doc/Zsh/mod_newuser.yo
+++ b/Doc/Zsh/mod_newuser.yo
@@ -44,4 +44,4 @@ even if the tt(zsh/newuser) module is disabled. Note, however, that
if the module is not installed the function will not be installed either.
The function is documented in
ifnzman(noderef(User Configuration Functions))\
-ifzman(the section User Configuration Functions in zmanref(zshcontrib)).
+ifzman(the section `User Configuration Functions' in zmanref(zshcontrib)).
diff --git a/Doc/Zsh/mod_parameter.yo b/Doc/Zsh/mod_parameter.yo
index 2e3011e44..f3bcd7957 100644
--- a/Doc/Zsh/mod_parameter.yo
+++ b/Doc/Zsh/mod_parameter.yo
@@ -165,6 +165,8 @@ The keys of the associative arrays are usually valid job numbers,
and these are the values output with, for example, tt(${(k)jobdirs}).
Non-numeric job references may be used when looking up a value;
for example, tt(${jobdirs[%+]}) refers to the current job.
+
+See the tt(jobs) builtin for how job information is provided in a subshell.
)
vindex(jobtexts)
item(tt(jobtexts))(
@@ -173,6 +175,8 @@ that were used to start the jobs.
Handling of the keys of the associative array is as described for
tt(jobdirs) above.
+
+See the tt(jobs) builtin for how job information is provided in a subshell.
)
vindex(jobstates)
item(tt(jobstates))(
@@ -189,6 +193,8 @@ the var(state) describes the state of that process.
Handling of the keys of the associative array is as described for
tt(jobdirs) above.
+
+See the tt(jobs) builtin for how job information is provided in a subshell.
)
vindex(nameddirs)
item(tt(nameddirs))(
diff --git a/Doc/Zsh/mod_private.yo b/Doc/Zsh/mod_private.yo
index 78aee0acf..184fa2be8 100644
--- a/Doc/Zsh/mod_private.yo
+++ b/Doc/Zsh/mod_private.yo
@@ -10,12 +10,16 @@ ifnzman()
startitem()
findex(private)
cindex(private parameter, creating)
-item(tt(private) [ {tt(PLUS())|tt(-)}tt(AHUahlprtux) ] \
+item(tt(private) [ {tt(PLUS())|tt(-)}tt(AHUahlmrtux) ] \
[ {tt(PLUS())|tt(-)}tt(EFLRZi) [ var(n) ] ] [ var(name)[tt(=)var(value)] ... ])(
The tt(private) builtin accepts all the same options and arguments as tt(local)
(ifzman(zmanref(zshbuiltins))ifnzman(noderef(Shell Builtin Commands))) except
for the `tt(-)tt(T)' option. Tied parameters may not be made private.
+The `tt(-)tt(p)' option is presently a no-op because the state of
+private parameters cannot reliably be reloaded. This also applies
+to printing private parameters with `tt(typeset -p)'.
+
If used at the top level (outside a function scope), tt(private) creates a
normal parameter in the same manner as tt(declare) or tt(typeset). A
warning about this is printed if tt(WARN_CREATE_GLOBAL) is set
@@ -75,7 +79,8 @@ itemiz(Within any other function called by the declaring function, the
private parameter does em(NOT) hide other parameters of the same name, so
for example a global parameter of the same name is visible and may be
assigned or unset. This includes calls to anonymous functions, although
-that may also change in the future.)
+that may also change in the future. However, the private name may not be
+created outside the local scope when it was not previously declared.)
itemiz(An exported private remains in the environment of inner scopes but
appears unset for the current shell in those scopes. Generally, exporting
private parameters should be avoided.)
diff --git a/Doc/Zsh/mod_regex.yo b/Doc/Zsh/mod_regex.yo
index f20451664..40ee92785 100644
--- a/Doc/Zsh/mod_regex.yo
+++ b/Doc/Zsh/mod_regex.yo
@@ -26,5 +26,17 @@ tt(-regex-match) operator.
If tt(BASH_REMATCH) is set, then the array tt(BASH_REMATCH) will be set
instead of tt(MATCH) and tt(match).
+
+Note that the tt(zsh/regex) module logic relies on the host system. The
+same var(expr) and var(regex) pair could produce different results on different
+platforms if a var(regex) with non-standard syntax is given.
+
+For example, no syntax for matching a word boundary is defined in the POSIX
+extended regular expression standard. GNU tt(libc) and BSD tt(libc) both provide
+such syntaxes as extensions (tt(\b) and tt([[:<:]])/tt([[:>:]]) respectively),
+but neither of these syntaxes is supported by both of these implementations.
+
+Refer to the manref(regcomp)(3) and manref(re_format)(7) manual pages on your
+system for locally-supported syntax.
)
enditem()
diff --git a/Doc/Zsh/mod_stat.yo b/Doc/Zsh/mod_stat.yo
index 9caed1e45..b591d4003 100644
--- a/Doc/Zsh/mod_stat.yo
+++ b/Doc/Zsh/mod_stat.yo
@@ -118,6 +118,8 @@ formatting of the time elements. The format string supports all of the
zsh extensions described in
ifzman(the section EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\
ifnzman(noderef(Prompt Expansion)).
+In particular, tt(-F %s.%N) can be used to show timestamps with nanosecond
+precision if supported by the system.
The tt(-s) option is implied.
)
item(tt(-g))(
diff --git a/Doc/Zsh/mod_system.yo b/Doc/Zsh/mod_system.yo
index 6292af071..884c3e753 100644
--- a/Doc/Zsh/mod_system.yo
+++ b/Doc/Zsh/mod_system.yo
@@ -62,6 +62,9 @@ suppress updating of the file atime
item(tt(nofollow))(
fail if var(file) is a symbolic link
)
+item(tt(nonblock))(
+the file is opened in nonblocking mode
+)
item(tt(sync))(
request that writes wait until data has been physically written
)
@@ -166,7 +169,7 @@ to the command, or 2 for an error on the write; no error message is
printed in the last case, but the parameter tt(ERRNO) will reflect
the error that occurred.
)
-xitem(tt(zsystem flock) [ tt(-t) var(timeout) ] [ tt(-f) var(var) ] [tt(-er)] var(file))
+xitem(tt(zsystem flock) [ tt(-t) var(timeout) ] [ tt(-i) var(interval) ] [ tt(-f) var(var) ] [tt(-er)] var(file))
item(tt(zsystem flock -u) var(fd_expr))(
The builtin tt(zsystem)'s subcommand tt(flock) performs advisory file
locking (via the manref(fcntl)(2) system call) over the entire contents
@@ -196,9 +199,16 @@ a safety check that the file descriptor is in use for file locking.
By default the shell waits indefinitely for the lock to succeed.
The option tt(-t) var(timeout) specifies a timeout for the lock in
-seconds; currently this must be an integer. The shell will attempt
-to lock the file once a second during this period. If the attempt
-times out, status 2 is returned.
+seconds; fractional seconds are allowed. During this period, the
+shell will attempt to lock the file every var(interval) seconds
+if the tt(-i) var(interval) option is given, otherwise once a second.
+(This var(interval) is shortened before the last attempt if needed,
+so that the shell waits only until the var(timeout) and not longer.)
+If the attempt times out, status 2 is returned.
+
+(Note: var(timeout) is limited to 2^30-1 seconds (about 34 years), and
+var(interval) to 0.999 * LONG_MAX microseconds (only about 35 minutes
+on 32-bit systems).)
If the option tt(-e) is given, the file descriptor for the lock is
preserved when the shell uses tt(exec) to start a new process;
@@ -256,9 +266,9 @@ tt($$), which returns the process ID of the main shell process.
)
item(tt(ppid))(
vindex(ppid, sysparams)
-Returns the process ID of the parent of the current process, even in
-subshells. Compare tt($PPID), which returns the process ID of the parent
-of the main shell process.
+Returns the current process ID of the parent of the current process, even
+in subshells. Compare tt($PPID), which returns the process ID of the
+initial parent of the main shell process.
)
item(tt(procsubstpid))(
Returns the process ID of the last process started for process
diff --git a/Doc/Zsh/mod_watch.yo b/Doc/Zsh/mod_watch.yo
new file mode 100644
index 000000000..d97a41d13
--- /dev/null
+++ b/Doc/Zsh/mod_watch.yo
@@ -0,0 +1,146 @@
+COMMENT(!MOD!zsh/watch
+Reporting of login and logout events.
+!MOD!)
+The tt(zsh/watch) module can be used to report when specific users log in or
+out. This is controlled via the following parameters.
+
+startitem()
+vindex(LOGCHECK)
+item(tt(LOGCHECK))(
+The interval in seconds between checks for login/logout activity
+using the tt(watch) parameter.
+)
+vindex(watch)
+vindex(WATCH)
+item(tt(watch) <S> <Z> (tt(WATCH) <S>))(
+An array (colon-separated list) of login/logout events to report.
+
+If it contains the single word `tt(all)', then all login/logout events
+are reported. If it contains the single word `tt(notme)', then all
+events are reported as with `tt(all)' except tt($USERNAME).
+
+An entry in this list may consist of a username,
+an `tt(@)' followed by a remote hostname,
+and a `tt(%)' followed by a line (tty). Any of these may
+be a pattern (be sure to quote this during the assignment to
+tt(watch) so that it does not immediately perform file generation);
+the setting of the tt(EXTENDED_GLOB) option is respected.
+Any or all of these components may be present in an entry;
+if a login/logout event matches all of them,
+it is reported.
+
+For example, with the tt(EXTENDED_GLOB) option set, the following:
+
+example(watch=('^(pws|barts)'))
+
+causes reports for activity associated with any user other than tt(pws)
+or tt(barts).
+)
+vindex(WATCHFMT)
+item(tt(WATCHFMT))(
+The format of login/logout reports if the tt(watch) parameter is set.
+Default is `tt(%n has %a %l from %m)'.
+Recognizes the following escape sequences:
+
+startitem()
+item(tt(%n))(
+The name of the user that logged in/out.
+)
+item(tt(%a))(
+The observed action, i.e. "logged on" or "logged off".
+)
+item(tt(%l))(
+The line (tty) the user is logged in on.
+)
+item(tt(%M))(
+The full hostname of the remote host.
+)
+item(tt(%m))(
+The hostname up to the first `tt(.)'. If only the
+IP address is available or the utmp field contains
+the name of an X-windows display, the whole name is printed.
+
+em(NOTE:)
+The `tt(%m)' and `tt(%M)' escapes will work only if there is a host name
+field in the utmp on your machine. Otherwise they are
+treated as ordinary strings.
+)
+item(tt(%F{)var(color)tt(}) LPAR()tt(%f)RPAR())(
+Start (stop) using a different foreground color.
+)
+item(tt(%K{)var(color)tt(}) LPAR()tt(%k)RPAR())(
+Start (stop) using a different background color.
+)
+item(tt(%S) LPAR()tt(%s)RPAR())(
+Start (stop) standout mode.
+)
+item(tt(%U) LPAR()tt(%u)RPAR())(
+Start (stop) underline mode.
+)
+item(tt(%B) LPAR()tt(%b)RPAR())(
+Start (stop) boldface mode.
+)
+xitem(tt(%t))
+item(tt(%@))(
+The time, in 12-hour, am/pm format.
+)
+item(tt(%T))(
+The time, in 24-hour format.
+)
+item(tt(%w))(
+The date in `var(day)tt(-)var(dd)' format.
+)
+item(tt(%W))(
+The date in `var(mm)tt(/)var(dd)tt(/)var(yy)' format.
+)
+item(tt(%D))(
+The date in `var(yy)tt(-)var(mm)tt(-)var(dd)' format.
+)
+item(tt(%D{)var(string)tt(}))(
+The date formatted as var(string) using the tt(strftime) function, with
+zsh extensions as described by
+ifzman(EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\
+ifnzman(noderef(Prompt Expansion)).
+)
+item(tt(%LPAR())var(x)tt(:)var(true-text)tt(:)var(false-text)tt(RPAR()))(
+Specifies a ternary expression.
+The character following the var(x) is
+arbitrary; the same character is used to separate the text
+for the "true" result from that for the "false" result.
+Both the separator and the right parenthesis may be escaped
+with a backslash.
+Ternary expressions may be nested.
+
+The test character var(x) may be any one of `tt(l)', `tt(n)', `tt(m)'
+or `tt(M)', which indicate a `true' result if the corresponding
+escape sequence would return a non-empty value; or it may be `tt(a)',
+which indicates a `true' result if the watched user has logged in,
+or `false' if he has logged out.
+Other characters evaluate to neither true nor false; the entire
+expression is omitted in this case.
+
+If the result is `true', then the var(true-text)
+is formatted according to the rules above and printed,
+and the var(false-text) is skipped.
+If `false', the var(true-text) is skipped and the var(false-text)
+is formatted and printed.
+Either or both of the branches may be empty, but
+both separators must be present in any case.
+)
+enditem()
+)
+enditem()
+
+Furthermore, the tt(zsh/watch) module makes available one builtin
+command:
+
+startitem()
+findex(log)
+vindex(watch, use of)
+cindex(watching users)
+cindex(users, watching)
+item(tt(log))(
+List all users currently logged in who are affected by
+the current setting of the tt(watch) parameter.
+)
+enditem()
diff --git a/Doc/Zsh/mod_zselect.yo b/Doc/Zsh/mod_zselect.yo
index e0651571e..faf59c165 100644
--- a/Doc/Zsh/mod_zselect.yo
+++ b/Doc/Zsh/mod_zselect.yo
@@ -12,7 +12,7 @@ The tt(zselect) builtin is a front-end to the `select' system call, which
blocks until a file descriptor is ready for reading or writing, or has an
error condition, with an optional timeout. If this is not available on
your system, the command prints an error message and returns status 2
-(normal errors return status 1). For more information, see your systems
+(normal errors return status 1). For more information, see your system's
documentation for manref(select)(3). Note there is no connection with the
shell builtin of the same name.
diff --git a/Doc/Zsh/mod_zutil.yo b/Doc/Zsh/mod_zutil.yo
index 24aebdfaf..3cf9e5028 100644
--- a/Doc/Zsh/mod_zutil.yo
+++ b/Doc/Zsh/mod_zutil.yo
@@ -32,20 +32,27 @@ If two patterns are equally specific, the tie is broken in favour of
the pattern that was defined first.
em(Example)
+kindex(preferred-precipitation, example style)
+findex(weather, example function)
-For example, to define your preferred form of precipitation depending on which
-city you're in, you might set the following in your tt(zshrc):
+For example, a fictional `tt(weather)' plugin might state in its documentation
+that it looks up the tt(preferred-precipitation) style under the
+`tt(:weather:)var(continent)tt(:)var(day-of-the-week)tt(:)var(phase-of-the-moon)' context.
+According to this, you might set the following in your tt(zshrc):
example(zstyle ':weather:europe:*' preferred-precipitation rain
-zstyle ':weather:europe:germany:* preferred-precipitation none
-zstyle ':weather:europe:germany:*:munich' preferred-precipitation snow)
+zstyle ':weather:*:Sunday:*' preferred-precipitation snow)
-Then, the fictional `tt(weather)' plugin might run under the hood a command
-such as
+Then the plugin would run under the hood a command such as
-example(zstyle -s ":weather:${continent}:${country}:${county}:${city}" preferred-precipitation REPLY)
+example(zstyle -s ":weather:${continent}:${day_of_week}:${moon_phase}" preferred-precipitation REPLY)
in order to retrieve your preference into the scalar variable tt($REPLY).
+On Sundays tt($REPLY) would be set to `tt(snow)'; in Europe it would be set
+to `tt(rain)'; and on Sundays in Europe it would be set to `tt(snow)' again,
+because the patterns `tt(:weather:europe:*)' and `tt(:weather:*:Sunday:*)' both
+match the var(context) argument to tt(zstyle -s), are equally specific, and the
+latter is more specific (because it has more colon-separated components).
em(Usage)
@@ -143,8 +150,9 @@ enditem()
)
findex(zformat)
xitem(tt(zformat -f) var(param) var(format) var(spec) ...)
+xitem(tt(zformat -F) var(param) var(format) var(spec) ...)
item(tt(zformat -a) var(array) var(sep) var(spec) ...)(
-This builtin provides two different forms of formatting. The first form
+This builtin provides different forms of formatting. The first form
is selected with the tt(-f) option. In this case the var(format)
string will be modified by replacing sequences starting with a percent
sign in it with strings from the var(spec)s. Each var(spec) should be
@@ -188,7 +196,13 @@ outputs "The answer is 'yes'." to tt(REPLY) since the value for the format
specifier tt(c) is 3, agreeing with the digit argument to the ternary
expression.
-The second form, using the tt(-a) option, can be used for aligning
+With tt(-F) instead of tt(-f), ternary expressions choose between the
+`true' or `false' text on the basis of whether the format specifier is
+present and non-empty. A test number indicates a minimum width for the
+value given in the format specifier. Negative numbers reverse this,
+so the test is for whether the value exceeds a maximum width.
+
+The form, using the tt(-a) option, can be used for aligning
strings. Here, the var(spec)s are of the form
`var(left)tt(:)var(right)' where `var(left)' and `var(right)' are
arbitrary strings. These strings are modified by replacing the colons
diff --git a/Doc/Zsh/modlist.yo b/Doc/Zsh/modlist.yo
index 484321e69..d066879a9 100644
--- a/Doc/Zsh/modlist.yo
+++ b/Doc/Zsh/modlist.yo
@@ -87,6 +87,9 @@ Interface to the termcap database.
item(tt(zsh/terminfo))(
Interface to the terminfo database.
)
+item(tt(zsh/watch))(
+Reporting of login and logout events.
+)
item(tt(zsh/zftp))(
A builtin FTP client.
)
@@ -195,10 +198,13 @@ includefile(Zsh/mod_tcp.yo)
texinode(The zsh/termcap Module)(The zsh/terminfo Module)(The zsh/net/tcp Module)(Zsh Modules)
sect(The zsh/termcap Module)
includefile(Zsh/mod_termcap.yo)
-texinode(The zsh/terminfo Module)(The zsh/zftp Module)(The zsh/termcap Module)(Zsh Modules)
+texinode(The zsh/terminfo Module)(The zsh/watch Module)(The zsh/termcap Module)(Zsh Modules)
sect(The zsh/terminfo Module)
includefile(Zsh/mod_terminfo.yo)
-texinode(The zsh/zftp Module)(The zsh/zle Module)(The zsh/terminfo Module)(Zsh Modules)
+texinode(The zsh/watch Module)(The zsh/zftp Module)(The zsh/terminfo Module)(Zsh Modules)
+sect(The zsh/watch Module)
+includefile(Zsh/mod_watch.yo)
+texinode(The zsh/zftp Module)(The zsh/zle Module)(The zsh/watch Module)(Zsh Modules)
sect(The zsh/zftp Module)
includefile(Zsh/mod_zftp.yo)
texinode(The zsh/zle Module)(The zsh/zleparameter Module)(The zsh/zftp Module)(Zsh Modules)
diff --git a/Doc/Zsh/modmenu.yo b/Doc/Zsh/modmenu.yo
index 2d29b6e96..c922390a4 100644
--- a/Doc/Zsh/modmenu.yo
+++ b/Doc/Zsh/modmenu.yo
@@ -28,6 +28,7 @@ menu(The zsh/system Module)
menu(The zsh/net/tcp Module)
menu(The zsh/termcap Module)
menu(The zsh/terminfo Module)
+menu(The zsh/watch Module)
menu(The zsh/zftp Module)
menu(The zsh/zle Module)
menu(The zsh/zleparameter Module)
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index fdea51412..443676b78 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -41,6 +41,9 @@ will be treated just as `tt(-f)', but the string `tt(-f i)' is an error.
This is because many systems which implement the `tt(#!)' mechanism for
calling scripts do not strip trailing whitespace.
+It is possible for options to be set within a function scope. See the
+description of the option tt(LOCAL_OPTIONS) below.
+
texinode(Description of Options)(Option Aliases)(Specifying Options)(Options)
sect(Description of Options)
cindex(options, description)
@@ -474,6 +477,22 @@ item(tt(CASE_MATCH) <D>)(
Make regular expressions using the tt(zsh/regex) module (including
matches with tt(=~)) sensitive to case.
)
+pindex(CASE_PATHS)
+pindex(NO_CASE_PATHS)
+pindex(CASEPATHS)
+pindex(NOCASEPATHS)
+cindex(case-sensitive globbing, option)
+item(tt(CASE_PATHS))(
+If tt(CASE_PATHS) is not set (the default), tt(CASE_GLOB) affects the
+interpretation of em(every) path component, whenever a special
+character appears in em(any) component. When tt(CASE_PATHS) is set,
+file path components that do em(not) contain special filename
+generation characters are always sensitive to case, thus restricting
+tt(NO_CASE_GLOB) to components that contain globbing characters.
+
+Note that if the filesystem itself is not sensitive to case, then
+tt(CASE_PATHS) has no effect.
+)
pindex(CSH_NULL_GLOB)
pindex(NO_CSH_NULL_GLOB)
pindex(CSHNULLGLOB)
@@ -586,7 +605,7 @@ Substitutions using the tt(:s) and tt(:&) history modifiers are performed
with pattern matching instead of string matching. This occurs wherever
history modifiers are valid, including glob qualifiers and parameters.
See
-ifzman(the section Modifiers in zmanref(zshexpn))\
+ifzman(the section `Modifiers' in zmanref(zshexpn))\
ifnzman(noderef(Modifiers)).
)
pindex(IGNORE_BRACES)
@@ -1124,7 +1143,7 @@ pindex(GLOBALRCS)
pindex(NOGLOBALRCS)
cindex(startup files, global, inhibiting)
cindex(files, global startup, inhibiting)
-item(tt(GLOBAL_RCS) (tt(-d)) <D>)(
+item(tt(GLOBAL_RCS) (tt(+d)) <D>)(
If this option is unset, the startup files tt(zprofile()),
tt(zshrc()), tt(zlogin()) and tt(zlogout()) will not be run. It
can be disabled and re-enabled at any time, including inside local startup
@@ -1168,6 +1187,22 @@ If the option is not set, and the option tt(APPEND_CREATE) is also
not set, `tt(>>!)' or `tt(>>|)' must be used to create a file.
If either option is set, `tt(>>)' may be used.
)
+pindex(CLOBBER_EMPTY)
+pindex(NO_CLOBBER_EMPTY)
+pindex(CLOBBEREMPTY)
+pindex(NOCLOBBEREMPTY)
+cindex(clobbering, of empty files)
+cindex(file clobbering, of empty files)
+item(tt(CLOBBER_EMPTY))(
+This option is only used if the option tt(CLOBBER) is not set: note that
+it is set by default.
+
+If this option is set, then regular files of zero length may be
+ovewritten (`clobbered'). Note that it is possible another process
+has written to the file between this test and use of the file by
+the current process. This option should therefore not be used in
+cases where files to be clobbered may be written to asynchronously.
+)
pindex(CORRECT)
pindex(NO_CORRECT)
pindex(NOCORRECT)
@@ -1377,6 +1412,14 @@ item(tt(SHORT_LOOPS) <C> <Z>)(
Allow the short forms of tt(for), tt(repeat), tt(select),
tt(if), and tt(function) constructs.
)
+pindex(SHORT_REPEAT)
+pindex(NO_SHORT_REPEAT)
+pindex(SHORTREPEAT)
+pindex(NOSHORTREPEAT)
+item(tt(SHORT_REPEAT))(
+Allow the short form tt(repeat) as tt(SHORT_LOOPS) but without enabling
+it for the other constructs.
+)
pindex(SUN_KEYBOARD_HACK)
pindex(NO_SUN_KEYBOARD_HACK)
pindex(SUNKEYBOARDHACK)
@@ -1443,7 +1486,7 @@ The check is omitted if the commands run from the previous command line
included a `tt(jobs)' command, since it is assumed the user is aware that
there are background or suspended jobs. A `tt(jobs)' command run from one
of the hook functions defined in
-ifnzman(the section Special Functions in noderef(Functions))\
+ifnzman(the section `Special Functions' in noderef(Functions))\
ifzman(the section SPECIAL FUNCTIONS in zmanref(zshmisc))
is not counted for this purpose.
)
@@ -1902,6 +1945,16 @@ If the option is set, they will only be shown when parameters are selected
with the `tt(-m)' option. The option `tt(-p)' is available whether or not
the option is set.
)
+pindex(TYPESET_TO_UNSET)
+pindex(NO_TYPESET_TO_UNSET)
+pindex(TYPESETTOUNSET)
+pindex(NOTYPESETTOUNSET)
+item(tt(TYPESET_TO_UNSET) <K> <S>)(
+When declaring a new parameter with any of the `tt(typeset)' family of
+related commands, the parameter remains unset unless and until a
+value is explicity assigned to it, either in the `tt(typeset)' command
+itself or as a later assignment statement.
+)
pindex(VERBOSE)
pindex(NO_VERBOSE)
pindex(NOVERBOSE)
@@ -2199,7 +2252,8 @@ command found in the path.
Furthermore, the tt(getopts) builtin behaves in a POSIX-compatible
fashion in that the associated variable tt(OPTIND) is not made
-local to functions.
+local to functions, and its value is calculated differently to match
+other shells.
Moreover, the warning and special exit code from
tt([[ -o )var(non_existent_option)tt( ]]) are suppressed.
@@ -2279,10 +2333,15 @@ When this option is set, the usual zsh behaviour of executing
traps for tt(EXIT) on exit from shell functions is suppressed.
In that case, manipulating tt(EXIT) traps always alters the global
trap for exiting the shell; the tt(LOCAL_TRAPS) option is
-ignored for the tt(EXIT) trap. Furthermore, a tt(return) statement
-executed in a trap with no argument passes back from the function the
-value from the surrounding context, not from code executed within the
-trap.
+ignored for the tt(EXIT) trap.
+
+Also, a tt(return) statement executed in a trap with no argument passes
+back from the function the value from the surrounding context, not from
+code executed within the trap.
+
+Furthermore, if a trap is set to be ignored, this state persists when
+a subshell is entered. Without the option, the trap would be reset to
+its default state at this point.
)
pindex(SH_FILE_EXPANSION)
pindex(NO_SH_FILE_EXPANSION)
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 8daf33d5e..6d2d41b7a 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -106,7 +106,7 @@ may be in any order. Note that this syntax is strict: tt([) and tt(]=) must
not be quoted, and var(key) may not consist of the unquoted string
tt(]=), but is otherwise treated as a simple string. The enhanced forms
of subscript expression that may be used when directly subscripting a
-variable name, described in the section Array Subscripts below, are not
+variable name, described in the section `Array Subscripts' below, are not
available.
The syntaxes with and without the explicit key may be mixed. An implicit
@@ -393,12 +393,21 @@ is compared to the pattern, and the first matching key found is the
result. On failure substitutes the length of the array plus one, as
discussed under the description of `tt(r)', or the empty string for an
associative array.
+
+Note: Although `tt(i)' may be applied to a scalar substitution to find
+the offset of a substring, the results are likely to be misleading when
+searching within substitutions that yield an empty string, or when
+searching for the empty substring.
)
item(tt(I))(
Like `tt(i)', but gives the index of the last match, or all possible
matching keys in an associative array. On failure substitutes 0, or
the empty string for an associative array. This flag is best when
testing for values or keys that do not exist.
+
+Note: If the option tt(KSH_ARRAYS) is in effect and no match is found, the
+result is indistinguishable from the case when the first element of the array
+matches.
)
item(tt(k))(
If used in a subscript on an associative array, this flag causes the keys
@@ -623,6 +632,14 @@ In the parameter lists that follow, the mark `<S>' indicates that the
parameter is special. `<Z>' indicates that the parameter does not exist
when the shell initializes in tt(sh) or tt(ksh) emulation mode.
+The parameters `tt(!)', `tt(#)', `tt(*)', `tt(-)', `tt(?)', `tt(@)',
+`tt($)', `tt(ARGC)', `tt(HISTCMD)', `tt(LINENO)', `tt(PPID)',
+`tt(status)', `tt(TTYIDLE)', `tt(zsh_eval_context)',
+`tt(ZSH_EVAL_CONTEXT)', and `tt(ZSH_SUBSHELL)' are read-only and thus
+cannot be restored by the user, so they are not output by
+`tt(typeset -p)'. This also applies to many read-only parameters loaded
+from modules.
+
The following parameters are automatically set by the shell:
startitem()
@@ -645,10 +662,11 @@ Same as tt(#).
)
vindex($)
item(tt($) <S>)(
-The process ID of this shell. Note that this indicates the original
-shell started by invoking tt(zsh); all processes forked from the shells
-without executing a new program, such as subshells started by
-tt(LPAR())var(...)tt(RPAR()), substitute the same value.
+The process ID of this shell, set when the shell initializes. Processes
+forked from the shell without executing a new program, such as command
+substitutions and commands grouped with tt(LPAR())var(...)tt(RPAR()),
+are subshells that duplicate the current shell, and thus substitute the
+same value for tt($$) as their parent shell.
)
vindex(-)
item(tt(-) <S>)(
@@ -727,7 +745,7 @@ explicitly set locally.
)
vindex(ERRNO)
item(tt(ERRNO) <S>)(
-The value of errno (see manref(errno)(3))
+The value of tt(errno) (see manref(errno)(3))
as set by the most recently failed system call.
This value is system dependent and is intended for debugging
purposes. It is also useful with the tt(zsh/system) module which
@@ -808,9 +826,9 @@ The operating system, as determined at compile time.
)
vindex(PPID)
item(tt(PPID) <S>)(
-The process ID of the parent of the shell. As for tt($$), the
-value indicates the parent of the original shell and does not
-change in subshells.
+The process ID of the parent of the shell, set when the shell initializes.
+As with tt($$), the value does not change in subshells created as a
+duplicate of the current shell.
)
vindex(PWD)
item(tt(PWD))(
@@ -836,8 +854,9 @@ will be the value that was assigned plus the number of seconds
since the assignment.
Unlike other special parameters, the type of the tt(SECONDS) parameter can
-be changed using the tt(typeset) command. Only integer and one of the
-floating point types are allowed. For example, `tt(typeset -F SECONDS)'
+be changed using the tt(typeset) command. The type may be changed only
+to one of the floating point types or back to integer. For example,
+`tt(typeset -F SECONDS)'
causes the value to be reported as a floating point number. The
value is available to microsecond accuracy, although the shell may
show more or fewer digits depending on the use of tt(typeset). See
@@ -1313,11 +1332,6 @@ most as many lines as given by the absolute value.
If set to zero, the shell asks only if the top of the listing would scroll
off the screen.
)
-vindex(LOGCHECK)
-item(tt(LOGCHECK))(
-The interval in seconds between checks for login/logout activity
-using the tt(watch) parameter.
-)
vindex(MAIL)
item(tt(MAIL))(
If this parameter is set and tt(mailpath) is not set,
@@ -1556,6 +1570,11 @@ if it is in the environment of the shell but not explicitly assigned to in
the input line. This avoids running stty at every external command by
accidentally exporting it. Also note that tt(STTY) should not be used for
window size specifications; these will not be local to the command.
+
+If the parameter is set and empty, all of the above applies except
+that tt(stty) is not run. This can be useful as a way to freeze the tty
+around a single command, blocking its changes to tty settings,
+similar to the tt(ttyctl) builtin.
)
vindex(TERM)
item(tt(TERM) <S>)(
@@ -1651,119 +1670,6 @@ to be interpreted as a file extension. The default is not to append
any suffix, thus this parameter should be assigned only when needed
and then unset again.
)
-vindex(watch)
-vindex(WATCH)
-item(tt(watch) <S> <Z> (tt(WATCH) <S>))(
-An array (colon-separated list) of login/logout events to report.
-
-If it contains the single word `tt(all)', then all login/logout events
-are reported. If it contains the single word `tt(notme)', then all
-events are reported as with `tt(all)' except tt($USERNAME).
-
-An entry in this list may consist of a username,
-an `tt(@)' followed by a remote hostname,
-and a `tt(%)' followed by a line (tty). Any of these may
-be a pattern (be sure to quote this during the assignment to
-tt(watch) so that it does not immediately perform file generation);
-the setting of the tt(EXTENDED_GLOB) option is respected.
-Any or all of these components may be present in an entry;
-if a login/logout event matches all of them,
-it is reported.
-
-For example, with the tt(EXTENDED_GLOB) option set, the following:
-
-example(watch=('^(pws|barts)'))
-
-causes reports for activity associated with any user other than tt(pws)
-or tt(barts).
-)
-vindex(WATCHFMT)
-item(tt(WATCHFMT))(
-The format of login/logout reports if the tt(watch) parameter is set.
-Default is `tt(%n has %a %l from %m)'.
-Recognizes the following escape sequences:
-
-startitem()
-item(tt(%n))(
-The name of the user that logged in/out.
-)
-item(tt(%a))(
-The observed action, i.e. "logged on" or "logged off".
-)
-item(tt(%l))(
-The line (tty) the user is logged in on.
-)
-item(tt(%M))(
-The full hostname of the remote host.
-)
-item(tt(%m))(
-The hostname up to the first `tt(.)'. If only the
-IP address is available or the utmp field contains
-the name of an X-windows display, the whole name is printed.
-
-em(NOTE:)
-The `tt(%m)' and `tt(%M)' escapes will work only if there is a host name
-field in the utmp on your machine. Otherwise they are
-treated as ordinary strings.
-)
-item(tt(%S) LPAR()tt(%s)RPAR())(
-Start (stop) standout mode.
-)
-item(tt(%U) LPAR()tt(%u)RPAR())(
-Start (stop) underline mode.
-)
-item(tt(%B) LPAR()tt(%b)RPAR())(
-Start (stop) boldface mode.
-)
-xitem(tt(%t))
-item(tt(%@))(
-The time, in 12-hour, am/pm format.
-)
-item(tt(%T))(
-The time, in 24-hour format.
-)
-item(tt(%w))(
-The date in `var(day)tt(-)var(dd)' format.
-)
-item(tt(%W))(
-The date in `var(mm)tt(/)var(dd)tt(/)var(yy)' format.
-)
-item(tt(%D))(
-The date in `var(yy)tt(-)var(mm)tt(-)var(dd)' format.
-)
-item(tt(%D{)var(string)tt(}))(
-The date formatted as var(string) using the tt(strftime) function, with
-zsh extensions as described by
-ifzman(EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\
-ifnzman(noderef(Prompt Expansion)).
-)
-item(tt(%LPAR())var(x)tt(:)var(true-text)tt(:)var(false-text)tt(RPAR()))(
-Specifies a ternary expression.
-The character following the var(x) is
-arbitrary; the same character is used to separate the text
-for the "true" result from that for the "false" result.
-Both the separator and the right parenthesis may be escaped
-with a backslash.
-Ternary expressions may be nested.
-
-The test character var(x) may be any one of `tt(l)', `tt(n)', `tt(m)'
-or `tt(M)', which indicate a `true' result if the corresponding
-escape sequence would return a non-empty value; or it may be `tt(a)',
-which indicates a `true' result if the watched user has logged in,
-or `false' if he has logged out.
-Other characters evaluate to neither true nor false; the entire
-expression is omitted in this case.
-
-If the result is `true', then the var(true-text)
-is formatted according to the rules above and printed,
-and the var(false-text) is skipped.
-If `false', the var(true-text) is skipped and the var(false-text)
-is formatted and printed.
-Either or both of the branches may be empty, but
-both separators must be present in any case.
-)
-enditem()
-)
vindex(WORDCHARS)
item(tt(WORDCHARS) <S>)(
A list of non-alphanumeric characters considered part of a word
diff --git a/Doc/Zsh/redirect.yo b/Doc/Zsh/redirect.yo
index 2b48974b4..fd40ab5a4 100644
--- a/Doc/Zsh/redirect.yo
+++ b/Doc/Zsh/redirect.yo
@@ -86,7 +86,8 @@ item(tt(<<<) var(word))(
Perform shell expansion on var(word) and pass the result
to standard input. This is known as a em(here-string).
Compare the use of var(word) in here-documents above, where var(word)
-does not undergo shell expansion.
+does not undergo shell expansion. The result will have a trailing newline
+after it.
)
xitem(tt(<&) var(number))
item(tt(>&) var(number))(
diff --git a/Doc/Zsh/roadmap.yo b/Doc/Zsh/roadmap.yo
index 94ef74d1f..2db90889b 100644
--- a/Doc/Zsh/roadmap.yo
+++ b/Doc/Zsh/roadmap.yo
@@ -20,7 +20,7 @@ The function is designed to be self-explanatory. You can run it by hand
with `tt(autoload -Uz zsh-newuser-install; zsh-newuser-install -f)'.
See also
ifnzman(noderef(User Configuration Functions))\
-ifzman(the section User Configuration Functions in zmanref(zshcontrib)).
+ifzman(the section `User Configuration Functions' in zmanref(zshcontrib)).
sect(Interactive Use)
@@ -49,7 +49,7 @@ The shell now supports the UTF-8 character set (and also others if
supported by the operating system). This is (mostly) handled transparently
by the shell, but the degree of support in terminal emulators is variable.
There is some discussion of this in the shell FAQ,
-uref(http://www.zsh.org/FAQ/). Note in particular that for combining
+uref(https://www.zsh.org/FAQ/). Note in particular that for combining
characters to be handled the option tt(COMBINING_CHARS) needs to be set.
Because the shell is now more sensitive to the definition of the
character set, note that if you are upgrading from an older version of
diff --git a/Doc/Zsh/zftpsys.yo b/Doc/Zsh/zftpsys.yo
index 349039edc..c2fbdd23f 100644
--- a/Doc/Zsh/zftpsys.yo
+++ b/Doc/Zsh/zftpsys.yo
@@ -518,13 +518,11 @@ command `tt(zstyle ':zftp:*') var(style) var(value) ...'.
defines the var(style) to have value var(value); more than one value may be
given, although that is not useful in the cases described here. These
values will then be used throughout the zftp function system. For more
-precise control, the first argument, which gives a context in which the
+precise control, the first argument, which gives a pattern that matches em(contexts) in which the
style applies, can be modified to include a particular function, as for
example `tt(:zftp:zfget)': the style will then have the given value only
-in the tt(zfget) function. Values for the same style in different contexts
-may be set; the most specific function will be used, where
-strings are held to be more specific than patterns, and longer patterns and
-shorter patterns. Note that only the top level function name, as called by
+in the tt(zfget) function, and will override styles set under `tt(:zftp:*)'.
+Note that only the top level function name, as called by
the user, is used; calling of lower level functions is transparent to the
user. Hence modifications to the title bar in tt(zftp_chpwd) use the
contexts tt(:zftp:zfopen), tt(:zftp:zfcd), etc., depending where it was
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index c928b8ca2..2d033a0a1 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -50,13 +50,15 @@ argument causes the next command entered to be repeated the specified
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) )\
+ifnzman(noderef(Arguments))\
for some other ways the numeric argument can be modified.
startmenu()
menu(Keymaps)
menu(Zle Builtins)
menu(Zle Widgets)
+menu(User-Defined Widgets)
+menu(Standard Widgets)
menu(Character Highlighting)
endmenu()
@@ -107,6 +109,7 @@ In the `tt(.safe)' keymap, each single key is bound to tt(self-insert),
except for ^J (line feed) and ^M (return) which are bound to tt(accept-line).
This is deliberately not pleasant to use; if you are using it, it
means you deleted the main keymap, and you should put it back.
+
subsect(Reading Commands)
When ZLE is reading a command from the terminal, it may read a sequence
that is bound to some command and is also a prefix of a longer bound string.
@@ -137,6 +140,7 @@ in user-defined widgets with the tt(read-command) widget, described in
ifzman(the subsection `Miscellaneous' of the section `Standard Widgets' below)\
ifnzman(noderef(Miscellaneous) below)\
.
+
subsect(Local Keymaps)
cindex(local keymaps)
While for normal editing a single keymap is used exclusively, in many
@@ -415,7 +419,7 @@ xitem(tt(zle) tt(-K) var(keymap))
xitem(tt(zle) tt(-F) [ tt(-L) | tt(-w) ] [ var(fd) [ var(handler) ] ])
xitem(tt(zle) tt(-I))
xitem(tt(zle) tt(-T) [ tt(tc) var(function) | tt(-r) tt(tc) | tt(-L) ] )
-item(tt(zle) var(widget) [ tt(-n) var(num) ] [ tt(-Nw) ] [ tt(-K) var(keymap) ] var(args) ...)(
+item(tt(zle) var(widget) [ tt(-n) var(num) ] [ tt(-f) var(flag) ] [ tt(-Nw) ] [ tt(-K) var(keymap) ] var(args) ...)(
The tt(zle) builtin performs a number of different actions concerning
ZLE.
@@ -501,8 +505,7 @@ ifnzman(noderef(Completion Widgets))\
.
)
item(tt(-R) [ tt(-c) ] [ var(display-string) ] [ var(string) ... ])(
-Redisplay the command line; this is to be called from within a user-defined
-widget to allow changes to become visible. If a var(display-string) is
+Redisplay the command line. If a var(display-string) is
given and not empty, this is shown in the status line (immediately
below the line being edited).
@@ -511,9 +514,9 @@ prompt in the same way as completion lists are printed. If no
var(string)s are given but the tt(-c) option is used such a list is
cleared.
-Note that this option is only useful for widgets that do not exit
-immediately after using it because the strings displayed will be erased
-immediately after return from the widget.
+Note that immediately after returning from running widgets, the command line
+will be redisplayed and the strings displayed will be erased. Therefore, this
+option is only useful for widgets that do not exit immediately after using it.
This command can safely be called outside user defined widgets; if zle is
active, the display will be refreshed, while if zle is not active, the
@@ -683,7 +686,7 @@ optional argument for debugging or testing. Note that this
transformation is not applied to other non-printing characters such as
carriage returns and newlines.
)
-item(var(widget) [ tt(-n) var(num) ] [ tt(-Nw) ] [ tt(-K) var(keymap) ] var(args) ...)(
+item(var(widget) [ tt(-n) var(num) ] [ tt(-f) var(flag) ] [ tt(-Nw) ] [ tt(-K) var(keymap) ] var(args) ...)(
Invoke the specified var(widget). This can only be done when ZLE is
active; normally this will be within a user-defined widget.
@@ -702,6 +705,9 @@ appears as if the top-level widget called by the user were still
active. With the option tt(-w), tt(WIDGET) and related parameters are set
to reflect the widget being executed by the tt(zle) call.
+Normally, when var(widget) returns the special parameter tt(LASTWIDGET) will
+point to it. This can be inhibited by passing the option tt(-f nolast).
+
Any further arguments will be passed to the widget; note that as
standard argument handling is performed, any general argument list
should be preceded by tt(-)tt(-). If it is a shell
@@ -726,15 +732,17 @@ enditem()
)
enditem()
-texinode(Zle Widgets)(Character Highlighting)(Zle Builtins)(Zsh Line Editor)
-sect(Widgets)
+texinode(Zle Widgets)(User-Defined Widgets)(Zle Builtins)(Zsh Line Editor)
+sect(Zle Widgets)
cindex(widgets)
All actions in the editor are performed by `widgets'. A widget's job is
simply to perform some small action. The ZLE commands that key sequences
in keymaps are bound to are in fact widgets. Widgets can be user-defined
or built in.
-The standard widgets built into ZLE are listed in Standard Widgets below.
+The standard widgets built into ZLE are listed in
+ifzman(the section `Standard Widgets' below)\
+ifnzman(noderef(Standard Widgets)).
Other built-in widgets can be defined by other modules (see
ifzman(zmanref(zshmodules))\
ifnzman(noderef(Zsh Modules))\
@@ -748,6 +756,8 @@ as shell functions. When the widget is executed, the corresponding
shell function is executed, and can perform editing (or other) actions.
It is recommended that user-defined widgets should not have names
starting with `tt(.)'.
+
+texinode(User-Defined Widgets)(Standard Widgets)(Zle Widgets)(Zsh Line Editor)
sect(User-Defined Widgets)
cindex(widgets, user-defined)
User-defined widgets, being implemented as shell functions,
@@ -974,27 +984,39 @@ of the non-editable parts of the command line in tt(PREDISPLAY)
and tt(POSTDISPLAY) are possible, but note that the tt(P) flag
is needed for character indexing to include tt(PREDISPLAY).
-Each string consists of the following parts:
+Each string consists of the following whitespace-separated parts:
startitemize()
itemiz(Optionally, a `tt(P)' to signify that the start and end offset that
follow include any string set by the tt(PREDISPLAY) special parameter;
this is needed if the predisplay string itself is to be highlighted.
-Whitespace may follow the `tt(P)'.)
-itemiz(A start offset in the same units as tt(CURSOR), terminated by
-whitespace.)
-itemiz(An end offset in the same units as tt(CURSOR), terminated by
-whitespace.)
+Whitespace between the `tt(P)' and the start offset is optional.)
+itemiz(A start offset in the same units as tt(CURSOR).)
+itemiz(An end offset in the same units as tt(CURSOR).)
itemiz(A highlight specification in the same format as
used for contexts in the parameter tt(zle_highlight), see
ifnzman(noderef(Character Highlighting))\
ifzman(the section `Character Highlighting' below);
-for example, tt(standout) or tt(fg=red,bold)).
+for example, tt(standout) or tt(fg=red,bold).)
+itemiz(Optionally, a string of the form `tt(memo=)var(token)'.
+The var(token) consists of everything between the `tt(=)' and the next
+whitespace, comma, NUL, or the end of the string.
+The var(token) is preserved verbatim but not parsed in any way.
+
+Plugins may use this to identify array elements they have added: for example,
+a plugin might set var(token) to its (the plugin's) name and then use
+`tt(region_highlight=+LPAR() ${region_highlight:#*memo=)var(token)tt(} +RPAR())'
+in order to remove array elements it have added.
+
+(This example uses the `tt(${)var(name)tt(:#)var(pattern)tt(})' array-grepping
+syntax described in
+ifzman(the section `Parameter Expansion' in zmanref(zshexpn))\
+ifnzman(noderef(Parameter Expansion)).))
enditemize()
For example,
-example(region_highlight=("P0 20 bold"))
+example(region_highlight=("P0 20 bold memo=foobar"))
specifies that the first twenty characters of the text including
any predisplay string should be highlighted in bold.
@@ -1002,6 +1024,14 @@ any predisplay string should be highlighted in bold.
Note that the effect of tt(region_highlight) is not saved and disappears
as soon as the line is accepted.
+Note that zsh 5.8 and older do not support the `tt(memo=)var(token)' field
+and may misparse the third (highlight specification) field when a memo
+is given.
+COMMENT(The syntax `tt(0 20 bold, memo=foobar)' (with an auxiliary comma)
+happens to work on both zsh <=5.8 and zsh 5.9-to-be, but that seems to be more of
+an accident of implementation than something we should make a first-class-citizen
+API promise. It's mentioned in the "Incompatibilities" section of README.)
+
The final highlighting on the command line depends on both tt(region_highlight)
and tt(zle_highlight); see
ifzman(the section CHARACTER HIGHLIGHTING below)\
@@ -1184,6 +1214,7 @@ This can be used for detecting switches between the vi command
)
enditem()
+texinode(Standard Widgets)(Character Highlighting)(User-Defined Widgets)(Zsh Line Editor)
sect(Standard Widgets)
cindex(widgets, standard)
The following is a list of all the standard widgets,
@@ -1209,7 +1240,7 @@ menu(Completion)
menu(Miscellaneous)
menu(Text Objects)
endmenu()
-texinode(Movement)(History Control)()(Zle Widgets)
+texinode(Movement)(History Control)()(Standard Widgets)
subsect(Movement)
startitem()
tindex(vi-backward-blank-word)
@@ -1356,7 +1387,7 @@ item(tt(up-line) (unbound) (unbound) (unbound))(
Move up a line in the buffer.
)
enditem()
-texinode(History Control)(Modifying Text)(Movement)(Zle Widgets)
+texinode(History Control)(Modifying Text)(Movement)(Standard Widgets)
subsect(History Control)
startitem()
tindex(beginning-of-buffer-or-history)
@@ -1704,7 +1735,7 @@ the numeric argument. Zero for both local and imported lines and nonzero for
only local lines.
)
enditem()
-texinode(Modifying Text)(Arguments)(History Control)(Zle Widgets)
+texinode(Modifying Text)(Arguments)(History Control)(Standard Widgets)
subsect(Modifying Text)
startitem()
tindex(vi-add-eol)
@@ -2030,7 +2061,7 @@ into the kill buffer.
Arguably, this is what Y should do in vi, but it isn't what it actually does.
)
enditem()
-texinode(Arguments)(Completion)(Modifying Text)(Zle Widgets)
+texinode(Arguments)(Completion)(Modifying Text)(Standard Widgets)
subsect(Arguments)
startitem()
tindex(digit-argument)
@@ -2078,7 +2109,7 @@ example(zle argument-base 16
zle universal-argument)
)
enditem()
-texinode(Completion)(Miscellaneous)(Arguments)(Zle Widgets)
+texinode(Completion)(Miscellaneous)(Arguments)(Standard Widgets)
subsect(Completion)
startitem()
tindex(accept-and-menu-complete)
@@ -2153,7 +2184,7 @@ When a previous completion displayed a list below the prompt, this
widget can be used to move the prompt below the list.
)
enditem()
-texinode(Miscellaneous)(Text Objects)(Completion)(Zle Widgets)
+texinode(Miscellaneous)(Text Objects)(Completion)(Standard Widgets)
subsect(Miscellaneous)
startitem()
tindex(accept-and-hold)
@@ -2200,7 +2231,7 @@ item(tt(beep))(
Beep, unless the tt(BEEP) option is unset.
)
tindex(bracketed-paste)
-item(tt(bracketed-paste))(
+item(tt(bracketed-paste) (tt(^[[200~)) (tt(^[[200~)) (tt(^[[200~)))(
This widget is invoked when text is pasted to the terminal emulator. It
is not intended to be bound to actual keys but instead to the special
sequence generated by the terminal emulator when text is pasted.
@@ -2551,7 +2582,7 @@ If the last command executed was a digit as part of an argument,
continue the argument. Otherwise, execute vi-beginning-of-line.
)
enditem()
-texinode(Text Objects)()(Miscellaneous)(Zle Widgets)
+texinode(Text Objects)()(Miscellaneous)(Standard Widgets)
subsect(Text Objects)
cindex(text objects)
Text objects are commands that can be used to select a block of text
@@ -2596,7 +2627,7 @@ argument, multiple words will be selected.
)
enditem()
-texinode(Character Highlighting)()(Zle Widgets)(Zsh Line Editor)
+texinode(Character Highlighting)()(Standard Widgets)(Zsh Line Editor)
sect(Character Highlighting)
vindex(zle_highlight, setting)
diff --git a/Doc/help/alias b/Doc/help/alias
index 7fe9e3166..a746af240 100644
--- a/Doc/help/alias
+++ b/Doc/help/alias
@@ -3,7 +3,13 @@ alias [ {+|-}gmrsL ] [ name[=value] ... ]
that value. A trailing space in value causes the next word to
be checked for alias expansion. If the -g flag is present, de-
fine a global alias; global aliases are expanded even if they do
- not occur in command position.
+ not occur in command position:
+
+ % perldoc --help 2>&1 | grep 'built-in functions'
+ -f Search Perl built-in functions
+ % alias -g HG='--help 2>&1 | grep'
+ % perldoc HG 'built-in functions'
+ -f Search Perl built-in functions
If the -s flag is present, define a suffix alias: if the command
word on a command line is in the form `text.name', where text is
diff --git a/Doc/help/fc b/Doc/help/fc
index 07fa8ae01..5a4b149e2 100644
--- a/Doc/help/fc
+++ b/Doc/help/fc
@@ -1,4 +1,5 @@
-fc [ -e ename ] [ -LI ] [ -m match ] [ old=new ... ] [ first [ last ] ]
+fc [ -e ename ] [ -s ] [ -LI ] [ -m match ] [ old=new ... ] [ first [
+last ] ]
fc -l [ -LI ] [ -nrdfEiD ] [ -t timefmt ] [ -m match ]
[ old=new ... ] [ first [ last ] ]
fc -p [ -a ] [ filename [ histsize [ savehistsize ] ] ]
@@ -6,26 +7,27 @@ fc -P
fc -ARWI [ filename ]
The fc command controls the interactive history mechanism. Note
that reading and writing of history options is only performed if
- the shell is interactive. Usually this is detected automati-
- cally, but it can be forced by setting the interactive option
+ the shell is interactive. Usually this is detected automati-
+ cally, but it can be forced by setting the interactive option
when starting the shell.
- The first two forms of this command select a range of events
- from first to last from the history list. The arguments first
- and last may be specified as a number or as a string. A nega-
- tive number is used as an offset to the current history event
+ The first two forms of this command select a range of events
+ from first to last from the history list. The arguments first
+ and last may be specified as a number or as a string. A nega-
+ tive number is used as an offset to the current history event
number. A string specifies the most recent event beginning with
- the given string. All substitutions old=new, if any, are then
+ the given string. All substitutions old=new, if any, are then
performed on the text of the events.
- In addition to the number range,
+ The range of events selected by numbers can be narrowed further
+ by the following flags.
-I restricts to only internal events (not from $HISTFILE)
-L restricts to only local events (not from other shells,
see SHARE_HISTORY in zshoptions(1) -- note that $HISTFILE
is considered local when read at startup)
- -m takes the first argument as a pattern (should be quoted)
- and only the history events matching this pattern are
- considered
+ -m takes the first argument as a pattern (which should be
+ quoted) and only the history events matching this pattern
+ are considered
If first is not specified, it will be set to -1 (the most recent
event), or to -16 if the -l flag is given. If last is not spec-
@@ -43,65 +45,66 @@ fc -ARWI [ filename ]
ename is `-', no editor is invoked. When editing is complete,
the edited command is executed.
- The flag -r reverses the order of the events and the flag -n
- suppresses event numbers when listing.
+ The flag `-s' is equivalent to `-e -'. The flag -r reverses the
+ order of the events and the flag -n suppresses event numbers
+ when listing.
Also when listing,
-d prints timestamps for each event
- -f prints full time-date stamps in the US `MM/DD/YY hh:mm'
+ -f prints full time-date stamps in the US `MM/DD/YY hh:mm'
format
- -E prints full time-date stamps in the European `dd.mm.yyyy
+ -E prints full time-date stamps in the European `dd.mm.yyyy
hh:mm' format
-i prints full time-date stamps in ISO8601 `yyyy-mm-dd
hh:mm' format
- -t fmt prints time and date stamps in the given format; fmt is
- formatted with the strftime function with the zsh exten-
- sions described for the %D{string} prompt format in the
+ -t fmt prints time and date stamps in the given format; fmt is
+ formatted with the strftime function with the zsh exten-
+ sions described for the %D{string} prompt format in the
section EXPANSION OF PROMPT SEQUENCES in zshmisc(1). The
resulting formatted string must be no more than 256 char-
acters or will not be printed
-D prints elapsed times; may be combined with one of the op-
tions above
- `fc -p' pushes the current history list onto a stack and
+ `fc -p' pushes the current history list onto a stack and
switches to a new history list. If the -a option is also speci-
- fied, this history list will be automatically popped when the
- current function scope is exited, which is a much better solu-
+ fied, this history list will be automatically popped when the
+ current function scope is exited, which is a much better solu-
tion than creating a trap function to call `fc -P' manually. If
- no arguments are specified, the history list is left empty,
- $HISTFILE is unset, and $HISTSIZE & $SAVEHIST are set to their
- default values. If one argument is given, $HISTFILE is set to
+ no arguments are specified, the history list is left empty,
+ $HISTFILE is unset, and $HISTSIZE & $SAVEHIST are set to their
+ default values. If one argument is given, $HISTFILE is set to
that filename, $HISTSIZE & $SAVEHIST are left unchanged, and the
- history file is read in (if it exists) to initialize the new
- list. If a second argument is specified, $HISTSIZE & $SAVEHIST
+ history file is read in (if it exists) to initialize the new
+ list. If a second argument is specified, $HISTSIZE & $SAVEHIST
are instead set to the single specified numeric value. Finally,
if a third argument is specified, $SAVEHIST is set to a separate
- value from $HISTSIZE. You are free to change these environment
- values for the new history list however you desire in order to
+ value from $HISTSIZE. You are free to change these environment
+ values for the new history list however you desire in order to
manipulate the new history list.
`fc -P' pops the history list back to an older list saved by `fc
- -p'. The current list is saved to its $HISTFILE before it is
- destroyed (assuming that $HISTFILE and $SAVEHIST are set appro-
- priately, of course). The values of $HISTFILE, $HISTSIZE, and
- $SAVEHIST are restored to the values they had when `fc -p' was
- called. Note that this restoration can conflict with making
+ -p'. The current list is saved to its $HISTFILE before it is
+ destroyed (assuming that $HISTFILE and $SAVEHIST are set appro-
+ priately, of course). The values of $HISTFILE, $HISTSIZE, and
+ $SAVEHIST are restored to the values they had when `fc -p' was
+ called. Note that this restoration can conflict with making
these variables "local", so your best bet is to avoid local dec-
- larations for these variables in functions that use `fc -p'.
- The one other guaranteed-safe combination is declaring these
- variables to be local at the top of your function and using the
- automatic option (-a) with `fc -p'. Finally, note that it is
+ larations for these variables in functions that use `fc -p'.
+ The one other guaranteed-safe combination is declaring these
+ variables to be local at the top of your function and using the
+ automatic option (-a) with `fc -p'. Finally, note that it is
legal to manually pop a push marked for automatic popping if you
need to do so before the function exits.
- `fc -R' reads the history from the given file, `fc -W' writes
- the history out to the given file, and `fc -A' appends the his-
- tory out to the given file. If no filename is specified, the
- $HISTFILE is assumed. If the -I option is added to -R, only
- those events that are not already contained within the internal
- history list are added. If the -I option is added to -A or -W,
- only those events that are new since last incremental ap-
- pend/write to the history file are appended/written. In any
+ `fc -R' reads the history from the given file, `fc -W' writes
+ the history out to the given file, and `fc -A' appends the his-
+ tory out to the given file. If no filename is specified, the
+ $HISTFILE is assumed. If the -I option is added to -R, only
+ those events that are not already contained within the internal
+ history list are added. If the -I option is added to -A or -W,
+ only those events that are new since last incremental ap-
+ pend/write to the history file are appended/written. In any
case, the created file will have no more than $SAVEHIST entries.
history
diff --git a/Doc/help/fg b/Doc/help/fg
index f52ca1fd5..da8897332 100644
--- a/Doc/help/fg
+++ b/Doc/help/fg
@@ -1,4 +1,4 @@
fg [ job ... ]
job ...
- Bring each specified job in turn to the foreground. If no job
+ Bring each specified job in turn to the foreground. If no job
is specified, resume the current job.
diff --git a/Doc/help/functions b/Doc/help/functions
index 2f1a5dd0b..cadbd0350 100644
--- a/Doc/help/functions
+++ b/Doc/help/functions
@@ -3,50 +3,92 @@ functions -c oldfn newfn
functions -M [-s] mathfn [ min [ max [ shellfn ] ] ]
functions -M [ -m pattern ... ]
functions +M [ -m ] mathfn ...
- Equivalent to typeset -f, with the exception of the -c, -x, -M
- and -W options. For functions -u and functions -U, see au-
+ Equivalent to typeset -f, with the exception of the -c, -x, -M
+ and -W options. For functions -u and functions -U, see au-
toload, which provides additional options.
The -x option indicates that any functions output will have each
- leading tab for indentation, added by the shell to show syntac-
- tic structure, expanded to the given number num of spaces. num
+ leading tab for indentation, added by the shell to show syntac-
+ tic structure, expanded to the given number num of spaces. num
can also be 0 to suppress all indentation.
- The -W option turns on the option WARN_NESTED_VAR for the named
- function or functions only. The option is turned off at the
- start of nested functions (apart from anonoymous functions) un-
+ The -W option turns on the option WARN_NESTED_VAR for the named
+ function or functions only. The option is turned off at the
+ start of nested functions (apart from anonoymous functions) un-
less the called function also has the -W attribute.
- The -c option causes oldfn to be copied to newfn. The copy is
- efficiently handled internally by reference counting. If oldfn
+ The -c option causes oldfn to be copied to newfn. The copy is
+ efficiently handled internally by reference counting. If oldfn
was marked for autoload it is first loaded and if this fails the
copy fails. Either function may subsequently be redefined with-
- out affecting the other. A typical idiom is that oldfn is the
+ out affecting the other. A typical idiom is that oldfn is the
name of a library shell function which is then redefined to call
newfn, thereby installing a modified version of the function.
+ The -M and +M flags
+
Use of the -M option may not be combined with any of the options
handled by typeset -f.
functions -M mathfn defines mathfn as the name of a mathematical
- function recognised in all forms of arithmetical expressions;
- see the section `Arithmetic Evaluation' in zshmisc(1). By de-
- fault mathfn may take any number of comma-separated arguments.
- If min is given, it must have exactly min args; if min and max
- are both given, it must have at least min and at most max args.
+ function recognised in all forms of arithmetical expressions;
+ see the section `Arithmetic Evaluation' in zshmisc(1). By de-
+ fault mathfn may take any number of comma-separated arguments.
+ If min is given, it must have exactly min args; if min and max
+ are both given, it must have at least min and at most max args.
max may be -1 to indicate that there is no upper limit.
- By default the function is implemented by a shell function of
- the same name; if shellfn is specified it gives the name of the
- corresponding shell function while mathfn remains the name used
- in arithmetical expressions. The name of the function in $0 is
- mathfn (not shellfn as would usually be the case), provided the
+ By default the function is implemented by a shell function of
+ the same name; if shellfn is specified it gives the name of the
+ corresponding shell function while mathfn remains the name used
+ in arithmetical expressions. The name of the function in $0 is
+ mathfn (not shellfn as would usually be the case), provided the
option FUNCTION_ARGZERO is in effect. The positional parameters
- in the shell function correspond to the arguments of the mathe-
- matical function call. The result of the last arithmetical ex-
- pression evaluated inside the shell function (even if it is a
- form that normally only returns a status) gives the result of
- the mathematical function.
+ in the shell function correspond to the arguments of the mathe-
+ matical function call.
+
+ The result of the last arithmetical expression evaluated inside
+ the shell function gives the result of the mathematical func-
+ tion. This is not limited to arithmetic substitutions of the
+ form $((...)), but also includes arithmetical expressions evalu-
+ ated in any other way, including by the let builtin, by ((...))
+ statements, and even by the return builtin and by array sub-
+ scripts. Therefore, care must be taken not to use syntactical
+ constructs that perform arithmetic evaluation after evaluating
+ what is to be the result of the function. For example:
+
+ # WRONG
+ zmath_cube() {
+ (( $1 * $1 * $1 ))
+ return 0
+ }
+ functions -M cube 1 1 zmath_cube
+ print $(( cube(3) ))
+
+ This will print `0' because of the return.
+
+ Commenting the return out would lead to a different problem: the
+ ((...)) statement would become the last statement in the func-
+ tion, so the return status ($?) of the function would be
+ non-zero (indicating failure) whenever the arithmetic result of
+ the function would happen to be zero (numerically):
+
+ # WRONG
+ zmath_cube() {
+ (( $1 * $1 * $1 ))
+ }
+ functions -M cube 1 1 zmath_cube
+ print $(( cube(0) ))
+
+ Instead, the true builtin can be used:
+
+ # RIGHT
+ zmath_cube() {
+ (( $1 * $1 * $1 ))
+ true
+ }
+ functions -M cube 1 1 zmath_cube
+ print $(( cube(3) ))
If the additional option -s is given to functions -M, the argu-
ment to the function is a single string: anything between the
@@ -54,28 +96,20 @@ functions +M [ -m ] mathfn ...
tion as a single argument, even if it includes commas or white
space. The minimum and maximum argument specifiers must there-
fore be 1 if given. An empty argument list is passed as a
- zero-length string.
+ zero-length string. Thus, the following string function takes a
+ single argument, including the commas, and prints 11:
+
+ stringfn() { (( $#1 )); true }
+ functions -Ms stringfn
+ print $(( stringfn(foo,bar,rod) ))
functions -M with no arguments lists all such user-defined func-
tions in the same form as a definition. With the additional op-
- tion -m and a list of arguments, all functions whose mathfn
+ tion -m and a list of arguments, all functions whose mathfn
matches one of the pattern arguments are listed.
function +M removes the list of mathematical functions; with the
- additional option -m the arguments are treated as patterns and
- all functions whose mathfn matches the pattern are removed.
- Note that the shell function implementing the behaviour is not
+ additional option -m the arguments are treated as patterns and
+ all functions whose mathfn matches the pattern are removed.
+ Note that the shell function implementing the behaviour is not
removed (regardless of whether its name coincides with mathfn).
-
- For example, the following prints the cube of 3:
-
- zmath_cube() { (( $1 * $1 * $1 )) }
- functions -M cube 1 1 zmath_cube
- print $(( cube(3) ))
-
- The following string function takes a single argument, including
- the commas, so prints 11:
-
- stringfn() { (( $#1 )) }
- functions -Ms stringfn
- print $(( stringfn(foo,bar,rod) ))
diff --git a/Doc/help/getopts b/Doc/help/getopts
index ef73c55c1..bb89d2f2a 100644
--- a/Doc/help/getopts
+++ b/Doc/help/getopts
@@ -16,15 +16,16 @@ getopts optstring name [ arg ... ]
The first option to be examined may be changed by explicitly as-
signing to OPTIND. OPTIND has an initial value of 1, and is
normally set to 1 upon entry to a shell function and restored
- upon exit (this is disabled by the POSIX_BUILTINS option). OP-
- TARG is not reset and retains its value from the most recent
- call to getopts. If either of OPTIND or OPTARG is explicitly
+ upon exit. (The POSIX_BUILTINS option disables this, and also
+ changes the way the value is calculated to match other shells.)
+ OPTARG is not reset and retains its value from the most recent
+ call to getopts. If either of OPTIND or OPTARG is explicitly
unset, it remains unset, and the index or option argument is not
stored. The option itself is still stored in name in this case.
A leading `:' in optstring causes getopts to store the letter of
- any invalid option in OPTARG, and to set name to `?' for an un-
- known option and to `:' when a required argument is missing.
- Otherwise, getopts sets name to `?' and prints an error message
- when an option is invalid. The exit status is nonzero when
+ any invalid option in OPTARG, and to set name to `?' for an un-
+ known option and to `:' when a required argument is missing.
+ Otherwise, getopts sets name to `?' and prints an error message
+ when an option is invalid. The exit status is nonzero when
there are no more options.
diff --git a/Doc/help/hash b/Doc/help/hash
index c1dfb49f2..dcbc7fd1c 100644
--- a/Doc/help/hash
+++ b/Doc/help/hash
@@ -1,47 +1,47 @@
hash [ -Ldfmrv ] [ name[=value] ] ...
- hash can be used to directly modify the contents of the command
- hash table, and the named directory hash table. Normally one
- would modify these tables by modifying one's PATH (for the com-
- mand hash table) or by creating appropriate shell parameters
- (for the named directory hash table). The choice of hash table
- to work on is determined by the -d option; without the option
- the command hash table is used, and with the option the named
+ hash can be used to directly modify the contents of the command
+ hash table, and the named directory hash table. Normally one
+ would modify these tables by modifying one's PATH (for the com-
+ mand hash table) or by creating appropriate shell parameters
+ (for the named directory hash table). The choice of hash table
+ to work on is determined by the -d option; without the option
+ the command hash table is used, and with the option the named
directory hash table is used.
A command name starting with a / is never hashed, whether by ex-
- plicit use of the hash command or otherwise. Such a command is
+ plicit use of the hash command or otherwise. Such a command is
always found by direct look up in the file system.
- Given no arguments, and neither the -r or -f options, the se-
+ Given no arguments, and neither the -r or -f options, the se-
lected hash table will be listed in full.
- The -r option causes the selected hash table to be emptied. It
- will be subsequently rebuilt in the normal fashion. The -f op-
- tion causes the selected hash table to be fully rebuilt immedi-
- ately. For the command hash table this hashes all the absolute
- directories in the PATH, and for the named directory hash table
+ The -r option causes the selected hash table to be emptied. It
+ will be subsequently rebuilt in the normal fashion. The -f op-
+ tion causes the selected hash table to be fully rebuilt immedi-
+ ately. For the command hash table this hashes all the absolute
+ directories in the PATH, and for the named directory hash table
this adds all users' home directories. These two options cannot
be used with any arguments.
- The -m option causes the arguments to be taken as patterns
- (which should be quoted) and the elements of the hash table
- matching those patterns are printed. This is the only way to
+ The -m option causes the arguments to be taken as patterns
+ (which should be quoted) and the elements of the hash table
+ matching those patterns are printed. This is the only way to
display a limited selection of hash table elements.
- For each name with a corresponding value, put `name' in the se-
+ For each name with a corresponding value, put `name' in the se-
lected hash table, associating it with the pathname `value'. In
- the command hash table, this means that whenever `name' is used
- as a command argument, the shell will try to execute the file
+ the command hash table, this means that whenever `name' is used
+ as a command argument, the shell will try to execute the file
given by `value'. In the named directory hash table, this means
that `value' may be referred to as `~name'.
- For each name with no corresponding value, attempt to add name
+ For each name with no corresponding value, attempt to add name
to the hash table, checking what the appropriate value is in the
- normal manner for that hash table. If an appropriate value
+ normal manner for that hash table. If an appropriate value
can't be found, then the hash table will be unchanged.
The -v option causes hash table entries to be listed as they are
- added by explicit specification. If has no effect if used with
+ added by explicit specification. If has no effect if used with
-f.
If the -L flag is present, then each hash table entry is printed
diff --git a/Doc/help/jobs b/Doc/help/jobs
index 7a602da2b..56f4e34fd 100644
--- a/Doc/help/jobs
+++ b/Doc/help/jobs
@@ -1,14 +1,33 @@
jobs [ -dlprs ] [ job ... ]
jobs -Z string
- Lists information about each given job, or all jobs if job is
- omitted. The -l flag lists process IDs, and the -p flag lists
- process groups. If the -r flag is specified only running jobs
+ Lists information about each given job, or all jobs if job is
+ omitted. The -l flag lists process IDs, and the -p flag lists
+ process groups. If the -r flag is specified only running jobs
will be listed and if the -s flag is given only stopped jobs are
- shown. If the -d flag is given, the directory from which the
- job was started (which may not be the current directory of the
+ shown. If the -d flag is given, the directory from which the
+ job was started (which may not be the current directory of the
job) will also be shown.
- The -Z option replaces the shell's argument and environment
- space with the given string, truncated if necessary to fit.
+ The -Z option replaces the shell's argument and environment
+ space with the given string, truncated if necessary to fit.
This will normally be visible in ps (ps(1)) listings. This fea-
ture is typically used by daemons, to indicate their state.
+
+ Full job control is only available in the top-level interactive
+ shell, not in commands run in the left hand side of pipelines or
+ within the (...) construct. However, a snapshot of the job
+ state at that point is taken, so it is still possible to use the
+ jobs builtin, or any parameter providing job information. This
+ gives information about the state of jobs at the point the sub-
+ shell was created. If background processes are created within
+ the subshell, then instead information about those processes is
+ provided.
+
+ For example,
+
+ sleep 10 & # Job in background
+ ( # Shell forks
+ jobs # Shows information about "sleep 10 &"
+ sleep 5 & # Process in background (no job control)
+ jobs # Shows information about "sleep 5 &"
+ )
diff --git a/Doc/help/kill b/Doc/help/kill
index c68d46704..9112ffefe 100644
--- a/Doc/help/kill
+++ b/Doc/help/kill
@@ -1,24 +1,24 @@
kill [ -s signal_name | -n signal_number | -sig ] job ...
kill -l [ sig ... ]
- Sends either SIGTERM or the specified signal to the given jobs
- or processes. Signals are given by number or by names, with or
- without the `SIG' prefix. If the signal being sent is not
- `KILL' or `CONT', then the job will be sent a `CONT' signal if
- it is stopped. The argument job can be the process ID of a job
+ Sends either SIGTERM or the specified signal to the given jobs
+ or processes. Signals are given by number or by names, with or
+ without the `SIG' prefix. If the signal being sent is not
+ `KILL' or `CONT', then the job will be sent a `CONT' signal if
+ it is stopped. The argument job can be the process ID of a job
not in the job list. In the second form, kill -l, if sig is not
- specified the signal names are listed. Otherwise, for each sig
- that is a name, the corresponding signal number is listed. For
- each sig that is a signal number or a number representing the
- exit status of a process which was terminated or stopped by a
+ specified the signal names are listed. Otherwise, for each sig
+ that is a name, the corresponding signal number is listed. For
+ each sig that is a signal number or a number representing the
+ exit status of a process which was terminated or stopped by a
signal the name of the signal is printed.
- On some systems, alternative signal names are allowed for a few
+ On some systems, alternative signal names are allowed for a few
signals. Typical examples are SIGCHLD and SIGCLD or SIGPOLL and
SIGIO, assuming they correspond to the same signal number. kill
- -l will only list the preferred form, however kill -l alt will
- show if the alternative form corresponds to a signal number.
+ -l will only list the preferred form, however kill -l alt will
+ show if the alternative form corresponds to a signal number.
For example, under Linux kill -l IO and kill -l POLL both output
29, hence kill -IO and kill -POLL have the same effect.
- Many systems will allow process IDs to be negative to kill a
+ Many systems will allow process IDs to be negative to kill a
process group or zero to kill the current process group.
diff --git a/Doc/help/let b/Doc/help/let
index 96f3dc167..2119df55c 100644
--- a/Doc/help/let
+++ b/Doc/help/let
@@ -1,6 +1,6 @@
let arg ...
- Evaluate each arg as an arithmetic expression. See the section
- `Arithmetic Evaluation' in zshmisc(1) for a description of
- arithmetic expressions. The exit status is 0 if the value of
+ Evaluate each arg as an arithmetic expression. See the section
+ `Arithmetic Evaluation' in zshmisc(1) for a description of
+ arithmetic expressions. The exit status is 0 if the value of
the last expression is nonzero, 1 if it is zero, and 2 if an er-
ror occurred.
diff --git a/Doc/help/limit b/Doc/help/limit
index 1e31b122d..342df33da 100644
--- a/Doc/help/limit
+++ b/Doc/help/limit
@@ -1,17 +1,17 @@
limit [ -hs ] [ resource [ limit ] ] ...
- Set or display resource limits. Unless the -s flag is given,
- the limit applies only the children of the shell. If -s is
- given without other arguments, the resource limits of the cur-
- rent shell is set to the previously set resource limits of the
+ Set or display resource limits. Unless the -s flag is given,
+ the limit applies only the children of the shell. If -s is
+ given without other arguments, the resource limits of the cur-
+ rent shell is set to the previously set resource limits of the
children.
If limit is not specified, print the current limit placed on re-
- source, otherwise set the limit to the specified value. If the
+ source, otherwise set the limit to the specified value. If the
-h flag is given, use hard limits instead of soft limits. If no
resource is given, print all limits.
When looping over multiple resources, the shell will abort imme-
- diately if it detects a badly formed argument. However, if it
+ diately if it detects a badly formed argument. However, if it
fails to set a limit for some other reason it will continue try-
ing to set the remaining limits.
@@ -20,7 +20,7 @@ limit [ -hs ] [ resource [ limit ] ] ...
addressspace
Maximum amount of address space used.
aiomemorylocked
- Maximum amount of memory locked in RAM for AIO opera-
+ Maximum amount of memory locked in RAM for AIO opera-
tions.
aiooperations
Maximum number of AIO operations.
@@ -71,10 +71,10 @@ limit [ -hs ] [ resource [ limit ] ] ...
for the resource by the operating system.
If argument corresponds to a number which is out of the range of
- the resources configured into the shell, the shell will try to
+ the resources configured into the shell, the shell will try to
read or write the limit anyway, and will report an error if this
- fails. As the shell does not store such resources internally,
- an attempt to set the limit will fail unless the -s option is
+ fails. As the shell does not store such resources internally,
+ an attempt to set the limit will fail unless the -s option is
present.
limit is a number, with an optional scaling factor, as follows:
@@ -86,6 +86,6 @@ limit [ -hs ] [ resource [ limit ] ] ...
[mm:]ss
minutes and seconds
- The limit command is not made available by default when the
- shell starts in a mode emulating another shell. It can be made
+ The limit command is not made available by default when the
+ shell starts in a mode emulating another shell. It can be made
available with the command `zmodload -F zsh/rlimits b:limit'.
diff --git a/Doc/help/log b/Doc/help/log
deleted file mode 100644
index e6627fc5f..000000000
--- a/Doc/help/log
+++ /dev/null
@@ -1,2 +0,0 @@
-log List all users currently logged in who are affected by the cur-
- rent setting of the watch parameter.
diff --git a/Doc/help/read b/Doc/help/read
index 743389f72..ac14407ea 100644
--- a/Doc/help/read
+++ b/Doc/help/read
@@ -1,5 +1,5 @@
read [ -rszpqAclneE ] [ -t [ num ] ] [ -k [ num ] ] [ -d delim ]
- [ -u n ] [ name[?prompt] ] [ name ... ]
+ [ -u n ] [ [name][?prompt] ] [ name ... ]
Read one line and break it into fields using the characters in
$IFS as separators, except as noted below. The first field is
assigned to the first name, the second field to the second name,
diff --git a/Doc/help/return b/Doc/help/return
index d9a53e15b..61a32d48a 100644
--- a/Doc/help/return
+++ b/Doc/help/return
@@ -1,8 +1,13 @@
return [ n ]
Causes a shell function or `.' script to return to the invoking
script with the return status specified by an arithmetic expres-
- sion n. If n is omitted, the return status is that of the last
- command executed.
+ sion n. For example, the following prints `42':
+
+ () { integer foo=40; return "foo + 2" }
+ echo $?
+
+ If n is omitted, the return status is that of the last command
+ executed.
If return was executed from a trap in a TRAPNAL function, the
effect is different for zero and non-zero return status. With
@@ -12,5 +17,5 @@ return [ n ]
rupted except that the return status of the trap is retained.
Note that the numeric value of the signal which caused the trap
is passed as the first argument, so the statement `return
- $((128+$1))' will return the same status as if the signal had
- not been trapped.
+ "128+$1"' will return the same status as if the signal had not
+ been trapped.
diff --git a/Doc/help/ttyctl b/Doc/help/ttyctl
index 6736658f2..937fdf913 100644
--- a/Doc/help/ttyctl
+++ b/Doc/help/ttyctl
@@ -18,4 +18,5 @@ ttyctl [ -fu ]
command line are preserved. Strings of commands run between
editing the command line will see a consistent tty state. See
also the shell variable STTY for a means of initialising the tty
- before running external commands.
+ before running external commands and/or freezing the tty around
+ a single command.
diff --git a/Doc/help/typeset b/Doc/help/typeset
index 31f505fb7..852b39153 100644
--- a/Doc/help/typeset
+++ b/Doc/help/typeset
@@ -5,16 +5,21 @@ typeset -T [ {+|-}Uglrux ] [ {+|-}LRZp [ n ] ]
typeset -f [ {+|-}TUkmtuz ] [ + ] [ name ... ]
Set or display attributes and values for shell parameters.
- Except as noted below for control flags that change the behav-
- ior, a parameter is created for each name that does not already
- refer to one. When inside a function, a new parameter is cre-
- ated for every name (even those that already exist), and is un-
- set again when the function completes. See `Local Parameters'
- in zshparam(1). The same rules apply to special shell parame-
+ Except as noted below for control flags that change the behav-
+ ior, a parameter is created for each name that does not already
+ refer to one. When inside a function, a new parameter is cre-
+ ated for every name (even those that already exist), and is un-
+ set again when the function completes. See `Local Parameters'
+ in zshparam(1). The same rules apply to special shell parame-
ters, which retain their special attributes when made local.
- For each name=value assignment, the parameter name is set to
- value.
+ For each name=value assignment, the parameter name is set to
+ value. If the assignment is omitted and name does not refer to
+ an existing parameter, a new parameter is intialized to empty
+ string, zero, or empty array (as appropriate), unless the shell
+ option TYPESET_TO_UNSET is set. When that option is set, the
+ parameter attributes are recorded but the parameter remains un-
+ set.
If the shell option TYPESET_SILENT is not set, for each remain-
ing name that refers to a parameter that is already set, the
@@ -88,7 +93,7 @@ typeset -f [ {+|-}TUkmtuz ] [ + ] [ name ... ]
to typeset after expansion. Hence it is not possible to assign
to multiple arrays by this means.
- Note that each interface to any of the commands my be disabled
+ Note that each interface to any of the commands may be disabled
separately. For example, `disable -r typeset' disables the re-
served word interface to typeset, exposing the builtin inter-
face, while `disable typeset' disables the builtin. Note that
@@ -395,16 +400,16 @@ declare
Same as typeset.
float [ {+|-}Hghlprtux ] [ {+|-}EFLRZ [ n ] ] [ name[=value] ... ]
- Equivalent to typeset -E, except that options irrelevant to
+ Equivalent to typeset -E, except that options irrelevant to
floating point numbers are not permitted.
integer [ {+|-}Hghlprtux ] [ {+|-}LRZi [ n ] ] [ name[=value] ... ]
- Equivalent to typeset -i, except that options irrelevant to in-
+ Equivalent to typeset -i, except that options irrelevant to in-
tegers are not permitted.
local [ {+|-}AHUahlprtux ] [ {+|-}EFLRZi [ n ] ] [ name[=value] ... ]
Same as typeset, except that the options -g, and -f are not per-
- mitted. In this case the -x option does not force the use of
+ mitted. In this case the -x option does not force the use of
-g, i.e. exported variables will be local to functions.
readonly
diff --git a/Doc/help/umask b/Doc/help/umask
index ed29a4361..a27f722c8 100644
--- a/Doc/help/umask
+++ b/Doc/help/umask
@@ -1,8 +1,8 @@
umask [ -S ] [ mask ]
The umask is set to mask. mask can be either an octal number or
- a symbolic value as described in chmod(1). If mask is omitted,
- the current value is printed. The -S option causes the mask to
- be printed as a symbolic value. Otherwise, the mask is printed
- as an octal number. Note that in the symbolic form the permis-
- sions you specify are those which are to be allowed (not denied)
- to the users specified.
+ a symbolic value as described in the chmod(1) man page. If mask
+ is omitted, the current value is printed. The -S option causes
+ the mask to be printed as a symbolic value. Otherwise, the mask
+ is printed as an octal number. Note that in the symbolic form
+ the permissions you specify are those which are to be allowed
+ (not denied) to the users specified.
diff --git a/Doc/version.yo b/Doc/version.yo
index 970c93892..ed5d73cbc 100644
--- a/Doc/version.yo
+++ b/Doc/version.yo
@@ -1,6 +1,6 @@
IFDEF(INCWSLEVEL)(INCWSLEVEL())(STARTDEF())
-def(version)(0)(5.8.1)
-def(date)(0)(February 12, 2022)
+def(version)(0)(5.8.1.2-test)
+def(date)(0)(April 9, 2022)
def(zshenv)(0)(/etc/zshenv)
def(zprofile)(0)(/etc/zprofile)
def(zshrc)(0)(/etc/zshrc)
diff --git a/Doc/zsh.1 b/Doc/zsh.1
index f133c3e90..f85583d23 100644
--- a/Doc/zsh.1
+++ b/Doc/zsh.1
@@ -1,4 +1,4 @@
-.TH "ZSH" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSH" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zsh \- the Z shell
.\" Yodl file: Zsh/intro.yo
@@ -48,19 +48,19 @@ login shell and as a shell script command processor\&. Of the standard shells,
zsh most closely resembles \fBksh\fP but includes many enhancements\&. It
does not provide compatibility with POSIX or other shells in its
default operating mode: see
-the section Compatibility below\&.
+the section `Compatibility\&' below\&.
.PP
Zsh has command line editing, builtin spelling correction, programmable
command completion, shell functions (with autoloading), a history
mechanism, and a host of other features\&.
.\" Yodl file: Zsh/metafaq.yo
.SH "AUTHOR"
-Zsh was originally written by Paul Falstad \fB<pf@zsh\&.org>\fP\&.
-Zsh is now maintained by the members of the zsh\-workers mailing
-list \fB<zsh\-workers@zsh\&.org>\fP\&. The development is currently
-coordinated by Peter Stephenson \fB<pws@zsh\&.org>\fP\&. The coordinator
-can be contacted at \fB<coordinator@zsh\&.org>\fP, but matters relating to
-the code should generally go to the mailing list\&.
+Zsh was originally written by Paul Falstad\&. Zsh is now maintained by
+the members of the zsh\-workers mailing list \fB<zsh\-workers@zsh\&.org>\fP\&.
+The development is currently coordinated by Peter Stephenson
+\fB<pws@zsh\&.org>\fP\&. The coordinator can be contacted at
+\fB<coordinator@zsh\&.org>\fP, but matters relating to the code should
+generally go to the mailing list\&.
.SH "AVAILABILITY"
Zsh is available from the following HTTP and anonymous FTP site\&.
.PP
@@ -68,15 +68,14 @@ Zsh is available from the following HTTP and anonymous FTP site\&.
\fBftp://ftp\&.zsh\&.org/pub/\fP
\fBhttps://www\&.zsh\&.org/pub/\fP
.fi
-)
.PP
The up\-to\-date source code is available via Git from Sourceforge\&. See
\fBhttps://sourceforge\&.net/projects/zsh/\fP for details\&. A summary of
instructions for the archive can be found at
-\fBhttp://zsh\&.sourceforge\&.net/\fP\&.
+\fBhttps://zsh\&.sourceforge\&.io/\fP\&.
.PP
.SH "MAILING LISTS"
-Zsh has 3 mailing lists:
+Zsh has several mailing lists:
.PP
.PD 0
.TP
@@ -90,6 +89,14 @@ User discussions\&.
.TP
\fB<zsh\-workers@zsh\&.org>\fP
Hacking, development, bug reports and patches\&.
+.TP
+\fB<zsh\-security@zsh\&.org>\fP
+Private mailing list (the general public cannot subscribe to it) for discussing
+bug reports with security implications, i\&.e\&., potential vulnerabilities\&.
+.RS
+.PP
+If you find a security problem in zsh itself, please mail this address\&.
+.RE
.PP
To subscribe or unsubscribe, send mail
to the associated administrative address for the mailing list\&.
@@ -116,30 +123,28 @@ All submissions to \fBzsh\-announce\fP are automatically forwarded to
forwarded to \fBzsh\-workers\fP\&.
.PP
If you have problems subscribing/unsubscribing to any of the mailing
-lists, send mail to \fB<listmaster@zsh\&.org>\fP\&. The mailing lists are
-maintained by Karsten Thygesen \fB<karthy@kom\&.auc\&.dk>\fP\&.
+lists, send mail to \fB<listmaster@zsh\&.org>\fP\&.
.PP
The mailing lists are archived; the archives can be accessed via the
administrative addresses listed above\&. There is also a hypertext
-archive, maintained by Geoff Wing \fB<gcw@zsh\&.org>\fP, available at
+archive available at
\fBhttps://www\&.zsh\&.org/mla/\fP\&.
.SH "THE ZSH FAQ"
Zsh has a list of Frequently Asked Questions (FAQ), maintained by
Peter Stephenson \fB<pws@zsh\&.org>\fP\&. It is regularly posted to the
newsgroup \fBcomp\&.unix\&.shell\fP and the \fBzsh\-announce\fP mailing list\&.
The latest version can be found at any of the Zsh FTP sites, or at
-\fBhttp://www\&.zsh\&.org/FAQ/\fP\&. The contact address for FAQ\-related matters
+\fBhttps://www\&.zsh\&.org/FAQ/\fP\&. The contact address for FAQ\-related matters
is \fB<faqmaster@zsh\&.org>\fP\&.
.SH "THE ZSH WEB PAGE"
-Zsh has a web page which is located at \fBhttps://www\&.zsh\&.org/\fP\&. This is
-maintained by Karsten Thygesen \fB<karthy@zsh\&.org>\fP, of SunSITE Denmark\&.
+Zsh has a web page which is located at \fBhttps://www\&.zsh\&.org/\fP\&.
The contact address for web\-related matters is \fB<webmaster@zsh\&.org>\fP\&.
.SH "THE ZSH USERGUIDE"
A userguide is currently in preparation\&. It is intended to complement the
manual, with explanations and hints on issues where the manual can be
cabbalistic, hierographic, or downright mystifying (for example, the word
`hierographic\&' does not exist)\&. It can be viewed in its current state at
-\fBhttp://zsh\&.sourceforge\&.net/Guide/\fP\&. At the time of writing, chapters
+\fBhttps://zsh\&.sourceforge\&.io/Guide/\fP\&. At the time of writing, chapters
dealing with startup files and their contents and the new completion system
were essentially complete\&.
.\" Yodl file: Zsh/invoke.yo
@@ -274,8 +279,7 @@ parameters are not special and not initialized by the shell:
\fBPROMPT3\fP,
\fBPROMPT4\fP,
\fBpsvar\fP,
-\fBstatus\fP,
-\fBwatch\fP\&.
+\fBstatus\fP\&.
.PP
The usual zsh startup/shutdown scripts are not executed\&. Login shells
source \fB/etc/profile\fP followed by \fB$HOME/\&.profile\fP\&. If the
@@ -317,6 +321,12 @@ Also, the
and
\fBSINGLE_LINE_ZLE\fP
options are set if zsh is invoked as \fBksh\fP\&.
+.PP
+Please note that, whilst reasonable efforts are taken to address
+incompatibilities when they arise, zsh does not guarantee complete
+emulation of other shells, nor POSIX compliance\&. For more information on
+the differences between zsh and other shells, please refer to chapter 2
+of the shell FAQ, \fBhttps://www\&.zsh\&.org/FAQ/\fP\&.
.\" Yodl file: Zsh/restricted.yo
.SH "RESTRICTED SHELL"
When the basename of the command used to invoke zsh starts with the letter
diff --git a/Doc/zsh.texi b/Doc/zsh.texi
index 5d96e06cb..4509b7c92 100644
--- a/Doc/zsh.texi
+++ b/Doc/zsh.texi
@@ -27,8 +27,8 @@
@end iftex
@titlepage
@title The Z Shell Manual
-@subtitle Version 5.8.1
-@subtitle Updated February 12, 2022
+@subtitle Version 5.8.1.2-test
+@subtitle Updated April 9, 2022
@author Original documentation by Paul Falstad
@page
This is a texinfo version of the documentation for the Z Shell, originally by
@@ -63,7 +63,7 @@ POSIX shells, but its default mode is not POSIX compatible, either.
@noindent
@cindex version
-Version 5.8.1, last updated February 12, 2022.
+Version 5.8.1.2-test, last updated April 9, 2022.
@end ifinfo
@menu
@@ -179,6 +179,8 @@ Zsh Line Editor
* Keymaps::
* Zle Builtins::
* Zle Widgets::
+* User-Defined Widgets::
+* Standard Widgets::
* Character Highlighting::
@noindent
@@ -246,6 +248,7 @@ Zsh Modules
* The zsh/net/tcp Module::
* The zsh/termcap Module::
* The zsh/terminfo Module::
+* The zsh/watch Module::
* The zsh/zftp Module::
* The zsh/zle Module::
* The zsh/zleparameter Module::
@@ -327,7 +330,7 @@ produce a nicely formatted printed manual.
An HTML version of this manual is available at the Zsh web site via:
@noindent
-@t{@uref{http://zsh.sourceforge.net/Doc/}}.
+@t{@uref{https://zsh.sourceforge.io/Doc/}}.
@noindent
(The HTML version is produced with @cite{texi2html}, which may be obtained
@@ -375,12 +378,12 @@ mechanism, and a host of other features.
@section Author
@noindent
@cindex author
-Zsh was originally written by Paul Falstad @t{<pf@@zsh.org>}.
-Zsh is now maintained by the members of the zsh-workers mailing
-list @t{<zsh-workers@@zsh.org>}. The development is currently
-coordinated by Peter Stephenson @t{<pws@@zsh.org>}. The coordinator
-can be contacted at @t{<coordinator@@zsh.org>}, but matters relating to
-the code should generally go to the mailing list.
+Zsh was originally written by Paul Falstad. Zsh is now maintained by
+the members of the zsh-workers mailing list @t{<zsh-workers@@zsh.org>}.
+The development is currently coordinated by Peter Stephenson
+@t{<pws@@zsh.org>}. The coordinator can be contacted at
+@t{<coordinator@@zsh.org>}, but matters relating to the code should
+generally go to the mailing list.
@node Availability, Mailing Lists, Author, Introduction
@section Availability
@@ -393,13 +396,12 @@ Zsh is available from the following HTTP and anonymous FTP site.
@cindex availability of zsh
@t{@uref{ftp://ftp.zsh.org/pub/}}@*
@t{@uref{https://www.zsh.org/pub/}}
-)
@noindent
The up-to-date source code is available via Git from Sourceforge. See
@t{@uref{https://sourceforge.net/projects/zsh/}} for details. A summary of
instructions for the archive can be found at
-@t{@uref{http://zsh.sourceforge.net/}}.
+@t{@uref{https://zsh.sourceforge.io/}}.
@noindent
@node Mailing Lists, The Zsh FAQ, Availability, Introduction
@@ -407,7 +409,7 @@ instructions for the archive can be found at
@section Mailing Lists
@noindent
@cindex mailing lists
-Zsh has 3 mailing lists:
+Zsh has several mailing lists:
@noindent
@table @asis
@@ -421,6 +423,13 @@ User discussions.
@item @t{<zsh-workers@@zsh.org>}
Hacking, development, bug reports and patches.
+@item @t{<zsh-security@@zsh.org>}
+Private mailing list (the general public cannot subscribe to it) for discussing
+bug reports with security implications, i.e., potential vulnerabilities.
+
+@noindent
+If you find a security problem in zsh itself, please mail this address.
+
@end table
@noindent
@@ -448,13 +457,12 @@ forwarded to @cite{zsh-workers}.
@noindent
If you have problems subscribing/unsubscribing to any of the mailing
-lists, send mail to @t{<listmaster@@zsh.org>}. The mailing lists are
-maintained by Karsten Thygesen @t{<karthy@@kom.auc.dk>}.
+lists, send mail to @t{<listmaster@@zsh.org>}.
@noindent
The mailing lists are archived; the archives can be accessed via the
administrative addresses listed above. There is also a hypertext
-archive, maintained by Geoff Wing @t{<gcw@@zsh.org>}, available at
+archive available at
@t{@uref{https://www.zsh.org/mla/}}.
@node The Zsh FAQ, The Zsh Web Page, Mailing Lists, Introduction
@@ -464,14 +472,13 @@ Zsh has a list of Frequently Asked Questions (FAQ), maintained by
Peter Stephenson @t{<pws@@zsh.org>}. It is regularly posted to the
newsgroup @cite{comp.unix.shell} and the @cite{zsh-announce} mailing list.
The latest version can be found at any of the Zsh FTP sites, or at
-@t{@uref{http://www.zsh.org/FAQ/}}. The contact address for FAQ-related matters
+@t{@uref{https://www.zsh.org/FAQ/}}. The contact address for FAQ-related matters
is @t{<faqmaster@@zsh.org>}.
@node The Zsh Web Page, The Zsh Userguide, The Zsh FAQ, Introduction
@section The Zsh Web Page
@noindent
-Zsh has a web page which is located at @t{@uref{https://www.zsh.org/}}. This is
-maintained by Karsten Thygesen @t{<karthy@@zsh.org>}, of SunSITE Denmark.
+Zsh has a web page which is located at @t{@uref{https://www.zsh.org/}}.
The contact address for web-related matters is @t{<webmaster@@zsh.org>}.
@node The Zsh Userguide, See Also, The Zsh Web Page, Introduction
@@ -481,7 +488,7 @@ A userguide is currently in preparation. It is intended to complement the
manual, with explanations and hints on issues where the manual can be
cabbalistic, hierographic, or downright mystifying (for example, the word
`hierographic' does not exist). It can be viewed in its current state at
-@t{@uref{http://zsh.sourceforge.net/Guide/}}. At the time of writing, chapters
+@t{@uref{https://zsh.sourceforge.io/Guide/}}. At the time of writing, chapters
dealing with startup files and their contents and the new completion system
were essentially complete.
@c (avoiding a yodl bug)
@@ -490,12 +497,12 @@ were essentially complete.
@section See Also
@noindent
-man page sh(1),
-man page csh(1),
-man page tcsh(1),
-man page rc(1),
-man page bash(1),
-man page ksh(1)
+sh(1),
+csh(1),
+tcsh(1),
+rc(1),
+bash(1),
+ksh(1)
@noindent
@cite{IEEE Standard for information Technology -
@@ -564,7 +571,7 @@ The shell now supports the UTF-8 character set (and also others if
supported by the operating system). This is (mostly) handled transparently
by the shell, but the degree of support in terminal emulators is variable.
There is some discussion of this in the shell FAQ,
-@t{@uref{http://www.zsh.org/FAQ/}}. Note in particular that for combining
+@t{@uref{https://www.zsh.org/FAQ/}}. Note in particular that for combining
characters to be handled the option @t{COMBINING_CHARS} needs to be set.
Because the shell is now more sensitive to the definition of the
character set, note that if you are upgrading from an older version of
@@ -911,8 +918,7 @@ parameters are not special and not initialized by the shell:
@t{PROMPT3},
@t{PROMPT4},
@t{psvar},
-@t{status},
-@t{watch}.
+@t{status}.
@noindent
@vindex ENV, use of
@@ -957,6 +963,13 @@ Also, the
and
@t{SINGLE_LINE_ZLE}
options are set if zsh is invoked as @t{ksh}.
+
+@noindent
+Please note that, whilst reasonable efforts are taken to address
+incompatibilities when they arise, zsh does not guarantee complete
+emulation of other shells, nor POSIX compliance. For more information on
+the differences between zsh and other shells, please refer to chapter 2
+of the shell FAQ, @t{@uref{https://www.zsh.org/FAQ/}}.
@c (avoiding a yodl bug)
@c Yodl file: Zsh/restricted.yo
@node Restricted Shell, , Compatibility, Invocation
@@ -1489,7 +1502,9 @@ for each selection until a break or end-of-file is encountered.
@cindex subshell
@item @t{(} @var{list} @t{)}
Execute @var{list} in a subshell. Traps set by the @t{trap} builtin
-are reset to their default values while executing @var{list}.
+are reset to their default values while executing @var{list}; an
+exception is that ignored signals will continue to be ignored
+if the option @t{POSIXTRAPS} is set.
@item @t{@{} @var{list} @t{@}}
Execute @var{list}.
@@ -1566,7 +1581,7 @@ execution of @var{always-list}, just like @t{break} and @t{continue}.
@findex function
-@item @t{function} @var{word} ... [ @t{()} ] [ @var{term} ] @t{@{} @var{list} @t{@}}
+@item @t{function} [ @t{-T} ] @var{word} ... [ @t{()} ] [ @var{term} ] @t{@{} @var{list} @t{@}}
@itemx @var{word} ... @t{()} [ @var{term} ] @t{@{} @var{list} @t{@}}
@itemx @var{word} ... @t{()} [ @var{term} ] @var{command}
where @var{term} is one or more newline or @t{;}.
@@ -1577,6 +1592,18 @@ The body of the function is the @var{list} between
the @t{@{} and @t{@}}. See @ref{Functions}.
@noindent
+The options of @t{function} have the following meanings:
+
+@noindent
+@table @asis
+@item -T
+Enable tracing for this function, as though with @t{functions -T}. See the
+documentation of the @t{-f} option to the @t{typeset} builtin, in
+@ref{Shell Builtin Commands}.
+
+@end table
+
+@noindent
If the option @t{SH_GLOB} is set for compatibility with other shells, then
whitespace may appear between the left and right parentheses when
there is a single @var{word}; otherwise, the parentheses will be treated as
@@ -1635,6 +1662,8 @@ else the end of the test will not be recognized. For the
@t{for}, @t{repeat}, @t{case} and @t{select} commands no such special form
for the arguments is necessary, but the other condition (the special form
of @var{sublist} or use of the @t{SHORT_LOOPS} option) still applies.
+The @t{SHORT_REPEAT} option is available to enable the short version only
+for the @t{repeat} command.
@noindent
@table @asis
@@ -1823,6 +1852,13 @@ position (if it could be the first word of a simple command),
or if the alias is global.
If the replacement text ends with a space, the next word in the shell input
is always eligible for purposes of alias expansion.
+
+@noindent
+It is an error for the function name, @var{word}, in the sh-compatible function
+definition syntax `@var{word} @t{()} ...' to be a word that resulted
+from alias expansion, unless the @t{ALIAS_FUNC_DEF} option is set.
+
+@noindent
@findex alias, use of
@cindex aliases, global
An alias is defined using the @t{alias} builtin; global aliases
@@ -1860,6 +1896,19 @@ nothing to prevent an alias being defined for the quoted form such as
@t{\foo} as well.
@noindent
+In particular, note that quoting must be used when using @t{unalias} to remove
+global aliases:
+
+@noindent
+@example
+% alias -g foo=bar
+% unalias foo
+unalias: no such hash table element: bar
+% unalias \foo
+%
+@end example
+
+@noindent
When @t{POSIX_ALIASES} is set, only plain unquoted strings are eligible
for aliasing. The @t{alias} builtin does not reject ineligible aliases,
but they are not expanded.
@@ -1923,35 +1972,6 @@ or `@t{.}'. Consequently, use of functions rather than aliases is
recommended in non-interactive code.
@noindent
-Note also the unhelpful interaction of aliases and function definitions:
-
-@noindent
-@example
-alias func='noglob func'
-func() @{
- echo Do something with $*
-@}
-@end example
-
-@noindent
-Because aliases are expanded in function definitions, this causes the
-following command to be executed:
-
-@noindent
-@example
-noglob func() @{
- echo Do something with $*
-@}
-@end example
-
-@noindent
-which defines @t{noglob} as well as @t{func} as functions with the
-body given. To avoid this, either quote the name @t{func} or use the
-alternative function definition form `@t{function func}'. Ensuring the
-alias is defined after the function works but is problematic if the
-code fragment might be re-executed.
-
-@noindent
@node Quoting, , Aliasing, Shell Grammar
@section Quoting
@@ -2083,12 +2103,13 @@ tabs are stripped from @var{word} and from the document.
Perform shell expansion on @var{word} and pass the result
to standard input. This is known as a @emph{here-string}.
Compare the use of @var{word} in here-documents above, where @var{word}
-does not undergo shell expansion.
+does not undergo shell expansion. The result will have a trailing newline
+after it.
@item @t{<&} @var{number}
@itemx @t{>&} @var{number}
The standard input/output is duplicated from file descriptor
-@var{number} (see man page dup2(2)).
+@var{number} (see dup2(2)).
@item @t{<& -}
@itemx @t{>& -}
@@ -2462,9 +2483,24 @@ a shell builtin by that name, the builtin is invoked.
@noindent
@vindex path, use of
Otherwise, the shell searches each element of @t{$path} for a
-directory containing an executable file by that name. If the
-search is unsuccessful, the shell prints an error message and returns
-a nonzero exit status.
+directory containing an executable file by that name.
+
+@noindent
+If execution fails: an error message is printed, and one of the
+following values is returned.
+
+@noindent
+@table @asis
+@item 127
+The search was unsuccessful. The error message is
+`@t{command not found:} @var{cmd}'.
+@item 126
+The executable file has insufficient permissions, is a
+directory or special file, or is not a script and is in a format
+unrecognized by the operating system. The exact conditions and error
+message are operating system-dependent; see
+execve(2).
+@end table
@noindent
If execution fails because the file is not in executable format,
@@ -2479,14 +2515,9 @@ not handle this executable format in the kernel.
If no external command is found but a function @t{command_not_found_handler}
exists the shell executes this function with all
command line arguments. The return status of the function becomes the
-status of the command. If the function wishes to mimic the
-behaviour of the shell when the command is not found, it should
-print the message `@t{command not found:} @var{cmd}' to standard error
-and return status 127. Note that the handler is executed in a
+status of the command. Note that the handler is executed in a
subshell forked to execute an external command, hence changes to
directories, shell parameters, etc. have no effect on the main shell.
-
-@noindent
@c (avoiding a yodl bug)
@c Yodl file: Zsh/func.yo
@node Functions, Jobs & Signals, Command Execution, Top
@@ -2757,13 +2788,14 @@ Certain functions, if defined, have special meaning to the shell.
For the functions below, it is possible to define an array that has the
same name as the function with `@t{_functions}' appended. Any element in
such an array is taken as the name of a function to execute; it is executed
-in the same context and with the same arguments as the basic function. For
+in the same context and with the same arguments and same initial value of @t{$?}
+as the basic function. For
example, if @t{$chpwd_functions} is an array containing the values
`@t{mychpwd}', `@t{chpwd_save_dirstack}', then the shell attempts to
execute the functions `@t{chpwd}', `@t{mychpwd}' and
`@t{chpwd_save_dirstack}', in that order. Any function that does not exist
is silently ignored. A function found by this mechanism is referred to
-elsewhere as a `hook function'. An error in any function causes subsequent
+elsewhere as a @emph{hook function}. An error in any function causes subsequent
functions not to be run. Note further that an error in a @t{precmd} hook
causes an immediately following @t{periodic} function not to run (though
it may run at the next opportunity).
@@ -2830,7 +2862,7 @@ value is taken.
@noindent
A hook function may call `@t{fc -p} @var{...}' to switch the history
-context so that the history is saved in a different file from the
+context so that the history is saved in a different file from
that in the global @t{HISTFILE} parameter. This is handled specially:
the history context is automatically restored after the processing
of the history line is finished.
@@ -3123,7 +3155,7 @@ a @t{SIGHUP} signal, if the @t{HUP} option is set.
@cindex disowning jobs
@findex disown, use of
To avoid having the shell terminate the running jobs, either
-use the @cite{nohup} command (see man page nohup(1))
+use the nohup(1) command
or the @t{disown} builtin.
@section Signals
@@ -3148,7 +3180,7 @@ exit without waiting. Examples of such asynchronous jobs are
process substitution, see
@ref{Process Substitution}, and the handler processes for
multios, see
-the section Multios in @ref{Redirection}.
+the section @emph{Multios} in @ref{Redirection}.
@c (avoiding a yodl bug)
@c Yodl file: Zsh/arith.yo
@node Arithmetic Evaluation, Conditional Expressions, Jobs & Signals, Top
@@ -3173,7 +3205,7 @@ The @t{let} builtin command takes arithmetic expressions as arguments; each
is evaluated separately. Since many of the arithmetic operators, as well
as spaces, require quoting, an alternative form is provided: for any
command which begins with a `@t{((}', all the characters until a
-matching `@t{))}' are treated as a quoted expression and
+matching `@t{))}' are treated as a double-quoted expression and
arithmetic expansion performed as for an argument of @t{let}. More
precisely, `@t{((}@var{...}@t{))}' is equivalent to
`@t{let "}@var{...}@t{"}'. The return status is 0 if the arithmetic value
@@ -3983,7 +4015,7 @@ The date in @var{mm}@t{/}@var{dd}@t{/}@var{yy} format.
@item @t{%D@{}@var{string}@t{@}}
@var{string} is formatted using the @t{strftime} function.
-See man page strftime(3) for more details. Various zsh
+See strftime(3) for more details. Various zsh
extensions provide numbers with no leading zero or space
if the number is a single digit:
@@ -4322,7 +4354,7 @@ you may see in your prompt (see
A history expansion begins with the first character of the @t{histchars}
parameter, which is `@t{!}' by default, and may occur anywhere on the
command line, including inside double quotes (but not inside single quotes
-@t{'...'} or C-style quotes @t{$'...'} nor when escaped with a backslash).
+@t{'...'} or C-style quotes @t{$'...'} nor when escaped with a backslash).
@noindent
The first character is followed by an optional event designator
@@ -4553,8 +4585,10 @@ expansion.
@item @t{P}
Turn a file name into an absolute path, like @t{realpath(3)}.
-The resulting path will be absolute, have neither `@t{.}' nor `@t{..}' components,
-and refer to the same directory entry as the input filename.
+The resulting path will be absolute,
+will refer to the same directory entry as the input filename,
+and none of its components will be symbolic links or equal to
+`@t{.}' or `@t{..}'.
@noindent
Unlike @t{realpath(3)}, non-existent trailing components are
@@ -4770,7 +4804,7 @@ If @t{=(}@var{...}@t{)} is used instead of
then the file passed as an argument will be the name
of a temporary file containing the output of the @var{list}
process. This may be used instead of the @t{<}
-form for a program that expects to lseek (see man page lseek(2))
+form for a program that expects to lseek (see lseek(2))
on the input file.
@noindent
@@ -4785,7 +4819,7 @@ contents.
@noindent
The @t{=} form is useful as both the @t{/dev/fd} and the named pipe
-implementation of @t{<(}@var{...}@t{)} have drawbacks. In
+implementation of @t{<(}@var{...}@t{)} have drawbacks. In
the former case, some programmes may automatically close the file
descriptor in question before examining the file on the command line,
particularly if this is necessary for security reasons such as when the
@@ -4795,7 +4829,7 @@ from or write to the pipe will (in a typical implementation, different
operating systems may have different behaviour) block for ever and have to
be killed explicitly. In both cases, the shell actually supplies the
information using a pipe, so that programmes that expect to lseek
-(see man page lseek(2)) on the file will not work.
+(see lseek(2)) on the file will not work.
@noindent
Also note that the previous example can be more compactly and
@@ -5229,6 +5263,7 @@ of the string @t{$-} and the array @t{$*} respectively. If
the @t{#} to be treated in this fashion.
@item @t{$@{^}@var{spec}@t{@}}
+@itemx @t{$@{^^}@var{spec}@t{@}}
@pindex RC_EXPAND_PARAM, toggle
@cindex array expansion style, rc
@cindex rc, array expansion style
@@ -5253,6 +5288,7 @@ happening later. If word splitting is also in effect the
elements.
@item @t{$@{=}@var{spec}@t{@}}
+@itemx @t{$@{==}@var{spec}@t{@}}
@pindex SH_WORD_SPLIT, toggle
@cindex field splitting, sh style, parameter
@cindex sh, field splitting style, parameter
@@ -5270,6 +5306,7 @@ of @var{spec} @emph{before} the assignment to @var{name} is performed.
This affects the result of array assignments with the @t{A} flag.
@item @t{$@{~}@var{spec}@t{@}}
+@itemx @t{$@{~~}@var{spec}@t{@}}
@pindex GLOB_SUBST, toggle
Turn on the @t{GLOB_SUBST} option for the evaluation of
@var{spec}; if the `@t{~}' is doubled, turn it off. When this option is
@@ -5329,9 +5366,10 @@ following flags are supported:
@noindent
@table @asis
@item @t{#}
-Evaluate the resulting words as numeric expressions and output the
-characters corresponding to the resulting integer. Note that this form is
-entirely distinct from use of the @t{#} without parentheses.
+Evaluate the resulting words as numeric expressions and interpret
+these as character codes. Output the corresponding characters. Note
+that this form is entirely distinct from use of the @t{#} without
+parentheses.
@noindent
If the @t{MULTIBYTE} option is set and the number is greater than 127
@@ -5339,7 +5377,7 @@ If the @t{MULTIBYTE} option is set and the number is greater than 127
@item @t{%}
Expand all @t{%} escapes in the resulting words in the same way as in
-prompts (see
+prompts (see
@ref{Prompt Expansion}). If this flag is given twice,
full prompt expansion is done on the resulting words, depending on the
setting of the @t{PROMPT_PERCENT}, @t{PROMPT_SUBST} and @t{PROMPT_BANG}
@@ -5468,22 +5506,31 @@ Convert all letters in the result to lower case.
@item @t{n}
Sort decimal integers numerically; if the first differing
characters of two test strings are not digits, sorting
-is lexical. Integers with more initial zeroes
-are sorted before those with fewer or none. Hence the array `@t{foo1 foo02
+is lexical. `@t{+}' and `@t{-}' are not treated specially; they are treated as
+any other non-digit. Integers with more initial zeroes
+are sorted before those with fewer or none. Hence the array `@t{foo+24 foo1 foo02
foo2 foo3 foo20 foo23}' is sorted into the order shown.
May be combined with `@t{i}' or `@t{O}'.
+@item @t{-}
+As @t{n}, but a leading minus sign indicates a negative decimal
+integer. A leading minus sign not followed by an integer does not trigger
+numeric sorting.
+Note that `@t{+}' signs are not handled specially (this may change in the
+future).
+
@item @t{o}
Sort the resulting words in ascending order; if this appears on its
own the sorting is lexical and case-sensitive (unless the locale
renders it case-insensitive). Sorting in ascending order is the
default for other forms of sorting, so this is ignored if combined
-with `@t{a}', `@t{i}' or `@t{n}'.
+with `@t{a}', `@t{i}', `@t{n}' or `@t{-}'.
@item @t{O}
Sort the resulting words in descending order; `@t{O}' without `@t{a}',
-`@t{i}' or `@t{n}' sorts in reverse lexical order. May be combined
-with `@t{a}', `@t{i}' or `@t{n}' to reverse the order of sorting.
+`@t{i}', `@t{n}' or `@t{-}' sorts in reverse lexical order. May be
+combined with `@t{a}', `@t{i}', `@t{n}' or `@t{-}' to reverse the
+order of sorting.
@item @t{P}
This forces the value of the parameter @var{name} to be interpreted as a
@@ -5573,6 +5620,11 @@ for readonly parameters
@item @t{tag}
for tagged parameters
+@item @t{tied}
+for parameters tied to another parameter in the manner of @t{PATH}
+(colon-separated list) and @t{path} (array), whether these are
+special parameters or user-defined with `@t{typeset -T}'
+
@item @t{export}
for exported parameters
@@ -5784,16 +5836,31 @@ i.e. @t{"$@{(@@s.:.)line@}"}.
@item @t{Z:}@var{opts}@t{:}
As @t{z} but takes a combination of option letters between a following
pair of delimiter characters. With no options the effect is identical
-to @t{z}. @t{(Z+c+)}
+to @t{z}. The following options are available:
+
+@noindent
+@table @asis
+@item @t{(Z+c+)}
causes comments to be parsed as a string and retained; any field in the
resulting array beginning with an unquoted comment character is a
-comment. @t{(Z+C+)} causes comments to be parsed
+comment.
+
+@item @t{(Z+C+)}
+causes comments to be parsed
and removed. The rule for comments is standard: anything between a word
starting with the third character of @t{$HISTCHARS}, default @t{#}, up to
-the next newline is a comment. @t{(Z+n+)} causes
+the next newline is a comment.
+
+@item @t{(Z+n+)}
+causes
unquoted newlines to be treated as ordinary whitespace, else they are
treated as if they are shell code delimiters and converted to
-semicolons. Options are combined within the same set of delimiters,
+semicolons.
+
+@end table
+
+@noindent
+Options are combined within the same set of delimiters,
e.g. @t{(Z+Cn+)}.
@item @t{_:}@var{flags}@t{:}
@@ -5806,7 +5873,7 @@ error, and the flag itself has no effect.
@noindent
The following flags are meaningful with the @t{$@{}...@t{#}...@t{@}} or
-@t{$@{}...@t{%}...@t{@}} forms. The @t{S} and @t{I} flags may also be
+@t{$@{}...@t{%}...@t{@}} forms. The @t{S}, @t{I}, and @t{*} flags may also be
used with the @t{$@{}...@t{/}...@t{@}} forms.
@noindent
@@ -5889,6 +5956,10 @@ will remove the same matches as for `@t{#}', but in reverse order, and the
form using `@t{%%}' will remove the same matches as for `@t{##}' in reverse
order.
+@item @t{*}
+Enable @t{EXTENDED_GLOB} for substitution via @t{$@{}...@t{/}...@t{@}} or
+@t{$@{}...@t{//}...@t{@}}.
+
@item @t{B}
Include the index of the beginning of the match in the result.
@@ -5911,8 +5982,9 @@ Include the unmatched portion in the result (the @emph{R}est).
@subsection Rules
@noindent
-
-@noindent
+@cindex parameter expansion rules
+@cindex rules, parameter expansion
+@cindex substitution, parameter, rules
Here is a summary of the rules for substitution; this assumes that braces
are present around the substitution, i.e. @t{$@{}@var{...}@t{@}}. Some particular
examples are given below. Note that the Zsh Development Group accepts
@@ -6121,6 +6193,7 @@ expression) and replaced with the corresponding value, with internal flags
@subsection Examples
@noindent
+@cindex parameter expansion, examples
The flag @t{f} is useful to split a double-quoted substitution line by
line. For example, @t{$@{(f)"$(<}@var{file}@t{)"@}}
substitutes the contents of @var{file} divided so that each line is
@@ -6140,7 +6213,7 @@ This produces the result @t{b}. First, the inner substitution
@t{"$@{foo@}"}, which has no array (@t{@@}) flag, produces a single word
result @t{"bar baz"}. The outer substitution @t{"$@{(@@)...[1]@}"} detects
that this is a scalar, so that (despite the `@t{(@@)}' flag) the subscript
-picks the first character.
+picks the first character.
@item @t{"$@{$@{(@@)foo@}[1]@}"}
This produces the result `@t{bar}'. In this case, the inner substitution
@@ -6179,7 +6252,7 @@ empty string will then be elided, as it is not in double quotes.
@cindex command substitution
@cindex substitution, command
A command enclosed in parentheses preceded by a dollar sign, like
-`@t{$(}...@t{)}', or quoted with grave
+`@t{$(}...@t{)}', or quoted with grave
accents, like `@t{`}...@t{`}', is replaced with its standard output, with
any trailing newlines deleted.
If the substitution is not enclosed in double quotes, the
@@ -6323,14 +6396,21 @@ option exchanges the effects of `@t{~+}' and `@t{~-}' where they are
followed by a number.
@noindent
+@menu
+* Dynamic named directories::
+* Static named directories::
+* `=' expansion::
+* Notes::
+@end menu
+
+@noindent
+@node Dynamic named directories, Static named directories, , Filename Expansion
@subsection Dynamic named directories
@noindent
@cindex directories, named, dynamic
@cindex named directories, dynamic
@cindex dynamic named directories
-
-@noindent
If the function @t{zsh_directory_name} exists, or the shell variable
@t{zsh_directory_name_functions} exists and contains an array of
function names, then the functions are used to implement dynamic
@@ -6432,6 +6512,7 @@ zsh_directory_name() @{
@end example
@noindent
+@node Static named directories, `=' expansion, Dynamic named directories, Filename Expansion
@subsection Static named directories
@noindent
@@ -6463,6 +6544,7 @@ if they are the same length.
The parameters @t{$PWD} and @t{$OLDPWD} are never abbreviated in this fashion.
@noindent
+@node `=' expansion, Notes, Static named directories, Filename Expansion
@subsection `=' expansion
@noindent
@@ -6476,11 +6558,11 @@ exists by that name, the word is replaced
by the full pathname of the command.
@noindent
+@node Notes, , `=' expansion, Filename Expansion
@subsection Notes
@noindent
-
-@noindent
+@cindex filename expansion, notes
Filename expansion is performed on the right hand side of a parameter
assignment, including those appearing after commands of the
@t{typeset} family. In this case, the right hand side will be treated
@@ -6533,6 +6615,7 @@ matching, the `@t{/}' and `@t{.}' are not treated specially.
@subsection Glob Operators
@noindent
+@cindex glob operators
@table @asis
@item @t{*}
Matches any string, including the null string.
@@ -6551,7 +6634,7 @@ There are also several named classes of characters, in the form
The first set use the macros provided by
the operating system to test for the given character combinations,
including any modifications due to local language settings, see
-man page ctype(3):
+ctype(3):
@noindent
@table @asis
@@ -6605,7 +6688,8 @@ is not sensitive to the locale:
@table @asis
@item @t{[:IDENT:]}
The character is allowed to form part of a shell identifier, such
-as a parameter name
+as a parameter name; this test respects the @t{POSIX_IDENTIFIERS}
+option
@item @t{[:IFS:]}
The character is used as an input field separator, i.e. is contained in the
@@ -6773,6 +6857,8 @@ pattern.
@subsection Globbing Flags
@noindent
+@cindex globbing flags
+@cindex glob flags
There are various flags which affect any text to their right up to the
end of the enclosing group or to the end of the pattern; they require
the @t{EXTENDED_GLOB} option. All take the form
@@ -6955,7 +7041,7 @@ qualifiers are also not applied in ordinary pattern matching.
@item @t{u}
Respect the current locale in determining the presence of multibyte
-characters in a pattern, provided the shell was compiled with
+characters in a pattern, provided the shell was compiled with
@t{MULTIBYTE_SUPPORT}. This overrides the @t{MULTIBYTE}
option; the default behaviour is taken from the option. Compare @t{U}.
(Mnemonic: typically multibyte characters are from Unicode in the UTF-8
@@ -6990,6 +7076,8 @@ searched for all files which match, so that a pattern of the form
@subsection Approximate Matching
@noindent
+@cindex approximate matching
+@cindex matching, approximate
When matching approximately, the shell keeps a count of the errors found,
which cannot exceed the number specified in the
@t{(#a}@var{num}@t{)} flags. Four types of error are recognised:
@@ -7064,6 +7152,8 @@ segments which are known to be correct.
@subsection Recursive Globbing
@noindent
+@cindex recursive globbing
+@cindex globbing, recursive
A pathname component of the form `@t{(}@var{foo}@t{/)#}'
matches a path consisting of zero or more directories
matching the pattern @var{foo}.
@@ -7239,19 +7329,19 @@ expected, if combined with a `@t{=}', the value given must match the
file-modes exactly, with a `@t{+}', at least the bits in the
given number must be set in the file-modes, and with a `@t{-}', the
bits in the number must not be set. Giving a `@t{?}' instead of a
-octal digit anywhere in the number ensures that the corresponding bits
+octal digit anywhere in the number ensures that the corresponding bits
in the file-modes are not checked, this is only useful in combination
with `@t{=}'.
@noindent
If the qualifier `@t{f}' is followed by any other character anything
-up to the next matching character (`@t{[}', `@t{@{}', and `@t{<}' match
+up to the next matching character (`@t{[}', `@t{@{}', and `@t{<}' match
`@t{]}', `@t{@}}', and `@t{>}' respectively, any other character
matches itself) is taken as a list of comma-separated
@var{sub-spec}s. Each @var{sub-spec} may be either an octal number as
described above or a list of any of the characters `@t{u}', `@t{g}',
`@t{o}', and `@t{a}', followed by a `@t{=}', a `@t{+}', or a
-`@t{-}', followed by a list of any of the characters `@t{r}', `@t{w}',
+`@t{-}', followed by a list of any of the characters `@t{r}', `@t{w}',
`@t{x}', `@t{s}', and `@t{t}', or an octal digit. The first list of
characters specify which access rights are to be checked. If a `@t{u}'
is given, those for the owner of the file are used, if a `@t{g}' is
@@ -7260,7 +7350,7 @@ of other users, and the `@t{a}' says to test all three groups. The
`@t{=}', `@t{+}', and `@t{-}' again says how the modes are to be
checked and have the same meaning as described for the first form
above. The second list of characters finally says which access rights
-are to be expected: `@t{r}' for read access, `@t{w}' for write access,
+are to be expected: `@t{r}' for read access, `@t{w}' for write access,
`@t{x}' for the right to execute the file (or to search a directory),
`@t{s}' for the setuid and setgid bits, and `@t{t}' for the sticky
bit.
@@ -7270,7 +7360,7 @@ Thus, `@t{*(f70?)}' gives the files for which the owner has read,
write, and execute permission, and for which other group members have
no rights, independent of the permissions for other users. The pattern
`@t{*(f-100)}' gives all files for which the owner does not have
-execute permission, and `@t{*(f:gu+w,o-rx:)}' gives the files for which
+execute permission, and `@t{*(f:gu+w,o-rx:)}' gives the files for which
the owner and the other members of the group have at least write
permission, and for which other users don't have read or execute
permission.
@@ -7401,7 +7491,9 @@ negates all qualifiers following it
@item @t{-}
toggles between making the qualifiers work on symbolic links (the
-default) and the files they point to
+default) and the files they point to, if any; any symbolic link for
+whose target the `@t{stat}' system call fails (whatever the cause of the
+failure) is treated as a file in its own right
@item @t{M}
sets the @t{MARK_DIRS} option for the current pattern
@@ -7432,18 +7524,37 @@ matches in directory traversal order will be considered.
Implies @t{oN} when no @t{o}@var{c} qualifier is used.
@item @t{o}@var{c}
-specifies how the names of the files should be sorted. If @var{c} is
-@t{n} they are sorted by name; if it is @t{L} they
-are sorted depending on the size (length) of the files; if @t{l}
-they are sorted by the number of links; if @t{a}, @t{m}, or @t{c}
-they are sorted by the time of the last access, modification, or
-inode change respectively; if @t{d}, files in subdirectories appear before
+specifies how the names of the files should be sorted. The following values
+of @var{c} sort in the following ways:
+
+@noindent
+@table @asis
+@item @t{n}
+By name.
+@item @t{L}
+By the size (length) of the files.
+@item @t{l}
+By number of links.
+@item @t{a}
+By time of last access, youngest first.
+@item @t{m}
+By time of last modification, youngest first.
+@item @t{c}
+By time of last inode change, youngest first.
+@item @t{d}
+By directories: files in subdirectories appear before
those in the current directory at each level of the search --- this is best
combined with other criteria, for example `@t{odon}' to sort on names for
-files within the same directory; if @t{N}, no sorting is performed.
-Note that @t{a}, @t{m}, and @t{c} compare
-the age against the current time, hence the first name in the list is the
-youngest file. Also note that the modifiers @t{^} and @t{-} are used,
+files within the same directory.
+@item @t{N}
+No sorting is performed.
+@item @t{e}@var{string}
+@itemx @t{+}@var{cmd}
+Sort by shell code (see below).
+@end table
+
+@noindent
+Note that the modifiers @t{^} and @t{-} are used,
so `@t{*(^-oL)}' gives a list of all files sorted by file size in descending
order, following any symbolic links. Unless @t{oN} is used, multiple order
specifiers may occur to resolve ties.
@@ -7465,8 +7576,8 @@ repeated, but note that the maximum number of sort operators of any kind
that may appear in any glob expression is 12.
@item @t{O}@var{c}
-like `@t{o}', but sorts in descending order; i.e. `@t{*(^oc)}' is the
-same as `@t{*(Oc)}' and `@t{*(^Oc)}' is the same as `@t{*(oc)}'; `@t{Od}'
+like `@t{o}', but sorts in descending order; i.e. `@t{*(^o}@var{c}@t{)}' is the
+same as `@t{*(O}@var{c}@t{)}' and `@t{*(^O}@var{c}@t{)}' is the same as `@t{*(o}@var{c}@t{)}'; `@t{Od}'
puts files in the current directory before those in subdirectories at each
level of the search.
@@ -7474,7 +7585,7 @@ level of the search.
specifies which of the matched filenames should be included in the
returned list. The syntax is the same as for array
subscripts. @var{beg} and the optional @var{end} may be mathematical
-expressions. As in parameter subscripting they may be negative to make
+expressions. As in parameter subscripting they may be negative to make
them count from the last match backward. E.g.: `@t{*(-OL[1,3])}'
gives a list of the names of the three largest files.
@@ -7718,7 +7829,7 @@ may be in any order. Note that this syntax is strict: @t{[} and @t{]=} must
not be quoted, and @var{key} may not consist of the unquoted string
@t{]=}, but is otherwise treated as a simple string. The enhanced forms
of subscript expression that may be used when directly subscripting a
-variable name, described in the section Array Subscripts below, are not
+variable name, described in the section `Array Subscripts' below, are not
available.
@noindent
@@ -8088,12 +8199,23 @@ result. On failure substitutes the length of the array plus one, as
discussed under the description of `@t{r}', or the empty string for an
associative array.
+@noindent
+Note: Although `@t{i}' may be applied to a scalar substitution to find
+the offset of a substring, the results are likely to be misleading when
+searching within substitutions that yield an empty string, or when
+searching for the empty substring.
+
@item @t{I}
Like `@t{i}', but gives the index of the last match, or all possible
matching keys in an associative array. On failure substitutes 0, or
the empty string for an associative array. This flag is best when
testing for values or keys that do not exist.
+@noindent
+Note: If the option @t{KSH_ARRAYS} is in effect and no match is found, the
+result is indistinguishable from the case when the first element of the array
+matches.
+
@item @t{k}
If used in a subscript on an associative array, this flag causes the keys
to be interpreted as patterns, and returns the value for the first key
@@ -8351,6 +8473,15 @@ parameter is special. `<Z>' indicates that the parameter does not exist
when the shell initializes in @t{sh} or @t{ksh} emulation mode.
@noindent
+The parameters `@t{!}', `@t{#}', `@t{*}', `@t{-}', `@t{?}', `@t{@@}',
+`@t{$}', `@t{ARGC}', `@t{HISTCMD}', `@t{LINENO}', `@t{PPID}',
+`@t{status}', `@t{TTYIDLE}', `@t{zsh_eval_context}',
+`@t{ZSH_EVAL_CONTEXT}', and `@t{ZSH_SUBSHELL}' are read-only and thus
+cannot be restored by the user, so they are not output by
+`@t{typeset -p}'. This also applies to many read-only parameters loaded
+from modules.
+
+@noindent
The following parameters are automatically set by the shell:
@noindent
@@ -8374,10 +8505,11 @@ Same as @t{#}.
@vindex $
@item @t{$} <S>
-The process ID of this shell. Note that this indicates the original
-shell started by invoking @t{zsh}; all processes forked from the shells
-without executing a new program, such as subshells started by
-@t{(}@var{...}@t{)}, substitute the same value.
+The process ID of this shell, set when the shell initializes. Processes
+forked from the shell without executing a new program, such as command
+substitutions and commands grouped with @t{(}@var{...}@t{)},
+are subshells that duplicate the current shell, and thus substitute the
+same value for @t{$$} as their parent shell.
@vindex -
@item @t{-} <S>
@@ -8458,7 +8590,7 @@ explicitly set locally.
@vindex ERRNO
@item @t{ERRNO} <S>
-The value of errno (see man page errno(3))
+The value of @t{errno} (see errno(3))
as set by the most recently failed system call.
This value is system dependent and is intended for debugging
purposes. It is also useful with the @t{zsh/system} module which
@@ -8511,7 +8643,7 @@ If the corresponding variable is not set in the environment of the
shell, it is initialized to the login name corresponding to the
current login session. This parameter is exported by default but
this can be disabled using the @t{typeset} builtin. The value
-is set to the string returned by the man page getlogin(3) system call
+is set to the string returned by the getlogin(3) system call
if that is available.
@vindex MACHTYPE
@@ -8540,9 +8672,9 @@ The operating system, as determined at compile time.
@vindex PPID
@item @t{PPID} <S>
-The process ID of the parent of the shell. As for @t{$$}, the
-value indicates the parent of the original shell and does not
-change in subshells.
+The process ID of the parent of the shell, set when the shell initializes.
+As with @t{$$}, the value does not change in subshells created as a
+duplicate of the current shell.
@vindex PWD
@item @t{PWD}
@@ -8570,8 +8702,9 @@ since the assignment.
@noindent
Unlike other special parameters, the type of the @t{SECONDS} parameter can
-be changed using the @t{typeset} command. Only integer and one of the
-floating point types are allowed. For example, `@t{typeset -F SECONDS}'
+be changed using the @t{typeset} command. The type may be changed only
+to one of the floating point types or back to integer. For example,
+`@t{typeset -F SECONDS}'
causes the value to be reported as a floating point number. The
value is available to microsecond accuracy, although the shell may
show more or fewer digits depending on the use of @t{typeset}. See
@@ -9062,11 +9195,6 @@ most as many lines as given by the absolute value.
If set to zero, the shell asks only if the top of the listing would scroll
off the screen.
-@vindex LOGCHECK
-@item @t{LOGCHECK}
-The interval in seconds between checks for login/logout activity
-using the @t{watch} parameter.
-
@vindex MAIL
@item @t{MAIL}
If this parameter is set and @t{mailpath} is not set,
@@ -9310,6 +9438,12 @@ the input line. This avoids running stty at every external command by
accidentally exporting it. Also note that @t{STTY} should not be used for
window size specifications; these will not be local to the command.
+@noindent
+If the parameter is set and empty, all of the above applies except
+that @t{stty} is not run. This can be useful as a way to freeze the tty
+around a single command, blocking its changes to tty settings,
+similar to the @t{ttyctl} builtin.
+
@vindex TERM
@item @t{TERM} <S>
The type of terminal in use. This is used when looking up termcap
@@ -9322,16 +9456,16 @@ take effect.
@vindex TERMINFO
@item @t{TERMINFO} <S>
A reference to your terminfo database, used by the `terminfo' library when the
-system has it; see man page terminfo(5).
+system has it; see terminfo(5).
If set, this causes the shell to reinitialise the terminal, making the
workaround `@t{TERM=$TERM}' unnecessary.
@vindex TERMINFO_DIRS
@item @t{TERMINFO_DIRS} <S>
A colon-seprarated list of terminfo databases, used by the `terminfo' library
-when the system has it; see man page terminfo(5). This variable is only
+when the system has it; see terminfo(5). This variable is only
used by certain terminal libraries, in particular ncurses; see
-man page terminfo(5) to check support on your system. If set, this
+terminfo(5) to check support on your system. If set, this
causes the shell to reinitialise the terminal, making the workaround
`@t{TERM=$TERM}' unnecessary. Note that unlike other colon-separated
arrays this is not tied to a zsh array.
@@ -9426,129 +9560,6 @@ to be interpreted as a file extension. The default is not to append
any suffix, thus this parameter should be assigned only when needed
and then unset again.
-@vindex watch
-@vindex WATCH
-@item @t{watch} <S> <Z> (@t{WATCH} <S>)
-An array (colon-separated list) of login/logout events to report.
-
-@noindent
-If it contains the single word `@t{all}', then all login/logout events
-are reported. If it contains the single word `@t{notme}', then all
-events are reported as with `@t{all}' except @t{$USERNAME}.
-
-@noindent
-An entry in this list may consist of a username,
-an `@t{@@}' followed by a remote hostname,
-and a `@t{%}' followed by a line (tty). Any of these may
-be a pattern (be sure to quote this during the assignment to
-@t{watch} so that it does not immediately perform file generation);
-the setting of the @t{EXTENDED_GLOB} option is respected.
-Any or all of these components may be present in an entry;
-if a login/logout event matches all of them,
-it is reported.
-
-@noindent
-For example, with the @t{EXTENDED_GLOB} option set, the following:
-
-@noindent
-@example
-watch=('^(pws|barts)')
-@end example
-
-@noindent
-causes reports for activity associated with any user other than @t{pws}
-or @t{barts}.
-
-@vindex WATCHFMT
-@item @t{WATCHFMT}
-The format of login/logout reports if the @t{watch} parameter is set.
-Default is `@t{%n has %a %l from %m}'.
-Recognizes the following escape sequences:
-
-@noindent
-@table @asis
-@item @t{%n}
-The name of the user that logged in/out.
-
-@item @t{%a}
-The observed action, i.e. "logged on" or "logged off".
-
-@item @t{%l}
-The line (tty) the user is logged in on.
-
-@item @t{%M}
-The full hostname of the remote host.
-
-@item @t{%m}
-The hostname up to the first `@t{.}'. If only the
-IP address is available or the utmp field contains
-the name of an X-windows display, the whole name is printed.
-
-@noindent
-@emph{NOTE:}
-The `@t{%m}' and `@t{%M}' escapes will work only if there is a host name
-field in the utmp on your machine. Otherwise they are
-treated as ordinary strings.
-
-@item @t{%S} (@t{%s})
-Start (stop) standout mode.
-
-@item @t{%U} (@t{%u})
-Start (stop) underline mode.
-
-@item @t{%B} (@t{%b})
-Start (stop) boldface mode.
-
-@item @t{%t}
-@itemx @t{%@@}
-The time, in 12-hour, am/pm format.
-
-@item @t{%T}
-The time, in 24-hour format.
-
-@item @t{%w}
-The date in `@var{day}@t{-}@var{dd}' format.
-
-@item @t{%W}
-The date in `@var{mm}@t{/}@var{dd}@t{/}@var{yy}' format.
-
-@item @t{%D}
-The date in `@var{yy}@t{-}@var{mm}@t{-}@var{dd}' format.
-
-@item @t{%D@{}@var{string}@t{@}}
-The date formatted as @var{string} using the @t{strftime} function, with
-zsh extensions as described by
-@ref{Prompt Expansion}.
-
-@item @t{%(}@var{x}@t{:}@var{true-text}@t{:}@var{false-text}@t{)}
-Specifies a ternary expression.
-The character following the @var{x} is
-arbitrary; the same character is used to separate the text
-for the "true" result from that for the "false" result.
-Both the separator and the right parenthesis may be escaped
-with a backslash.
-Ternary expressions may be nested.
-
-@noindent
-The test character @var{x} may be any one of `@t{l}', `@t{n}', `@t{m}'
-or `@t{M}', which indicate a `true' result if the corresponding
-escape sequence would return a non-empty value; or it may be `@t{a}',
-which indicates a `true' result if the watched user has logged in,
-or `false' if he has logged out.
-Other characters evaluate to neither true nor false; the entire
-expression is omitted in this case.
-
-@noindent
-If the result is `true', then the @var{true-text}
-is formatted according to the rules above and printed,
-and the @var{false-text} is skipped.
-If `false', the @var{true-text} is skipped and the @var{false-text}
-is formatted and printed.
-Either or both of the branches may be empty, but
-both separators must be present in any case.
-
-@end table
-
@vindex WORDCHARS
@item @t{WORDCHARS} <S>
A list of non-alphanumeric characters considered part of a word
@@ -9723,6 +9734,10 @@ This is because many systems which implement the `@t{#!}' mechanism for
calling scripts do not strip trailing whitespace.
@noindent
+It is possible for options to be set within a function scope. See the
+description of the option @t{LOCAL_OPTIONS} below.
+
+@noindent
@node Description of Options, Option Aliases, Specifying Options, Options
@section Description of Options
@@ -10169,6 +10184,23 @@ can match the directory @t{CVS} owing to the presence of the globbing flag
Make regular expressions using the @t{zsh/regex} module (including
matches with @t{=~}) sensitive to case.
+@pindex CASE_PATHS
+@pindex NO_CASE_PATHS
+@pindex CASEPATHS
+@pindex NOCASEPATHS
+@cindex case-sensitive globbing, option
+@item @t{CASE_PATHS}
+If @t{CASE_PATHS} is not set (the default), @t{CASE_GLOB} affects the
+interpretation of @emph{every} path component, whenever a special
+character appears in @emph{any} component. When @t{CASE_PATHS} is set,
+file path components that do @emph{not} contain special filename
+generation characters are always sensitive to case, thus restricting
+@t{NO_CASE_GLOB} to components that contain globbing characters.
+
+@noindent
+Note that if the filesystem itself is not sensitive to case, then
+@t{CASE_PATHS} has no effect.
+
@pindex CSH_NULL_GLOB
@pindex NO_CSH_NULL_GLOB
@pindex CSHNULLGLOB
@@ -10848,7 +10880,7 @@ most portable way to achieve this behaviour.
@pindex NOGLOBALRCS
@cindex startup files, global, inhibiting
@cindex files, global startup, inhibiting
-@item @t{GLOBAL_RCS} (@t{-d}) <D>
+@item @t{GLOBAL_RCS} (@t{+d}) <D>
If this option is unset, the startup files @t{/etc/zprofile},
@t{/etc/zshrc}, @t{/etc/zlogin} and @t{/etc/zlogout} will not be run. It
can be disabled and re-enabled at any time, including inside local startup
@@ -10896,6 +10928,23 @@ If the option is not set, and the option @t{APPEND_CREATE} is also
not set, `@t{>>!}' or `@t{>>|}' must be used to create a file.
If either option is set, `@t{>>}' may be used.
+@pindex CLOBBER_EMPTY
+@pindex NO_CLOBBER_EMPTY
+@pindex CLOBBEREMPTY
+@pindex NOCLOBBEREMPTY
+@cindex clobbering, of empty files
+@cindex file clobbering, of empty files
+@item @t{CLOBBER_EMPTY}
+This option is only used if the option @t{CLOBBER} is not set: note that
+it is set by default.
+
+@noindent
+If this option is set, then regular files of zero length may be
+ovewritten (`clobbered'). Note that it is possible another process
+has written to the file between this test and use of the file by
+the current process. This option should therefore not be used in
+cases where files to be clobbered may be written to asynchronously.
+
@pindex CORRECT
@pindex NO_CORRECT
@pindex NOCORRECT
@@ -11055,7 +11104,7 @@ command path. See
@item @t{PRINT_EIGHT_BIT}
Print eight bit characters literally in completion lists, etc.
This option is not necessary if your system correctly returns the
-printability of eight bit characters (see man page ctype(3)).
+printability of eight bit characters (see ctype(3)).
@pindex PRINT_EXIT_VALUE
@pindex NO_PRINT_EXIT_VALUE
@@ -11108,6 +11157,14 @@ avoided by expanding the `@t{*}' in ZLE (with tab).
Allow the short forms of @t{for}, @t{repeat}, @t{select},
@t{if}, and @t{function} constructs.
+@pindex SHORT_REPEAT
+@pindex NO_SHORT_REPEAT
+@pindex SHORTREPEAT
+@pindex NOSHORTREPEAT
+@item @t{SHORT_REPEAT}
+Allow the short form @t{repeat} as @t{SHORT_LOOPS} but without enabling
+it for the other constructs.
+
@pindex SUN_KEYBOARD_HACK
@pindex NO_SUN_KEYBOARD_HACK
@pindex SUNKEYBOARDHACK
@@ -11178,7 +11235,7 @@ The check is omitted if the commands run from the previous command line
included a `@t{jobs}' command, since it is assumed the user is aware that
there are background or suspended jobs. A `@t{jobs}' command run from one
of the hook functions defined in
-the section Special Functions in @ref{Functions}
+the section `Special Functions' in @ref{Functions}
is not counted for this purpose.
@pindex CHECK_RUNNING_JOBS
@@ -11669,6 +11726,16 @@ If the option is set, they will only be shown when parameters are selected
with the `@t{-m}' option. The option `@t{-p}' is available whether or not
the option is set.
+@pindex TYPESET_TO_UNSET
+@pindex NO_TYPESET_TO_UNSET
+@pindex TYPESETTOUNSET
+@pindex NOTYPESETTOUNSET
+@item @t{TYPESET_TO_UNSET} <K> <S>
+When declaring a new parameter with any of the `@t{typeset}' family of
+related commands, the parameter remains unset unless and until a
+value is explicity assigned to it, either in the `@t{typeset}' command
+itself or as a later assignment statement.
+
@pindex VERBOSE
@pindex NO_VERBOSE
@pindex NOVERBOSE
@@ -11734,7 +11801,7 @@ substrings.
@pindex NOBSDECHO
@cindex echo, BSD compatible
@item @t{BSD_ECHO} <S>
-Make the @t{echo} builtin compatible with the BSD man page echo(1) command.
+Make the @t{echo} builtin compatible with the BSD echo(1) command.
This disables backslashed escape sequences in echo strings unless the
@t{-e} option is specified.
@@ -11986,7 +12053,8 @@ command found in the path.
@noindent
Furthermore, the @t{getopts} builtin behaves in a POSIX-compatible
fashion in that the associated variable @t{OPTIND} is not made
-local to functions.
+local to functions, and its value is calculated differently to match
+other shells.
@noindent
Moreover, the warning and special exit code from
@@ -12074,10 +12142,17 @@ When this option is set, the usual zsh behaviour of executing
traps for @t{EXIT} on exit from shell functions is suppressed.
In that case, manipulating @t{EXIT} traps always alters the global
trap for exiting the shell; the @t{LOCAL_TRAPS} option is
-ignored for the @t{EXIT} trap. Furthermore, a @t{return} statement
-executed in a trap with no argument passes back from the function the
-value from the surrounding context, not from code executed within the
-trap.
+ignored for the @t{EXIT} trap.
+
+@noindent
+Also, a @t{return} statement executed in a trap with no argument passes
+back from the function the value from the surrounding context, not from
+code executed within the trap.
+
+@noindent
+Furthermore, if a trap is set to be ignored, this state persists when
+a subshell is entered. Without the option, the trap would be reset to
+its default state at this point.
@pindex SH_FILE_EXPANSION
@pindex NO_SH_FILE_EXPANSION
@@ -12721,7 +12796,16 @@ For each @var{name} with a corresponding @var{value}, define an alias
with that value. A trailing space in @var{value} causes the next word
to be checked for alias expansion. If the @t{-g} flag is present,
define a global alias; global aliases are expanded even if they do not
-occur in command position.
+occur in command position:
+
+@noindent
+@example
+% perldoc --help 2>&1 | grep 'built-in functions'
+ -f Search Perl built-in functions
+% alias -g HG='--help 2>&1 | grep'
+% perldoc HG 'built-in functions'
+ -f Search Perl built-in functions
+@end example
@noindent
If the @t{-s} flag is present, define a suffix alias: if the command
@@ -13450,7 +13534,7 @@ Do nothing and return an exit status of 1.
@cindex history, editing
@cindex editing history
-@item @t{fc} [ @t{-e} @var{ename} ] [ @t{-LI} ] [ @t{-m} @var{match} ] [ @var{old}@t{=}@var{new} ... ] [ @var{first} [ @var{last} ] ]
+@item @t{fc} [ @t{-e} @var{ename} ] [ @t{-s} ] [ @t{-LI} ] [ @t{-m} @var{match} ] [ @var{old}@t{=}@var{new} ... ] [ @var{first} [ @var{last} ] ]
@itemx @t{fc -l }[ @t{-LI} ] [ @t{-nrdfEiD} ] [ @t{-t} @var{timefmt} ] [ @t{-m} @var{match} ]
@itemx @t{@ @ @ @ @ @ }[ @var{old}@t{=}@var{new} ... ] [ @var{first} [ @var{last} ] ]
@itemx @t{fc -p }[ @t{-a} ] [ @var{filename} [ @var{histsize} [ @var{savehistsize} ] ] ]
@@ -13472,7 +13556,8 @@ substitutions @var{old}@t{=}@var{new}, if any, are then performed on the
text of the events.
@noindent
-In addition to the number range,
+The range of events selected by numbers can be narrowed further by the
+following flags.
@table @asis
@item @t{-I}
restricts to only internal events (not from @t{$HISTFILE})
@@ -13481,8 +13566,8 @@ restricts to only local events (not from other shells, see
@t{SHARE_HISTORY} in @ref{Description of Options} -- note that @t{$HISTFILE} is
considered local when read at startup)
@item @t{-m}
-takes the first argument as a pattern (should be quoted) and
-only the history events matching this pattern are considered
+takes the first argument as a pattern (which should be
+quoted) and only the history events matching this pattern are considered
@end table
@noindent
@@ -13504,6 +13589,7 @@ usually `@t{vi}' is used. If @var{ename} is `@t{-}', no editor is invoked.
When editing is complete, the edited command is executed.
@noindent
+The flag `@t{-s}' is equivalent to `@t{-e -}'.
The flag @t{-r} reverses the order of the events and the
flag @t{-n} suppresses event numbers when listing.
@@ -13625,6 +13711,11 @@ name of a library shell function which is then redefined to call
@t{newfn}, thereby installing a modified version of the function.
@noindent
+@emph{The }@t{-M}@emph{ and }@t{+M}@emph{ flags}
+@cindex defining mathematical functions
+@cindex functions, defining mathematical
+
+@noindent
Use of the @t{-M} option may not be combined with any of the options
handled by @t{typeset -f}.
@@ -13646,52 +13737,99 @@ expressions. The name of the function in @t{$0} is @var{mathfn} (not
@var{shellfn} as would usually be the case), provided the option
@t{FUNCTION_ARGZERO} is in effect. The positional parameters in the shell
function correspond to the arguments of the mathematical function call.
-The result of the last arithmetical expression evaluated
-inside the shell function (even if it is a form that normally only returns
-a status) gives the result of the mathematical function.
@noindent
-If the additional option @t{-s} is given to @t{functions -M}, the
-argument to the function is a single string: anything between the
-opening and matching closing parenthesis is passed to the function as a
-single argument, even if it includes commas or white space. The minimum
-and maximum argument specifiers must therefore be 1 if given. An empty
-argument list is passed as a zero-length string.
+The result of the last arithmetical expression evaluated inside the shell
+function gives the result of the mathematical function. This is not limited to
+arithmetic substitutions of the form @t{$((}@var{...}@t{))},
+but also includes arithmetical expressions evaluated in any other way, including
+by the @t{let} builtin,
+by @t{((}@var{...}@t{))} statements,
+and even
+by the @t{return} builtin
+and
+by array subscripts.
+Therefore, care must be taken not to use syntactical constructs that perform
+arithmetic evaluation after evaluating what is to be the result of the function.
+For example:
@noindent
-@t{functions -M} with no arguments lists all such user-defined functions in
-the same form as a definition. With the additional option @t{-m} and
-a list of arguments, all functions whose @var{mathfn} matches one of
-the pattern arguments are listed.
+@findex zmath_cube
+@findex cube
+@example
+# WRONG
+zmath_cube() @{
+ (( $1 * $1 * $1 ))
+ return 0
+@}
+functions -M cube 1 1 zmath_cube
+print $(( cube(3) ))
+@end example
@noindent
-@t{function +M} removes the list of mathematical functions; with the
-additional option @t{-m} the arguments are treated as patterns and
-all functions whose @var{mathfn} matches the pattern are removed. Note
-that the shell function implementing the behaviour is not removed
-(regardless of whether its name coincides with @var{mathfn}).
+This will print `@t{0}' because of the @t{return}.
@noindent
-For example, the following prints the cube of 3:
+Commenting the @t{return} out would lead to a different problem: the
+@t{((}@var{...}@t{))} statement would become
+the last statement in the function, so the @emph{return status} (@t{$?}) of the
+function would be non-zero (indicating failure) whenever the @emph{arithmetic
+result} of the function would happen to be zero (numerically):
@noindent
@example
-zmath_cube() @{ (( $1 * $1 * $1 )) @}
+# WRONG
+zmath_cube() @{
+ (( $1 * $1 * $1 ))
+@}
+functions -M cube 1 1 zmath_cube
+print $(( cube(0) ))
+@end example
+
+@noindent
+Instead, the @t{true} builtin can be used:
+
+@noindent
+@example
+# RIGHT
+zmath_cube() @{
+ (( $1 * $1 * $1 ))
+ true
+@}
functions -M cube 1 1 zmath_cube
print $(( cube(3) ))
@end example
@noindent
-The following string function takes a single argument, including
-the commas, so prints 11:
+If the additional option @t{-s} is given to @t{functions -M}, the
+argument to the function is a single string: anything between the
+opening and matching closing parenthesis is passed to the function as a
+single argument, even if it includes commas or white space. The minimum
+and maximum argument specifiers must therefore be 1 if given. An empty
+argument list is passed as a zero-length string.
+Thus, the following string function takes a single argument, including
+the commas, and prints 11:
@noindent
@example
-stringfn() @{ (( $#1 )) @}
+stringfn() @{ (( $#1 )); true @}
functions -Ms stringfn
print $(( stringfn(foo,bar,rod) ))
@end example
+@noindent
+@t{functions -M} with no arguments lists all such user-defined functions in
+the same form as a definition. With the additional option @t{-m} and
+a list of arguments, all functions whose @var{mathfn} matches one of
+the pattern arguments are listed.
+
+@noindent
+@t{function +M} removes the list of mathematical functions; with the
+additional option @t{-m} the arguments are treated as patterns and
+all functions whose @var{mathfn} matches the pattern are removed. Note
+that the shell function implementing the behaviour is not removed
+(regardless of whether its name coincides with @var{mathfn}).
+
@item @t{getcap}
See @ref{The zsh/cap Module}.
@@ -13729,7 +13867,8 @@ is stored in @t{OPTARG}.
The first option to be examined may be changed by explicitly assigning
to @t{OPTIND}. @t{OPTIND} has an initial value of @t{1}, and is
normally set to @t{1} upon entry to a shell function and restored
-upon exit (this is disabled by the @t{POSIX_BUILTINS} option). @t{OPTARG}
+upon exit. (The @t{POSIX_BUILTINS} option disables this, and also changes
+the way the value is calculated to match other shells.) @t{OPTARG}
is not reset and retains its value from the most recent call to
@t{getopts}. If either of @t{OPTIND} or @t{OPTARG} is explicitly
unset, it remains unset, and the index or option argument is not
@@ -13826,9 +13965,32 @@ be shown.
@noindent
The @t{-Z} option replaces the shell's argument and environment space with
the given string, truncated if necessary to fit. This will normally be
-visible in @t{ps} (man page ps(1)) listings. This feature is typically
+visible in @t{ps} (ps(1)) listings. This feature is typically
used by daemons, to indicate their state.
+@noindent
+Full job control is only available in the top-level interactive shell,
+not in commands run in the left hand side of pipelines or within
+the @t{(}@var{...}@t{)} construct. However, a snapshot
+of the job state at that point is taken, so it is still possible
+to use the @t{jobs} builtin, or any parameter providing job information.
+This gives information about the state of jobs at the point the subshell
+was created. If background processes are created within the subshell,
+then instead information about those processes is provided.
+
+@noindent
+For example,
+
+@noindent
+@example
+sleep 10 & # Job in background
+( # Shell forks
+jobs # Shows information about "sleep 10 &"
+sleep 5 & # Process in background (no job control)
+jobs # Shows information about "sleep 5 &"
+)
+@end example
+
@findex kill
@cindex killing jobs
@cindex jobs, killing
@@ -13986,14 +14148,6 @@ Same as @t{typeset}, except that the options @t{-g}, and
@t{-f} are not permitted. In this case the @t{-x} option does not force
the use of @t{-g}, i.e. exported variables will be local to functions.
-@findex log
-@vindex watch, use of
-@cindex watching users
-@cindex users, watching
-@item @t{log}
-List all users currently logged in who are affected by
-the current setting of the @t{watch} parameter.
-
@findex logout
@item @t{logout} [ @var{n} ]
Same as @t{exit}, except that it only works in a login shell.
@@ -14255,7 +14409,7 @@ Same as @t{fc -e -}.
@vindex IFS, use of
@item @t{read }[ @t{-rszpqAclneE} ] [ @t{-t} [ @var{num} ] ] [ @t{-k} [ @var{num} ] ] [ @t{-d} @var{delim} ]
-@itemx @t{@ @ @ @ @ }[ @t{-u} @var{n} ] [ @var{name}[@t{?}@var{prompt}] ] [ @var{name} ... ]
+@itemx @t{@ @ @ @ @ }[ @t{-u} @var{n} ] [ [@var{name}][@t{?}@var{prompt}] ] [ @var{name} ... ]
@vindex REPLY, use of
@vindex reply, use of
Read one line and break it into fields using the characters
@@ -14396,7 +14550,17 @@ Same as @t{hash -r}.
@item @t{return} [ @var{n} ]
Causes a shell function or `@t{.}' script to return to
the invoking script with the return status specified by
-an arithmetic expression @var{n}. If @var{n}
+an arithmetic expression @var{n}.
+For example, the following prints `@t{42}':
+
+@noindent
+@example
+() @{ integer foo=40; return "foo + 2" @}
+echo $?
+@end example
+
+@noindent
+If @var{n}
is omitted, the return status is that of the last command
executed.
@@ -14408,7 +14572,7 @@ will return to whatever it was previously processing; with a non-zero
status, the shell will behave as interrupted except that the return
status of the trap is retained. Note that the numeric value of the signal
which caused the trap is passed as the first argument, so the statement
-`@t{return $((128+$1))}' will return the same status as if the signal
+`@t{return "128+$1"}' will return the same status as if the signal
had not been trapped.
@item @t{sched}
@@ -14692,7 +14856,8 @@ unfreezing the tty does not guarantee settings made on the
command line are preserved. Strings of commands run between
editing the command line will see a consistent tty state.
See also the shell variable @t{STTY} for a means of initialising
-the tty before running external commands.
+the tty before running external commands and/or freezing the tty
+around a single command.
@findex type
@item @t{type} [ @t{-wfpamsS} ] @var{name} ...
@@ -14720,7 +14885,11 @@ retain their special attributes when made local.
@noindent
For each @var{name}@t{=}@var{value} assignment, the parameter
-@var{name} is set to @var{value}.
+@var{name} is set to @var{value}. If the assignment is omitted and @var{name}
+does @emph{not} refer to an existing parameter, a new parameter is intialized
+to empty string, zero, or empty array (as appropriate), @emph{unless} the
+shell option @t{TYPESET_TO_UNSET} is set. When that option is set,
+the parameter attributes are recorded but the parameter remains unset.
@noindent
If the shell option @t{TYPESET_SILENT} is not set, for each remaining
@@ -14814,7 +14983,7 @@ expansion. Hence it is not possible to assign to multiple arrays by
this means.
@noindent
-Note that each interface to any of the commands my be disabled
+Note that each interface to any of the commands may be disabled
separately. For example, `@t{disable -r typeset}' disables the reserved
word interface to @t{typeset}, exposing the builtin interface, while
`@t{disable typeset}' disables the builtin. Note that disabling the
@@ -15224,7 +15393,7 @@ will report an error if this fails.
@cindex umask
@item @t{umask} [ @t{-S} ] [ @var{mask} ]
The umask is set to @var{mask}. @var{mask} can be either
-an octal number or a symbolic value as described in man page chmod(1).
+an octal number or a symbolic value as described in the chmod(1) man page.
If @var{mask} is omitted, the current value is printed. The @t{-S}
option causes the mask to be printed as a symbolic value. Otherwise,
the mask is printed as an octal number. Note that in
@@ -15961,13 +16130,15 @@ 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; this is implemented
by the @t{digit-argument} widget. See also
-@ref{Arguments} for some other ways the numeric argument can be modified.
+@ref{Arguments}for some other ways the numeric argument can be modified.
@noindent
@menu
* Keymaps::
* Zle Builtins::
* Zle Widgets::
+* User-Defined Widgets::
+* Standard Widgets::
* Character Highlighting::
@end menu
@@ -16037,6 +16208,8 @@ except for ^J (line feed) and ^M (return) which are bound to @t{accept-line}.
This is deliberately not pleasant to use; if you are using it, it
means you deleted the main keymap, and you should put it back.
+@noindent
+
@subsection Reading Commands
@noindent
When ZLE is reading a command from the terminal, it may read a sequence
@@ -16070,6 +16243,8 @@ A key sequence typed by the user can be turned into a command name for use
in user-defined widgets with the @t{read-command} widget, described in
@ref{Miscellaneous} below.
+@noindent
+
@subsection Local Keymaps
@noindent
@cindex local keymaps
@@ -16399,7 +16574,7 @@ refer to a terminal an error is reported.
@itemx @t{zle} @t{-F} [ @t{-L} | @t{-w} ] [ @var{fd} [ @var{handler} ] ]
@itemx @t{zle} @t{-I}
@itemx @t{zle} @t{-T} [ @t{tc} @var{function} | @t{-r} @t{tc} | @t{-L} ]
-@itemx @t{zle} @var{widget} [ @t{-n} @var{num} ] [ @t{-Nw} ] [ @t{-K} @var{keymap} ] @var{args} ...
+@itemx @t{zle} @var{widget} [ @t{-n} @var{num} ] [ @t{-f} @var{flag} ] [ @t{-Nw} ] [ @t{-K} @var{keymap} ] @var{args} ...
The @t{zle} builtin performs a number of different actions concerning
ZLE.
@@ -16490,8 +16665,7 @@ For further information, see
@ref{Completion Widgets}.
@item @t{-R} [ @t{-c} ] [ @var{display-string} ] [ @var{string} ... ]
-Redisplay the command line; this is to be called from within a user-defined
-widget to allow changes to become visible. If a @var{display-string} is
+Redisplay the command line. If a @var{display-string} is
given and not empty, this is shown in the status line (immediately
below the line being edited).
@@ -16502,9 +16676,9 @@ prompt in the same way as completion lists are printed. If no
cleared.
@noindent
-Note that this option is only useful for widgets that do not exit
-immediately after using it because the strings displayed will be erased
-immediately after return from the widget.
+Note that immediately after returning from running widgets, the command line
+will be redisplayed and the strings displayed will be erased. Therefore, this
+option is only useful for widgets that do not exit immediately after using it.
@noindent
This command can safely be called outside user defined widgets; if zle is
@@ -16700,7 +16874,7 @@ optional argument for debugging or testing. Note that this
transformation is not applied to other non-printing characters such as
carriage returns and newlines.
-@item @var{widget} [ @t{-n} @var{num} ] [ @t{-Nw} ] [ @t{-K} @var{keymap} ] @var{args} ...
+@item @var{widget} [ @t{-n} @var{num} ] [ @t{-f} @var{flag} ] [ @t{-Nw} ] [ @t{-K} @var{keymap} ] @var{args} ...
Invoke the specified @var{widget}. This can only be done when ZLE is
active; normally this will be within a user-defined widget.
@@ -16723,6 +16897,10 @@ active. With the option @t{-w}, @t{WIDGET} and related parameters are set
to reflect the widget being executed by the @t{zle} call.
@noindent
+Normally, when @var{widget} returns the special parameter @t{LASTWIDGET} will
+point to it. This can be inhibited by passing the option @t{-f nolast}.
+
+@noindent
Any further arguments will be passed to the widget; note that as
standard argument handling is performed, any general argument list
should be preceded by @t{-}@t{-}. If it is a shell
@@ -16750,9 +16928,9 @@ it should call the @t{beep} widget directly.
@end table
@noindent
-@node Zle Widgets, Character Highlighting, Zle Builtins, Zsh Line Editor
+@node Zle Widgets, User-Defined Widgets, Zle Builtins, Zsh Line Editor
-@section Widgets
+@section Zle Widgets
@noindent
@cindex widgets
All actions in the editor are performed by `widgets'. A widget's job is
@@ -16761,7 +16939,8 @@ in keymaps are bound to are in fact widgets. Widgets can be user-defined
or built in.
@noindent
-The standard widgets built into ZLE are listed in Standard Widgets below.
+The standard widgets built into ZLE are listed in
+@ref{Standard Widgets}.
Other built-in widgets can be defined by other modules (see
@ref{Zsh Modules}). Each built-in widget has two names: its normal canonical name, and the
same name preceded by a `@t{.}'. The `@t{.}' name is special: it can't be
@@ -16775,6 +16954,9 @@ shell function is executed, and can perform editing (or other) actions.
It is recommended that user-defined widgets should not have names
starting with `@t{.}'.
+@noindent
+@node User-Defined Widgets, Standard Widgets, Zle Widgets, Zsh Line Editor
+
@section User-Defined Widgets
@noindent
@cindex widgets, user-defined
@@ -17012,7 +17194,7 @@ and @t{POSTDISPLAY} are possible, but note that the @t{P} flag
is needed for character indexing to include @t{PREDISPLAY}.
@noindent
-Each string consists of the following parts:
+Each string consists of the following whitespace-separated parts:
@noindent
@itemize @bullet
@@ -17021,18 +17203,32 @@ Each string consists of the following parts:
Optionally, a `@t{P}' to signify that the start and end offset that
follow include any string set by the @t{PREDISPLAY} special parameter;
this is needed if the predisplay string itself is to be highlighted.
-Whitespace may follow the `@t{P}'.
+Whitespace between the `@t{P}' and the start offset is optional.
@item
-A start offset in the same units as @t{CURSOR}, terminated by
-whitespace.
+A start offset in the same units as @t{CURSOR}.
@item
-An end offset in the same units as @t{CURSOR}, terminated by
-whitespace.
+An end offset in the same units as @t{CURSOR}.
@item
A highlight specification in the same format as
used for contexts in the parameter @t{zle_highlight}, see
@ref{Character Highlighting};
for example, @t{standout} or @t{fg=red,bold}.
+@item
+Optionally, a string of the form `@t{memo=}@var{token}'.
+The @var{token} consists of everything between the `@t{=}' and the next
+whitespace, comma, NUL, or the end of the string.
+The @var{token} is preserved verbatim but not parsed in any way.
+
+@noindent
+Plugins may use this to identify array elements they have added: for example,
+a plugin might set @var{token} to its (the plugin's) name and then use
+`@t{region_highlight=( $@{region_highlight:#*memo=}@var{token}@t{@} )}'
+in order to remove array elements it have added.
+
+@noindent
+(This example uses the `@t{$@{}@var{name}@t{:#}@var{pattern}@t{@}}' array-grepping
+syntax described in
+@ref{Parameter Expansion}.)
@end itemize
@noindent
@@ -17040,7 +17236,7 @@ For example,
@noindent
@example
-region_highlight=("P0 20 bold")
+region_highlight=("P0 20 bold memo=foobar")
@end example
@noindent
@@ -17052,6 +17248,12 @@ Note that the effect of @t{region_highlight} is not saved and disappears
as soon as the line is accepted.
@noindent
+Note that zsh 5.8 and older do not support the `@t{memo=}@var{token}' field
+and may misparse the third (highlight specification) field when a memo
+is given.
+
+
+@noindent
The final highlighting on the command line depends on both @t{region_highlight}
and @t{zle_highlight}; see
@ref{Character Highlighting} for details.
@@ -17264,6 +17466,7 @@ This can be used for detecting switches between the vi command
@end table
@noindent
+@node Standard Widgets, Character Highlighting, User-Defined Widgets, Zsh Line Editor
@section Standard Widgets
@noindent
@@ -17291,7 +17494,7 @@ the @t{KEYTIMEOUT} parameter, see @ref{Parameters}.
* Miscellaneous::
* Text Objects::
@end menu
-@node Movement, History Control, , Zle Widgets
+@node Movement, History Control, , Standard Widgets
@subsection Movement
@noindent
@@ -17440,7 +17643,7 @@ Repeat the last @t{vi-find} command in the opposite direction.
Move up a line in the buffer.
@end table
-@node History Control, Modifying Text, Movement, Zle Widgets
+@node History Control, Modifying Text, Movement, Standard Widgets
@subsection History Control
@noindent
@@ -17819,7 +18022,7 @@ the numeric argument. Zero for both local and imported lines and nonzero for
only local lines.
@end table
-@node Modifying Text, Arguments, History Control, Zle Widgets
+@node Modifying Text, Arguments, History Control, Standard Widgets
@subsection Modifying Text
@noindent
@@ -18154,7 +18357,7 @@ into the kill buffer.
Arguably, this is what Y should do in vi, but it isn't what it actually does.
@end table
-@node Arguments, Completion, Modifying Text, Zle Widgets
+@node Arguments, Completion, Modifying Text, Standard Widgets
@subsection Arguments
@noindent
@@ -18210,7 +18413,7 @@ zle universal-argument
@end example
@end table
-@node Completion, Miscellaneous, Arguments, Zle Widgets
+@node Completion, Miscellaneous, Arguments, Standard Widgets
@subsection Completion
@noindent
@@ -18287,7 +18490,7 @@ When a previous completion displayed a list below the prompt, this
widget can be used to move the prompt below the list.
@end table
-@node Miscellaneous, Text Objects, Completion, Zle Widgets
+@node Miscellaneous, Text Objects, Completion, Standard Widgets
@subsection Miscellaneous
@noindent
@@ -18338,7 +18541,7 @@ a desired suffix-preservation behavior.
Beep, unless the @t{BEEP} option is unset.
@tindex bracketed-paste
-@item @t{bracketed-paste}
+@item @t{bracketed-paste} (@t{^[[200~}) (@t{^[[200~}) (@t{^[[200~})
This widget is invoked when text is pasted to the terminal emulator. It
is not intended to be bound to actual keys but instead to the special
sequence generated by the terminal emulator when text is pasted.
@@ -18711,7 +18914,7 @@ If the last command executed was a digit as part of an argument,
continue the argument. Otherwise, execute vi-beginning-of-line.
@end table
-@node Text Objects, , Miscellaneous, Zle Widgets
+@node Text Objects, , Miscellaneous, Standard Widgets
@subsection Text Objects
@noindent
@@ -18760,7 +18963,7 @@ argument, multiple words will be selected.
@end table
@noindent
-@node Character Highlighting, , Zle Widgets, Zsh Line Editor
+@node Character Highlighting, , Standard Widgets, Zsh Line Editor
@section Character Highlighting
@noindent
@@ -19053,7 +19256,7 @@ work even if the widget in question has been re-bound.
When this newly defined widget is bound to a key
using the @t{bindkey} builtin command defined in the @t{zsh/zle} module
(@ref{Zsh Line Editor}), typing that key will call the shell function `@t{completer}'. This
-function is responsible for generating the possible matches using the
+function is responsible for generating completion matches using the
builtins described below. As with other ZLE widgets, the function is
called with its standard input closed.
@@ -19241,7 +19444,7 @@ The string of an exact match if one was found, otherwise unset.
@vindex ignored, compstate
@item @t{ignored}
-The number of words that were ignored because they matched one of the
+The number of completions that were ignored because they matched one of the
patterns given with the @t{-F} option to the @t{compadd} builtin
command.
@@ -19344,8 +19547,7 @@ will be used in the same way as the value of @t{LISTMAX}.
@vindex nmatches, compstate
@item @t{nmatches}
-The number of matches generated and accepted by the completion code so
-far.
+The number of matches added by the completion code so far.
@vindex old_insert, compstate
@item @t{old_insert}
@@ -19383,7 +19585,8 @@ value of a parameter assignment.
@vindex pattern_insert, compstate
@item @t{pattern_insert}
Normally this is set to @t{menu}, which specifies that menu completion will
-be used whenever a set of matches was generated using pattern matching. If
+be used whenever a set of matches was generated using @t{pattern_match}
+(see below). If
it is set to any other non-empty string by the user and menu completion is
not selected by other option settings, the code will instead insert any
common prefix for the generated matches as with normal completion.
@@ -19400,7 +19603,7 @@ additionally a wildcard `@t{*}' is assumed at the cursor position; if
it is empty or unset, metacharacters will be treated literally.
@noindent
-Note that the matcher specifications given to the @t{compadd} builtin
+Note that the match specifications given to the @t{compadd} builtin
command are not used if this is set to a non-empty string.
@vindex quote, compstate
@@ -19498,21 +19701,20 @@ edited.
@itemx @t{@ @ @ @ @ @ @ @ }[@t{-r} @var{remove-chars} ] [ @t{-R} @var{remove-func} ]
@itemx @t{@ @ @ @ @ @ @ @ }[@t{-D} @var{array} ] [ @t{-O} @var{array} ] [ @t{-A} @var{array} ]
@itemx @t{@ @ @ @ @ @ @ @ }[@t{-E} @var{number} ]
-@itemx @t{@ @ @ @ @ @ @ @ }[@t{-M} @var{match-spec} ] [ @t{-}@t{-} ] [ @var{words} ... ]
+@itemx @t{@ @ @ @ @ @ @ @ }[@t{-M} @var{match-spec} ] [ @t{-}@t{-} ] [ @var{completions} ... ]
@noindent
This builtin command can be used to add matches directly and control
all the information the completion code stores with each possible
-match. The return status is zero if at least one match was added and
+completion. The return status is zero if at least one match was added and
non-zero if no matches were added.
@noindent
-The completion code breaks the string to complete into seven fields in
-the order:
+The completion code breaks each match into seven fields in the order:
@noindent
@quotation
-@var{<ipre><apre><hpre><word><hsuf><asuf><isuf>}
+@var{<ipre><apre><hpre><body><hsuf><asuf><isuf>}
@end quotation
@noindent
@@ -19522,12 +19724,12 @@ is an ignored prefix taken from the command line, the contents of the
option. With the @t{-U} option, only the string from the @t{-i}
option is used. The field @var{<apre>} is an optional prefix string
given with the @t{-P} option. The @var{<hpre>} field is a string
-that is considered part of the match but that should not be shown when
+that is considered part of the match but that should not be shown when
listing completions, given with the @t{-p} option; for example,
functions that do filename generation might specify
-a common path prefix this way. @var{<word>} is the part of the match that
-should appear in the list of completions, i.e. one of the @var{words} given
-at the end of the @t{compadd} command line. The suffixes @var{<hsuf>},
+a common path prefix this way. @var{<body>} is the part of the match that
+should appear in the list of matches shown to the user.
+The suffixes @var{<hsuf>},
@var{<asuf>} and @var{<isuf>} correspond to the prefixes @var{<hpre>},
@var{<apre>} and @var{<ipre>} and are given by the options @t{-s}, @t{-S} and
@t{-I}, respectively.
@@ -19538,53 +19740,53 @@ The supported flags are:
@noindent
@table @asis
@item @t{-P} @var{prefix}
-This gives a string to be inserted before the given @var{words}. The
+This gives a string to be inserted before each match. The
string given is not considered as part of the match and any shell
metacharacters in it will not be quoted when the string is inserted.
@item @t{-S} @var{suffix}
-Like @t{-P}, but gives a string to be inserted after the match.
+Like @t{-P}, but gives a string to be inserted after each match.
@item @t{-p} @var{hidden-prefix}
-This gives a string that should be inserted into the command line before the
+This gives a string that should be inserted before each
match but that should not appear in the list of matches. Unless the
@t{-U} option is given, this string must be matched as part of the string
on the command line.
@item @t{-s} @var{hidden-suffix}
-Like `@t{-p}', but gives a string to insert after the match.
+Like `@t{-p}', but gives a string to insert after each match.
@item @t{-i} @var{ignored-prefix}
-This gives a string to insert into the command line just before any
+This gives a string to insert just before any
string given with the `@t{-P}' option. Without `@t{-P}' the string is
-inserted before the string given with `@t{-p}' or directly before the
+inserted before the string given with `@t{-p}' or directly before each
match.
@item @t{-I} @var{ignored-suffix}
Like @t{-i}, but gives an ignored suffix.
@item @t{-a}
-With this flag the @var{words} are taken as names of arrays and the
-possible matches are their values. If only some elements of the
-arrays are needed, the @var{words} may also contain subscripts, as in
+With this flag the @var{completions} are taken as names of arrays and the
+actual completions are their values. If only some elements of the
+arrays are needed, the @var{completions} may also contain subscripts, as in
`@t{foo[2,-1]}'.
@item @t{-k}
-With this flag the @var{words} are taken as names of associative arrays
-and the possible matches are their keys. As for @t{-a}, the
+With this flag the @var{completions} are taken as names of associative arrays
+and the actual completions are their keys. As for @t{-a}, the
@var{words} may also contain subscripts, as in `@t{foo[(R)*bar*]}'.
@item @t{-d} @var{array}
-This adds per-match display strings. The @var{array} should contain one
-element per @var{word} given. The completion code will then display the
-first element instead of the first @var{word}, and so on. The
+This adds per-completion display strings. The @var{array} should contain one
+element per @var{completion} given. The completion code will then display the
+first element instead of the first @var{completion}, and so on. The
@var{array} may be given as the name of an array parameter or directly
as a space-separated list of words in parentheses.
@noindent
-If there are fewer display strings than @var{words}, the leftover
-@var{words} will be displayed unchanged and if there are more display
-strings than @var{words}, the leftover display strings will be silently
+If there are fewer display strings than @var{completions}, the leftover
+@var{completions} will be displayed unchanged and if there are more display
+strings than @var{completions}, the leftover display strings will be silently
ignored.
@item @t{-l}
@@ -19608,7 +19810,8 @@ by the @t{-d} option). This is the default if `@t{-o}' is specified but
the @var{order} argument is omitted.
@item @t{nosort}
-This specifies that the matches are pre-sorted and their order should be
+This specifies that the @var{completions}
+are pre-sorted and their order should be
preserved. This value only makes sense alone and cannot be combined with any
others.
@@ -19622,7 +19825,7 @@ Arrange the matches backwards by reversing the sort ordering.
@end table
@item @t{-J} @var{group-name}
-Gives the name of the group of matches the words should be stored in.
+Gives the name of the group that the matches should be stored in.
@item @t{-V} @var{group-name}
Like @t{-J} but naming an unsorted group. This option is identical to
@@ -19666,13 +19869,13 @@ produce unexpected results. If arbitrary text is to be passed in a
description, it can be escaped using e.g. @t{$@{my_str//\%/%%@}}.
@item @t{-x} @var{message}
-Like @t{-X}, but the @var{message} will be printed even if there are no
+Like @t{-X}, but the @var{message} will be printed even if there are no
matches in the group.
@item @t{-q}
-The suffix given with @t{-S} will be automatically removed if
+The suffix given with @t{-S} will be automatically removed if
the next character typed is a blank or does not insert anything, or if
-the suffix consists of only one character and the next character typed
+the suffix consists of only one character and the next character typed
is the same character.
@item @t{-r} @var{remove-chars}
@@ -19695,15 +19898,15 @@ automatically added space will be removed when one of the characters in the
list is typed.
@item @t{-R} @var{remove-func}
-This is another form of the @t{-r} option. When a suffix
-has been inserted and the completion accepted, the function
+This is another form of the @t{-r} option. When a match
+has been accepted and a suffix has been inserted, the function
@var{remove-func} will be called after the next character typed. It is
passed the length of the suffix as an argument and can use the special
parameters available in ordinary (non-completion) zle widgets (see
@ref{Zsh Line Editor}) to analyse and modify the command line.
@item @t{-f}
-If this flag is given, all of the matches built from @var{words} are
+If this flag is given, all of the matches built from the @var{completions} are
marked as being the names of files. They are not required to be actual
filenames, but if they are, and the option @t{LIST_TYPES} is set, the
characters describing the types of the files in the completion lists will
@@ -19717,15 +19920,14 @@ the @t{AUTO_PARAM_SLASH} and @t{AUTO_PARAM_KEYS} options be used for
the matches.
@item @t{-W} @var{file-prefix}
-This string is a pathname that will be
-prepended to each of the matches formed by the given @var{words} together
+This string is a pathname that will be prepended to each match together
with any prefix specified by the @t{-p} option to form a complete filename
for testing. Hence it is only useful if combined with the @t{-f} flag, as
the tests will not otherwise be performed.
@item @t{-F} @var{array}
-Specifies an array containing patterns. Words matching one of these
-patterns are ignored, i.e. not considered to be possible matches.
+Specifies an array containing patterns. @var{completions} that match one of
+these patterns are ignored, that is, not considered to be matches.
@noindent
The @var{array} may be the name of an array parameter or a list of
@@ -19734,8 +19936,8 @@ literal patterns enclosed in parentheses and quoted, as in `@t{-F "(*?.o
taken as the patterns.
@item @t{-Q}
-This flag instructs the completion
-code not to quote any metacharacters in the words when inserting them
+This flag instructs the completion
+code not to quote any metacharacters in the matches when inserting them
into the command line.
@item @t{-M} @var{match-spec}
@@ -19746,47 +19948,50 @@ between them to form the specification string to use.
Note that they will only be used if the @t{-U} option is not given.
@item @t{-n}
-Specifies that the words added are to be used as possible
-matches, but are not to appear in the completion listing.
+Specifies that matching @var{completions} are to be added to the set of
+matches, but are not to be listed to the user.
@item @t{-U}
-If this flag is given, all words given will be accepted and no matching
+If this flag is given, all @var{completions} are added
+to the set of matches and no matching
will be done by the completion code. Normally this is used in
functions that do the matching themselves.
@item @t{-O} @var{array}
-If this option is given, the @var{words} are @emph{not} added to the set of
-possible completions. Instead, matching is done as usual and all of the
-@var{words} given as arguments that match the string on the command line
+If this option is given, the @var{completions} are @emph{not} added to the set of
+matches. Instead, matching is done as usual and all of the
+@var{completions} that match
will be stored in the array parameter whose name is given as @var{array}.
@item @t{-A} @var{array}
-As the @t{-O} option, except that instead of those of the @var{words} which
+As the @t{-O} option, except that instead of those of the @var{completions}
+which
match being stored in @var{array}, the strings generated internally by the
-completion code are stored. For example,
-with a matching specification of `@t{-M "L:|no="}', the string `@t{nof}'
-on the command line and the string `@t{foo}' as one of the @var{words}, this
+completion code are stored. For example,
+with a match specification of `@t{-M "L:|no="}', a current word of `@t{nof}'
+and @var{completions} of `@t{foo}', this
option stores the string `@t{nofoo}' in the array, whereas the @t{-O}
option stores the `@t{foo}' originally given.
@item @t{-D} @var{array}
-As with @t{-O}, the @var{words} are not added to the set of possible
-completions. Instead, the completion code tests whether each @var{word}
-in turn matches what is on the line. If the @var{n}th @var{word} does not
+As with @t{-O}, the @var{completions} are not added to the set of matches.
+Instead, whenever the @var{n}th @var{completion} does not
match, the @var{n}th element of the @var{array} is removed. Elements
-for which the corresponding @var{word} is matched are retained.
+for which the corresponding @var{completion} matches are retained.
+This option can be used more than once to remove elements from multiple
+arrays.
@item @t{-C}
This option adds a special match which expands to all other matches
when inserted into the line, even those that are added after this
option is used. Together with the @t{-d} option it is possible to
-specify a string that should be displayed in the list for this special
-match. If no string is given, it will be shown as a string containing
-the strings that would be inserted for the other matches, truncated to
+specify a string that should be displayed in the list for this special
+match. If no string is given, it will be shown as a string containing
+the strings that would be inserted for the other matches, truncated to
the width of the screen.
@item @t{-E} @var{number}
-This option adds @var{number} empty matches after the @var{words} have
+This option adds @var{number} empty matches after matching @var{completions} have
been added. An empty match takes up space in completion listings but
will never be inserted in the line and can't be selected with menu
completion or menu selection. This makes empty matches only useful to
@@ -19801,7 +20006,7 @@ added.
@item @t{-}
@itemx @t{-}@t{-}
This flag ends the list of flags and options. All arguments after it
-will be taken as the words to use as matches even if they begin with
+will be taken as the @var{completions} even if they begin with
hyphens.
@end table
@@ -19842,7 +20047,7 @@ Without the optional @var{number}, the longest match is taken, but
if @var{number} is given, anything up to the @var{number}th match is
moved. If the @var{number} is negative, the @var{number}th longest
match is moved. For example, if @t{PREFIX} contains the string
-`@t{a=b=c}', then @t{compset -P '*\='} will move the string `@t{a=b=}'
+`@t{a=b=c}', then @t{compset -P '*\='} will move the string `@t{a=b=}'
into the @t{IPREFIX} parameter, but @t{compset -P 1 '*\='} will move only
the string `@t{a=}'.
@@ -19855,7 +20060,7 @@ As @t{-P}, but match the last portion of @t{SUFFIX} and transfer the
matched portion to the front of the value of @t{ISUFFIX}.
@item @t{-n} @var{begin} [ @var{end} ]
-If the current word position as specified by the parameter @t{CURRENT}
+If the current word position as specified by the parameter @t{CURRENT}
is greater than or equal to @var{begin}, anything up to the
@var{begin}th word is removed from the @t{words} array and the value
of the parameter @t{CURRENT} is decremented by @var{begin}.
@@ -19881,7 +20086,7 @@ point to the same word in the changed array.
If the optional pattern @var{end-pat} is also given, and there is an
element in the @t{words} array matching this pattern, the parameters
are modified only if the index of this word is higher than the one
-given by the @t{CURRENT} parameter (so that the matching word has
+given by the @t{CURRENT} parameter (so that the matching word has
to be after the cursor). In this case, the words starting with the one
matching @t{end-pat} are also removed from the @t{words}
array. If @t{words} contains no word matching @var{end-pat}, the
@@ -19890,7 +20095,7 @@ testing and modification is performed as if it were not given.
@item @t{-q}
The word
currently being completed is split on spaces into separate words,
-respecting the usual shell quoting conventions. The
+respecting the usual shell quoting conventions. The
resulting words are stored in the @t{words} array, and @t{CURRENT},
@t{PREFIX}, @t{SUFFIX}, @t{QIPREFIX}, and @t{QISUFFIX} are modified to
reflect the word part that is completed.
@@ -19954,7 +20159,7 @@ true if the test for the @t{-P} option of @t{compset} would succeed.
true if the test for the @t{-S} option of @t{compset} would succeed.
@item @t{-after} @var{beg-pat}
-true if the test of the @t{-N} option with only the @var{beg-pat} given
+true if the test of the @t{-N} option with only the @var{beg-pat} given
would succeed.
@item @t{-between} @var{beg-pat end-pat}
@@ -19969,311 +20174,329 @@ true if the test for the @t{-N} option with both patterns would succeed.
@noindent
@noindent
-It is possible by use of the
-@t{-M} option of the @t{compadd} builtin command to specify how the
-characters in the string to be completed (referred to here as the
-command line) map onto the characters in the list of matches produced by
-the completion code (referred to here as the trial completions). Note
-that this is not used if the command line contains a glob pattern and
-the @t{GLOB_COMPLETE} option is set or the @t{pattern_match} of the
-@t{compstate} special association is set to a non-empty string.
+When the user invokes completion, the current @emph{word} on the command line
+(that is, the word the cursor is currently on) is used to generate a @emph{match
+pattern}. Only those @emph{completions} that match the pattern are offered to the
+user as @emph{matches}.
@noindent
-The @var{match-spec} given as the argument to the @t{-M} option (see
-@ref{Completion Builtin Commands}) consists of one or more matching descriptions separated by
-whitespace. Each description consists of a letter followed by a colon
-and then the patterns describing which character sequences on the line match
-which character sequences in the trial completion. Any sequence of
-characters not handled in this fashion must match exactly, as usual.
+The default match pattern is generated from the current word by either
@noindent
-The forms of @var{match-spec} understood are as follows. In each case, the
-form with an upper case initial character retains the string already
-typed on the command line as the final result of completion, while with
-a lower case initial character the string on the command line is changed
-into the corresponding part of the trial completion.
+@itemize @bullet
+
+@item
+appending a `@t{*}' (matching any number of characters in a completion)
+@emph{or,}
+@item
+if the shell option @t{COMPLETE_IN_WORD} is set, inserting a `@t{*}' at the
+cursor position.
+@end itemize
@noindent
-@table @asis
-@item @t{m:}@var{lpat}@t{=}@var{tpat}
-@itemx @t{M:}@var{lpat}@t{=}@var{tpat}
-Here, @var{lpat} is a pattern that matches on the command line,
-corresponding to @var{tpat} which matches in the trial completion.
+This narrow pattern can be broadened selectively by passing a @emph{match
+specification} to the @t{compadd} builtin command through its @t{-M} option
+(see
+@ref{Completion Builtin Commands}). A match specification consists of one or more @var{matchers} separated by
+whitespace. Matchers in a match specification are applied one at a time, from
+left to right. Once all matchers have been applied, completions are compared
+to the final match pattern and non-matching ones are discarded.
-@item @t{l:}@var{lanchor}@t{|}@var{lpat}@t{=}@var{tpat}
-@itemx @t{L:}@var{lanchor}@t{|}@var{lpat}@t{=}@var{tpat}
-@itemx @t{l:}@var{lanchor}@t{||}@var{ranchor}@t{=}@var{tpat}
-@itemx @t{L:}@var{lanchor}@t{||}@var{ranchor}@t{=}@var{tpat}
-@itemx @t{b:}@var{lpat}@t{=}@var{tpat}
-@itemx @t{B:}@var{lpat}@t{=}@var{tpat}
-These letters are for patterns that are anchored by another pattern on
-the left side. Matching for @var{lpat} and @var{tpat} is as for @t{m} and
-@t{M}, but the pattern @var{lpat} matched on the command line must be
-preceded by the pattern @var{lanchor}. The @var{lanchor} can be blank to
-anchor the match to the start of the command line string; otherwise the
-anchor can occur anywhere, but must match in both the command line and
-trial completion strings.
+@noindent
+@itemize @bullet
+
+@item
+Note that the @t{-M} option is ignored if the current word contains a glob
+pattern and the shell option @t{GLOB_COMPLETE} is set or if the
+@t{pattern_match} key of the special associative array @t{compstate} is set to
+a non-empty value (see
+@ref{Completion Special Parameters}).
+@item
+Users of the @ref{Completion System} should generally not use the @t{-M} option directly, but rather use the
+@t{matcher-list} and @t{matcher} styles (see the subsection @emph{Standard Styles}
+in
+@ref{Completion System Configuration}).
+@end itemize
@noindent
-If no @var{lpat} is given but a @var{ranchor} is, this matches the gap
-between substrings matched by @var{lanchor} and @var{ranchor}. Unlike
-@var{lanchor}, the @var{ranchor} only needs to match the trial
-completion string.
+Each matcher consists of
@noindent
-The @t{b} and @t{B} forms are similar to @t{l} and @t{L} with an empty
-anchor, but need to match only the beginning of the word on the command line
-or trial completion, respectively.
+@itemize @bullet
-@item @t{r:}@var{lpat}@t{|}@var{ranchor}@t{=}@var{tpat}
-@itemx @t{R:}@var{lpat}@t{|}@var{ranchor}@t{=}@var{tpat}
-@itemx @t{r:}@var{lanchor}@t{||}@var{ranchor}@t{=}@var{tpat}
-@itemx @t{R:}@var{lanchor}@t{||}@var{ranchor}@t{=}@var{tpat}
-@itemx @t{e:}@var{lpat}@t{=}@var{tpat}
-@itemx @t{E:}@var{lpat}@t{=}@var{tpat}
-As @t{l}, @t{L}, @t{b} and @t{B}, with the difference that the command
-line and trial completion patterns are anchored on the right side.
-Here an empty @var{ranchor} and the @t{e} and @t{E} forms force the
-match to the end of the command line or trial completion string.
+@item
+a case-sensitive letter
+@item
+a `@t{:}',
+@item
+one or more patterns separated by pipes (`@t{|}'),
+@item
+an equals sign (`@t{=}'), and
+@item
+another pattern.
+@end itemize
-@item @t{x:}
-This form is used to mark the end of matching specifications:
-subsequent specifications are ignored. In a single standalone list
-of specifications this has no use but where matching specifications
-are accumulated, such as from nested function calls, it can allow one
-function to override another.
+@noindent
+The patterns before the `@t{=}' are used to match substrings of the current
+word. For each matched substring, the corresponding part of the match pattern
+is broadened with the pattern after the `@t{=}', by means of a logical @t{OR}.
-@end table
+@noindent
+Each pattern in a matcher cosists of either
@noindent
-Each @var{lpat}, @var{tpat} or @var{anchor} is either an empty string or
-consists of a sequence of literal characters (which may be quoted with a
-backslash), question marks, character classes, and correspondence
-classes; ordinary shell patterns are not used. Literal characters match
-only themselves, question marks match any character, and character
-classes are formed as for globbing and match any character in the given
-set.
+@itemize @bullet
+
+@item
+the empty string or
+@item
+a sequence of
@noindent
-Correspondence classes are defined like character classes, but with two
-differences: they are delimited by a pair of braces, and negated classes
-are not allowed, so the characters @t{!} and @t{^} have no special
-meaning directly after the opening brace. They indicate that a range of
-characters on the line match a range of characters in the trial
-completion, but (unlike ordinary character classes) paired according to
-the corresponding position in the sequence. For example, to make any
-ASCII lower case letter on the line match the corresponding upper case
-letter in the trial completion, you can use `@t{m:@{a-z@}=@{A-Z@}}'
-(however, see below for the recommended form for this). More
-than one pair of classes can occur, in which case the first class before
-the @t{=} corresponds to the first after it, and so on. If one side has
-more such classes than the other side, the superfluous classes behave
-like normal character classes. In anchor patterns correspondence classes
-also behave like normal character classes.
-
-@noindent
-The standard `@t{[:}@var{name}@t{:]}' forms described for standard shell
-patterns (see
-@ref{Filename Generation})
-may appear in correspondence classes as well as normal character
-classes. The only special behaviour in correspondence classes is if
-the form on the left and the form on the right are each one of
-@t{[:upper:]}, @t{[:lower:]}. In these cases the
-character in the word and the character on the line must be the same up
-to a difference in case. Hence to make any lower case character on the
-line match the corresponding upper case character in the trial
-completion you can use `@t{m:@{[:lower:]@}=@{[:upper:]@}}'. Although the
-matching system does not yet handle multibyte characters, this is likely
-to be a future extension, at which point this syntax will handle
-arbitrary alphabets; hence this form, rather than the use of explicit
-ranges, is the recommended form. In other cases
-`@t{[:}@var{name}@t{:]}' forms are allowed. If the two forms on the left
-and right are the same, the characters must match exactly. In remaining
-cases, the corresponding tests are applied to both characters, but they
-are not otherwise constrained; any matching character in one set goes
-with any matching character in the other set: this is equivalent to the
-behaviour of ordinary character classes.
-
-@noindent
-The pattern @var{tpat} may also be one or two stars, `@t{*}' or
-`@t{**}'. This means that the pattern on the command line can match
-any number of characters in the trial completion. In this case the
-pattern must be anchored (on either side); in the case of a single
-star, the @var{anchor} then determines how much of the trial completion
-is to be included --- only the characters up to the next appearance of
-the anchor will be matched. With two stars, substrings matched by the
-anchor can be matched, too.
+@itemize @bullet
+
+@item
+literal characters (which may be quoted with a `@t{\}'),
+@item
+question marks (`@t{?}'),
+@item
+bracket expressions (`@t{[...]}'; see the subsection @emph{Glob Operators} in
+@ref{Filename Generation}), and/or
+@item
+brace expressions (see below).
+@end itemize
+
+@end itemize
@noindent
-Examples:
+Other shell patterns are not allowed.
@noindent
-The keys of the @t{options} association defined by the @t{parameter}
-module are the option names in all-lower-case form, without
-underscores, and without the optional @t{no} at the beginning even
-though the builtins @t{setopt} and @t{unsetopt} understand option names
-with upper case letters, underscores, and the optional @t{no}. The
-following alters the matching rules so that the prefix @t{no} and any
-underscore are ignored when trying to match the trial completions
-generated and upper case letters on the line match the corresponding
-lower case letters in the words:
+A brace expression, like a bracket expression, consists of a list of
@noindent
-@example
-compadd -M 'L:|[nN][oO]= M:_= M:@{[:upper:]@}=@{[:lower:]@}' - \
- $@{(k)options@}
-@end example
+@itemize @bullet
+
+@item
+literal characters,
+@item
+ranges (`@t{0-9}'), and/or
+@item
+character classes (`@t{[:}@var{name}@t{:]}').
+@end itemize
@noindent
-The first part says that the pattern `@t{[nN][oO]}' at the beginning
-(the empty anchor before the pipe symbol) of the string on the
-line matches the empty string in the list of words generated by
-completion, so it will be ignored if present. The second part does the
-same for an underscore anywhere in the command line string, and the
-third part uses correspondence classes so that any
-upper case letter on the line matches the corresponding lower case
-letter in the word. The use of the upper case forms of the
-specification characters (@t{L} and @t{M}) guarantees that what has
-already been typed on the command line (in particular the prefix
-@t{no}) will not be deleted.
+However, they differ from each other as follows:
@noindent
-Note that the use of @t{L} in the first part means that it matches
-only when at the beginning of both the command line string and the
-trial completion. I.e., the string `@t{_NO_f}' would not be
-completed to `@t{_NO_foo}', nor would `@t{NONO_f}' be completed to
-`@t{NONO_foo}' because of the leading underscore or the second
-`@t{NO}' on the line which makes the pattern fail even though they are
-otherwise ignored. To fix this, one would use `@t{B:[nN][oO]=}'
-instead of the first part. As described above, this matches at the
-beginning of the trial completion, independent of other characters or
-substrings at the beginning of the command line word which are ignored
-by the same or other @var{match-spec}s.
+@itemize @bullet
+
+@item
+A brace expression is delimited by a pair of braces (`@t{@{...@}}').
+@item
+Brace expressions do not support negations. That is, an initial
+`@t{!}' or `@t{^}' has no special meaning and will be interpreted as a literal
+character.
+@item
+When a character in the current word matches the @var{n}th pattern in a brace
+expression, the corresponding part of the match pattern is broadened only with
+the @var{n}th pattern of the brace expression on the other side of the `@t{=}',
+if there is one; if there is no brace expression on the other side, then this
+pattern is the empty string. However, if either brace expression has more
+elements than the other, then the excess entries are simply ignored. When
+comparing indexes, each literal character or character class counts as one
+element, but each range is instead expanded to the full list of literal
+characters it represents. Additionally, if on @emph{both} sides of the
+`@t{=}', the @var{n}th pattern is `@t{[:upper:]}' or `@t{[:lower:]}', then these
+are expanded as ranges, too.
+@end itemize
@noindent
-The second example makes completion case insensitive. This is just
-the same as in the option example, except here we wish to retain the
-characters in the list of completions:
+Note that, although the matching system does not yet handle multibyte
+characters, this is likely to be a future extension. Hence, using
+`@t{[:upper:]}' and `@t{[:lower:]}' is recommended over
+`@t{A-Z}' and `@t{a-z}'.
@noindent
-@example
-compadd -M 'm:@{[:lower:]@}=@{[:upper:]@}' ...
-@end example
+Below are the different forms of matchers supported. Each @emph{uppercase} form
+behaves exactly like its lowercase counterpart, but adds an additional step
+@emph{after} the match pattern has filtered out non-matching completions: Each of
+a match's substrings that was matched by a subpattern from an uppercase matcher
+is replaced with the corresponding substring of the current word. However,
+patterns from @emph{lowercase} matchers have higher weight: If a substring of the
+current word was matched by patterns from both a lowercase and an uppercase
+matcher, then the lowercase matcher's pattern wins and the corresponding part
+of the match is not modified.
@noindent
-This makes lower case letters match their upper case counterparts.
-To make upper case letters match the lower case forms as well:
+Unless indicated otherwise, each example listed assumes @t{COMPLETE_IN_WORD} to
+be unset (as it is by default).
@noindent
-@example
-compadd -M 'm:@{[:lower:][:upper:]@}=@{[:upper:][:lower:]@}' ...
-@end example
+@table @asis
+@item @t{m:}@var{word-pat}@t{=}@var{match-pat}
+@itemx @t{M:}@var{word-pat}@t{=}@var{match-pat}
@noindent
-A nice example for the use of @t{*} patterns is partial word
-completion. Sometimes you would like to make strings like `@t{c.s.u}'
-complete to strings like `@t{comp.source.unix}', i.e. the word on the
-command line consists of multiple parts, separated by a dot in this
-example, where each part should be completed separately --- note,
-however, that the case where each part of the word, i.e. `@t{comp}',
-`@t{source}' and `@t{unix}' in this example, is to be completed from
-separate sets of matches
-is a different problem to be solved by the implementation of the
-completion widget. The example can be handled by:
+For each substring of the current word that matches @var{word-pat}, broaden the
+corresponding part of the match pattern to additionally match @var{match-pat}.
@noindent
-@example
-compadd -M 'r:|.=* r:|=*' \
- - comp.sources.unix comp.sources.misc ...
-@end example
+@table @asis
+@item Examples:
@noindent
-The first specification says that @var{lpat} is the empty string, while
-@var{anchor} is a dot; @var{tpat} is @t{*}, so this can match anything
-except for the `@t{.}' from the anchor in
-the trial completion word. So in `@t{c.s.u}', the matcher sees `@t{c}',
-followed by the empty string, followed by the anchor `@t{.}', and
-likewise for the second dot, and replaces the empty strings before the
-anchors, giving `@t{c}[@t{omp}]@t{.s}[@t{ources}]@t{.u}[@t{nix}]', where
-the last part of the completion is just as normal.
+@t{m:@{[:lower:]@}=@{[:upper:]@}} lets any lower case character in the current word
+be completed to itself or its uppercase counterpart. So, the completions
+`@t{foo}', `@t{FOO}' and `@t{Foo}' will are be considered matches for the word
+`@t{fo}'.
@noindent
-With the pattern shown above, the string `@t{c.u}' could not be
-completed to `@t{comp.sources.unix}' because the single star means
-that no dot (matched by the anchor) can be skipped. By using two stars
-as in `@t{r:|.=**}', however, `@t{c.u}' could be completed to
-`@t{comp.sources.unix}'. This also shows that in some cases,
-especially if the anchor is a real pattern, like a character class,
-the form with two stars may result in more matches than one would like.
+@t{M:_=} inserts every underscore from the current word into each match, in the
+same relative position, determined by matching the substrings around it. So,
+given a completion `@t{foo}', the word `@t{f_o}' will be completed to the match
+`@t{f_oo}', even though the latter was not present as a completion.
+
+@end table
+
+@item @t{b:}@var{word-pat}@t{=}@var{match-pat}
+@itemx @t{B:}@var{word-pat}@t{=}@var{match-pat}
+@itemx @t{e:}@var{word-pat}@t{=}@var{match-pat}
+@itemx @t{E:}@var{word-pat}@t{=}@var{match-pat}
@noindent
-The second specification is needed to make this work when the cursor is
-in the middle of the string on the command line and the option
-@t{COMPLETE_IN_WORD} is set. In this case the completion code would
-normally try to match trial completions that end with the string as
-typed so far, i.e. it will only insert new characters at the cursor
-position rather than at the end. However in our example we would like
-the code to recognise matches which contain extra characters after the
-string on the line (the `@t{nix}' in the example). Hence we say that the
-empty string at the end of the string on the line matches any characters
-at the end of the trial completion.
+For each consecutive substring at the @t{b:}eginning or @t{e:}nd of the current
+word that matches @var{word-pat}, broaden the corresponding part of the match
+pattern to additionally match @var{match-pat}.
@noindent
-More generally, the specification
+@table @asis
+@item Examples:
@noindent
-@example
-compadd -M 'r:|[.,_-]=* r:|=*' ...
-@end example
+`@t{b:-=+}' lets any number of minuses at the start of the current word be
+completed to a minus or a plus.
@noindent
-allows one to complete words with abbreviations before any of the
-characters in the square brackets. For example, to
-complete @t{veryverylongfile.c} rather than @t{veryverylongheader.h}
-with the above in effect, you can just type @t{very.c} before attempting
-completion.
+`@t{B:0=}' adds all zeroes at the beginning of the current word to the
+beginning of each match.
+
+@end table
+
+@item @t{l:}@t{|}@var{word-pat}@t{=}@var{match-pat}
+@itemx @t{L:}@t{|}@var{word-pat}@t{=}@var{match-pat}
+@itemx @t{R:}@var{word-pat}@t{|}@t{=}@var{match-pat}
+@itemx @t{r:}@var{word-pat}@t{|}@t{=}@var{match-pat}
@noindent
-The specifications with both a left and a right anchor are useful to
-complete partial words whose parts are not separated by some
-special character. For example, in some places strings have to be
-completed that are formed `@t{LikeThis}' (i.e. the separate parts are
-determined by a leading upper case letter) or maybe one has to
-complete strings with trailing numbers. Here one could use the simple
-form with only one anchor as in:
+If there is a substring at the @t{l:}eft or @t{r:}ight edge of the current word
+that matches @var{word-pat}, then broaden the corresponding part of the match
+pattern to additionally match @var{match-pat}.
@noindent
-@example
-compadd -M 'r:|[[:upper:]0-9]=* r:|=*' LikeTHIS FooHoo 5foo123 5bar234
-@end example
+For each @t{l:}, @t{L:}, @t{r:} and @t{R:} matcher (including the ones below),
+the pattern @var{match-pat} may also be a `@t{*}'. This matches any number of
+characters in a completion.
@noindent
-But with this, the string `@t{H}' would neither complete to `@t{FooHoo}'
-nor to `@t{LikeTHIS}' because in each case there is an upper case
-letter before the `@t{H}' and that is matched by the anchor. Likewise,
-a `@t{2}' would not be completed. In both cases this could be changed
-by using `@t{r:|[[:upper:]0-9]=**}', but then `@t{H}' completes to both
-`@t{LikeTHIS}' and `@t{FooHoo}' and a `@t{2}' matches the other
-strings because characters can be inserted before every upper case
-letter and digit. To avoid this one would use:
+@table @asis
+@item Examples:
@noindent
-@example
-compadd -M 'r:[^[:upper:]0-9]||[[:upper:]0-9]=** r:|=*' \
- LikeTHIS FooHoo foo123 bar234
-@end example
+`@t{r:|=*}' appends a `@t{*}' to the match pattern, even when
+@t{COMPLETE_IN_WORD} is set and the cursor is not at the end of the current
+word.
+
+@noindent
+If the current word starts with a minus, then `@t{L:|-=}' will prepend it to
+each match.
+
+@end table
+
+@item @t{l:}@var{anchor}@t{|}@var{word-pat}@t{=}@var{match-pat}
+@itemx @t{L:}@var{anchor}@t{|}@var{word-pat}@t{=}@var{match-pat}
+@itemx @t{r:}@var{word-pat}@t{|}@var{anchor}@t{=}@var{match-pat}
+@itemx @t{R:}@var{word-pat}@t{|}@var{anchor}@t{=}@var{match-pat}
+
+@noindent
+For each substring of the current word that matches @var{word-pat} and has on
+its @t{l:}eft or @t{r:}ight another substring matching @var{anchor}, broaden the
+corresponding part of the match pattern to additionally match @var{match-pat}.
+
+@noindent
+Note that these matchers (and the ones below) modify only what is matched by
+@var{word-pat}; they do not change the matching behavior of what is matched by
+@var{anchor} (or @var{coanchor}; see the matchers below). Thus, unless its
+corresponding part of the match pattern has been modified, the anchor in the
+current word has to match literally in each completion, just like any other
+substring of the current word.
+
+@noindent
+If a matcher includes at least one anchor (which includes the matchers with two
+anchors, below), then @var{match-pat} may also be `@t{*}' or `@t{**}'. `@t{*}'
+can match any part of a completion that does not contain any substrings
+matching @var{anchor}, whereas a `@t{**}' can match any part of a completion,
+period. (Note that this is different from the behavior of `@t{*}' in the
+anchorless forms of `@t{l:}' and `@t{r:}' and and also different from `@t{*}'
+and `@t{**}' in glob expressions.)
@noindent
-By using these two anchors, a `@t{H}' matches only upper case `@t{H}'s that
-are immediately preceded by something matching the left anchor
-`@t{[^[:upper:]0-9]}'. The effect is, of course, that `@t{H}' matches only
-the string `@t{FooHoo}', a `@t{2}' matches only `@t{bar234}' and so on.
+@table @asis
+@item Examples:
@noindent
-When using the completion system (see
-@ref{Completion System}), users can define match specifications that are to be used for
-specific contexts by using the @t{matcher} and @t{matcher-list}
-styles. The values for the latter will be used everywhere.
+`@t{r:|.=*}' makes the completion `@t{comp.sources.unix}' a match for the word
+`@t{..u}' --- but @emph{not} for the word `@t{.u}'.
+
+@noindent
+Given a completion `@t{-}@t{-foo}', the matcher `@t{L:--|no-=}' will complete
+the word `@t{-}@t{-no-}' to the match `@t{-}@t{-no-foo}'.
+
+@end table
+
+@item @t{l:}@var{anchor}@t{||}@var{coanchor}@t{=}@var{match-pat}
+@itemx @t{L:}@var{anchor}@t{||}@var{coanchor}@t{=}@var{match-pat}
+@itemx @t{r:}@var{coanchor}@t{||}@var{anchor}@t{=}@var{match-pat}
+@itemx @t{R:}@var{coanchor}@t{||}@var{anchor}@t{=}@var{match-pat}
+
+@noindent
+For any two consecutive substrings of the current word that match @var{anchor}
+and @var{coanchor}, in the order given, insert the pattern @var{match-pat}
+between their corresponding parts in the match pattern.
+
+@noindent
+Note that, unlike @var{anchor}, the pattern @var{coanchor} does not change what
+`@t{*}' can match.
+
+@noindent
+@table @asis
+@item Examples:
+
+@noindent
+`@t{r:?||[[:upper:]]=*}' will complete the current word `@t{fB}' to
+`@t{fooBar}', but it will not complete it to `@t{fooHooBar}' (because `@t{*}'
+here cannot match anything that includes a match for `@t{[[:upper:]]}), nor
+will it complete `@t{B}' to `@t{fooBar}' (because there is no character in the
+current word to match @var{coanchor}).
+
+@noindent
+Given the current word `@t{pass.n}' and a completion `@t{pass.byname}', the
+matcher `@t{L:.||[[:alpha:]]=by}' will produce the match `@t{pass.name}'.
+
+@end table
+
+@item @t{x:}
+
+@noindent
+Ignore this matcher and all matchers to its right.
+
+@noindent
+This matcher is used to mark the end of a match specification. In a single
+standalone list of matchers, this has no use, but where match specifications
+are concatenated, as is often the case when using the
+@ref{Completion System}, it can allow one match specification to override another.
+
+@end table
@noindent
@node Completion Widget Example, , Completion Matching Control, Completion Widgets
@@ -20310,7 +20533,7 @@ complete-files () @{ compadd - * @}
@end example
@noindent
-This function will complete files in the current directory matching the
+This function will complete files in the current directory matching the
current word.
@c (avoiding a yodl bug)
@c Yodl file: Zsh/compsys.yo
@@ -20537,7 +20760,7 @@ root or by the current user. If such files or directories are found,
avoid these tests and make all files found be used without asking, use the
option @t{-u}, and to make @t{compinit} silently ignore all insecure files
and directories use the option @t{-i}. This security check is skipped
-entirely when the @t{-C} option is given.
+entirely when the @t{-C} option is given, provided the dumpfile exists.
@noindent
@findex compaudit
@@ -20688,15 +20911,15 @@ The special contexts for which completion functions can be defined are:
The right hand side of an array-assignment
(`@var{name}@t{=(}@var{...}@t{)}')
-@kindex -brace-parameter-, completion context
-@item @t{-brace-parameter-}
-The name of a parameter expansion within braces (`@t{$@{}@var{...}@t{@}}')
-
@kindex -assign-parameter-, completion context
@item @t{-assign-parameter-}
The name of a parameter in an assignment, i.e. on the left hand side of
an `@t{=}'
+@kindex -brace-parameter-, completion context
+@item @t{-brace-parameter-}
+The name of a parameter expansion within braces (`@t{$@{}@var{...}@t{@}}')
+
@kindex -command-, completion context
@item @t{-command-}
A word in command position
@@ -21089,8 +21312,8 @@ described in
When looking up styles the completion system uses full context names,
including the tag. Looking up the value of a style therefore consists of
two things: the context, which is matched to the most specific (best
-fitting) style pattern, and the name of the style itself, which must be
-matched exactly. The following examples demonstrate that style patterns
+fitting) pattern, and the name of the style itself, which must be
+matched exactly. The following examples demonstrate that patterns
may be loosely defined for styles that apply broadly, or as tightly
defined as desired for styles that apply in narrower circumstances.
@@ -21109,7 +21332,7 @@ zstyle ':completion:*' verbose yes
in a startup file (probably @t{.zshrc}).
This gives the @t{verbose} style the value @t{yes} in every
context inside the completion system, unless that context has a more
-specific definition. It is best to avoid giving the context as `@t{*}'
+specific definition. It is best to avoid giving the pattern as `@t{*}'
in case the style has some meaning outside the completion system.
@noindent
@@ -21159,16 +21382,22 @@ as @t{menu} and @t{list-rows-first}.
@noindent
Note that the order in which styles are @emph{defined} does not matter; the
style mechanism uses the most specific possible match for a particular
-style to determine the set of values. More precisely, strings are
+style to determine the set of values. Strings are
preferred over patterns (for example, `@t{:completion::complete:::foo}' is
more specific than `@t{:completion::complete:::*'}), and longer patterns are
-preferred over shorter patterns.
+preferred over the pattern `@t{*}'. See
+@ref{The zsh/zutil Module}
+for details.
@noindent
-A good rule of thumb is that any completion style pattern that needs to
-include more than one wildcard (@t{*}) and that does not end in a tag
-name, should include all six colons (@t{:}), possibly surrounding
-additional wildcards.
+Context patterns that use something other than a wildcard (@t{*}) to match the
+middle parts of the context --- the @var{completer}, @var{command}, and
+@var{argument} in
+@t{:completion:}@var{function}@t{:}@var{completer}@t{:}@var{command}@t{:}@var{argument}@t{:}@var{tag}
+--- should include all six colons (@t{:}) explicitly. Without this,
+a pattern such as @t{:completion:*:foo:*} could match @t{foo} against a
+component other than the intended one (for example, against @var{completer} when
+a match against @var{command} was intended).
@noindent
Style names like those of tags are arbitrary and depend on the completion
@@ -21341,14 +21570,14 @@ for hostnames
@item @t{indexes}
for array indexes
-@kindex jobs, completion tag
-@item @t{jobs}
-for jobs (as listed by the `@t{jobs}' builtin)
-
@kindex interfaces, completion tag
@item @t{interfaces}
for network interfaces
+@kindex jobs, completion tag
+@item @t{jobs}
+for jobs (as listed by the `@t{jobs}' builtin)
+
@kindex keymaps, completion tag
@item @t{keymaps}
for names of zsh keymaps
@@ -21372,14 +21601,14 @@ directory when completing arguments of @t{cd} and related builtin
commands (compare @t{path-directories}) --- when the @t{cdpath}
array is unset, @t{directories} is used instead
-@kindex manuals, completion tag
-@item @t{manuals}
-for names of manual pages
-
@kindex mailboxes, completion tag
@item @t{mailboxes}
for e-mail folders
+@kindex manuals, completion tag
+@item @t{manuals}
+for names of manual pages
+
@kindex maps, completion tag
@item @t{maps}
for map names (e.g. NIS maps)
@@ -21429,11 +21658,6 @@ offering the original string as a match
@item @t{other-accounts}
used to look up the @t{users-hosts} style
-@kindex other-files, completion tag
-@item @t{other-files}
-for the names of any non-directory files. This is used instead
-of @t{all-files} when the @t{list-dirs-first} style is in effect.
-
@kindex packages, completion tag
@item @t{packages}
for packages (e.g. @t{rpm} or installed @t{Debian} packages)
@@ -21871,6 +22095,12 @@ components after the first ambiguous one will also be added. This means
that the resulting string is the longest unambiguous string possible.
However, menu completion can be used to cycle through all matches.
+@kindex extra-verbose, completion style
+@item @t{extra-verbose}
+If set, the completion listing is more verbose at the cost of
+a probable decrease in completion speed. Completion performance
+will suffer if this style is set to `true'.
+
@kindex fake, completion style
@item @t{fake}
This style may be set for any completion context. It
@@ -22030,9 +22260,10 @@ If no `@t{:}@var{tag}' is given the `@t{files}' tag will be used.
The @var{tag} may also be followed by an optional second colon and a
description, which will be used for the `@t{%d}' in the value of
the @t{format} style (if that is set) instead of the default
-description supplied by the completion function. If the description
-given here contains itself a `@t{%d}', that is replaced with the
-description supplied by the completion function.
+description supplied by the completion function. The inclusion
+of a description also gives precedence to associated options such as
+for completion grouping so it can be used where files should be
+separated.
@noindent
For example, to make the @t{rm} command first complete only names of
@@ -22064,6 +22295,19 @@ sees this pattern. Note also it will never try a pattern more than once
for a single completion attempt.
@noindent
+To separate directories into a separate group from the files but still
+complete them at the first attempt, a description needs to be given.
+Note that directories need to be explicitly excluded from the
+globbed-files because `@t{*}' will match directories. For grouping, it
+is also necessary to set the @t{group-name} style.
+
+@noindent
+@example
+zstyle ':completion:*' file-patterns \
+ '%p(^-/):globbed-files *(-/):directories:location'
+@end example
+
+@noindent
During the execution of completion functions, the @t{EXTENDED_GLOB}
option is in effect, so the characters `@t{#}', `@t{~}' and `@t{^}' have
special meanings in the patterns.
@@ -22160,6 +22404,15 @@ and similar escape sequences. This is handled by the @t{zformat}
builtin command from the @t{zsh/zutil} module, see
@ref{The zsh/zutil Module}.
+@kindex gain-privileges, completion style
+@item @t{gain-privileges}
+If set to @t{true}, this style enables the use of commands like @t{sudo}
+or @t{doas} to gain extra privileges when retrieving information for
+completion. This is only done when a command such as @t{sudo} appears on
+the command-line. To force the use of, e.g. @t{sudo} or to override any
+prefix that might be added due to @t{gain-privileges}, the @t{command}
+style can be used with a value that begins with a hyphen.
+
@kindex glob, completion style
@item @t{glob}
This is used by the @t{_expand} completer. If
@@ -22208,6 +22461,10 @@ zstyle ':completion:*' group-name @value{dsq}
All matches for which no group name is defined will be put in a group
named @t{-default-}.
+@noindent
+To display the group name in the output, see the @t{format} style (q.v.)
+under the @t{descriptions} tag.
+
@kindex group-order, completion style
@item @t{group-order}
This style is additional to the @t{group-name} style to specify the
@@ -22323,12 +22580,6 @@ Excluded values act in a similar fashion to values of the
@t{ignored-patterns} style, so they can be restored to consideration by
the @t{_ignored} completer.
-@kindex extra-verbose, completion style
-@item @t{extra-verbose}
-If set, the completion listing is more verbose at the cost of
-a probable decrease in completion speed. Completion performance
-will suffer if this style is set to `true'.
-
@kindex ignored-patterns, completion style
@item @t{ignored-patterns}
A list of patterns; any trial completion matching one of the patterns
@@ -22367,6 +22618,35 @@ be unsuccessful until that point. If the value is any other
string, menu completion will be started when the string typed by the
user is longer than the common prefix to the corresponding IDs.
+@kindex insert-sections, completion style
+@item @t{insert-sections}
+This style is used with tags of the form `@t{manuals.}@var{X}' when
+completing names of manual pages. If set and the @var{X} in the tag name matches
+the section number of the page being completed, the section number is inserted
+along with the page name. For example, given
+
+@noindent
+@example
+zstyle ':completion:*:manuals.*' insert-sections true
+@end example
+
+@noindent
+@t{man ssh_<TAB>} may be completed to @t{man 5 ssh_config}.
+
+@noindent
+The value may also be set to one of `@t{prepend}', or `@t{suffix}'.
+`@t{prepend}' behaves the same as `true' as in the above example, while
+`@t{suffix}' would complete @t{man ssh_<TAB>} as @t{man ssh_config.5}.
+
+@noindent
+This is especially useful in conjunction with @t{separate-sections}, as
+it ensures that the page requested of @t{man} corresponds to the one
+displayed in the completion listing when there are multiple pages with the
+same name (e.g., @t{printf(1)} and @t{printf(3)}).
+
+@noindent
+The default for this style is `false'.
+
@kindex insert-tab, completion style
@item @t{insert-tab}
If this is set to `true', the completion system will
@@ -22409,15 +22689,6 @@ In the case of the @t{_match} completer, the style may also be set to
the string `@t{pattern}'. Then the pattern on the line is left
unchanged if it does not match unambiguously.
-@kindex gain-privileges, completion style
-@item @t{gain-privileges}
-If set to @t{true}, this style enables the use of commands like @t{sudo}
-or @t{doas} to gain extra privileges when retrieving information for
-completion. This is only done when a command such as @t{sudo} appears on
-the command-line. To force the use of, e.g. @t{sudo} or to override any
-prefix that might be added due to @t{gain-privileges}, the @t{command}
-style can be used with a value that begins with a hyphen.
-
@kindex keep-prefix, completion style
@item @t{keep-prefix}
This style is used by the @t{_expand} completer. If it is `true', the
@@ -22434,6 +22705,13 @@ The behaviour of @t{_expand} when this style is `true' is to cause @t{_expand}
to give up when a single expansion with the restored prefix is the same
as the original; hence any remaining completers may be called.
+@kindex known-hosts-files
+@item @t{known-hosts-files}
+This style should contain a list of files to search for host names and
+(if the @t{use-ip} style is set) IP addresses in a format compatible with
+ssh @t{known_hosts} files. If it is not set, the files
+@t{/etc/ssh/ssh_known_hosts} and @t{~/.ssh/known_hosts} are used.
+
@kindex last-prompt, completion style
@item @t{last-prompt}
This is a more flexible form of the @t{ALWAYS_LAST_PROMPT} option.
@@ -22445,13 +22723,6 @@ previous line if this style is `true' for all types of match. Note
that unlike the @t{ALWAYS_LAST_PROMPT} option this is independent of the
numeric argument.
-@kindex known-hosts-files
-@item @t{known-hosts-files}
-This style should contain a list of files to search for host names and
-(if the @t{use-ip} style is set) IP addresses in a format compatible with
-ssh @t{known_hosts} files. If it is not set, the files
-@t{/etc/ssh/ssh_known_hosts} and @t{~/.ssh/known_hosts} are used.
-
@kindex list, completion style
@item @t{list}
This style is used by the @t{_history_complete_word} bindable command.
@@ -22496,11 +22767,10 @@ obtained by setting the style to an empty string (i.e. @t{@value{dsq}}).
@kindex list-dirs-first, completion style
@item @t{list-dirs-first}
-This is used by file completion. If set, directories to be completed
-are listed separately from and before completion for other files,
-regardless of tag ordering. In addition, the tag @t{other-files}
-is used in place of @t{all-files} for the remaining files, to indicate
-that no directories are presented with that tag.
+This is used by file completion and corresponds to a particular
+setting of the @t{file-patterns} style.
+If set, the default directories to be completed
+are listed separately from and before completion for other files.
@kindex list-grouped, completion style
@item @t{list-grouped}
@@ -22555,6 +22825,12 @@ This style is tested in the same way as the @t{list-packed} style and
determines whether matches are to be listed in a rows-first fashion as
if the @t{LIST_ROWS_FIRST} option were set.
+@kindex list-separator, completion style
+@item @t{list-separator}
+The value of this style is used in completion listing to separate the
+string to complete from a description when possible (e.g. when
+completing options). It defaults to `@t{-}@t{-}' (two hyphens).
+
@kindex list-suffixes, completion style
@item @t{list-suffixes}
This style is used by the function that completes filenames. If it is
@@ -22562,12 +22838,6 @@ This style is used by the function that completes filenames. If it is
typed pathname components, all ambiguous components will be shown.
Otherwise, completion stops at the first ambiguous component.
-@kindex list-separator, completion style
-@item @t{list-separator}
-The value of this style is used in completion listing to separate the
-string to complete from a description when possible (e.g. when
-completing options). It defaults to `@t{-}@t{-}' (two hyphens).
-
@kindex local, completion style
@item @t{local}
This is for use with functions that complete URLs for which the
@@ -23059,7 +23329,7 @@ zstyle ':completion:*' recursive-files '*/zsh/*'
@noindent
If the current directory is @t{/home/pws/zsh/Src}, then
-@t{zle_tr}@emph{TAB} can be completed to @t{Zle/zle_tricky.c}.
+@t{zle_tr<TAB>} can be completed to @t{Zle/zle_tricky.c}.
@kindex regular, completion style
@item @t{regular}
@@ -23117,12 +23387,14 @@ The default is to scroll by single lines.
@item @t{separate-sections}
This style is used with the @t{manuals} tag when completing names of
manual pages. If it is `true', entries for different sections are
-added separately using tag names of the form `@t{manual.}@var{X}',
+added separately using tag names of the form `@t{manuals.}@var{X}',
where @var{X} is the section number. When the @t{group-name} style is
also in effect, pages from different sections will appear separately.
This style is also used similarly with the @t{words} style when
completing words for the dict command. It allows words from different
-dictionary databases to be added separately.
+dictionary databases to be added separately. See also @t{insert-sections}.
+
+@noindent
The default for this style is `false'.
@kindex show-ambiguity, completion style
@@ -24349,8 +24621,19 @@ described using the @var{spec}s which are of the form:
`@var{tag}@t{:}@var{descr}@t{:}@var{action}'. The @var{tag}s are offered using
@t{_tags} and if the tag is requested, the @var{action} is executed with the
given description @var{descr}. The @var{action}s are those accepted
-by the @t{_arguments} function (described below), excluding the
-`@t{->}@var{state}' and `@t{=}@var{...}' forms.
+by the @t{_arguments} function (described below), with the following
+exceptions:
+@itemize @bullet
+
+@item
+The `@t{->}@var{state}' and `@t{=}@var{...}' forms are not supported.
+
+@item
+The `@t{((a\:bar b\:baz}@t{))}' form does not need
+the colon to be escaped, since the @var{spec}s have no colon-separated fields
+after the @var{action}.
+
+@end itemize
@noindent
For example, the @var{action} may be a simple function call:
@@ -24502,6 +24785,12 @@ The default @var{matchspec} allows partial word completion after `@t{_}' and
@t{r:|[_-]=* r:|=*}
@end example
+@item @t{-0}
+When populating values of the `@t{opt_args}' associative array, don't
+backslash-escape colons and backslashes and use NUL rather than colon for
+joining multiple values. This option is described in more detail below, under
+the heading @emph{@var{spec}s: actions}.
+
@end table
@noindent
@@ -24695,6 +24984,7 @@ used, and on subsequent calls `@t{_arguments !$^global_options}'.
@noindent
@emph{@var{spec}s: actions}
+
@noindent
In each of the forms above the @var{action} determines how
completions should be generated. Except for the `@t{->}@var{string}'
@@ -24836,9 +25126,29 @@ the normal arguments from the command line, i.e. the words from the
command line after the command name excluding all options and their
arguments. Options are stored in the associative array
`@t{opt_args}' with option names as keys and their arguments as
-the values. For options that have more than one argument these are
-given as one string, separated by colons. All colons and backslashes
-in the original arguments are preceded with backslashes.
+the values. By default, all colons and backslashes in the value are escaped
+with backslashes, and if an option has multiple arguments (for example, when
+using an @var{optspec} of the form `@t{*}@var{optspec}'), they are joined with
+(unescaped) colons. However, if the @t{-0} option was passed, no backslash
+escaping is performed, and multiple values are joined with NUL bytes. For
+example, after `@t{zsh -o foo:foo -o bar:bar -o <TAB>}', the contents of
+`@t{opt_args}' would be
+
+@noindent
+@example
+typeset -A opt_args=( [-o]='foo\:foo:bar\:bar:' )
+@end example
+
+@noindent
+by default, and
+
+@noindent
+@example
+typeset -A opt_args=( [-o]=$'foo:foo\x00bar:bar\x00' )
+@end example
+
+@noindent
+if @t{_arguments} had been called with the @t{-0} option.
@noindent
The parameter `@t{context}' is set when returning to the calling function
@@ -25112,7 +25422,7 @@ The last two descriptions say what should be completed as
arguments. The first describes the first argument as a
`@var{postscript file}' and makes files ending in `@t{ps}' or `@t{eps}'
be completed. The last description gives all other arguments the
-description `@var{page numbers}' but does not offer completions.
+description `@var{page number}' but does not offer completions.
@findex _cache_invalid
@item @t{_cache_invalid} @var{cache_identifier}
@@ -25253,6 +25563,15 @@ Include the leading underscore (`@t{_}') in the matches.
@end table
+@findex _default
+@item @t{_default}
+This function corresponds to the @t{-default-} special context which is
+applied where no completion is defined. It is useful to call it under
+certain error conditions such as completion after an unrecognised
+subcommand. This applies the concept of graceful degradation to the
+completion system, allowing it to fallback on basic completion of
+commonly useful things like filenames.
+
@findex _describe
@item @t{_describe }[@t{-12JVx}] [ @t{-oO} | @t{-t} @var{tag} ] @var{descr} @var{name1} [ @var{name2} ] [ @var{opt} ... ]
@@ -25336,8 +25655,26 @@ not contain an explanation string to be displayed above the matches.
If @t{_description} is called with more than three arguments,
the additional @var{spec}s should be of the form `@var{char}@t{:}@var{str}'.
These supply escape sequence replacements for the @t{format} style:
-every appearance of `@t{%}@var{char}' will be
-replaced by @var{string}.
+every appearance of `@t{%}@var{char}' will be replaced by @var{string}.
+If no additional @var{spec}s are given but the description in @var{descr}
+conforms to a common form then further escape sequences are set for
+elements of that description. These elements correspond to a default
+value (`@t{%o}'), the units (`@t{%m}') range of acceptable values
+(`@t{%r}') and the remaining initial part of the description (`@t{%h}').
+The form the description takes consists of specifying the units and
+range in parentheses and the default value in square brackets, for
+example:
+
+@noindent
+@example
+_description times expl 'timeout (seconds) (0-60) [20]'
+@end example
+
+@noindent
+It is possible to use @t{zformat} conditional expressions when styling
+these elements. So, for example, to add `@t{default:}' as a tag but only
+when there is a default value to show, the @t{format} style might
+include `@t{%(o.default: %o.)}'.
@noindent
If the @t{-x} option is given, the description will be passed to
@@ -25653,6 +25990,81 @@ checked. If it is set completion is terminated at that point even if
no matches have been found. This is the same effect as in the
@t{-first-} context.
+@findex _numbers
+@item @t{_numbers} [ @var{option} ... ] [ @var{description} ] [ @var{suffix} ... ]
+This can be used where a number is followed by a suffix to indicate the units.
+The unit suffixes are completed and can also be included in the description
+used when completion is invoked for the preceding number.
+
+@noindent
+In addition to common @t{compadd} options, @t{_numbers} accepts the following
+options:
+
+@noindent
+@table @asis
+@item @t{-t} @var{tag}
+Specify a tag to use instead of the default of @t{numbers}.
+
+@item @t{-u} @var{units}
+Indicate the default units for the number, e.g. @t{bytes}.
+
+@item @t{-l} @var{min}
+Specify the lowest possible value for the number.
+
+@item @t{-m} @var{max}
+Specify the highest possible value for the number.
+
+@item @t{-d} @var{default}
+Specify the default value.
+
+@item @t{-N}
+Allow negative numbers. This is implied if the range includes a negative.
+
+@item @t{-f}
+Allow decimal numbers.
+
+@end table
+
+@noindent
+Where a particular suffix represents the default units for a number, it
+should be prefixed with a colon. Additionally, suffixes can be followed
+by a colon and a description. So for example, the following allows the
+age of something to be specified, either in seconds or with an optional
+suffix with a longer unit of time:
+
+@noindent
+@example
+_numbers -u seconds age :s:seconds m:minutes h:hours d:days
+@end example
+
+@noindent
+It is typically helpful for units to be presented in order of magnitude
+when completed. To facilitate this, the order in which they are given
+is preserved.
+
+@noindent
+When the @t{format} style is looked up with the @t{descriptions} tag or
+the tag specified with @t{-t}, the list of suffixes is available as a
+`@t{%x}' escape sequence. This is in addition to the usual sequences
+documented under the @t{format} style. The form this list takes can also
+be configured. To this end, the @t{format} style is first looked up with
+the tag @t{unit-suffixes}. The retrieved format is applied to each
+suffix in turn and the results are then concatenated to form the
+completed list. For the @t{unit-suffixes} format, `@t{%x}' expands to
+the individual suffix and `@t{%X}' to its description. @t{%d}' indicates
+a default suffix and can be used in a condition. The index and reverse
+index are set in `@t{%i}' and `@t{%r}' respectively and are useful for
+text included only with the first and last suffixes in the list. So for
+example, the following joins the suffixes together as a comma-separated
+list:
+
+@noindent
+@example
+zstyle ':completion:*:unit-suffixes' format '%x%(r::,)'
+@end example
+
+
+@noindent
@findex _options
@item @t{_options}
This can be used to complete the names of shell options. It provides a
@@ -26288,10 +26700,14 @@ matches with the given description:
@example
local expl
_wanted tag expl 'description' \
- compadd matches...
+ compadd -- @var{match1} @var{match2}...
@end example
@noindent
+See also the use of @t{_wanted} in the example function in
+@ref{Dynamic named directories}.
+
+@noindent
Note that, as for @t{_requested}, the @var{command} must be able to
accept options to be passed down to @t{compadd}.
@@ -26334,8 +26750,6 @@ in the @t{_comp_caller_options} associative array. Option names, spelled
in lowercase without underscores, are mapped to one or other of the
strings `@t{on}' and `@t{off}'.
-
-@noindent
@item @t{_comp_priv_prefix}
Completion functions such as @t{_sudo} can set the @t{_comp_priv_prefix}
array to a command prefix that may then be used by @t{_call_program} to
@@ -26344,6 +26758,8 @@ match the privileges when calling programs to generate matches.
@end table
@noindent
+@vindex compprefuncs, use of
+@vindex comppostfuncs, use of
Two more features are offered by the @t{_main_complete} function. The
arrays @t{compprefuncs} and @t{comppostfuncs} may contain
names of functions that are to be called immediately before or after
@@ -27288,6 +27704,9 @@ Interface to the termcap database.
@item @t{zsh/terminfo}
Interface to the terminfo database.
+@item @t{zsh/watch}
+Reporting of login and logout events.
+
@item @t{zsh/zftp}
A builtin FTP client.
@@ -27342,6 +27761,7 @@ styles.
* The zsh/net/tcp Module::
* The zsh/termcap Module::
* The zsh/terminfo Module::
+* The zsh/watch Module::
* The zsh/zftp Module::
* The zsh/zle Module::
* The zsh/zleparameter Module::
@@ -28252,7 +28672,7 @@ input. This is only available with the ncurses library; mouse handling
can be detected by checking for the exit status of `@t{zcurses mouse}' with
no arguments. If a mouse
button is clicked (or double- or triple-clicked, or pressed or released with
-a configurable delay from being clicked) then @t{kparam} is set to the string
+a configurable delay from being clicked) then @var{kparam} is set to the string
@t{MOUSE}, and @var{mparam} is set to an array consisting of the
following elements:
@table @asis
@@ -28395,18 +28815,21 @@ The @t{zsh/datetime} module makes available one builtin command:
@table @asis
@findex strftime
@cindex date string, printing
-@item @t{strftime} [ @t{-s} @var{scalar} ] @var{format} [ @var{epochtime} [ @var{nanoseconds} ] ]
-@itemx @t{strftime} @t{-r} [ @t{-q} ] [ @t{-s} @var{scalar} ] @var{format} @var{timestring}
+@item @t{strftime} [ @t{-s} @var{scalar} | @t{-n} ] @var{format} [ @var{epochtime} [ @var{nanoseconds} ] ]
+@itemx @t{strftime} @t{-r} [ @t{-q} ] [ @t{-s} @var{scalar} | @t{-n} ] @var{format} @var{timestring}
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 man page strftime(3) for details. The zsh extensions described in
+See strftime(3) for details. The zsh extensions described in
@ref{Prompt Expansion} are also available.
@noindent
@table @asis
+@item @t{-n}
+Suppress printing a newline after the formatted string.
+
@item @t{-q}
Run quietly; suppress printing of all error messages described below.
Errors for invalid @var{epochtime} values are always printed.
@@ -28415,7 +28838,7 @@ Errors for invalid @var{epochtime} values are always printed.
With the option @t{-r} (reverse), use @var{format} to parse the input
string @var{timestring} and output the number of seconds since the epoch at
which the time occurred. The parsing is implemented by the system
-function @t{strptime}; see man page strptime(3). This means that zsh
+function @t{strptime}; see strptime(3). This means that zsh
format extensions are not available, but for reverse lookup they are not
required.
@@ -28758,7 +29181,7 @@ directories are first created if necessary, and there will be
no complaint if the directory already exists.
The @t{-m} option can be used to specify (in octal) a set of file permissions
for the created directories, otherwise mode 777 modified by the current
-@t{umask} (see man page umask(2)) is used.
+@t{umask} (see umask(2)) is used.
@findex mv
@item @t{mv} [ @t{-fi} ] @var{filename} @var{dest}
@@ -28790,7 +29213,7 @@ Removes files and directories specified.
@noindent
Normally, @t{rm} will not remove directories (except with the @t{-R} or @t{-r}
options). The @t{-d} option causes @t{rm} to try removing directories
-with @t{unlink} (see man page unlink(2)), the same method used for files.
+with @t{unlink} (see unlink(2)), the same method used for files.
Typically only the super-user can actually succeed in unlinking
directories in this way.
@t{-d} takes precedence over @t{-R} and @t{-r}.
@@ -28807,7 +29230,7 @@ silently deleted, without querying, and suppresses all error indications.
@noindent
The @t{-R} and @t{-r} options cause @t{rm} to recursively descend into
directories, deleting all files in the directory before removing the directory
-with the @t{rmdir} system call (see man page rmdir(2)).
+with the @t{rmdir} system call (see rmdir(2)).
@noindent
The @t{-s} option is a zsh extension to @t{rm} functionality. It enables
@@ -28826,7 +29249,7 @@ Removes empty directories specified.
@findex sync
@item @t{sync}
-Calls the system call of the same name (see man page sync(2)), which
+Calls the system call of the same name (see sync(2)), which
flushes dirty buffers to disk. It might return before the I/O has
actually been completed.
@@ -28896,7 +29319,7 @@ value is the content of the file. The value is treated identically to any
other text coming from a parameter. The value may also be assigned to, in
which case the file in question is written (whether or not it originally
existed); or an element may be unset, which will delete the file in
-question. For example, `@t{vared mapfile[myfile]}' works as expected,
+question. For example, `@t{vared 'mapfile[myfile]'}' works as expected,
editing the file `@t{myfile}'.
@noindent
@@ -28992,7 +29415,7 @@ returns an integer.
@noindent
The function @t{signgam} takes no arguments, and returns an integer, which
-is the C variable of the same name, as described in man page gamma(3). Note
+is the C variable of the same name, as described in gamma(3). Note
that it is therefore only useful immediately after a call to @t{gamma} or
@t{lgamma}. Note also that `@t{signgam()}' and `@t{signgam}' are
distinct expressions.
@@ -29341,6 +29764,9 @@ and these are the values output with, for example, @t{$@{(k)jobdirs@}}.
Non-numeric job references may be used when looking up a value;
for example, @t{$@{jobdirs[%+]@}} refers to the current job.
+@noindent
+See the @t{jobs} builtin for how job information is provided in a subshell.
+
@vindex jobtexts
@item @t{jobtexts}
This associative array maps job numbers to the texts of the command lines
@@ -29350,6 +29776,9 @@ that were used to start the jobs.
Handling of the keys of the associative array is as described for
@t{jobdirs} above.
+@noindent
+See the @t{jobs} builtin for how job information is provided in a subshell.
+
@vindex jobstates
@item @t{jobstates}
This associative array gives information about the states of the jobs
@@ -29367,6 +29796,9 @@ the @var{state} describes the state of that process.
Handling of the keys of the associative array is as described for
@t{jobdirs} above.
+@noindent
+See the @t{jobs} builtin for how job information is provided in a subshell.
+
@vindex nameddirs
@item @t{nameddirs}
This associative array maps the names of named directories to the pathnames
@@ -29564,12 +29996,17 @@ This module provides a single autoloaded builtin:
@table @asis
@findex private
@cindex private parameter, creating
-@item @t{private} [ @{@t{+}|@t{-}@}@t{AHUahlprtux} ] [ @{@t{+}|@t{-}@}@t{EFLRZi} [ @var{n} ] ] [ @var{name}[@t{=}@var{value}] ... ]
+@item @t{private} [ @{@t{+}|@t{-}@}@t{AHUahlmrtux} ] [ @{@t{+}|@t{-}@}@t{EFLRZi} [ @var{n} ] ] [ @var{name}[@t{=}@var{value}] ... ]
The @t{private} builtin accepts all the same options and arguments as @t{local}
(@ref{Shell Builtin Commands}) except
for the `@t{-}@t{T}' option. Tied parameters may not be made private.
@noindent
+The `@t{-}@t{p}' option is presently a no-op because the state of
+private parameters cannot reliably be reloaded. This also applies
+to printing private parameters with `@t{typeset -p}'.
+
+@noindent
If used at the top level (outside a function scope), @t{private} creates a
normal parameter in the same manner as @t{declare} or @t{typeset}. A
warning about this is printed if @t{WARN_CREATE_GLOBAL} is set
@@ -29646,7 +30083,8 @@ Within any other function called by the declaring function, the
private parameter does @emph{NOT} hide other parameters of the same name, so
for example a global parameter of the same name is visible and may be
assigned or unset. This includes calls to anonymous functions, although
-that may also change in the future.
+that may also change in the future. However, the private name may not be
+created outside the local scope when it was not previously declared.
@item
An exported private remains in the environment of inner scopes but
appears unset for the current shell in those scopes. Generally, exporting
@@ -29700,6 +30138,21 @@ automatically load this module as needed and will invoke the
If @t{BASH_REMATCH} is set, then the array @t{BASH_REMATCH} will be set
instead of @t{MATCH} and @t{match}.
+@noindent
+Note that the @t{zsh/regex} module logic relies on the host system. The
+same @var{expr} and @var{regex} pair could produce different results on different
+platforms if a @var{regex} with non-standard syntax is given.
+
+@noindent
+For example, no syntax for matching a word boundary is defined in the POSIX
+extended regular expression standard. GNU @t{libc} and BSD @t{libc} both provide
+such syntaxes as extensions (@t{\b} and @t{[[:<:]]}/@t{[[:>:]]} respectively),
+but neither of these syntaxes is supported by both of these implementations.
+
+@noindent
+Refer to the regcomp(3) and re_format(7) manual pages on your
+system for locally-supported syntax.
+
@end table
@c (avoiding a yodl bug)
@node The zsh/sched Module, The zsh/net/socket Module, The zsh/regex Module, Zsh Modules
@@ -29900,7 +30353,7 @@ two possible names:
@itemx @t{@ @ @ @ @ @ }[ @t{+}@var{element} ] [ @var{file} ... ]
@itemx @t{stat} @var{...}
The command acts as a front end to the @t{stat} system call (see
-man page stat(2)). The same command is provided with two names; as
+stat(2)). The same command is provided with two names; as
the name @t{stat} is often used by an external command it is recommended
that only the @t{zstat} form of the command is used. This can be
arranged by loading the module with the command `@t{zmodload -F zsh/stat
@@ -30002,10 +30455,12 @@ Use the file on file descriptor @var{fd} instead of
named files; no list of file names is allowed in this case.
@item @t{-F} @var{fmt}
-Supplies a @t{strftime} (see man page strftime(3)) string for the
+Supplies a @t{strftime} (see strftime(3)) string for the
formatting of the time elements. The format string supports all of the
zsh extensions described in
@ref{Prompt Expansion}.
+In particular, @t{-F %s.%N} can be used to show timestamps with nanosecond
+precision if supported by the system.
The @t{-s} option is implied.
@item @t{-g}
@@ -30018,11 +30473,11 @@ output or an array as appropriate) and return immediately;
arguments, and options other than @t{-A}, are ignored.
@item @t{-L}
-Perform an @t{lstat} (see man page lstat(2)) rather than a @t{stat}
+Perform an @t{lstat} (see lstat(2)) rather than a @t{stat}
system call. In this case, if the file is a link, information
about the link itself rather than the target file is returned.
This option is required to make the @t{link} element useful.
-It's important to note that this is the exact opposite from man page ls(1),
+It's important to note that this is the exact opposite from ls(1),
etc.
@item @t{-n}
@@ -30138,6 +30593,9 @@ suppress updating of the file atime
@item @t{nofollow}
fail if @var{file} is a symbolic link
+@item @t{nonblock}
+the file is opened in nonblocking mode
+
@item @t{sync}
request that writes wait until data has been physically written
@@ -30254,10 +30712,10 @@ to the command, or 2 for an error on the write; no error message is
printed in the last case, but the parameter @t{ERRNO} will reflect
the error that occurred.
-@item @t{zsystem flock} [ @t{-t} @var{timeout} ] [ @t{-f} @var{var} ] [@t{-er}] @var{file}
+@item @t{zsystem flock} [ @t{-t} @var{timeout} ] [ @t{-i} @var{interval} ] [ @t{-f} @var{var} ] [@t{-er}] @var{file}
@itemx @t{zsystem flock -u} @var{fd_expr}
The builtin @t{zsystem}'s subcommand @t{flock} performs advisory file
-locking (via the man page fcntl(2) system call) over the entire contents
+locking (via the fcntl(2) system call) over the entire contents
of the given file. This form of locking requires the processes
accessing the file to cooperate; its most obvious use is between two
instances of the shell itself.
@@ -30287,9 +30745,17 @@ a safety check that the file descriptor is in use for file locking.
@noindent
By default the shell waits indefinitely for the lock to succeed.
The option @t{-t} @var{timeout} specifies a timeout for the lock in
-seconds; currently this must be an integer. The shell will attempt
-to lock the file once a second during this period. If the attempt
-times out, status 2 is returned.
+seconds; fractional seconds are allowed. During this period, the
+shell will attempt to lock the file every @var{interval} seconds
+if the @t{-i} @var{interval} option is given, otherwise once a second.
+(This @var{interval} is shortened before the last attempt if needed,
+so that the shell waits only until the @var{timeout} and not longer.)
+If the attempt times out, status 2 is returned.
+
+@noindent
+(Note: @var{timeout} is limited to 2^30-1 seconds (about 34 years), and
+@var{interval} to 0.999 * LONG_MAX microseconds (only about 35 minutes
+on 32-bit systems).)
@noindent
If the option @t{-e} is given, the file descriptor for the lock is
@@ -30359,9 +30825,9 @@ Returns the process ID of the current process, even in subshells. Compare
@item @t{ppid}
@vindex ppid, sysparams
-Returns the process ID of the parent of the current process, even in
-subshells. Compare @t{$PPID}, which returns the process ID of the parent
-of the main shell process.
+Returns the current process ID of the parent of the current process, even
+in subshells. Compare @t{$PPID}, which returns the process ID of the
+initial parent of the main shell process.
@item @t{procsubstpid}
Returns the process ID of the last process started for process
@@ -30623,7 +31089,7 @@ their values.
@end table
@c (avoiding a yodl bug)
-@node The zsh/terminfo Module, The zsh/zftp Module, The zsh/termcap Module, Zsh Modules
+@node The zsh/terminfo Module, The zsh/watch Module, The zsh/termcap Module, Zsh Modules
@section The zsh/terminfo Module
@noindent
@@ -30653,7 +31119,170 @@ their values.
@end table
@c (avoiding a yodl bug)
-@node The zsh/zftp Module, The zsh/zle Module, The zsh/terminfo Module, Zsh Modules
+@node The zsh/watch Module, The zsh/zftp Module, The zsh/terminfo Module, Zsh Modules
+
+@section The zsh/watch Module
+@noindent
+@c Yodl file: Zsh/mod_watch.yo
+
+The @t{zsh/watch} module can be used to report when specific users log in or
+out. This is controlled via the following parameters.
+
+@noindent
+@table @asis
+@vindex LOGCHECK
+@item @t{LOGCHECK}
+The interval in seconds between checks for login/logout activity
+using the @t{watch} parameter.
+
+@vindex watch
+@vindex WATCH
+@item @t{watch} <S> <Z> (@t{WATCH} <S>)
+An array (colon-separated list) of login/logout events to report.
+
+@noindent
+If it contains the single word `@t{all}', then all login/logout events
+are reported. If it contains the single word `@t{notme}', then all
+events are reported as with `@t{all}' except @t{$USERNAME}.
+
+@noindent
+An entry in this list may consist of a username,
+an `@t{@@}' followed by a remote hostname,
+and a `@t{%}' followed by a line (tty). Any of these may
+be a pattern (be sure to quote this during the assignment to
+@t{watch} so that it does not immediately perform file generation);
+the setting of the @t{EXTENDED_GLOB} option is respected.
+Any or all of these components may be present in an entry;
+if a login/logout event matches all of them,
+it is reported.
+
+@noindent
+For example, with the @t{EXTENDED_GLOB} option set, the following:
+
+@noindent
+@example
+watch=('^(pws|barts)')
+@end example
+
+@noindent
+causes reports for activity associated with any user other than @t{pws}
+or @t{barts}.
+
+@vindex WATCHFMT
+@item @t{WATCHFMT}
+The format of login/logout reports if the @t{watch} parameter is set.
+Default is `@t{%n has %a %l from %m}'.
+Recognizes the following escape sequences:
+
+@noindent
+@table @asis
+@item @t{%n}
+The name of the user that logged in/out.
+
+@item @t{%a}
+The observed action, i.e. "logged on" or "logged off".
+
+@item @t{%l}
+The line (tty) the user is logged in on.
+
+@item @t{%M}
+The full hostname of the remote host.
+
+@item @t{%m}
+The hostname up to the first `@t{.}'. If only the
+IP address is available or the utmp field contains
+the name of an X-windows display, the whole name is printed.
+
+@noindent
+@emph{NOTE:}
+The `@t{%m}' and `@t{%M}' escapes will work only if there is a host name
+field in the utmp on your machine. Otherwise they are
+treated as ordinary strings.
+
+@item @t{%F@{}@var{color}@t{@}} (@t{%f})
+Start (stop) using a different foreground color.
+
+@item @t{%K@{}@var{color}@t{@}} (@t{%k})
+Start (stop) using a different background color.
+
+@item @t{%S} (@t{%s})
+Start (stop) standout mode.
+
+@item @t{%U} (@t{%u})
+Start (stop) underline mode.
+
+@item @t{%B} (@t{%b})
+Start (stop) boldface mode.
+
+@item @t{%t}
+@itemx @t{%@@}
+The time, in 12-hour, am/pm format.
+
+@item @t{%T}
+The time, in 24-hour format.
+
+@item @t{%w}
+The date in `@var{day}@t{-}@var{dd}' format.
+
+@item @t{%W}
+The date in `@var{mm}@t{/}@var{dd}@t{/}@var{yy}' format.
+
+@item @t{%D}
+The date in `@var{yy}@t{-}@var{mm}@t{-}@var{dd}' format.
+
+@item @t{%D@{}@var{string}@t{@}}
+The date formatted as @var{string} using the @t{strftime} function, with
+zsh extensions as described by
+@ref{Prompt Expansion}.
+
+@item @t{%(}@var{x}@t{:}@var{true-text}@t{:}@var{false-text}@t{)}
+Specifies a ternary expression.
+The character following the @var{x} is
+arbitrary; the same character is used to separate the text
+for the "true" result from that for the "false" result.
+Both the separator and the right parenthesis may be escaped
+with a backslash.
+Ternary expressions may be nested.
+
+@noindent
+The test character @var{x} may be any one of `@t{l}', `@t{n}', `@t{m}'
+or `@t{M}', which indicate a `true' result if the corresponding
+escape sequence would return a non-empty value; or it may be `@t{a}',
+which indicates a `true' result if the watched user has logged in,
+or `false' if he has logged out.
+Other characters evaluate to neither true nor false; the entire
+expression is omitted in this case.
+
+@noindent
+If the result is `true', then the @var{true-text}
+is formatted according to the rules above and printed,
+and the @var{false-text} is skipped.
+If `false', the @var{true-text} is skipped and the @var{false-text}
+is formatted and printed.
+Either or both of the branches may be empty, but
+both separators must be present in any case.
+
+@end table
+
+@end table
+
+@noindent
+Furthermore, the @t{zsh/watch} module makes available one builtin
+command:
+
+@noindent
+@table @asis
+@findex log
+@vindex watch, use of
+@cindex watching users
+@cindex users, watching
+@item @t{log}
+List all users currently logged in who are affected by
+the current setting of the @t{watch} parameter.
+
+@end table
+@c (avoiding a yodl bug)
+@node The zsh/zftp Module, The zsh/zle Module, The zsh/watch Module, Zsh Modules
@section The zsh/zftp Module
@noindent
@@ -31444,8 +32073,8 @@ The @t{zselect} builtin is a front-end to the `select' system call, which
blocks until a file descriptor is ready for reading or writing, or has an
error condition, with an optional timeout. If this is not available on
your system, the command prints an error message and returns status 2
-(normal errors return status 1). For more information, see your systems
-documentation for man page select(3). Note there is no connection with the
+(normal errors return status 1). For more information, see your system's
+documentation for select(3). Note there is no connection with the
shell builtin of the same name.
@noindent
@@ -31547,29 +32176,36 @@ the pattern that was defined first.
@noindent
@emph{Example}
+@kindex preferred-precipitation, example style
+@findex weather, example function
@noindent
-For example, to define your preferred form of precipitation depending on which
-city you're in, you might set the following in your @t{zshrc}:
+For example, a fictional `@t{weather}' plugin might state in its documentation
+that it looks up the @t{preferred-precipitation} style under the
+`@t{:weather:}@var{continent}@t{:}@var{day-of-the-week}@t{:}@var{phase-of-the-moon}' context.
+According to this, you might set the following in your @t{zshrc}:
@noindent
@example
zstyle ':weather:europe:*' preferred-precipitation rain
-zstyle ':weather:europe:germany:* preferred-precipitation none
-zstyle ':weather:europe:germany:*:munich' preferred-precipitation snow
+zstyle ':weather:*:Sunday:*' preferred-precipitation snow
@end example
@noindent
-Then, the fictional `@t{weather}' plugin might run under the hood a command
-such as
+Then the plugin would run under the hood a command such as
@noindent
@example
-zstyle -s ":weather:$@{continent@}:$@{country@}:$@{county@}:$@{city@}" preferred-precipitation REPLY
+zstyle -s ":weather:$@{continent@}:$@{day_of_week@}:$@{moon_phase@}" preferred-precipitation REPLY
@end example
@noindent
in order to retrieve your preference into the scalar variable @t{$REPLY}.
+On Sundays @t{$REPLY} would be set to `@t{snow}'; in Europe it would be set
+to `@t{rain}'; and on Sundays in Europe it would be set to `@t{snow}' again,
+because the patterns `@t{:weather:europe:*}' and `@t{:weather:*:Sunday:*}' both
+match the @var{context} argument to @t{zstyle -s}, are equally specific, and the
+latter is more specific (because it has more colon-separated components).
@noindent
@emph{Usage}
@@ -31677,8 +32313,9 @@ Match a value. Returns status zero if the
@findex zformat
@item @t{zformat -f} @var{param} @var{format} @var{spec} ...
+@itemx @t{zformat -F} @var{param} @var{format} @var{spec} ...
@itemx @t{zformat -a} @var{array} @var{sep} @var{spec} ...
-This builtin provides two different forms of formatting. The first form
+This builtin provides different forms of formatting. The first form
is selected with the @t{-f} option. In this case the @var{format}
string will be modified by replacing sequences starting with a percent
sign in it with strings from the @var{spec}s. Each @var{spec} should be
@@ -31729,7 +32366,14 @@ specifier @t{c} is 3, agreeing with the digit argument to the ternary
expression.
@noindent
-The second form, using the @t{-a} option, can be used for aligning
+With @t{-F} instead of @t{-f}, ternary expressions choose between the
+`true' or `false' text on the basis of whether the format specifier is
+present and non-empty. A test number indicates a minimum width for the
+value given in the format specifier. Negative numbers reverse this,
+so the test is for whether the value exceeds a maximum width.
+
+@noindent
+The form, using the @t{-a} option, can be used for aligning
strings. Here, the @var{spec}s are of the form
`@var{left}@t{:}@var{right}' where `@var{left}' and `@var{right}' are
arbitrary strings. These strings are modified by replacing the colons
@@ -32865,7 +33509,7 @@ The location of the main calendar. The default is @t{~/calendar}.
@kindex date-format
@item @t{date-format}
-A @t{strftime} format string (see man page strftime(3)) with the zsh
+A @t{strftime} format string (see strftime(3)) with the zsh
extensions providing various numbers with no leading zero or space
if the number is a single digit as described for the
@t{%D@{}@var{string}@t{@}} prompt format in
@@ -34052,7 +34696,7 @@ This describes the set of shell functions supplied with the source
distribution as an interface to the @t{zftp} builtin command, allowing you
to perform FTP operations from the shell command line or within functions
or scripts. The interface is similar to a traditional FTP client (e.g. the
-@t{ftp} command itself, see man page ftp(1)), but as it is entirely done
+@t{ftp} command itself, see ftp(1)), but as it is entirely done
within the shell all the familiar completion, editing and globbing features,
and so on, are present, and macros are particularly simple to write as they
are just ordinary shell functions.
@@ -34634,13 +35278,11 @@ command `@t{zstyle ':zftp:*'} @var{style} @var{value} ...'.
defines the @var{style} to have value @var{value}; more than one value may be
given, although that is not useful in the cases described here. These
values will then be used throughout the zftp function system. For more
-precise control, the first argument, which gives a context in which the
+precise control, the first argument, which gives a pattern that matches @emph{contexts} in which the
style applies, can be modified to include a particular function, as for
example `@t{:zftp:zfget}': the style will then have the given value only
-in the @t{zfget} function. Values for the same style in different contexts
-may be set; the most specific function will be used, where
-strings are held to be more specific than patterns, and longer patterns and
-shorter patterns. Note that only the top level function name, as called by
+in the @t{zfget} function, and will override styles set under `@t{:zftp:*}'.
+Note that only the top level function name, as called by
the user, is used; calling of lower level functions is transparent to the
user. Hence modifications to the title bar in @t{zftp_chpwd} use the
contexts @t{:zftp:zfopen}, @t{:zftp:zfcd}, etc., depending where it was
@@ -34876,7 +35518,7 @@ distribution in your home directory, you would use the commands:
@noindent
@example
mkdir ~/zsh_help
-perl ~/zsh-5.8.1/Util/helpfiles ~/zsh_help
+perl ~/zsh-5.8.1.2-test/Util/helpfiles ~/zsh_help
@end example
@noindent
@@ -35037,7 +35679,7 @@ Run @t{zkbd} either as an autoloaded function, or as a shell script:
@noindent
@example
-zsh -f ~/zsh-5.8.1/Functions/Misc/zkbd
+zsh -f ~/zsh-5.8.1.2-test/Functions/Misc/zkbd
@end example
@noindent
@@ -35102,7 +35744,7 @@ command and redirect the output into a file:
@noindent
@example
-. ~/zsh-5.8.1/Util/reporter > zsh.report
+. ~/zsh-5.8.1.2-test/Util/reporter > zsh.report
@end example
@noindent
@@ -35243,7 +35885,7 @@ as the @var{hook} argument.
is added to the array of widgets to be invoked in the given hook context.
Widgets are invoked in the order they were added, with
@example
-@t{zle }@var{widgetname}@t{ -Nw -- "$@@"}
+@t{zle }@var{widgetname}@t{ -Nw -f "nolast" -- "$@@"}
@end example
@noindent
@@ -35397,7 +36039,7 @@ allows you to edit the list of directories, one per line. The
list can be edited to any extent you like; no sanity checking is
performed. Completion is available. No quoting is necessary (except for
newlines, where I have in any case no sympathy); directories are in
-unabbreviated from and contain an absolute path, i.e. they start with @t{/}.
+unabbreviated form and contain an absolute path, i.e. they start with @t{/}.
Usually the first entry should be left as the current directory.
@item @t{-p '}@var{pattern}@t{'}
@@ -35554,7 +36196,7 @@ changes to descendant directories; earlier directories on the
list are not pruned. For example, changing from ~pws/yet/another
to ~pws/some/other/dir does not cause ~pws to be pruned.
-@item @t{pattern:@var{pattern}}
+@item @t{pattern:}@var{pattern}
Gives a zsh pattern for directories that should not be
added to the recent list (if not already there). This element
can be repeated to add different patterns. For example,
@@ -35691,7 +36333,7 @@ Then arrange for the wrapper to be run as a zsh_directory_name hook:
@noindent
@example
-autoload -Uz add-zsh-hook zsh_diretory_name_generic zdn_mywrapper
+autoload -Uz add-zsh-hook zsh_directory_name_generic zdn_mywrapper
add-zsh-hook -U zsh_directory_name zdn_mywrapper
@end example
@@ -36255,7 +36897,7 @@ This is used by the Perforce backend (@t{p4}) to decide if it should
contact the Perforce server to find out if a directory is managed
by Perforce. This is the only reliable way of doing this, but runs
the risk of a delay if the server name cannot be found. If the
-server (more specifically, the @t{host}@t{:}@t{port} pair describing the
+server (more specifically, the @var{host}@t{:}@var{port} pair describing the
server) cannot be contacted, its name is put into the associative array
@t{vcs_info_p4_dead_servers} and is not contacted again during the session
until it is removed by hand. If you do not set this style, the @t{p4}
@@ -36274,7 +36916,7 @@ If there are two different ways of gathering
information, you can select the simpler one by setting this style to true;
the default is to use the not-that-simple code, which is potentially a lot
slower but might be more accurate in all possible cases. This style is
-used by the @t{bzr} and @t{hg} backends. In the case of @t{hg} it will invoke
+used by the @t{bzr}, @t{hg}, and @t{git} backends. In the case of @t{hg} it will invoke
the external hexdump program to parse the binary dirstate cache file; this
method will not return the local revision number.
@@ -36334,7 +36976,7 @@ This boolean style controls whether a backend should attempt to gather a list
of unapplied patches (for example with Mercurial Queue patches).
@noindent
-Used by the @t{quilt} and @t{hg} backends.
+Used by the @t{quilt}, @t{hg}, and @t{git} backends.
@end table
@@ -36461,7 +37103,7 @@ The @t{quilt} `standalone' backend sets this expando to the same value as the
@item @t{%Q}
Quilt series information.
When quilt is used (either in `addon' mode or as a `standalone' backend),
-this expando is set to quilt series' @t{patch-format} string.
+this expando is set to the quilt series' @t{patch-format} string.
The @t{set-patch-format} hook and @t{nopatch-format} style are honoured.
@noindent
@@ -36475,7 +37117,8 @@ In @t{branchformat} these replacements are done:
@noindent
@table @asis
@item @t{%b}
-The branch name.
+The branch name. For @t{hg}, the branch name can include a
+topic name.
@item @t{%r}
The current revision number or the @t{hgrevformat} style for
@t{hg}.
@@ -36580,7 +37223,7 @@ a directory that holds quilt's patches needs to be found. That directory is
configurable via the `@t{QUILT_PATCHES}' environment variable. If that
variable exists its value is used, otherwise the value `@t{patches}' is
assumed. The value from @t{$QUILT_PATCHES} can be overwritten using the
-`@t{quilt-patches}' style. (Note: you can use @t{vcs_info} to keep the value
+`@t{quilt-patch-dir}' style. (Note: you can use @t{vcs_info} to keep the value
of @t{$QUILT_PATCHES} correct all the time via the @t{post-quilt} hook).
@noindent
@@ -36700,7 +37343,7 @@ below for details.
@findex vcs_info_lastmsg
@item @t{vcs_info_lastmsg}
-Outputs the last @t{$@{vcs_info_msg_*_@}} value.
+Outputs the current values of @t{$@{vcs_info_msg_*_@}}.
Takes into account the value of the @t{use-prompt-escapes} style in
@t{':vcs_info:formats:command:-all-'}. It also only prints @t{max-exports}
values.
@@ -36874,11 +37517,19 @@ is generated; the @t{use-quilt} zstyle must be true for @t{quilt} (the @t{mq}
and @t{stgit} backends are active by default).
@noindent
-This hook gets the names of all applied patches which @t{vcs_info} collected
-so far in the opposite order, which means that the first argument is the
+The arguments to this hook describe applied patches
+in the opposite order, which means that the first argument is the
top-most patch and so forth.
@noindent
+When the patches' log messages can be extracted, those are embedded
+within each argument after a space, so each argument is of the form
+`@var{patch-name} @var{first line of the log message}', where @var{patch-name}
+contains no whitespace. The @t{mq} backend passes arguments of
+the form `@var{patch name}', with possible embedded spaces, but without
+extracting the patch's log message.
+
+@noindent
When setting @t{ret} to non-zero, the string in
@t{$@{hook_com[applied-string]@}} will be
available as @t{%p} in the @t{patch-format} and @t{nopatch-format} styles.
@@ -36886,6 +37537,11 @@ This hook is, in concert with @t{set-patch-format}, responsible for
@t{%}-escaping that value for use in the prompt.
(See @ref{vcs_info Oddities}.)
+@noindent
+The @t{quilt} backend passes to this hook the inputs
+@t{$@{hook_com[quilt-patches-dir]@}} and, if it has been
+determined, @t{$@{hook_com[quilt-pc-dir]@}}.
+
@item @t{gen-unapplied-string}
Called in the @t{git} (with @t{stgit} or during rebase), and @t{hg} (with
@t{mq}) backend and in @t{quilt} support when the @t{unapplied-string} is
@@ -36893,10 +37549,13 @@ generated; the @t{get-unapplied} style must be true.
@noindent
This hook gets the names of all unapplied patches which @t{vcs_info}
-collected so far in order, which means that the first argument is
+in order, which means that the first argument is
the patch next-in-line to be applied and so forth.
@noindent
+The format of each argument is as for @t{gen-applied-string}, above.
+
+@noindent
When setting @t{ret} to non-zero, the string in
@t{$@{hook_com[unapplied-string]@}} will be available as @t{%u} in the
@t{patch-format} and @t{nopatch-format} styles.
@@ -36904,6 +37563,11 @@ This hook is, in concert with @t{set-patch-format}, responsible for
@t{%}-escaping that value for use in the prompt.
(See @ref{vcs_info Oddities}.)
+@noindent
+The @t{quilt} backend passes to this hook the inputs
+@t{$@{hook_com[quilt-patches-dir]@}} and, if it has been
+determined, @t{$@{hook_com[quilt-pc-dir]@}}.
+
@item @t{gen-mqguards-string}
Called in the @t{hg} backend when @t{guards-string} is generated; the
@t{get-mq} style must be true (default).
@@ -37000,6 +37664,11 @@ This hook is, in concert with the @t{gen-applied-string} or
@t{%}-escaping the final @t{patch-format} value for use in the prompt.
(See @ref{vcs_info Oddities}.)
+@noindent
+The @t{quilt} backend passes to this hook the inputs
+@t{$@{hook_com[quilt-patches-dir]@}} and, if it has been
+determined, @t{$@{hook_com[quilt-pc-dir]@}}.
+
@item @t{set-message}
Called each time before a `@t{vcs_info_msg_}@var{N}@t{_}' message is set.
It takes two arguments; the first being the `@var{N}' in the message
@@ -37091,22 +37760,40 @@ If you do use @t{use-simple}, please report if it does `the-right-thing[tm]'.
Display the revision number in yellow for @t{bzr} and @t{svn}:
@example
zstyle ':vcs_info:(svn|bzr):*' \
+ branchformat '%b%%F@{yellow@}:%r'
+@end example
+
+@noindent
+The doubled percent sign is explained in
+@ref{vcs_info Oddities}.
+
+@noindent
+Alternatively, one can use the raw colour codes directly:
+
+@noindent
+@example
+zstyle ':vcs_info:(svn|bzr):*' \
branchformat '%b%@{'$@{fg[yellow]@}'%@}:%r'
@end example
@noindent
-If you want colors, make sure you enclose the color codes in @t{%@{}@var{...}@t{%@}}
+Normally when a variable is interpolated into a format string, the variable
+needs to be @t{%}-escaped. In this example we skipped that because we assume
+the value of @t{$@{fg[yellow]@}} doesn't contain any @t{%} signs.
+
+@noindent
+Make sure you enclose the color codes in @t{%@{}@var{...}@t{%@}}
if you want to use the string provided by @t{vcs_info} in prompts.
@noindent
Here is how to print the VCS information as a command (not in a prompt):
@example
-alias vcsi='vcs_info command; vcs_info_lastmsg'
+vcsi() @{ vcs_info interactive; vcs_info_lastmsg @}
@end example
@noindent
This way, you can even define different formats for output via
-@t{vcs_info_lastmsg} in the '@t{:vcs_info:*:command:*}' namespace.
+@t{vcs_info_lastmsg} in the '@t{:vcs_info:*:interactive:*}' namespace.
@noindent
Now as promised, some code that uses hooks:
@@ -37223,7 +37910,7 @@ This concludes our guided tour through zsh's @t{vcs_info}.
@noindent
You should make sure all the functions from the @t{Functions/Prompts}
directory of the source distribution are available; they all begin with
-the string `@t{prompt_}' except for the special function`@t{promptinit}'.
+the string `@t{prompt_}' except for the special function `@t{promptinit}'.
You also need the `@t{colors}' and `@t{add-zsh-hook}' functions from
@t{Functions/Misc}.
All these functions may already be installed on your system; if not,
@@ -37350,29 +38037,34 @@ setopts (@t{promptbang}, etc.) are turned on, all other prompt-related
options are turned off. The @t{prompt_opts} array preserves setopts even
beyond the scope of @t{localoptions}, should your function need that.
-@item Modify precmd and preexec
-Use of @t{add-zsh-hook} is recommended. The @t{precmd} and @t{preexec}
-hooks are automatically adjusted if the prompt theme changes or is
-disabled.
+@item Modify hooks
+Use of @t{add-zsh-hook} and @t{add-zle-hook-widget} is recommended (see
+the @cite{Manipulating Hook Functions} section above).
+All hooks that follow the naming pattern @t{prompt_}@var{theme}@t{_}@var{hook}
+are automatically removed when the prompt theme changes or is disabled.
@item Declare cleanup
If your function makes any other changes that should be undone when the
theme is disabled, your setup function may call
+
+@noindent
@example
prompt_cleanup @var{command}
@end example
+
+@noindent
where @var{command} should be suitably quoted. If your theme is ever
disabled or replaced by another, @var{command} is executed with @t{eval}.
You may declare more than one such cleanup hook.
@item Define preview
-Define or autoload a function @t{prompt_@var{name}_preview} to display
+Define or autoload a function @t{prompt_}@var{name}@t{_preview} to display
a simulated version of your prompt. A simple default previewer is
defined by @t{promptinit} for themes that do not define their own.
This preview function is called by `@t{prompt -p}'.
@item Provide help
-Define or autoload a function @t{prompt_@var{name}_help} to display
+Define or autoload a function @t{prompt_}@var{name}@t{_help} to display
documentation or help text for your theme.
This help function is called by `@t{prompt -h}'.
@@ -37706,7 +38398,7 @@ directly.
@tindex bracketed-paste-magic
@item @t{bracketed-paste-magic}
-The @t{bracketed-paste} widget (see @ref{Miscellaneous} in @ref{Zle Widgets})
+The @t{bracketed-paste} widget (see @ref{Miscellaneous} in @ref{Standard Widgets})
inserts pasted text literally into the editor buffer rather than interpret
it as keystrokes. This disables some common usages where the self-insert
widget is replaced in order to accomplish some extra processing. An
@@ -37895,6 +38587,16 @@ Edit the command line using your visual editor, as in @t{ksh}.
bindkey -M vicmd v edit-command-line
@end example
+@noindent
+The editor to be used can also be specified using the @t{editor} style in
+the context of the widget. It is specified as an array of command and
+arguments:
+
+@noindent
+@example
+zstyle :zle:edit-command-line editor gvim -f
+@end example
+
@tindex expand-absolute-path
@item @t{expand-absolute-path}
Expand the file name under the cursor to an absolute path, resolving
@@ -39254,7 +39956,8 @@ Calling @t{zsh-mime-setup} with the option
@noindent
The system respects the @t{mailcap} flags @t{needsterminal} and
-@t{copiousoutput}, see man page mailcap(4).
+@t{copiousoutput}; see mailcap(4) or mailcap(5)
+(the man page's name varies across platforms).
@noindent
The functions use the following styles, which are defined with the
@@ -40043,6 +40746,12 @@ Same as @t{zed -f}. This function does not appear in the zsh
distribution, but can be created by linking @t{zed} to the name @t{fned}
in some directory in your @t{fpath}.
+@findex histed
+@item @t{histed} [ [ @var{name} ] @var{size} ]
+Same as @t{zed -h}. This function does not appear in the zsh
+distribution, but can be created by linking @t{zed} to the name @t{histed}
+in some directory in your @t{fpath}.
+
@findex is-at-least
@item @t{is-at-least} @var{needed} [ @var{present} ]
Perform a greater-than-or-equal-to comparison of two strings having the
@@ -40079,7 +40788,7 @@ See also the @t{pager}, @t{prompt} and @t{rprompt} styles below.
@findex regexp-replace
@item @t{regexp-replace} @var{var} @var{regexp} @var{replace}
Use regular expressions to perform a global search and replace operation
-on a variable. POSIX extended regular expressions are used,
+on a variable. POSIX extended regular expressions (ERE) are used,
unless the option @t{RE_MATCH_PCRE} has been set, in which case
Perl-compatible regular expressions are used
(this requires the shell to be linked against the @t{pcre}
@@ -40102,6 +40811,10 @@ reference to @t{$MATCH} will be replaced by the text matched by the pattern.
@noindent
The return status is 0 if at least one match was performed, else 1.
+@noindent
+Note that if using POSIX EREs, the @t{^} or word boundary operators
+(where available) may not work properly.
+
@findex run-help
@item @t{run-help} @var{cmd}
This function is designed to be invoked by the @t{run-help} ZLE widget,
@@ -40148,6 +40861,7 @@ your search path, in order to be found and used by @t{run-help}.
@noindent
@table @asis
+@findex run-help-btrfs
@findex run-help-git
@findex run-help-ip
@findex run-help-openssl
@@ -40155,14 +40869,16 @@ your search path, in order to be found and used by @t{run-help}.
@findex run-help-sudo
@findex run-help-svk
@findex run-help-svn
-@item run-help-git
-@itemx run-help-ip
-@itemx run-help-openssl
-@itemx run-help-p4
-@itemx run-help-sudo
-@itemx run-help-svk
+@item @t{run-help-btrfs}
+@itemx @t{run-help-git}
+@itemx @t{run-help-ip}
+@itemx @t{run-help-openssl}
+@itemx @t{run-help-p4}
+@itemx @t{run-help-sudo}
+@itemx @t{run-help-svk}
@itemx @t{run-help-svn}
Assistant functions for the
+@t{btrfs},
@t{git},
@t{ip},
@t{openssl},
@@ -40284,12 +41000,13 @@ counts the number of arguments passed to each execution of @var{command},
each @var{input} is processed separately as if by `@t{-L} @t{1}'.
@noindent
-For details of the other @t{zargs} options, see man page xargs(1) (but note
+For details of the other @t{zargs} options, see the xargs(1) man page (but note
the difference in function between @t{zargs} and @t{xargs}) or run
@t{zargs} with the @t{-}@t{-help} option.
@findex zed
@item @t{zed} [ @t{-f} [ @t{-x} @var{num} ] ] @var{name}
+@itemx @t{zed} [ @t{-h} [ @var{name} ] @var{size} ]
@itemx @t{zed -b}
This function uses the ZLE editor to edit a file or function.
@@ -40306,7 +41023,16 @@ of functions distributed with the shell.
@noindent
Without @t{-f}, @var{name} is the path name of the file to edit, which need
-not exist; it is created on write, if necessary.
+not exist; it is created on write, if necessary. With @t{-h}, the file is
+presumed to contain history events.
+
+@noindent
+When no file name is provided for @t{-h} the current shell history is edited
+in place. The history is renumbered when zed exits successfully.
+
+@noindent
+When editing history, multi-line events must have a trailing backslash on
+every line before the last.
@noindent
While editing, the function sets the main keymap to @t{zed} and the
@@ -40326,17 +41052,21 @@ this will overwrite the existing @t{zed} and @t{zed-vicmd} keymaps.
@noindent
Completion is available, and styles may be set with the context prefix
-`@t{:completion:zed}'.
+`@t{:completion:zed:}'.
@noindent
-A zle widget @t{zed-set-file-name} is available. This can be called by
-name from within zed using `@t{\ex zed-set-file-name}' (note, however, that
-because of zed's rebindings you will have to type @t{^j} at the end instead
-of the return key), or can be bound to a key in either of the @t{zed} or
-@t{zed-vicmd} keymaps after `@t{zed -b}' has been run. When the widget is
-called, it prompts for a new name for the file being edited. When zed
-exits the file will be written under that name and the original file will
-be left alone. The widget has no effect with `@t{zed -f}'.
+@findex zed-set-file-name
+A zle widget @t{zed-set-file-name} is available. This can be called
+by name from within zed using `@t{\ex zed-set-file-name}' or can be
+bound to a key in either of the @t{zed} or @t{zed-vicmd} keymaps after
+`@t{zed -b}' has been run. When the widget is called, it prompts for
+a new name for the file being edited. When zed exits the file will be
+written under that name and the original file will be left alone. The
+widget has no effect when invoked from `@t{zed -f}'. The completion
+context is changed to `@t{:completion:zed-set-file-name:}'. When editing
+the current history with `@t{zed -h}', the history is first updated and
+then the file is written, but the global setting of @t{HISTFILE} is not
+altered.
@noindent
While @t{zed-set-file-name} is running, zed uses the keymap
@@ -40384,7 +41114,7 @@ was not given) causes the entire function to abort without doing
anything.
@noindent
-In addition to pattern replacement, the variable @t{$f} can be referrred
+In addition to pattern replacement, the variable @t{$f} can be referred
to in the second (replacement) argument. This makes it possible to
use variable substitution to alter the argument; see examples below.
diff --git a/Doc/zshall.1 b/Doc/zshall.1
index 4891d1abf..15ff09107 100644
--- a/Doc/zshall.1
+++ b/Doc/zshall.1
@@ -1,4 +1,4 @@
-.TH "ZSHALL" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHALL" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshall \- the Z shell meta\-man page
.\" Yodl file: Zsh/intro.yo
@@ -47,19 +47,19 @@ login shell and as a shell script command processor\&. Of the standard shells,
zsh most closely resembles \fBksh\fP but includes many enhancements\&. It
does not provide compatibility with POSIX or other shells in its
default operating mode: see
-the section Compatibility below\&.
+the section `Compatibility' below\&.
.PP
Zsh has command line editing, builtin spelling correction, programmable
command completion, shell functions (with autoloading), a history
mechanism, and a host of other features\&.
.\" Yodl file: Zsh/metafaq.yo
.SH "AUTHOR"
-Zsh was originally written by Paul Falstad \fB<pf@zsh\&.org>\fP\&.
-Zsh is now maintained by the members of the zsh\-workers mailing
-list \fB<zsh\-workers@zsh\&.org>\fP\&. The development is currently
-coordinated by Peter Stephenson \fB<pws@zsh\&.org>\fP\&. The coordinator
-can be contacted at \fB<coordinator@zsh\&.org>\fP, but matters relating to
-the code should generally go to the mailing list\&.
+Zsh was originally written by Paul Falstad\&. Zsh is now maintained by
+the members of the zsh\-workers mailing list \fB<zsh\-workers@zsh\&.org>\fP\&.
+The development is currently coordinated by Peter Stephenson
+\fB<pws@zsh\&.org>\fP\&. The coordinator can be contacted at
+\fB<coordinator@zsh\&.org>\fP, but matters relating to the code should
+generally go to the mailing list\&.
.SH "AVAILABILITY"
Zsh is available from the following HTTP and anonymous FTP site\&.
.PP
@@ -67,15 +67,14 @@ Zsh is available from the following HTTP and anonymous FTP site\&.
\fBftp://ftp\&.zsh\&.org/pub/\fP
\fBhttps://www\&.zsh\&.org/pub/\fP
.fi
-)
.PP
The up\-to\-date source code is available via Git from Sourceforge\&. See
\fBhttps://sourceforge\&.net/projects/zsh/\fP for details\&. A summary of
instructions for the archive can be found at
-\fBhttp://zsh\&.sourceforge\&.net/\fP\&.
+\fBhttps://zsh\&.sourceforge\&.io/\fP\&.
.PP
.SH "MAILING LISTS"
-Zsh has 3 mailing lists:
+Zsh has several mailing lists:
.PP
.PD 0
.TP
@@ -89,6 +88,14 @@ User discussions\&.
.TP
\fB<zsh\-workers@zsh\&.org>\fP
Hacking, development, bug reports and patches\&.
+.TP
+\fB<zsh\-security@zsh\&.org>\fP
+Private mailing list (the general public cannot subscribe to it) for discussing
+bug reports with security implications, i\&.e\&., potential vulnerabilities\&.
+.RS
+.PP
+If you find a security problem in zsh itself, please mail this address\&.
+.RE
.PP
To subscribe or unsubscribe, send mail
to the associated administrative address for the mailing list\&.
@@ -115,30 +122,28 @@ All submissions to \fBzsh\-announce\fP are automatically forwarded to
forwarded to \fBzsh\-workers\fP\&.
.PP
If you have problems subscribing/unsubscribing to any of the mailing
-lists, send mail to \fB<listmaster@zsh\&.org>\fP\&. The mailing lists are
-maintained by Karsten Thygesen \fB<karthy@kom\&.auc\&.dk>\fP\&.
+lists, send mail to \fB<listmaster@zsh\&.org>\fP\&.
.PP
The mailing lists are archived; the archives can be accessed via the
administrative addresses listed above\&. There is also a hypertext
-archive, maintained by Geoff Wing \fB<gcw@zsh\&.org>\fP, available at
+archive available at
\fBhttps://www\&.zsh\&.org/mla/\fP\&.
.SH "THE ZSH FAQ"
Zsh has a list of Frequently Asked Questions (FAQ), maintained by
Peter Stephenson \fB<pws@zsh\&.org>\fP\&. It is regularly posted to the
newsgroup \fBcomp\&.unix\&.shell\fP and the \fBzsh\-announce\fP mailing list\&.
The latest version can be found at any of the Zsh FTP sites, or at
-\fBhttp://www\&.zsh\&.org/FAQ/\fP\&. The contact address for FAQ\-related matters
+\fBhttps://www\&.zsh\&.org/FAQ/\fP\&. The contact address for FAQ\-related matters
is \fB<faqmaster@zsh\&.org>\fP\&.
.SH "THE ZSH WEB PAGE"
-Zsh has a web page which is located at \fBhttps://www\&.zsh\&.org/\fP\&. This is
-maintained by Karsten Thygesen \fB<karthy@zsh\&.org>\fP, of SunSITE Denmark\&.
+Zsh has a web page which is located at \fBhttps://www\&.zsh\&.org/\fP\&.
The contact address for web\-related matters is \fB<webmaster@zsh\&.org>\fP\&.
.SH "THE ZSH USERGUIDE"
A userguide is currently in preparation\&. It is intended to complement the
manual, with explanations and hints on issues where the manual can be
cabbalistic, hierographic, or downright mystifying (for example, the word
`hierographic' does not exist)\&. It can be viewed in its current state at
-\fBhttp://zsh\&.sourceforge\&.net/Guide/\fP\&. At the time of writing, chapters
+\fBhttps://zsh\&.sourceforge\&.io/Guide/\fP\&. At the time of writing, chapters
dealing with startup files and their contents and the new completion system
were essentially complete\&.
.\" Yodl file: Zsh/invoke.yo
@@ -273,8 +278,7 @@ parameters are not special and not initialized by the shell:
\fBPROMPT3\fP,
\fBPROMPT4\fP,
\fBpsvar\fP,
-\fBstatus\fP,
-\fBwatch\fP\&.
+\fBstatus\fP\&.
.PP
The usual zsh startup/shutdown scripts are not executed\&. Login shells
source \fB/etc/profile\fP followed by \fB$HOME/\&.profile\fP\&. If the
@@ -316,6 +320,12 @@ Also, the
and
\fBSINGLE_LINE_ZLE\fP
options are set if zsh is invoked as \fBksh\fP\&.
+.PP
+Please note that, whilst reasonable efforts are taken to address
+incompatibilities when they arise, zsh does not guarantee complete
+emulation of other shells, nor POSIX compliance\&. For more information on
+the differences between zsh and other shells, please refer to chapter 2
+of the shell FAQ, \fBhttps://www\&.zsh\&.org/FAQ/\fP\&.
.\" Yodl file: Zsh/restricted.yo
.SH "RESTRICTED SHELL"
When the basename of the command used to invoke zsh starts with the letter
@@ -476,7 +486,7 @@ file will be used instead\&.
.so man1/zshtcpsys.1
.so man1/zshzftpsys.1
.so man1/zshcontrib.1
-.TH "ZSHALL" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHALL" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2\-test"
.\" Yodl file: Zsh/filelist.yo
.SH "FILES"
.PD 0
diff --git a/Doc/zshbuiltins.1 b/Doc/zshbuiltins.1
index 82b9225f2..5b4acbfd0 100644
--- a/Doc/zshbuiltins.1
+++ b/Doc/zshbuiltins.1
@@ -1,4 +1,4 @@
-.TH "ZSHBUILTINS" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHBUILTINS" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshbuiltins \- zsh built\-in commands
.\" Yodl file: Zsh/builtins.yo
@@ -77,9 +77,19 @@ For each \fIname\fP with a corresponding \fIvalue\fP, define an alias
with that value\&. A trailing space in \fIvalue\fP causes the next word
to be checked for alias expansion\&. If the \fB\-g\fP flag is present,
define a global alias; global aliases are expanded even if they do not
-occur in command position\&.
+occur in command position:
.RS
.PP
+.RS
+.nf
+\fB% perldoc \-\-help 2>&1 | grep \&'built\-in functions'
+ \-f Search Perl built\-in functions
+% alias \-g HG=\&'\-\-help 2>&1 | grep'
+% perldoc HG \&'built\-in functions'
+ \-f Search Perl built\-in functions\fP
+.fi
+.RE
+.PP
If the \fB\-s\fP flag is present, define a suffix alias: if the command
word on a command line is in the form `\fItext\fP\fB\&.\fP\fIname\fP\&', where
\fItext\fP is any non\-empty string, it is replaced by the text
@@ -770,7 +780,7 @@ Do nothing and return an exit status of 1\&.
.TP
.PD 0
-\fBfc\fP [ \fB\-e\fP \fIename\fP ] [ \fB\-LI\fP ] [ \fB\-m\fP \fImatch\fP ] [ \fIold\fP\fB=\fP\fInew\fP \&.\&.\&. ] [ \fIfirst\fP [ \fIlast\fP ] ]
+\fBfc\fP [ \fB\-e\fP \fIename\fP ] [ \fB\-s\fP ] [ \fB\-LI\fP ] [ \fB\-m\fP \fImatch\fP ] [ \fIold\fP\fB=\fP\fInew\fP \&.\&.\&. ] [ \fIfirst\fP [ \fIlast\fP ] ]
.TP
.PD 0
\fBfc \-l \fP[ \fB\-LI\fP ] [ \fB\-nrdfEiD\fP ] [ \fB\-t\fP \fItimefmt\fP ] [ \fB\-m\fP \fImatch\fP ]
@@ -801,7 +811,8 @@ specifies the most recent event beginning with the given string\&. All
substitutions \fIold\fP\fB=\fP\fInew\fP, if any, are then performed on the
text of the events\&.
.PP
-In addition to the number range,
+The range of events selected by numbers can be narrowed further by the
+following flags\&.
.PD 0
.TP
\fB\-I\fP
@@ -813,8 +824,8 @@ restricts to only local events (not from other shells, see
considered local when read at startup)
.TP
\fB\-m\fP
-takes the first argument as a pattern (should be quoted) and
-only the history events matching this pattern are considered
+takes the first argument as a pattern (which should be
+quoted) and only the history events matching this pattern are considered
.PD
.PP
If \fIfirst\fP is not specified, it will be set to \-1 (the most recent
@@ -833,6 +844,7 @@ the parameter \fBEDITOR\fP is used; if that is not set a builtin default,
usually `\fBvi\fP\&' is used\&. If \fIename\fP is `\fB\-\fP', no editor is invoked\&.
When editing is complete, the edited command is executed\&.
.PP
+The flag `\fB\-s\fP\&' is equivalent to `\fB\-e \-\fP'\&.
The flag \fB\-r\fP reverses the order of the events and the
flag \fB\-n\fP suppresses event numbers when listing\&.
.PP
@@ -957,6 +969,8 @@ without affecting the other\&. A typical idiom is that \fIoldfn\fP is the
name of a library shell function which is then redefined to call
\fBnewfn\fP, thereby installing a modified version of the function\&.
.PP
+\fIThe \fP\fB\-M\fP\fI and \fP\fB+M\fP\fI flags\fP
+.PP
Use of the \fB\-M\fP option may not be combined with any of the options
handled by \fBtypeset \-f\fP\&.
.PP
@@ -976,48 +990,93 @@ expressions\&. The name of the function in \fB$0\fP is \fImathfn\fP (not
\fIshellfn\fP as would usually be the case), provided the option
\fBFUNCTION_ARGZERO\fP is in effect\&. The positional parameters in the shell
function correspond to the arguments of the mathematical function call\&.
-The result of the last arithmetical expression evaluated
-inside the shell function (even if it is a form that normally only returns
-a status) gives the result of the mathematical function\&.
.PP
-If the additional option \fB\-s\fP is given to \fBfunctions \-M\fP, the
-argument to the function is a single string: anything between the
-opening and matching closing parenthesis is passed to the function as a
-single argument, even if it includes commas or white space\&. The minimum
-and maximum argument specifiers must therefore be 1 if given\&. An empty
-argument list is passed as a zero\-length string\&.
+The result of the last arithmetical expression evaluated inside the shell
+function gives the result of the mathematical function\&. This is not limited to
+arithmetic substitutions of the form \fB$((\fP\fI\&.\&.\&.\fP\fB))\fP,
+but also includes arithmetical expressions evaluated in any other way, including
+by the \fBlet\fP builtin,
+by \fB((\fP\fI\&.\&.\&.\fP\fB))\fP statements,
+and even
+by the \fBreturn\fP builtin
+and
+by array subscripts\&.
+Therefore, care must be taken not to use syntactical constructs that perform
+arithmetic evaluation after evaluating what is to be the result of the function\&.
+For example:
.PP
-\fBfunctions \-M\fP with no arguments lists all such user\-defined functions in
-the same form as a definition\&. With the additional option \fB\-m\fP and
-a list of arguments, all functions whose \fImathfn\fP matches one of
-the pattern arguments are listed\&.
+.RS
+.nf
+\fB# WRONG
+zmath_cube() {
+ (( $1 * $1 * $1 ))
+ return 0
+}
+functions \-M cube 1 1 zmath_cube
+print $(( cube(3) ))\fP
+.fi
+.RE
.PP
-\fBfunction +M\fP removes the list of mathematical functions; with the
-additional option \fB\-m\fP the arguments are treated as patterns and
-all functions whose \fImathfn\fP matches the pattern are removed\&. Note
-that the shell function implementing the behaviour is not removed
-(regardless of whether its name coincides with \fImathfn\fP)\&.
+This will print `\fB0\fP\&' because of the \fBreturn\fP\&.
.PP
-For example, the following prints the cube of 3:
+Commenting the \fBreturn\fP out would lead to a different problem: the
+\fB((\fP\fI\&.\&.\&.\fP\fB))\fP statement would become
+the last statement in the function, so the \fIreturn status\fP (\fB$?\fP) of the
+function would be non\-zero (indicating failure) whenever the \fIarithmetic
+result\fP of the function would happen to be zero (numerically):
.PP
.RS
.nf
-\fBzmath_cube() { (( $1 * $1 * $1 )) }
+\fB# WRONG
+zmath_cube() {
+ (( $1 * $1 * $1 ))
+}
+functions \-M cube 1 1 zmath_cube
+print $(( cube(0) ))\fP
+.fi
+.RE
+.PP
+Instead, the \fBtrue\fP builtin can be used:
+.PP
+.RS
+.nf
+\fB# RIGHT
+zmath_cube() {
+ (( $1 * $1 * $1 ))
+ true
+}
functions \-M cube 1 1 zmath_cube
print $(( cube(3) ))\fP
.fi
.RE
.PP
-The following string function takes a single argument, including
-the commas, so prints 11:
+If the additional option \fB\-s\fP is given to \fBfunctions \-M\fP, the
+argument to the function is a single string: anything between the
+opening and matching closing parenthesis is passed to the function as a
+single argument, even if it includes commas or white space\&. The minimum
+and maximum argument specifiers must therefore be 1 if given\&. An empty
+argument list is passed as a zero\-length string\&.
+Thus, the following string function takes a single argument, including
+the commas, and prints 11:
.PP
.RS
.nf
-\fBstringfn() { (( $#1 )) }
+\fBstringfn() { (( $#1 )); true }
functions \-Ms stringfn
print $(( stringfn(foo,bar,rod) ))\fP
.fi
.RE
+.PP
+\fBfunctions \-M\fP with no arguments lists all such user\-defined functions in
+the same form as a definition\&. With the additional option \fB\-m\fP and
+a list of arguments, all functions whose \fImathfn\fP matches one of
+the pattern arguments are listed\&.
+.PP
+\fBfunction +M\fP removes the list of mathematical functions; with the
+additional option \fB\-m\fP the arguments are treated as patterns and
+all functions whose \fImathfn\fP matches the pattern are removed\&. Note
+that the shell function implementing the behaviour is not removed
+(regardless of whether its name coincides with \fImathfn\fP)\&.
.RE
.TP
\fBgetcap\fP
@@ -1049,7 +1108,8 @@ is stored in \fBOPTARG\fP\&.
The first option to be examined may be changed by explicitly assigning
to \fBOPTIND\fP\&. \fBOPTIND\fP has an initial value of \fB1\fP, and is
normally set to \fB1\fP upon entry to a shell function and restored
-upon exit (this is disabled by the \fBPOSIX_BUILTINS\fP option)\&. \fBOPTARG\fP
+upon exit\&. (The \fBPOSIX_BUILTINS\fP option disables this, and also changes
+the way the value is calculated to match other shells\&.) \fBOPTARG\fP
is not reset and retains its value from the most recent call to
\fBgetopts\fP\&. If either of \fBOPTIND\fP or \fBOPTARG\fP is explicitly
unset, it remains unset, and the index or option argument is not
@@ -1141,6 +1201,28 @@ The \fB\-Z\fP option replaces the shell\&'s argument and environment space with
the given string, truncated if necessary to fit\&. This will normally be
visible in \fBps\fP (\fIps\fP(1)) listings\&. This feature is typically
used by daemons, to indicate their state\&.
+.PP
+Full job control is only available in the top\-level interactive shell,
+not in commands run in the left hand side of pipelines or within
+the \fB(\fP\fI\&.\&.\&.\fP\fB)\fP construct\&. However, a snapshot
+of the job state at that point is taken, so it is still possible
+to use the \fBjobs\fP builtin, or any parameter providing job information\&.
+This gives information about the state of jobs at the point the subshell
+was created\&. If background processes are created within the subshell,
+then instead information about those processes is provided\&.
+.PP
+For example,
+.PP
+.RS
+.nf
+\fBsleep 10 & # Job in background
+( # Shell forks
+jobs # Shows information about "sleep 10 &"
+sleep 5 & # Process in background (no job control)
+jobs # Shows information about "sleep 5 &"
+)\fP
+.fi
+.RE
.RE
.TP
.PD 0
@@ -1316,10 +1398,6 @@ Same as \fBtypeset\fP, except that the options \fB\-g\fP, and
\fB\-f\fP are not permitted\&. In this case the \fB\-x\fP option does not force
the use of \fB\-g\fP, i\&.e\&. exported variables will be local to functions\&.
.TP
-\fBlog\fP
-List all users currently logged in who are affected by
-the current setting of the \fBwatch\fP parameter\&.
-.TP
\fBlogout\fP [ \fIn\fP ]
Same as \fBexit\fP, except that it only works in a login shell\&.
.TP
@@ -1575,7 +1653,7 @@ Same as \fBfc \-e \-\fP\&.
\fBread \fP[ \fB\-rszpqAclneE\fP ] [ \fB\-t\fP [ \fInum\fP ] ] [ \fB\-k\fP [ \fInum\fP ] ] [ \fB\-d\fP \fIdelim\fP ]
.TP
.PD
-\fB \fP[ \fB\-u\fP \fIn\fP ] [ \fIname\fP[\fB?\fP\fIprompt\fP] ] [ \fIname\fP \&.\&.\&. ]
+\fB \fP[ \fB\-u\fP \fIn\fP ] [ [\fIname\fP][\fB?\fP\fIprompt\fP] ] [ \fIname\fP \&.\&.\&. ]
Read one line and break it into fields using the characters
in \fB$IFS\fP as separators, except as noted below\&.
The first field is assigned to the first \fIname\fP, the second field
@@ -1714,10 +1792,20 @@ Same as \fBhash \-r\fP\&.
\fBreturn\fP [ \fIn\fP ]
Causes a shell function or `\fB\&.\fP\&' script to return to
the invoking script with the return status specified by
-an arithmetic expression \fIn\fP\&. If \fIn\fP
+an arithmetic expression \fIn\fP\&.
+For example, the following prints `\fB42\fP\&':
+.RS
+.PP
+.RS
+.nf
+\fB() { integer foo=40; return "foo + 2" }
+echo $?\fP
+.fi
+.RE
+.PP
+If \fIn\fP
is omitted, the return status is that of the last command
executed\&.
-.RS
.PP
If \fBreturn\fP was executed from a trap in a \fBTRAP\fP\fINAL\fP function,
the effect is different for zero and non\-zero return status\&. With zero
@@ -1726,7 +1814,7 @@ will return to whatever it was previously processing; with a non\-zero
status, the shell will behave as interrupted except that the return
status of the trap is retained\&. Note that the numeric value of the signal
which caused the trap is passed as the first argument, so the statement
-`\fBreturn $((128+$1))\fP\&' will return the same status as if the signal
+`\fBreturn "128+$1"\fP\&' will return the same status as if the signal
had not been trapped\&.
.RE
.TP
@@ -1980,7 +2068,8 @@ unfreezing the tty does not guarantee settings made on the
command line are preserved\&. Strings of commands run between
editing the command line will see a consistent tty state\&.
See also the shell variable \fBSTTY\fP for a means of initialising
-the tty before running external commands\&.
+the tty before running external commands and/or freezing the tty
+around a single command\&.
.RE
.TP
\fBtype\fP [ \fB\-wfpamsS\fP ] \fIname\fP \&.\&.\&.
@@ -2013,7 +2102,11 @@ function completes\&. See
retain their special attributes when made local\&.
.PP
For each \fIname\fP\fB=\fP\fIvalue\fP assignment, the parameter
-\fIname\fP is set to \fIvalue\fP\&.
+\fIname\fP is set to \fIvalue\fP\&. If the assignment is omitted and \fIname\fP
+does \fInot\fP refer to an existing parameter, a new parameter is intialized
+to empty string, zero, or empty array (as appropriate), \fIunless\fP the
+shell option \fBTYPESET_TO_UNSET\fP is set\&. When that option is set,
+the parameter attributes are recorded but the parameter remains unset\&.
.PP
If the shell option \fBTYPESET_SILENT\fP is not set, for each remaining
\fIname\fP that refers to a parameter that is already set, the name and
@@ -2101,7 +2194,7 @@ a set of three normal command line arguments to \fBtypeset\fP after
expansion\&. Hence it is not possible to assign to multiple arrays by
this means\&.
.PP
-Note that each interface to any of the commands my be disabled
+Note that each interface to any of the commands may be disabled
separately\&. For example, `\fBdisable \-r typeset\fP\&' disables the reserved
word interface to \fBtypeset\fP, exposing the builtin interface, while
`\fBdisable typeset\fP\&' disables the builtin\&. Note that disabling the
@@ -2514,7 +2607,7 @@ will report an error if this fails\&.
.TP
\fBumask\fP [ \fB\-S\fP ] [ \fImask\fP ]
The umask is set to \fImask\fP\&. \fImask\fP can be either
-an octal number or a symbolic value as described in \fIchmod\fP(1)\&.
+an octal number or a symbolic value as described in the \fIchmod\fP(1) man page\&.
If \fImask\fP is omitted, the current value is printed\&. The \fB\-S\fP
option causes the mask to be printed as a symbolic value\&. Otherwise,
the mask is printed as an octal number\&. Note that in
diff --git a/Doc/zshcalsys.1 b/Doc/zshcalsys.1
index e49e2b05c..0a9b557b6 100644
--- a/Doc/zshcalsys.1
+++ b/Doc/zshcalsys.1
@@ -1,4 +1,4 @@
-.TH "ZSHCALSYS" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHCALSYS" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshcalsys \- zsh calendar system
.\" Yodl file: Zsh/calsys.yo
@@ -531,7 +531,7 @@ the dates in the calendar file\&.
\fBcalendar_add\fP [ \fB\-BL\fP ] \fIevent\fP \&.\&.\&.
Adds a single event to the calendar in the appropriate location\&.
The event can contain multiple lines, as described in
-the section Calendar File Format above\&.
+the section `Calendar File Format\&' above\&.
Using this function ensures that the calendar file is sorted in date
and time order\&. It also makes special arrangements for locking
the file while it is altered\&. The old calendar is left in a file
diff --git a/Doc/zshcompctl.1 b/Doc/zshcompctl.1
index deb884a07..a70703099 100644
--- a/Doc/zshcompctl.1
+++ b/Doc/zshcompctl.1
@@ -1,4 +1,4 @@
-.TH "ZSHCOMPCTL" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHCOMPCTL" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshcompctl \- zsh programmable completion
.\" Yodl file: Zsh/compctl.yo
diff --git a/Doc/zshcompsys.1 b/Doc/zshcompsys.1
index 09cf8c120..1edd707b8 100644
--- a/Doc/zshcompsys.1
+++ b/Doc/zshcompsys.1
@@ -1,4 +1,4 @@
-.TH "ZSHCOMPSYS" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHCOMPSYS" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshcompsys \- zsh completion system
.\" Yodl file: Zsh/compsys.yo
@@ -48,7 +48,7 @@ Styles modify various operations of the completion system, such as
output formatting, but also what kinds of completers are used (and in
what order), or which tags are examined\&. Styles may accept arguments
and are manipulated using the \fBzstyle\fP command described in
-see \fIzshmodules\fP(1)\&.
+\fIzshmodules\fP(1)\&.
.PP
In summary, tags describe \fIwhat\fP the completion objects are, and style
\fBhow\fP they are to be completed\&. At various points of execution, the
@@ -175,7 +175,7 @@ root or by the current user\&. If such files or directories are found,
avoid these tests and make all files found be used without asking, use the
option \fB\-u\fP, and to make \fBcompinit\fP silently ignore all insecure files
and directories use the option \fB\-i\fP\&. This security check is skipped
-entirely when the \fB\-C\fP option is given\&.
+entirely when the \fB\-C\fP option is given, provided the dumpfile exists\&.
.PP
The security check can be retried at any time by running the function
\fBcompaudit\fP\&. This is the same check used by \fBcompinit\fP, but when it
@@ -312,13 +312,13 @@ The special contexts for which completion functions can be defined are:
The right hand side of an array\-assignment
(`\fIname\fP\fB=(\fP\fI\&.\&.\&.\fP\fB)\fP\&')
.TP
-\fB\-brace\-parameter\-\fP
-The name of a parameter expansion within braces (`\fB${\fP\fI\&.\&.\&.\fP\fB}\fP\&')
-.TP
\fB\-assign\-parameter\-\fP
The name of a parameter in an assignment, i\&.e\&. on the left hand side of
an `\fB=\fP\&'
.TP
+\fB\-brace\-parameter\-\fP
+The name of a parameter expansion within braces (`\fB${\fP\fI\&.\&.\&.\fP\fB}\fP\&')
+.TP
\fB\-command\-\fP
A word in command position
.TP
@@ -667,8 +667,8 @@ the section `Bindable Commands\&' below\&.
When looking up styles the completion system uses full context names,
including the tag\&. Looking up the value of a style therefore consists of
two things: the context, which is matched to the most specific (best
-fitting) style pattern, and the name of the style itself, which must be
-matched exactly\&. The following examples demonstrate that style patterns
+fitting) pattern, and the name of the style itself, which must be
+matched exactly\&. The following examples demonstrate that patterns
may be loosely defined for styles that apply broadly, or as tightly
defined as desired for styles that apply in narrower circumstances\&.
.PP
@@ -686,7 +686,7 @@ put
in a startup file (probably \fB\&.zshrc\fP)\&.
This gives the \fBverbose\fP style the value \fByes\fP in every
context inside the completion system, unless that context has a more
-specific definition\&. It is best to avoid giving the context as `\fB*\fP\&'
+specific definition\&. It is best to avoid giving the pattern as `\fB*\fP\&'
in case the style has some meaning outside the completion system\&.
.PP
Many such general purpose styles can be configured simply by using the
@@ -733,15 +733,21 @@ as \fBmenu\fP and \fBlist\-rows\-first\fP\&.
.PP
Note that the order in which styles are \fIdefined\fP does not matter; the
style mechanism uses the most specific possible match for a particular
-style to determine the set of values\&. More precisely, strings are
+style to determine the set of values\&. Strings are
preferred over patterns (for example, `\fB:completion::complete:::foo\fP\&' is
more specific than `\fB:completion::complete:::*\&'\fP), and longer patterns are
-preferred over shorter patterns\&.
-.PP
-A good rule of thumb is that any completion style pattern that needs to
-include more than one wildcard (\fB*\fP) and that does not end in a tag
-name, should include all six colons (\fB:\fP), possibly surrounding
-additional wildcards\&.
+preferred over the pattern `\fB*\fP\&'\&. See
+\fIzmodules\fP(1)
+for details\&.
+.PP
+Context patterns that use something other than a wildcard (\fB*\fP) to match the
+middle parts of the context \-\- the \fIcompleter\fP, \fIcommand\fP, and
+\fIargument\fP in
+\fB:completion:\fP\fIfunction\fP\fB:\fP\fIcompleter\fP\fB:\fP\fIcommand\fP\fB:\fP\fIargument\fP\fB:\fP\fItag\fP
+\-\- should include all six colons (\fB:\fP) explicitly\&. Without this,
+a pattern such as \fB:completion:*:foo:*\fP could match \fBfoo\fP against a
+component other than the intended one (for example, against \fIcompleter\fP when
+a match against \fIcommand\fP was intended)\&.
.PP
Style names like those of tags are arbitrary and depend on the completion
function\&. However, the following two sections list some of the most
@@ -874,12 +880,12 @@ for hostnames
\fBindexes\fP
for array indexes
.TP
-\fBjobs\fP
-for jobs (as listed by the `\fBjobs\fP\&' builtin)
-.TP
\fBinterfaces\fP
for network interfaces
.TP
+\fBjobs\fP
+for jobs (as listed by the `\fBjobs\fP\&' builtin)
+.TP
\fBkeymaps\fP
for names of zsh keymaps
.TP
@@ -898,12 +904,12 @@ directory when completing arguments of \fBcd\fP and related builtin
commands (compare \fBpath\-directories\fP) \-\- when the \fBcdpath\fP
array is unset, \fBdirectories\fP is used instead
.TP
-\fBmanuals\fP
-for names of manual pages
-.TP
\fBmailboxes\fP
for e\-mail folders
.TP
+\fBmanuals\fP
+for names of manual pages
+.TP
\fBmaps\fP
for map names (e\&.g\&. NIS maps)
.TP
@@ -941,10 +947,6 @@ offering the original string as a match
\fBother\-accounts\fP
used to look up the \fBusers\-hosts\fP style
.TP
-\fBother\-files\fP
-for the names of any non\-directory files\&. This is used instead
-of \fBall\-files\fP when the \fBlist\-dirs\-first\fP style is in effect\&.
-.TP
\fBpackages\fP
for packages (e\&.g\&. \fBrpm\fP or installed \fBDebian\fP packages)
.TP
@@ -1329,6 +1331,11 @@ that the resulting string is the longest unambiguous string possible\&.
However, menu completion can be used to cycle through all matches\&.
.RE
.TP
+\fBextra\-verbose\fP
+If set, the completion listing is more verbose at the cost of
+a probable decrease in completion speed\&. Completion performance
+will suffer if this style is set to `true\&'\&.
+.TP
\fBfake\fP
This style may be set for any completion context\&. It
specifies additional strings that will always be completed in that
@@ -1483,9 +1490,10 @@ If no `\fB:\fP\fItag\fP\&' is given the `\fBfiles\fP' tag will be used\&.
The \fItag\fP may also be followed by an optional second colon and a
description, which will be used for the `\fB%d\fP\&' in the value of
the \fBformat\fP style (if that is set) instead of the default
-description supplied by the completion function\&. If the description
-given here contains itself a `\fB%d\fP\&', that is replaced with the
-description supplied by the completion function\&.
+description supplied by the completion function\&. The inclusion
+of a description also gives precedence to associated options such as
+for completion grouping so it can be used where files should be
+separated\&.
.PP
For example, to make the \fBrm\fP command first complete only names of
object files and then the names of all files if there is no matching
@@ -1515,6 +1523,19 @@ all files using the pattern `\fB*\fP\&' at the first step and stops when it
sees this pattern\&. Note also it will never try a pattern more than once
for a single completion attempt\&.
.PP
+To separate directories into a separate group from the files but still
+complete them at the first attempt, a description needs to be given\&.
+Note that directories need to be explicitly excluded from the
+globbed\-files because `\fB*\fP\&' will match directories\&. For grouping, it
+is also necessary to set the \fBgroup\-name\fP style\&.
+.PP
+.RS
+.nf
+\fBzstyle \&':completion:*' file\-patterns \e
+ \&'%p(^\-/):globbed\-files *(\-/):directories:location'\fP
+.fi
+.RE
+.PP
During the execution of completion functions, the \fBEXTENDED_GLOB\fP
option is in effect, so the characters `\fB#\fP\&', `\fB~\fP' and `\fB^\fP' have
special meanings in the patterns\&.
@@ -1605,6 +1626,14 @@ builtin command from the \fBzsh/zutil\fP module, see
\fIzshmodules\fP(1)\&.
.RE
.TP
+\fBgain\-privileges\fP
+If set to \fBtrue\fP, this style enables the use of commands like \fBsudo\fP
+or \fBdoas\fP to gain extra privileges when retrieving information for
+completion\&. This is only done when a command such as \fBsudo\fP appears on
+the command\-line\&. To force the use of, e\&.g\&. \fBsudo\fP or to override any
+prefix that might be added due to \fBgain\-privileges\fP, the \fBcommand\fP
+style can be used with a value that begins with a hyphen\&.
+.TP
\fBglob\fP
This is used by the \fB_expand\fP completer\&. If
it is set to `true\&' (the default), globbing will be attempted on the
@@ -1649,6 +1678,9 @@ different types of matches displayed separately, one can just set:
.PP
All matches for which no group name is defined will be put in a group
named \fB\-default\-\fP\&.
+.PP
+To display the group name in the output, see the \fBformat\fP style (q\&.v\&.)
+under the \fBdescriptions\fP tag\&.
.RE
.TP
\fBgroup\-order\fP
@@ -1760,11 +1792,6 @@ Excluded values act in a similar fashion to values of the
the \fB_ignored\fP completer\&.
.RE
.TP
-\fBextra\-verbose\fP
-If set, the completion listing is more verbose at the cost of
-a probable decrease in completion speed\&. Completion performance
-will suffer if this style is set to `true\&'\&.
-.TP
\fBignored\-patterns\fP
A list of patterns; any trial completion matching one of the patterns
will be excluded from consideration\&. The
@@ -1802,6 +1829,33 @@ string, menu completion will be started when the string typed by the
user is longer than the common prefix to the corresponding IDs\&.
.RE
.TP
+\fBinsert\-sections\fP
+This style is used with tags of the form `\fBmanuals\&.\fP\fIX\fP\&' when
+completing names of manual pages\&. If set and the \fIX\fP in the tag name matches
+the section number of the page being completed, the section number is inserted
+along with the page name\&. For example, given
+.RS
+.PP
+.RS
+.nf
+\fBzstyle \&':completion:*:manuals\&.*' insert\-sections true\fP
+.fi
+.RE
+.PP
+\fBman ssh_<TAB>\fP may be completed to \fBman 5 ssh_config\fP\&.
+.PP
+The value may also be set to one of `\fBprepend\fP\&', or `\fBsuffix\fP'\&.
+`\fBprepend\fP\&' behaves the same as `true' as in the above example, while
+`\fBsuffix\fP\&' would complete \fBman ssh_<TAB>\fP as \fBman ssh_config\&.5\fP\&.
+.PP
+This is especially useful in conjunction with \fBseparate\-sections\fP, as
+it ensures that the page requested of \fBman\fP corresponds to the one
+displayed in the completion listing when there are multiple pages with the
+same name (e\&.g\&., \fBprintf(1)\fP and \fBprintf(3)\fP)\&.
+.PP
+The default for this style is `false\&'\&.
+.RE
+.TP
\fBinsert\-tab\fP
If this is set to `true\&', the completion system will
insert a TAB character (assuming that was used to start completion) instead
@@ -1842,14 +1896,6 @@ the string `\fBpattern\fP\&'\&. Then the pattern on the line is left
unchanged if it does not match unambiguously\&.
.RE
.TP
-\fBgain\-privileges\fP
-If set to \fBtrue\fP, this style enables the use of commands like \fBsudo\fP
-or \fBdoas\fP to gain extra privileges when retrieving information for
-completion\&. This is only done when a command such as \fBsudo\fP appears on
-the command\-line\&. To force the use of, e\&.g\&. \fBsudo\fP or to override any
-prefix that might be added due to \fBgain\-privileges\fP, the \fBcommand\fP
-style can be used with a value that begins with a hyphen\&.
-.TP
\fBkeep\-prefix\fP
This style is used by the \fB_expand\fP completer\&. If it is `true\&', the
completer will try to keep a prefix containing a tilde or parameter
@@ -1866,6 +1912,12 @@ to give up when a single expansion with the restored prefix is the same
as the original; hence any remaining completers may be called\&.
.RE
.TP
+\fBknown\-hosts\-files\fP
+This style should contain a list of files to search for host names and
+(if the \fBuse\-ip\fP style is set) IP addresses in a format compatible with
+ssh \fBknown_hosts\fP files\&. If it is not set, the files
+\fB/etc/ssh/ssh_known_hosts\fP and \fB~/\&.ssh/known_hosts\fP are used\&.
+.TP
\fBlast\-prompt\fP
This is a more flexible form of the \fBALWAYS_LAST_PROMPT\fP option\&.
If it is `true\&', the completion system will try to return the cursor to
@@ -1876,12 +1928,6 @@ previous line if this style is `true\&' for all types of match\&. Note
that unlike the \fBALWAYS_LAST_PROMPT\fP option this is independent of the
numeric argument\&.
.TP
-\fBknown\-hosts\-files\fP
-This style should contain a list of files to search for host names and
-(if the \fBuse\-ip\fP style is set) IP addresses in a format compatible with
-ssh \fBknown_hosts\fP files\&. If it is not set, the files
-\fB/etc/ssh/ssh_known_hosts\fP and \fB~/\&.ssh/known_hosts\fP are used\&.
-.TP
\fBlist\fP
This style is used by the \fB_history_complete_word\fP bindable command\&.
If it is set to `true\&' it has no effect\&. If it is set to `false'
@@ -1922,11 +1968,10 @@ obtained by setting the style to an empty string (i\&.e\&. \fB\&''\fP)\&.
.RE
.TP
\fBlist\-dirs\-first\fP
-This is used by file completion\&. If set, directories to be completed
-are listed separately from and before completion for other files,
-regardless of tag ordering\&. In addition, the tag \fBother\-files\fP
-is used in place of \fBall\-files\fP for the remaining files, to indicate
-that no directories are presented with that tag\&.
+This is used by file completion and corresponds to a particular
+setting of the \fBfile\-patterns\fP style\&.
+If set, the default directories to be completed
+are listed separately from and before completion for other files\&.
.TP
\fBlist\-grouped\fP
If this style is `true\&' (the default), the completion system will try to
@@ -1977,17 +2022,17 @@ This style is tested in the same way as the \fBlist\-packed\fP style and
determines whether matches are to be listed in a rows\-first fashion as
if the \fBLIST_ROWS_FIRST\fP option were set\&.
.TP
+\fBlist\-separator\fP
+The value of this style is used in completion listing to separate the
+string to complete from a description when possible (e\&.g\&. when
+completing options)\&. It defaults to `\fB\-\fP\fB\-\fP\&' (two hyphens)\&.
+.TP
\fBlist\-suffixes\fP
This style is used by the function that completes filenames\&. If it is
`true\&', and completion is attempted on a string containing multiple partially
typed pathname components, all ambiguous components will be shown\&.
Otherwise, completion stops at the first ambiguous component\&.
.TP
-\fBlist\-separator\fP
-The value of this style is used in completion listing to separate the
-string to complete from a description when possible (e\&.g\&. when
-completing options)\&. It defaults to `\fB\-\fP\fB\-\fP\&' (two hyphens)\&.
-.TP
\fBlocal\fP
This is for use with functions that complete URLs for which the
corresponding files are available directly from the file system\&.
@@ -2448,7 +2493,7 @@ For example,
.RE
.PP
If the current directory is \fB/home/pws/zsh/Src\fP, then
-\fBzle_tr\fP\fITAB\fP can be completed to \fBZle/zle_tricky\&.c\fP\&.
+\fBzle_tr<TAB>\fP can be completed to \fBZle/zle_tricky\&.c\fP\&.
.RE
.TP
\fBregular\fP
@@ -2501,13 +2546,16 @@ The default is to scroll by single lines\&.
\fBseparate\-sections\fP
This style is used with the \fBmanuals\fP tag when completing names of
manual pages\&. If it is `true\&', entries for different sections are
-added separately using tag names of the form `\fBmanual\&.\fP\fIX\fP\&',
+added separately using tag names of the form `\fBmanuals\&.\fP\fIX\fP\&',
where \fIX\fP is the section number\&. When the \fBgroup\-name\fP style is
also in effect, pages from different sections will appear separately\&.
This style is also used similarly with the \fBwords\fP style when
completing words for the dict command\&. It allows words from different
-dictionary databases to be added separately\&.
+dictionary databases to be added separately\&. See also \fBinsert\-sections\fP\&.
+.RS
+.PP
The default for this style is `false\&'\&.
+.RE
.TP
\fBshow\-ambiguity\fP
If the \fBzsh/complist\fP module is loaded, this style can be used to
@@ -3644,8 +3692,20 @@ described using the \fIspec\fPs which are of the form:
`\fItag\fP\fB:\fP\fIdescr\fP\fB:\fP\fIaction\fP\&'\&. The \fItag\fPs are offered using
\fB_tags\fP and if the tag is requested, the \fIaction\fP is executed with the
given description \fIdescr\fP\&. The \fIaction\fPs are those accepted
-by the \fB_arguments\fP function (described below), excluding the
-`\fB\->\fP\fIstate\fP\&' and `\fB=\fP\fI\&.\&.\&.\fP' forms\&.
+by the \fB_arguments\fP function (described below), with the following
+exceptions:
+.PD 0
+.TP
+.PD
+\(bu
+The `\fB\->\fP\fIstate\fP\&' and `\fB=\fP\fI\&.\&.\&.\fP' forms are not supported\&.
+
+.TP
+\(bu
+The `\fB((a\e:bar b\e:baz\fP\fB))\fP\&' form does not need
+the colon to be escaped, since the \fIspec\fPs have no colon\-separated fields
+after the \fIaction\fP\&.
+
.PP
For example, the \fIaction\fP may be a simple function call:
.PP
@@ -3800,6 +3860,12 @@ The default \fImatchspec\fP allows partial word completion after `\fB_\fP\&' and
\fB\fBr:|[_\-]=* r:|=*\fP\fP
.fi
.RE
+.TP
+\fB\-0\fP
+When populating values of the `\fBopt_args\fP\&' associative array, don't
+backslash\-escape colons and backslashes and use NUL rather than colon for
+joining multiple values\&. This option is described in more detail below, under
+the heading \fI\fIspec\fPs: actions\fP\&.
.PP
\fI\fIspec\fPs: overview\fP
.PP
@@ -4006,6 +4072,7 @@ specific contexts: on the first call `\fB_arguments $global_options\fP\&' is
used, and on subsequent calls `\fB_arguments !$^global_options\fP\&'\&.
.PP
\fI\fIspec\fPs: actions\fP
+
.PP
In each of the forms above the \fIaction\fP determines how
completions should be generated\&. Except for the `\fB\->\fP\fIstring\fP\&'
@@ -4147,9 +4214,29 @@ the normal arguments from the command line, i\&.e\&. the words from the
command line after the command name excluding all options and their
arguments\&. Options are stored in the associative array
`\fBopt_args\fP\&' with option names as keys and their arguments as
-the values\&. For options that have more than one argument these are
-given as one string, separated by colons\&. All colons and backslashes
-in the original arguments are preceded with backslashes\&.
+the values\&. By default, all colons and backslashes in the value are escaped
+with backslashes, and if an option has multiple arguments (for example, when
+using an \fIoptspec\fP of the form `\fB*\fP\fIoptspec\fP\&'), they are joined with
+(unescaped) colons\&. However, if the \fB\-0\fP option was passed, no backslash
+escaping is performed, and multiple values are joined with NUL bytes\&. For
+example, after `\fBzsh \-o foo:foo \-o bar:bar \-o <TAB>\fP\&', the contents of
+`\fBopt_args\fP\&' would be
+.PP
+.RS
+.nf
+\fBtypeset \-A opt_args=( [\-o]=\&'foo\e:foo:bar\e:bar:' )\fP
+.fi
+.RE
+.PP
+by default, and
+.PP
+.RS
+.nf
+\fBtypeset \-A opt_args=( [\-o]=$\&'foo:foo\ex00bar:bar\ex00' )\fP
+.fi
+.RE
+.PP
+if \fB_arguments\fP had been called with the \fB\-0\fP option\&.
.PP
The parameter `\fBcontext\fP\&' is set when returning to the calling function
to perform an action of the form `\fB\->\fP\fIstring\fP\&'\&. It is set to an
@@ -4398,7 +4485,7 @@ The last two descriptions say what should be completed as
arguments\&. The first describes the first argument as a
`\fIpostscript file\fP\&' and makes files ending in `\fBps\fP' or `\fBeps\fP'
be completed\&. The last description gives all other arguments the
-description `\fIpage numbers\fP\&' but does not offer completions\&.
+description `\fIpage number\fP\&' but does not offer completions\&.
.RE
.TP
\fB_cache_invalid\fP \fIcache_identifier\fP
@@ -4533,6 +4620,14 @@ This function completes names of completers\&.
\fB\-p\fP
Include the leading underscore (`\fB_\fP\&') in the matches\&.
.RE
+.TP
+\fB_default\fP
+This function corresponds to the \fB\-default\-\fP special context which is
+applied where no completion is defined\&. It is useful to call it under
+certain error conditions such as completion after an unrecognised
+subcommand\&. This applies the concept of graceful degradation to the
+completion system, allowing it to fallback on basic completion of
+commonly useful things like filenames\&.
.TP
.PD 0
@@ -4611,8 +4706,26 @@ not contain an explanation string to be displayed above the matches\&.
If \fB_description\fP is called with more than three arguments,
the additional \fIspec\fPs should be of the form `\fIchar\fP\fB:\fP\fIstr\fP\&'\&.
These supply escape sequence replacements for the \fBformat\fP style:
-every appearance of `\fB%\fP\fIchar\fP\&' will be
-replaced by \fIstring\fP\&.
+every appearance of `\fB%\fP\fIchar\fP\&' will be replaced by \fIstring\fP\&.
+If no additional \fIspec\fPs are given but the description in \fIdescr\fP
+conforms to a common form then further escape sequences are set for
+elements of that description\&. These elements correspond to a default
+value (`\fB%o\fP\&'), the units (`\fB%m\fP') range of acceptable values
+(`\fB%r\fP\&') and the remaining initial part of the description (`\fB%h\fP')\&.
+The form the description takes consists of specifying the units and
+range in parentheses and the default value in square brackets, for
+example:
+.PP
+.RS
+.nf
+\fB_description times expl \&'timeout (seconds) (0\-60) [20]'\fP
+.fi
+.RE
+.PP
+It is possible to use \fBzformat\fP conditional expressions when styling
+these elements\&. So, for example, to add `\fBdefault:\fP\&' as a tag but only
+when there is a default value to show, the \fBformat\fP style might
+include `\fB%(o\&.default: %o\&.)\fP\&'\&.
.PP
If the \fB\-x\fP option is given, the description will be passed to
\fBcompadd\fP using the \fB\-x\fP option instead of the default \fB\-X\fP\&. This
@@ -4916,6 +5029,78 @@ no matches have been found\&. This is the same effect as in the
\fB\-first\-\fP context\&.
.RE
.TP
+\fB_numbers\fP [ \fIoption\fP \&.\&.\&. ] [ \fIdescription\fP ] [ \fIsuffix\fP \&.\&.\&. ]
+This can be used where a number is followed by a suffix to indicate the units\&.
+The unit suffixes are completed and can also be included in the description
+used when completion is invoked for the preceding number\&.
+.RS
+.PP
+In addition to common \fBcompadd\fP options, \fB_numbers\fP accepts the following
+options:
+.PP
+.PD 0
+.TP
+.PD
+\fB\-t\fP \fItag\fP
+Specify a tag to use instead of the default of \fBnumbers\fP\&.
+.TP
+\fB\-u\fP \fIunits\fP
+Indicate the default units for the number, e\&.g\&. \fBbytes\fP\&.
+.TP
+\fB\-l\fP \fImin\fP
+Specify the lowest possible value for the number\&.
+.TP
+\fB\-m\fP \fImax\fP
+Specify the highest possible value for the number\&.
+.TP
+\fB\-d\fP \fIdefault\fP
+Specify the default value\&.
+.TP
+\fB\-N\fP
+Allow negative numbers\&. This is implied if the range includes a negative\&.
+.TP
+\fB\-f\fP
+Allow decimal numbers\&.
+.PP
+Where a particular suffix represents the default units for a number, it
+should be prefixed with a colon\&. Additionally, suffixes can be followed
+by a colon and a description\&. So for example, the following allows the
+age of something to be specified, either in seconds or with an optional
+suffix with a longer unit of time:
+.PP
+.RS
+.nf
+\fB_numbers \-u seconds age :s:seconds m:minutes h:hours d:days\fP
+.fi
+.RE
+.PP
+It is typically helpful for units to be presented in order of magnitude
+when completed\&. To facilitate this, the order in which they are given
+is preserved\&.
+.PP
+When the \fBformat\fP style is looked up with the \fBdescriptions\fP tag or
+the tag specified with \fB\-t\fP, the list of suffixes is available as a
+`\fB%x\fP\&' escape sequence\&. This is in addition to the usual sequences
+documented under the \fBformat\fP style\&. The form this list takes can also
+be configured\&. To this end, the \fBformat\fP style is first looked up with
+the tag \fBunit\-suffixes\fP\&. The retrieved format is applied to each
+suffix in turn and the results are then concatenated to form the
+completed list\&. For the \fBunit\-suffixes\fP format, `\fB%x\fP\&' expands to
+the individual suffix and `\fB%X\fP\&' to its description\&. \fB%d\fP' indicates
+a default suffix and can be used in a condition\&. The index and reverse
+index are set in `\fB%i\fP\&' and `\fB%r\fP' respectively and are useful for
+text included only with the first and last suffixes in the list\&. So for
+example, the following joins the suffixes together as a comma\-separated
+list:
+.PP
+.RS
+.nf
+\fBzstyle \&':completion:*:unit\-suffixes' format '%x%(r::,)'\fP
+.fi
+.RE
+.RE
+.PP
+.TP
\fB_options\fP
This can be used to complete the names of shell options\&. It provides a
matcher specification that ignores a leading `\fBno\fP\&', ignores
@@ -5513,10 +5698,13 @@ matches with the given description:
.nf
\fBlocal expl
_wanted tag expl \&'description' \e
- compadd matches\&.\&.\&.\fP
+ compadd \-\- \fImatch1\fP \fImatch2\fP\&.\&.\&.\fP
.fi
.RE
.PP
+See also the use of \fB_wanted\fP in the example function in
+the subsection `Dynamic named directories\&' in \fIzshexpn\fP(1)\&.
+.PP
Note that, as for \fB_requested\fP, the \fIcommand\fP must be able to
accept options to be passed down to \fBcompadd\fP\&.
.PP
@@ -5549,8 +5737,6 @@ needs to know what the user\&'s option preferences are\&. These are saved
in the \fB_comp_caller_options\fP associative array\&. Option names, spelled
in lowercase without underscores, are mapped to one or other of the
strings `\fBon\fP\&' and `\fBoff\fP'\&.
-.RS
-.PP
.TP
\fB_comp_priv_prefix\fP
Completion functions such as \fB_sudo\fP can set the \fB_comp_priv_prefix\fP
diff --git a/Doc/zshcompwid.1 b/Doc/zshcompwid.1
index 2e44b5272..54cc3ee72 100644
--- a/Doc/zshcompwid.1
+++ b/Doc/zshcompwid.1
@@ -1,4 +1,4 @@
-.TH "ZSHCOMPWID" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHCOMPWID" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshcompwid \- zsh completion widgets
.\" Yodl file: Zsh/compwid.yo
@@ -35,7 +35,7 @@ work even if the widget in question has been re\-bound\&.
When this newly defined widget is bound to a key
using the \fBbindkey\fP builtin command defined in the \fBzsh/zle\fP module
(see \fIzshzle\fP(1)), typing that key will call the shell function `\fBcompleter\fP\&'\&. This
-function is responsible for generating the possible matches using the
+function is responsible for generating completion matches using the
builtins described below\&. As with other ZLE widgets, the function is
called with its standard input closed\&.
.PP
@@ -201,7 +201,7 @@ was generated, the match is accepted\&.
The string of an exact match if one was found, otherwise unset\&.
.TP
\fBignored\fP
-The number of words that were ignored because they matched one of the
+The number of completions that were ignored because they matched one of the
patterns given with the \fB\-F\fP option to the \fBcompadd\fP builtin
command\&.
.TP
@@ -294,8 +294,7 @@ It may be set to any other value; when the widget exits this value
will be used in the same way as the value of \fBLISTMAX\fP\&.
.TP
\fBnmatches\fP
-The number of matches generated and accepted by the completion code so
-far\&.
+The number of matches added by the completion code so far\&.
.TP
\fBold_insert\fP
On entry to the widget this will be set to the number of the match of
@@ -331,7 +330,8 @@ value of a parameter assignment\&.
.TP
\fBpattern_insert\fP
Normally this is set to \fBmenu\fP, which specifies that menu completion will
-be used whenever a set of matches was generated using pattern matching\&. If
+be used whenever a set of matches was generated using \fBpattern_match\fP
+(see below)\&. If
it is set to any other non\-empty string by the user and menu completion is
not selected by other option settings, the code will instead insert any
common prefix for the generated matches as with normal completion\&.
@@ -347,7 +347,7 @@ additionally a wildcard `\fB*\fP\&' is assumed at the cursor position; if
it is empty or unset, metacharacters will be treated literally\&.
.RS
.PP
-Note that the matcher specifications given to the \fBcompadd\fP builtin
+Note that the match specifications given to the \fBcompadd\fP builtin
command are not used if this is set to a non\-empty string\&.
.RE
.TP
@@ -450,20 +450,19 @@ edited\&.
\fB \fP[\fB\-E\fP \fInumber\fP ]
.TP
.PD
-\fB \fP[\fB\-M\fP \fImatch\-spec\fP ] [ \fB\-\fP\fB\-\fP ] [ \fIwords\fP \&.\&.\&. ]
+\fB \fP[\fB\-M\fP \fImatch\-spec\fP ] [ \fB\-\fP\fB\-\fP ] [ \fIcompletions\fP \&.\&.\&. ]
.RS
.PP
This builtin command can be used to add matches directly and control
all the information the completion code stores with each possible
-match\&. The return status is zero if at least one match was added and
+completion\&. The return status is zero if at least one match was added and
non\-zero if no matches were added\&.
.PP
-The completion code breaks the string to complete into seven fields in
-the order:
+The completion code breaks each match into seven fields in the order:
.PP
.RS
.nf
-\fI<ipre><apre><hpre><word><hsuf><asuf><isuf>\fP
+\fI<ipre><apre><hpre><body><hsuf><asuf><isuf>\fP
.fi
.RE
.PP
@@ -473,12 +472,12 @@ is an ignored prefix taken from the command line, the contents of the
option\&. With the \fB\-U\fP option, only the string from the \fB\-i\fP
option is used\&. The field \fI<apre>\fP is an optional prefix string
given with the \fB\-P\fP option\&. The \fI<hpre>\fP field is a string
-that is considered part of the match but that should not be shown when
+that is considered part of the match but that should not be shown when
listing completions, given with the \fB\-p\fP option; for example,
functions that do filename generation might specify
-a common path prefix this way\&. \fI<word>\fP is the part of the match that
-should appear in the list of completions, i\&.e\&. one of the \fIwords\fP given
-at the end of the \fBcompadd\fP command line\&. The suffixes \fI<hsuf>\fP,
+a common path prefix this way\&. \fI<body>\fP is the part of the match that
+should appear in the list of matches shown to the user\&.
+The suffixes \fI<hsuf>\fP,
\fI<asuf>\fP and \fI<isuf>\fP correspond to the prefixes \fI<hpre>\fP,
\fI<apre>\fP and \fI<ipre>\fP and are given by the options \fB\-s\fP, \fB\-S\fP and
\fB\-I\fP, respectively\&.
@@ -489,53 +488,53 @@ The supported flags are:
.TP
.PD
\fB\-P\fP \fIprefix\fP
-This gives a string to be inserted before the given \fIwords\fP\&. The
+This gives a string to be inserted before each match\&. The
string given is not considered as part of the match and any shell
metacharacters in it will not be quoted when the string is inserted\&.
.TP
\fB\-S\fP \fIsuffix\fP
-Like \fB\-P\fP, but gives a string to be inserted after the match\&.
+Like \fB\-P\fP, but gives a string to be inserted after each match\&.
.TP
\fB\-p\fP \fIhidden\-prefix\fP
-This gives a string that should be inserted into the command line before the
+This gives a string that should be inserted before each
match but that should not appear in the list of matches\&. Unless the
\fB\-U\fP option is given, this string must be matched as part of the string
on the command line\&.
.TP
\fB\-s\fP \fIhidden\-suffix\fP
-Like `\fB\-p\fP\&', but gives a string to insert after the match\&.
+Like `\fB\-p\fP\&', but gives a string to insert after each match\&.
.TP
\fB\-i\fP \fIignored\-prefix\fP
-This gives a string to insert into the command line just before any
+This gives a string to insert just before any
string given with the `\fB\-P\fP\&' option\&. Without `\fB\-P\fP' the string is
-inserted before the string given with `\fB\-p\fP\&' or directly before the
+inserted before the string given with `\fB\-p\fP\&' or directly before each
match\&.
.TP
\fB\-I\fP \fIignored\-suffix\fP
Like \fB\-i\fP, but gives an ignored suffix\&.
.TP
\fB\-a\fP
-With this flag the \fIwords\fP are taken as names of arrays and the
-possible matches are their values\&. If only some elements of the
-arrays are needed, the \fIwords\fP may also contain subscripts, as in
+With this flag the \fIcompletions\fP are taken as names of arrays and the
+actual completions are their values\&. If only some elements of the
+arrays are needed, the \fIcompletions\fP may also contain subscripts, as in
`\fBfoo[2,\-1]\fP\&'\&.
.TP
\fB\-k\fP
-With this flag the \fIwords\fP are taken as names of associative arrays
-and the possible matches are their keys\&. As for \fB\-a\fP, the
+With this flag the \fIcompletions\fP are taken as names of associative arrays
+and the actual completions are their keys\&. As for \fB\-a\fP, the
\fIwords\fP may also contain subscripts, as in `\fBfoo[(R)*bar*]\fP\&'\&.
.TP
\fB\-d\fP \fIarray\fP
-This adds per\-match display strings\&. The \fIarray\fP should contain one
-element per \fIword\fP given\&. The completion code will then display the
-first element instead of the first \fIword\fP, and so on\&. The
+This adds per\-completion display strings\&. The \fIarray\fP should contain one
+element per \fIcompletion\fP given\&. The completion code will then display the
+first element instead of the first \fIcompletion\fP, and so on\&. The
\fIarray\fP may be given as the name of an array parameter or directly
as a space\-separated list of words in parentheses\&.
.RS
.PP
-If there are fewer display strings than \fIwords\fP, the leftover
-\fIwords\fP will be displayed unchanged and if there are more display
-strings than \fIwords\fP, the leftover display strings will be silently
+If there are fewer display strings than \fIcompletions\fP, the leftover
+\fIcompletions\fP will be displayed unchanged and if there are more display
+strings than \fIcompletions\fP, the leftover display strings will be silently
ignored\&.
.RE
.TP
@@ -562,7 +561,8 @@ by the \fB\-d\fP option)\&. This is the default if `\fB\-o\fP\&' is specified bu
the \fIorder\fP argument is omitted\&.
.TP
\fBnosort\fP
-This specifies that the matches are pre\-sorted and their order should be
+This specifies that the \fIcompletions\fP
+are pre\-sorted and their order should be
preserved\&. This value only makes sense alone and cannot be combined with any
others\&.
.TP
@@ -575,7 +575,7 @@ Arrange the matches backwards by reversing the sort ordering\&.
.RE
.TP
\fB\-J\fP \fIgroup\-name\fP
-Gives the name of the group of matches the words should be stored in\&.
+Gives the name of the group that the matches should be stored in\&.
.TP
\fB\-V\fP \fIgroup\-name\fP
Like \fB\-J\fP but naming an unsorted group\&. This option is identical to
@@ -620,13 +620,13 @@ description, it can be escaped using e\&.g\&. \fB${my_str//\e%/%%}\fP\&.
.RE
.TP
\fB\-x\fP \fImessage\fP
-Like \fB\-X\fP, but the \fImessage\fP will be printed even if there are no
+Like \fB\-X\fP, but the \fImessage\fP will be printed even if there are no
matches in the group\&.
.TP
\fB\-q\fP
-The suffix given with \fB\-S\fP will be automatically removed if
+The suffix given with \fB\-S\fP will be automatically removed if
the next character typed is a blank or does not insert anything, or if
-the suffix consists of only one character and the next character typed
+the suffix consists of only one character and the next character typed
is the same character\&.
.TP
\fB\-r\fP \fIremove\-chars\fP
@@ -650,15 +650,15 @@ list is typed\&.
.RE
.TP
\fB\-R\fP \fIremove\-func\fP
-This is another form of the \fB\-r\fP option\&. When a suffix
-has been inserted and the completion accepted, the function
+This is another form of the \fB\-r\fP option\&. When a match
+has been accepted and a suffix has been inserted, the function
\fIremove\-func\fP will be called after the next character typed\&. It is
passed the length of the suffix as an argument and can use the special
parameters available in ordinary (non\-completion) zle widgets (see
\fIzshzle\fP(1)) to analyse and modify the command line\&.
.TP
\fB\-f\fP
-If this flag is given, all of the matches built from \fIwords\fP are
+If this flag is given, all of the matches built from the \fIcompletions\fP are
marked as being the names of files\&. They are not required to be actual
filenames, but if they are, and the option \fBLIST_TYPES\fP is set, the
characters describing the types of the files in the completion lists will
@@ -672,15 +672,14 @@ the \fBAUTO_PARAM_SLASH\fP and \fBAUTO_PARAM_KEYS\fP options be used for
the matches\&.
.TP
\fB\-W\fP \fIfile\-prefix\fP
-This string is a pathname that will be
-prepended to each of the matches formed by the given \fIwords\fP together
+This string is a pathname that will be prepended to each match together
with any prefix specified by the \fB\-p\fP option to form a complete filename
for testing\&. Hence it is only useful if combined with the \fB\-f\fP flag, as
the tests will not otherwise be performed\&.
.TP
\fB\-F\fP \fIarray\fP
-Specifies an array containing patterns\&. Words matching one of these
-patterns are ignored, i\&.e\&. not considered to be possible matches\&.
+Specifies an array containing patterns\&. \fIcompletions\fP that match one of
+these patterns are ignored, that is, not considered to be matches\&.
.RS
.PP
The \fIarray\fP may be the name of an array parameter or a list of
@@ -690,8 +689,8 @@ taken as the patterns\&.
.RE
.TP
\fB\-Q\fP
-This flag instructs the completion
-code not to quote any metacharacters in the words when inserting them
+This flag instructs the completion
+code not to quote any metacharacters in the matches when inserting them
into the command line\&.
.TP
\fB\-M\fP \fImatch\-spec\fP
@@ -702,47 +701,50 @@ between them to form the specification string to use\&.
Note that they will only be used if the \fB\-U\fP option is not given\&.
.TP
\fB\-n\fP
-Specifies that the words added are to be used as possible
-matches, but are not to appear in the completion listing\&.
+Specifies that matching \fIcompletions\fP are to be added to the set of
+matches, but are not to be listed to the user\&.
.TP
\fB\-U\fP
-If this flag is given, all words given will be accepted and no matching
+If this flag is given, all \fIcompletions\fP are added
+to the set of matches and no matching
will be done by the completion code\&. Normally this is used in
functions that do the matching themselves\&.
.TP
\fB\-O\fP \fIarray\fP
-If this option is given, the \fIwords\fP are \fInot\fP added to the set of
-possible completions\&. Instead, matching is done as usual and all of the
-\fIwords\fP given as arguments that match the string on the command line
+If this option is given, the \fIcompletions\fP are \fInot\fP added to the set of
+matches\&. Instead, matching is done as usual and all of the
+\fIcompletions\fP that match
will be stored in the array parameter whose name is given as \fIarray\fP\&.
.TP
\fB\-A\fP \fIarray\fP
-As the \fB\-O\fP option, except that instead of those of the \fIwords\fP which
+As the \fB\-O\fP option, except that instead of those of the \fIcompletions\fP
+which
match being stored in \fIarray\fP, the strings generated internally by the
-completion code are stored\&. For example,
-with a matching specification of `\fB\-M "L:|no="\fP\&', the string `\fBnof\fP'
-on the command line and the string `\fBfoo\fP\&' as one of the \fIwords\fP, this
+completion code are stored\&. For example,
+with a match specification of `\fB\-M "L:|no="\fP\&', a current word of `\fBnof\fP'
+and \fIcompletions\fP of `\fBfoo\fP\&', this
option stores the string `\fBnofoo\fP\&' in the array, whereas the \fB\-O\fP
option stores the `\fBfoo\fP\&' originally given\&.
.TP
\fB\-D\fP \fIarray\fP
-As with \fB\-O\fP, the \fIwords\fP are not added to the set of possible
-completions\&. Instead, the completion code tests whether each \fIword\fP
-in turn matches what is on the line\&. If the \fIn\fPth \fIword\fP does not
+As with \fB\-O\fP, the \fIcompletions\fP are not added to the set of matches\&.
+Instead, whenever the \fIn\fPth \fIcompletion\fP does not
match, the \fIn\fPth element of the \fIarray\fP is removed\&. Elements
-for which the corresponding \fIword\fP is matched are retained\&.
+for which the corresponding \fIcompletion\fP matches are retained\&.
+This option can be used more than once to remove elements from multiple
+arrays\&.
.TP
\fB\-C\fP
This option adds a special match which expands to all other matches
when inserted into the line, even those that are added after this
option is used\&. Together with the \fB\-d\fP option it is possible to
-specify a string that should be displayed in the list for this special
-match\&. If no string is given, it will be shown as a string containing
-the strings that would be inserted for the other matches, truncated to
+specify a string that should be displayed in the list for this special
+match\&. If no string is given, it will be shown as a string containing
+the strings that would be inserted for the other matches, truncated to
the width of the screen\&.
.TP
\fB\-E\fP \fInumber\fP
-This option adds \fInumber\fP empty matches after the \fIwords\fP have
+This option adds \fInumber\fP empty matches after matching \fIcompletions\fP have
been added\&. An empty match takes up space in completion listings but
will never be inserted in the line and can\&'t be selected with menu
completion or menu selection\&. This makes empty matches only useful to
@@ -760,7 +762,7 @@ added\&.
.PD
\fB\-\fP\fB\-\fP
This flag ends the list of flags and options\&. All arguments after it
-will be taken as the words to use as matches even if they begin with
+will be taken as the \fIcompletions\fP even if they begin with
hyphens\&.
.PP
Except for the \fB\-M\fP flag, if any of these flags is given more than
@@ -811,7 +813,7 @@ Without the optional \fInumber\fP, the longest match is taken, but
if \fInumber\fP is given, anything up to the \fInumber\fPth match is
moved\&. If the \fInumber\fP is negative, the \fInumber\fPth longest
match is moved\&. For example, if \fBPREFIX\fP contains the string
-`\fBa=b=c\fP\&', then \fBcompset \-P '*\e='\fP will move the string `\fBa=b=\fP'
+`\fBa=b=c\fP\&', then \fBcompset \-P '*\e='\fP will move the string `\fBa=b=\fP'
into the \fBIPREFIX\fP parameter, but \fBcompset \-P 1 \&'*\e='\fP will move only
the string `\fBa=\fP\&'\&.
.RE
@@ -825,7 +827,7 @@ As \fB\-P\fP, but match the last portion of \fBSUFFIX\fP and transfer the
matched portion to the front of the value of \fBISUFFIX\fP\&.
.TP
\fB\-n\fP \fIbegin\fP [ \fIend\fP ]
-If the current word position as specified by the parameter \fBCURRENT\fP
+If the current word position as specified by the parameter \fBCURRENT\fP
is greater than or equal to \fIbegin\fP, anything up to the
\fIbegin\fPth word is removed from the \fBwords\fP array and the value
of the parameter \fBCURRENT\fP is decremented by \fIbegin\fP\&.
@@ -851,7 +853,7 @@ point to the same word in the changed array\&.
If the optional pattern \fIend\-pat\fP is also given, and there is an
element in the \fBwords\fP array matching this pattern, the parameters
are modified only if the index of this word is higher than the one
-given by the \fBCURRENT\fP parameter (so that the matching word has
+given by the \fBCURRENT\fP parameter (so that the matching word has
to be after the cursor)\&. In this case, the words starting with the one
matching \fBend\-pat\fP are also removed from the \fBwords\fP
array\&. If \fBwords\fP contains no word matching \fIend\-pat\fP, the
@@ -861,7 +863,7 @@ testing and modification is performed as if it were not given\&.
\fB\-q\fP
The word
currently being completed is split on spaces into separate words,
-respecting the usual shell quoting conventions\&. The
+respecting the usual shell quoting conventions\&. The
resulting words are stored in the \fBwords\fP array, and \fBCURRENT\fP,
\fBPREFIX\fP, \fBSUFFIX\fP, \fBQIPREFIX\fP, and \fBQISUFFIX\fP are modified to
reflect the word part that is completed\&.
@@ -916,7 +918,7 @@ true if the test for the \fB\-P\fP option of \fBcompset\fP would succeed\&.
true if the test for the \fB\-S\fP option of \fBcompset\fP would succeed\&.
.TP
\fB\-after\fP \fIbeg\-pat\fP
-true if the test of the \fB\-N\fP option with only the \fIbeg\-pat\fP given
+true if the test of the \fB\-N\fP option with only the \fIbeg\-pat\fP given
would succeed\&.
.TP
\fB\-between\fP \fIbeg\-pat end\-pat\fP
@@ -924,319 +926,352 @@ true if the test for the \fB\-N\fP option with both patterns would succeed\&.
.PP
.SH "COMPLETION MATCHING CONTROL"
.PP
-It is possible by use of the
-\fB\-M\fP option of the \fBcompadd\fP builtin command to specify how the
-characters in the string to be completed (referred to here as the
-command line) map onto the characters in the list of matches produced by
-the completion code (referred to here as the trial completions)\&. Note
-that this is not used if the command line contains a glob pattern and
-the \fBGLOB_COMPLETE\fP option is set or the \fBpattern_match\fP of the
-\fBcompstate\fP special association is set to a non\-empty string\&.
-.PP
-The \fImatch\-spec\fP given as the argument to the \fB\-M\fP option (see
-`Completion Builtin Commands\&' above) consists of one or more matching descriptions separated by
-whitespace\&. Each description consists of a letter followed by a colon
-and then the patterns describing which character sequences on the line match
-which character sequences in the trial completion\&. Any sequence of
-characters not handled in this fashion must match exactly, as usual\&.
-.PP
-The forms of \fImatch\-spec\fP understood are as follows\&. In each case, the
-form with an upper case initial character retains the string already
-typed on the command line as the final result of completion, while with
-a lower case initial character the string on the command line is changed
-into the corresponding part of the trial completion\&.
+When the user invokes completion, the current \fIword\fP on the command line
+(that is, the word the cursor is currently on) is used to generate a \fImatch
+pattern\fP\&. Only those \fIcompletions\fP that match the pattern are offered to the
+user as \fImatches\fP\&.
+.PP
+The default match pattern is generated from the current word by either
.PP
.PD 0
.TP
+.PD
+\(bu
+appending a `\fB*\fP\&' (matching any number of characters in a completion)
+\fIor,\fP
+.TP
+\(bu
+if the shell option \fBCOMPLETE_IN_WORD\fP is set, inserting a `\fB*\fP\&' at the
+cursor position\&.
+.PP
+This narrow pattern can be broadened selectively by passing a \fImatch
+specification\fP to the \fBcompadd\fP builtin command through its \fB\-M\fP option
+(see
+`Completion Builtin Commands\&' above)\&. A match specification consists of one or more \fImatchers\fP separated by
+whitespace\&. Matchers in a match specification are applied one at a time, from
+left to right\&. Once all matchers have been applied, completions are compared
+to the final match pattern and non\-matching ones are discarded\&.
+.PP
.PD 0
-\fBm:\fP\fIlpat\fP\fB=\fP\fItpat\fP
.TP
.PD
-\fBM:\fP\fIlpat\fP\fB=\fP\fItpat\fP
-Here, \fIlpat\fP is a pattern that matches on the command line,
-corresponding to \fItpat\fP which matches in the trial completion\&.
+\(bu
+Note that the \fB\-M\fP option is ignored if the current word contains a glob
+pattern and the shell option \fBGLOB_COMPLETE\fP is set or if the
+\fBpattern_match\fP key of the special associative array \fBcompstate\fP is set to
+a non\-empty value (see
+`Completion Special Parameters\&' above)\&.
.TP
+\(bu
+Users of the completion system (see \fIzshcompsys\fP(1)) should generally not use the \fB\-M\fP option directly, but rather use the
+\fBmatcher\-list\fP and \fBmatcher\fP styles (see the subsection \fIStandard Styles\fP
+in
+the documentation for COMPLETION SYSTEM CONFIGURATION in \fIzshcompsys\fP(1))\&.
+.PP
+Each matcher consists of
+.PP
.PD 0
-\fBl:\fP\fIlanchor\fP\fB|\fP\fIlpat\fP\fB=\fP\fItpat\fP
.TP
-.PD 0
-\fBL:\fP\fIlanchor\fP\fB|\fP\fIlpat\fP\fB=\fP\fItpat\fP
+.PD
+\(bu
+a case\-sensitive letter
+.TP
+\(bu
+a `\fB:\fP\&',
+.TP
+\(bu
+one or more patterns separated by pipes (`\fB|\fP\&'),
+.TP
+\(bu
+an equals sign (`\fB=\fP\&'), and
.TP
+\(bu
+another pattern\&.
+.PP
+The patterns before the `\fB=\fP\&' are used to match substrings of the current
+word\&. For each matched substring, the corresponding part of the match pattern
+is broadened with the pattern after the `\fB=\fP\&', by means of a logical \fBOR\fP\&.
+.PP
+Each pattern in a matcher cosists of either
+.PP
.PD 0
-\fBl:\fP\fIlanchor\fP\fB||\fP\fIranchor\fP\fB=\fP\fItpat\fP
.TP
+.PD
+\(bu
+the empty string or
+.TP
+\(bu
+a sequence of
+.RS
+.PP
.PD 0
-\fBL:\fP\fIlanchor\fP\fB||\fP\fIranchor\fP\fB=\fP\fItpat\fP
.TP
+.PD
+\(bu
+literal characters (which may be quoted with a `\fB\e\fP\&'),
+.TP
+\(bu
+question marks (`\fB?\fP\&'),
+.TP
+\(bu
+bracket expressions (`\fB[\&.\&.\&.]\fP\&'; see the subsection \fIGlob Operators\fP in
+the documentation for GLOB OPERATORS in \fIzshexpn\fP(1)), and/or
+.TP
+\(bu
+brace expressions (see below)\&.
+
+.RE
+.PP
+Other shell patterns are not allowed\&.
+.PP
+A brace expression, like a bracket expression, consists of a list of
+.PP
.PD 0
-\fBb:\fP\fIlpat\fP\fB=\fP\fItpat\fP
.TP
.PD
-\fBB:\fP\fIlpat\fP\fB=\fP\fItpat\fP
-These letters are for patterns that are anchored by another pattern on
-the left side\&. Matching for \fIlpat\fP and \fItpat\fP is as for \fBm\fP and
-\fBM\fP, but the pattern \fIlpat\fP matched on the command line must be
-preceded by the pattern \fIlanchor\fP\&. The \fIlanchor\fP can be blank to
-anchor the match to the start of the command line string; otherwise the
-anchor can occur anywhere, but must match in both the command line and
-trial completion strings\&.
-.RS
+\(bu
+literal characters,
+.TP
+\(bu
+ranges (`\fB0\-9\fP\&'), and/or
+.TP
+\(bu
+character classes (`\fB[:\fP\fIname\fP\fB:]\fP\&')\&.
.PP
-If no \fIlpat\fP is given but a \fIranchor\fP is, this matches the gap
-between substrings matched by \fIlanchor\fP and \fIranchor\fP\&. Unlike
-\fIlanchor\fP, the \fIranchor\fP only needs to match the trial
-completion string\&.
+However, they differ from each other as follows:
.PP
-The \fBb\fP and \fBB\fP forms are similar to \fBl\fP and \fBL\fP with an empty
-anchor, but need to match only the beginning of the word on the command line
-or trial completion, respectively\&.
-.RE
+.PD 0
+.TP
+.PD
+\(bu
+A brace expression is delimited by a pair of braces (`\fB{\&.\&.\&.}\fP\&')\&.
+.TP
+\(bu
+Brace expressions do not support negations\&. That is, an initial
+`\fB!\fP\&' or `\fB^\fP' has no special meaning and will be interpreted as a literal
+character\&.
+.TP
+\(bu
+When a character in the current word matches the \fIn\fPth pattern in a brace
+expression, the corresponding part of the match pattern is broadened only with
+the \fIn\fPth pattern of the brace expression on the other side of the `\fB=\fP\&',
+if there is one; if there is no brace expression on the other side, then this
+pattern is the empty string\&. However, if either brace expression has more
+elements than the other, then the excess entries are simply ignored\&. When
+comparing indexes, each literal character or character class counts as one
+element, but each range is instead expanded to the full list of literal
+characters it represents\&. Additionally, if on \fIboth\fP sides of the
+`\fB=\fP\&', the \fIn\fPth pattern is `\fB[:upper:]\fP' or `\fB[:lower:]\fP', then these
+are expanded as ranges, too\&.
+.PP
+Note that, although the matching system does not yet handle multibyte
+characters, this is likely to be a future extension\&. Hence, using
+`\fB[:upper:]\fP\&' and `\fB[:lower:]\fP' is recommended over
+`\fBA\-Z\fP\&' and `\fBa\-z\fP'\&.
+.PP
+Below are the different forms of matchers supported\&. Each \fIuppercase\fP form
+behaves exactly like its lowercase counterpart, but adds an additional step
+\fIafter\fP the match pattern has filtered out non\-matching completions: Each of
+a match\&'s substrings that was matched by a subpattern from an uppercase matcher
+is replaced with the corresponding substring of the current word\&. However,
+patterns from \fIlowercase\fP matchers have higher weight: If a substring of the
+current word was matched by patterns from both a lowercase and an uppercase
+matcher, then the lowercase matcher\&'s pattern wins and the corresponding part
+of the match is not modified\&.
+.PP
+Unless indicated otherwise, each example listed assumes \fBCOMPLETE_IN_WORD\fP to
+be unset (as it is by default)\&.
+.PP
+.PD 0
.TP
.PD 0
-\fBr:\fP\fIlpat\fP\fB|\fP\fIranchor\fP\fB=\fP\fItpat\fP
+\fBm:\fP\fIword\-pat\fP\fB=\fP\fImatch\-pat\fP
.TP
+.PD
+\fBM:\fP\fIword\-pat\fP\fB=\fP\fImatch\-pat\fP
+.RS
+.PP
+For each substring of the current word that matches \fIword\-pat\fP, broaden the
+corresponding part of the match pattern to additionally match \fImatch\-pat\fP\&.
+.PP
.PD 0
-\fBR:\fP\fIlpat\fP\fB|\fP\fIranchor\fP\fB=\fP\fItpat\fP
+.TP
+.PD
+Examples:
+.RS
+.PP
+\fBm:{[:lower:]}={[:upper:]}\fP lets any lower case character in the current word
+be completed to itself or its uppercase counterpart\&. So, the completions
+`\fBfoo\fP\&', `\fBFOO\fP' and `\fBFoo\fP' will are be considered matches for the word
+`\fBfo\fP\&'\&.
+.PP
+\fBM:_=\fP inserts every underscore from the current word into each match, in the
+same relative position, determined by matching the substrings around it\&. So,
+given a completion `\fBfoo\fP\&', the word `\fBf_o\fP' will be completed to the match
+`\fBf_oo\fP\&', even though the latter was not present as a completion\&.
+.RE
+.RE
.TP
.PD 0
-\fBr:\fP\fIlanchor\fP\fB||\fP\fIranchor\fP\fB=\fP\fItpat\fP
+\fBb:\fP\fIword\-pat\fP\fB=\fP\fImatch\-pat\fP
.TP
.PD 0
-\fBR:\fP\fIlanchor\fP\fB||\fP\fIranchor\fP\fB=\fP\fItpat\fP
+\fBB:\fP\fIword\-pat\fP\fB=\fP\fImatch\-pat\fP
.TP
.PD 0
-\fBe:\fP\fIlpat\fP\fB=\fP\fItpat\fP
+\fBe:\fP\fIword\-pat\fP\fB=\fP\fImatch\-pat\fP
.TP
.PD
-\fBE:\fP\fIlpat\fP\fB=\fP\fItpat\fP
-As \fBl\fP, \fBL\fP, \fBb\fP and \fBB\fP, with the difference that the command
-line and trial completion patterns are anchored on the right side\&.
-Here an empty \fIranchor\fP and the \fBe\fP and \fBE\fP forms force the
-match to the end of the command line or trial completion string\&.
-.TP
-\fBx:\fP
-This form is used to mark the end of matching specifications:
-subsequent specifications are ignored\&. In a single standalone list
-of specifications this has no use but where matching specifications
-are accumulated, such as from nested function calls, it can allow one
-function to override another\&.
-.PP
-Each \fIlpat\fP, \fItpat\fP or \fIanchor\fP is either an empty string or
-consists of a sequence of literal characters (which may be quoted with a
-backslash), question marks, character classes, and correspondence
-classes; ordinary shell patterns are not used\&. Literal characters match
-only themselves, question marks match any character, and character
-classes are formed as for globbing and match any character in the given
-set\&.
-.PP
-Correspondence classes are defined like character classes, but with two
-differences: they are delimited by a pair of braces, and negated classes
-are not allowed, so the characters \fB!\fP and \fB^\fP have no special
-meaning directly after the opening brace\&. They indicate that a range of
-characters on the line match a range of characters in the trial
-completion, but (unlike ordinary character classes) paired according to
-the corresponding position in the sequence\&. For example, to make any
-ASCII lower case letter on the line match the corresponding upper case
-letter in the trial completion, you can use `\fBm:{a\-z}={A\-Z}\fP\&'
-(however, see below for the recommended form for this)\&. More
-than one pair of classes can occur, in which case the first class before
-the \fB=\fP corresponds to the first after it, and so on\&. If one side has
-more such classes than the other side, the superfluous classes behave
-like normal character classes\&. In anchor patterns correspondence classes
-also behave like normal character classes\&.
-.PP
-The standard `\fB[:\fP\fIname\fP\fB:]\fP\&' forms described for standard shell
-patterns (see
-the section FILENAME GENERATION in \fIzshexpn\fP(1))
-may appear in correspondence classes as well as normal character
-classes\&. The only special behaviour in correspondence classes is if
-the form on the left and the form on the right are each one of
-\fB[:upper:]\fP, \fB[:lower:]\fP\&. In these cases the
-character in the word and the character on the line must be the same up
-to a difference in case\&. Hence to make any lower case character on the
-line match the corresponding upper case character in the trial
-completion you can use `\fBm:{[:lower:]}={[:upper:]}\fP\&'\&. Although the
-matching system does not yet handle multibyte characters, this is likely
-to be a future extension, at which point this syntax will handle
-arbitrary alphabets; hence this form, rather than the use of explicit
-ranges, is the recommended form\&. In other cases
-`\fB[:\fP\fIname\fP\fB:]\fP\&' forms are allowed\&. If the two forms on the left
-and right are the same, the characters must match exactly\&. In remaining
-cases, the corresponding tests are applied to both characters, but they
-are not otherwise constrained; any matching character in one set goes
-with any matching character in the other set: this is equivalent to the
-behaviour of ordinary character classes\&.
-.PP
-The pattern \fItpat\fP may also be one or two stars, `\fB*\fP\&' or
-`\fB**\fP\&'\&. This means that the pattern on the command line can match
-any number of characters in the trial completion\&. In this case the
-pattern must be anchored (on either side); in the case of a single
-star, the \fIanchor\fP then determines how much of the trial completion
-is to be included \-\- only the characters up to the next appearance of
-the anchor will be matched\&. With two stars, substrings matched by the
-anchor can be matched, too\&.
+\fBE:\fP\fIword\-pat\fP\fB=\fP\fImatch\-pat\fP
+.RS
+.PP
+For each consecutive substring at the \fBb:\fPeginning or \fBe:\fPnd of the current
+word that matches \fIword\-pat\fP, broaden the corresponding part of the match
+pattern to additionally match \fImatch\-pat\fP\&.
.PP
+.PD 0
+.TP
+.PD
Examples:
+.RS
.PP
-The keys of the \fBoptions\fP association defined by the \fBparameter\fP
-module are the option names in all\-lower\-case form, without
-underscores, and without the optional \fBno\fP at the beginning even
-though the builtins \fBsetopt\fP and \fBunsetopt\fP understand option names
-with upper case letters, underscores, and the optional \fBno\fP\&. The
-following alters the matching rules so that the prefix \fBno\fP and any
-underscore are ignored when trying to match the trial completions
-generated and upper case letters on the line match the corresponding
-lower case letters in the words:
+`\fBb:\-=+\fP\&' lets any number of minuses at the start of the current word be
+completed to a minus or a plus\&.
.PP
-.RS
-.nf
-\fBcompadd \-M \&'L:|[nN][oO]= M:_= M:{[:upper:]}={[:lower:]}' \- \e
- ${(k)options} \fP
-.fi
+`\fBB:0=\fP\&' adds all zeroes at the beginning of the current word to the
+beginning of each match\&.
+.RE
.RE
+.TP
+.PD 0
+\fBl:\fP\fB|\fP\fIword\-pat\fP\fB=\fP\fImatch\-pat\fP
+.TP
+.PD 0
+\fBL:\fP\fB|\fP\fIword\-pat\fP\fB=\fP\fImatch\-pat\fP
+.TP
+.PD 0
+\fBR:\fP\fIword\-pat\fP\fB|\fP\fB=\fP\fImatch\-pat\fP
+.TP
+.PD
+\fBr:\fP\fIword\-pat\fP\fB|\fP\fB=\fP\fImatch\-pat\fP
+.RS
.PP
-The first part says that the pattern `\fB[nN][oO]\fP\&' at the beginning
-(the empty anchor before the pipe symbol) of the string on the
-line matches the empty string in the list of words generated by
-completion, so it will be ignored if present\&. The second part does the
-same for an underscore anywhere in the command line string, and the
-third part uses correspondence classes so that any
-upper case letter on the line matches the corresponding lower case
-letter in the word\&. The use of the upper case forms of the
-specification characters (\fBL\fP and \fBM\fP) guarantees that what has
-already been typed on the command line (in particular the prefix
-\fBno\fP) will not be deleted\&.
-.PP
-Note that the use of \fBL\fP in the first part means that it matches
-only when at the beginning of both the command line string and the
-trial completion\&. I\&.e\&., the string `\fB_NO_f\fP\&' would not be
-completed to `\fB_NO_foo\fP\&', nor would `\fBNONO_f\fP' be completed to
-`\fBNONO_foo\fP\&' because of the leading underscore or the second
-`\fBNO\fP\&' on the line which makes the pattern fail even though they are
-otherwise ignored\&. To fix this, one would use `\fBB:[nN][oO]=\fP\&'
-instead of the first part\&. As described above, this matches at the
-beginning of the trial completion, independent of other characters or
-substrings at the beginning of the command line word which are ignored
-by the same or other \fImatch\-spec\fPs\&.
-.PP
-The second example makes completion case insensitive\&. This is just
-the same as in the option example, except here we wish to retain the
-characters in the list of completions:
+If there is a substring at the \fBl:\fPeft or \fBr:\fPight edge of the current word
+that matches \fIword\-pat\fP, then broaden the corresponding part of the match
+pattern to additionally match \fImatch\-pat\fP\&.
.PP
+For each \fBl:\fP, \fBL:\fP, \fBr:\fP and \fBR:\fP matcher (including the ones below),
+the pattern \fImatch\-pat\fP may also be a `\fB*\fP\&'\&. This matches any number of
+characters in a completion\&.
+.PP
+.PD 0
+.TP
+.PD
+Examples:
.RS
-.nf
-\fBcompadd \-M \&'m:{[:lower:]}={[:upper:]}' \&.\&.\&. \fP
-.fi
-.RE
.PP
-This makes lower case letters match their upper case counterparts\&.
-To make upper case letters match the lower case forms as well:
+`\fBr:|=*\fP\&' appends a `\fB*\fP' to the match pattern, even when
+\fBCOMPLETE_IN_WORD\fP is set and the cursor is not at the end of the current
+word\&.
.PP
-.RS
-.nf
-\fBcompadd \-M \&'m:{[:lower:][:upper:]}={[:upper:][:lower:]}' \&.\&.\&. \fP
-.fi
+If the current word starts with a minus, then `\fBL:|\-=\fP\&' will prepend it to
+each match\&.
+.RE
.RE
+.TP
+.PD 0
+\fBl:\fP\fIanchor\fP\fB|\fP\fIword\-pat\fP\fB=\fP\fImatch\-pat\fP
+.TP
+.PD 0
+\fBL:\fP\fIanchor\fP\fB|\fP\fIword\-pat\fP\fB=\fP\fImatch\-pat\fP
+.TP
+.PD 0
+\fBr:\fP\fIword\-pat\fP\fB|\fP\fIanchor\fP\fB=\fP\fImatch\-pat\fP
+.TP
+.PD
+\fBR:\fP\fIword\-pat\fP\fB|\fP\fIanchor\fP\fB=\fP\fImatch\-pat\fP
+.RS
.PP
-A nice example for the use of \fB*\fP patterns is partial word
-completion\&. Sometimes you would like to make strings like `\fBc\&.s\&.u\fP\&'
-complete to strings like `\fBcomp\&.source\&.unix\fP\&', i\&.e\&. the word on the
-command line consists of multiple parts, separated by a dot in this
-example, where each part should be completed separately \-\- note,
-however, that the case where each part of the word, i\&.e\&. `\fBcomp\fP\&',
-`\fBsource\fP\&' and `\fBunix\fP' in this example, is to be completed from
-separate sets of matches
-is a different problem to be solved by the implementation of the
-completion widget\&. The example can be handled by:
+For each substring of the current word that matches \fIword\-pat\fP and has on
+its \fBl:\fPeft or \fBr:\fPight another substring matching \fIanchor\fP, broaden the
+corresponding part of the match pattern to additionally match \fImatch\-pat\fP\&.
+.PP
+Note that these matchers (and the ones below) modify only what is matched by
+\fIword\-pat\fP; they do not change the matching behavior of what is matched by
+\fIanchor\fP (or \fIcoanchor\fP; see the matchers below)\&. Thus, unless its
+corresponding part of the match pattern has been modified, the anchor in the
+current word has to match literally in each completion, just like any other
+substring of the current word\&.
+.PP
+If a matcher includes at least one anchor (which includes the matchers with two
+anchors, below), then \fImatch\-pat\fP may also be `\fB*\fP\&' or `\fB**\fP'\&. `\fB*\fP'
+can match any part of a completion that does not contain any substrings
+matching \fIanchor\fP, whereas a `\fB**\fP\&' can match any part of a completion,
+period\&. (Note that this is different from the behavior of `\fB*\fP\&' in the
+anchorless forms of `\fBl:\fP\&' and `\fBr:\fP' and and also different from `\fB*\fP'
+and `\fB**\fP\&' in glob expressions\&.)
.PP
+.PD 0
+.TP
+.PD
+Examples:
.RS
-.nf
-\fBcompadd \-M \&'r:|\&.=* r:|=*' \e
- \- comp\&.sources\&.unix comp\&.sources\&.misc \&.\&.\&.\fP
-.fi
-.RE
.PP
-The first specification says that \fIlpat\fP is the empty string, while
-\fIanchor\fP is a dot; \fItpat\fP is \fB*\fP, so this can match anything
-except for the `\fB\&.\fP\&' from the anchor in
-the trial completion word\&. So in `\fBc\&.s\&.u\fP\&', the matcher sees `\fBc\fP',
-followed by the empty string, followed by the anchor `\fB\&.\fP\&', and
-likewise for the second dot, and replaces the empty strings before the
-anchors, giving `\fBc\fP[\fBomp\fP]\fB\&.s\fP[\fBources\fP]\fB\&.u\fP[\fBnix\fP]\&', where
-the last part of the completion is just as normal\&.
-.PP
-With the pattern shown above, the string `\fBc\&.u\fP\&' could not be
-completed to `\fBcomp\&.sources\&.unix\fP\&' because the single star means
-that no dot (matched by the anchor) can be skipped\&. By using two stars
-as in `\fBr:|\&.=**\fP\&', however, `\fBc\&.u\fP' could be completed to
-`\fBcomp\&.sources\&.unix\fP\&'\&. This also shows that in some cases,
-especially if the anchor is a real pattern, like a character class,
-the form with two stars may result in more matches than one would like\&.
-.PP
-The second specification is needed to make this work when the cursor is
-in the middle of the string on the command line and the option
-\fBCOMPLETE_IN_WORD\fP is set\&. In this case the completion code would
-normally try to match trial completions that end with the string as
-typed so far, i\&.e\&. it will only insert new characters at the cursor
-position rather than at the end\&. However in our example we would like
-the code to recognise matches which contain extra characters after the
-string on the line (the `\fBnix\fP\&' in the example)\&. Hence we say that the
-empty string at the end of the string on the line matches any characters
-at the end of the trial completion\&.
-.PP
-More generally, the specification
+`\fBr:|\&.=*\fP\&' makes the completion `\fBcomp\&.sources\&.unix\fP' a match for the word
+`\fB\&.\&.u\fP\&' \-\- but \fInot\fP for the word `\fB\&.u\fP'\&.
.PP
-.RS
-.nf
-\fBcompadd \-M \&'r:|[\&.,_\-]=* r:|=*' \&.\&.\&. \fP
-.fi
+Given a completion `\fB\-\fP\fB\-foo\fP\&', the matcher `\fBL:\-\-|no\-=\fP' will complete
+the word `\fB\-\fP\fB\-no\-\fP\&' to the match `\fB\-\fP\fB\-no\-foo\fP'\&.
+.RE
.RE
+.TP
+.PD 0
+\fBl:\fP\fIanchor\fP\fB||\fP\fIcoanchor\fP\fB=\fP\fImatch\-pat\fP
+.TP
+.PD 0
+\fBL:\fP\fIanchor\fP\fB||\fP\fIcoanchor\fP\fB=\fP\fImatch\-pat\fP
+.TP
+.PD 0
+\fBr:\fP\fIcoanchor\fP\fB||\fP\fIanchor\fP\fB=\fP\fImatch\-pat\fP
+.TP
+.PD
+\fBR:\fP\fIcoanchor\fP\fB||\fP\fIanchor\fP\fB=\fP\fImatch\-pat\fP
+.RS
.PP
-allows one to complete words with abbreviations before any of the
-characters in the square brackets\&. For example, to
-complete \fBveryverylongfile\&.c\fP rather than \fBveryverylongheader\&.h\fP
-with the above in effect, you can just type \fBvery\&.c\fP before attempting
-completion\&.
+For any two consecutive substrings of the current word that match \fIanchor\fP
+and \fIcoanchor\fP, in the order given, insert the pattern \fImatch\-pat\fP
+between their corresponding parts in the match pattern\&.
.PP
-The specifications with both a left and a right anchor are useful to
-complete partial words whose parts are not separated by some
-special character\&. For example, in some places strings have to be
-completed that are formed `\fBLikeThis\fP\&' (i\&.e\&. the separate parts are
-determined by a leading upper case letter) or maybe one has to
-complete strings with trailing numbers\&. Here one could use the simple
-form with only one anchor as in:
+Note that, unlike \fIanchor\fP, the pattern \fIcoanchor\fP does not change what
+`\fB*\fP\&' can match\&.
.PP
+.PD 0
+.TP
+.PD
+Examples:
.RS
-.nf
-\fBcompadd \-M \&'r:|[[:upper:]0\-9]=* r:|=*' LikeTHIS FooHoo 5foo123 5bar234\fP
-.fi
-.RE
.PP
-But with this, the string `\fBH\fP\&' would neither complete to `\fBFooHoo\fP'
-nor to `\fBLikeTHIS\fP\&' because in each case there is an upper case
-letter before the `\fBH\fP\&' and that is matched by the anchor\&. Likewise,
-a `\fB2\fP\&' would not be completed\&. In both cases this could be changed
-by using `\fBr:|[[:upper:]0\-9]=**\fP\&', but then `\fBH\fP' completes to both
-`\fBLikeTHIS\fP\&' and `\fBFooHoo\fP' and a `\fB2\fP' matches the other
-strings because characters can be inserted before every upper case
-letter and digit\&. To avoid this one would use:
+`\fBr:?||[[:upper:]]=*\fP\&' will complete the current word `\fBfB\fP' to
+`\fBfooBar\fP\&', but it will not complete it to `\fBfooHooBar\fP' (because `\fB*\fP'
+here cannot match anything that includes a match for `\fB[[:upper:]]\fP), nor
+will it complete `\fBB\fP\&' to `\fBfooBar\fP' (because there is no character in the
+current word to match \fIcoanchor\fP)\&.
.PP
-.RS
-.nf
-\fBcompadd \-M \&'r:[^[:upper:]0\-9]||[[:upper:]0\-9]=** r:|=*' \e
- LikeTHIS FooHoo foo123 bar234\fP
-.fi
+Given the current word `\fBpass\&.n\fP\&' and a completion `\fBpass\&.byname\fP', the
+matcher `\fBL:\&.||[[:alpha:]]=by\fP\&' will produce the match `\fBpass\&.name\fP'\&.
+.RE
.RE
+.TP
+\fBx:\fP
+.RS
.PP
-By using these two anchors, a `\fBH\fP\&' matches only upper case `\fBH\fP's that
-are immediately preceded by something matching the left anchor
-`\fB[^[:upper:]0\-9]\fP\&'\&. The effect is, of course, that `\fBH\fP' matches only
-the string `\fBFooHoo\fP\&', a `\fB2\fP' matches only `\fBbar234\fP' and so on\&.
+Ignore this matcher and all matchers to its right\&.
.PP
-When using the completion system (see
-\fIzshcompsys\fP(1)), users can define match specifications that are to be used for
-specific contexts by using the \fBmatcher\fP and \fBmatcher\-list\fP
-styles\&. The values for the latter will be used everywhere\&.
+This matcher is used to mark the end of a match specification\&. In a single
+standalone list of matchers, this has no use, but where match specifications
+are concatenated, as is often the case when using the
+completion system (see \fIzshcompsys\fP(1)), it can allow one match specification to override another\&.
+.RE
.PP
.SH "COMPLETION WIDGET EXAMPLE"
.PP
@@ -1267,5 +1302,5 @@ matches, e\&.g\&.:
.fi
.RE
.PP
-This function will complete files in the current directory matching the
+This function will complete files in the current directory matching the
current word\&.
diff --git a/Doc/zshcontrib.1 b/Doc/zshcontrib.1
index 849d0865f..b6fb67bb6 100644
--- a/Doc/zshcontrib.1
+++ b/Doc/zshcontrib.1
@@ -1,4 +1,4 @@
-.TH "ZSHCONTRIB" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHCONTRIB" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshcontrib \- user contributions to zsh
.\" Yodl file: Zsh/contrib.yo
@@ -41,7 +41,7 @@ distribution in your home directory, you would use the commands:
.RS
.nf
\fBmkdir ~/zsh_help
-perl ~/zsh\-5\&.8\&.1/Util/helpfiles ~/zsh_help\fP
+perl ~/zsh\-5\&.8\&.1\&.2\-test/Util/helpfiles ~/zsh_help\fP
.fi
.RE
.PP
@@ -181,7 +181,7 @@ Run \fBzkbd\fP either as an autoloaded function, or as a shell script:
.PP
.RS
.nf
-\fBzsh \-f ~/zsh\-5\&.8\&.1/Functions/Misc/zkbd\fP
+\fBzsh \-f ~/zsh\-5\&.8\&.1\&.2\-test/Functions/Misc/zkbd\fP
.fi
.RE
.PP
@@ -237,7 +237,7 @@ command and redirect the output into a file:
.PP
.RS
.nf
-\fB\&. ~/zsh\-5\&.8\&.1/Util/reporter > zsh\&.report\fP
+\fB\&. ~/zsh\-5\&.8\&.1\&.2\-test/Util/reporter > zsh\&.report\fP
.fi
.RE
.PP
@@ -374,7 +374,7 @@ is added to the array of widgets to be invoked in the given hook context\&.
Widgets are invoked in the order they were added, with
.RS
.nf
-\fB\fBzle \fP\fIwidgetname\fP\fB \-Nw \-\- "$@"\fP\fP
+\fB\fBzle \fP\fIwidgetname\fP\fB \-Nw \-f "nolast" \-\- "$@"\fP\fP
.fi
.RE
.PP
@@ -494,7 +494,7 @@ allows you to edit the list of directories, one per line\&. The
list can be edited to any extent you like; no sanity checking is
performed\&. Completion is available\&. No quoting is necessary (except for
newlines, where I have in any case no sympathy); directories are in
-unabbreviated from and contain an absolute path, i\&.e\&. they start with \fB/\fP\&.
+unabbreviated form and contain an absolute path, i\&.e\&. they start with \fB/\fP\&.
Usually the first entry should be left as the current directory\&.
.TP
\fB\-p \&'\fP\fIpattern\fP\fB'\fP
@@ -647,7 +647,7 @@ changes to descendant directories; earlier directories on the
list are not pruned\&. For example, changing from ~pws/yet/another
to ~pws/some/other/dir does not cause ~pws to be pruned\&.
.TP
-\fBpattern:\fIpattern\fP\fP
+\fBpattern:\fP\fIpattern\fP
Gives a zsh pattern for directories that should not be
added to the recent list (if not already there)\&. This element
can be repeated to add different patterns\&. For example,
@@ -705,7 +705,7 @@ more details\&.
.PP
The dynamic directory naming system is described in the subsection
\fIDynamic named directories\fP of
-the section \fIFilename Expansion\fP in \fIexpn\fP(1)\&. In this, a reference to
+the section \fIFilename Expansion\fP in \fIzshexpn\fP(1)\&. In this, a reference to
\fB~[\fP\fI\&.\&.\&.\fP\fB]\fP is expanded by a function found by the hooks
mechanism\&.
.PP
@@ -754,7 +754,7 @@ Then arrange for the wrapper to be run as a zsh_directory_name hook:
.PP
.RS
.nf
-\fBautoload \-Uz add\-zsh\-hook zsh_diretory_name_generic zdn_mywrapper
+\fBautoload \-Uz add\-zsh\-hook zsh_directory_name_generic zdn_mywrapper
add\-zsh\-hook \-U zsh_directory_name zdn_mywrapper\fP
.fi
.RE
@@ -1269,7 +1269,7 @@ This is used by the Perforce backend (\fBp4\fP) to decide if it should
contact the Perforce server to find out if a directory is managed
by Perforce\&. This is the only reliable way of doing this, but runs
the risk of a delay if the server name cannot be found\&. If the
-server (more specifically, the \fBhost\fP\fB:\fP\fBport\fP pair describing the
+server (more specifically, the \fIhost\fP\fB:\fP\fIport\fP pair describing the
server) cannot be contacted, its name is put into the associative array
\fBvcs_info_p4_dead_servers\fP and is not contacted again during the session
until it is removed by hand\&. If you do not set this style, the \fBp4\fP
@@ -1288,7 +1288,7 @@ If there are two different ways of gathering
information, you can select the simpler one by setting this style to true;
the default is to use the not\-that\-simple code, which is potentially a lot
slower but might be more accurate in all possible cases\&. This style is
-used by the \fBbzr\fP and \fBhg\fP backends\&. In the case of \fBhg\fP it will invoke
+used by the \fBbzr\fP, \fBhg\fP, and \fBgit\fP backends\&. In the case of \fBhg\fP it will invoke
the external hexdump program to parse the binary dirstate cache file; this
method will not return the local revision number\&.
.TP
@@ -1343,7 +1343,7 @@ This boolean style controls whether a backend should attempt to gather a list
of unapplied patches (for example with Mercurial Queue patches)\&.
.RS
.PP
-Used by the \fBquilt\fP and \fBhg\fP backends\&.
+Used by the \fBquilt\fP, \fBhg\fP, and \fBgit\fP backends\&.
.RE
.PP
The default values for these styles in all contexts are:
@@ -1504,7 +1504,7 @@ The \fBquilt\fP `standalone\&' backend sets this expando to the same value as th
\fB%Q\fP
Quilt series information\&.
When quilt is used (either in `addon\&' mode or as a `standalone' backend),
-this expando is set to quilt series\&' \fBpatch\-format\fP string\&.
+this expando is set to the quilt series\&' \fBpatch\-format\fP string\&.
The \fBset\-patch\-format\fP hook and \fBnopatch\-format\fP style are honoured\&.
.RS
.PP
@@ -1516,7 +1516,8 @@ In \fBbranchformat\fP these replacements are done:
.PD 0
.TP
\fB%b\fP
-The branch name\&.
+The branch name\&. For \fBhg\fP, the branch name can include a
+topic name\&.
.TP
\fB%r\fP
The current revision number or the \fBhgrevformat\fP style for
@@ -1613,7 +1614,7 @@ a directory that holds quilt\&'s patches needs to be found\&. That directory is
configurable via the `\fBQUILT_PATCHES\fP\&' environment variable\&. If that
variable exists its value is used, otherwise the value `\fBpatches\fP\&' is
assumed\&. The value from \fB$QUILT_PATCHES\fP can be overwritten using the
-`\fBquilt\-patches\fP\&' style\&. (Note: you can use \fBvcs_info\fP to keep the value
+`\fBquilt\-patch\-dir\fP\&' style\&. (Note: you can use \fBvcs_info\fP to keep the value
of \fB$QUILT_PATCHES\fP correct all the time via the \fBpost\-quilt\fP hook)\&.
.PP
When the directory in question is found, quilt is assumed to be active\&. To
@@ -1714,7 +1715,7 @@ See \fBHooks in vcs_info\fP
below for details\&.
.TP
\fBvcs_info_lastmsg\fP
-Outputs the last \fB${vcs_info_msg_*_}\fP value\&.
+Outputs the current values of \fB${vcs_info_msg_*_}\fP\&.
Takes into account the value of the \fBuse\-prompt\-escapes\fP style in
\fB\&':vcs_info:formats:command:\-all\-'\fP\&. It also only prints \fBmax\-exports\fP
values\&.
@@ -1867,16 +1868,27 @@ is generated; the \fBuse\-quilt\fP zstyle must be true for \fBquilt\fP (the \fBm
and \fBstgit\fP backends are active by default)\&.
.RS
.PP
-This hook gets the names of all applied patches which \fBvcs_info\fP collected
-so far in the opposite order, which means that the first argument is the
+The arguments to this hook describe applied patches
+in the opposite order, which means that the first argument is the
top\-most patch and so forth\&.
.PP
+When the patches\&' log messages can be extracted, those are embedded
+within each argument after a space, so each argument is of the form
+`\fIpatch\-name\fP \fIfirst line of the log message\fP\&', where \fIpatch\-name\fP
+contains no whitespace\&. The \fBmq\fP backend passes arguments of
+the form `\fIpatch name\fP\&', with possible embedded spaces, but without
+extracting the patch\&'s log message\&.
+.PP
When setting \fBret\fP to non\-zero, the string in
\fB${hook_com[applied\-string]}\fP will be
available as \fB%p\fP in the \fBpatch\-format\fP and \fBnopatch\-format\fP styles\&.
This hook is, in concert with \fBset\-patch\-format\fP, responsible for
\fB%\fP\-escaping that value for use in the prompt\&.
(See the \fBOddities\fP section\&.)
+.PP
+The \fBquilt\fP backend passes to this hook the inputs
+\fB${hook_com[quilt\-patches\-dir]}\fP and, if it has been
+determined, \fB${hook_com[quilt\-pc\-dir]}\fP\&.
.RE
.TP
\fBgen\-unapplied\-string\fP
@@ -1886,15 +1898,21 @@ generated; the \fBget\-unapplied\fP style must be true\&.
.RS
.PP
This hook gets the names of all unapplied patches which \fBvcs_info\fP
-collected so far in order, which means that the first argument is
+in order, which means that the first argument is
the patch next\-in\-line to be applied and so forth\&.
.PP
+The format of each argument is as for \fBgen\-applied\-string\fP, above\&.
+.PP
When setting \fBret\fP to non\-zero, the string in
\fB${hook_com[unapplied\-string]}\fP will be available as \fB%u\fP in the
\fBpatch\-format\fP and \fBnopatch\-format\fP styles\&.
This hook is, in concert with \fBset\-patch\-format\fP, responsible for
\fB%\fP\-escaping that value for use in the prompt\&.
(See the \fBOddities\fP section\&.)
+.PP
+The \fBquilt\fP backend passes to this hook the inputs
+\fB${hook_com[quilt\-patches\-dir]}\fP and, if it has been
+determined, \fB${hook_com[quilt\-pc\-dir]}\fP\&.
.RE
.TP
\fBgen\-mqguards\-string\fP
@@ -1993,6 +2011,10 @@ This hook is, in concert with the \fBgen\-applied\-string\fP or
\fBgen\-unapplied\-string\fP hooks if they are defined, responsible for
\fB%\fP\-escaping the final \fBpatch\-format\fP value for use in the prompt\&.
(See the \fBOddities\fP section\&.)
+.PP
+The \fBquilt\fP backend passes to this hook the inputs
+\fB${hook_com[quilt\-patches\-dir]}\fP and, if it has been
+determined, \fB${hook_com[quilt\-pc\-dir]}\fP\&.
.RE
.TP
\fBset\-message\fP
@@ -2081,22 +2103,38 @@ Display the revision number in yellow for \fBbzr\fP and \fBsvn\fP:
.RS
.nf
\fBzstyle \&':vcs_info:(svn|bzr):*' \e
+ branchformat \&'%b%%F{yellow}:%r'\fP
+.fi
+.RE
+.PP
+The doubled percent sign is explained in
+the \fBOddities\fP section\&.
+.PP
+Alternatively, one can use the raw colour codes directly:
+.PP
+.RS
+.nf
+\fBzstyle \&':vcs_info:(svn|bzr):*' \e
branchformat \&'%b%{'${fg[yellow]}'%}:%r'\fP
.fi
.RE
.PP
-If you want colors, make sure you enclose the color codes in \fB%{\fP\fI\&.\&.\&.\fP\fB%}\fP
+Normally when a variable is interpolated into a format string, the variable
+needs to be \fB%\fP\-escaped\&. In this example we skipped that because we assume
+the value of \fB${fg[yellow]}\fP doesn\&'t contain any \fB%\fP signs\&.
+.PP
+Make sure you enclose the color codes in \fB%{\fP\fI\&.\&.\&.\fP\fB%}\fP
if you want to use the string provided by \fBvcs_info\fP in prompts\&.
.PP
Here is how to print the VCS information as a command (not in a prompt):
.RS
.nf
-\fBalias vcsi=\&'vcs_info command; vcs_info_lastmsg'\fP
+\fBvcsi() { vcs_info interactive; vcs_info_lastmsg }\fP
.fi
.RE
.PP
This way, you can even define different formats for output via
-\fBvcs_info_lastmsg\fP in the \&'\fB:vcs_info:*:command:*\fP' namespace\&.
+\fBvcs_info_lastmsg\fP in the \&'\fB:vcs_info:*:interactive:*\fP' namespace\&.
.PP
Now as promised, some code that uses hooks:
say, you\&'d like to replace the string `svn' by `subversion' in
@@ -2210,7 +2248,7 @@ This concludes our guided tour through zsh\&'s \fBvcs_info\fP\&.
.PP
You should make sure all the functions from the \fBFunctions/Prompts\fP
directory of the source distribution are available; they all begin with
-the string `\fBprompt_\fP\&' except for the special function`\fBpromptinit\fP'\&.
+the string `\fBprompt_\fP\&' except for the special function `\fBpromptinit\fP'\&.
You also need the `\fBcolors\fP\&' and `\fBadd\-zsh\-hook\fP' functions from
\fBFunctions/Misc\fP\&.
All these functions may already be installed on your system; if not,
@@ -2334,31 +2372,36 @@ setopts (\fBpromptbang\fP, etc\&.) are turned on, all other prompt\-related
options are turned off\&. The \fBprompt_opts\fP array preserves setopts even
beyond the scope of \fBlocaloptions\fP, should your function need that\&.
.TP
-Modify precmd and preexec
-Use of \fBadd\-zsh\-hook\fP is recommended\&. The \fBprecmd\fP and \fBpreexec\fP
-hooks are automatically adjusted if the prompt theme changes or is
-disabled\&.
+Modify hooks
+Use of \fBadd\-zsh\-hook\fP and \fBadd\-zle\-hook\-widget\fP is recommended (see
+the \fBManipulating Hook Functions\fP section above)\&.
+All hooks that follow the naming pattern \fBprompt_\fP\fItheme\fP\fB_\fP\fIhook\fP
+are automatically removed when the prompt theme changes or is disabled\&.
.TP
Declare cleanup
If your function makes any other changes that should be undone when the
theme is disabled, your setup function may call
.RS
+.PP
+.RS
.nf
\fBprompt_cleanup \fIcommand\fP\fP
.fi
.RE
+.PP
where \fIcommand\fP should be suitably quoted\&. If your theme is ever
disabled or replaced by another, \fIcommand\fP is executed with \fBeval\fP\&.
You may declare more than one such cleanup hook\&.
+.RE
.TP
Define preview
-Define or autoload a function \fBprompt_\fIname\fP_preview\fP to display
+Define or autoload a function \fBprompt_\fP\fIname\fP\fB_preview\fP to display
a simulated version of your prompt\&. A simple default previewer is
defined by \fBpromptinit\fP for themes that do not define their own\&.
This preview function is called by `\fBprompt \-p\fP\&'\&.
.TP
Provide help
-Define or autoload a function \fBprompt_\fIname\fP_help\fP to display
+Define or autoload a function \fBprompt_\fP\fIname\fP\fB_help\fP to display
documentation or help text for your theme\&.
This help function is called by `\fBprompt \-h\fP\&'\&.
.PP
@@ -2669,7 +2712,7 @@ directly\&.
.RE
.TP
\fBbracketed\-paste\-magic\fP
-The \fBbracketed\-paste\fP widget (see subsection Miscellaneous in
+The \fBbracketed\-paste\fP widget (see the subsection `Miscellaneous\&' in
\fIzshzle\fP(1))
inserts pasted text literally into the editor buffer rather than interpret
it as keystrokes\&. This disables some common usages where the self\-insert
@@ -2857,6 +2900,16 @@ Edit the command line using your visual editor, as in \fBksh\fP\&.
\fBbindkey \-M vicmd v edit\-command\-line\fP
.fi
.RE
+.PP
+The editor to be used can also be specified using the \fBeditor\fP style in
+the context of the widget\&. It is specified as an array of command and
+arguments:
+.PP
+.RS
+.nf
+\fBzstyle :zle:edit\-command\-line editor gvim \-f\fP
+.fi
+.RE
.RE
.TP
\fBexpand\-absolute\-path\fP
@@ -3811,7 +3864,7 @@ investigate the command word found\&. The default is \fBwhence \-c\fP\&.
.TP
\fBzcalc\-auto\-insert\fP
This function is useful together with the \fBzcalc\fP function described in
-the section Mathematical Functions\&.
+the section `Mathematical Functions\&'\&.
It should be bound to a key representing a binary operator such
as `\fB+\fP\&', `\fB\-\fP', `\fB*\fP' or `\fB/\fP'\&. When running in zcalc,
if the key occurs at the start of the line or immediately following
@@ -4252,7 +4305,8 @@ Calling \fBzsh\-mime\-setup\fP with the option
\fB\-v\fP causes verbose output to be shown during the setup operation\&.
.PP
The system respects the \fBmailcap\fP flags \fBneedsterminal\fP and
-\fBcopiousoutput\fP, see \fImailcap\fP(4)\&.
+\fBcopiousoutput\fP; see \fImailcap\fP(4) or \fImailcap\fP(5)
+(the man page\&'s name varies across platforms)\&.
.PP
The functions use the following styles, which are defined with the
\fBzstyle\fP builtin command (see \fIzshmodules\fP(1))\&. They should be defined
@@ -4330,7 +4384,7 @@ types even if they are executable\&. As this example shows, the complete
file name is matched against the pattern, regardless of how the file
was passed to the handler\&. The file is resolved to a full path using
the \fB:P\fP modifier described in
-the subsection Modifiers in \fIzshexpn\fP(1);
+the subsection `Modifiers\&' in \fIzshexpn\fP(1);
this means that symbolic links are resolved where possible, so that
links into other file systems behave in the correct fashion\&.
.RE
@@ -4995,6 +5049,11 @@ Same as \fBzed \-f\fP\&. This function does not appear in the zsh
distribution, but can be created by linking \fBzed\fP to the name \fBfned\fP
in some directory in your \fBfpath\fP\&.
.TP
+\fBhisted\fP [ [ \fIname\fP ] \fIsize\fP ]
+Same as \fBzed \-h\fP\&. This function does not appear in the zsh
+distribution, but can be created by linking \fBzed\fP to the name \fBhisted\fP
+in some directory in your \fBfpath\fP\&.
+.TP
\fBis\-at\-least\fP \fIneeded\fP [ \fIpresent\fP ]
Perform a greater\-than\-or\-equal\-to comparison of two strings having the
format of a zsh version number; that is, a string of numbers and text with
@@ -5031,7 +5090,7 @@ See also the \fBpager\fP, \fBprompt\fP and \fBrprompt\fP styles below\&.
.TP
\fBregexp\-replace\fP \fIvar\fP \fIregexp\fP \fIreplace\fP
Use regular expressions to perform a global search and replace operation
-on a variable\&. POSIX extended regular expressions are used,
+on a variable\&. POSIX extended regular expressions (ERE) are used,
unless the option \fBRE_MATCH_PCRE\fP has been set, in which case
Perl\-compatible regular expressions are used
(this requires the shell to be linked against the \fBpcre\fP
@@ -5050,6 +5109,9 @@ and arithmetic expressions which will be replaced: in particular, a
reference to \fB$MATCH\fP will be replaced by the text matched by the pattern\&.
.PP
The return status is 0 if at least one match was performed, else 1\&.
+.PP
+Note that if using POSIX EREs, the \fB^\fP or word boundary operators
+(where available) may not work properly\&.
.RE
.TP
\fBrun\-help\fP \fIcmd\fP
@@ -5096,26 +5158,30 @@ your search path, in order to be found and used by \fBrun\-help\fP\&.
.PD 0
.TP
.PD 0
-run\-help\-git
+\fBrun\-help\-btrfs\fP
+.TP
+.PD 0
+\fBrun\-help\-git\fP
.TP
.PD 0
-run\-help\-ip
+\fBrun\-help\-ip\fP
.TP
.PD 0
-run\-help\-openssl
+\fBrun\-help\-openssl\fP
.TP
.PD 0
-run\-help\-p4
+\fBrun\-help\-p4\fP
.TP
.PD 0
-run\-help\-sudo
+\fBrun\-help\-sudo\fP
.TP
.PD 0
-run\-help\-svk
+\fBrun\-help\-svk\fP
.TP
.PD
\fBrun\-help\-svn\fP
Assistant functions for the
+\fBbtrfs\fP,
\fBgit\fP,
\fBip\fP,
\fBopenssl\fP,
@@ -5233,7 +5299,7 @@ counts the number of arguments passed to each execution of \fIcommand\fP,
\fIincluding\fP any \fIarg\fP list\&. Also, any time \fB\-i\fP or \fB\-I\fP is used,
each \fIinput\fP is processed separately as if by `\fB\-L\fP \fB1\fP\&'\&.
.PP
-For details of the other \fBzargs\fP options, see \fIxargs\fP(1) (but note
+For details of the other \fBzargs\fP options, see the \fIxargs\fP(1) man page (but note
the difference in function between \fBzargs\fP and \fBxargs\fP) or run
\fBzargs\fP with the \fB\-\fP\fB\-help\fP option\&.
.RE
@@ -5241,6 +5307,9 @@ the difference in function between \fBzargs\fP and \fBxargs\fP) or run
.PD 0
\fBzed\fP [ \fB\-f\fP [ \fB\-x\fP \fInum\fP ] ] \fIname\fP
.TP
+.PD 0
+\fBzed\fP [ \fB\-h\fP [ \fIname\fP ] \fIsize\fP ]
+.TP
.PD
\fBzed \-b\fP
This function uses the ZLE editor to edit a file or function\&.
@@ -5257,7 +5326,14 @@ the given number of spaces; `\fB\-x 2\fP\&' is consistent with the layout
of functions distributed with the shell\&.
.PP
Without \fB\-f\fP, \fIname\fP is the path name of the file to edit, which need
-not exist; it is created on write, if necessary\&.
+not exist; it is created on write, if necessary\&. With \fB\-h\fP, the file is
+presumed to contain history events\&.
+.PP
+When no file name is provided for \fB\-h\fP the current shell history is edited
+in place\&. The history is renumbered when zed exits successfully\&.
+.PP
+When editing history, multi\-line events must have a trailing backslash on
+every line before the last\&.
.PP
While editing, the function sets the main keymap to \fBzed\fP and the
vi command keymap to \fBzed\-vicmd\fP\&. These will be copied from the existing
@@ -5273,16 +5349,19 @@ suitable for putting into a startup file\&. Note that, if rerun,
this will overwrite the existing \fBzed\fP and \fBzed\-vicmd\fP keymaps\&.
.PP
Completion is available, and styles may be set with the context prefix
-`\fB:completion:zed\fP\&'\&.
-.PP
-A zle widget \fBzed\-set\-file\-name\fP is available\&. This can be called by
-name from within zed using `\fB\eex zed\-set\-file\-name\fP\&' (note, however, that
-because of zed\&'s rebindings you will have to type \fB^j\fP at the end instead
-of the return key), or can be bound to a key in either of the \fBzed\fP or
-\fBzed\-vicmd\fP keymaps after `\fBzed \-b\fP\&' has been run\&. When the widget is
-called, it prompts for a new name for the file being edited\&. When zed
-exits the file will be written under that name and the original file will
-be left alone\&. The widget has no effect with `\fBzed \-f\fP\&'\&.
+`\fB:completion:zed:\fP\&'\&.
+.PP
+A zle widget \fBzed\-set\-file\-name\fP is available\&. This can be called
+by name from within zed using `\fB\eex zed\-set\-file\-name\fP\&' or can be
+bound to a key in either of the \fBzed\fP or \fBzed\-vicmd\fP keymaps after
+`\fBzed \-b\fP\&' has been run\&. When the widget is called, it prompts for
+a new name for the file being edited\&. When zed exits the file will be
+written under that name and the original file will be left alone\&. The
+widget has no effect when invoked from `\fBzed \-f\fP\&'\&. The completion
+context is changed to `\fB:completion:zed\-set\-file\-name:\fP\&'\&. When editing
+the current history with `\fBzed \-h\fP\&', the history is first updated and
+then the file is written, but the global setting of \fBHISTFILE\fP is not
+altered\&.
.PP
While \fBzed\-set\-file\-name\fP is running, zed uses the keymap
\fBzed\-normal\-keymap\fP, which is linked from the main keymap in effect
@@ -5332,7 +5411,7 @@ the same result, the destination was an existing regular file and \fB\-f\fP
was not given) causes the entire function to abort without doing
anything\&.
.PP
-In addition to pattern replacement, the variable \fB$f\fP can be referrred
+In addition to pattern replacement, the variable \fB$f\fP can be referred
to in the second (replacement) argument\&. This makes it possible to
use variable substitution to alter the argument; see examples below\&.
.PP
diff --git a/Doc/zshexpn.1 b/Doc/zshexpn.1
index 9987820e8..9ec445400 100644
--- a/Doc/zshexpn.1
+++ b/Doc/zshexpn.1
@@ -1,4 +1,4 @@
-.TH "ZSHEXPN" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHEXPN" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshexpn \- zsh expansion and substitution
.\" Yodl file: Zsh/expn.yo
@@ -66,7 +66,7 @@ EXPANSION OF PROMPT SEQUENCES in \fIzshmisc\fP(1)) is the number that is to be a
A history expansion begins with the first character of the \fBhistchars\fP
parameter, which is `\fB!\fP\&' by default, and may occur anywhere on the
command line, including inside double quotes (but not inside single quotes
-\fB\&'\&.\&.\&.'\fP or C\-style quotes \fB$'\&.\&.\&.'\fP nor when escaped with a backslash)\&.
+\fB\&'\&.\&.\&.'\fP or C\-style quotes \fB$'\&.\&.\&.'\fP nor when escaped with a backslash)\&.
.PP
The first character is followed by an optional event designator
(see the section `Event Designators\&') and then an optional word
@@ -277,8 +277,10 @@ expansion\&.
.TP
\fBP\fP
Turn a file name into an absolute path, like \fBrealpath(3)\fP\&.
-The resulting path will be absolute, have neither `\fB\&.\fP\&' nor `\fB\&.\&.\fP' components,
-and refer to the same directory entry as the input filename\&.
+The resulting path will be absolute,
+will refer to the same directory entry as the input filename,
+and none of its components will be symbolic links or equal to
+`\fB\&.\fP\&' or `\fB\&.\&.\fP'\&.
.RS
.PP
Unlike \fBrealpath(3)\fP, non\-existent trailing components are
@@ -490,7 +492,7 @@ which treats \fIarg\fP as a file name and replaces it with the file\&'s
contents\&.
.PP
The \fB=\fP form is useful as both the \fB/dev/fd\fP and the named pipe
-implementation of \fB<(\fP\fI\&.\&.\&.\fP\fB)\fP have drawbacks\&. In
+implementation of \fB<(\fP\fI\&.\&.\&.\fP\fB)\fP have drawbacks\&. In
the former case, some programmes may automatically close the file
descriptor in question before examining the file on the command line,
particularly if this is necessary for security reasons such as when the
@@ -507,8 +509,7 @@ efficiently written (provided the \fBMULTIOS\fP option is set) as:
.PP
.RS
.nf
-\fB\fBpaste <(cut \-f1\fP \fIfile1\fP\fB) <(cut \-f3\fP \fIfile2\fP\fB)\fP \e
-\fB> >(\fP\fIprocess1\fP\fB) > >(\fP\fIprocess2\fP\fB)\fP\fP
+\fB\fBpaste <(cut \-f1\fP \fIfile1\fP\fB) <(cut \-f3\fP \fIfile2\fP\fB)\fP \fB> >(\fP\fIprocess1\fP\fB) > >(\fP\fIprocess2\fP\fB)\fP\fP
.fi
.RE
.PP
@@ -943,7 +944,11 @@ of the string \fB$\-\fP and the array \fB$*\fP respectively\&. If
the \fB#\fP to be treated in this fashion\&.
.RE
.TP
+.PD 0
\fB${^\fP\fIspec\fP\fB}\fP
+.TP
+.PD
+\fB${^^\fP\fIspec\fP\fB}\fP
Turn on the \fBRC_EXPAND_PARAM\fP option for the
evaluation of \fIspec\fP; if the `\fB^\fP\&' is doubled, turn it off\&.
When this option is set, array expansions of the form
@@ -965,7 +970,11 @@ happening later\&. If word splitting is also in effect the
elements\&.
.RE
.TP
+.PD 0
\fB${=\fP\fIspec\fP\fB}\fP
+.TP
+.PD
+\fB${==\fP\fIspec\fP\fB}\fP
Perform word splitting using the rules for \fBSH_WORD_SPLIT\fP during the
evaluation of \fIspec\fP, but regardless of whether the parameter appears in
double quotes; if the `\fB=\fP\&' is doubled, turn it off\&.
@@ -979,7 +988,11 @@ of \fIspec\fP \fIbefore\fP the assignment to \fIname\fP is performed\&.
This affects the result of array assignments with the \fBA\fP flag\&.
.RE
.TP
+.PD 0
\fB${~\fP\fIspec\fP\fB}\fP
+.TP
+.PD
+\fB${~~\fP\fIspec\fP\fB}\fP
Turn on the \fBGLOB_SUBST\fP option for the evaluation of
\fIspec\fP; if the `\fB~\fP\&' is doubled, turn it off\&. When this option is
set, the string resulting from the expansion will be interpreted as a
@@ -1030,9 +1043,10 @@ following flags are supported:
.TP
.PD
\fB#\fP
-Evaluate the resulting words as numeric expressions and output the
-characters corresponding to the resulting integer\&. Note that this form is
-entirely distinct from use of the \fB#\fP without parentheses\&.
+Evaluate the resulting words as numeric expressions and interpret
+these as character codes\&. Output the corresponding characters\&. Note
+that this form is entirely distinct from use of the \fB#\fP without
+parentheses\&.
.RS
.PP
If the \fBMULTIBYTE\fP option is set and the number is greater than 127
@@ -1041,7 +1055,7 @@ If the \fBMULTIBYTE\fP option is set and the number is greater than 127
.TP
\fB%\fP
Expand all \fB%\fP escapes in the resulting words in the same way as in
-prompts (see
+prompts (see
EXPANSION OF PROMPT SEQUENCES in \fIzshmisc\fP(1))\&. If this flag is given twice,
full prompt expansion is done on the resulting words, depending on the
setting of the \fBPROMPT_PERCENT\fP, \fBPROMPT_SUBST\fP and \fBPROMPT_BANG\fP
@@ -1171,22 +1185,31 @@ Convert all letters in the result to lower case\&.
\fBn\fP
Sort decimal integers numerically; if the first differing
characters of two test strings are not digits, sorting
-is lexical\&. Integers with more initial zeroes
-are sorted before those with fewer or none\&. Hence the array `\fBfoo1 foo02
+is lexical\&. `\fB+\fP\&' and `\fB\-\fP' are not treated specially; they are treated as
+any other non\-digit\&. Integers with more initial zeroes
+are sorted before those with fewer or none\&. Hence the array `\fBfoo+24 foo1 foo02
foo2 foo3 foo20 foo23\fP\&' is sorted into the order shown\&.
May be combined with `\fBi\fP\&' or `\fBO\fP'\&.
.TP
+\fB\-\fP
+As \fBn\fP, but a leading minus sign indicates a negative decimal
+integer\&. A leading minus sign not followed by an integer does not trigger
+numeric sorting\&.
+Note that `\fB+\fP\&' signs are not handled specially (this may change in the
+future)\&.
+.TP
\fBo\fP
Sort the resulting words in ascending order; if this appears on its
own the sorting is lexical and case\-sensitive (unless the locale
renders it case\-insensitive)\&. Sorting in ascending order is the
default for other forms of sorting, so this is ignored if combined
-with `\fBa\fP\&', `\fBi\fP' or `\fBn\fP'\&.
+with `\fBa\fP\&', `\fBi\fP', `\fBn\fP' or `\fB\-\fP'\&.
.TP
\fBO\fP
Sort the resulting words in descending order; `\fBO\fP\&' without `\fBa\fP',
-`\fBi\fP\&' or `\fBn\fP' sorts in reverse lexical order\&. May be combined
-with `\fBa\fP\&', `\fBi\fP' or `\fBn\fP' to reverse the order of sorting\&.
+`\fBi\fP\&', `\fBn\fP' or `\fB\-\fP' sorts in reverse lexical order\&. May be
+combined with `\fBa\fP\&', `\fBi\fP', `\fBn\fP' or `\fB\-\fP' to reverse the
+order of sorting\&.
.TP
\fBP\fP
This forces the value of the parameter \fIname\fP to be interpreted as a
@@ -1277,6 +1300,11 @@ for readonly parameters
\fBtag\fP
for tagged parameters
.TP
+\fBtied\fP
+for parameters tied to another parameter in the manner of \fBPATH\fP
+(colon\-separated list) and \fBpath\fP (array), whether these are
+special parameters or user\-defined with `\fBtypeset \-T\fP\&'
+.TP
\fBexport\fP
for exported parameters
.TP
@@ -1487,17 +1515,32 @@ i\&.e\&. \fB"${(@s\&.:\&.)line}"\fP\&.
\fBZ:\fP\fIopts\fP\fB:\fP
As \fBz\fP but takes a combination of option letters between a following
pair of delimiter characters\&. With no options the effect is identical
-to \fBz\fP\&. \fB(Z+c+)\fP
+to \fBz\fP\&. The following options are available:
+.RS
+.PP
+.PD 0
+.TP
+.PD
+\fB(Z+c+)\fP
causes comments to be parsed as a string and retained; any field in the
resulting array beginning with an unquoted comment character is a
-comment\&. \fB(Z+C+)\fP causes comments to be parsed
+comment\&.
+.TP
+\fB(Z+C+)\fP
+causes comments to be parsed
and removed\&. The rule for comments is standard: anything between a word
starting with the third character of \fB$HISTCHARS\fP, default \fB#\fP, up to
-the next newline is a comment\&. \fB(Z+n+)\fP causes
+the next newline is a comment\&.
+.TP
+\fB(Z+n+)\fP
+causes
unquoted newlines to be treated as ordinary whitespace, else they are
treated as if they are shell code delimiters and converted to
-semicolons\&. Options are combined within the same set of delimiters,
+semicolons\&.
+.PP
+Options are combined within the same set of delimiters,
e\&.g\&. \fB(Z+Cn+)\fP\&.
+.RE
.TP
\fB_:\fP\fIflags\fP\fB:\fP
The underscore (\fB_\fP) flag is reserved for future use\&. As of this
@@ -1506,7 +1549,7 @@ underscore, other than an empty pair of delimiters, is treated as an
error, and the flag itself has no effect\&.
.PP
The following flags are meaningful with the \fB${\fP\&.\&.\&.\fB#\fP\&.\&.\&.\fB}\fP or
-\fB${\fP\&.\&.\&.\fB%\fP\&.\&.\&.\fB}\fP forms\&. The \fBS\fP and \fBI\fP flags may also be
+\fB${\fP\&.\&.\&.\fB%\fP\&.\&.\&.\fB}\fP forms\&. The \fBS\fP, \fBI\fP, and \fB*\fP flags may also be
used with the \fB${\fP\&.\&.\&.\fB/\fP\&.\&.\&.\fB}\fP forms\&.
.PP
.PD 0
@@ -1594,6 +1637,10 @@ form using `\fB%%\fP\&' will remove the same matches as for `\fB##\fP' in revers
order\&.
.RE
.TP
+\fB*\fP
+Enable \fBEXTENDED_GLOB\fP for substitution via \fB${\fP\&.\&.\&.\fB/\fP\&.\&.\&.\fB}\fP or
+\fB${\fP\&.\&.\&.\fB//\fP\&.\&.\&.\fB}\fP\&.
+.TP
\fBB\fP
Include the index of the beginning of the match in the result\&.
.TP
@@ -1611,7 +1658,6 @@ Include the length of the match in the result\&.
Include the unmatched portion in the result (the \fIR\fPest)\&.
.PP
.SS "Rules"
-.PP
Here is a summary of the rules for substitution; this assumes that braces
are present around the substitution, i\&.e\&. \fB${\fP\fI\&.\&.\&.\fP\fB}\fP\&. Some particular
examples are given below\&. Note that the Zsh Development Group accepts
@@ -1840,7 +1886,7 @@ This produces the result \fBb\fP\&. First, the inner substitution
\fB"${foo}"\fP, which has no array (\fB@\fP) flag, produces a single word
result \fB"bar baz"\fP\&. The outer substitution \fB"${(@)\&.\&.\&.[1]}"\fP detects
that this is a scalar, so that (despite the `\fB(@)\fP\&' flag) the subscript
-picks the first character\&.
+picks the first character\&.
.TP
\fB"${${(@)foo}[1]}"\fP
This produces the result `\fBbar\fP\&'\&. In this case, the inner substitution
@@ -1869,7 +1915,7 @@ empty string will then be elided, as it is not in double quotes\&.
.PP
.SH "COMMAND SUBSTITUTION"
A command enclosed in parentheses preceded by a dollar sign, like
-`\fB$(\fP\&.\&.\&.\fB)\fP\&', or quoted with grave
+`\fB$(\fP\&.\&.\&.\fB)\fP\&', or quoted with grave
accents, like `\fB`\fP\&.\&.\&.\fB`\fP\&', is replaced with its standard output, with
any trailing newlines deleted\&.
If the substitution is not enclosed in double quotes, the
@@ -1952,7 +1998,7 @@ has similar effects\&.
.PP
To combine brace expansion with array expansion, see the
\fB${^\fP\fIspec\fP\fB}\fP form described
-in the section Parameter Expansion
+in the section `Parameter Expansion\&'
above\&.
.PP
.SH "FILENAME EXPANSION"
@@ -1982,8 +2028,8 @@ The \fBPUSHD_MINUS\fP
option exchanges the effects of `\fB~+\fP\&' and `\fB~\-\fP' where they are
followed by a number\&.
.PP
-.SS "Dynamic named directories"
.PP
+.SS "Dynamic named directories"
If the function \fBzsh_directory_name\fP exists, or the shell variable
\fBzsh_directory_name_functions\fP exists and contains an array of
function names, then the functions are used to implement dynamic
@@ -2113,7 +2159,6 @@ exists by that name, the word is replaced
by the full pathname of the command\&.
.PP
.SS "Notes"
-.PP
Filename expansion is performed on the right hand side of a parameter
assignment, including those appearing after commands of the
\fBtypeset\fP family\&. In this case, the right hand side will be treated
@@ -2224,7 +2269,8 @@ is not sensitive to the locale:
.PD
\fB[:IDENT:]\fP
The character is allowed to form part of a shell identifier, such
-as a parameter name
+as a parameter name; this test respects the \fBPOSIX_IDENTIFIERS\fP
+option
.TP
\fB[:IFS:]\fP
The character is used as an input field separator, i\&.e\&. is contained in the
@@ -2558,7 +2604,7 @@ qualifiers are also not applied in ordinary pattern matching\&.
.TP
\fBu\fP
Respect the current locale in determining the presence of multibyte
-characters in a pattern, provided the shell was compiled with
+characters in a pattern, provided the shell was compiled with
\fBMULTIBYTE_SUPPORT\fP\&. This overrides the \fBMULTIBYTE\fP
option; the default behaviour is taken from the option\&. Compare \fBU\fP\&.
(Mnemonic: typically multibyte characters are from Unicode in the UTF\-8
@@ -2818,19 +2864,19 @@ expected, if combined with a `\fB=\fP\&', the value given must match the
file\-modes exactly, with a `\fB+\fP\&', at least the bits in the
given number must be set in the file\-modes, and with a `\fB\-\fP\&', the
bits in the number must not be set\&. Giving a `\fB?\fP\&' instead of a
-octal digit anywhere in the number ensures that the corresponding bits
+octal digit anywhere in the number ensures that the corresponding bits
in the file\-modes are not checked, this is only useful in combination
with `\fB=\fP\&'\&.
.RS
.PP
If the qualifier `\fBf\fP\&' is followed by any other character anything
-up to the next matching character (`\fB[\fP\&', `\fB{\fP', and `\fB<\fP' match
+up to the next matching character (`\fB[\fP\&', `\fB{\fP', and `\fB<\fP' match
`\fB]\fP\&', `\fB}\fP', and `\fB>\fP' respectively, any other character
matches itself) is taken as a list of comma\-separated
\fIsub\-spec\fPs\&. Each \fIsub\-spec\fP may be either an octal number as
described above or a list of any of the characters `\fBu\fP\&', `\fBg\fP',
`\fBo\fP\&', and `\fBa\fP', followed by a `\fB=\fP', a `\fB+\fP', or a
-`\fB\-\fP\&', followed by a list of any of the characters `\fBr\fP', `\fBw\fP',
+`\fB\-\fP\&', followed by a list of any of the characters `\fBr\fP', `\fBw\fP',
`\fBx\fP\&', `\fBs\fP', and `\fBt\fP', or an octal digit\&. The first list of
characters specify which access rights are to be checked\&. If a `\fBu\fP\&'
is given, those for the owner of the file are used, if a `\fBg\fP\&' is
@@ -2839,7 +2885,7 @@ of other users, and the `\fBa\fP\&' says to test all three groups\&. The
`\fB=\fP\&', `\fB+\fP', and `\fB\-\fP' again says how the modes are to be
checked and have the same meaning as described for the first form
above\&. The second list of characters finally says which access rights
-are to be expected: `\fBr\fP\&' for read access, `\fBw\fP' for write access,
+are to be expected: `\fBr\fP\&' for read access, `\fBw\fP' for write access,
`\fBx\fP\&' for the right to execute the file (or to search a directory),
`\fBs\fP\&' for the setuid and setgid bits, and `\fBt\fP' for the sticky
bit\&.
@@ -2848,7 +2894,7 @@ Thus, `\fB*(f70?)\fP\&' gives the files for which the owner has read,
write, and execute permission, and for which other group members have
no rights, independent of the permissions for other users\&. The pattern
`\fB*(f\-100)\fP\&' gives all files for which the owner does not have
-execute permission, and `\fB*(f:gu+w,o\-rx:)\fP\&' gives the files for which
+execute permission, and `\fB*(f:gu+w,o\-rx:)\fP\&' gives the files for which
the owner and the other members of the group have at least write
permission, and for which other users don\&'t have read or execute
permission\&.
@@ -2981,7 +3027,9 @@ negates all qualifiers following it
.TP
\fB\-\fP
toggles between making the qualifiers work on symbolic links (the
-default) and the files they point to
+default) and the files they point to, if any; any symbolic link for
+whose target the `\fBstat\fP\&' system call fails (whatever the cause of the
+failure) is treated as a file in its own right
.TP
\fBM\fP
sets the \fBMARK_DIRS\fP option for the current pattern
@@ -3009,22 +3057,50 @@ Implies \fBoN\fP when no \fBo\fP\fIc\fP qualifier is used\&.
.RE
.TP
\fBo\fP\fIc\fP
-specifies how the names of the files should be sorted\&. If \fIc\fP is
-\fBn\fP they are sorted by name; if it is \fBL\fP they
-are sorted depending on the size (length) of the files; if \fBl\fP
-they are sorted by the number of links; if \fBa\fP, \fBm\fP, or \fBc\fP
-they are sorted by the time of the last access, modification, or
-inode change respectively; if \fBd\fP, files in subdirectories appear before
+specifies how the names of the files should be sorted\&. The following values
+of \fIc\fP sort in the following ways:
+.RS
+.PP
+.PD 0
+.TP
+\fBn\fP
+By name\&.
+.TP
+\fBL\fP
+By the size (length) of the files\&.
+.TP
+\fBl\fP
+By number of links\&.
+.TP
+\fBa\fP
+By time of last access, youngest first\&.
+.TP
+\fBm\fP
+By time of last modification, youngest first\&.
+.TP
+\fBc\fP
+By time of last inode change, youngest first\&.
+.TP
+\fBd\fP
+By directories: files in subdirectories appear before
those in the current directory at each level of the search \-\- this is best
combined with other criteria, for example `\fBodon\fP\&' to sort on names for
-files within the same directory; if \fBN\fP, no sorting is performed\&.
-Note that \fBa\fP, \fBm\fP, and \fBc\fP compare
-the age against the current time, hence the first name in the list is the
-youngest file\&. Also note that the modifiers \fB^\fP and \fB\-\fP are used,
+files within the same directory\&.
+.TP
+\fBN\fP
+No sorting is performed\&.
+.TP
+.PD 0
+\fBe\fP\fIstring\fP
+.TP
+\fB+\fP\fIcmd\fP
+Sort by shell code (see below)\&.
+.PD
+.PP
+Note that the modifiers \fB^\fP and \fB\-\fP are used,
so `\fB*(^\-oL)\fP\&' gives a list of all files sorted by file size in descending
order, following any symbolic links\&. Unless \fBoN\fP is used, multiple order
specifiers may occur to resolve ties\&.
-.RS
.PP
The default sorting is \fBn\fP (by name) unless the \fBY\fP glob qualifier is used,
in which case it is \fBN\fP (unsorted)\&.
@@ -3041,9 +3117,10 @@ repeated, but note that the maximum number of sort operators of any kind
that may appear in any glob expression is 12\&.
.RE
.TP
+.PD
\fBO\fP\fIc\fP
-like `\fBo\fP\&', but sorts in descending order; i\&.e\&. `\fB*(^oc)\fP' is the
-same as `\fB*(Oc)\fP\&' and `\fB*(^Oc)\fP' is the same as `\fB*(oc)\fP'; `\fBOd\fP'
+like `\fBo\fP\&', but sorts in descending order; i\&.e\&. `\fB*(^o\fP\fIc\fP\fB)\fP' is the
+same as `\fB*(O\fP\fIc\fP\fB)\fP\&' and `\fB*(^O\fP\fIc\fP\fB)\fP' is the same as `\fB*(o\fP\fIc\fP\fB)\fP'; `\fBOd\fP'
puts files in the current directory before those in subdirectories at each
level of the search\&.
.TP
@@ -3051,7 +3128,7 @@ level of the search\&.
specifies which of the matched filenames should be included in the
returned list\&. The syntax is the same as for array
subscripts\&. \fIbeg\fP and the optional \fIend\fP may be mathematical
-expressions\&. As in parameter subscripting they may be negative to make
+expressions\&. As in parameter subscripting they may be negative to make
them count from the last match backward\&. E\&.g\&.: `\fB*(\-OL[1,3])\fP\&'
gives a list of the names of the three largest files\&.
.TP
diff --git a/Doc/zshmisc.1 b/Doc/zshmisc.1
index d0d1a21d9..e5396d1d8 100644
--- a/Doc/zshmisc.1
+++ b/Doc/zshmisc.1
@@ -1,4 +1,4 @@
-.TH "ZSHMISC" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHMISC" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshmisc \- everything and then some
.\" Yodl file: Zsh/grammar.yo
@@ -256,7 +256,9 @@ for each selection until a break or end\-of\-file is encountered\&.
.TP
\fB(\fP \fIlist\fP \fB)\fP
Execute \fIlist\fP in a subshell\&. Traps set by the \fBtrap\fP builtin
-are reset to their default values while executing \fIlist\fP\&.
+are reset to their default values while executing \fIlist\fP; an
+exception is that ignored signals will continue to be ignored
+if the option \fBPOSIXTRAPS\fP is set\&.
.TP
\fB{\fP \fIlist\fP \fB}\fP
Execute \fIlist\fP\&.
@@ -326,7 +328,7 @@ execution of \fIalways\-list\fP, just like \fBbreak\fP and \fBcontinue\fP\&.
.RE
.TP
.PD 0
-\fBfunction\fP \fIword\fP \&.\&.\&. [ \fB()\fP ] [ \fIterm\fP ] \fB{\fP \fIlist\fP \fB}\fP
+\fBfunction\fP [ \fB\-T\fP ] \fIword\fP \&.\&.\&. [ \fB()\fP ] [ \fIterm\fP ] \fB{\fP \fIlist\fP \fB}\fP
.TP
.PD 0
\fIword\fP \&.\&.\&. \fB()\fP [ \fIterm\fP ] \fB{\fP \fIlist\fP \fB}\fP
@@ -341,6 +343,16 @@ The body of the function is the \fIlist\fP between
the \fB{\fP and \fB}\fP\&. See the section `Functions\&'\&.
.RS
.PP
+The options of \fBfunction\fP have the following meanings:
+.PP
+.PD 0
+.TP
+.PD
+\-T
+Enable tracing for this function, as though with \fBfunctions \-T\fP\&. See the
+documentation of the \fB\-f\fP option to the \fBtypeset\fP builtin, in
+\fIzshbuiltins\fP(1)\&.
+.PP
If the option \fBSH_GLOB\fP is set for compatibility with other shells, then
whitespace may appear between the left and right parentheses when
there is a single \fIword\fP; otherwise, the parentheses will be treated as
@@ -387,6 +399,8 @@ else the end of the test will not be recognized\&. For the
\fBfor\fP, \fBrepeat\fP, \fBcase\fP and \fBselect\fP commands no such special form
for the arguments is necessary, but the other condition (the special form
of \fIsublist\fP or use of the \fBSHORT_LOOPS\fP option) still applies\&.
+The \fBSHORT_REPEAT\fP option is available to enable the short version only
+for the \fBrepeat\fP command\&.
.PP
.PD 0
.TP
@@ -572,6 +586,11 @@ position (if it could be the first word of a simple command),
or if the alias is global\&.
If the replacement text ends with a space, the next word in the shell input
is always eligible for purposes of alias expansion\&.
+.PP
+It is an error for the function name, \fIword\fP, in the sh\-compatible function
+definition syntax `\fIword\fP \fB()\fP \&.\&.\&.\&' to be a word that resulted
+from alias expansion, unless the \fBALIAS_FUNC_DEF\fP option is set\&.
+.PP
An alias is defined using the \fBalias\fP builtin; global aliases
may be defined using the \fB\-g\fP option to that builtin\&.
.PP
@@ -608,6 +627,19 @@ word, e\&.g\&. \fB\efoo\fP\&. Any form of quoting works, although there is
nothing to prevent an alias being defined for the quoted form such as
\fB\efoo\fP as well\&.
.PP
+In particular, note that quoting must be used when using \fBunalias\fP to remove
+global aliases:
+.PP
+.RS
+.nf
+\fB% alias \-g foo=bar
+% unalias foo
+unalias: no such hash table element: bar
+% unalias \efoo
+% \fP
+.fi
+.RE
+.PP
When \fBPOSIX_ALIASES\fP is set, only plain unquoted strings are eligible
for aliasing\&. The \fBalias\fP builtin does not reject ineligible aliases,
but they are not expanded\&.
@@ -661,34 +693,6 @@ a problem in shell scripts, functions, and code executed with `\fBsource\fP\&'
or `\fB\&.\fP\&'\&. Consequently, use of functions rather than aliases is
recommended in non\-interactive code\&.
.PP
-Note also the unhelpful interaction of aliases and function definitions:
-.PP
-.RS
-.nf
-\fBalias func=\&'noglob func'
-func() {
- echo Do something with $*
-}\fP
-.fi
-.RE
-.PP
-Because aliases are expanded in function definitions, this causes the
-following command to be executed:
-.PP
-.RS
-.nf
-\fBnoglob func() {
- echo Do something with $*
-}\fP
-.fi
-.RE
-.PP
-which defines \fBnoglob\fP as well as \fBfunc\fP as functions with the
-body given\&. To avoid this, either quote the name \fBfunc\fP or use the
-alternative function definition form `\fBfunction func\fP\&'\&. Ensuring the
-alias is defined after the function works but is problematic if the
-code fragment might be re\-executed\&.
-.PP
.SH "QUOTING"
A character may be \fIquoted\fP (that is, made
to stand for itself) by preceding it with a `\fB\e\fP\&'\&.
@@ -810,7 +814,8 @@ tabs are stripped from \fIword\fP and from the document\&.
Perform shell expansion on \fIword\fP and pass the result
to standard input\&. This is known as a \fIhere\-string\fP\&.
Compare the use of \fIword\fP in here\-documents above, where \fIword\fP
-does not undergo shell expansion\&.
+does not undergo shell expansion\&. The result will have a trailing newline
+after it\&.
.TP
.PD 0
\fB<&\fP \fInumber\fP
@@ -1169,9 +1174,24 @@ is invoked as described in the section `Functions\&'\&. If there exists
a shell builtin by that name, the builtin is invoked\&.
.PP
Otherwise, the shell searches each element of \fB$path\fP for a
-directory containing an executable file by that name\&. If the
-search is unsuccessful, the shell prints an error message and returns
-a nonzero exit status\&.
+directory containing an executable file by that name\&.
+.PP
+If execution fails: an error message is printed, and one of the
+following values is returned\&.
+.PP
+.PD 0
+.TP
+127
+The search was unsuccessful\&. The error message is
+`\fBcommand not found:\fP \fIcmd\fP\&'\&.
+.TP
+126
+The executable file has insufficient permissions, is a
+directory or special file, or is not a script and is in a format
+unrecognized by the operating system\&. The exact conditions and error
+message are operating system\-dependent; see
+\fIexecve\fP(2)\&.
+.PD
.PP
If execution fails because the file is not in executable format,
and the file is not a directory, it is assumed to be a shell
@@ -1184,13 +1204,9 @@ not handle this executable format in the kernel\&.
If no external command is found but a function \fBcommand_not_found_handler\fP
exists the shell executes this function with all
command line arguments\&. The return status of the function becomes the
-status of the command\&. If the function wishes to mimic the
-behaviour of the shell when the command is not found, it should
-print the message `\fBcommand not found:\fP \fIcmd\fP\&' to standard error
-and return status 127\&. Note that the handler is executed in a
+status of the command\&. Note that the handler is executed in a
subshell forked to execute an external command, hence changes to
directories, shell parameters, etc\&. have no effect on the main shell\&.
-.PP
.\" Yodl file: Zsh/func.yo
.SH "FUNCTIONS"
Shell functions are defined with the \fBfunction\fP reserved word or the
@@ -1415,13 +1431,14 @@ Certain functions, if defined, have special meaning to the shell\&.
For the functions below, it is possible to define an array that has the
same name as the function with `\fB_functions\fP\&' appended\&. Any element in
such an array is taken as the name of a function to execute; it is executed
-in the same context and with the same arguments as the basic function\&. For
+in the same context and with the same arguments and same initial value of \fB$?\fP
+as the basic function\&. For
example, if \fB$chpwd_functions\fP is an array containing the values
`\fBmychpwd\fP\&', `\fBchpwd_save_dirstack\fP', then the shell attempts to
execute the functions `\fBchpwd\fP\&', `\fBmychpwd\fP' and
`\fBchpwd_save_dirstack\fP\&', in that order\&. Any function that does not exist
is silently ignored\&. A function found by this mechanism is referred to
-elsewhere as a `hook function\&'\&. An error in any function causes subsequent
+elsewhere as a \fIhook function\fP\&. An error in any function causes subsequent
functions not to be run\&. Note further that an error in a \fBprecmd\fP hook
causes an immediately following \fBperiodic\fP function not to run (though
it may run at the next opportunity)\&.
@@ -1475,7 +1492,7 @@ the history file\&. In case of a conflict, the first non\-zero status
value is taken\&.
.PP
A hook function may call `\fBfc \-p\fP \fI\&.\&.\&.\fP\&' to switch the history
-context so that the history is saved in a different file from the
+context so that the history is saved in a different file from
that in the global \fBHISTFILE\fP parameter\&. This is handled specially:
the history context is automatically restored after the processing
of the history line is finished\&.
@@ -1723,7 +1740,7 @@ jobs will be terminated, and the running jobs will be sent
a \fBSIGHUP\fP signal, if the \fBHUP\fP option is set\&.
.PP
To avoid having the shell terminate the running jobs, either
-use the \fBnohup\fP command (see \fInohup\fP(1))
+use the \fInohup\fP(1) command
or the \fBdisown\fP builtin\&.
.SH "SIGNALS"
The \fBINT\fP and \fBQUIT\fP signals for an invoked
@@ -1759,7 +1776,7 @@ The \fBlet\fP builtin command takes arithmetic expressions as arguments; each
is evaluated separately\&. Since many of the arithmetic operators, as well
as spaces, require quoting, an alternative form is provided: for any
command which begins with a `\fB((\fP\&', all the characters until a
-matching `\fB))\fP\&' are treated as a quoted expression and
+matching `\fB))\fP\&' are treated as a double\-quoted expression and
arithmetic expansion performed as for an argument of \fBlet\fP\&. More
precisely, `\fB((\fP\fI\&.\&.\&.\fP\fB))\fP\&' is equivalent to
`\fBlet "\fP\fI\&.\&.\&.\fP\fB"\fP\&'\&. The return status is 0 if the arithmetic value
diff --git a/Doc/zshmodules.1 b/Doc/zshmodules.1
index e6d696fb7..dd3bb4c39 100644
--- a/Doc/zshmodules.1
+++ b/Doc/zshmodules.1
@@ -1,4 +1,4 @@
-.TH "ZSHMODULES" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHMODULES" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshmodules \- zsh loadable modules
.\" Yodl file: Zsh/modules.yo
@@ -105,6 +105,9 @@ Interface to the termcap database\&.
\fBzsh/terminfo\fP
Interface to the terminfo database\&.
.TP
+\fBzsh/watch\fP
+Reporting of login and logout events\&.
+.TP
\fBzsh/zftp\fP
A builtin FTP client\&.
.TP
@@ -972,7 +975,7 @@ input\&. This is only available with the ncurses library; mouse handling
can be detected by checking for the exit status of `\fBzcurses mouse\fP\&' with
no arguments\&. If a mouse
button is clicked (or double\- or triple\-clicked, or pressed or released with
-a configurable delay from being clicked) then \fBkparam\fP is set to the string
+a configurable delay from being clicked) then \fIkparam\fP is set to the string
\fBMOUSE\fP, and \fImparam\fP is set to an array consisting of the
following elements:
.PD 0
@@ -1100,10 +1103,10 @@ The \fBzsh/datetime\fP module makes available one builtin command:
.PD 0
.TP
.PD 0
-\fBstrftime\fP [ \fB\-s\fP \fIscalar\fP ] \fIformat\fP [ \fIepochtime\fP [ \fInanoseconds\fP ] ]
+\fBstrftime\fP [ \fB\-s\fP \fIscalar\fP | \fB\-n\fP ] \fIformat\fP [ \fIepochtime\fP [ \fInanoseconds\fP ] ]
.TP
.PD
-\fBstrftime\fP \fB\-r\fP [ \fB\-q\fP ] [ \fB\-s\fP \fIscalar\fP ] \fIformat\fP \fItimestring\fP
+\fBstrftime\fP \fB\-r\fP [ \fB\-q\fP ] [ \fB\-s\fP \fIscalar\fP | \fB\-n\fP ] \fIformat\fP \fItimestring\fP
Output the date in the \fIformat\fP specified\&. With no \fIepochtime\fP, the
current system date/time is used; optionally, \fIepochtime\fP may be used to
specify the number of seconds since the epoch, and \fInanoseconds\fP may
@@ -1116,6 +1119,9 @@ the section EXPANSION OF PROMPT SEQUENCES in \fIzshmisc\fP(1) are also available
.PD 0
.TP
.PD
+\fB\-n\fP
+Suppress printing a newline after the formatted string\&.
+.TP
\fB\-q\fP
Run quietly; suppress printing of all error messages described below\&.
Errors for invalid \fIepochtime\fP values are always printed\&.
@@ -1541,7 +1547,7 @@ value is the content of the file\&. The value is treated identically to any
other text coming from a parameter\&. The value may also be assigned to, in
which case the file in question is written (whether or not it originally
existed); or an element may be unset, which will delete the file in
-question\&. For example, `\fBvared mapfile[myfile]\fP\&' works as expected,
+question\&. For example, `\fBvared \&'mapfile[myfile]'\fP' works as expected,
editing the file `\fBmyfile\fP\&'\&.
.RS
.PP
@@ -1767,7 +1773,7 @@ The script supplied with the module invokes the shell function
even if the \fBzsh/newuser\fP module is disabled\&. Note, however, that
if the module is not installed the function will not be installed either\&.
The function is documented in
-the section User Configuration Functions in \fIzshcontrib\fP(1)\&.
+the section `User Configuration Functions\&' in \fIzshcontrib\fP(1)\&.
.SH "THE ZSH/PARAMETER MODULE"
.\" Yodl file: Zsh/mod_parameter.yo
@@ -1912,6 +1918,8 @@ The keys of the associative arrays are usually valid job numbers,
and these are the values output with, for example, \fB${(k)jobdirs}\fP\&.
Non\-numeric job references may be used when looking up a value;
for example, \fB${jobdirs[%+]}\fP refers to the current job\&.
+.PP
+See the \fBjobs\fP builtin for how job information is provided in a subshell\&.
.RE
.TP
\fBjobtexts\fP
@@ -1921,6 +1929,8 @@ that were used to start the jobs\&.
.PP
Handling of the keys of the associative array is as described for
\fBjobdirs\fP above\&.
+.PP
+See the \fBjobs\fP builtin for how job information is provided in a subshell\&.
.RE
.TP
\fBjobstates\fP
@@ -1938,6 +1948,8 @@ the \fIstate\fP describes the state of that process\&.
.PP
Handling of the keys of the associative array is as described for
\fBjobdirs\fP above\&.
+.PP
+See the \fBjobs\fP builtin for how job information is provided in a subshell\&.
.RE
.TP
\fBnameddirs\fP
@@ -2113,12 +2125,16 @@ This module provides a single autoloaded builtin:
.PD 0
.TP
.PD
-\fBprivate\fP [ {\fB+\fP|\fB\-\fP}\fBAHUahlprtux\fP ] [ {\fB+\fP|\fB\-\fP}\fBEFLRZi\fP [ \fIn\fP ] ] [ \fIname\fP[\fB=\fP\fIvalue\fP] \&.\&.\&. ]
+\fBprivate\fP [ {\fB+\fP|\fB\-\fP}\fBAHUahlmrtux\fP ] [ {\fB+\fP|\fB\-\fP}\fBEFLRZi\fP [ \fIn\fP ] ] [ \fIname\fP[\fB=\fP\fIvalue\fP] \&.\&.\&. ]
The \fBprivate\fP builtin accepts all the same options and arguments as \fBlocal\fP
(\fIzshbuiltins\fP(1)) except
for the `\fB\-\fP\fBT\fP\&' option\&. Tied parameters may not be made private\&.
.RS
.PP
+The `\fB\-\fP\fBp\fP\&' option is presently a no\-op because the state of
+private parameters cannot reliably be reloaded\&. This also applies
+to printing private parameters with `\fBtypeset \-p\fP\&'\&.
+.PP
If used at the top level (outside a function scope), \fBprivate\fP creates a
normal parameter in the same manner as \fBdeclare\fP or \fBtypeset\fP\&. A
warning about this is printed if \fBWARN_CREATE_GLOBAL\fP is set
@@ -2196,7 +2212,8 @@ Within any other function called by the declaring function, the
private parameter does \fINOT\fP hide other parameters of the same name, so
for example a global parameter of the same name is visible and may be
assigned or unset\&. This includes calls to anonymous functions, although
-that may also change in the future\&.
+that may also change in the future\&. However, the private name may not be
+created outside the local scope when it was not previously declared\&.
.TP
\(bu
An exported private remains in the environment of inner scopes but
@@ -2241,6 +2258,18 @@ automatically load this module as needed and will invoke the
.PP
If \fBBASH_REMATCH\fP is set, then the array \fBBASH_REMATCH\fP will be set
instead of \fBMATCH\fP and \fBmatch\fP\&.
+.PP
+Note that the \fBzsh/regex\fP module logic relies on the host system\&. The
+same \fIexpr\fP and \fIregex\fP pair could produce different results on different
+platforms if a \fIregex\fP with non\-standard syntax is given\&.
+.PP
+For example, no syntax for matching a word boundary is defined in the POSIX
+extended regular expression standard\&. GNU \fBlibc\fP and BSD \fBlibc\fP both provide
+such syntaxes as extensions (\fB\eb\fP and \fB[[:<:]]\fP/\fB[[:>:]]\fP respectively),
+but neither of these syntaxes is supported by both of these implementations\&.
+.PP
+Refer to the \fIregcomp\fP(3) and \fIre_format\fP(7) manual pages on your
+system for locally\-supported syntax\&.
.RE
.SH "THE ZSH/SCHED MODULE"
.\" Yodl file: Zsh/mod_sched.yo
@@ -2520,6 +2549,8 @@ Supplies a \fBstrftime\fP (see \fIstrftime\fP(3)) string for the
formatting of the time elements\&. The format string supports all of the
zsh extensions described in
the section EXPANSION OF PROMPT SEQUENCES in \fIzshmisc\fP(1)\&.
+In particular, \fB\-F %s\&.%N\fP can be used to show timestamps with nanosecond
+precision if supported by the system\&.
The \fB\-s\fP option is implied\&.
.TP
\fB\-g\fP
@@ -2647,6 +2678,9 @@ suppress updating of the file atime
\fBnofollow\fP
fail if \fIfile\fP is a symbolic link
.TP
+\fBnonblock\fP
+the file is opened in nonblocking mode
+.TP
\fBsync\fP
request that writes wait until data has been physically written
.TP
@@ -2764,7 +2798,7 @@ the error that occurred\&.
.RE
.TP
.PD 0
-\fBzsystem flock\fP [ \fB\-t\fP \fItimeout\fP ] [ \fB\-f\fP \fIvar\fP ] [\fB\-er\fP] \fIfile\fP
+\fBzsystem flock\fP [ \fB\-t\fP \fItimeout\fP ] [ \fB\-i\fP \fIinterval\fP ] [ \fB\-f\fP \fIvar\fP ] [\fB\-er\fP] \fIfile\fP
.TP
.PD
\fBzsystem flock \-u\fP \fIfd_expr\fP
@@ -2797,9 +2831,16 @@ a safety check that the file descriptor is in use for file locking\&.
.PP
By default the shell waits indefinitely for the lock to succeed\&.
The option \fB\-t\fP \fItimeout\fP specifies a timeout for the lock in
-seconds; currently this must be an integer\&. The shell will attempt
-to lock the file once a second during this period\&. If the attempt
-times out, status 2 is returned\&.
+seconds; fractional seconds are allowed\&. During this period, the
+shell will attempt to lock the file every \fIinterval\fP seconds
+if the \fB\-i\fP \fIinterval\fP option is given, otherwise once a second\&.
+(This \fIinterval\fP is shortened before the last attempt if needed,
+so that the shell waits only until the \fItimeout\fP and not longer\&.)
+If the attempt times out, status 2 is returned\&.
+.PP
+(Note: \fItimeout\fP is limited to 2^30\-1 seconds (about 34 years), and
+\fIinterval\fP to 0\&.999 * LONG_MAX microseconds (only about 35 minutes
+on 32\-bit systems)\&.)
.PP
If the option \fB\-e\fP is given, the file descriptor for the lock is
preserved when the shell uses \fBexec\fP to start a new process;
@@ -2859,9 +2900,9 @@ Returns the process ID of the current process, even in subshells\&. Compare
\fB$$\fP, which returns the process ID of the main shell process\&.
.TP
\fBppid\fP
-Returns the process ID of the parent of the current process, even in
-subshells\&. Compare \fB$PPID\fP, which returns the process ID of the parent
-of the main shell process\&.
+Returns the current process ID of the parent of the current process, even
+in subshells\&. Compare \fB$PPID\fP, which returns the process ID of the
+initial parent of the main shell process\&.
.TP
\fBprocsubstpid\fP
Returns the process ID of the last process started for process
@@ -3110,6 +3151,158 @@ The \fBzsh/terminfo\fP module makes available one parameter:
\fBterminfo\fP
An associative array that maps terminfo capability names to
their values\&.
+.SH "THE ZSH/WATCH MODULE"
+.\" Yodl file: Zsh/mod_watch.yo
+
+The \fBzsh/watch\fP module can be used to report when specific users log in or
+out\&. This is controlled via the following parameters\&.
+.PP
+.PD 0
+.TP
+.PD
+\fBLOGCHECK\fP
+The interval in seconds between checks for login/logout activity
+using the \fBwatch\fP parameter\&.
+.TP
+\fBwatch\fP <S> <Z> (\fBWATCH\fP <S>)
+An array (colon\-separated list) of login/logout events to report\&.
+.RS
+.PP
+If it contains the single word `\fBall\fP\&', then all login/logout events
+are reported\&. If it contains the single word `\fBnotme\fP\&', then all
+events are reported as with `\fBall\fP\&' except \fB$USERNAME\fP\&.
+.PP
+An entry in this list may consist of a username,
+an `\fB@\fP\&' followed by a remote hostname,
+and a `\fB%\fP\&' followed by a line (tty)\&. Any of these may
+be a pattern (be sure to quote this during the assignment to
+\fBwatch\fP so that it does not immediately perform file generation);
+the setting of the \fBEXTENDED_GLOB\fP option is respected\&.
+Any or all of these components may be present in an entry;
+if a login/logout event matches all of them,
+it is reported\&.
+.PP
+For example, with the \fBEXTENDED_GLOB\fP option set, the following:
+.PP
+.RS
+.nf
+\fBwatch=(\&'^(pws|barts)')\fP
+.fi
+.RE
+.PP
+causes reports for activity associated with any user other than \fBpws\fP
+or \fBbarts\fP\&.
+.RE
+.TP
+\fBWATCHFMT\fP
+The format of login/logout reports if the \fBwatch\fP parameter is set\&.
+Default is `\fB%n has %a %l from %m\fP\&'\&.
+Recognizes the following escape sequences:
+.RS
+.PP
+.PD 0
+.TP
+.PD
+\fB%n\fP
+The name of the user that logged in/out\&.
+.TP
+\fB%a\fP
+The observed action, i\&.e\&. "logged on" or "logged off"\&.
+.TP
+\fB%l\fP
+The line (tty) the user is logged in on\&.
+.TP
+\fB%M\fP
+The full hostname of the remote host\&.
+.TP
+\fB%m\fP
+The hostname up to the first `\fB\&.\fP\&'\&. If only the
+IP address is available or the utmp field contains
+the name of an X\-windows display, the whole name is printed\&.
+.RS
+.PP
+\fINOTE:\fP
+The `\fB%m\fP\&' and `\fB%M\fP' escapes will work only if there is a host name
+field in the utmp on your machine\&. Otherwise they are
+treated as ordinary strings\&.
+.RE
+.TP
+\fB%F{\fP\fIcolor\fP\fB}\fP (\fB%f\fP)
+Start (stop) using a different foreground color\&.
+.TP
+\fB%K{\fP\fIcolor\fP\fB}\fP (\fB%k\fP)
+Start (stop) using a different background color\&.
+.TP
+\fB%S\fP (\fB%s\fP)
+Start (stop) standout mode\&.
+.TP
+\fB%U\fP (\fB%u\fP)
+Start (stop) underline mode\&.
+.TP
+\fB%B\fP (\fB%b\fP)
+Start (stop) boldface mode\&.
+.TP
+.PD 0
+\fB%t\fP
+.TP
+.PD
+\fB%@\fP
+The time, in 12\-hour, am/pm format\&.
+.TP
+\fB%T\fP
+The time, in 24\-hour format\&.
+.TP
+\fB%w\fP
+The date in `\fIday\fP\fB\-\fP\fIdd\fP\&' format\&.
+.TP
+\fB%W\fP
+The date in `\fImm\fP\fB/\fP\fIdd\fP\fB/\fP\fIyy\fP\&' format\&.
+.TP
+\fB%D\fP
+The date in `\fIyy\fP\fB\-\fP\fImm\fP\fB\-\fP\fIdd\fP\&' format\&.
+.TP
+\fB%D{\fP\fIstring\fP\fB}\fP
+The date formatted as \fIstring\fP using the \fBstrftime\fP function, with
+zsh extensions as described by
+EXPANSION OF PROMPT SEQUENCES in \fIzshmisc\fP(1)\&.
+.TP
+\fB%(\fP\fIx\fP\fB:\fP\fItrue\-text\fP\fB:\fP\fIfalse\-text\fP\fB)\fP
+Specifies a ternary expression\&.
+The character following the \fIx\fP is
+arbitrary; the same character is used to separate the text
+for the "true" result from that for the "false" result\&.
+Both the separator and the right parenthesis may be escaped
+with a backslash\&.
+Ternary expressions may be nested\&.
+.RS
+.PP
+The test character \fIx\fP may be any one of `\fBl\fP\&', `\fBn\fP', `\fBm\fP'
+or `\fBM\fP\&', which indicate a `true' result if the corresponding
+escape sequence would return a non\-empty value; or it may be `\fBa\fP\&',
+which indicates a `true\&' result if the watched user has logged in,
+or `false\&' if he has logged out\&.
+Other characters evaluate to neither true nor false; the entire
+expression is omitted in this case\&.
+.PP
+If the result is `true\&', then the \fItrue\-text\fP
+is formatted according to the rules above and printed,
+and the \fIfalse\-text\fP is skipped\&.
+If `false\&', the \fItrue\-text\fP is skipped and the \fIfalse\-text\fP
+is formatted and printed\&.
+Either or both of the branches may be empty, but
+both separators must be present in any case\&.
+.RE
+.RE
+.PP
+Furthermore, the \fBzsh/watch\fP module makes available one builtin
+command:
+.PP
+.PD 0
+.TP
+.PD
+\fBlog\fP
+List all users currently logged in who are affected by
+the current setting of the \fBwatch\fP parameter\&.
.SH "THE ZSH/ZFTP MODULE"
.\" Yodl file: Zsh/mod_zftp.yo
@@ -3827,7 +4020,7 @@ The \fBzselect\fP builtin is a front\-end to the `select\&' system call, which
blocks until a file descriptor is ready for reading or writing, or has an
error condition, with an optional timeout\&. If this is not available on
your system, the command prints an error message and returns status 2
-(normal errors return status 1)\&. For more information, see your systems
+(normal errors return status 1)\&. For more information, see your system\&'s
documentation for \fIselect\fP(3)\&. Note there is no connection with the
shell builtin of the same name\&.
.RS
@@ -3931,27 +4124,32 @@ the pattern that was defined first\&.
.PP
\fIExample\fP
.PP
-For example, to define your preferred form of precipitation depending on which
-city you\&'re in, you might set the following in your \fBzshrc\fP:
+For example, a fictional `\fBweather\fP\&' plugin might state in its documentation
+that it looks up the \fBpreferred\-precipitation\fP style under the
+`\fB:weather:\fP\fIcontinent\fP\fB:\fP\fIday\-of\-the\-week\fP\fB:\fP\fIphase\-of\-the\-moon\fP\&' context\&.
+According to this, you might set the following in your \fBzshrc\fP:
.PP
.RS
.nf
\fBzstyle \&':weather:europe:*' preferred\-precipitation rain
-zstyle \&':weather:europe:germany:* preferred\-precipitation none
-zstyle \&':weather:europe:germany:*:munich' preferred\-precipitation snow\fP
+zstyle \&':weather:*:Sunday:*' preferred\-precipitation snow\fP
.fi
.RE
.PP
-Then, the fictional `\fBweather\fP\&' plugin might run under the hood a command
-such as
+Then the plugin would run under the hood a command such as
.PP
.RS
.nf
-\fBzstyle \-s ":weather:${continent}:${country}:${county}:${city}" preferred\-precipitation REPLY\fP
+\fBzstyle \-s ":weather:${continent}:${day_of_week}:${moon_phase}" preferred\-precipitation REPLY\fP
.fi
.RE
.PP
in order to retrieve your preference into the scalar variable \fB$REPLY\fP\&.
+On Sundays \fB$REPLY\fP would be set to `\fBsnow\fP\&'; in Europe it would be set
+to `\fBrain\fP\&'; and on Sundays in Europe it would be set to `\fBsnow\fP' again,
+because the patterns `\fB:weather:europe:*\fP\&' and `\fB:weather:*:Sunday:*\fP' both
+match the \fIcontext\fP argument to \fBzstyle \-s\fP, are equally specific, and the
+latter is more specific (because it has more colon\-separated components)\&.
.PP
\fIUsage\fP
.PP
@@ -4063,9 +4261,12 @@ Match a value\&. Returns status zero if the
.PD 0
\fBzformat \-f\fP \fIparam\fP \fIformat\fP \fIspec\fP \&.\&.\&.
.TP
+.PD 0
+\fBzformat \-F\fP \fIparam\fP \fIformat\fP \fIspec\fP \&.\&.\&.
+.TP
.PD
\fBzformat \-a\fP \fIarray\fP \fIsep\fP \fIspec\fP \&.\&.\&.
-This builtin provides two different forms of formatting\&. The first form
+This builtin provides different forms of formatting\&. The first form
is selected with the \fB\-f\fP option\&. In this case the \fIformat\fP
string will be modified by replacing sequences starting with a percent
sign in it with strings from the \fIspec\fPs\&. Each \fIspec\fP should be
@@ -4114,7 +4315,13 @@ outputs "The answer is \&'yes'\&." to \fBREPLY\fP since the value for the format
specifier \fBc\fP is 3, agreeing with the digit argument to the ternary
expression\&.
.PP
-The second form, using the \fB\-a\fP option, can be used for aligning
+With \fB\-F\fP instead of \fB\-f\fP, ternary expressions choose between the
+`true\&' or `false' text on the basis of whether the format specifier is
+present and non\-empty\&. A test number indicates a minimum width for the
+value given in the format specifier\&. Negative numbers reverse this,
+so the test is for whether the value exceeds a maximum width\&.
+.PP
+The form, using the \fB\-a\fP option, can be used for aligning
strings\&. Here, the \fIspec\fPs are of the form
`\fIleft\fP\fB:\fP\fIright\fP\&' where `\fIleft\fP' and `\fIright\fP' are
arbitrary strings\&. These strings are modified by replacing the colons
diff --git a/Doc/zshoptions.1 b/Doc/zshoptions.1
index fd10e8d29..c85c877ee 100644
--- a/Doc/zshoptions.1
+++ b/Doc/zshoptions.1
@@ -1,4 +1,4 @@
-.TH "ZSHOPTIONS" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHOPTIONS" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshoptions \- zsh options
.\" Yodl file: Zsh/options.yo
@@ -34,6 +34,9 @@ will be treated just as `\fB\-f\fP\&', but the string `\fB\-f i\fP' is an error\
This is because many systems which implement the `\fB#!\fP\&' mechanism for
calling scripts do not strip trailing whitespace\&.
.PP
+It is possible for options to be set within a function scope\&. See the
+description of the option \fBLOCAL_OPTIONS\fP below\&.
+.PP
.SH "DESCRIPTION OF OPTIONS"
In the following list, options set by default in all emulations are marked
<D>; those set by default only in csh, ksh, sh, or zsh emulations are marked
@@ -289,6 +292,19 @@ can match the directory \fBCVS\fP owing to the presence of the globbing flag
Make regular expressions using the \fBzsh/regex\fP module (including
matches with \fB=~\fP) sensitive to case\&.
.TP
+\fBCASE_PATHS\fP
+If \fBCASE_PATHS\fP is not set (the default), \fBCASE_GLOB\fP affects the
+interpretation of \fIevery\fP path component, whenever a special
+character appears in \fIany\fP component\&. When \fBCASE_PATHS\fP is set,
+file path components that do \fInot\fP contain special filename
+generation characters are always sensitive to case, thus restricting
+\fBNO_CASE_GLOB\fP to components that contain globbing characters\&.
+.RS
+.PP
+Note that if the filesystem itself is not sensitive to case, then
+\fBCASE_PATHS\fP has no effect\&.
+.RE
+.TP
\fBCSH_NULL_GLOB\fP <C>
If a pattern for filename generation has no matches,
delete the pattern from the argument list;
@@ -351,7 +367,7 @@ Substitutions using the \fB:s\fP and \fB:&\fP history modifiers are performed
with pattern matching instead of string matching\&. This occurs wherever
history modifiers are valid, including glob qualifiers and parameters\&.
See
-the section Modifiers in \fIzshexpn\fP(1)\&.
+the section `Modifiers\&' in \fIzshexpn\fP(1)\&.
.TP
\fBIGNORE_BRACES\fP (\fB\-I\fP) <S>
Do not perform brace expansion\&. For historical reasons this
@@ -724,7 +740,7 @@ effect extends beyond the scope of the enclosing function; this is the
most portable way to achieve this behaviour\&.
.RE
.TP
-\fBGLOBAL_RCS\fP (\fB\-d\fP) <D>
+\fBGLOBAL_RCS\fP (\fB+d\fP) <D>
If this option is unset, the startup files \fB/etc/zprofile\fP,
\fB/etc/zshrc\fP, \fB/etc/zlogin\fP and \fB/etc/zlogout\fP will not be run\&. It
can be disabled and re\-enabled at any time, including inside local startup
@@ -757,6 +773,18 @@ not set, `\fB>>!\fP\&' or `\fB>>|\fP' must be used to create a file\&.
If either option is set, `\fB>>\fP\&' may be used\&.
.RE
.TP
+\fBCLOBBER_EMPTY\fP
+This option is only used if the option \fBCLOBBER\fP is not set: note that
+it is set by default\&.
+.RS
+.PP
+If this option is set, then regular files of zero length may be
+ovewritten (`clobbered\&')\&. Note that it is possible another process
+has written to the file between this test and use of the file by
+the current process\&. This option should therefore not be used in
+cases where files to be clobbered may be written to asynchronously\&.
+.RE
+.TP
\fBCORRECT\fP (\fB\-0\fP)
Try to correct the spelling of commands\&.
Note that, when the \fBHASH_LIST_ALL\fP option is not set or when some
@@ -881,6 +909,10 @@ avoided by expanding the `\fB*\fP\&' in ZLE (with tab)\&.
Allow the short forms of \fBfor\fP, \fBrepeat\fP, \fBselect\fP,
\fBif\fP, and \fBfunction\fP constructs\&.
.TP
+\fBSHORT_REPEAT\fP
+Allow the short form \fBrepeat\fP as \fBSHORT_LOOPS\fP but without enabling
+it for the other constructs\&.
+.TP
\fBSUN_KEYBOARD_HACK\fP (\fB\-L\fP)
If a line ends with a backquote, and there are an odd number
of backquotes on the line, ignore the trailing backquote\&.
@@ -1247,6 +1279,12 @@ If the option is set, they will only be shown when parameters are selected
with the `\fB\-m\fP\&' option\&. The option `\fB\-p\fP' is available whether or not
the option is set\&.
.TP
+\fBTYPESET_TO_UNSET\fP <K> <S>
+When declaring a new parameter with any of the `\fBtypeset\fP\&' family of
+related commands, the parameter remains unset unless and until a
+value is explicity assigned to it, either in the `\fBtypeset\fP\&' command
+itself or as a later assignment statement\&.
+.TP
\fBVERBOSE\fP (\fB\-v\fP, ksh: \fB\-v\fP)
Print shell input lines as they are read\&.
.TP
@@ -1463,7 +1501,8 @@ command found in the path\&.
.PP
Furthermore, the \fBgetopts\fP builtin behaves in a POSIX\-compatible
fashion in that the associated variable \fBOPTIND\fP is not made
-local to functions\&.
+local to functions, and its value is calculated differently to match
+other shells\&.
.PP
Moreover, the warning and special exit code from
\fB[[ \-o \fP\fInon_existent_option\fP\fB ]]\fP are suppressed\&.
@@ -1529,10 +1568,17 @@ When this option is set, the usual zsh behaviour of executing
traps for \fBEXIT\fP on exit from shell functions is suppressed\&.
In that case, manipulating \fBEXIT\fP traps always alters the global
trap for exiting the shell; the \fBLOCAL_TRAPS\fP option is
-ignored for the \fBEXIT\fP trap\&. Furthermore, a \fBreturn\fP statement
-executed in a trap with no argument passes back from the function the
-value from the surrounding context, not from code executed within the
-trap\&.
+ignored for the \fBEXIT\fP trap\&.
+.RS
+.PP
+Also, a \fBreturn\fP statement executed in a trap with no argument passes
+back from the function the value from the surrounding context, not from
+code executed within the trap\&.
+.PP
+Furthermore, if a trap is set to be ignored, this state persists when
+a subshell is entered\&. Without the option, the trap would be reset to
+its default state at this point\&.
+.RE
.TP
\fBSH_FILE_EXPANSION\fP <K> <S>
Perform filename expansion (e\&.g\&., \fB~\fP expansion) \fIbefore\fP
diff --git a/Doc/zshparam.1 b/Doc/zshparam.1
index 3ace5d3ab..8860fb8ac 100644
--- a/Doc/zshparam.1
+++ b/Doc/zshparam.1
@@ -1,4 +1,4 @@
-.TH "ZSHPARAM" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHPARAM" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshparam \- zsh parameters
.\" Yodl file: Zsh/params.yo
@@ -97,7 +97,7 @@ may be in any order\&. Note that this syntax is strict: \fB[\fP and \fB]=\fP mu
not be quoted, and \fIkey\fP may not consist of the unquoted string
\fB]=\fP, but is otherwise treated as a simple string\&. The enhanced forms
of subscript expression that may be used when directly subscripting a
-variable name, described in the section Array Subscripts below, are not
+variable name, described in the section `Array Subscripts\&' below, are not
available\&.
.PP
The syntaxes with and without the explicit key may be mixed\&. An implicit
@@ -459,12 +459,25 @@ is compared to the pattern, and the first matching key found is the
result\&. On failure substitutes the length of the array plus one, as
discussed under the description of `\fBr\fP\&', or the empty string for an
associative array\&.
+.RS
+.PP
+Note: Although `\fBi\fP\&' may be applied to a scalar substitution to find
+the offset of a substring, the results are likely to be misleading when
+searching within substitutions that yield an empty string, or when
+searching for the empty substring\&.
+.RE
.TP
\fBI\fP
Like `\fBi\fP\&', but gives the index of the last match, or all possible
matching keys in an associative array\&. On failure substitutes 0, or
the empty string for an associative array\&. This flag is best when
testing for values or keys that do not exist\&.
+.RS
+.PP
+Note: If the option \fBKSH_ARRAYS\fP is in effect and no match is found, the
+result is indistinguishable from the case when the first element of the array
+matches\&.
+.RE
.TP
\fBk\fP
If used in a subscript on an associative array, this flag causes the keys
@@ -690,6 +703,14 @@ In the parameter lists that follow, the mark `<S>\&' indicates that the
parameter is special\&. `<Z>\&' indicates that the parameter does not exist
when the shell initializes in \fBsh\fP or \fBksh\fP emulation mode\&.
.PP
+The parameters `\fB!\fP\&', `\fB#\fP', `\fB*\fP', `\fB\-\fP', `\fB?\fP', `\fB@\fP',
+`\fB$\fP\&', `\fBARGC\fP', `\fBHISTCMD\fP', `\fBLINENO\fP', `\fBPPID\fP',
+`\fBstatus\fP\&', `\fBTTYIDLE\fP', `\fBzsh_eval_context\fP',
+`\fBZSH_EVAL_CONTEXT\fP\&', and `\fBZSH_SUBSHELL\fP' are read\-only and thus
+cannot be restored by the user, so they are not output by
+`\fBtypeset \-p\fP\&'\&. This also applies to many read\-only parameters loaded
+from modules\&.
+.PP
The following parameters are automatically set by the shell:
.PP
.PD 0
@@ -710,10 +731,11 @@ the length of the parameter \fB\-\fP, q\&.v\&.
Same as \fB#\fP\&.
.TP
\fB$\fP <S>
-The process ID of this shell\&. Note that this indicates the original
-shell started by invoking \fBzsh\fP; all processes forked from the shells
-without executing a new program, such as subshells started by
-\fB(\fP\fI\&.\&.\&.\fP\fB)\fP, substitute the same value\&.
+The process ID of this shell, set when the shell initializes\&. Processes
+forked from the shell without executing a new program, such as command
+substitutions and commands grouped with \fB(\fP\fI\&.\&.\&.\fP\fB)\fP,
+are subshells that duplicate the current shell, and thus substitute the
+same value for \fB$$\fP as their parent shell\&.
.TP
\fB\-\fP <S>
Flags supplied to the shell on invocation or by the \fBset\fP
@@ -783,7 +805,7 @@ explicitly set locally\&.
.RE
.TP
\fBERRNO\fP <S>
-The value of errno (see \fIerrno\fP(3))
+The value of \fBerrno\fP (see \fIerrno\fP(3))
as set by the most recently failed system call\&.
This value is system dependent and is intended for debugging
purposes\&. It is also useful with the \fBzsh/system\fP module which
@@ -854,9 +876,9 @@ command\&.
The operating system, as determined at compile time\&.
.TP
\fBPPID\fP <S>
-The process ID of the parent of the shell\&. As for \fB$$\fP, the
-value indicates the parent of the original shell and does not
-change in subshells\&.
+The process ID of the parent of the shell, set when the shell initializes\&.
+As with \fB$$\fP, the value does not change in subshells created as a
+duplicate of the current shell\&.
.TP
\fBPWD\fP
The present working directory\&. This is set when the shell initializes
@@ -882,8 +904,9 @@ since the assignment\&.
.RS
.PP
Unlike other special parameters, the type of the \fBSECONDS\fP parameter can
-be changed using the \fBtypeset\fP command\&. Only integer and one of the
-floating point types are allowed\&. For example, `\fBtypeset \-F SECONDS\fP\&'
+be changed using the \fBtypeset\fP command\&. The type may be changed only
+to one of the floating point types or back to integer\&. For example,
+`\fBtypeset \-F SECONDS\fP\&'
causes the value to be reported as a floating point number\&. The
value is available to microsecond accuracy, although the shell may
show more or fewer digits depending on the use of \fBtypeset\fP\&. See
@@ -1325,10 +1348,6 @@ most as many lines as given by the absolute value\&.
If set to zero, the shell asks only if the top of the listing would scroll
off the screen\&.
.TP
-\fBLOGCHECK\fP
-The interval in seconds between checks for login/logout activity
-using the \fBwatch\fP parameter\&.
-.TP
\fBMAIL\fP
If this parameter is set and \fBmailpath\fP is not set,
the shell looks for mail in the specified file\&.
@@ -1562,6 +1581,13 @@ if it is in the environment of the shell but not explicitly assigned to in
the input line\&. This avoids running stty at every external command by
accidentally exporting it\&. Also note that \fBSTTY\fP should not be used for
window size specifications; these will not be local to the command\&.
+.RS
+.PP
+If the parameter is set and empty, all of the above applies except
+that \fBstty\fP is not run\&. This can be useful as a way to freeze the tty
+around a single command, blocking its changes to tty settings,
+similar to the \fBttyctl\fP builtin\&.
+.RE
.TP
\fBTERM\fP <S>
The type of terminal in use\&. This is used when looking up termcap
@@ -1692,130 +1718,6 @@ to be interpreted as a file extension\&. The default is not to append
any suffix, thus this parameter should be assigned only when needed
and then unset again\&.
.TP
-\fBwatch\fP <S> <Z> (\fBWATCH\fP <S>)
-An array (colon\-separated list) of login/logout events to report\&.
-.RS
-.PP
-If it contains the single word `\fBall\fP\&', then all login/logout events
-are reported\&. If it contains the single word `\fBnotme\fP\&', then all
-events are reported as with `\fBall\fP\&' except \fB$USERNAME\fP\&.
-.PP
-An entry in this list may consist of a username,
-an `\fB@\fP\&' followed by a remote hostname,
-and a `\fB%\fP\&' followed by a line (tty)\&. Any of these may
-be a pattern (be sure to quote this during the assignment to
-\fBwatch\fP so that it does not immediately perform file generation);
-the setting of the \fBEXTENDED_GLOB\fP option is respected\&.
-Any or all of these components may be present in an entry;
-if a login/logout event matches all of them,
-it is reported\&.
-.PP
-For example, with the \fBEXTENDED_GLOB\fP option set, the following:
-.PP
-.RS
-.nf
-\fBwatch=(\&'^(pws|barts)')\fP
-.fi
-.RE
-.PP
-causes reports for activity associated with any user other than \fBpws\fP
-or \fBbarts\fP\&.
-.RE
-.TP
-\fBWATCHFMT\fP
-The format of login/logout reports if the \fBwatch\fP parameter is set\&.
-Default is `\fB%n has %a %l from %m\fP\&'\&.
-Recognizes the following escape sequences:
-.RS
-.PP
-.PD 0
-.TP
-.PD
-\fB%n\fP
-The name of the user that logged in/out\&.
-.TP
-\fB%a\fP
-The observed action, i\&.e\&. "logged on" or "logged off"\&.
-.TP
-\fB%l\fP
-The line (tty) the user is logged in on\&.
-.TP
-\fB%M\fP
-The full hostname of the remote host\&.
-.TP
-\fB%m\fP
-The hostname up to the first `\fB\&.\fP\&'\&. If only the
-IP address is available or the utmp field contains
-the name of an X\-windows display, the whole name is printed\&.
-.RS
-.PP
-\fINOTE:\fP
-The `\fB%m\fP\&' and `\fB%M\fP' escapes will work only if there is a host name
-field in the utmp on your machine\&. Otherwise they are
-treated as ordinary strings\&.
-.RE
-.TP
-\fB%S\fP (\fB%s\fP)
-Start (stop) standout mode\&.
-.TP
-\fB%U\fP (\fB%u\fP)
-Start (stop) underline mode\&.
-.TP
-\fB%B\fP (\fB%b\fP)
-Start (stop) boldface mode\&.
-.TP
-.PD 0
-\fB%t\fP
-.TP
-.PD
-\fB%@\fP
-The time, in 12\-hour, am/pm format\&.
-.TP
-\fB%T\fP
-The time, in 24\-hour format\&.
-.TP
-\fB%w\fP
-The date in `\fIday\fP\fB\-\fP\fIdd\fP\&' format\&.
-.TP
-\fB%W\fP
-The date in `\fImm\fP\fB/\fP\fIdd\fP\fB/\fP\fIyy\fP\&' format\&.
-.TP
-\fB%D\fP
-The date in `\fIyy\fP\fB\-\fP\fImm\fP\fB\-\fP\fIdd\fP\&' format\&.
-.TP
-\fB%D{\fP\fIstring\fP\fB}\fP
-The date formatted as \fIstring\fP using the \fBstrftime\fP function, with
-zsh extensions as described by
-EXPANSION OF PROMPT SEQUENCES in \fIzshmisc\fP(1)\&.
-.TP
-\fB%(\fP\fIx\fP\fB:\fP\fItrue\-text\fP\fB:\fP\fIfalse\-text\fP\fB)\fP
-Specifies a ternary expression\&.
-The character following the \fIx\fP is
-arbitrary; the same character is used to separate the text
-for the "true" result from that for the "false" result\&.
-Both the separator and the right parenthesis may be escaped
-with a backslash\&.
-Ternary expressions may be nested\&.
-.RS
-.PP
-The test character \fIx\fP may be any one of `\fBl\fP\&', `\fBn\fP', `\fBm\fP'
-or `\fBM\fP\&', which indicate a `true' result if the corresponding
-escape sequence would return a non\-empty value; or it may be `\fBa\fP\&',
-which indicates a `true\&' result if the watched user has logged in,
-or `false\&' if he has logged out\&.
-Other characters evaluate to neither true nor false; the entire
-expression is omitted in this case\&.
-.PP
-If the result is `true\&', then the \fItrue\-text\fP
-is formatted according to the rules above and printed,
-and the \fIfalse\-text\fP is skipped\&.
-If `false\&', the \fItrue\-text\fP is skipped and the \fIfalse\-text\fP
-is formatted and printed\&.
-Either or both of the branches may be empty, but
-both separators must be present in any case\&.
-.RE
-.RE
-.TP
\fBWORDCHARS\fP <S>
A list of non\-alphanumeric characters considered part of a word
by the line editor\&.
diff --git a/Doc/zshroadmap.1 b/Doc/zshroadmap.1
index b7b220d06..254c03bdd 100644
--- a/Doc/zshroadmap.1
+++ b/Doc/zshroadmap.1
@@ -1,4 +1,4 @@
-.TH "ZSHROADMAP" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHROADMAP" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshroadmap \- informal introduction to the zsh manual
.\" Yodl file: Zsh/roadmap.yo
@@ -19,7 +19,7 @@ appear if your administrator has disabled the \fBzsh/newuser\fP module\&.
The function is designed to be self\-explanatory\&. You can run it by hand
with `\fBautoload \-Uz zsh\-newuser\-install; zsh\-newuser\-install \-f\fP\&'\&.
See also
-the section User Configuration Functions in \fIzshcontrib\fP(1)\&.
+the section `User Configuration Functions\&' in \fIzshcontrib\fP(1)\&.
.PP
.SH "INTERACTIVE USE"
.PP
@@ -45,7 +45,7 @@ The shell now supports the UTF\-8 character set (and also others if
supported by the operating system)\&. This is (mostly) handled transparently
by the shell, but the degree of support in terminal emulators is variable\&.
There is some discussion of this in the shell FAQ,
-\fBhttp://www\&.zsh\&.org/FAQ/\fP\&. Note in particular that for combining
+\fBhttps://www\&.zsh\&.org/FAQ/\fP\&. Note in particular that for combining
characters to be handled the option \fBCOMBINING_CHARS\fP needs to be set\&.
Because the shell is now more sensitive to the definition of the
character set, note that if you are upgrading from an older version of
diff --git a/Doc/zshtcpsys.1 b/Doc/zshtcpsys.1
index 62884fad0..21ef50ee9 100644
--- a/Doc/zshtcpsys.1
+++ b/Doc/zshtcpsys.1
@@ -1,4 +1,4 @@
-.TH "ZSHTCPSYS" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHTCPSYS" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshtcpsys \- zsh tcp system
.\" Yodl file: Zsh/tcpsys.yo
diff --git a/Doc/zshzftpsys.1 b/Doc/zshzftpsys.1
index 7cb73b798..627d66564 100644
--- a/Doc/zshzftpsys.1
+++ b/Doc/zshzftpsys.1
@@ -1,4 +1,4 @@
-.TH "ZSHZFTPSYS" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHZFTPSYS" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshzftpsys \- zftp function front\-end
.\" Yodl file: Zsh/zftpsys.yo
@@ -515,13 +515,11 @@ command `\fBzstyle \&':zftp:*'\fP \fIstyle\fP \fIvalue\fP \&.\&.\&.'\&.
defines the \fIstyle\fP to have value \fIvalue\fP; more than one value may be
given, although that is not useful in the cases described here\&. These
values will then be used throughout the zftp function system\&. For more
-precise control, the first argument, which gives a context in which the
+precise control, the first argument, which gives a pattern that matches \fIcontexts\fP in which the
style applies, can be modified to include a particular function, as for
example `\fB:zftp:zfget\fP\&': the style will then have the given value only
-in the \fBzfget\fP function\&. Values for the same style in different contexts
-may be set; the most specific function will be used, where
-strings are held to be more specific than patterns, and longer patterns and
-shorter patterns\&. Note that only the top level function name, as called by
+in the \fBzfget\fP function, and will override styles set under `\fB:zftp:*\fP\&'\&.
+Note that only the top level function name, as called by
the user, is used; calling of lower level functions is transparent to the
user\&. Hence modifications to the title bar in \fBzftp_chpwd\fP use the
contexts \fB:zftp:zfopen\fP, \fB:zftp:zfcd\fP, etc\&., depending where it was
diff --git a/Doc/zshzle.1 b/Doc/zshzle.1
index bc685e553..c67d3fd34 100644
--- a/Doc/zshzle.1
+++ b/Doc/zshzle.1
@@ -1,4 +1,4 @@
-.TH "ZSHZLE" "1" "February 12, 2022" "zsh 5\&.8\&.1"
+.TH "ZSHZLE" "1" "April 9, 2022" "zsh 5\&.8\&.1\&.2-test"
.SH "NAME"
zshzle \- zsh command line editor
.\" Yodl file: Zsh/zle.yo
@@ -101,6 +101,7 @@ In the `\fB\&.safe\fP\&' keymap, each single key is bound to \fBself\-insert\fP,
except for ^J (line feed) and ^M (return) which are bound to \fBaccept\-line\fP\&.
This is deliberately not pleasant to use; if you are using it, it
means you deleted the main keymap, and you should put it back\&.
+.PP
.SS "Reading Commands"
When ZLE is reading a command from the terminal, it may read a sequence
that is bound to some command and is also a prefix of a longer bound string\&.
@@ -129,6 +130,7 @@ without a real command being read\&.
A key sequence typed by the user can be turned into a command name for use
in user\-defined widgets with the \fBread\-command\fP widget, described in
the subsection `Miscellaneous\&' of the section `Standard Widgets' below\&.
+.PP
.SS "Local Keymaps"
While for normal editing a single keymap is used exclusively, in many
modes a local keymap allows for some keys to be customised\&. For example,
@@ -490,7 +492,7 @@ refer to a terminal an error is reported\&.
\fBzle\fP \fB\-T\fP [ \fBtc\fP \fIfunction\fP | \fB\-r\fP \fBtc\fP | \fB\-L\fP ]
.TP
.PD
-\fBzle\fP \fIwidget\fP [ \fB\-n\fP \fInum\fP ] [ \fB\-Nw\fP ] [ \fB\-K\fP \fIkeymap\fP ] \fIargs\fP \&.\&.\&.
+\fBzle\fP \fIwidget\fP [ \fB\-n\fP \fInum\fP ] [ \fB\-f\fP \fIflag\fP ] [ \fB\-Nw\fP ] [ \fB\-K\fP \fIkeymap\fP ] \fIargs\fP \&.\&.\&.
The \fBzle\fP builtin performs a number of different actions concerning
ZLE\&.
.RS
@@ -578,8 +580,7 @@ For further information, see
\fIzshcompwid\fP(1)\&.
.TP
\fB\-R\fP [ \fB\-c\fP ] [ \fIdisplay\-string\fP ] [ \fIstring\fP \&.\&.\&. ]
-Redisplay the command line; this is to be called from within a user\-defined
-widget to allow changes to become visible\&. If a \fIdisplay\-string\fP is
+Redisplay the command line\&. If a \fIdisplay\-string\fP is
given and not empty, this is shown in the status line (immediately
below the line being edited)\&.
.RS
@@ -589,9 +590,9 @@ prompt in the same way as completion lists are printed\&. If no
\fIstring\fPs are given but the \fB\-c\fP option is used such a list is
cleared\&.
.PP
-Note that this option is only useful for widgets that do not exit
-immediately after using it because the strings displayed will be erased
-immediately after return from the widget\&.
+Note that immediately after returning from running widgets, the command line
+will be redisplayed and the strings displayed will be erased\&. Therefore, this
+option is only useful for widgets that do not exit immediately after using it\&.
.PP
This command can safely be called outside user defined widgets; if zle is
active, the display will be refreshed, while if zle is not active, the
@@ -779,7 +780,7 @@ transformation is not applied to other non\-printing characters such as
carriage returns and newlines\&.
.RE
.TP
-\fIwidget\fP [ \fB\-n\fP \fInum\fP ] [ \fB\-Nw\fP ] [ \fB\-K\fP \fIkeymap\fP ] \fIargs\fP \&.\&.\&.
+\fIwidget\fP [ \fB\-n\fP \fInum\fP ] [ \fB\-f\fP \fIflag\fP ] [ \fB\-Nw\fP ] [ \fB\-K\fP \fIkeymap\fP ] \fIargs\fP \&.\&.\&.
Invoke the specified \fIwidget\fP\&. This can only be done when ZLE is
active; normally this will be within a user\-defined widget\&.
.RS
@@ -799,6 +800,9 @@ appears as if the top\-level widget called by the user were still
active\&. With the option \fB\-w\fP, \fBWIDGET\fP and related parameters are set
to reflect the widget being executed by the \fBzle\fP call\&.
.PP
+Normally, when \fIwidget\fP returns the special parameter \fBLASTWIDGET\fP will
+point to it\&. This can be inhibited by passing the option \fB\-f nolast\fP\&.
+.PP
Any further arguments will be passed to the widget; note that as
standard argument handling is performed, any general argument list
should be preceded by \fB\-\fP\fB\-\fP\&. If it is a shell
@@ -821,13 +825,14 @@ it should call the \fBbeep\fP widget directly\&.
.RE
.RE
.PP
-.SH "WIDGETS"
+.SH "ZLE WIDGETS"
All actions in the editor are performed by `widgets\&'\&. A widget's job is
simply to perform some small action\&. The ZLE commands that key sequences
in keymaps are bound to are in fact widgets\&. Widgets can be user\-defined
or built in\&.
.PP
-The standard widgets built into ZLE are listed in Standard Widgets below\&.
+The standard widgets built into ZLE are listed in
+the section `Standard Widgets\&' below\&.
Other built\-in widgets can be defined by other modules (see
\fIzshmodules\fP(1))\&. Each built\-in widget has two names: its normal canonical name, and the
same name preceded by a `\fB\&.\fP\&'\&. The `\fB\&.\fP' name is special: it can't be
@@ -839,6 +844,7 @@ as shell functions\&. When the widget is executed, the corresponding
shell function is executed, and can perform editing (or other) actions\&.
It is recommended that user\-defined widgets should not have names
starting with `\fB\&.\fP\&'\&.
+.PP
.SH "USER\-DEFINED WIDGETS"
User\-defined widgets, being implemented as shell functions,
can execute any normal shell command\&. They can also run other widgets
@@ -1053,7 +1059,7 @@ and \fBPOSTDISPLAY\fP are possible, but note that the \fBP\fP flag
is needed for character indexing to include \fBPREDISPLAY\fP\&.
.RS
.PP
-Each string consists of the following parts:
+Each string consists of the following whitespace\-separated parts:
.PP
.PD 0
.TP
@@ -1062,27 +1068,42 @@ Each string consists of the following parts:
Optionally, a `\fBP\fP\&' to signify that the start and end offset that
follow include any string set by the \fBPREDISPLAY\fP special parameter;
this is needed if the predisplay string itself is to be highlighted\&.
-Whitespace may follow the `\fBP\fP\&'\&.
+Whitespace between the `\fBP\fP\&' and the start offset is optional\&.
.TP
\(bu
-A start offset in the same units as \fBCURSOR\fP, terminated by
-whitespace\&.
+A start offset in the same units as \fBCURSOR\fP\&.
.TP
\(bu
-An end offset in the same units as \fBCURSOR\fP, terminated by
-whitespace\&.
+An end offset in the same units as \fBCURSOR\fP\&.
.TP
\(bu
A highlight specification in the same format as
used for contexts in the parameter \fBzle_highlight\fP, see
the section `Character Highlighting\&' below;
-for example, \fBstandout\fP or \fBfg=red,bold\fP
+for example, \fBstandout\fP or \fBfg=red,bold\fP\&.
+.TP
+\(bu
+Optionally, a string of the form `\fBmemo=\fP\fItoken\fP\&'\&.
+The \fItoken\fP consists of everything between the `\fB=\fP\&' and the next
+whitespace, comma, NUL, or the end of the string\&.
+The \fItoken\fP is preserved verbatim but not parsed in any way\&.
+.RS
+.PP
+Plugins may use this to identify array elements they have added: for example,
+a plugin might set \fItoken\fP to its (the plugin\&'s) name and then use
+`\fBregion_highlight=( ${region_highlight:#*memo=\fP\fItoken\fP\fB} )\fP\&'
+in order to remove array elements it have added\&.
+.PP
+(This example uses the `\fB${\fP\fIname\fP\fB:#\fP\fIpattern\fP\fB}\fP\&' array\-grepping
+syntax described in
+the section `Parameter Expansion\&' in \fIzshexpn\fP(1)\&.)
+.RE
.PP
For example,
.PP
.RS
.nf
-\fBregion_highlight=("P0 20 bold")\fP
+\fBregion_highlight=("P0 20 bold memo=foobar")\fP
.fi
.RE
.PP
@@ -1092,6 +1113,11 @@ any predisplay string should be highlighted in bold\&.
Note that the effect of \fBregion_highlight\fP is not saved and disappears
as soon as the line is accepted\&.
.PP
+Note that zsh 5\&.8 and older do not support the `\fBmemo=\fP\fItoken\fP\&' field
+and may misparse the third (highlight specification) field when a memo
+is given\&.
+
+.PP
The final highlighting on the command line depends on both \fBregion_highlight\fP
and \fBzle_highlight\fP; see
the section CHARACTER HIGHLIGHTING below for details\&.
@@ -2222,7 +2248,7 @@ a desired suffix\-preservation behavior\&.
\fBbeep\fP
Beep, unless the \fBBEEP\fP option is unset\&.
.TP
-\fBbracketed\-paste\fP
+\fBbracketed\-paste\fP (\fB^[[200~\fP) (\fB^[[200~\fP) (\fB^[[200~\fP)
This widget is invoked when text is pasted to the terminal emulator\&. It
is not intended to be bound to actual keys but instead to the special
sequence generated by the terminal emulator when text is pasted\&.
diff --git a/Doc/ztexi.yo b/Doc/ztexi.yo
index 7d52e6e91..c105c3e71 100644
--- a/Doc/ztexi.yo
+++ b/Doc/ztexi.yo
@@ -110,6 +110,7 @@ def(texiauthor)(1)(\
NOTRANS(@author )ARG1\
)
+COMMENT(Arguments are node identifiers: this, next, previous, up)
def(texinode)(4)(\
NOTRANS(@node )ARG1, ARG2, ARG3, ARG4\
)
@@ -150,7 +151,7 @@ def(comment)(1)(\
COMMENT(--- cross-references ---)
-def(manref)(2)(man page ARG1+LPAR()ARG2+RPAR())
+def(manref)(2)(ARG1+LPAR()ARG2+RPAR())
def(zmanref)(1)(manref(ARG1)(1))
def(noderef)(1)(\
NOTRANS(@ref{)ARG1+NOTRANS(})\
diff --git a/Etc/.gitignore b/Etc/.gitignore
new file mode 100644
index 000000000..595541f37
--- /dev/null
+++ b/Etc/.gitignore
@@ -0,0 +1 @@
+FAQ*.html
diff --git a/Etc/BUGS b/Etc/BUGS
index 99a0d9753..5624fb24d 100644
--- a/Etc/BUGS
+++ b/Etc/BUGS
@@ -12,6 +12,8 @@ the nonomatch and nullglob options.
------------------------------------------------------------------------
It is currently impossible to time builtins.
------------------------------------------------------------------------
+38754: unwanted scrolling of the terminal
+------------------------------------------------------------------------
40106: The comp* completion-related builtins (compadd, compset, etc) are
run with $_comp_options in effect, rather than the user's options.
------------------------------------------------------------------------
@@ -26,8 +28,38 @@ skipped when STTY=... is set for that command
41203 and others: Make it easier to maintain C modules out of tree.
(May require defining a stable API for modules, see 41254)
------------------------------------------------------------------------
+42609: :|: =(hang)
+------------------------------------------------------------------------
44007 - Martijn - exit in trap executes rest of function
See test case in Test/C03traps.ztst.
------------------------------------------------------------------------
-45282: ${${:-foo}:P} where foo is a symlink that points to itself segfaults
+44133 debian #924736 (partial patch in 44134) three setopts following ` #`
+------------------------------------------------------------------------
+44850 terminal issues with continuation markers
+------------------------------------------------------------------------
+users/24765 -direct terminals. Not a bug as such but we may need to do
+ something if -direct values in TERM are ever common
+------------------------------------------------------------------------
+44850: zle -M doesn't work properly if the command line fills the screen
+------------------------------------------------------------------------
+44525, 45778 [PATCH] prompt redrawn on the wrong line upon SIGWINCH
+------------------------------------------------------------------------
+45400: vared does not work in subshells, even when the parent shell is
+interactive and the subshell is the foreground job. The USEZLE option is
+always turned off in subshells, for reasons lost to history. There is a
+related, probably obsolete, vared special case for $TERM set to "emacs".
+------------------------------------------------------------------------
+users/26150: MULTIOS does not work with "exec":
+
+exec 3>/tmp/test1 3>/tmp/test2
+
+causes a script to hang.
+------------------------------------------------------------------------
+47561: [PATCH v4] vcs_info: choose backend by basedir
+------------------------------------------------------------------------
+39319: () { exit } =(:) doesn't clean up the tempfile
+------------------------------------------------------------------------
+48091: Bug in compdescribe with matcher 'b:-=+'
+------------------------------------------------------------------------
+users/26071: Strange behavior about option completion of `git push
------------------------------------------------------------------------
diff --git a/Etc/CONTRIBUTORS b/Etc/CONTRIBUTORS
index 6a0ea33ce..0c8190a93 100644
--- a/Etc/CONTRIBUTORS
+++ b/Etc/CONTRIBUTORS
@@ -2,10 +2,10 @@
ZSH CONTRIBUTORS
----------------
-Zsh was originally written by Paul Falstad <pf@zsh.org>. Zsh is
-now maintained by the members of the zsh-workers mailing list
-<zsh-workers@zsh.org>. The development is currently coordinated
-by Peter Stephenson <pws@zsh.org>.
+Zsh was originally written by Paul Falstad. Zsh is now maintained
+by the members of the zsh-workers mailing list <zsh-workers@zsh.org>.
+The development is currently coordinated by Peter Stephenson
+<pws@zsh.org>.
This file credits only the major contributors to the current release.
See the ChangeLog files for a complete list of people who have submitted
diff --git a/Etc/FAQ b/Etc/FAQ
index a8461de4b..5382bd1ee 100644
--- a/Etc/FAQ
+++ b/Etc/FAQ
@@ -1,15 +1,15 @@
Archive-Name: unix-faq/shell/zsh
-Last-Modified: 2015/05/31
+Last-Modified: 2020/08/08
Submitted-By: coordinator@zsh.org (Peter Stephenson) <coordinator@zsh.org (Peter Stephenson)>
Posting-Frequency: Monthly
-Copyright: (C) P.W. Stephenson, 1995--2016 (see end of document)
+Copyright: (C) P.W. Stephenson, 1995--2020 (see end of document)
This document contains a list of frequently-asked (or otherwise
significant) questions concerning the Z-shell, a command interpreter
for many UNIX systems which is freely available to anyone with FTP
access. Zsh is among the most powerful freely available Bourne-like
-shell for interactive use.
+shells for interactive use.
If you have never heard of `sh', `csh' or `ksh', then you are
probably better off to start by reading a general introduction to UNIX
@@ -17,7 +17,7 @@ rather than this document.
If you just want to know how to get your hands on the latest version,
skip to question 1.6; if you want to know what to do with
-insoluble problems, go to 5.2.
+insoluble problems, go to 6.2.
Notation: Quotes `like this' are ordinary textual quotation
marks. Other uses of quotation marks are input to the shell.
@@ -41,6 +41,7 @@ Chapter 2: How does zsh differ from...?
2.5. bash?
2.6. Shouldn't zsh be more/less like ksh/(t)csh?
2.7. What is zsh's support for Unicode/UTF-8?
+2.8. Why does my bash script report an error when I run it under zsh?
Chapter 3: How to get various things to work
3.1. Why does `$var' where `var="foo bar"' not do what I expect?
@@ -94,6 +95,7 @@ Chapter 6: The future of zsh
6.2. Where do I report bugs, get more info / who's working on zsh?
6.3. What's on the wish-list?
6.4. Did zsh have problems in the year 2000?
+6.5. When reporting a bug, how do I reduce my `.zshrc' into a minimal reproduction recipe?
Acknowledgments
@@ -110,17 +112,17 @@ Chapter 1: Introducing zsh and how to install it
Information on zsh is available via the World Wide Web. The URL
- is http://zsh.sourceforge.net/ .
+ is https://zsh.sourceforge.io/ .
The server provides this FAQ and much else and is
now maintained by the zsh workers (email zsh-workers@zsh.org <zsh-workers@zsh.org>).
- The FAQ is at http://zsh.sourceforge.net/FAQ/ .
+ The FAQ is at https://zsh.sourceforge.io/FAQ/ .
The site also contains some contributed zsh scripts and functions;
we are delighted to add more, or simply links to your own collection.
This document was originally written in YODL, allowing it to be converted
easily into various other formats. The master source file lives at
- http://zsh.sourceforge.net/FAQ/zshfaq.yo and the plain text version
- can be found at http://zsh.sourceforge.net/FAQ/zshfaq.txt .
+ https://zsh.sourceforge.io/FAQ/zshfaq.yo and the plain text version
+ can be found at https://zsh.sourceforge.io/FAQ/zshfaq.txt .
Another useful source of information is the collection of FAQ articles
posted frequently to the Usenet news groups comp.unix.questions,
@@ -145,14 +147,14 @@ The latest version of this FAQ is also available directly from any
I have put together a user guide to complement the manual by
explaining the most useful features of zsh in a more easy to read way.
This can be found at the zsh web site:
- http://zsh.sourceforge.net/Guide/
+ https://zsh.sourceforge.io/Guide/
(As a method of reading the following in Emacs, you can type \M-2
\C-x $ to make all the indented text vanish, then \M-0 \C-x $
when you are on the title you want.)
For any more eclectic information, you should contact the mailing
- list: see question 5.2.
+ list: see question 6.2.
1.2: What is it?
@@ -168,7 +170,7 @@ Zsh is a UNIX command interpreter (shell) which of the standard
It was written by Paul Falstad when a student at Princeton; however,
Paul doesn't maintain it any more and enquiries should be sent to
- the mailing list (see question 5.2). Zsh is distributed under a
+ the mailing list (see question 6.2). Zsh is distributed under a
standard Berkeley style copyright.
For more information, the files Doc/intro.txt or Doc/intro.troff
@@ -235,8 +237,8 @@ There used to be separate ports for Windows and OS/2, but these
If you need to change something to support a new machine, it would be
appreciated if you could add any necessary preprocessor code and
alter configure.in and acconfig.h to configure zsh automatically,
- then send the required context diffs to the list (see question
- 5.2). Please make sure you have the latest version first.
+ then send the required unified diffs to the list (see question
+ 6.2). Please make sure you have the latest version first.
To get it to work, retrieve the source distribution (see question
1.6), un-gzip it, un-tar it and read the INSTALL file in the top
@@ -252,7 +254,7 @@ To get it to work, retrieve the source distribution (see question
1.5: What's the latest version?
-Zsh 5.8.1 is the latest production version. For details of all the
+Zsh 5.9 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
@@ -265,11 +267,11 @@ A beta of the next version is sometimes available. Development of zsh is
development subdirectory.
Note also that as the shell changes, it may become incompatible with
- older versions; see the end of question 5.1 for a partial list.
+ older versions; see the end of question 6.1 for a partial list.
Changes of this kind are almost always forced by an awkward or
unnecessary feature in the original design (as perceived by current
users), or to enhance compatibility with other Bourne shell
- derivatives, or (mostly in the 3.0 series) to provide POSIX compliancy.
+ derivatives, or (mostly in the 3.0 series) to provide POSIX compliance.
1.6: Where do I get it?
@@ -279,7 +281,7 @@ Note also that as the shell changes, it may become incompatible with
The coordinator of development is currently me; the alias
coordinator@zsh.org <coordinator@zsh.org> can be used to contact whoever is in the hot
seat. https://www.zsh.org/ is the official
- archive site, currently in Australia. Test versions are kept in the
+ archive site. Test versions are kept in the
`testing' subdirectory: such up-to-the-minute development versions should
only be retrieved if you actually plan to help test the latest version of
the shell.
@@ -304,7 +306,7 @@ Starting from mid-October 1997, there is an archive of patches sent
1.1) at:
- http://zsh.sourceforge.net/Patches/
+ https://zsh.sourceforge.io/Patches/
@@ -652,7 +654,8 @@ Here is Bart Schaefer's guide to converting csh aliases for zsh.
1. ) If the csh alias references "parameters" (\!:1, \!* etc.),
then in zsh you need a function (referencing $1, $* etc.).
- Otherwise, you can use a zsh alias.
+ In recent versions of zsh this can be done by defining an anonymous
+ function within the alias. Otherwise, a simple zsh alias suffices.
2. ) If you use a zsh function, you need to refer _at_least_ to
$* in the body (inside the { }). Parameters don't magically
@@ -696,7 +699,7 @@ Those first four are all you really need, but here are four more for
parameters. (E.g., in a csh alias, a reference to \!:5 will
cause an error if 4 or fewer arguments are given; in a zsh
function, $5 is the empty string if there are 4 or fewer
- parameters.)
+ parameters. Force an error in this example by using ${5?}.)
7. ) To begin a zsh alias with a - (dash, hyphen) character, use
`alias --':
@@ -717,9 +720,8 @@ There is one other serious problem with aliases: consider
`l' in the function definition is in command position and is expanded
as an alias, defining `/bin/ls' and `-F' as functions which call
- `/bin/ls', which gets a bit recursive. This can be avoided if you use
- `function' to define a function, which doesn't expand aliases. It is
- possible to argue for extra warnings somewhere in this mess.
+ `/bin/ls', which gets a bit recursive. Recent versions of zsh treat
+ this as an error, but older versions silently create the functions.
One workaround for this is to use the "function" keyword instead:
@@ -805,11 +807,12 @@ If you're missing the editor function run-fg-editor, try something
2.5: Similarities with bash
+
The Bourne-Again Shell, bash, is another enhanced Bourne-like shell;
the most obvious difference from zsh is that it does not attempt to
emulate the Korn shell. Since both shells are under active
development it is probably not sensible to be too specific here.
- Broadly, bash has paid more attention to standards compliancy
+ Broadly, bash has paid more attention to standards compliance
(i.e. POSIX) for longer, and has so far avoided the more abstruse
interactive features (programmable completion, etc.) that zsh has.
@@ -875,6 +878,68 @@ However, the 4.3 branch has much better support, and furthermore this
fully below, see `Multibyte input and output'.
+2.8: Why does my bash script report an error when I run it under zsh?
+
+
+
+tl;dr: bash is not the reference implementation of zsh, and zsh is not
+ a bug-for-bug compatible reimplementation of bash.
+
+bash and zsh are different programming languages. They are not
+ interchangeable; programs written for either of these languages will,
+ in general, not run under the other. (The situation is similar with
+ many other pairs of closely-related languages, such as Python 2 and
+ Python 3; C and C++; and even C89 and C11.)
+
+When bash and zsh behave differently on the same input, whether zsh's
+ behaviour is a bug does not depend on what bash does on the same
+ input; rather, it depends on what zsh's user manual specifies.
+ (By way of comparison, it's not a bug in Emacs that `:q!' doesn't
+ cause it to exit.)
+
+That being said, the bash and zsh languages do have a common subset, and it is
+ feasible to write non-trivial pieces of code that would run under either of
+ them, if one is sufficiently familiar with both of them. However,
+ a difference between bash's behaviour and zsh's does not imply that
+ zsh has a bug. The difference might be a bug in zsh, a bug in bash, or
+ a bug in neither shell
+ (see 3.1 for an example).
+
+The recommended way to deal with these differences depends on what kind
+ of piece of code is in question: a _script_ or a _plugin_.
+
+For scripts -- external commands that
+ are located in $PATH, or located elsewhere and are executed by
+ giving their path explicitly (as in `ls', `/etc/rc.d/sshd',
+ and `./configure') -- the answer is simple:
+
+Don't run bash scripts under zsh. If the scripts were written for
+ bash, run them in bash. There's absolutely no problem with having
+ `#!/usr/bin/env bash' scripts even if `zsh' is your shell for
+ interactive sessions.
+
+In fact, if you've recently changed to zsh, we _recommend_ that
+ you keep your scripts as `#!/usr/bin/env bash', at least for
+ a while: this would make the change more gradual and flatten your
+ learning curve. Once you're used to zsh, you can decide for each
+ script whether to port it to zsh or keep it as-is.
+
+For _plugins_ -- pieces of code
+ executed within the shell itself, loaded via the `.',
+ `source', or `autoload' builtins, added to `.zshrc', or
+ pasted interactively at the shell prompt -- one may consider it
+ worthwhile to invest the effort to make them runnable under either shell.
+ However, as mentioned above, doing so requires one to be familiar with both
+ shells, and either steer clear of their differences or handle them explicitly
+ with conditional code (such as `if test -n "$ZSH_VERSION"').
+
+In summary,
+ if you'd like to run a bash script or plugin under zsh, you must port the script or plugin
+ properly, reviewing it line by line for differences between the two
+ languages and adjusting it accordingly, just like you would
+ when translating a book from American English to British English.
+
+
Chapter 3: How to get various things to work
@@ -910,9 +975,9 @@ For example, defining the function args to show the number of its
Unless you need strict sh/ksh compatibility, you should ask yourself
whether you really want this behaviour, as it can produce unexpected
effects for variables with entirely innocuous embedded spaces. This
- can cause horrendous quoting problems when invoking scripts from
- other shells. The natural way to produce word-splitting behaviour
- in zsh is via arrays. For example,
+ can cause horrendous quoting problems when invoking scripts written
+ for other shells (see 2.8). The natural way to produce
+ word-splitting behaviour in zsh is via arrays. For example,
set -A array one two three twenty
@@ -930,7 +995,7 @@ Unless you need strict sh/ksh compatibility, you should ask yourself
been automatic word splitting in scalars, which is a sort of
uncontrollable poor man's array.
-Note that this happens regardless of the value of the internal field
+Note that word splitting happens regardless of the value of the internal field
separator, $IFS; in other words, with `IFS=:; foo=a:b; args $foo'
you get the answer 1.
@@ -962,22 +1027,32 @@ SH_WORD_SPLIT is set when zsh is invoked with the names `ksh' or `sh',
or (entirely equivalent) when `emulate ksh' or `emulate sh' is in
effect.
-There is one other effect of word splitting which differs between ksh
+There used to be another effect of word splitting which differed between ksh
and zsh. In ksh, the builtin commands that declare parameters such
as typeset and export force word-splitting not to take place
after on an assignment argument:
typeset param=`echo foo bar`
- in ksh will create a parameter with value `foo bar', but in zsh will
+ in ksh will create a parameter with value `foo bar'.
+
+zsh used to
create a parameter param with value foo and a parameter bar
- whose value is empty. Contrast this with a normal assignment (no
+ whose value was empty. Contrast this with a normal assignment (no
typeset or other command in front), which never causes a word split
- unless you have GLOB_ASSIGN set. From zsh version 4.0.2 the option
- KSH_TYPESET, set automatically in compatibility mode, fixes this
- problem. Note that in bash this behaviour occurs with all arguments that
- look like assignments, whatever the command name; to get this behaviour
- in zsh you have to set the option MAGIC_EQUAL_SUBST.
+ unless you have GLOB_ASSIGN set.
+
+zsh version 4.0.2 and newer creates a single parameter with value
+ `foo bar', like ksh does, when the option KSH_TYPESET is set.
+ This option gets set automatically when in ksh compatibility mode.
+
+zsh 5.1 and newer create a single parameter with value `foo bar' by
+ default, in both compatibility and native modes. The older behaviour
+ can be obtained with `disable -r typeset'.
+
+If the options `MAGIC_EQUAL_SUBST' and `KSH_TYPESET' are both
+ set, arguments that look like assignments will not undergo word
+ splitting, whatever the command name.
3.2: In which startup file do I put...?
@@ -2435,11 +2510,6 @@ The shell is being maintained by various (entirely self-appointed)
you want someone to mail you directly, say so. Most patches to zsh
appear there first.
-Note that this location has just changed (January 1999), and the
- instructions to go with it are slightly different --- in particular,
- if you are already subscribed, the instructions about how to
- unsubscribe are different.
-
Please note when reporting bugs that many exist only on certain
architectures, which the developers may not have access to. In
this case debugging information, as detailed as possible, is
@@ -2457,6 +2527,11 @@ Two progressively lower volume lists exist, one with messages
(posting to the last one is currently restricted).
+Finally, there is a private mailing list (the general public cannot subscribe
+ to it) for discussing bug reports with security implications, i.e., potential
+ vulnerabilities: `zsh-security@zsh.org'. If you find a security problem
+ in zsh itself, please mail this address.
+
Note that you should only join one of these lists: people on
zsh-workers receive all the lists, and people on zsh-users will
also receive the announcements list.
@@ -2470,16 +2545,18 @@ To join zsh-workers, send email to
zsh-workers-subscribe@zsh.org
(the actual content is unimportant). Replace subscribe with
- unsubscribe to unsubscribe. The mailing software (ezlm) has
+ unsubscribe to unsubscribe. The mailing software (Sympa) has
various bells and whistles: you can retrieve archived messages.
- Mail zsh-workers-help@zsh.org <zsh-workers-help@zsh.org> for detailed information.
+ Mail sympa@zsh.org?subject=help <sympa@zsh.org?subject=help> for detailed information.
Administrative matters are best sent to
zsh-workers-owner@zsh.org <zsh-workers-owner@zsh.org>.
- real name is Geoff Wing <gcw@zsh.org> <Geoff Wing <gcw@zsh.org>>.
+
+Note that this location changed in August 2020, and the
+ instructions to go with it are slightly different.
An archive of mailings for the last few years can be found at
http://www.zsh.org/mla/
- at the main zsh archive in Australia.
+ at the main zsh archive site.
Of course, you can also post zsh queries to the Usenet group
comp.unix.shell; if all else fails, you could even e-mail me.
@@ -2519,6 +2596,92 @@ Not that I heard of; it's up to you to be careful with two-digit dates,
show problems here.
+6.5: When reporting a bug, how do I reduce my `.zshrc' into a minimal reproduction recipe?
+
+
+When reporting a bug, the gold standard is to include with the bug
+ a _minimal reproduction recipe_, with which anyone who reads the bug
+ report can reproduce the bug for themselves
+ at will.
+
+When you run into a bug in the shell, particularly during interactive
+ use, a reproduction recipe would ideally start by running zsh -f
+ and then, within that instance of the shell, run a minimal short
+ sequence of commands that reproduces the bug. A good way to devise
+ such recipes is the following:
+
+
+ 1. ) First, ensure the bug is reproducible. To do this, start
+ a new instance of the shell -- for example, open a new tab in
+ your terminal emulator -- and reproduce the bug there.
+
+2. ) Start a new instance of the shell by running the
+ command `zsh -f' from your regular shell prompt, and reproduce the
+ bug there. (The `-f' flag inhibits `.zshenv',
+ `/etc/zprofile', `.zprofile', `/etc/zshrc', and
+ `.zshrc' from being sourced.)
+
+If you succeeded in reproducing the bug in `zsh -f', copy the
+ commands you used and their outputs (from the `zsh -f' invocation
+ to the point the bug occurred) and include them in your bug report.
+ Skip the remaining steps of this procedure.
+
+If, however, the bug happens in your regular shell but not in `zsh
+ -f', read the next steps.
+
+3. ) Make a backup of your .zshrc file.
+
+4. ) Delete your .zshrc file, start a new instance of zsh, and confirm
+ that the problem does not reproduce there. (If the problem
+ does reproduce there, it's caused by something in `.zshenv',
+ `.zprofile', `/etc/zprofile', or `/etc/zshrc', so apply
+ this procedure from the top to those files rather than to your
+ `.zshrc'.)
+
+
+
+5. ) At this point, you know that the problem is caused by
+ something in your `.zshrc' file, but not what line exactly.
+ To find the responsible line, we will use
+ a variation
+ of the binary search
+ algorithm, as follows:
+
+Suppose your `.zshrc' file has 200 lines. To start, copy
+ the first half of your `.zshrc' -- that is, lines
+ 1 through 100 -- from the backup copy to your live `.zshrc'
+ file, and check whether the bug reproduces then. Now, empty the live
+ `.zshrc' file again, and copy the second half of your
+ `.zshrc' file from the backup to the live `.zshrc' file
+ -- the live file should now contain lines 101 through 200, only
+ -- and see whether the problem reproduces.
+
+Normally, the bug will reproduce either with lines 1 through 100
+ or with lines 101 through 200, but not in both cases. To isolate
+ the specific line that causes the bug, repeat the above process on the
+ relevant half of the file: for example, if you've determined that the
+ bug reproduces when only lines 101 through 200 are installed, check
+ whether the bug reproduces (a) when only lines 101 through 150 are
+ installed, and (b) when only lines 151 through 200 are installed.
+ Repeat the process until the resulting `.zshrc' is minimal.
+
+It is not important to break the file into two halves exactly.
+ Breaking the file into two parts sized one-third and two-thirds, for
+ example, will work equally well. You can even try restoring one line
+ at a time, but this is impractical for all but the shortest
+ `.zshrc' files.
+
+6. ) Include the minimal set of lines you devised in the previous
+ step, along with the commands you used and their outputs, in your bug
+ report.
+
+7. ) Restore your `.zshrc' from backup.
+
+
+Bug reports should be emailed to the `zsh-workers@zsh.org' public
+ mailing list; see 6.2 for details.
+
+
Acknowledgments:
@@ -2536,7 +2699,7 @@ Copyright Information:
This document is copyright (C) P.W. Stephenson, 1995, 1996, 1997,
-1998, 1999, 2000, 2012. This text originates in the U.K. and the author
+1998, 1999, 2000, 2012, 2020. This text originates in the U.K. and the author
asserts his moral rights under the Copyrights, Designs and Patents Act,
1988.
@@ -2547,4 +2710,4 @@ notice appears in all copies of this documentation. Remember,
however, that this document changes monthly and it may be more useful
to provide a pointer to it rather than the entire text. A suitable
pointer is "information on the Z-shell can be obtained on the World
-Wide Web at URL http://zsh.sourceforge.net/".
+Wide Web at URL https://zsh.sourceforge.io/".
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index 650c2d9d8..8bd7262fe 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -49,23 +49,29 @@ def(item)(2)(
ARG1: ARG2)\
def(nofill)(1)(ARG1)\
def(uref)(1)(url(ARG1)(ARG1))\
-def(LPAR)(0)(CHAR(40))\
-def(RPAR)(1)(CHAR(41))
+COMMENT(TODO: make this expand to a Unicode em dash (U+2014) in HTML output)\
+def(emdash)(0)(\
+ whenlatex(---)\
+ whenhtml(---)\
+ whenman(--)whenms(--)whensgml(--)\
+ whentxt(--))\
+SUBST(_LPAR_)(CHAR(40))\
+SUBST(_RPAR_)(CHAR(41))
myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(2010/02/15)
COMMENT(-- the following are for Usenet and must appear first)\
description(\
mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 2015/05/31
+mydit(Last-Modified:) 2020/08/08
mydit(Submitted-By:) email(coordinator@zsh.org (Peter Stephenson))
mydit(Posting-Frequency:) Monthly
-mydit(Copyright:) (C) P.W. Stephenson, 1995--2016 (see end of document)
+mydit(Copyright:) (C) P.W. Stephenson, 1995--2020 (see end of document)
)
This document contains a list of frequently-asked (or otherwise
significant) questions concerning the Z-shell, a command interpreter
for many UNIX systems which is freely available to anyone with FTP
access. Zsh is among the most powerful freely available Bourne-like
-shell for interactive use.
+shells for interactive use.
If you have never heard of mytt(sh), mytt(csh) or mytt(ksh), then you are
probably better off to start by reading a general introduction to UNIX
@@ -73,7 +79,7 @@ rather than this document.
If you just want to know how to get your hands on the latest version,
skip to question link(1.6)(16); if you want to know what to do with
-insoluble problems, go to link(5.2)(52).
+insoluble problems, go to link(6.2)(62).
whentxt(Notation: Quotes `like this' are ordinary textual quotation
marks. Other uses of quotation marks are input to the shell.)
@@ -97,6 +103,7 @@ Chapter 2: How does zsh differ from...?
2.5. bash?
2.6. Shouldn't zsh be more/less like ksh/(t)csh?
2.7. What is zsh's support for Unicode/UTF-8?
+2.8. Why does my bash script report an error when I run it under zsh?
Chapter 3: How to get various things to work
3.1. Why does `$var' where `var="foo bar"' not do what I expect?
@@ -150,6 +157,7 @@ Chapter 6: The future of zsh
6.2. Where do I report bugs, get more info / who's working on zsh?
6.3. What's on the wish-list?
6.4. Did zsh have problems in the year 2000?
+6.5. When reporting a bug, how do I reduce my mytt(.zshrc) into a minimal reproduction recipe?
Acknowledgments
@@ -163,20 +171,20 @@ sect(Sources of information)
label(11)
Information on zsh is available via the World Wide Web. The URL
- is url(http://zsh.sourceforge.net/)(http://zsh.sourceforge.net/) .
+ is url(https://zsh.sourceforge.io/)(https://zsh.sourceforge.io/) .
The server provides this FAQ and much else and is
now maintained by the zsh workers (email email(zsh-workers@zsh.org)).
The FAQ is at \
-url(http://zsh.sourceforge.net/FAQ/)(http://zsh.sourceforge.net/FAQ/) .
+url(https://zsh.sourceforge.io/FAQ/)(https://zsh.sourceforge.io/FAQ/) .
The site also contains some contributed zsh scripts and functions;
we are delighted to add more, or simply links to your own collection.
This document was originally written in YODL, allowing it to be converted
easily into various other formats. The master source file lives at
- url(http://zsh.sourceforge.net/FAQ/zshfaq.yo)
-(http://zsh.sourceforge.net/FAQ/zshfaq.yo) and the plain text version
- can be found at url(http://zsh.sourceforge.net/FAQ/zshfaq.txt)
-(http://zsh.sourceforge.net/FAQ/zshfaq.txt) .
+ url(https://zsh.sourceforge.io/FAQ/zshfaq.yo)
+(https://zsh.sourceforge.io/FAQ/zshfaq.yo) and the plain text version
+ can be found at url(https://zsh.sourceforge.io/FAQ/zshfaq.txt)
+(https://zsh.sourceforge.io/FAQ/zshfaq.txt) .
Another useful source of information is the collection of FAQ articles
posted frequently to the Usenet news groups comp.unix.questions,
@@ -205,14 +213,14 @@ email(mail-server@rtfm.mit.edu)
I have put together a user guide to complement the manual by
explaining the most useful features of zsh in a more easy to read way.
This can be found at the zsh web site:
- url(http://zsh.sourceforge.net/Guide/)(http://zsh.sourceforge.net/Guide/)
+ url(https://zsh.sourceforge.io/Guide/)(https://zsh.sourceforge.io/Guide/)
(As a method of reading the following in Emacs, you can type tt(\M-2
\C-x $) to make all the indented text vanish, then tt(\M-0 \C-x $)
when you are on the title you want.)
For any more eclectic information, you should contact the mailing
- list: see question link(5.2)(52).
+ list: see question link(6.2)(62).
sect(What is it?)
@@ -227,7 +235,7 @@ sect(What is it?)
It was written by Paul Falstad when a student at Princeton; however,
Paul doesn't maintain it any more and enquiries should be sent to
- the mailing list (see question link(5.2)(52)). Zsh is distributed under a
+ the mailing list (see question link(6.2)(62)). Zsh is distributed under a
standard Berkeley style copyright.
For more information, the files Doc/intro.txt or Doc/intro.troff
@@ -292,8 +300,8 @@ sect(On what machines will it run?)
If you need to change something to support a new machine, it would be
appreciated if you could add any necessary preprocessor code and
alter configure.in and acconfig.h to configure zsh automatically,
- then send the required context diffs to the list (see question
- link(5.2)(52)). Please make sure you have the latest version first.
+ then send the required unified diffs to the list (see question
+ link(6.2)(62)). Please make sure you have the latest version first.
To get it to work, retrieve the source distribution (see question
link(1.6)(16)), un-gzip it, un-tar it and read the INSTALL file in the top
@@ -308,7 +316,7 @@ sect(On what machines will it run?)
sect(What's the latest version?)
- Zsh 5.8.1 is the latest production version. For details of all the
+ Zsh 5.9 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
@@ -321,11 +329,11 @@ sect(What's the latest version?)
tt(development) subdirectory.
Note also that as the shell changes, it may become incompatible with
- older versions; see the end of question link(5.1)(51) for a partial list.
+ older versions; see the end of question link(6.1)(61) for a partial list.
Changes of this kind are almost always forced by an awkward or
unnecessary feature in the original design (as perceived by current
users), or to enhance compatibility with other Bourne shell
- derivatives, or (mostly in the 3.0 series) to provide POSIX compliancy.
+ derivatives, or (mostly in the 3.0 series) to provide POSIX compliance.
sect(Where do I get it?)
@@ -334,7 +342,7 @@ label(16)
The coordinator of development is currently me; the alias
email(coordinator@zsh.org) can be used to contact whoever is in the hot
seat. url(https://www.zsh.org/)(https://www.zsh.org/) is the official
- archive site, currently in Australia. Test versions are kept in the
+ archive site. Test versions are kept in the
`testing' subdirectory: such up-to-the-minute development versions should
only be retrieved if you actually plan to help test the latest version of
the shell.
@@ -359,8 +367,8 @@ label(16)
link(1.1)(11)) at:
description(
- mydit() url(http://zsh.sourceforge.net/Patches/)
-(http://zsh.sourceforge.net/Patches/)
+ mydit() url(https://zsh.sourceforge.io/Patches/)
+(https://zsh.sourceforge.io/Patches/)
)
sect(I don't have root access: how do I make zsh my login shell?)
@@ -698,7 +706,7 @@ label(23)
cd() { builtin cd "$@"; print -D $PWD; }
)
(which converts your home directory to a tt(~)). In fact, this problem is
- better solved by defining the special function chpwd+LPAR()RPAR() (see
+ better solved by defining the special function chpwd+_LPAR__RPAR_ (see
the manual). Note also that the mytt(;) at the end of the function is
optional in zsh, but not in ksh or sh (for sh's where it exists).
@@ -707,7 +715,8 @@ label(23)
enumeration(
myeit() If the csh alias references "parameters" (tt(\!:1), tt(\!*) etc.),
then in zsh you need a function (referencing tt($1), tt($*) etc.).
- Otherwise, you can use a zsh alias.
+ In recent versions of zsh this can be done by defining an anonymous
+ function within the alias. Otherwise, a simple zsh alias suffices.
myeit() If you use a zsh function, you need to refer _at_least_ to
tt($*) in the body (inside the tt({ })). Parameters don't magically
@@ -751,7 +760,7 @@ label(23)
parameters. (E.g., in a csh alias, a reference to tt(\!:5) will
cause an error if 4 or fewer arguments are given; in a zsh
function, tt($5) is the empty string if there are 4 or fewer
- parameters.)
+ parameters. Force an error in this example by using tt(${5?}).)
myeit() To begin a zsh alias with a - (dash, hyphen) character, use
mytt(alias --):
@@ -772,9 +781,8 @@ label(23)
)
mytt(l) in the function definition is in command position and is expanded
as an alias, defining mytt(/bin/ls) and mytt(-F) as functions which call
- mytt(/bin/ls), which gets a bit recursive. This can be avoided if you use
- mytt(function) to define a function, which doesn't expand aliases. It is
- possible to argue for extra warnings somewhere in this mess.
+ mytt(/bin/ls), which gets a bit recursive. Recent versions of zsh treat
+ this as an error, but older versions silently create the functions.
One workaround for this is to use the "function" keyword instead:
verb(
@@ -782,7 +790,7 @@ label(23)
function l { /bin/ls -la "$@" | more }
)
The mytt(l) after mytt(function) is not expanded. Note you don't need
- the mytt(LPAR()RPAR()) in this case, although it's harmless.
+ the mytt(_LPAR__RPAR_) in this case, although it's harmless.
You need to be careful if you are defining a function with multiple
names; most people don't need to do this, so it's an unusual problem,
@@ -795,7 +803,7 @@ label(23)
This oddity was fixed in version 5.1.
The rest of this item assumes you use the (more common,
- but equivalent) mytt(LPAR()RPAR()) definitions.
+ but equivalent) mytt(_LPAR__RPAR_) definitions.
Bart Schaefer's rule is: Define first those aliases you expect to
use in the body of a function, but define the function first if the
@@ -857,12 +865,13 @@ mytt(compctl)
sect(Similarities with bash)
+label(25)
The Bourne-Again Shell, bash, is another enhanced Bourne-like shell;
the most obvious difference from zsh is that it does not attempt to
emulate the Korn shell. Since both shells are under active
development it is probably not sensible to be too specific here.
- Broadly, bash has paid more attention to standards compliancy
+ Broadly, bash has paid more attention to standards compliance
(i.e. POSIX) for longer, and has so far avoided the more abstruse
interactive features (programmable completion, etc.) that zsh has.
@@ -927,6 +936,67 @@ sect(What is zsh's support for Unicode/UTF-8?)
fully below, see `Multibyte input and output'.
+sect(Why does my bash script report an error when I run it under zsh?)
+label(28)
+
+ em(tl;dr:) bash is not the reference implementation of zsh, and zsh is not
+ a bug-for-bug compatible reimplementation of bash.
+
+ bash and zsh are different programming languages. They are not
+ interchangeable; programs written for either of these languages will,
+ in general, not run under the other. (The situation is similar with
+ many other pairs of closely-related languages, such as Python 2 and
+ Python 3; C and C++; and even C89 and C11.)
+
+ When bash and zsh behave differently on the same input, whether zsh's
+ behaviour is a bug does not depend on what bash does on the same
+ input; rather, it depends on what zsh's user manual specifies.
+ (By way of comparison, it's not a bug in Emacs that mytt(:q!) doesn't
+ cause it to exit.)
+
+ That being said, the bash and zsh languages do have a common subset, and it is
+ feasible to write non-trivial pieces of code that would run under either of
+ them, if one is sufficiently familiar with both of them. However,
+ a difference between bash's behaviour and zsh's does not imply that
+ zsh has a bug. The difference might be a bug in zsh, a bug in bash, or
+ a bug in neither shell
+ (see link(3.1)(31) for an example).
+
+ The recommended way to deal with these differences depends on what kind
+ of piece of code is in question: a myem(script) or a myem(plugin).
+
+ For em(scripts) emdash() external commands that
+ are located in tt($PATH), or located elsewhere and are executed by
+ giving their path explicitly (as in mytt(ls), mytt(/etc/rc.d/sshd),
+ and mytt(./configure)) emdash() the answer is simple:
+
+ Don't run bash scripts under zsh. If the scripts were written for
+ bash, run them in bash. There's absolutely no problem with having
+ mytt(#!/usr/bin/env bash) scripts even if mytt(zsh) is your shell for
+ interactive sessions.
+
+ In fact, if you've recently changed to zsh, we myem(recommend) that
+ you keep your scripts as mytt(#!/usr/bin/env bash), at least for
+ a while: this would make the change more gradual and flatten your
+ learning curve. Once you're used to zsh, you can decide for each
+ script whether to port it to zsh or keep it as-is.
+
+ For myem(plugins) emdash() pieces of code
+ executed within the shell itself, loaded via the mytt(.),
+ mytt(source), or mytt(autoload) builtins, added to mytt(.zshrc), or
+ pasted interactively at the shell prompt emdash() one may consider it
+ worthwhile to invest the effort to make them runnable under either shell.
+ However, as mentioned above, doing so requires one to be familiar with both
+ shells, and either steer clear of their differences or handle them explicitly
+ with conditional code (such as mytt(if test -n "$ZSH_VERSION")).
+
+ In summary,
+ if you'd like to run a bash script or plugin under zsh, you must port the script or plugin
+ properly, reviewing it line by line for differences between the two
+ languages and adjusting it accordingly, just like you would
+ when translating a book from American English to British English.
+
+
chapter(How to get various things to work)
sect(Why does mytt($var) where mytt(var="foo bar") not do what I expect?)
@@ -959,9 +1029,9 @@ label(31)
Unless you need strict sh/ksh compatibility, you should ask yourself
whether you really want this behaviour, as it can produce unexpected
effects for variables with entirely innocuous embedded spaces. This
- can cause horrendous quoting problems when invoking scripts from
- other shells. The natural way to produce word-splitting behaviour
- in zsh is via arrays. For example,
+ can cause horrendous quoting problems when invoking scripts written
+ for other shells (see link(2.8)(28)). The natural way to produce
+ word-splitting behaviour in zsh is via arrays. For example,
verb(
set -A array one two three twenty
)
@@ -979,7 +1049,7 @@ label(31)
been automatic word splitting in scalars, which is a sort of
uncontrollable poor man's array.
- Note that this happens regardless of the value of the internal field
+ Note that word splitting happens regardless of the value of the internal field
separator, tt($IFS); in other words, with mytt(IFS=:; foo=a:b; args $foo)
you get the answer 1.
@@ -1011,22 +1081,32 @@ label(31)
or (entirely equivalent) when mytt(emulate ksh) or mytt(emulate sh) is in
effect.
- There is one other effect of word splitting which differs between ksh
+ There used to be another effect of word splitting which differed between ksh
and zsh. In ksh, the builtin commands that declare parameters such
as tt(typeset) and tt(export) force word-splitting not to take place
after on an assignment argument:
verb(
typeset param=`echo foo bar`
)
- in ksh will create a parameter with value mytt(foo bar), but in zsh will
+ in ksh will create a parameter with value mytt(foo bar).
+
+ zsh used to
create a parameter tt(param) with value tt(foo) and a parameter tt(bar)
- whose value is empty. Contrast this with a normal assignment (no
+ whose value was empty. Contrast this with a normal assignment (no
tt(typeset) or other command in front), which never causes a word split
- unless you have tt(GLOB_ASSIGN) set. From zsh version 4.0.2 the option
- tt(KSH_TYPESET), set automatically in compatibility mode, fixes this
- problem. Note that in bash this behaviour occurs with all arguments that
- look like assignments, whatever the command name; to get this behaviour
- in zsh you have to set the option tt(MAGIC_EQUAL_SUBST).
+ unless you have tt(GLOB_ASSIGN) set.
+
+ zsh version 4.0.2 and newer creates a single parameter with value
+ mytt(foo bar), like ksh does, when the option tt(KSH_TYPESET) is set.
+ This option gets set automatically when in ksh compatibility mode.
+
+ zsh 5.1 and newer create a single parameter with value mytt(foo bar) by
+ default, in both compatibility and native modes. The older behaviour
+ can be obtained with mytt(disable -r typeset).
+
+ If the options mytt(MAGIC_EQUAL_SUBST) and mytt(KSH_TYPESET) are both
+ set, arguments that look like assignments will not undergo word
+ splitting, whatever the command name.
sect(In which startup file do I put...?)
@@ -1906,7 +1986,7 @@ label(327)
mytt(something) mustn't contain tt(/) if the pattern is being used for
globbing.
- Likewise, mytt(abc+LPAR()<->~<10-100>RPAR().txt) matches a file consisting of
+ Likewise, mytt(abc+_LPAR_<->~<10-100>_RPAR_.txt) matches a file consisting of
tt(abc), then some digits, then tt(.txt), unless the digits happen to
match a number from 10 to 100 inclusive (remember the handy mytt(<->)
pattern for matching integers with optional limits to the range). So
@@ -2029,7 +2109,7 @@ sect(Why doesn't the expansion mytt(*.{tex,aux,pdf}) do what I expect?)
This use of parentheses is special to zsh. Modern Bourne-like shells
have a syntax like this, too, but with an mytt(@) in front of the
- parentheses: again, see link(2.1)(21), and search for mytt(@+LPAR()).
+ parentheses: again, see link(2.1)(21), and search for mytt(@_LPAR_).
This is harder for the user to remember but easier for the shell to
parse!
@@ -2419,7 +2499,7 @@ chapter(The future of zsh)
sect(What bugs are currently known and unfixed? (Plus recent \
important changes))
-label(51)
+label(61)
Bugs tend to be tracked on the zsh-workers mailing list; see the
next section. Check the mailing list to see if a bug has been
@@ -2433,7 +2513,7 @@ label(51)
sect(Where do I report bugs, get more info / who's working on zsh?)
-label(52)
+label(62)
The shell is being maintained by various (entirely self-appointed)
subscribers to the mailing list,
@@ -2445,11 +2525,6 @@ label(52)
you want someone to mail you directly, say so. Most patches to zsh
appear there first.
- Note that this location has just changed (January 1999), and the
- instructions to go with it are slightly different --- in particular,
- if you are already subscribed, the instructions about how to
- unsubscribe are different.
-
Please note when reporting bugs that many exist only on certain
architectures, which the developers may not have access to. In
this case debugging information, as detailed as possible, is
@@ -2467,6 +2542,11 @@ label(52)
)
(posting to the last one is currently restricted).
+ Finally, there is a private mailing list (the general public cannot subscribe
+ to it) for discussing bug reports with security implications, i.e., potential
+ vulnerabilities: mytt(zsh-security@zsh.org). If you find a security problem
+ in zsh itself, please mail this address.
+
Note that you should only join one of these lists: people on
zsh-workers receive all the lists, and people on zsh-users will
also receive the announcements list.
@@ -2480,16 +2560,18 @@ label(52)
zsh-workers-subscribe@zsh.org
)
(the actual content is unimportant). Replace tt(subscribe) with
- tt(unsubscribe) to unsubscribe. The mailing software (tt(ezlm)) has
+ tt(unsubscribe) to unsubscribe. The mailing software (tt(Sympa)) has
various bells and whistles: you can retrieve archived messages.
- Mail email(zsh-workers-help@zsh.org) for detailed information.
+ Mail email(sympa@zsh.org?subject=help) for detailed information.
Administrative matters are best sent to
email(zsh-workers-owner@zsh.org).
- real name is email(Geoff Wing <gcw@zsh.org>).
+ Note that this location changed in August 2020, and the
+ instructions to go with it are slightly different.
+
An archive of mailings for the last few years can be found at
url(http://www.zsh.org/mla/)(http://www.zsh.org/mla/)
- at the main zsh archive in Australia.
+ at the main zsh archive site.
Of course, you can also post zsh queries to the Usenet group
comp.unix.shell; if all else fails, you could even e-mail me.
@@ -2527,6 +2609,98 @@ sect(Did zsh have problems in the year 2000?)
show problems here.
+sect(When reporting a bug, how do I reduce my mytt(.zshrc) into a minimal reproduction recipe?)
+
+ When reporting a bug, the gold standard is to include with the bug
+ a myem(minimal reproduction recipe), with which anyone who reads the bug
+ report can url(reproduce the bug for themselves)
+ (https://www.chiark.greenend.org.uk/~sgtatham/bugs.html#showmehow)
+ at will.
+
+ When you run into a bug in the shell, particularly during interactive
+ use, a reproduction recipe would ideally start by running tt(zsh -f)
+ and then, within that instance of the shell, run a minimal short
+ sequence of commands that reproduces the bug. A good way to devise
+ such recipes is the following:
+
+COMMENT(For reference, here's Vim's write-up of a similar process:
+https://github.com/chrisbra/vim_faq/blob/de424bd8e08bcf0e6b1e0563ee49514dfed926ae/vim_faq.txt#L1153-L1228)
+
+ enumeration(
+ myeit() First, ensure the bug is reproducible. To do this, start
+ a new instance of the shell emdash() for example, open a new tab in
+ your terminal emulator emdash() and reproduce the bug there.
+
+ myeit() Start a new instance of the shell by running the
+ command mytt(zsh -f) from your regular shell prompt, and reproduce the
+ bug there. (The mytt(-f) flag inhibits mytt(.zshenv),
+ mytt(/etc/zprofile), mytt(.zprofile), mytt(/etc/zshrc), and
+ mytt(.zshrc) from being sourced.)
+
+ If you succeeded in reproducing the bug in mytt(zsh -f), copy the
+ commands you used and their outputs (from the mytt(zsh -f) invocation
+ to the point the bug occurred) and include them in your bug report.
+ Skip the remaining steps of this procedure.
+
+ If, however, the bug happens in your regular shell but not in mytt(zsh
+ -f), read the next steps.
+
+ myeit() Make a backup of your tt(.zshrc) file.
+
+ myeit() Delete your tt(.zshrc) file, start a new instance of zsh, and confirm
+ that the problem does em(not) reproduce there. (If the problem
+ does reproduce there, it's caused by something in mytt(.zshenv),
+ mytt(.zprofile), mytt(/etc/zprofile), or mytt(/etc/zshrc), so apply
+ this procedure from the top to those files rather than to your
+ mytt(.zshrc).)
+ COMMENT(Note that mytt(/etc/zshenv) is not mentioned, since by this
+ point we have established the bug does not occur under mytt(zsh -f),
+ which sources mytt(/etc/zshenv).)
+ COMMENT(mytt(.zlogout) and mytt(/etc/zlogout) aren't mentioned because
+ they're unlikely to be relevant to most readers.)
+
+ myeit() At this point, you know that the problem is caused by
+ something in your mytt(.zshrc) file, but not what line exactly.
+ To find the responsible line, we will use
+ a url(variation)(https://en.wikipedia.org/wiki/Delta_debugging)
+ of the url(binary search)(https://en.wikipedia.org/wiki/Binary_search)
+ algorithm, as follows:
+
+ Suppose your mytt(.zshrc) file has 200 lines. To start, copy
+ the em(first) half of your mytt(.zshrc) emdash() that is, lines
+ 1 through 100 emdash() from the backup copy to your live mytt(.zshrc)
+ file, and check whether the bug reproduces then. Now, empty the live
+ mytt(.zshrc) file again, and copy the em(second) half of your
+ mytt(.zshrc) file from the backup to the live mytt(.zshrc) file
+ emdash() the live file should now contain lines 101 through 200, only
+ emdash() and see whether the problem reproduces.
+
+ Normally, the bug will reproduce em(either) with lines 1 through 100
+ em(or) with lines 101 through 200, but not in both cases. To isolate
+ the specific line that causes the bug, repeat the above process on the
+ relevant half of the file: for example, if you've determined that the
+ bug reproduces when only lines 101 through 200 are installed, check
+ whether the bug reproduces (a) when only lines 101 through 150 are
+ installed, and (b) when only lines 151 through 200 are installed.
+ Repeat the process until the resulting mytt(.zshrc) is minimal.
+
+ It is not important to break the file into two halves exactly.
+ Breaking the file into two parts sized one-third and two-thirds, for
+ example, will work equally well. You can even try restoring one line
+ at a time, but this is impractical for all but the shortest
+ mytt(.zshrc) files.
+
+ myeit() Include the minimal set of lines you devised in the previous
+ step, along with the commands you used and their outputs, in your bug
+ report.
+
+ myeit() Restore your mytt(.zshrc) from backup.
+ )
+
+ Bug reports should be emailed to the mytt(zsh-workers@zsh.org) public
+ mailing list; see link(6.2)(62) for details.
+
+
nsect(Acknowledgments:)
Thanks to zsh-list, in particular Bart Schaefer, for suggestions
@@ -2542,7 +2716,7 @@ Wischnowsky).
nsect(Copyright Information:)
This document is copyright (C) P.W. Stephenson, 1995, 1996, 1997,
-1998, 1999, 2000, 2012. This text originates in the U.K. and the author
+1998, 1999, 2000, 2012, 2020. This text originates in the U.K. and the author
asserts his moral rights under the Copyrights, Designs and Patents Act,
1988.
@@ -2553,4 +2727,4 @@ notice appears in all copies of this documentation. Remember,
however, that this document changes monthly and it may be more useful
to provide a pointer to it rather than the entire text. A suitable
pointer is "information on the Z-shell can be obtained on the World
-Wide Web at URL http://zsh.sourceforge.net/".
+Wide Web at URL https://zsh.sourceforge.io/".
diff --git a/Etc/NEWS-4.3 b/Etc/NEWS-4.3
index 19b3daada..8d93af134 100644
--- a/Etc/NEWS-4.3
+++ b/Etc/NEWS-4.3
@@ -139,7 +139,7 @@ The new shell option POSIX_CD, active in emulations of POSIX-based shells,
makes the cd builtin POSIX-compatible.
The POSIX_JOBS option already referred to has various other
-compatibility enchancements.
+compatibility enhancements.
The new shell option POSIX_STRINGS makes a null character in $'...'
expansion terminate the string, as is already the case in bash. This is
diff --git a/Etc/changelog2html.pl b/Etc/changelog2html.pl
index 82416bff9..de6877d97 100755
--- a/Etc/changelog2html.pl
+++ b/Etc/changelog2html.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# This programme turns the ChangeLog into changelog.html for display
-# on the website. That lives at http://zsh.sourceforge.net/Etc/changelog.html.
+# on the website. That lives at https://zsh.sourceforge.io/Etc/changelog.html.
my $out = "changelog.html";
diff --git a/Etc/completion-style-guide b/Etc/completion-style-guide
index 53d522764..f7dcae230 100644
--- a/Etc/completion-style-guide
+++ b/Etc/completion-style-guide
@@ -44,7 +44,10 @@ Descriptions:
Descriptions should not have a trailing full stop and initial capital
letter. Though capitals are fine where you have an acronym which
-generally appears in uppercase.
+generally appears in uppercase. Prefer the use of the imperative
+mood as it is shorter and more natural in the absence of an explicit
+subject for a sentence, e.g. "recurse subdirectories" instead of
+"recurses subdirectories", as if orders are being given.
It is a good idea to copy descriptions from the command's man page or
--help output. If you do this, be careful that the description still
@@ -72,6 +75,8 @@ but use:
To indicate a default value, use square brackets:
'--timeout[specify connection timeout]:timeout (ms) [5000]'
These two conventions can be used together or individually as appropriate.
+Alternatively the `_numbers' function may be used:
+ '--timeout[specify connection timeout]: :_numbers -u ms -d 5000 timeout'
Group descriptions should be singular because only one thing is being
completed even though many may be listed. This applies even where you
@@ -121,7 +126,7 @@ supported. The functions are merely updated to reflect the latest stable
version. Exceptions to this can be made where are particular version
continues to be commonly distributed. Where there is more than one variant
of the same command however (e.g., the command takes different options
-different platforms), the separate variants should be supported.
+on different platforms), the separate variants should be supported.
Contexts, tags and all that
---------------------------
@@ -433,7 +438,7 @@ keep things consistent).
Descriptions
------------
-Always use description. This is important. Really. *Always* use
+Always use descriptions. This is important. Really. *Always* use
descriptions. If you have just written down a `compadd' without a
"$expl[@]" (or equivalent), you have just made an error. Even in
helper functions where you use a "$@": if you can't be sure that there
@@ -486,6 +491,20 @@ is all you need to make your function work correctly with both tags
and description at the same time.
+Caching
+-------
+
+Where generating matches takes a long time it can be useful to save
+the list for reuse in subsequent completion attempts. If you use
+a global variable, prefix the name of it with `_cache_' and explicitly
+declare it with `typeset -g'. In many cases this is sufficient but
+where generating matches takes especially long or the list is
+especially large, use the `_store_cache` mechanism to allow for a
+persistent cache. When caching matches, also consider whether
+generated matches might be affected by style settings for limited
+contexts and adapt to allow such configuration to work.
+
+
Misc. remarks
-------------
@@ -513,7 +532,7 @@ Misc. remarks
6) When matches with a common prefix such as option names are generated,
add them *with* the prefix (like `-', `+', or `--' for options).
Then check the `prefix-needed' style to see if the matches are to be
- added when the prefix is on the line and use the `prefix-hidden'
+ added when the prefix is not on the line and use the `prefix-hidden'
style to see if the prefix should be listed or not.
7) If at all possible, completion code for a command or a suite of
commands should go into only one file. If a command has sub-commands,
@@ -553,3 +572,13 @@ Misc. remarks
data derived from another command's output to the helper. Consider
using some variation of the `q` expansion flag to deal with this:
`_call_program vals $words[1] ${(q-)myfile}'
+10) If you are going to create a new completion function '_cmd' for a
+ command 'cmd', and if the 'cmd' supports the --help option, then you
+ may try
+ compdef _gnu_generic cmd
+ cmd -<TAB>
+ _gnu_generic may not work sufficiently well for 'cmd', but the specs
+ for _arguments generated from the help text are cached in a variable
+ '_args_cache_cmd', and you can save them in a file '_cmd' by
+ print -r -- ${(F)${(@qqq)_args_cache_cmd}} > _cmd
+ and use the file as a draft of the new completion function.
diff --git a/Etc/creating-a-release.txt b/Etc/creating-a-release.txt
index 805ff2ce0..640d19d39 100644
--- a/Etc/creating-a-release.txt
+++ b/Etc/creating-a-release.txt
@@ -7,9 +7,9 @@ To create a zsh release:
Config/version.mk to today's date
Config/version.mk version number
- Etc/FAQ.yo
- README
- NEWS
+ Etc/FAQ.yo ('latest version' section)
+ README (first two paragraphs, 'incompatibilities since' sections)
+ NEWS ('changes since' sections)
The version-number sequence is as follows:
@@ -31,7 +31,9 @@ To create a zsh release:
README should document compatibility-breaking changes. Generally, NEWS should
document new features and major bug fixes (but not routine fixes or changes to
- completion/contrib functions).
+ completion/contrib functions). Historically, these documents have often been
+ missed at the time the changes were actually committed, so it may be a good
+ idea to scan back through the history and fill in any blanks before release.
For -test releases, you may update the FAQ, README, etc., to refer to the
upcoming stable version number.
@@ -72,6 +74,13 @@ To create a zsh release:
git clone git://git.code.sf.net/p/zsh/web
git clone ssh://git.code.sf.net/p/zsh/web
+- [one time step] Add your key to the Keys/ directory in the 'web' repository, using
+ `gpg --armor --export $YourPublicKeyFingerprint`.
+
+- Create the keyring:
+
+ cat web.git/Keys/*.asc > zsh-keyring.asc
+
- Upload to sf.net:
Test releases go to the "zsh-test" directory.
@@ -81,6 +90,22 @@ To create a zsh release:
[Select All] next to "Default Download For:". This should cause sf.net
to offer that artifact in the "Looking for the latest version?" line.
+ You should upload five files:
+
+ zsh-5.8.tar.xz
+ zsh-5.8.tar.xz.asc
+ zsh-doc-5.8.tar.xz
+ zsh-doc-5.8.tar.xz.asc
+ zsh-keyring.asc
+
+ (TODO: what about MD5SUM, FAQ, META-FAQ, all in www.zsh.org/pub/?)
+
+ Note that zsh-keyring.asc is fine to just overwrite, since it's only ever
+ appended to, and in any case the underlying Keys/*.asc files are in version
+ control.
+
+ TODO: link to zsh-keyring.asc from Arc/source.html and elsewhere
+
- If the new release is a stable release, update zsh.sf.net:
# Move into the 'web' repository mentioned above
@@ -119,8 +144,14 @@ To create a zsh release:
# several minutes to appear afterwards
rsync ...
-- For stable releases, upload the build artefacts to zsh.org/pub; you may need
- assistance from another dev if you don't have access to do this.
+- For stable releases, upload the build artefacts to zsh.org/pub, making sure to
+ move the previous ones to old/. For example (assuming the new artefacts are in
+ the CWD):
+
+ mv /usr/local/www/ftp/pub/zsh-*.*(.) /usr/local/www/ftp/pub/old/
+ mv zsh-*.*(.) /usr/local/www/ftp/pub/
+
+ You may need assistance from another dev if you don't have access to do this.
- Post to -workers@
diff --git a/Etc/zsh-development-guide b/Etc/zsh-development-guide
index cbada7de9..e8c292cfd 100644
--- a/Etc/zsh-development-guide
+++ b/Etc/zsh-development-guide
@@ -66,6 +66,14 @@ avoided further changes to our workflow.
the mailing list sequence number. This number is generated by the list
server and inserted as an X-Seq: header field in the e-mail.
+ Your email client may be able to be configured to show the X-Seq:
+ header by default, and probably has a way to view the raw full headers
+ of an email. The X-Seq header is also shown on the
+ https://www.zsh.org/mla/ email archives. We can also, upon request,
+ set up an email-based bot that, whenever you post a patch to the
+ mailing list, will send you an offlist reply with the X-Seq number of
+ your patch.
+
* An entry in the ChangeLog file should be added manually before pushing
a commit to the master repository. Don't create a separate change for
this: amend the existing commit in your local repository.
diff --git a/Functions/Chpwd/cdr b/Functions/Chpwd/cdr
index 4bed88b13..43745e5aa 100644
--- a/Functions/Chpwd/cdr
+++ b/Functions/Chpwd/cdr
@@ -55,7 +55,7 @@
# pattern from the directory list. The match is against the fully
# expanded directory path and the full string must match (use wildcards
# at the ends if needed). If output is going to a terminal, the
-# function will print the new list for the user to confrim; this can be
+# function will print the new list for the user to confirm; this can be
# skipped by giving -P instead of -p.
#
# Details of directory handling
diff --git a/Functions/Chpwd/zsh_directory_name_cdr b/Functions/Chpwd/zsh_directory_name_cdr
index cb72e4600..b653e7c38 100644
--- a/Functions/Chpwd/zsh_directory_name_cdr
+++ b/Functions/Chpwd/zsh_directory_name_cdr
@@ -16,8 +16,10 @@ elif [[ $1 = c ]]; then
typeset -a keys values
values=(${${(f)"$(cdr -l)"}/ ##/:})
keys=(${values%%:*})
+ local addsuffix
+ [[ $ISUFFIX = *\]* ]] || addsuffix='-S]'
_describe -t dir-index 'recent directory index' \
- values -V unsorted -S']'
+ values -V unsorted $addsuffix
return
fi
fi
diff --git a/Functions/Example/zpgrep b/Functions/Example/zpgrep
index 8b1edaa1c..556e58cd6 100644
--- a/Functions/Example/zpgrep
+++ b/Functions/Example/zpgrep
@@ -2,24 +2,31 @@
#
zpgrep() {
-local file pattern
+local file pattern ret
pattern=$1
shift
+ret=1
if ((! ARGC)) then
set -- -
fi
-pcre_compile $pattern
+zmodload zsh/pcre || return
+pcre_compile -- "$pattern"
pcre_study
for file
do
if [[ "$file" == - ]] then
- while read -u0 buf; do pcre_match $buf && print $buf; done
+ while IFS= read -ru0 buf; do
+ pcre_match -- "$buf" && ret=0 && print -r -- "$buf"
+ done
else
- while read -u0 buf; do pcre_match $buf && print $buf; done < "$file"
+ while IFS= read -ru0 buf; do
+ pcre_match -- "$buf" && ret=0 && print -r -- "$buf"
+ done < "$file"
fi
done
+return "$ret"
}
diff --git a/Functions/Math/zmathfunc b/Functions/Math/zmathfunc
index 4ff40700d..12d2c2f3d 100644
--- a/Functions/Math/zmathfunc
+++ b/Functions/Math/zmathfunc
@@ -1,34 +1,50 @@
#autoload
zsh_math_func_min() {
+ emulate -L zsh
local result=$1
shift
local arg
for arg ; do
- (( $arg < result )) && result=$arg
+ (( arg < result ))
+ case $? in
+ (0) (( result = arg ));;
+ (1) ;;
+ (*) return $?;;
+ esac
done
- (( result )) # return
+ (( result ))
+ true # Careful here: `return 0` evaluates an arithmetic expression
}
functions -M min 1 -1 zsh_math_func_min # at least one argument
zsh_math_func_max() {
+ emulate -L zsh
local result=$1
shift
local arg
for arg ; do
- (( $arg > result )) && result=$arg
+ (( arg > result ))
+ case $? in
+ (0) (( result = arg ));;
+ (1) ;;
+ (*) return $?;;
+ esac
done
- (( result )) # return
+ (( result ))
+ true # Careful here: `return 0` evaluates an arithmetic expression
}
functions -M max 1 -1 zsh_math_func_max # at least one argument
zsh_math_func_sum() {
+ emulate -L zsh
local sum
local arg
for arg ; do
- (( sum += $arg ))
+ (( sum += arg ))
done
(( sum ))
+ true # Careful here: `return 0` evaluates an arithmetic expression
}
functions -M sum 0 -1 zsh_math_func_sum
diff --git a/Functions/Misc/add-zle-hook-widget b/Functions/Misc/add-zle-hook-widget
index 9cc35496f..4d8049083 100644
--- a/Functions/Misc/add-zle-hook-widget
+++ b/Functions/Misc/add-zle-hook-widget
@@ -47,9 +47,9 @@ function azhw:${^hooktypes} {
for hook in "${(@)${(@on)hook_widgets[@]}#<->:}"; do
if [[ "$hook" = user:* ]]; then
# Preserve $WIDGET within the renamed widget
- zle "$hook" -N -- "$@"
+ zle "$hook" -f "nolast" -N -- "$@"
else
- zle "$hook" -Nw -- "$@"
+ zle "$hook" -f "nolast" -Nw -- "$@"
fi || return
done
return 0
diff --git a/Functions/Misc/colors b/Functions/Misc/colors
index 027ca9a14..5e9d77d10 100644
--- a/Functions/Misc/colors
+++ b/Functions/Misc/colors
@@ -14,11 +14,12 @@ color=(
00 none # 20 gothic
01 bold # 21 double-underline
02 faint 22 normal
- 03 standout 23 no-standout
+ 03 italic 23 no-italic # no-gothic
04 underline 24 no-underline
05 blink 25 no-blink
# 06 fast-blink # 26 proportional
07 reverse 27 no-reverse
+# 07 standout 27 no-standout
08 conceal 28 no-conceal
# 09 strikethrough # 29 no-strikethrough
@@ -82,9 +83,11 @@ for k in ${color[(I)3?]}; do color[fg-${color[$k]}]=$k; done
# This is inaccurate, but the prompt theme system needs it.
-color[grey]=${color[black]}
-color[fg-grey]=${color[grey]}
-color[bg-grey]=${color[bg-black]}
+for k in grey gray; do
+ color[$k]=${color[black]}
+ color[fg-$k]=${color[$k]}
+ color[bg-$k]=${color[bg-black]}
+done
# Assistance for the color-blind.
diff --git a/Functions/Misc/regexp-replace b/Functions/Misc/regexp-replace
index dec105524..d4408f0f7 100644
--- a/Functions/Misc/regexp-replace
+++ b/Functions/Misc/regexp-replace
@@ -8,36 +8,84 @@
# $ and backtick substitutions; in particular, $MATCH will be replaced
# by the portion of the string matched by the regular expression.
-integer pcre
+# we use positional parameters instead of variables to avoid
+# clashing with the user's variable. Make sure we start with 3 and only
+# 3 elements:
+argv=("$1" "$2" "$3")
-[[ -o re_match_pcre ]] && pcre=1
+# $4 records whether pcre is enabled as that information would otherwise
+# be lost after emulate -L zsh
+4=0
+[[ -o re_match_pcre ]] && 4=1
emulate -L zsh
-(( pcre )) && setopt re_match_pcre
-
-# $4 is the string to be matched
-4=${(P)1}
-# $5 is the final string
-5=
-# 6 indicates if we made a change
-6=
+
+
local MATCH MBEGIN MEND
local -a match mbegin mend
-while [[ -n $4 ]]; do
- if [[ $4 =~ $2 ]]; then
- # append initial part and subsituted match
- 5+=${4[1,MBEGIN-1]}${(e)3}
- # truncate remaining string
- 4=${4[MEND+1,-1]}
- # indicate we did something
- 6=1
- else
- break
- fi
-done
-5+=$4
-
-eval ${1}=${(q)5}
-# status 0 if we did something, else 1.
-[[ -n $6 ]]
+if (( $4 )); then
+ # if using pcre, we're using pcre_match and a running offset
+ # That's needed for ^, \A, \b, and look-behind operators to work
+ # properly.
+
+ zmodload zsh/pcre || return 2
+ pcre_compile -- "$2" && pcre_study || return 2
+
+ # $4 is the current *byte* offset, $5, $6 reserved for later use
+ 4=0 6=
+
+ local ZPCRE_OP
+ while pcre_match -b -n $4 -- "${(P)1}"; do
+ # append offsets and computed replacement to the array
+ # we need to perform the evaluation in a scalar assignment so that if
+ # it generates an array, the elements are converted to string (by
+ # joining with the first character of $IFS as usual)
+ 5=${(e)3}
+ argv+=(${(s: :)ZPCRE_OP} "$5")
+
+ # for 0-width matches, increase offset by 1 to avoid
+ # infinite loop
+ 4=$((argv[-2] + (argv[-3] == argv[-2])))
+ done
+
+ (($# > 6)) || return # no match
+
+ set +o multibyte
+
+ # $5 contains the result, $6 the current offset
+ 5= 6=1
+ for 2 3 4 in "$@[7,-1]"; do
+ 5+=${(P)1[$6,$2]}$4
+ 6=$(($3 + 1))
+ done
+ 5+=${(P)1[$6,-1]}
+else
+ # in ERE, we can't use an offset so ^, (and \<, \b, \B, [[:<:]] where
+ # available) won't work properly.
+
+ # $4 is the string to be matched
+ 4=${(P)1}
+
+ while [[ -n $4 ]]; do
+ if [[ $4 =~ $2 ]]; then
+ # append initial part and substituted match
+ 5+=${4[1,MBEGIN-1]}${(e)3}
+ # truncate remaining string
+ if ((MEND < MBEGIN)); then
+ # zero-width match, skip one character for the next match
+ ((MEND++))
+ 5+=${4[1]}
+ fi
+ 4=${4[MEND+1,-1]}
+ # indicate we did something
+ 6=1
+ else
+ break
+ fi
+ done
+ [[ -n $6 ]] || return # no match
+ 5+=$4
+fi
+
+eval $1=\$5
diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help
index e351dd6a6..d52c1b032 100644
--- a/Functions/Misc/run-help
+++ b/Functions/Misc/run-help
@@ -101,12 +101,15 @@ do
builtin getln cmd_args
builtin print -z "$cmd_args"
cmd_args=( ${(z)cmd_args} )
- # Discard environment assignments, etc.
- while [[ $cmd_args[1] != ${run_help_orig_cmd:-$1} ]]
- do
- shift cmd_args || return 1
- done
- eval "run-help-$1:t ${(q@)cmd_args[2,-1]}"
+
+ # Discard the command itself & everything before it.
+ shift $cmd_args[(i)${run_help_orig_cmd:-$1}] cmd_args ||
+ return
+
+ # Discard options, parameter assignments & paths.
+ cmd_args=( ${cmd_args[@]:#([-+]*|*=*|*/*|\~*)} )
+
+ eval "run-help-$1:t ${(@q)cmd_args}"
else
POSIXLY_CORRECT=1 man $@:t
fi
diff --git a/Functions/Misc/run-help-btrfs b/Functions/Misc/run-help-btrfs
new file mode 100644
index 000000000..cb139e9b7
--- /dev/null
+++ b/Functions/Misc/run-help-btrfs
@@ -0,0 +1,18 @@
+case $1 in
+ (b*) man btrfs-balance ;;
+ (c*) man btrfs-check ;;
+ (d*) man btrfs-device ;;
+ (f*) man btrfs-filesystem ;;
+ (i*) man btrfs-inspect-internal ;;
+ (p*) man btrfs-property ;;
+ (qg*) man btrfs-qgroup ;;
+ (qu*) man btrfs-quota ;;
+ (rec*) man btrfs-receive ;;
+ (rep*) man btrfs-replace ;;
+ (resc*) man btrfs-rescue ;;
+ (rest*) man btrfs-restore ;;
+ (sc*) man btrfs-scrub ;;
+ (se*) man btrfs-send ;;
+ (su*) man btrfs-subvolume ;;
+ (*) man btrfs ;;
+esac
diff --git a/Functions/Misc/run-help-git b/Functions/Misc/run-help-git
index ce94d0d02..a841f89d6 100644
--- a/Functions/Misc/run-help-git
+++ b/Functions/Misc/run-help-git
@@ -1,9 +1 @@
-if [ $# -eq 0 ]; then
- man git
-else
- local al
- if al=$(git config --get "alias.$1"); then
- 1=${al%% *}
- fi
- man git-$1
-fi
+git help ${1:-git}
diff --git a/Functions/Misc/run-help-ip b/Functions/Misc/run-help-ip
index 8807f9ef1..b811ce352 100644
--- a/Functions/Misc/run-help-ip
+++ b/Functions/Misc/run-help-ip
@@ -14,10 +14,6 @@ if ! man -w ip-address >/dev/null 2>&1; then
return
fi
-while [[ $# != 0 && $1 == -* ]]; do
- shift
-done
-
case $1 in
(addrl*) man ip-addrlabel ;;
(a*) man ip-address ;;
diff --git a/Functions/Misc/run-help-p4 b/Functions/Misc/run-help-p4
index 662ce94fe..e48a4d068 100644
--- a/Functions/Misc/run-help-p4
+++ b/Functions/Misc/run-help-p4
@@ -2,4 +2,4 @@ if (( ! $# )); then
p4 help commands
else
p4 help $1
-fi | ${=PAGER:-less}
+fi | ${=PAGER:-more}
diff --git a/Functions/Misc/run-help-sudo b/Functions/Misc/run-help-sudo
index f38696e19..a8fa7aa0f 100644
--- a/Functions/Misc/run-help-sudo
+++ b/Functions/Misc/run-help-sudo
@@ -2,6 +2,6 @@
if [ $# -eq 0 ]; then
man sudo
else
- man $1
+ run-help $1
fi
diff --git a/Functions/Misc/run-help-svk b/Functions/Misc/run-help-svk
index 92438a53f..782538246 100644
--- a/Functions/Misc/run-help-svk
+++ b/Functions/Misc/run-help-svk
@@ -1 +1 @@
-svk help ${${@:#-*}[1]} | ${=PAGER:-more}
+svk help $1 | ${=PAGER:-more}
diff --git a/Functions/Misc/run-help-svn b/Functions/Misc/run-help-svn
index 5d1068588..d55a493a6 100644
--- a/Functions/Misc/run-help-svn
+++ b/Functions/Misc/run-help-svn
@@ -1 +1 @@
-svn help ${${@:#-*}[1]} | ${=PAGER:-more}
+svn help $1 | ${=PAGER:-more}
diff --git a/Functions/Misc/zargs b/Functions/Misc/zargs
index 28ebca78f..81916a3ac 100644
--- a/Functions/Misc/zargs
+++ b/Functions/Misc/zargs
@@ -43,14 +43,12 @@
# than 127 for "command not found" so this function incorrectly returns
# 123 in that case if used with zsh 4.0.x.
#
-# With the --max-procs option, zargs may not correctly capture the exit
-# status of the backgrounded jobs, because of limitations of the "wait"
-# builtin. If the zsh/parameter module is not available, the status is
-# NEVER correctly returned, otherwise the status of the longest-running
-# job in each batch is captured.
+# Because of "wait" limitations, --max-procs spawns max-procs jobs, then
+# waits for all of those, then spawns another batch, etc.
#
-# Also because of "wait" limitations, --max-procs spawns max-procs jobs,
-# then waits for all of those, then spawns another batch, etc.
+# The maximum number of parallel jobs for which exit status is available
+# is determined by the sysconf CHILD_MAX parameter, which can't be read
+# or changed from within the shell.
#
# Differences from POSIX xargs:
#
@@ -69,11 +67,27 @@
# -I/-L and implementations reportedly differ.) In zargs, -i/-I have
# this behavior, as do -l/-L, but when -i/-I appear anywhere then -l/-L
# are ignored (forced to 1).
+#
+# * The use of SIGUSR1 and SIGUSR2 to change the number of parallel jobs
+# is not supported.
+
+# First, capture the current setopts as "sticky emulation"
+if zmodload zsh/parameter
+then
+ emulate $(emulate -l) -c "\
+ _zarun() {
+ options=( ${(j: :kv)options[@]} monitor off zle off )"'
+ eval "$@"
+ }'
+else
+ # Warning?
+ emulate $(emulate -l) -c '_zarun() { eval "$@" }'
+fi
emulate -L zsh || return 1
local -a opts eof n s l P i
-local ZARGS_VERSION="1.5"
+local ZARGS_VERSION="1.7"
if zparseopts -a opts -D -- \
-eof::=eof e::=eof \
@@ -186,8 +200,8 @@ local execute='
elif (( $opts[(I)-(-verbose|t)] ))
then print -u2 -r -- "$call"
fi
- eval "{
- \"\${(@)call}\"
+ _zarun "{
+ \"\${call[@]}\"
} $bg"'
local ret=0 analyze='
case $? in
@@ -251,17 +265,19 @@ if (( P != 1 && ARGC > 1 ))
then
# These setopts are necessary for "wait" on multiple jobs to work.
setopt nonotify nomonitor
- bg='&'
- if zmodload -i zsh/parameter 2>/dev/null
- then
- wait='wait ${${jobstates[(R)running:*]/#*:/}/%=*/}'
- else
- wait='wait'
- fi
+ local -a _zajobs
+ local j
+ bg='& _zajobs+=( $! )'
+ wait='wait'
+ analyze='
+ for j in $_zajobs; do
+ wait $j
+ '"$analyze"'
+ done; _zajobs=()'
fi
-# Everything has to be in a subshell just in case of backgrounding jobs,
-# so that we don't unintentionally "wait" for jobs of the parent shell.
+# Everything has to be in a subshell so that we don't "wait" for any
+# unrelated jobs of the parent shell.
(
while ((ARGC))
diff --git a/Functions/Misc/zed b/Functions/Misc/zed
index 9eb4b2d93..7d0d590db 100644
--- a/Functions/Misc/zed
+++ b/Functions/Misc/zed
@@ -5,16 +5,18 @@
# Edit small files with the command line editor.
# Use ^X^W to save (or ZZ in vicmd mode), ^C to abort.
# Option -f: edit shell functions. (Also if called as fned.)
+# Option -h: edit shell history. (Also if called as histed.)
setopt localoptions noksharrays
local var opts zed_file_name
# We do not want timeout while we are editing a file
-integer TMOUT=0 okargs=1 fun bind
+integer TMOUT=0 okargs=1 fun hist bind
local -a expand
-zparseopts -D -A opts f b x:
+zparseopts -D -A opts f h b x:
fun=$+opts[-f]
+hist=$+opts[-h]
bind=$+opts[-b]
if [[ $opts[-x] == <-> ]]; then
expand=(-x $opts[-x])
@@ -24,23 +26,28 @@ elif (( $+opts[-x] )); then
fi
[[ $0 = fned ]] && fun=1
+[[ $0 = histed ]] && hist=1
+(( hist && $# <= 2 )) && okargs=$#
(( bind )) && okargs=0
-if (( $# != okargs )); then
+if (( $# != okargs || bind + fun + hist > 1 )); then
echo 'Usage:
zed filename
zed -f [ -x N ] function
+zed -h [ filename [ size ] ]
zed -b' >&2
return 1
fi
local curcontext=zed:::
-# Matching used in zstyle -m: hide result from caller.
-# Variables not used directly here.
-local -a match mbegin mend
-zstyle -m ":completion:zed:*" insert-tab '*' ||
- zstyle ":completion:zed:*" insert-tab yes
+() {
+ # Matching used in zstyle -m: hide result from caller.
+ # Variables not used directly here.
+ local -a match mbegin mend
+ zstyle -m ":completion:zed:*" insert-tab '*' ||
+ zstyle ":completion:zed:*" insert-tab yes
+}
zmodload zsh/terminfo 2>/dev/null
@@ -124,22 +131,51 @@ fi
setopt localoptions nobanghist
if ((fun)) then
- var="$(functions $expand -- $1)"
+ var="$(functions $expand -- "$1")"
# If function is undefined but autoloadable, load it
if [[ $var = *\#\ undefined* ]] then
- var="$(autoload +X $1; functions -- $1)"
+ var="$(autoload +X "$1"; functions -- "$1")"
elif [[ -z $var ]] then
var="${(q-)1} () {
}"
fi
vared -M zed -m zed-vicmd -i __zed_init var && eval function "$var"
+elif ((hist)) then
+ if [[ -n $1 ]]; then
+ { fc -p -a "$1" ${2:-$({ wc -l <"$1" } 2>/dev/null)} || return }
+ let HISTSIZE++
+ print -s "" # Work around fc -p limitation
+ fi
+ # When editing the current shell history, the "zed -h" command is not
+ # itself included because the current event is not added to the ring
+ # until the next prompt is printed. This means "zed -h" is prepended
+ # to the result of the edit, because of the way "print -s" is defined.
+ var=( "${(@Oav)history}" )
+ IFS=$'\n' vared -M zed -m zed-vicmd -i __zed_init var
+ if (( ? )); then
+ [[ -n $1 ]] && unset HISTFILE
+ else
+ local HISTSIZE=0 savehist=$#var
+ fc -R /dev/null # Remove entries other than those added here
+ HISTSIZE=$savehist # Resets on function exit because local
+ [[ -n $1 ]] && SAVEHIST=$savehist # Resets via foregoing fc -a
+ for (( hist=1; hist <= savehist; hist++ ))
+ do print -rs -- "$var[hist]"
+ done
+ if [[ -n $zed_file_name ]]; then
+ fc -W "$zed_file_name"
+ [[ -n $1 ]] && unset HISTFILE
+ fi
+ # Note prepend effect when global HISTSIZE greater than $savehist.
+ # This does not affect file editing.
+ fi
else
- zed_file_name=$1
- [[ -f $1 ]] && var="$(<$1)"
+ zed_file_name="$1"
+ [[ -f $1 ]] && var="$(<"$1")"
while vared -M zed -m zed-vicmd -i __zed_init var
do
{
- print -r -- "$var" >| $zed_file_name
+ print -r -- "$var" >| "$zed_file_name"
} always {
(( TRY_BLOCK_ERROR = 0 ))
} && break
diff --git a/Functions/Misc/zmathfuncdef b/Functions/Misc/zmathfuncdef
index e5692e769..5ed991f68 100644
--- a/Functions/Misc/zmathfuncdef
+++ b/Functions/Misc/zmathfuncdef
@@ -78,7 +78,7 @@ if ! zmodload -e zsh/mathfunc; then
fi
{
- eval "$fname() { (( $body )) }"
+ eval "$fname() { (( $body )); true }"
} always {
# Remove math function if shell function definition failed.
if (( TRY_BLOCK_ERROR )); then
diff --git a/Functions/Newuser/zsh-newuser-install b/Functions/Newuser/zsh-newuser-install
index 60ac16b13..9e911d07c 100644
--- a/Functions/Newuser/zsh-newuser-install
+++ b/Functions/Newuser/zsh-newuser-install
@@ -627,7 +627,7 @@ Type:
}
-# Print and despatch a submenu.
+# Print and dispatch a submenu.
# The first argument is the title. The remaining arguments
# are pairs of descriptions and functions to execute.
# There shouldn't be more than 9 entries.
diff --git a/Functions/Prompts/prompt_restore_setup b/Functions/Prompts/prompt_restore_setup
index 54c4adbf9..b77dbe815 100644
--- a/Functions/Prompts/prompt_restore_setup
+++ b/Functions/Prompts/prompt_restore_setup
@@ -1,2 +1,3 @@
# Damn that was easy
zstyle -t :prompt-theme cleanup
+zstyle -t :prompt-theme restore
diff --git a/Functions/Prompts/promptinit b/Functions/Prompts/promptinit
index e27b8779a..0c06699e8 100644
--- a/Functions/Prompts/promptinit
+++ b/Functions/Prompts/promptinit
@@ -14,6 +14,8 @@ prompt_themes=()
promptinit () {
emulate -L zsh
setopt extendedglob
+ autoload -Uz add-zsh-hook add-zle-hook-widget
+
local ppath='' name theme
local -a match mbegin mend
@@ -32,9 +34,6 @@ promptinit () {
fi
done
- # To manipulate precmd and preexec hooks...
- autoload -Uz add-zsh-hook
-
# Variables common to all prompt styles
prompt_newline=$'\n%{\r%}'
}
@@ -47,36 +46,23 @@ prompt_preview_safely() {
return
fi
- # This handles all the stuff from the default :prompt-theme cleanup
- local +h PS1=$PS1 PS2=$PS2 PS3=$PS3 PS4=$PS4 RPS1=$RPS1 RPS2=$RPS2
- local +h PROMPT=$PROMPT RPROMPT=$RPOMPT RPROMPT2=$RPROMPT2 PSVAR=$PSVAR
- local -a precmd_functions preexec_functions prompt_preview_cleanup
- local -aLl +h zle_highlight
+ # Run this in a subshell, so we don't need to clean up afterwards.
+ (
+ # Execute current theme's cleanup sequence, if any.
+ zstyle -t :prompt-theme cleanup
- {
- # Save and clear current restore-point if any
- zstyle -g prompt_preview_cleanup :prompt-theme cleanup
- {
- zstyle -d :prompt-theme cleanup
-
- # The next line is a bit ugly. It (perhaps unnecessarily)
- # runs the prompt theme setup function to ensure that if
- # the theme has a _preview function that it's been autoloaded.
+ # If we can't find a _preview function, run the _setup function to see if
+ # it will create one.
+ typeset +f prompt_${1}_preview >&/dev/null ||
prompt_${1}_setup
- if typeset +f prompt_${1}_preview >&/dev/null; then
- prompt_${1}_preview "$@[2,-1]"
- else
- prompt_preview_theme "$@"
- fi
- } always {
- # Run any theme-specific cleanup, then reset restore point
- zstyle -t :prompt-theme cleanup
- }
- } always {
- (( $#prompt_preview_cleanup )) &&
- zstyle -e :prompt-theme cleanup "${prompt_preview_cleanup[@]}"
- }
+ # ...then try again.
+ if typeset +f prompt_${1}_preview >&/dev/null; then
+ prompt_${1}_preview "$@[2,-1]"
+ else
+ prompt_preview_theme "$@"
+ fi
+ )
}
set_prompt() {
@@ -87,7 +73,7 @@ set_prompt() {
Options:
-c Show currently selected theme and parameters
-l List currently available prompt themes
- -p [<themes>] Preview given themes (defaults to all)
+ -p [<themes>] Preview given themes (defaults to all except current theme)
-h [<theme>] Display help (for given theme)
-s <theme> Set and save theme
<theme> Switch to new theme immediately (changes not saved)
@@ -96,19 +82,6 @@ Use prompt -h <theme> for help on specific themes.'
getopts "chlps:" opt
case "$opt" in
- (h|p)
- setopt localtraps
- if [[ -z "$prompt_theme[1]" ]]; then
- # Not using a prompt theme; save settings
- local +h PS1=$PS1 PS2=$PS2 PS3=$PS3 PS4=$PS4 RPS1=$RPS1 RPS2=$RPS2
- local +h PROMPT=$PROMPT RPROMPT=$RPOMPT RPROMPT2=$RPROMPT2 PSVAR=$PSVAR
- local -a precmd_functions preexec_functions
- else
- trap 'prompt_${prompt_theme[1]}_setup "${(@)prompt_theme[2,-1]}"' 0
- fi
- ;;
- esac
- case "$opt" in
c) if [[ -n $prompt_theme ]]; then
print -n "Current prompt theme"
(( $#prompt_theme > 1 )) && print -n " with parameters"
@@ -119,20 +92,26 @@ Use prompt -h <theme> for help on specific themes.'
return
;;
h) if [[ -n "$2" && -n $prompt_themes[(r)$2] ]]; then
- if functions prompt_$2_setup >/dev/null; then
- # The next line is a bit ugly. It (perhaps unnecessarily)
- # runs the prompt theme setup function to ensure that if
- # the theme has a _help function that it's been autoloaded.
- prompt_$2_setup
- fi
- if functions prompt_$2_help >/dev/null; then
- print "Help for $2 theme:\n"
- prompt_$2_help
- else
- print "No help available for $2 theme."
- fi
- print "\nType \`prompt -p $2' to preview the theme, \`prompt $2'"
- print "to try it out, and \`prompt -s $2' to use it in future sessions."
+ # Run this in a subshell, so we don't need to clean up afterwards.
+ (
+ # Execute current theme's cleanup sequence, if any.
+ zstyle -t :prompt-theme cleanup
+
+ # If we can't find a _help function, run the _setup function to see
+ # if it will create one.
+ typeset +f prompt_$2_help >/dev/null ||
+ prompt_$2_setup
+
+ # ...then try again.
+ if typeset +f prompt_$2_help >/dev/null; then
+ print "Help for $2 theme:\n"
+ prompt_$2_help
+ else
+ print "No help available for $2 theme."
+ fi
+ print "\nType \`prompt -p $2' to preview the theme, \`prompt $2'"
+ print "to try it out, and \`prompt -s $2' to use it in future sessions."
+ )
else
print "$usage"
fi
@@ -141,10 +120,9 @@ Use prompt -h <theme> for help on specific themes.'
print $prompt_themes
return
;;
- p) preview=( $prompt_themes )
+ p) preview=( ${prompt_themes:#$prompt_theme} )
(( $#* > 1 )) && preview=( "$@[2,-1]" )
for theme in $preview; do
- [[ "$theme" == "$prompt_theme[*]" ]] && continue
prompt_preview_safely "$=theme"
done
print -P "%b%f%k"
@@ -173,34 +151,46 @@ Use prompt -h <theme> for help on specific themes.'
# Reset some commonly altered bits to the default
local hook
- for hook in chpwd precmd preexec periodic zshaddhistory zshexit; do
- add-zsh-hook -D "${hook}" "prompt_*_${hook}"
+ for hook in chpwd precmd preexec periodic zshaddhistory zshexit \
+ zsh_directory_name; do
+ add-zsh-hook -D "$hook" "prompt_*_$hook"
+ done
+ for hook in isearch-exit isearch-update line-pre-redraw line-init \
+ line-finish history-line-set keymap-select; do
+ add-zle-hook-widget -D "$hook" "prompt_*_$hook"
done
typeset -ga zle_highlight=( ${zle_highlight:#default:*} )
(( ${#zle_highlight} )) || unset zle_highlight
+ zstyle -t :prompt-theme cleanup
prompt_$1_setup "$@[2,-1]" && prompt_theme=( "$@" )
;;
esac
}
prompt_cleanup () {
- local -a cleanup_hooks
- if zstyle -g cleanup_hooks :prompt-theme cleanup
- then
- cleanup_hooks+=(';' "$@")
- zstyle -e :prompt-theme cleanup "${cleanup_hooks[@]}"
- elif (( $+prompt_preview_cleanup == 0 ))
- then
- print -u2 "prompt_cleanup: no prompt theme active"
- return 1
+ local -a cleanup_hooks theme_active
+ if ! zstyle -g cleanup_hooks :prompt-theme cleanup; then
+ if ! zstyle -g theme_active :prompt-theme restore; then
+ print -u2 "prompt_cleanup: no prompt theme active"
+ return 1
+ fi
+
+ # Set the cleanup sequence up.
+ zstyle -e :prompt-theme cleanup \
+ 'zstyle -d :prompt-theme cleanup;' \
+ 'reply=(yes)'
+ zstyle -g cleanup_hooks :prompt-theme cleanup
fi
+
+ cleanup_hooks+=(';' "$@")
+ zstyle -e :prompt-theme cleanup "${cleanup_hooks[@]}"
}
prompt () {
local -a prompt_opts theme_active
- zstyle -g theme_active :prompt-theme cleanup || {
+ zstyle -g theme_active :prompt-theme restore || {
# This is done here rather than in set_prompt so that it
# is safe and sane for set_prompt to setopt localoptions,
# which will be cleared before we arrive back here again.
@@ -210,22 +200,21 @@ prompt () {
[[ -o promptpercent ]] && prompt_opts+=(percent)
[[ -o promptsp ]] && prompt_opts+=(sp)
[[ -o promptsubst ]] && prompt_opts+=(subst)
- zstyle -e :prompt-theme cleanup \
- 'zstyle -d :prompt-theme cleanup;' \
- 'prompt_default_setup;' \
- ${PS1+PS1="${(q)PS1}"} \
- ${PS2+PS2="${(q)PS2}"} \
- ${PS3+PS3="${(q)PS3}"} \
- ${PS4+PS4="${(q)PS4}"} \
- ${RPS1+RPS1="${(q)RPS1}"} \
- ${RPS2+RPS2="${(q)RPS2}"} \
- ${RPROMPT+RPROMPT="${(q)RPROMPT}"} \
- ${RPROMPT2+RPROMPT2="${(q)RPROMPT2}"} \
- ${PSVAR+PSVAR="${(q)PSVAR}"} \
- "precmd_functions=(${(q)precmd_functions[@]})" \
- "preexec_functions=(${(q)preexec_functions[@]})" \
- "prompt_opts=( ${prompt_opts[*]} )" \
- 'reply=(yes)'
+ zstyle -e :prompt-theme restore "
+ zstyle -d :prompt-theme restore
+ prompt_default_setup
+ ${PS1+PS1=${(q+)PS1}}
+ ${PS2+PS2=${(q+)PS2}}
+ ${PS3+PS3=${(q+)PS3}}
+ ${PS4+PS4=${(q+)PS4}}
+ ${RPS1+RPS1=${(q+)RPS1}}
+ ${RPS2+RPS2=${(q+)RPS2}}
+ ${RPROMPT+RPROMPT=${(q+)RPROMPT}}
+ ${RPROMPT2+RPROMPT2=${(q+)RPROMPT2}}
+ ${PSVAR+PSVAR=${(q+)PSVAR}}
+ prompt_opts=( $prompt_opts[*] )
+ reply=( yes )
+ "
}
set_prompt "$@"
@@ -238,26 +227,29 @@ prompt () {
prompt_preview_theme () {
emulate -L zsh
- # Check for proper state handling
- (( $+prompt_preview_cleanup )) || {
- prompt_preview_safely "$@"
- return
- }
-
# Minimal preview for prompts that don't supply one
local -a prompt_opts
print -n "$1 theme"
(( $#* > 1 )) && print -n " with parameters \`$*[2,-1]'"
print ":"
+ zstyle -t :prompt-theme cleanup
prompt_${1}_setup "$@[2,-1]"
(( ${#prompt_opts} )) &&
setopt noprompt{bang,cr,percent,sp,subst} "prompt${^prompt_opts[@]}"
+
+ [[ -n ${chpwd_functions[(r)prompt_${1}_chpwd]} ]] &&
+ prompt_${1}_chpwd
[[ -n ${precmd_functions[(r)prompt_${1}_precmd]} ]] &&
- prompt_${1}_precmd
- [[ -o promptcr ]] && print -n $'\r'; :
- print -P "${PS1}command arg1 arg2 ... argn"
+ prompt_${1}_precmd
+
+ # We'd like to call zle-line-init/finish hooks, too, but that's not possible
+ # while the ZLE is not active.
+
+ [[ -o promptcr ]] && print -n $'\r'
+ :; print -P -- "${PS1}command arg1 arg2 ... argn"
+
[[ -n ${preexec_functions[(r)prompt_${1}_preexec]} ]] &&
- prompt_${1}_preexec
+ prompt_${1}_preexec
}
[[ -o kshautoload ]] || promptinit "$@"
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs b/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
index 7a5ee1eef..a57959ec9 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_cvs
@@ -7,5 +7,18 @@ setopt localoptions NO_shwordsplit
[[ $1 == '--flavours' ]] && return 1
VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
-[[ -d "./CVS" ]] && [[ -r "./CVS/Repository" ]] && return 0
-return 1
+if ! [[ -d "./CVS" ]] || ! [[ -r "./CVS/Repository" ]] ; then
+ return 1
+fi
+
+# Look for the most distant parent that still has a CVS subdirectory.
+local cvsbase="."
+cvsbase=${cvsbase:P}
+while [[ -d "${cvsbase:h}/CVS" ]]; do
+ cvsbase="${cvsbase:h}"
+ if [[ $cvsbase == '/' ]]; then
+ break
+ fi
+done
+
+vcs_comm[basedir]="${cvsbase}"
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_git b/Functions/VCS_Info/Backends/VCS_INFO_detect_git
index e4191f474..b7955de38 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_git
@@ -7,6 +7,7 @@ setopt localoptions NO_shwordsplit
[[ $1 == '--flavours' ]] && { print -l git-p4 git-svn; return 0 }
if VCS_INFO_check_com ${vcs_comm[cmd]} && vcs_comm[gitdir]="$(${vcs_comm[cmd]} rev-parse --git-dir 2> /dev/null)" ; then
+ vcs_comm[basedir]="$( ${vcs_comm[cmd]} rev-parse --show-toplevel 2> /dev/null )"
if [[ -d ${vcs_comm[gitdir]}/svn ]] ; then vcs_comm[overwrite_name]='git-svn'
elif [[ -d ${vcs_comm[gitdir]}/refs/remotes/p4 ]] ; then vcs_comm[overwrite_name]='git-p4' ; fi
return 0
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
index b30e0e12b..f1f5527e8 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
@@ -100,14 +100,7 @@ else
fi
rrn=${bzrbase:t}
-zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat bzrbr || bzrbr="%b:%r"
-hook_com=( branch "${bzrinfo[2]}" revision "${bzrinfo[1]}" )
-if VCS_INFO_hook 'set-branch-format' "${bzrbr}"; then
- zformat -f bzrbr "${bzrbr}" "b:${hook_com[branch]}" "r:${hook_com[revision]}"
-else
- bzrbr=${hook_com[branch-replace]}
-fi
-hook_com=()
-
+VCS_INFO_set-branch-format "${bzrinfo[2]}" "${bzrinfo[1]}" &&
+ bzrbr="${REPLY}"
VCS_INFO_formats '' "${bzrbr}" "${bzrbase}" '' "${bzr_changes}" "${bzrinfo[1]}" "${bzr_changes}"
return 0
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs
index 9b828bd11..bc0d5cfe5 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs
@@ -5,17 +5,8 @@
setopt localoptions NO_shwordsplit
local cvsbranch cvsbase
-# Look for the most distant parent that still has a CVS subdirectory.
+cvsbase="${vcs_comm[basedir]}"
# VCS_INFO_detect_cvs ensured that ./CVS/Repository exists.
-cvsbase="."
-cvsbase=${cvsbase:P}
-while [[ -d "${cvsbase:h}/CVS" ]]; do
- cvsbase="${cvsbase:h}"
- if [[ $cvsbase == '/' ]]; then
- break
- fi
-done
-
cvsbranch=$(< ./CVS/Repository)
rrn=${cvsbase:t}
cvsbranch=${cvsbranch##${rrn}/}
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_fossil b/Functions/VCS_Info/Backends/VCS_INFO_get_data_fossil
index fd0f8389e..e84b3abc0 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_fossil
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_fossil
@@ -20,5 +20,6 @@ if [ -n "$merging" ]; then
action="merging"
fi
+rrn=${fsinfo[local_root]:t}
VCS_INFO_formats "$action" "${fsbranch}" "${fsinfo[local_root]}" '' "$changed" "${fshash}" "${fsinfo[repository]}"
return 0
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index ceb4f978a..e45eebc8e 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -132,13 +132,17 @@ VCS_INFO_git_handle_patches () {
VCS_INFO_set-patch-format 'git_patches_applied' 'git_applied_s' \
'git_patches_unapplied' 'git_unapplied_s' \
":vcs_info:${vcs}:${usercontext}:${rrn}" gitmsg \
- '' ''
+ '' '' ''
gitmisc=$REPLY
}
gitdir=${vcs_comm[gitdir]}
VCS_INFO_git_getbranch ${gitdir}
-gitbase=$( ${vcs_comm[cmd]} rev-parse --show-toplevel )
+gitbase=${vcs_comm[basedir]}
+if [[ -z ${gitbase} ]]; then
+ # Bare repository
+ gitbase=${gitdir:P}
+fi
rrn=${gitbase:t}
if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then
gitsha1=$(${vcs_comm[cmd]} rev-parse --quiet --verify HEAD)
@@ -192,13 +196,19 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then
# 'git rebase -i'
patchdir="${gitdir}/rebase-merge"
local p
- [[ -f "${patchdir}/done" ]] &&
- for p in ${(f)"$(< "${patchdir}/done")"}; do
+ (( ${+functions[VCS_INFO_git_map_rebase_line_to_hash_and_subject]} )) ||
+ VCS_INFO_git_map_rebase_line_to_hash_and_subject() {
+ local p=$1
+ unset REPLY
# pick/edit/fixup/squash/reword: Add "$hash $subject" to $git_patches_applied.
# exec: Add "exec ${command}" to $git_patches_applied.
# (anything else): As 'exec'.
case $p in
- ((p|pick|e|edit|r|reword|f|fixup|s|squash)' '*)
+ ([#]*)
+ # Comment line. Skip.
+ return 0
+ ;;
+ (''(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#* }
@@ -221,11 +231,11 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then
p="${p%% *} ?"
fi
;;
- (x *)
+ (''(x|exec) *)
# 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 }
+ p=${p/#x /exec }
;;
(*)
# Forward compatibility with not-yet-existing 'git rebase -i' verbs.
@@ -233,30 +243,74 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then
p+=" ?"
fi
esac
- git_patches_applied+=("$p")
- done
+ REPLY=$p
+ }
+ if [[ -f "${patchdir}/done" ]] ; then
+ for p in ${(f)"$(< "${patchdir}/done")"}; do
+ VCS_INFO_git_map_rebase_line_to_hash_and_subject "$p"
+ (( $+REPLY )) && git_patches_applied+=( "$REPLY" )
+ done
+ fi
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")"}}:#[#]*} )
+ for p in ${(f)"$(< "${patchdir}/git-rebase-todo")"}; do
+ VCS_INFO_git_map_rebase_line_to_hash_and_subject "$p"
+ (( $+REPLY )) && git_patches_unapplied+=( "$REPLY" )
+ done
fi
VCS_INFO_git_handle_patches
elif [[ -d "${gitdir}/rebase-apply" ]]; then
- # 'git rebase' without -i
+ # 'git rebase' without -i, or 'git am'
patchdir="${gitdir}/rebase-apply"
local next="${patchdir}/next"
+ local this_patch_file
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
+ # Compute patch names for patches "before" the current patch
+ if [[ -r ${patchdir}/rewritten ]]; then
+ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" use-simple; then
+ git_patches_applied=( ${${(f)"$(<${patchdir}/rewritten)"}// */' ?'} )
+ else
+ git_patches_applied=(
+ ${(f)"$(${vcs_comm[cmd]} log --no-walk=unsorted --pretty='%h %s' ${${(f)"$(<${patchdir}/rewritten)"}%% *} --)"}
+ )
+ fi
+ else
+ # Compatibility with old git. In 2.11 and 2.24, at least,
+ # (( cur == 1 )), so the loop body would never run. However, both
+ # of these versions have original-commit and orig-head and would
+ # take the 'if' branch, rather than this 'else' branch.
+ for ((p = 1; p < cur; p++)); do
+ printf -v this_patch_file "%s/%04d" "${patchdir}" "${p}"
+ if [[ -f $this_patch_file ]]; then
+ VCS_INFO_patch2subject "${this_patch_file}"
+ git_patches_applied+=( "$p $REPLY" )
+ else
+ git_patches_applied+=( "$p ?" )
+ fi
+ done
+ fi
+ # Set $subject to the info for the current patch
if [[ -f "${patchdir}/msg-clean" ]]; then
subject="${$(< "${patchdir}/msg-clean")[(f)1]}"
- elif local this_patch_file
- printf -v this_patch_file "%s/%04d" "${patchdir}" "${cur}"
+ elif [[ -f "${patchdir}/final-commit" ]]; then
+ # This value is not rfc2047-encoded. It's also available via
+ # "${patchdir}/info".
+ subject="${$(< "${patchdir}/final-commit")[(f)1]}"
+ elif printf -v this_patch_file "%s/%04d" "${patchdir}" "${cur}"
[[ -f $this_patch_file ]]
then
+ # This branch is last for several reasons:
+ #
+ # - The "Subject" header will be MIME-encoded (rfc2047).
+ #
+ # - If the mail has full rfc822 headers (including "Received" and
+ # so on), we won't find the "Subject:" header, since
+ # VCS_INFO_patch2subject only checks the first few lines.
+ #
+ # - In --scissors mode, we may find the outer "Subject:" header,
+ # whereas the inner one (after the scissors line) will be used,
+ # if present.
() {
local REPLY
VCS_INFO_patch2subject "${this_patch_file}"
@@ -266,14 +320,32 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then
subject=${subject:-'?'}
if [[ -f "${patchdir}/original-commit" ]]; then
git_patches_applied+=("$(< ${patchdir}/original-commit) $subject")
+ elif [[ -f "${patchdir}/next" ]]; then
+ git_patches_applied+=("$(< ${patchdir}/next) $subject")
else
git_patches_applied+=("? $subject")
fi
- local last="$(< "${patchdir}/last")"
- if (( cur+1 <= last )); then
- git_patches_unapplied=( {$((cur+1))..$last} )
+ # Handle patches scheduled for after the current patch, if instructed to.
+ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-unapplied; then
+ local last="$(< "${patchdir}/last")"
+ if [[ -r ${patchdir}/original-commit && -r ${patchdir}/orig-head ]] &&
+ ! zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" use-simple
+ then
+ git_patches_unapplied+=( ${(f)"$(${vcs_comm[cmd]} log --reverse --pretty="%h %s" "$(<${patchdir}/original-commit)..$(<${patchdir}/orig-head)")"} )
+ else
+ for ((p = cur+1; p <= last; p++)); do
+ printf -v this_patch_file "%s/%04d" "${patchdir}" "${p}"
+ if [[ -f $this_patch_file ]]; then
+ VCS_INFO_patch2subject "${this_patch_file}"
+ git_patches_unapplied+=( "$p $REPLY" )
+ else
+ git_patches_unapplied+=( "$p ?" )
+ fi
+ done
+ fi
fi
fi
+ unset this_patch_file
VCS_INFO_git_handle_patches
elif [[ -f "${gitdir}/MERGE_HEAD" ]]; then
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
index cd5ef321d..ea3798b81 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
@@ -5,7 +5,7 @@
setopt localoptions extendedglob NO_shwordsplit
-local hgbase bmfile branchfile rebasefile dirstatefile mqseriesfile \
+local hgbase bmfile branchfile topicfile rebasefile dirstatefile mqseriesfile \
curbmfile curbm \
mqstatusfile mqguardsfile patchdir mergedir \
r_csetid r_lrev r_branch i_bmhash i_bmname \
@@ -14,7 +14,7 @@ local hgbase bmfile branchfile rebasefile dirstatefile mqseriesfile \
local -a hgid_args defrevformat defbranchformat \
hgbmarks mqpatches mqguards mqunapplied hgmisc \
- i_patchguards i_negguards i_posguards
+ i_patch i_patchguards i_negguards i_posguards
local -A hook_com
@@ -27,6 +27,7 @@ mergedir="${hgbase}/.hg/merge/"
bmfile="${hgbase}/.hg/bookmarks"
curbmfile="${hgbase}/.hg/bookmarks.current"
branchfile="${hgbase}/.hg/branch"
+topicfile="${hgbase}/.hg/topic"
rebasefile="${hgbase}/.hg/rebasestate"
dirstatefile="${hgbase}/.hg/dirstate"
mqstatusfile="${patchdir}/status" # currently applied patches
@@ -48,27 +49,34 @@ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then
# Settling for a short (but unique!) hash because getting the full
# 40-char hash in addition to all the other info we want isn't
# available in a single hg invocation
- hgid_args=( id -i -n -b )
+ hgid_args=( id -i -n )
# Looking for changes is a tad bit slower since the dirstate cache must
# first be refreshed before being read
zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" \
"check-for-changes" || hgid_args+=( -r. )
- local HGPLAIN
HGPLAIN=1 ${vcs_comm[cmd]} ${(z)hgid_args} 2> /dev/null \
- | read -r r_csetid r_lrev r_branch
+ | read -r r_csetid r_lrev
fi
fi
# If the user doesn't opt to invoke hg we can still get the current branch
-if [[ -z ${r_branch} && -r ${branchfile} ]] ; then
+if [[ -r ${branchfile} ]] ; then
r_branch=$(< ${branchfile})
fi
# If we still don't know the branch it's safe to assume default
[[ -n ${r_branch} ]] || r_branch="default"
+# Show topic if there is any (the UI for this experimental concept is not yet
+# final, but for a long time the convention has been to join the branch name
+# and the topic name by a colon)
+if [[ -f ${topicfile} && -r ${topicfile} && -s ${topicfile} ]] ; then
+ IFS= read -r REPLY < ${topicfile}
+ r_branch=${r_branch}:${REPLY}
+fi
+
# The working dir has uncommitted-changes if the revision ends with a +
if [[ $r_lrev[-1] == + ]] ; then
hgchanges=1
@@ -175,6 +183,9 @@ if zstyle -T ":vcs_info:${vcs}:${usercontext}:${rrn}" get-mq \
# Skip commented lines
[[ ${i_patch} == [[:space:]]#"#"* ]] && continue
+ # Skip applied patches
+ (( ${+mqpatches[(re)${i_patch}]} )) && continue
+
# Separate negative and positive guards to more easily find the
# intersection of active guards with patch guards
i_patchguards=( ${(s: :)i_patchguards} )
@@ -208,12 +219,16 @@ if zstyle -T ":vcs_info:${vcs}:${usercontext}:${rrn}" get-mq \
fi
local -A extra_hook_com=( guards "${guards_string}" guards-n ${#mqguards} )
- local -a extra_zformats=( "g:${extra_hook_com[guards]}" "G:${#mqguards}" )
+
+ (( ${+functions[VCS_INFO_hg_extra_zformats]} )) ||
+ VCS_INFO_hg_extra_zformats() {
+ reply=( "g:${hook_com[guards]}" "G:${#mqguards}" )
+ }
VCS_INFO_set-patch-format 'mqpatches' 'applied_string' \
'mqunapplied' 'unapplied_string' \
":vcs_info:${vcs}:${usercontext}:${rrn}" hgmqstring \
- extra_hook_com extra_zformats
+ extra_hook_com VCS_INFO_hg_extra_zformats ''
hgmqstring=$REPLY
fi
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 b/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4
index 329884982..e8a08a663 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4
@@ -17,13 +17,8 @@ local p4branch change
# here down is synced as the revision.
# I suppose the following might be slow on a tortuous client view.
change="${${$(${vcs_comm[cmd]} changes -m 1 ...\#have)##Change }%% *}"
-zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat p4branch || p4branch="%b:%r"
-hook_com=( branch "${p4info[Client_name]}" revision "${change}" )
-if VCS_INFO_hook 'set-branch-format' "${p4branch}"; then
- zformat -f p4branch "${p4branch}" "b:${hook_com[branch]}" "r:${hook_com[revision]}"
-else
- p4branch=${hook_com[branch-replace]}
-fi
-hook_com=()
+rrn=${p4base:t}
+VCS_INFO_set-branch-format "${p4info[Client_name]}" "${change}" &&
+ p4branch="${REPLY}"
VCS_INFO_formats '' "${p4branch}" "${p4base}" '' '' "$change" ''
return 0
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svk b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svk
index 1d2d22ffb..149e30222 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svk
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svk
@@ -8,13 +8,7 @@ local -A hook_com
svkbase=${vcs_comm[basedir]}
rrn=${svkbase:t}
-zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svkbranch || svkbranch="%b:%r"
-hook_com=( branch "${vcs_comm[branch]}" revision "${vcs_comm[revision]}" )
-if VCS_INFO_hook 'set-branch-format' "${svkbranch}"; then
- zformat -f svkbranch "${svkbranch}" "b:${hook_com[branch]}" "r:${hook_com[revision]}"
-else
- svkbranch=${hook_com[branch-replace]}
-fi
-hook_com=()
+VCS_INFO_set-branch-format "${vcs_comm[branch]}" "${vcs_comm[revision]}" &&
+ svkbranch="${REPLY}"
VCS_INFO_formats '' "${svkbranch}" "${svkbase}" '' '' "${vcs_comm[revision]}" ''
return 0
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
index 21590addd..b33efc2fb 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
@@ -10,6 +10,7 @@ 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
+integer -r SVN_ERR_WC_UNSUPPORTED_FORMAT=155021
svnbase=".";
svninfo=()
@@ -22,7 +23,14 @@ rc=$?
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'
+ # User should run 'svn upgrade'
+ VCS_INFO_formats '' '?' '?' '' '' '?' 'working copy upgrade required'
+ return $?
+ elif (( rc == 1 )) && [[ -n ${(M)dat:#"svn: E${SVN_ERR_WC_UNSUPPORTED_FORMAT}: "*} ]]; then
+ hook_com=()
+ # User probably needs to install a newer svn, but we're not sure, so point
+ # the user to svn's error message.
+ VCS_INFO_formats '' '?' '?' '' '' '?' 'svn error'
return $?
else
return 1
@@ -60,13 +68,7 @@ else
fi
rrn=${svnbase:t}
-zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svnbranch || svnbranch="%b:%r"
-hook_com=( branch "${svninfo[URL]##*/}" revision "${cwdinfo[Revision]}" )
-if VCS_INFO_hook 'set-branch-format' "${svnbranch}"; then
- zformat -f svnbranch "${svnbranch}" "b:${hook_com[branch]}" "r:${hook_com[revision]}"
-else
- svnbranch=${hook_com[branch-replace]}
-fi
-hook_com=()
+VCS_INFO_set-branch-format "${svninfo[URL]##*/}" "${cwdinfo[Revision]}" &&
+ svnbranch="${REPLY}"
VCS_INFO_formats '' "${svnbranch}" "${svnbase}" '' '' "${cwdinfo[Revision]}" ''
return 0
diff --git a/Functions/VCS_Info/VCS_INFO_bydir_detect b/Functions/VCS_Info/VCS_INFO_bydir_detect
index 29b261413..89b4d6503 100644
--- a/Functions/VCS_Info/VCS_INFO_bydir_detect
+++ b/Functions/VCS_Info/VCS_INFO_bydir_detect
@@ -36,4 +36,6 @@ done
[[ ${basedir} == "/" ]] && return 1
vcs_comm[basedir]=${basedir}
+# TODO: Would the following be correct? ---
+# rrn=${vcs_comm[basedir]:t}
return 0
diff --git a/Functions/VCS_Info/VCS_INFO_patch2subject b/Functions/VCS_Info/VCS_INFO_patch2subject
index a467edcdb..5aa9efd23 100644
--- a/Functions/VCS_Info/VCS_INFO_patch2subject
+++ b/Functions/VCS_Info/VCS_INFO_patch2subject
@@ -1,3 +1,5 @@
+## vim:ft=zsh
+#
# This function takes as an argument a filename of a patch and sets $REPLY to
# a single-line "subject", or unsets it if no subject could be extracted.
{
diff --git a/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt
index fef85964a..ce5b41f24 100644
--- a/Functions/VCS_Info/VCS_INFO_quilt
+++ b/Functions/VCS_Info/VCS_INFO_quilt
@@ -92,7 +92,7 @@ function VCS_INFO_quilt-patch2subject() {
emulate -L zsh
setopt extendedglob
local mode="$1"
- local patches pc tmp qstring root
+ local patches pc qstring root
local -i ret
local context
local -a applied unapplied applied_string unapplied_string quiltcommand quilt_env
@@ -113,9 +113,12 @@ function VCS_INFO_quilt-patch2subject() {
;;
esac
- VCS_INFO_quilt-dirfind .pc .version
- ret=$? pc=$REPLY
- if (( ret == 0 )); then
+ # Look for the patches directory.
+ #
+ # 1. Check if there's a .pc/.version file in a parent dir. If so, use the
+ # patches dir from the corresponding .pc/.quilt_patches.
+ if VCS_INFO_quilt-dirfind .pc .version; then
+ pc=$REPLY
[[ ${quiltmode} == 'standalone' ]] && root=${pc}
pc=${pc}/.pc
if [[ -e ${pc}/applied-patches ]]; then
@@ -128,33 +131,35 @@ function VCS_INFO_quilt-patch2subject() {
fi
patches=$(<$pc/.quilt_patches)
patches=`builtin cd -q "${pc:h}" && print -r - ${patches:P}`
+ # 2. Else, locate a patches dir using the style settings.
+ else
+ zstyle -s "${context}" quilt-patch-dir patches || patches="${QUILT_PATCHES}"
+ : ${patches:="patches"}
+ if [[ "${patches}" != /* ]]; then
+ if VCS_INFO_quilt-dirfind "${patches}"; then
+ patches=$REPLY/$patches
+ else
+ return $?
+ fi
+ else
+ [[ -d ${patches} ]] || return 1
+ fi
+ quilt_env+=(QUILT_PATCHES="$patches")
fi
+ # At this point, $patches is set and points to an existing directory.
+
if zstyle -t "${context}" get-unapplied; then
# This zstyle call needs to be moved further up if `quilt' needs
# to be run in more places than this one.
zstyle -s "${context}" quiltcommand quiltcommand || quiltcommand='quilt'
- quilt_env=(env)
- if [ -z "$patches" ]; then
- zstyle -s "${context}" quilt-patch-dir patches || patches="${QUILT_PATCHES}"
- if [[ "${patches}" != /* ]]; then
- tmp=${patches:-patches}
- VCS_INFO_quilt-dirfind "${tmp}"
- ret=$? patches=$REPLY
- (( ret )) && return ${ret}
- patches=${patches}/${tmp}
- else
- [[ -d ${patches} ]] || return 1
- fi
- quilt_env+=(QUILT_PATCHES="$patches")
- fi
- unapplied=( ${(f)"$(${quilt_env[@]} $quiltcommand --quiltrc /dev/null unapplied 2> /dev/null)"} )
+ unapplied=( ${(f)"$(if (( $+quilt_env[1] )); then export ${quilt_env[@]}; fi
+ $quiltcommand --quiltrc /dev/null unapplied 2> /dev/null)"} )
unapplied=( ${unapplied:#} )
else
unapplied=()
fi
- if [[ -n $patches ]]; then
- () {
+ {
local i
for ((i=1; i<=$#applied; i++)); do
if VCS_INFO_quilt-patch2subject "$patches/$applied[$i]" && (( $+REPLY ))
@@ -172,13 +177,17 @@ function VCS_INFO_quilt-patch2subject() {
unapplied[$i]+=" ?"
fi
done
- }
- fi
+ }
+
+ typeset -A quilt_extra_info=(
+ quilt-patches-dir ${patches}
+ ${pc:+"quilt-pc-dir"} $pc
+ )
VCS_INFO_set-patch-format 'applied' 'applied_string' \
'unapplied' 'unapplied_string' \
${context} qstring \
- '' ''
+ quilt_extra_info '' quilt_extra_info
qstring=$REPLY
case ${mode} in
diff --git a/Functions/VCS_Info/VCS_INFO_set-branch-format b/Functions/VCS_Info/VCS_INFO_set-branch-format
new file mode 100644
index 000000000..cbab60e29
--- /dev/null
+++ b/Functions/VCS_Info/VCS_INFO_set-branch-format
@@ -0,0 +1,24 @@
+## vim:ft=zsh
+#
+# A function for calling the branch-format hook
+#
+# Return the value to use in REPLY
+#
+# Parameters:
+readonly branch=$1
+readonly revision=$2
+#
+
+[[ -n $rrn ]] || return 1
+local -A hook_com
+local branchformat
+
+zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat branchformat || branchformat="%b:%r"
+hook_com=( branch "${branch}" revision "${revision}" )
+if VCS_INFO_hook 'set-branch-format' "${branchformat}"; then
+ zformat -f REPLY "${branchformat}" "b:${hook_com[branch]}" "r:${hook_com[revision]}"
+else
+ REPLY=${hook_com[branch-replace]}
+fi
+hook_com=()
+return 0
diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format
index 917ebf6bf..1c774a7f6 100644
--- a/Functions/VCS_Info/VCS_INFO_set-patch-format
+++ b/Functions/VCS_Info/VCS_INFO_set-patch-format
@@ -1,3 +1,5 @@
+## vim:ft=zsh
+#
# This function is the common guts of the gen-applied-string /
# gen-unapplied-string / set-patch-format dance of several backends.
#
@@ -12,7 +14,9 @@
# $6 - name of a parameter to store a patch-format format string in
# $7 - name of an assoc parameter with extra $hook_com key-value pairs for the
# set-patch-format hook invocation, or '' for none
-# $8 - name of an array parameter with extra arguments for the patch-format zformat call, or '' for empty
+# $8 - name of a function that sets $reply to extra arguments for the patch-format zformat call, or '' for none
+# $9 - name of an assoc parameter with extra $hook_com key-value pairs for the
+# gen-applied-string & gen-unapplied-string hook invocations, or '' for none
#
# The expanded patch-format string is returned in $REPLY.
#
@@ -20,8 +24,10 @@
# - $hook_com is overwritten and the keys 'applied', 'applied-n',
# 'unapplied', 'unapplied-n', 'all-n' are set.
{
+ hook_com=()
+
local applied_needs_escaping='unknown'
- local unapplied_needs_escaping='unknown'
+ hook_com+=( ${9:+"${(@kvP)9}"} )
if VCS_INFO_hook 'gen-applied-string' "${(@P)1}"; then
if (( ${(P)#1} )); then
REPLY=${(P)1[1]}
@@ -35,6 +41,8 @@
: ${(P)2::=$REPLY}
hook_com=()
+ local unapplied_needs_escaping='unknown'
+ hook_com+=( ${9:+"${(@kvP)9}"} )
if VCS_INFO_hook 'gen-unapplied-string' "${(@P)3}"; then
REPLY=${(P)#3}
unapplied_needs_escaping='yes'
@@ -68,10 +76,12 @@
hook_com[unapplied]=${hook_com[unapplied]//'%'/%%}
fi
+ reply=()
+ [[ -n $8 ]] && "$8"
zformat -f REPLY "${(P)6}" "p:${hook_com[applied]}" "u:${hook_com[unapplied]}" \
"n:${hook_com[applied-n]}" "c:${hook_com[unapplied-n]}" \
"a:${hook_com[all-n]}" \
- ${8:+"${(@P)8}"}
+ "${reply[@]}"
else
unset applied_needs_escaping unapplied_needs_escaping # the hook deals with escaping
REPLY=${hook_com[patch-replace]}
diff --git a/Functions/VCS_Info/test-repo-git-rebase-apply b/Functions/VCS_Info/test-repo-git-rebase-apply
new file mode 100755
index 000000000..ce49690cd
--- /dev/null
+++ b/Functions/VCS_Info/test-repo-git-rebase-apply
@@ -0,0 +1,59 @@
+#!/usr/local/bin/zsh -f
+#
+# This script creates a test repository for testing the git backend's behaviour during rebase-apply operations.
+#
+# It works in ./vcs-test/.
+#
+# Suggested zshrc settings:
+#
+# autoload vcs_info
+# precmd() { vcs_info; typeset -pm vcs\* }
+# zstyle ':vcs_info:*' actionformats %m
+# zstyle ':vcs_info:*' patch-format '[%n+%c=%a] [%p] [%u]'
+# zstyle :vcs_info:\*gen-applied-string\* hooks f1
+# +vi-f1() { typeset -p argv hook_com }
+# zstyle :vcs_info:\*gen-unapplied-string\* hooks f2
+# +vi-f2() { typeset -p argv hook_com }
+# zstyle :vcs_info:\* get-unapplied true
+#
+mkdir "vcs-test"
+cd "vcs-test"
+git init
+
+append_lines() { for 1; do echo line from r$1 >> iota && git commit -am "r$1: Append a line"; done }
+
+echo "This is the file 'iota'." > iota
+git add iota
+git commit -m "r1: Add iota"
+git tag rebase_onto_this HEAD
+
+# Make another change to iota
+append_lines 2
+git tag rebase_from_this HEAD
+
+# Make non-conflicting changes
+for 1 in 3 4 5 6; do
+ touch kappa$1
+ git add kappa$1
+ git commit -m "r${1}: non-conflicting change"
+done
+
+# Make more changes to iota
+append_lines 7 8 9
+
+# Specify a rebase that would create the history [1,3,4,5,6,7,8,9].
+# This will conflict because r7 depends on r2 which is not included.
+git checkout -b myref
+case $0:P in
+ (*/test-repo-git-rebase-apply)
+ git rebase --onto=rebase_onto_this rebase_from_this myref
+ ;;
+ (*/test-repo-git-rebase-merge)
+ git -c core.editor=true rebase -i --onto=rebase_onto_this rebase_from_this myref
+ ;;
+ (*)
+ echo >&2 "$0: unrecognized basename"
+ ;;
+esac
+
+
diff --git a/Functions/VCS_Info/test-repo-git-rebase-merge b/Functions/VCS_Info/test-repo-git-rebase-merge
new file mode 100755
index 000000000..ce49690cd
--- /dev/null
+++ b/Functions/VCS_Info/test-repo-git-rebase-merge
@@ -0,0 +1,59 @@
+#!/usr/local/bin/zsh -f
+#
+# This script creates a test repository for testing the git backend's behaviour during rebase-apply operations.
+#
+# It works in ./vcs-test/.
+#
+# Suggested zshrc settings:
+#
+# autoload vcs_info
+# precmd() { vcs_info; typeset -pm vcs\* }
+# zstyle ':vcs_info:*' actionformats %m
+# zstyle ':vcs_info:*' patch-format '[%n+%c=%a] [%p] [%u]'
+# zstyle :vcs_info:\*gen-applied-string\* hooks f1
+# +vi-f1() { typeset -p argv hook_com }
+# zstyle :vcs_info:\*gen-unapplied-string\* hooks f2
+# +vi-f2() { typeset -p argv hook_com }
+# zstyle :vcs_info:\* get-unapplied true
+#
+mkdir "vcs-test"
+cd "vcs-test"
+git init
+
+append_lines() { for 1; do echo line from r$1 >> iota && git commit -am "r$1: Append a line"; done }
+
+echo "This is the file 'iota'." > iota
+git add iota
+git commit -m "r1: Add iota"
+git tag rebase_onto_this HEAD
+
+# Make another change to iota
+append_lines 2
+git tag rebase_from_this HEAD
+
+# Make non-conflicting changes
+for 1 in 3 4 5 6; do
+ touch kappa$1
+ git add kappa$1
+ git commit -m "r${1}: non-conflicting change"
+done
+
+# Make more changes to iota
+append_lines 7 8 9
+
+# Specify a rebase that would create the history [1,3,4,5,6,7,8,9].
+# This will conflict because r7 depends on r2 which is not included.
+git checkout -b myref
+case $0:P in
+ (*/test-repo-git-rebase-apply)
+ git rebase --onto=rebase_onto_this rebase_from_this myref
+ ;;
+ (*/test-repo-git-rebase-merge)
+ git -c core.editor=true rebase -i --onto=rebase_onto_this rebase_from_this myref
+ ;;
+ (*)
+ echo >&2 "$0: unrecognized basename"
+ ;;
+esac
+
+
diff --git a/Functions/VCS_Info/vcs_info b/Functions/VCS_Info/vcs_info
index 9f48bee75..786b61918 100644
--- a/Functions/VCS_Info/vcs_info
+++ b/Functions/VCS_Info/vcs_info
@@ -22,6 +22,7 @@ static_functions=(
VCS_INFO_hexdump
VCS_INFO_hook
VCS_INFO_set-patch-format
+ VCS_INFO_set-branch-format
VCS_INFO_maxexports
VCS_INFO_nvcsformats
VCS_INFO_patch2subject
diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
index 991775ea5..5f7ea321f 100644
--- a/Functions/Zle/edit-command-line
+++ b/Functions/Zle/edit-command-line
@@ -7,6 +7,23 @@
# except that it will handle multi-line buffers properly.
emulate -L zsh
+local left right prebuffer buffer=$BUFFER lbuffer=$LBUFFER
+local TMPSUFFIX=.zsh
+# set up parameters depending on which context we are called from,
+# see below comment for more details
+if (( REGION_ACTIVE )); then
+ if (( CURSOR < MARK )); then
+ left=$CURSOR right=$MARK
+ lbuffer=
+ else
+ left=$MARK right=$CURSOR
+ lbuffer[right-left,-1]=
+ fi
+ (( left++ ))
+ buffer=$BUFFER[left,right]
+elif (( ! ZLE_RECURSIVE )); then
+ prebuffer=$PREBUFFER
+fi
() {
exec </dev/tty
@@ -17,13 +34,17 @@ emulate -L zsh
(( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[2]
# Open the editor, placing the cursor at the right place if we know how.
- local editor=( "${(@Q)${(z)${VISUAL:-${EDITOR:-vi}}}}" )
- case $editor in
+ local -a editor
+ zstyle -a :zle:$WIDGET editor editor
+ if (( ! $#editor )); then
+ editor=( "${(@Q)${(z)${VISUAL:-${EDITOR:-vi}}}}" )
+ fi
+ case $editor in
(*vim*)
- integer byteoffset=$(( $#PREBUFFER + $#LBUFFER + 1 ))
+ integer byteoffset=$(( $#prebuffer + $#lbuffer + 1 ))
"${(@)editor}" -c "normal! ${byteoffset}go" -- $1;;
(*emacs*)
- local lines=( "${(@f):-"$PREBUFFER$LBUFFER"}" )
+ local lines=( "${(@f):-"$prebuffer$lbuffer"}" )
"${(@)editor}" +${#lines}:$((${#lines[-1]} + 1)) $1;;
(*) "${(@)editor}" $1;;
esac
@@ -31,7 +52,32 @@ emulate -L zsh
(( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[1]
# Replace the buffer with the editor output.
- print -Rz - "$(<$1)"
-} =(<<<"$PREBUFFER$BUFFER")
+ # avoid drawing a new prompt when we can:
+ # - in recursive-edit, the send-break will just cancel the recursive-edit
+ # rather than reload the line from print -z so in that case we want to
+ # just set $BUFFER (unfortunately, recursive-edit doesn't reset CONTEXT
+ # or PREBUFFER so we have to explicitly handle this case, which overrides
+ # the following point)
+ # - when we are at PS2 (CONTEXT == cont && ! ZLE_RECURSIVE) we do want the
+ # break or otherwise the text from PREBUFFER will be inserted twice
+ # - when the region is active, we only want to change the parts of BUFFER
+ # covered by the region, and any PREBUFFER stays as PREBUFFER
+ # - in all other cases (that I can think of) we also just want to set
+ # $BUFFER directly.
+ if (( REGION_ACTIVE )); then
+ # adjust the length of the region to the length of the edited text
+ local prelen=$#BUFFER
+ BUFFER[left,right]="$(<$1)"
+ if (( MARK > CURSOR )); then
+ (( MARK += $#BUFFER - prelen ))
+ else
+ (( CURSOR += $#BUFFER - prelen ))
+ fi
+ elif [[ $CONTEXT != cont ]] || (( ZLE_RECURSIVE )); then
+ BUFFER="$(<$1)"
+ else
+ print -Rz - "$(<$1)"
+ zle send-break
+ fi
-zle send-break # Force reload from the buffer stack
+} =(<<<"$prebuffer$buffer")
diff --git a/Functions/Zle/zed-set-file-name b/Functions/Zle/zed-set-file-name
index da3421e71..745610660 100644
--- a/Functions/Zle/zed-set-file-name
+++ b/Functions/Zle/zed-set-file-name
@@ -2,8 +2,25 @@ emulate -L zsh
autoload -Uz read-from-minibuffer
-zle -K zed-normal-keymap
-
-local REPLY
-read-from-minibuffer "File name: "
-zed_file_name=$REPLY
+case $curcontext in
+ (zed:::)
+ local curcontext=zed-set-file-name:::
+ # The call to vared from zed does the equivalent of
+ # bindkey -A zed main
+ # which confuses read-from-minibuffer. Fix it.
+ bindkey -A zed-normal-keymap main;;
+ (zed-set-file-name:::)
+ zle -M "zed-set-file-name: may not be called recursively"
+ return 1;;
+ (*)
+ zle -M "zed-set-file-name: not called from within zed"
+ return 1;;
+esac
+{
+ local REPLY
+ read-from-minibuffer "File name: "
+ zed_file_name=$REPLY
+} always {
+ # Re-install the zed keymap in the way vared should have all along
+ zle -K zed
+}
diff --git a/META-FAQ b/META-FAQ
index 2e5c1cd21..58c08a06b 100644
--- a/META-FAQ
+++ b/META-FAQ
@@ -8,12 +8,12 @@ listed below.
Author
------
-Zsh was originally written by Paul Falstad <pf@zsh.org>.
-Zsh is now maintained by the members of the zsh-workers mailing
-list <zsh-workers@zsh.org>. The development is currently
-coordinated by Peter Stephenson <pws@zsh.org>. The coordinator
-can be contacted at <coordinator@zsh.org>, but matters relating to
-the code should generally go to the mailing list.
+Zsh was originally written by Paul Falstad. Zsh is now maintained by
+the members of the zsh-workers mailing list <zsh-workers@zsh.org>.
+The development is currently coordinated by Peter Stephenson
+<pws@zsh.org>. The coordinator can be contacted at
+<coordinator@zsh.org>, but matters relating to the code should
+generally go to the mailing list.
Availability
------------
@@ -22,18 +22,17 @@ Zsh is available from the following HTTP and anonymous FTP site.
ftp://ftp.zsh.org/pub/
https://www.zsh.org/pub/
-)
The up-to-date source code is available via Git from Sourceforge. See
https://sourceforge.net/projects/zsh/ for details. A summary of
instructions for the archive can be found at
-http://zsh.sourceforge.net/.
+https://zsh.sourceforge.io/.
Mailing Lists
-------------
-Zsh has 3 mailing lists:
+Zsh has several mailing lists:
<zsh-announce@zsh.org>
Announcements about releases, major changes in the shell and the
@@ -45,6 +44,12 @@ Zsh has 3 mailing lists:
<zsh-workers@zsh.org>
Hacking, development, bug reports and patches.
+ <zsh-security@zsh.org>
+ Private mailing list (the general public cannot subscribe to it) for discussing
+ bug reports with security implications, i.e., potential vulnerabilities.
+
+ If you find a security problem in zsh itself, please mail this address.
+
To subscribe or unsubscribe, send mail
to the associated administrative address for the mailing list.
@@ -62,12 +67,11 @@ zsh-users. All submissions to zsh-users are automatically
forwarded to zsh-workers.
If you have problems subscribing/unsubscribing to any of the mailing
-lists, send mail to <listmaster@zsh.org>. The mailing lists are
-maintained by Karsten Thygesen <karthy@kom.auc.dk>.
+lists, send mail to <listmaster@zsh.org>.
The mailing lists are archived; the archives can be accessed via the
administrative addresses listed above. There is also a hypertext
-archive, maintained by Geoff Wing <gcw@zsh.org>, available at
+archive available at
https://www.zsh.org/mla/.
The Zsh FAQ
@@ -77,14 +81,13 @@ Zsh has a list of Frequently Asked Questions (FAQ), maintained by
Peter Stephenson <pws@zsh.org>. It is regularly posted to the
newsgroup comp.unix.shell and the zsh-announce mailing list.
The latest version can be found at any of the Zsh FTP sites, or at
-http://www.zsh.org/FAQ/. The contact address for FAQ-related matters
+https://www.zsh.org/FAQ/. The contact address for FAQ-related matters
is <faqmaster@zsh.org>.
The Zsh Web Page
----------------
-Zsh has a web page which is located at https://www.zsh.org/. This is
-maintained by Karsten Thygesen <karthy@zsh.org>, of SunSITE Denmark.
+Zsh has a web page which is located at https://www.zsh.org/.
The contact address for web-related matters is <webmaster@zsh.org>.
The Zsh Userguide
@@ -94,6 +97,6 @@ A userguide is currently in preparation. It is intended to complement the
manual, with explanations and hints on issues where the manual can be
cabbalistic, hierographic, or downright mystifying (for example, the word
`hierographic' does not exist). It can be viewed in its current state at
-http://zsh.sourceforge.net/Guide/. At the time of writing, chapters
+https://zsh.sourceforge.io/Guide/. At the time of writing, chapters
dealing with startup files and their contents and the new completion system
were essentially complete.
diff --git a/Misc/vcs_info-examples b/Misc/vcs_info-examples
index 456b3a85b..94c47278d 100644
--- a/Misc/vcs_info-examples
+++ b/Misc/vcs_info-examples
@@ -1,3 +1,5 @@
+## vim:ft=zsh
+#
# A collection of vcs_info usage examples
### Running vcs_info #########################################################
@@ -55,7 +57,7 @@ precmd() {
# is (as with the other examples above too) just an example of a very
# basic single-line prompt. See "man zshmisc" for details on how to
# make this less readable. :-)
- if [[ -n ${vcs_info_msg_0_} ]]; then
+ if [[ -z ${vcs_info_msg_0_} ]]; then
# Oh hey, nothing from vcs_info, so we got more space.
# Let's print a longer part of $PWD...
PS1="%5~%# "
@@ -138,7 +140,7 @@ zstyle ':vcs_info:git*' formats "(%s)-[%12.12i %b]-" # hash & branch
### Fetch the full 40-character Mercurial revision id
# There is no great way to obtain branch, local rev, and untracked changes in
# addition to the full 40-character global rev id with a single invocation of
-# Mercurial. This hook obtains the full global rev id using hexdump (in the
+# Mercurial. This hook obtains the full global rev id using xxd(1) (in the
# same way the use-simple flag does) while retaining all the other vcs_info
# default functionality and information.
zstyle ':vcs_info:hg*+set-message:*' hooks hg-fullglobalrev
@@ -146,7 +148,7 @@ zstyle ':vcs_info:hg*+set-message:*' hooks hg-fullglobalrev
# Output the full 40-char global rev id
function +vi-hg-fullglobalrev() {
local dirstatefile="${hook_com[base]}/.hg/dirstate"
- local grevid="$(hexdump -n 20 -e '1/1 "%02x"' ${dirstatefile})"
+ local grevid="$(xxd -p -l 20 < ${dirstatefile})"
# Omit %h from your hgrevformat since it will be included below
hook_com[revision]="${hook_com[revision]} ${grevid}"
}
@@ -160,7 +162,7 @@ zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
+vi-git-untracked(){
if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \
- git status --porcelain | grep '??' &> /dev/null ; then
+ git status --porcelain | grep -q '^?? ' 2> /dev/null ; then
# This will show the marker if there are any untracked files in repo.
# If instead you want to show the marker only if there are untracked
# files in $PWD, use:
@@ -179,14 +181,17 @@ function +vi-git-st() {
local ahead behind
local -a gitstatus
- # for git prior to 1.7
- # ahead=$(git rev-list origin/${hook_com[branch]}..HEAD | wc -l)
- ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
- (( $ahead )) && gitstatus+=( "+${ahead}" )
+ # Exit early in case the worktree is on a detached HEAD
+ git rev-parse ${hook_com[branch]}@{upstream} >/dev/null 2>&1 || return 0
+
+ local -a ahead_and_behind=(
+ $(git rev-list --left-right --count HEAD...${hook_com[branch]}@{upstream} 2>/dev/null)
+ )
- # for git prior to 1.7
- # behind=$(git rev-list HEAD..origin/${hook_com[branch]} | wc -l)
- behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
+ ahead=${ahead_and_behind[1]}
+ behind=${ahead_and_behind[2]}
+
+ (( $ahead )) && gitstatus+=( "+${ahead}" )
(( $behind )) && gitstatus+=( "-${behind}" )
hook_com[misc]+=${(j:/:)gitstatus}
@@ -282,6 +287,54 @@ function +vi-hg-branchhead() {
}
+### Show information about patch series
+# This is used with with hg mq, quilt, and git rebases and conflicts.
+#
+# All these cases have a notion of a "series of patches/commits" that is being
+# applied. The following shows the information about the most recent patch to
+# have been applied:
+zstyle ':vcs_info:*+gen-applied-string:*' hooks gen-applied-string
+function +vi-gen-applied-string() {
+ # Separate the patch id from the patch log message.
+ if [[ $1 == *\ * ]]; then
+ local patch_name_or_filename="${1%% *}"
+ local patch_description="${1#* }"
+ else
+ local patch_name_or_filename="$1"
+ local patch_description=""
+ fi
+
+ # Apply escaping; see `Oddities' in the manual.
+ patch_name_or_filename=${patch_name_or_filename//'%'/%%}
+ patch_description=${patch_description//'%'/%%}
+
+ # Apply different colouring to the patch description.
+ if [[ -n ${patch_description} ]]; then
+ patch_description="%F{yellow}${patch_description}%f"
+ fi
+
+ # Re-assemble $1, escaped and coloured.
+ hook_com[applied-string]="${patch_name_or_filename} ${patch_description}"
+ ret=1
+}
+# The value of hook_com[applied-string] is incorporated into the %m expando
+# (see the 'patch-format' style for details), which is not included in the
+# 'formats' and 'actionformats' style by default, so to actually use this,
+# you'll need to add %m (or %Q under quilt in add-on mode) to your 'formats'
+# and 'actionformats' styles, as in:
+#
+# zstyle ':vcs_info:*' actionformats ' (%s)-[%b|%a]%u%c- %m'
+# zstyle ':vcs_info:*' formats ' (%s)-[%b]%u%c- %m'
+#
+# Or you could add it as a new word, as in:
+#
+# zstyle ':vcs_info:*' actionformats ' (%s)-[%b|%a]%u%c-' '%m'
+# zstyle ':vcs_info:*' formats ' (%s)-[%b]%u%c-' '%m'
+#
+# In the latter case, you will need to arrange to print ${vcs_info_msg_1_} in
+# addition to ${vcs_info_msg_0_}; see the top of this file for details.
+
+
### Run vcs_info selectively to increase speed in large repos ################
# The following example shows a possible setup for vcs_info which displays
@@ -544,6 +597,9 @@ function +vi-set-quilt-patches() {
# This would take care of all the dedicated-patches-directory-in-${HOME}
# from earlier examples, too.
+# Finally, the "Show information about patch series" example above this section
+# may also be useful.
+
### Using vcs_info from CVS ##################################################
diff --git a/NEWS b/NEWS
index 327b449a0..b762ad4a2 100644
--- a/NEWS
+++ b/NEWS
@@ -4,8 +4,111 @@ CHANGES FROM PREVIOUS VERSIONS OF ZSH
Note also the list of incompatibilities in the README file.
-Changes since 5.8
------------------
+Changes since 5.8.1
+-------------------
+
+zsh 5.9 is dedicated in memory of Sven Guckes, who was, amongst other
+things, a long-time zsh advocate.
+
+ https://linuxnews.de/2022/02/sven-guckes-verstorben/
+ https://groups.google.com/g/vim_announce/c/MJBKVd-xrEE/m/joVNaDgAAgAJ
+
+When unsetting a hash element, the string enclosed in square brackets is
+interpreted literally after any normal command-line-argument expansions.
+Thus
+ unset "hash[$key]"
+first expands $key as usual for a double-quoted string, and then interprets
+that result as the exact hash element to unset. This differs from previous
+versions of the shell, which would also remove a leading backslash for an
+unusual subset of characters in the expansion of $key. Note this also
+means, for example, that now
+ unset 'hash[ab]cd]'
+unsets the element with key "ab]cd" rather than silently doing nothing.
+
+The function command learnt a -T option to declare a function and enable
+tracing for it simultaneously.
+
+The option SHORT_REPEAT was added to enable the short syntax of
+SHORT_LOOPS for the repeat command only. It is disabled by default.
+
+The _arguments function now supports NUL-delimiting optargs in the
+opt_args array via the -0 option. Developers of completion functions
+should find this easier to handle reliably than the default
+colon-delimiting behaviour.
+
+The zsh/system module's `zsystem flock` command learnt an -i option to
+set the wait interval used with -t. Additionally, -t now supports
+fractional seconds.
+
+The option CLOBBER_EMPTY was added to enable the overwrite behaviour
+of CLOBBER for empty files only. It is disabled by default.
+
+A (-) expansion flag was added. It works like (n) but correctly sorts
+negative numbers.
+
+The compinit function learnt a -w option to explain why compdump runs.
+When run without the -i or -u options and compaudit discovers security
+issues, answering "y" to the "Ignore insecure ..." prompt removes the
+insecure elements (like the -i option) where previously it ignored the
+result (thus formerly like the -u option). Further, removing those
+elements includes dropping directories from the $fpath array.
+
+The zsh/datetime module's strftime builtin learnt an -n option to omit
+the trailing newline when printing a formatted time.
+
+The XTRACE option is now disabled while running user-defined completion
+widgets. This corresponds to long-standing behavior of other user ZLE
+widgets. Use the _complete_debug widget to capture XTRACE output, or
+use "functions -T" to enable tracing of specific completion functions.
+
+The fc builtin learnt an -s option which is a POSIX equivalent to the
+`fc -e-` method of re-executing a command without invoking an editor.
+
+The option CASE_PATHS was added to control how NO_CASE_GLOB behaves.
+NO_CASE_GLOB + NO_CASE_PATHS is equivalent to the current NO_CASE_GLOB
+behaviour. NO_CASE_GLOB + CASE_PATHS treats only path components that
+contain globbing characters as case-insensitive; this behaviour may
+yield more predictable results on case-sensitive file systems.
+NO_CASE_PATHS is the default.
+
+With the new TYPESET_TO_UNSET option set, "typeset foo" leaves foo unset,
+in contrast to the default behavior which assigns foo="". Any parameter
+attributes such as numeric type, sorting, and padding are retained until
+the parameter is explicitly unset or a conflicting value is assigned.
+This is similar to default behavior of bash and ksh. This option is
+disabled by default.
+
+The compadd builtin's -D option can now be specified more than once.
+
+The zsh/zutil module's zformat builtin learnt an -F option which behaves
+like -f except that ternary expressions check for existence instead of
+doing math evaluation.
+
+The conventional syntax used to indicate units, ranges, and default values
+in completion descriptions (e.g. `timeout (seconds) (0-60) [20]`) is now
+recognised by the completion system itself. These components are parsed
+out of the description and can be individually styled. A _numbers helper
+function has been added to help function authors offer rich completion
+for these values.
+
+The log builtin, WATCH parameter, et al., have been broken out into a
+separate module, zsh/watch. The module is enabled by default.
+
+The zsh/watch module's WATCHFMT parameter now supports colours via the
+%F and %K escapes.
+
+The STTY parameter can now be set to an empty string before running a
+command to automatically restore terminal settings after the command
+finishes.
+
+The "jobs" command and "$jobstates" and related parameters can report on
+parent shell jobs even in subshells. This is a snapshot of the parent
+state, frozen at the point the subshell started. However, if a subshell
+starts its own background jobs, the parent state is discarded in order
+to report on those new jobs.
+
+Changes from 5.8 to 5.8.1
+-------------------------
CVE-2021-45444: Some prompt expansion sequences, such as %F, support
'arguments' which are themselves expanded in case they contain colour
@@ -24,8 +127,13 @@ Etc/CVE-2021-45444-VCS_Info-workaround.patch included with the shell
source. [ Reported by RyotaK <security@ryotak.me>. Additional thanks to
Marc Cornellà <hello@mcornella.com>. ]
-Changes since 5.7.1-test-3
---------------------------
+A regression was introduced in 5.8.1 in which, when reading a script
+from standard input, zsh itself would consume lines that should otherwise
+have been consumed by commands executed earlier in the script. This was
+not intentional and has been fixed in subsequent versions.
+
+Changes from 5.7.1-test-3 to 5.8
+--------------------------------
CVE-2019-20044: When unsetting the PRIVILEGED option, the shell sets its
effective user and group IDs to match their respective real IDs. On some
@@ -542,7 +650,7 @@ Here is a summary of the most significant changes:
- The zshroadmap manual page provides a slightly more helpful
introduction to the shell manual than was previously available.
-- There have been some notable enhancements to POSIX comptability
+- There have been some notable enhancements to POSIX compatibility
when the shell is in a corresponding emulation (e.g. "emulate sh").
Expansion (parameters, globbing, etc.) and redirection
diff --git a/README b/README
index 502e9f49d..21142e17c 100644
--- a/README
+++ b/README
@@ -5,11 +5,12 @@ THE Z SHELL (ZSH)
Version
-------
-This is version 5.8.1 of the shell. This is a security and bugfix release.
+This is version 5.9 of the shell. This is a security and feature release.
+There are several visible improvements since 5.8.1, as well as bug fixes.
All zsh installations are encouraged to upgrade as soon as possible.
Note in particular the changes highlighted under "Incompatibilities since
-5.8" below. See NEWS for more information.
+5.8.1" below. See NEWS for more information.
Installing Zsh
--------------
@@ -30,15 +31,98 @@ 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.8
----------------------------
-
-PROMPT_SUBST expansion is no longer performed on arguments to prompt-
-expansion sequences such as %F.
-
-Incompatibilities since 5.7.1
+Incompatibilities since 5.8.1
-----------------------------
+compinit: A "y" response to the "Ignore ... and continue?" prompt removes
+insecure elements from the set of completion functions, where previously
+it ignored the compaudit result and included all elements.
+
+Build-time change: The default value of the --enable-gdbm configure
+argument has changed from "yes" to "no". Thus, the zsh/db/gdbm module will
+not be built unless --enable-gdbm is passed explicitly.
+
+vcs_info quilt: The value of the 'quiltcommand' style used to be taken for the
+name of an external command. Now it may also be a shell function. Normal
+command word precedence rules apply, so if you have a function and a command
+with the same name, the function will be used.
+
+The "function" reserved word, used to define functions, gained a new -T option.
+That affects syntaxes such as:
+
+1. "function -T { ... }". It used to define a function named "-T". It
+now defines and executes an anonymous function with single-level tracing
+enabled --- same as "function f { ... }; functions -T f; f", but without
+naming the function.
+
+2. "function -T foo { ... }". It used to define two functions, named "-T"
+and "foo" (see the MULTI_FUNC_DEF option). It now defines a function
+"foo" with tracing enabled.
+
+3. "function -- { ... }". It used to define a function named "--". It
+now defines and executes an anonymous function. The "--" is taken to be
+an end-of-options guard (same as "ls --").
+
+The sh-compatible function definition syntax, "f() { ... }", is unchanged.
+
+The time-out (-t) value given to zsh/system's `zsystem flock` command is
+now limited to 2^30-1 seconds (= a little over 34 years).
+
+zstyle: For background, recall that the zstyle builtin associates styles with
+values for particular contexts, and when a context (such as ':foo:bar:baz') is
+matched by multiple patterns (such as ':foo:*' and ':foo:bar:*'), the style's
+value for the more specific of the patterns is used. In zsh 5.8 and earlier
+the determination of which pattern is "more specific" used semantics slightly
+different to those the documentation promised. The implementation was changed
+to match the documentation. The upshot of this is that if you set a single
+style in multiple contexts, zsh 5.9 may use the values set for a pattern other
+than the one zsh 5.8 used. For example, if you do
+ zstyle ':foo:bar:*' style value1
+ zstyle ':foo:*:baz:*' style value2
+and the style is looked up under a context that both patterns match (e.g.,
+:foo:bar:baz:qux), zsh 5.9 will use value2 -- which is consistent with the
+documentation of both 5.8 and 5.9 -- but zsh 5.8 will use value1. If this
+affects you, make the implied colons in the first pattern explicit, as in:
+ zstyle ':foo:bar:*:*' style value1
+ zstyle ':foo:*:baz:*' style value2
+This will use value1 in both 5.8 and 5.9.
+
+Elements of the region_highlight array have gained a fourth space-separated
+field. Code written against 5.9 that sets the new field may break under 5.8:
+for example, the element "0 20 bold memo=foo", which is valid under 5.9, would
+not work under 5.8. (Under the hood, 5.8 does not recognize the space as
+terminating the highlighting specification.) On the other hand, code that does
+not set the new, fourth field will continue to work under both 5.8 and 5.9.
+(As it happens, adding a comma after "bold" will make both 5.8 and 5.9 do the
+right thing, but this should be viewed as an unsupported hack.)
+
+The XTRACE option is now disabled while running user-defined completion
+widgets. See NEWS.
+
+emulate sh: When zsh emulates sh, the final command in a pipeline is now run in
+a subshell. This differs from the behavior in the native (zsh) mode, but is
+consistent with most other sh implementations.
+
+The export and readonly builtins now ignore the -p option when there are
+operands given and POSIX_BUILTINS is enabled. This more closely matches the
+behaviour of bash and ksh.
+
+getopts now calculates OPTIND in a similar manner to other shells when the
+POSIX_BUILTINS option is enabled.
+
+Ignored-signal traps are now inherited by subshells when the POSIX_TRAPS
+option is enabled.
+
+emulate sh: Inf and NaN are now treated as parameter names in arithmetic
+context when zsh is emulating sh.
+
+The ${name:offset:length} expansion syntax now behaves more similarly to
+other shells in that the offset and length are applied as array indices
+prior to scalar conversion in e.g. "${*:0:2}".
+
+Incompatibilities between 5.7.1 and 5.8.1
+-----------------------------------------
+
The history expansion !:1:t2 used to be interpreted such that the 2
was a separate character added after the history expansion. Now
it is an argument to the :t modifier.
@@ -68,6 +152,9 @@ changes made in the course of fixing CVE-2019-20044. Please report this
to the zsh-workers mailing list if your system is affected. See NEWS for
more.
+PROMPT_SUBST expansion is no longer performed on arguments to prompt-
+expansion sequences such as %F.
+
Incompatibilities between 5.6.2 and 5.7.1
-----------------------------------------
@@ -85,8 +172,14 @@ reverse order, from last applied to first applied.
variables without a preceding '$' sign in shell arithmetic expansion
and in the double-parentheses and 'let' arithmetic commands.
+3) _alternative now correctly handles the same (...) action syntax as
+_arguments; this may necessitate quoting/escaping in calls to _alternative
+and _regex_arguments that wasn't previously required. See
+https://zsh.org/workers/48414 (commit zsh-5.8-348-g2c000ee7b) for details
+and an example.
+
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
@@ -147,7 +240,7 @@ been made an error. (The option setting NO_MULTI_FUNC_DEF turned this
case into an error, but did not help with other cases and is off by
default.) The alternative, of not expanding the alias, was rejected as
it was more difficult to achieve in the parser and also would silently
-change the shell's behaviur between versions. A new option,
+change the shell's behaviour between versions. A new option,
ALIAS_FUNC_DEF, has been added, which can be set to make the shell
behave as in previous versions. It is in any case recommended to use
the "function" keyword, as aliases are not expanded afterwards.
@@ -351,19 +444,19 @@ This is also necessary in the unusual eventuality that the builtins are
to be overridden by shell functions, since reserved words take
precedence over functions.
-10) For compatilibity with other shells, the syntax
+10) For compatibility with other shells, the syntax
array=([index]=value)
-can be used with both assoiative arrays and normal arrays. In the
+can be used with both associative arrays and normal arrays. In the
unlikely event that you wish to create an array with an entry
matching a file whose name consists of one of a range of characters
matched as a [...] expression, followed by an equal sign, followed
by arbitrary other characters, it is now necessary to quote the equals
sign.
-Incompatibilites between 5.0.7 and 5.0.8
-----------------------------------------
+Incompatibilities between 5.0.7 and 5.0.8
+-----------------------------------------
Various arithmetic operations have changed, in particular with respect
to the choice of integer or floating point operations. The new
diff --git a/Src/Builtins/rlimits.awk b/Src/Builtins/rlimits.awk
deleted file mode 100644
index e9c576c66..000000000
--- a/Src/Builtins/rlimits.awk
+++ /dev/null
@@ -1,116 +0,0 @@
-#
-# rlimits.awk: {g,n}awk script to generate rlimits.h
-#
-# NB: On SunOS 4.1.3 - user-functions don't work properly, also \" problems
-# Without 0 + hacks some nawks compare numbers as strings
-#
-BEGIN {limidx = 0}
-
-/^[\t ]*(#[\t ]*define[\t _]*RLIMIT_[A-Z_]*[\t ]*[0-9][0-9]*|RLIMIT_[A-Z_]*,[\t ]*|_*RLIMIT_[A-Z_]*[\t ]*=[\t ]*[0-9][0-9]*,[\t ]*)/ {
- limindex = index($0, "RLIMIT_")
- limtail = substr($0, limindex, 80)
- split(limtail, tmp)
- limnam = substr(tmp[1], 8, 20)
- limnum = tmp[2]
- # in this case I assume GNU libc resourcebits.h
- if (limnum == "") {
- limnum = limidx++
- limindex = index($0, ",")
- limnam = substr(limnam, 1, limindex-1)
- }
- if (limnum == "=") {
- if (tmp[3] ~ /^[0-9]/) {
- limnum = tmp[3] + 0
- } else {
- limnum = limidx++
- }
- limindex = index($0, ",")
- limnam = substr(limnam, 1, limindex-1)
- }
- limrev[limnam] = limnum
- if (lim[limnum] == "") {
- lim[limnum] = limnam
- if (limnum ~ /^[0-9]*$/) {
- if (limnam == "AIO_MEM") { msg[limnum] = "Maiomemorylocked" }
- if (limnam == "AIO_OPS") { msg[limnum] = "Naiooperations" }
- if (limnam == "AS") { msg[limnum] = "Maddressspace" }
- if (limnam == "CORE") { msg[limnum] = "Mcoredumpsize" }
- if (limnam == "CPU") { msg[limnum] = "Tcputime" }
- if (limnam == "DATA") { msg[limnum] = "Mdatasize" }
- if (limnam == "FSIZE") { msg[limnum] = "Mfilesize" }
- if (limnam == "LOCKS") { msg[limnum] = "Nmaxfilelocks" }
- if (limnam == "MEMLOCK") { msg[limnum] = "Mmemorylocked" }
- if (limnam == "NOFILE") { msg[limnum] = "Ndescriptors" }
- if (limnam == "NPROC") { msg[limnum] = "Nmaxproc" }
- if (limnam == "NTHR") { msg[limnum] = "Nmaxpthreads" }
- if (limnam == "OFILE") { msg[limnum] = "Ndescriptors" }
- if (limnam == "PTHREAD") { msg[limnum] = "Nmaxpthreads" }
- if (limnam == "RSS") { msg[limnum] = "Mresident" }
- if (limnam == "SBSIZE") { msg[limnum] = "Msockbufsize" }
- if (limnam == "STACK") { msg[limnum] = "Mstacksize" }
- if (limnam == "TCACHE") { msg[limnum] = "Ncachedthreads" }
- if (limnam == "VMEM") { msg[limnum] = "Mvmemorysize" }
- if (limnam == "SIGPENDING") { msg[limnum] = "Nsigpending" }
- if (limnam == "MSGQUEUE") { msg[limnum] = "Nmsgqueue" }
- if (limnam == "NICE") { msg[limnum] = "Nnice" }
- if (limnam == "RTPRIO") { msg[limnum] = "Nrt_priority" }
- if (limnam == "RTTIME") { msg[limnum] = "Urt_time" }
- if (limnam == "POSIXLOCKS") { msg[limnum] = "Nposixlocks" }
- if (limnam == "NPTS") { msg[limnum] = "Npseudoterminals" }
- if (limnam == "SWAP") { msg[limnum] = "Mswapsize" }
- if (limnam == "KQUEUES") { msg[limnum] = "Nkqueues" }
- if (limnam == "UMTXP") { msg[limnum] = "Numtxp" }
- }
- }
-}
-/^[\t ]*#[\t ]*define[\t _]*RLIM_NLIMITS[\t ]*[0-9][0-9]*/ {
- limindex = index($0, "RLIM_")
- limtail = substr($0, limindex, 80)
- split(limtail, tmp)
- nlimits = tmp[2]
-}
-# in case of GNU libc
-/^[\t ]*RLIM_NLIMITS[\t ]*=[\t ]*RLIMIT_NLIMITS/ {
- if(!nlimits) { nlimits = limidx }
-}
-/^[\t _]*RLIM(IT)?_NLIMITS[\t ]*=[\t ]*[0-9][0-9]*/ {
- limindex = index($0, "=")
- limtail = substr($0, limindex, 80)
- split(limtail, tmp)
- nlimits = tmp[2]
-}
-
-END {
- if (limrev["MEMLOCK"] != "") {
- irss = limrev["RSS"]
- msg[irss] = "Mmemoryuse"
- }
- ps = "%s"
-
- printf("%s\n%s\n\n", "/** rlimits.h **/", "/** architecture-customized limits for zsh **/")
- printf("#define ZSH_NLIMITS %d\n\nstatic char const *recs[ZSH_NLIMITS] = {\n", 0 + nlimits)
-
- for (i = 0; i < 0 + nlimits; i++)
- if (msg[i] == "")
- printf("\t%c%s%c,\n", 34, lim[i], 34)
- else
- printf("\t%c%s%c,\n", 34, substr(msg[i], 2, 30), 34)
- print "};"
- print ""
- print "static int limtype[ZSH_NLIMITS] = {"
- for (i = 0; i < 0 + nlimits; i++) {
- if (msg[i] == "")
- limtype = "UNKNOWN"
- else {
- limtype = substr(msg[i], 1, 1)
- if(limtype == "M") { limtype = "MEMORY" }
- if(limtype == "N") { limtype = "NUMBER" }
- if(limtype == "T") { limtype = "TIME" }
- if(limtype == "U") { limtype = "MICROSECONDS" }
- }
- printf("\tZLIMTYPE_%s,\n", limtype)
- }
- print "};"
-
- exit(0)
-}
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index 6b552f3a9..5f9c84b0f 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -32,20 +32,7 @@
#if defined(HAVE_GETRLIMIT) && defined(RLIM_INFINITY)
-#if defined(HAVE_RLIMIT_POSIXLOCKS) && !defined(HAVE_RLIMIT_LOCKS)
-# define RLIMIT_LOCKS RLIMIT_POSIXLOCKS
-# define HAVE_RLIMIT_LOCKS 1
-#endif
-
-#if defined(HAVE_RLIMIT_NTHR) && !defined(HAVE_RLIMIT_PTHREAD)
-# define RLIMIT_PTHREAD RLIMIT_NTHR
-# define HAVE_RLIMIT_PTHREAD 1
-# define THREAD_FMT "-T: threads "
-#else
-# define THREAD_FMT "-T: threads per process "
-#endif
-
-enum {
+enum zlimtype {
ZLIMTYPE_MEMORY,
ZLIMTYPE_NUMBER,
ZLIMTYPE_TIME,
@@ -53,11 +40,222 @@ enum {
ZLIMTYPE_UNKNOWN
};
-/* Generated rec array containing limits required for the limit builtin. *
- * They must appear in this array in numerical order of the RLIMIT_* macros. */
+typedef struct resinfo_T {
+ int res; /* RLIMIT_XXX */
+ char* name; /* used by limit builtin */
+ enum zlimtype type;
+ int unit; /* 1, 512, or 1024 */
+ char opt; /* option character */
+ char* descr; /* used by ulimit builtin */
+} resinfo_T;
+
+/* table of known resources */
+/*
+ * How to add a new resource:
+ * 1. Add zsh_LIMIT_PRESENT(RLIMIT_XXX) in configure.ac.
+ * 2. Add an entry for RLIMIT_XXX to known_resources[].
+ * Make sure the option letter (resinto_T.opt) is unique.
+ * 3. Build zsh and run the test B12rlimit.ztst.
+ */
+static const resinfo_T known_resources[] = {
+ {RLIMIT_CPU, "cputime", ZLIMTYPE_TIME, 1,
+ 't', "cpu time (seconds)"},
+ {RLIMIT_FSIZE, "filesize", ZLIMTYPE_MEMORY, 512,
+ 'f', "file size (blocks)"},
+ {RLIMIT_DATA, "datasize", ZLIMTYPE_MEMORY, 1024,
+ 'd', "data seg size (kbytes)"},
+ {RLIMIT_STACK, "stacksize", ZLIMTYPE_MEMORY, 1024,
+ 's', "stack size (kbytes)"},
+ {RLIMIT_CORE, "coredumpsize", ZLIMTYPE_MEMORY, 512,
+ 'c', "core file size (blocks)"},
+# ifdef HAVE_RLIMIT_NOFILE
+ {RLIMIT_NOFILE, "descriptors", ZLIMTYPE_NUMBER, 1,
+ 'n', "file descriptors"},
+# endif
+# if defined(HAVE_RLIMIT_AS) && !defined(RLIMIT_VMEM_IS_AS)
+ {RLIMIT_AS, "addressspace", ZLIMTYPE_MEMORY, 1024,
+ 'v', "address space (kbytes)"},
+# endif
+# if defined(HAVE_RLIMIT_RSS) && !defined(RLIMIT_VMEM_IS_RSS) && !defined(RLIMIT_RSS_IS_AS)
+ {RLIMIT_RSS, "resident", ZLIMTYPE_MEMORY, 1024,
+ 'm', "resident set size (kbytes)"},
+# endif
+# if defined(HAVE_RLIMIT_VMEM)
+ {RLIMIT_VMEM,
+# if defined(RLIMIT_VMEM_IS_RSS)
+ "resident", ZLIMTYPE_MEMORY, 1024,
+ 'm', "memory size (kbytes)"
+# else
+ "vmemorysize", ZLIMTYPE_MEMORY, 1024,
+ 'v', "virtual memory size (kbytes)"
+# endif
+ },
+# endif
+# ifdef HAVE_RLIMIT_NPROC
+ {RLIMIT_NPROC, "maxproc", ZLIMTYPE_NUMBER, 1,
+ 'u', "processes"},
+# endif
+# ifdef HAVE_RLIMIT_MEMLOCK
+ {RLIMIT_MEMLOCK, "memorylocked", ZLIMTYPE_MEMORY, 1024,
+ 'l', "locked-in-memory size (kbytes)"},
+# endif
+ /* Linux */
+# ifdef HAVE_RLIMIT_LOCKS
+ {RLIMIT_LOCKS, "maxfilelocks", ZLIMTYPE_NUMBER, 1,
+ 'x', "file locks"},
+# endif
+# ifdef HAVE_RLIMIT_SIGPENDING
+ {RLIMIT_SIGPENDING, "sigpending", ZLIMTYPE_NUMBER, 1,
+ 'i', "pending signals"},
+# endif
+# ifdef HAVE_RLIMIT_MSGQUEUE
+ {RLIMIT_MSGQUEUE, "msgqueue", ZLIMTYPE_NUMBER, 1,
+ 'q', "bytes in POSIX msg queues"},
+# endif
+# ifdef HAVE_RLIMIT_NICE
+ {RLIMIT_NICE, "nice", ZLIMTYPE_NUMBER, 1,
+ 'e', "max nice"},
+# endif
+# ifdef HAVE_RLIMIT_RTPRIO
+ {RLIMIT_RTPRIO, "rt_priority", ZLIMTYPE_NUMBER, 1,
+ 'r', "max rt priority"},
+# endif
+# ifdef HAVE_RLIMIT_RTTIME
+ {RLIMIT_RTTIME, "rt_time", ZLIMTYPE_MICROSECONDS, 1,
+ 'N', "rt cpu time (microseconds)"},
+# endif
+ /* BSD */
+# ifdef HAVE_RLIMIT_SBSIZE
+ {RLIMIT_SBSIZE, "sockbufsize", ZLIMTYPE_MEMORY, 1,
+ 'b', "socket buffer size (bytes)"},
+# endif
+# ifdef HAVE_RLIMIT_KQUEUES /* FreeBSD */
+ {RLIMIT_KQUEUES, "kqueues", ZLIMTYPE_NUMBER, 1,
+ 'k', "kqueues"},
+# endif
+# ifdef HAVE_RLIMIT_NPTS /* FreeBSD */
+ {RLIMIT_NPTS, "pseudoterminals", ZLIMTYPE_NUMBER, 1,
+ 'p', "pseudo-terminals"},
+# endif
+# ifdef HAVE_RLIMIT_SWAP /* FreeBSD */
+ {RLIMIT_SWAP, "swapsize", ZLIMTYPE_MEMORY, 1024,
+ 'w', "swap size (kbytes)"},
+# endif
+# ifdef HAVE_RLIMIT_UMTXP /* FreeBSD */
+ {RLIMIT_UMTXP, "umtxp", ZLIMTYPE_NUMBER, 1,
+ 'o', "umtx shared locks"},
+# endif
+
+# ifdef HAVE_RLIMIT_POSIXLOCKS /* DragonFly */
+ {RLIMIT_POSIXLOCKS, "posixlocks", ZLIMTYPE_NUMBER, 1,
+ 'x', "number of POSIX locks"},
+# endif
+# if defined(HAVE_RLIMIT_NTHR) && !defined(HAVE_RLIMIT_RTPRIO) /* Net/OpenBSD */
+ {RLIMIT_NTHR, "maxpthreads", ZLIMTYPE_NUMBER, 1,
+ 'r', "threads"},
+# endif
+ /* others */
+# if defined(HAVE_RLIMIT_PTHREAD) && !defined(HAVE_RLIMIT_NTHR) /* IRIX ? */
+ {RLIMIT_PTHREAD, "maxpthreads", ZLIMTYPE_NUMBER, 1,
+ 'T', "threads per process"},
+# endif
+# ifdef HAVE_RLIMIT_AIO_MEM /* HP-UX ? */
+ {RLIMIT_AIO_MEM, "aiomemorylocked", ZLIMTYPE_MEMORY, 1024,
+ 'N', "AIO locked-in-memory (kbytes)"},
+# endif
+# ifdef HAVE_RLIMIT_AIO_OPS /* HP-UX ? */
+ {RLIMIT_AIO_OPS, "aiooperations", ZLIMTYPE_NUMBER, 1,
+ 'N', "AIO operations"},
+# endif
+# ifdef HAVE_RLIMIT_TCACHE /* HP-UX ? */
+ {RLIMIT_TCACHE, "cachedthreads", ZLIMTYPE_NUMBER, 1,
+ 'N', "cached threads"},
+# endif
+};
+
+/* resinfo[RLIMIT_XXX] points to the corresponding entry
+ * in known_resources[] */
+static const resinfo_T **resinfo;
-# include "rlimits.h"
+/**/
+static void
+set_resinfo(void)
+{
+ int i;
+
+ resinfo = (const resinfo_T **)zshcalloc(RLIM_NLIMITS*sizeof(resinfo_T *));
+
+ for (i=0; i<sizeof(known_resources)/sizeof(resinfo_T); ++i) {
+ resinfo[known_resources[i].res] = &known_resources[i];
+ }
+ for (i=0; i<RLIM_NLIMITS; ++i) {
+ if (!resinfo[i]) {
+ /* unknown resource */
+ resinfo_T *info = (resinfo_T *)zshcalloc(sizeof(resinfo_T));
+ char *buf = (char *)zalloc(12);
+ snprintf(buf, 12, "UNKNOWN-%d", i);
+ info->res = - 1; /* negative value indicates "unknown" */
+ info->name = buf;
+ info->type = ZLIMTYPE_UNKNOWN;
+ info->unit = 1;
+ info->opt = 'N';
+ info->descr = buf;
+ resinfo[i] = info;
+ }
+ }
+}
+/**/
+static void
+free_resinfo(void)
+{
+ int i;
+ for (i=0; i<RLIM_NLIMITS; ++i) {
+ if (resinfo[i]->res < 0) { /* unknown resource */
+ free(resinfo[i]->name);
+ free((void*)resinfo[i]);
+ }
+ }
+ free(resinfo);
+ resinfo = NULL;
+}
+
+/* Find resource by its option character */
+
+/**/
+static int
+find_resource(char c)
+{
+ int i;
+ for (i=0; i<RLIM_NLIMITS; ++i) {
+ if (resinfo[i]->opt == c)
+ return i;
+ }
+ return -1;
+}
+
+/* Print a value of type rlim_t */
+
+/**/
+static void
+printrlim(rlim_t val, const char *unit)
+{
+# ifdef RLIM_T_IS_QUAD_T
+ printf("%qd%s", val, unit);
+# else
+# ifdef RLIM_T_IS_LONG_LONG
+ printf("%lld%s", val, unit);
+# else
+# ifdef RLIM_T_IS_UNSIGNED
+ printf("%lu%s", (unsigned long)val, unit);
+# else
+ printf("%ld%s", (long)val, unit);
+# endif /* RLIM_T_IS_UNSIGNED */
+# endif /* RLIM_T_IS_LONG_LONG */
+# endif /* RLIM_T_IS_QUAD_T */
+}
+
+/**/
static rlim_t
zstrtorlimt(const char *s, char **t, int base)
{
@@ -97,8 +295,8 @@ static void
showlimitvalue(int lim, rlim_t val)
{
/* display limit for resource number lim */
- if (lim < ZSH_NLIMITS)
- printf("%-16s", recs[lim]);
+ if (lim < RLIM_NLIMITS)
+ printf("%-16s", resinfo[lim]->name);
else
{
/* Unknown limit, hence unknown units. */
@@ -106,81 +304,25 @@ showlimitvalue(int lim, rlim_t val)
}
if (val == RLIM_INFINITY)
printf("unlimited\n");
- else if (lim >= ZSH_NLIMITS)
- {
-# ifdef RLIM_T_IS_QUAD_T
- printf("%qd\n", val);
-# else
-# ifdef RLIM_T_IS_LONG_LONG
- printf("%lld\n", val);
-# else
-# ifdef RLIM_T_IS_UNSIGNED
- printf("%lu\n", (unsigned long)val);
-# else
- printf("%ld\n", (long)val);
-# endif /* RLIM_T_IS_UNSIGNED */
-# endif /* RLIM_T_IS_LONG_LONG */
-# endif /* RLIM_T_IS_QUAD_T */
- }
- else if (limtype[lim] == ZLIMTYPE_TIME) {
+ else if (lim >= RLIM_NLIMITS)
+ printrlim(val, "\n");
+ else if (resinfo[lim]->type == ZLIMTYPE_TIME) {
/* time-type resource -- display as hours, minutes and
seconds. */
printf("%d:%02d:%02d\n", (int)(val / 3600),
(int)(val / 60) % 60, (int)(val % 60));
- } else if (limtype[lim] == ZLIMTYPE_MICROSECONDS) {
- /* microseconds */
-# ifdef RLIM_T_IS_QUAD_T
- printf("%qdus\n", val);
-# else
-# ifdef RLIM_T_IS_LONG_LONG
- printf("%lldus\n", val);
-# else
-# ifdef RLIM_T_IS_UNSIGNED
- printf("%luus\n", (unsigned long)val);
-# else
- printf("%ldus\n", (long)val);
-# endif /* RLIM_T_IS_UNSIGNED */
-# endif /* RLIM_T_IS_LONG_LONG */
-# endif /* RLIM_T_IS_QUAD_T */
- } else if (limtype[lim] == ZLIMTYPE_NUMBER ||
- limtype[lim] == ZLIMTYPE_UNKNOWN) {
- /* pure numeric resource */
-# ifdef RLIM_T_IS_QUAD_T
- printf("%qd\n", val);
-# else
-# ifdef RLIM_T_IS_LONG_LONG
- printf("%lld\n", val);
-# else
-# ifdef RLIM_T_IS_UNSIGNED
- printf("%lu\n", (unsigned long)val);
-# else
- printf("%ld\n", (long)val);
-# endif /* RLIM_T_IS_UNSIGNED */
-# endif /* RLIM_T_IS_LONG_LONG */
-# endif /* RLIM_T_IS_QUAD_T */
- } else if (val >= 1024L * 1024L)
- /* memory resource -- display with `K' or `M' modifier */
-# ifdef RLIM_T_IS_QUAD_T
- printf("%qdMB\n", val / (1024L * 1024L));
- else
- printf("%qdkB\n", val / 1024L);
-# else
-# ifdef RLIM_T_IS_LONG_LONG
- printf("%lldMB\n", val / (1024L * 1024L));
- else
- printf("%lldkB\n", val / 1024L);
-# else
-# ifdef RLIM_T_IS_UNSIGNED
- printf("%luMB\n", (unsigned long)(val / (1024L * 1024L)));
- else
- printf("%lukB\n", (unsigned long)(val / 1024L));
-# else
- printf("%ldMB\n", (long)val / (1024L * 1024L));
- else
- printf("%ldkB\n", (long)val / 1024L);
-# endif /* RLIM_T_IS_UNSIGNED */
-# endif /* RLIM_T_IS_LONG_LONG */
-# endif /* RLIM_T_IS_QUAD_T */
+ } else if (resinfo[lim]->type == ZLIMTYPE_MICROSECONDS)
+ printrlim(val, "us\n"); /* microseconds */
+ else if (resinfo[lim]->type == ZLIMTYPE_NUMBER ||
+ resinfo[lim]->type == ZLIMTYPE_UNKNOWN)
+ printrlim(val, "\n"); /* pure numeric resource */
+ else {
+ /* memory resource -- display with `k' or `M' modifier */
+ if (val >= 1024L * 1024L)
+ printrlim(val/(1024L * 1024L), "MB\n");
+ else
+ printrlim(val/1024L, "kB\n");
+ }
}
/* Display resource limits. hard indicates whether `hard' or `soft' *
@@ -193,7 +335,7 @@ showlimits(char *nam, int hard, int lim)
{
int rt;
- if (lim >= ZSH_NLIMITS)
+ if (lim >= RLIM_NLIMITS)
{
/*
* Not configured into the shell. Ask the OS
@@ -215,7 +357,7 @@ showlimits(char *nam, int hard, int lim)
else
{
/* main loop over resource types */
- for (rt = 0; rt != ZSH_NLIMITS; rt++)
+ for (rt = 0; rt != RLIM_NLIMITS; rt++)
showlimitvalue(rt, (hard) ? limits[rt].rlim_max :
limits[rt].rlim_cur);
}
@@ -234,7 +376,7 @@ printulimit(char *nam, int lim, int hard, int head)
rlim_t limit;
/* get the limit in question */
- if (lim >= ZSH_NLIMITS)
+ if (lim >= RLIM_NLIMITS)
{
struct rlimit vals;
@@ -248,199 +390,25 @@ printulimit(char *nam, int lim, int hard, int head)
else
limit = (hard) ? limits[lim].rlim_max : limits[lim].rlim_cur;
/* display the appropriate heading */
- switch (lim) {
- case RLIMIT_CORE:
- if (head)
- printf("-c: core file size (blocks) ");
- if (limit != RLIM_INFINITY)
- limit /= 512;
- break;
- case RLIMIT_DATA:
- if (head)
- printf("-d: data seg size (kbytes) ");
- if (limit != RLIM_INFINITY)
- limit /= 1024;
- break;
- case RLIMIT_FSIZE:
- if (head)
- printf("-f: file size (blocks) ");
- if (limit != RLIM_INFINITY)
- limit /= 512;
- break;
-# ifdef HAVE_RLIMIT_SIGPENDING
- case RLIMIT_SIGPENDING:
- if (head)
- printf("-i: pending signals ");
- break;
-# endif
-# ifdef HAVE_RLIMIT_MEMLOCK
- case RLIMIT_MEMLOCK:
- if (head)
- printf("-l: locked-in-memory size (kbytes) ");
- if (limit != RLIM_INFINITY)
- limit /= 1024;
- break;
-# endif /* HAVE_RLIMIT_MEMLOCK */
-/* If RLIMIT_VMEM and RLIMIT_RSS are defined and equal, avoid *
- * duplicate case statement. Observed on QNX Neutrino 6.1.0. */
-# if defined(HAVE_RLIMIT_RSS) && !defined(RLIMIT_VMEM_IS_RSS) && !defined(RLIMIT_RSS_IS_AS)
- case RLIMIT_RSS:
- if (head)
- printf("-m: resident set size (kbytes) ");
- if (limit != RLIM_INFINITY)
- limit /= 1024;
- break;
-# endif /* HAVE_RLIMIT_RSS */
-# if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_RSS) && defined(RLIMIT_VMEM_IS_RSS)
- case RLIMIT_VMEM:
- if (head)
- printf("-m: memory size (kbytes) ");
- if (limit != RLIM_INFINITY)
- limit /= 1024;
- break;
-# endif /* HAVE_RLIMIT_VMEM */
-# ifdef HAVE_RLIMIT_NOFILE
- case RLIMIT_NOFILE:
- if (head)
- printf("-n: file descriptors ");
- break;
-# endif /* HAVE_RLIMIT_NOFILE */
-# ifdef HAVE_RLIMIT_MSGQUEUE
- case RLIMIT_MSGQUEUE:
- if (head)
- printf("-q: bytes in POSIX msg queues ");
- break;
-# endif
- case RLIMIT_STACK:
- if (head)
- printf("-s: stack size (kbytes) ");
- if (limit != RLIM_INFINITY)
- limit /= 1024;
- break;
- case RLIMIT_CPU:
- if (head)
- printf("-t: cpu time (seconds) ");
- break;
-# ifdef HAVE_RLIMIT_NPROC
- case RLIMIT_NPROC:
- if (head)
- printf("-u: processes ");
- break;
-# endif /* HAVE_RLIMIT_NPROC */
-# if defined(HAVE_RLIMIT_VMEM) && (!defined(HAVE_RLIMIT_RSS) || !defined(RLIMIT_VMEM_IS_RSS))
- case RLIMIT_VMEM:
- if (head)
- printf("-v: virtual memory size (kbytes) ");
- if (limit != RLIM_INFINITY)
- limit /= 1024;
- break;
-# endif /* HAVE_RLIMIT_VMEM */
-# if defined HAVE_RLIMIT_AS && !defined(RLIMIT_VMEM_IS_AS)
- case RLIMIT_AS:
- if (head)
- printf("-v: address space (kbytes) ");
- if (limit != RLIM_INFINITY)
- limit /= 1024;
- break;
-# endif /* HAVE_RLIMIT_AS */
-# ifdef HAVE_RLIMIT_LOCKS
- case RLIMIT_LOCKS:
- if (head)
- printf("-x: file locks ");
- break;
-# endif /* HAVE_RLIMIT_LOCKS */
-# ifdef HAVE_RLIMIT_AIO_MEM
- case RLIMIT_AIO_MEM:
- if (head)
- printf("-N %2d: AIO locked-in-memory (kbytes)", RLIMIT_AIO_MEM);
- if (limit != RLIM_INFINITY)
- limit /= 1024;
- break;
-# endif /* HAVE_RLIMIT_AIO_MEM */
-# ifdef HAVE_RLIMIT_AIO_OPS
- case RLIMIT_AIO_OPS:
- if (head)
- printf("-N %2d: AIO operations ", RLIMIT_AIO_OPS);
- break;
-# endif /* HAVE_RLIMIT_AIO_OPS */
-# ifdef HAVE_RLIMIT_TCACHE
- case RLIMIT_TCACHE:
- if (head)
- printf("-N %2d: cached threads ", RLIMIT_TCACHE);
- break;
-# endif /* HAVE_RLIMIT_TCACHE */
-# ifdef HAVE_RLIMIT_SBSIZE
- case RLIMIT_SBSIZE:
- if (head)
- printf("-b: socket buffer size (bytes) ");
- break;
-# endif /* HAVE_RLIMIT_SBSIZE */
-# ifdef HAVE_RLIMIT_PTHREAD
- case RLIMIT_PTHREAD:
- if (head)
- printf("%s", THREAD_FMT);
- break;
-# endif /* HAVE_RLIMIT_PTHREAD */
-# ifdef HAVE_RLIMIT_NICE
- case RLIMIT_NICE:
- if (head)
- printf("-e: max nice ");
- break;
-# endif /* HAVE_RLIMIT_NICE */
-# ifdef HAVE_RLIMIT_RTPRIO
- case RLIMIT_RTPRIO:
- if (head)
- printf("-r: max rt priority ");
- break;
-# endif /* HAVE_RLIMIT_RTPRIO */
-# ifdef HAVE_RLIMIT_NPTS
- case RLIMIT_NPTS:
- if (head)
- printf("-p: pseudo-terminals ");
- break;
-# endif /* HAVE_RLIMIT_NPTS */
-# ifdef HAVE_RLIMIT_SWAP
- case RLIMIT_SWAP:
- if (head)
- printf("-w: swap size (kbytes) ");
- if (limit != RLIM_INFINITY)
- limit /= 1024;
- break;
-# endif /* HAVE_RLIMIT_SWAP */
-# ifdef HAVE_RLIMIT_KQUEUES
- case RLIMIT_KQUEUES:
- if (head)
- printf("-k: kqueues ");
- break;
-# endif /* HAVE_RLIMIT_KQUEUES */
-# ifdef HAVE_RLIMIT_UMTXP
- case RLIMIT_UMTXP:
- if (head)
- printf("-o: umtx shared locks ");
- break;
-# endif /* HAVE_RLIMIT_UMTXP */
- default:
- if (head)
- printf("-N %2d: ", lim);
- break;
+ if (head) {
+ if (lim < RLIM_NLIMITS) {
+ const resinfo_T *info = resinfo[lim];
+ if (info->opt == 'N')
+ printf("-N %2d: %-29s", lim, info->descr);
+ else
+ printf("-%c: %-32s", info->opt, info->descr);
+ }
+ else
+ printf("-N %2d: %-29s", lim, "");
}
/* display the limit */
if (limit == RLIM_INFINITY)
printf("unlimited\n");
else {
-# ifdef RLIM_T_IS_QUAD_T
- printf("%qd\n", limit);
-# else
-# ifdef RLIM_T_IS_LONG_LONG
- printf("%lld\n", limit);
-# else
-# ifdef RLIM_T_IS_UNSIGNED
- printf("%lu\n", (unsigned long)limit);
-# else
- printf("%ld\n", (long)limit);
-# endif /* RLIM_T_IS_UNSIGNED */
-# endif /* RLIM_T_IS_LONG_LONG */
-# endif /* RLIM_T_IS_QUAD_T */
+ if (lim < RLIM_NLIMITS)
+ printrlim(limit/resinfo[lim]->unit, "\n");
+ else
+ printrlim(limit, "\n");
}
return 0;
@@ -450,7 +418,7 @@ printulimit(char *nam, int lim, int hard, int head)
static int
do_limit(char *nam, int lim, rlim_t val, int hard, int soft, int set)
{
- if (lim >= ZSH_NLIMITS) {
+ if (lim >= RLIM_NLIMITS) {
struct rlimit vals;
if (getrlimit(lim, &vals) < 0)
{
@@ -558,8 +526,8 @@ bin_limit(char *nam, char **argv, Options ops, UNUSED(int func))
lim = (int)zstrtol(s, NULL, 10);
}
else
- for (lim = -1, limnum = 0; limnum < ZSH_NLIMITS; limnum++)
- if (!strncmp(recs[limnum], s, strlen(s))) {
+ for (lim = -1, limnum = 0; limnum < RLIM_NLIMITS; limnum++)
+ if (!strncmp(resinfo[limnum]->name, s, strlen(s))) {
if (lim != -1)
lim = -2;
else
@@ -576,7 +544,7 @@ bin_limit(char *nam, char **argv, Options ops, UNUSED(int func))
/* without value for limit, display the current limit */
if (!(s = *argv++))
return showlimits(nam, hard, lim);
- if (lim >= ZSH_NLIMITS)
+ if (lim >= RLIM_NLIMITS)
{
val = zstrtorlimt(s, &s, 10);
if (*s)
@@ -586,7 +554,7 @@ bin_limit(char *nam, char **argv, Options ops, UNUSED(int func))
return 1;
}
}
- else if (limtype[lim] == ZLIMTYPE_TIME) {
+ else if (resinfo[lim]->type == ZLIMTYPE_TIME) {
/* time-type resource -- may be specified as seconds, or minutes or *
* hours with the `m' and `h' modifiers, and `:' may be used to add *
* together more than one of these. It's easier to understand from *
@@ -604,9 +572,9 @@ bin_limit(char *nam, char **argv, Options ops, UNUSED(int func))
return 1;
}
}
- } else if (limtype[lim] == ZLIMTYPE_NUMBER ||
- limtype[lim] == ZLIMTYPE_UNKNOWN ||
- limtype[lim] == ZLIMTYPE_MICROSECONDS) {
+ } else if (resinfo[lim]->type == ZLIMTYPE_NUMBER ||
+ resinfo[lim]->type == ZLIMTYPE_UNKNOWN ||
+ resinfo[lim]->type == ZLIMTYPE_MICROSECONDS) {
/* pure numeric resource -- only a straight decimal number is
permitted. */
char *t = s;
@@ -642,7 +610,7 @@ static int
do_unlimit(char *nam, int lim, int hard, int soft, int set, int euid)
{
/* remove specified limit */
- if (lim >= ZSH_NLIMITS) {
+ if (lim >= RLIM_NLIMITS) {
struct rlimit vals;
if (getrlimit(lim, &vals) < 0)
{
@@ -718,8 +686,8 @@ bin_unlimit(char *nam, char **argv, Options ops, UNUSED(int func))
if (idigit(**argv)) {
lim = (int)zstrtol(*argv, NULL, 10);
} else {
- for (lim = -1, limnum = 0; limnum < ZSH_NLIMITS; limnum++)
- if (!strncmp(recs[limnum], *argv, strlen(*argv))) {
+ for (lim = -1, limnum = 0; limnum < RLIM_NLIMITS; limnum++)
+ if (!strncmp(resinfo[limnum]->name, *argv, strlen(*argv))) {
if (lim != -1)
lim = -2;
else
@@ -800,116 +768,14 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
resmask = (1 << RLIM_NLIMITS) - 1;
nres = RLIM_NLIMITS;
continue;
- case 't':
- res = RLIMIT_CPU;
- break;
- case 'f':
- res = RLIMIT_FSIZE;
- break;
- case 'd':
- res = RLIMIT_DATA;
- break;
- case 's':
- res = RLIMIT_STACK;
- break;
- case 'c':
- res = RLIMIT_CORE;
- break;
-# ifdef HAVE_RLIMIT_SBSIZE
- case 'b':
- res = RLIMIT_SBSIZE;
- break;
-# endif /* HAVE_RLIMIT_SBSIZE */
-# ifdef HAVE_RLIMIT_MEMLOCK
- case 'l':
- res = RLIMIT_MEMLOCK;
- break;
-# endif /* HAVE_RLIMIT_MEMLOCK */
-# ifdef HAVE_RLIMIT_RSS
- case 'm':
- res = RLIMIT_RSS;
- break;
-# endif /* HAVE_RLIMIT_RSS */
-# ifdef HAVE_RLIMIT_NOFILE
- case 'n':
- res = RLIMIT_NOFILE;
- break;
-# endif /* HAVE_RLIMIT_NOFILE */
-# ifdef HAVE_RLIMIT_NPROC
- case 'u':
- res = RLIMIT_NPROC;
- break;
-# endif /* HAVE_RLIMIT_NPROC */
-# if defined(HAVE_RLIMIT_VMEM) || defined(HAVE_RLIMIT_AS)
- case 'v':
-# ifdef HAVE_RLIMIT_VMEM
- res = RLIMIT_VMEM;
-# else
- res = RLIMIT_AS;
-# endif
- break;
-# endif /* HAVE_RLIMIT_VMEM */
-# ifdef HAVE_RLIMIT_LOCKS
- case 'x':
- res = RLIMIT_LOCKS;
- break;
-# endif
-# ifdef HAVE_RLIMIT_SIGPENDING
- case 'i':
- res = RLIMIT_SIGPENDING;
- break;
-# endif
-# ifdef HAVE_RLIMIT_MSGQUEUE
- case 'q':
- res = RLIMIT_MSGQUEUE;
- break;
-# endif
-# ifdef HAVE_RLIMIT_NICE
- case 'e':
- res = RLIMIT_NICE;
- break;
-# endif
-# ifdef HAVE_RLIMIT_RTPRIO
- case 'r':
- res = RLIMIT_RTPRIO;
- break;
-# else
-# ifdef HAVE_RLIMIT_NTHR
- /* For compatibility with sh on NetBSD */
- case 'r':
- res = RLIMIT_NTHR;
- break;
-# endif /* HAVE_RLIMIT_NTHR */
-# endif
-# ifdef HAVE_RLIMIT_NPTS
- case 'p':
- res = RLIMIT_NPTS;
- break;
-# endif
-# ifdef HAVE_RLIMIT_SWAP
- case 'w':
- res = RLIMIT_SWAP;
- break;
-# endif
-# ifdef HAVE_RLIMIT_KQUEUES
- case 'k':
- res = RLIMIT_KQUEUES;
- break;
-# endif
-# ifdef HAVE_RLIMIT_PTHREAD
- case 'T':
- res = RLIMIT_PTHREAD;
- break;
-# endif
-# ifdef HAVE_RLIMIT_UMTXP
- case 'o':
- res = RLIMIT_UMTXP;
- break;
-# endif
default:
- /* unrecognised limit */
- zwarnnam(name, "bad option: -%c", *options);
- return 1;
+ res = find_resource(*options);
+ if (res < 0) {
+ /* unrecognised limit */
+ zwarnnam(name, "bad option: -%c", *options);
+ return 1;
+ }
+ break;
}
if (options[1]) {
resmask |= 1 << res;
@@ -961,34 +827,8 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
return 1;
}
/* scale appropriately */
- switch (res) {
- case RLIMIT_FSIZE:
- case RLIMIT_CORE:
- limit *= 512;
- break;
- case RLIMIT_DATA:
- case RLIMIT_STACK:
-# ifdef HAVE_RLIMIT_RSS
- case RLIMIT_RSS:
-# endif /* HAVE_RLIMIT_RSS */
-# ifdef HAVE_RLIMIT_MEMLOCK
- case RLIMIT_MEMLOCK:
-# endif /* HAVE_RLIMIT_MEMLOCK */
-/* If RLIMIT_VMEM and RLIMIT_RSS are defined and equal, avoid *
- * duplicate case statement. Observed on QNX Neutrino 6.1.0. */
-# if defined(HAVE_RLIMIT_VMEM) && !defined(RLIMIT_VMEM_IS_RSS)
- case RLIMIT_VMEM:
-# endif /* HAVE_RLIMIT_VMEM */
-/* ditto RLIMIT_VMEM and RLIMIT_AS */
-# if defined(HAVE_RLIMIT_AS) && !defined(RLIMIT_VMEM_IS_AS) && !defined(RLIMIT_RSS_IS_AS)
- case RLIMIT_AS:
-# endif /* HAVE_RLIMIT_AS */
-# ifdef HAVE_RLIMIT_AIO_MEM
- case RLIMIT_AIO_MEM:
-# endif /* HAVE_RLIMIT_AIO_MEM */
- limit *= 1024;
- break;
- }
+ if (res < RLIM_NLIMITS)
+ limit *= resinfo[res]->unit;
}
if (do_limit(name, res, limit, hard, soft, 1))
ret++;
@@ -1052,6 +892,7 @@ enables_(Module m, int **enables)
int
boot_(UNUSED(Module m))
{
+ set_resinfo();
return 0;
}
@@ -1059,6 +900,7 @@ boot_(UNUSED(Module m))
int
cleanup_(Module m)
{
+ free_resinfo();
return setfeatureenables(m, &module_features, NULL);
}
diff --git a/Src/Builtins/rlimits.mdd b/Src/Builtins/rlimits.mdd
index 9e6e9e598..06c9e9c7f 100644
--- a/Src/Builtins/rlimits.mdd
+++ b/Src/Builtins/rlimits.mdd
@@ -6,18 +6,3 @@ autofeatures="b:limit b:ulimit b:unlimit"
autofeatures_emu="b:ulimit"
objects="rlimits.o"
-
-:<<\Make
-rlimits.o rlimits..o: rlimits.h
-
-# this file will not be made if limits are unavailable
-rlimits.h: rlimits.awk @RLIMITS_INC_H@
- $(AWK) -f $(sdir)/rlimits.awk @RLIMITS_INC_H@ /dev/null > rlimits.h
- @if grep ZLIMTYPE_UNKNOWN rlimits.h >/dev/null; then \
- echo >&2 WARNING: unknown limits: mail Src/Builtins/rlimits.h to developers; \
- else :; fi
-
-clean-here: clean.rlimits
-clean.rlimits:
- rm -f rlimits.h
-Make
diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c
index 19f285e34..e46903916 100644
--- a/Src/Modules/curses.c
+++ b/Src/Modules/curses.c
@@ -1212,7 +1212,7 @@ zccmd_input(const char *nam, char **args)
addlinknode(margs, "CTRL");
if (mevent.bstate & BUTTON_ALT)
addlinknode(margs, "ALT");
- if (!setaparam(args[3], zlinklist2array(margs)))
+ if (!setaparam(args[3], zlinklist2array(margs, 1)))
return 1;
} else {
#endif
@@ -1464,7 +1464,7 @@ zccmd_querychar(const char *nam, char **args)
}
/* Turn this into an array and store it. */
- return !setaparam(args[1] ? args[1] : "reply", zlinklist2array(clist));
+ return !setaparam(args[1] ? args[1] : "reply", zlinklist2array(clist, 1));
}
diff --git a/Src/Modules/curses_keys.awk b/Src/Modules/curses_keys.awk
index ffb182c35..25bd63c7e 100644
--- a/Src/Modules/curses_keys.awk
+++ b/Src/Modules/curses_keys.awk
@@ -12,8 +12,13 @@ BEGIN {nkeydefs = 0}
END {
printf("static const struct zcurses_namenumberpair keypad_names[] = {\n")
- for (i = 0; i < 0 + nkeydefs; i++)
+ for (i = 0; i < 0 + nkeydefs; i++) {
+ if (name[i] == "EVENT")
+ printf("#ifdef KEY_EVENT\n")
printf(" {\"%s\", KEY_%s},\n", name[i], name[i])
+ if (name[i] == "EVENT")
+ printf("#endif\n")
+ }
printf(" {NULL, 0}\n")
printf("};\n")
}
diff --git a/Src/Modules/datetime.c b/Src/Modules/datetime.c
index 521c15a5b..085e4cc26 100644
--- a/Src/Modules/datetime.c
+++ b/Src/Modules/datetime.c
@@ -175,7 +175,8 @@ output_strftime(char *nam, char **argv, Options ops, UNUSED(int func))
setsparam(scalar, metafy(buffer, len, META_DUP));
} else {
fwrite(buffer, 1, len, stdout);
- putchar('\n');
+ if (!OPT_ISSET(ops,'n'))
+ putchar('\n');
}
zfree(buffer, bufsize);
@@ -235,7 +236,7 @@ getcurrenttime(UNUSED(Param pm))
}
static struct builtin bintab[] = {
- BUILTIN("strftime", 0, bin_strftime, 1, 3, 0, "qrs:", NULL),
+ BUILTIN("strftime", 0, bin_strftime, 1, 3, 0, "nqrs:", NULL),
};
static const struct gsu_integer epochseconds_gsu =
diff --git a/Src/Modules/db_gdbm.c b/Src/Modules/db_gdbm.c
index b8e7c76c6..7e11ec939 100644
--- a/Src/Modules/db_gdbm.c
+++ b/Src/Modules/db_gdbm.c
@@ -233,7 +233,7 @@ bin_zuntie(char *nam, char **args, Options ops, UNUSED(int func))
/**/
static int
-bin_zgdbmpath(char *nam, char **args, Options ops, UNUSED(int func))
+bin_zgdbmpath(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
{
Param pm;
char *pmname;
@@ -332,6 +332,8 @@ gdbmgetfn(Param pm)
/* Can return pointer, correctly saved inside hash */
return pm->u.str;
+ } else {
+ pm->node.flags |= PM_DEFAULTED;
}
/* Free key */
diff --git a/Src/Modules/files.c b/Src/Modules/files.c
index 6d20e38a8..bf0e8f8a8 100644
--- a/Src/Modules/files.c
+++ b/Src/Modules/files.c
@@ -32,12 +32,6 @@
typedef int (*MoveFunc) _((char const *, char const *));
typedef int (*RecurseFunc) _((char *, char *, struct stat const *, void *));
-#ifndef STDC_HEADERS
-extern int link _((const char *, const char *));
-extern int symlink _((const char *, const char *));
-extern int rename _((const char *, const char *));
-#endif
-
struct recursivecmd;
#include "files.pro"
@@ -122,19 +116,29 @@ domkdir(char *nam, char *path, mode_t mode, int p)
{
int err;
mode_t oumask;
+ struct stat st;
+ int n = 8;
char const *rpath = unmeta(path);
- if(p) {
- struct stat st;
-
- if(!stat(rpath, &st) && S_ISDIR(st.st_mode))
+ while(n-- > 0) {
+ oumask = umask(0);
+ err = mkdir(rpath, mode) ? errno : 0;
+ umask(oumask);
+ if (!err)
return 0;
+ if(!p || err != EEXIST)
+ break;
+ if(stat(rpath, &st)) {
+ if(errno == ENOENT)
+ continue;
+ err = errno;
+ break;
+ }
+ if(S_ISDIR(st.st_mode))
+ return 0;
+ break;
}
- oumask = umask(0);
- err = mkdir(rpath, mode) ? errno : 0;
- umask(oumask);
- if(!err)
- return 0;
+
zwarnnam(nam, "cannot make directory `%s': %e", path, err);
return 1;
}
@@ -342,7 +346,13 @@ domove(char *nam, MoveFunc movefn, char *p, char *q, int flags)
unlink(qbuf);
}
if(movefn(pbuf, qbuf)) {
- zwarnnam(nam, "%s: %e", p, errno);
+ int ferrno = errno;
+ char *errfile = p;
+ if (ferrno == ENOENT && !lstat(pbuf, &st)) {
+ /* p *does* exist, so error is in q */
+ errfile = q;
+ }
+ zwarnnam(nam, "`%s': %e", errfile, ferrno);
zsfree(pbuf);
return 1;
}
@@ -642,7 +652,7 @@ chmod_dochmod(char *arg, char *rp, UNUSED(struct stat const *sp), void *magic)
/**/
static int
-bin_chmod(char *nam, char **args, Options ops, int func)
+bin_chmod(char *nam, char **args, Options ops, UNUSED(int func))
{
struct chmodmagic chm;
char *str = args[0], *ptr;
diff --git a/Src/Modules/nearcolor.c b/Src/Modules/nearcolor.c
index b49ee9afb..d50a6bb44 100644
--- a/Src/Modules/nearcolor.c
+++ b/Src/Modules/nearcolor.c
@@ -188,7 +188,7 @@ enables_(Module m, int **enables)
/**/
int
-boot_(Module m)
+boot_(UNUSED(Module m))
{
addhookfunc("get_color_attr", (Hookfn) getnearestcolor);
return 0;
diff --git a/Src/Modules/param_private.c b/Src/Modules/param_private.c
index 86416c5c5..c53839152 100644
--- a/Src/Modules/param_private.c
+++ b/Src/Modules/param_private.c
@@ -125,7 +125,7 @@ makeprivate(HashNode hn, UNUSED(int flags))
break;
}
/* PM_HIDE so new parameters in deeper scopes do not shadow */
- pm->node.flags |= (PM_HIDE|PM_SPECIAL|PM_REMOVABLE);
+ pm->node.flags |= (PM_HIDE|PM_SPECIAL|PM_REMOVABLE|PM_RO_BY_DESIGN);
pm->level -= 1;
}
}
@@ -171,6 +171,7 @@ bin_private(char *nam, char **args, LinkList assigns, Options ops, int func)
{
int from_typeset = 1;
int ofake = fakelevel; /* paranoia in case of recursive call */
+ int hasargs = /* *args != NULL || */ (assigns && firstnode(assigns));
makeprivate_error = 0;
if (!OPT_ISSET(ops, 'P')) {
@@ -189,7 +190,12 @@ bin_private(char *nam, char **args, LinkList assigns, Options ops, int func)
return bin_typeset("private", args, assigns, ops, func);
}
- ops->ind['g'] = 2; /* force bin_typeset() to behave as "local" */
+ if (!(OPT_ISSET(ops, 'm') || OPT_ISSET(ops, '+')))
+ ops->ind['g'] = 2; /* force bin_typeset() to behave as "local" */
+ if (OPT_ISSET(ops, 'p') || OPT_ISSET(ops, 'm') ||
+ (!hasargs && OPT_ISSET(ops, '+'))) {
+ return bin_typeset("private", args, assigns, ops, func);
+ }
queue_signals();
fakelevel = locallevel;
@@ -555,7 +561,7 @@ printprivatenode(HashNode hn, int printflags)
static struct builtin bintab[] = {
/* Copied from BUILTIN("local"), "P" added */
- BUILTIN("private", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_private, 0, -1, 0, "AE:%F:%HL:%PR:%TUZ:%ahi:%lprtux", "P")
+ BUILTIN("private", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_private, 0, -1, 0, "AE:%F:%HL:%PR:%TUZ:%ahi:%lmprtux", "P")
};
static struct features module_features = {
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index ef9148d7b..dbb61e474 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -592,7 +592,7 @@ getpmfunction_source(HashTable ht, const char *name)
return getfunction_source(ht, name, 0);
}
-/* Param table entry for retrieving ds_functions_source element */
+/* Param table entry for retrieving dis_functions_source element */
/**/
static HashNode
@@ -1244,19 +1244,19 @@ histwgetfn(UNUSED(Param pm))
/**/
static char *
-pmjobtext(int job)
+pmjobtext(Job jtab, int job)
{
Process pn;
int len = 1;
char *ret;
- for (pn = jobtab[job].procs; pn; pn = pn->next)
+ for (pn = jtab[job].procs; pn; pn = pn->next)
len += strlen(pn->text) + 3;
ret = (char *) zhalloc(len);
ret[0] = '\0';
- for (pn = jobtab[job].procs; pn; pn = pn->next) {
+ for (pn = jtab[job].procs; pn; pn = pn->next) {
strcat(ret, pn->text);
if (pn->next)
strcat(ret, " | ");
@@ -1269,22 +1269,25 @@ static HashNode
getpmjobtext(UNUSED(HashTable ht), const char *name)
{
Param pm = NULL;
- int job;
+ int job, jmax;
char *pend;
+ Job jtab;
pm = (Param) hcalloc(sizeof(struct param));
pm->node.nam = dupstring(name);
pm->node.flags = PM_SCALAR | PM_READONLY;
pm->gsu.s = &nullsetscalar_gsu;
+ selectjobtab(&jtab, &jmax);
+
job = strtod(name, &pend);
/* Non-numeric keys are looked up by job name */
if (*pend)
job = getjob(name, NULL);
- if (job >= 1 && job <= maxjob &&
- jobtab[job].stat && jobtab[job].procs &&
- !(jobtab[job].stat & STAT_NOPRINT))
- pm->u.str = pmjobtext(job);
+ if (job >= 1 && job <= jmax &&
+ jtab[job].stat && jtab[job].procs &&
+ !(jtab[job].stat & STAT_NOPRINT))
+ pm->u.str = pmjobtext(jtab, job);
else {
pm->u.str = dupstring("");
pm->node.flags |= (PM_UNSET|PM_SPECIAL);
@@ -1297,22 +1300,25 @@ static void
scanpmjobtexts(UNUSED(HashTable ht), ScanFunc func, int flags)
{
struct param pm;
- int job;
+ int job, jmax;
char buf[40];
+ Job jtab;
memset((void *)&pm, 0, sizeof(struct param));
pm.node.flags = PM_SCALAR | PM_READONLY;
pm.gsu.s = &nullsetscalar_gsu;
- for (job = 1; job <= maxjob; job++) {
- if (jobtab[job].stat && jobtab[job].procs &&
- !(jobtab[job].stat & STAT_NOPRINT)) {
+ selectjobtab(&jtab, &jmax);
+
+ for (job = 1; job <= jmax; job++) {
+ if (jtab[job].stat && jtab[job].procs &&
+ !(jtab[job].stat & STAT_NOPRINT)) {
if (func != scancountparams) {
sprintf(buf, "%d", job);
pm.node.nam = dupstring(buf);
if ((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
!(flags & SCANPM_WANTKEYS))
- pm.u.str = pmjobtext(job);
+ pm.u.str = pmjobtext(jtab, job);
}
func(&pm.node, flags);
}
@@ -1323,7 +1329,7 @@ scanpmjobtexts(UNUSED(HashTable ht), ScanFunc func, int flags)
/**/
static char *
-pmjobstate(int job)
+pmjobstate(Job jtab, int job)
{
Process pn;
char buf[256], buf2[128], *ret, *state, *cp;
@@ -1335,14 +1341,14 @@ pmjobstate(int job)
else
cp = ":";
- if (jobtab[job].stat & STAT_DONE)
+ if (jtab[job].stat & STAT_DONE)
ret = dyncat("done", cp);
- else if (jobtab[job].stat & STAT_STOPPED)
+ else if (jtab[job].stat & STAT_STOPPED)
ret = dyncat("suspended", cp);
else
ret = dyncat("running", cp);
- for (pn = jobtab[job].procs; pn; pn = pn->next) {
+ for (pn = jtab[job].procs; pn; pn = pn->next) {
if (pn->status == SP_RUNNING)
state = "running";
@@ -1371,21 +1377,24 @@ static HashNode
getpmjobstate(UNUSED(HashTable ht), const char *name)
{
Param pm = NULL;
- int job;
+ int job, jmax;
char *pend;
+ Job jtab;
pm = (Param) hcalloc(sizeof(struct param));
pm->node.nam = dupstring(name);
pm->node.flags = PM_SCALAR | PM_READONLY;
pm->gsu.s = &nullsetscalar_gsu;
+ selectjobtab(&jtab, &jmax);
+
job = strtod(name, &pend);
if (*pend)
job = getjob(name, NULL);
- if (job >= 1 && job <= maxjob &&
- jobtab[job].stat && jobtab[job].procs &&
- !(jobtab[job].stat & STAT_NOPRINT))
- pm->u.str = pmjobstate(job);
+ if (job >= 1 && job <= jmax &&
+ jtab[job].stat && jtab[job].procs &&
+ !(jtab[job].stat & STAT_NOPRINT))
+ pm->u.str = pmjobstate(jtab, job);
else {
pm->u.str = dupstring("");
pm->node.flags |= (PM_UNSET|PM_SPECIAL);
@@ -1398,22 +1407,25 @@ static void
scanpmjobstates(UNUSED(HashTable ht), ScanFunc func, int flags)
{
struct param pm;
- int job;
+ int job, jmax;
+ Job jtab;
char buf[40];
+ selectjobtab(&jtab, &jmax);
+
memset((void *)&pm, 0, sizeof(struct param));
pm.node.flags = PM_SCALAR | PM_READONLY;
pm.gsu.s = &nullsetscalar_gsu;
- for (job = 1; job <= maxjob; job++) {
- if (jobtab[job].stat && jobtab[job].procs &&
- !(jobtab[job].stat & STAT_NOPRINT)) {
+ for (job = 1; job <= jmax; job++) {
+ if (jtab[job].stat && jtab[job].procs &&
+ !(jtab[job].stat & STAT_NOPRINT)) {
if (func != scancountparams) {
sprintf(buf, "%d", job);
pm.node.nam = dupstring(buf);
if ((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
!(flags & SCANPM_WANTKEYS))
- pm.u.str = pmjobstate(job);
+ pm.u.str = pmjobstate(jtab, job);
}
func(&pm.node, flags);
}
@@ -1424,11 +1436,11 @@ scanpmjobstates(UNUSED(HashTable ht), ScanFunc func, int flags)
/**/
static char *
-pmjobdir(int job)
+pmjobdir(Job jtab, int job)
{
char *ret;
- ret = dupstring(jobtab[job].pwd ? jobtab[job].pwd : pwd);
+ ret = dupstring(jtab[job].pwd ? jtab[job].pwd : pwd);
return ret;
}
@@ -1437,21 +1449,24 @@ static HashNode
getpmjobdir(UNUSED(HashTable ht), const char *name)
{
Param pm = NULL;
- int job;
+ int job, jmax;
char *pend;
+ Job jtab;
pm = (Param) hcalloc(sizeof(struct param));
pm->node.nam = dupstring(name);
pm->node.flags = PM_SCALAR | PM_READONLY;
pm->gsu.s = &nullsetscalar_gsu;
+ selectjobtab(&jtab, &jmax);
+
job = strtod(name, &pend);
if (*pend)
job = getjob(name, NULL);
- if (job >= 1 && job <= maxjob &&
- jobtab[job].stat && jobtab[job].procs &&
- !(jobtab[job].stat & STAT_NOPRINT))
- pm->u.str = pmjobdir(job);
+ if (job >= 1 && job <= jmax &&
+ jtab[job].stat && jtab[job].procs &&
+ !(jtab[job].stat & STAT_NOPRINT))
+ pm->u.str = pmjobdir(jtab, job);
else {
pm->u.str = dupstring("");
pm->node.flags |= (PM_UNSET|PM_SPECIAL);
@@ -1464,22 +1479,25 @@ static void
scanpmjobdirs(UNUSED(HashTable ht), ScanFunc func, int flags)
{
struct param pm;
- int job;
+ int job, jmax;
char buf[40];
+ Job jtab;
memset((void *)&pm, 0, sizeof(struct param));
pm.node.flags = PM_SCALAR | PM_READONLY;
pm.gsu.s = &nullsetscalar_gsu;
- for (job = 1; job <= maxjob; job++) {
- if (jobtab[job].stat && jobtab[job].procs &&
- !(jobtab[job].stat & STAT_NOPRINT)) {
+ selectjobtab(&jtab, &jmax);
+
+ for (job = 1; job <= jmax; job++) {
+ if (jtab[job].stat && jtab[job].procs &&
+ !(jtab[job].stat & STAT_NOPRINT)) {
if (func != scancountparams) {
sprintf(buf, "%d", job);
pm.node.nam = dupstring(buf);
if ((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
!(flags & SCANPM_WANTKEYS))
- pm.u.str = pmjobdir(job);
+ pm.u.str = pmjobdir(jtab, job);
}
func(&pm.node, flags);
}
@@ -2011,6 +2029,9 @@ scanpmdissaliases(HashTable ht, ScanFunc func, int flags)
/**/
static Groupset get_all_groups(void)
{
+#ifdef DISABLE_DYNAMIC_NSS
+ return NULL;
+#else
Groupset gs = zhalloc(sizeof(*gs));
Groupmap gaptr;
gid_t *list, *lptr, egid;
@@ -2063,6 +2084,7 @@ static Groupset get_all_groups(void)
}
return gs;
+#endif /* DISABLE_DYNAMIC_NSS */
}
/* Standard hash element lookup. */
@@ -2081,7 +2103,11 @@ getpmusergroups(UNUSED(HashTable ht), const char *name)
pm->gsu.s = &nullsetscalar_gsu;
if (!gs) {
+#ifdef DISABLE_DYNAMIC_NSS
+ zerr("parameter 'usergroups' not available: NSS is disabled");
+#else
zerr("failed to retrieve groups for user: %e", errno);
+#endif
pm->u.str = dupstring("");
pm->node.flags |= (PM_UNSET|PM_SPECIAL);
return &pm->node;
@@ -2113,7 +2139,11 @@ scanpmusergroups(UNUSED(HashTable ht), ScanFunc func, int flags)
Groupmap gaptr;
if (!gs) {
+#ifdef DISABLE_DYNAMIC_NSS
+ zerr("parameter 'usergroups' not available: NSS is disabled");
+#else
zerr("failed to retrieve groups for user: %e", errno);
+#endif
return;
}
diff --git a/Src/Modules/system.c b/Src/Modules/system.c
index fb3d80773..71745548f 100644
--- a/Src/Modules/system.c
+++ b/Src/Modules/system.c
@@ -29,6 +29,7 @@
#include "system.mdh"
#include "system.pro"
+#include <math.h>
#ifdef HAVE_POLL_H
# include <poll.h>
@@ -279,7 +280,7 @@ bin_syswrite(char *nam, char **args, Options ops, UNUSED(int func))
}
-static struct { char *name; int oflag; } openopts[] = {
+static struct { const char *name; int oflag; } openopts[] = {
#ifdef O_CLOEXEC
{ "cloexec", O_CLOEXEC },
#else
@@ -296,6 +297,9 @@ static struct { char *name; int oflag; } openopts[] = {
#ifdef O_NOATIME
{ "noatime", O_NOATIME },
#endif
+#ifdef O_NONBLOCK
+ { "nonblock", O_NONBLOCK},
+#endif
{ "excl", O_EXCL | O_CREAT },
{ "creat", O_CREAT },
{ "create", O_CREAT },
@@ -531,7 +535,9 @@ static int
bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
{
int cloexec = 1, unlock = 0, readlock = 0;
- zlong timeout = -1;
+ double timeout = -1;
+ long timeout_interval = 1e6;
+ mnumber timeout_param;
char *fdvar = NULL;
#ifdef HAVE_FCNTL_H
struct flock lck;
@@ -583,7 +589,51 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
} else {
optarg = *args++;
}
- timeout = mathevali(optarg);
+ timeout_param = matheval(optarg);
+ timeout = (timeout_param.type & MN_FLOAT) ?
+ timeout_param.u.d : (double)timeout_param.u.l;
+
+ /*
+ * timeout must not overflow time_t, but little is known
+ * about this type's limits. Conservatively limit to 2^30-1
+ * (34 years). Then it can only overflow if time_t is only
+ * a 32-bit int and CLOCK_MONOTONIC is not supported, in which
+ * case there is a Y2038 problem anyway.
+ */
+ if (timeout > 1073741823.) {
+ zwarnnam(nam, "flock: invalid timeout value: '%s'",
+ optarg);
+ return 1;
+ }
+ break;
+
+ case 'i':
+ /* retry interval in seconds */
+ if (optptr[1]) {
+ optarg = optptr + 1;
+ optptr += strlen(optarg) - 1;
+ } else if (!*args) {
+ zwarnnam(nam,
+ "flock: option %c requires "
+ "a numeric retry interval",
+ opt);
+ return 1;
+ } else {
+ optarg = *args++;
+ }
+ timeout_param = matheval(optarg);
+ if (!(timeout_param.type & MN_FLOAT)) {
+ timeout_param.type = MN_FLOAT;
+ timeout_param.u.d = (double)timeout_param.u.l;
+ }
+ timeout_param.u.d = ceil(timeout_param.u.d * 1e6);
+ if (timeout_param.u.d < 1
+ || timeout_param.u.d > 0.999 * LONG_MAX) {
+ zwarnnam(nam, "flock: invalid interval value: '%s'",
+ optarg);
+ return 1;
+ }
+ timeout_interval = (long)timeout_param.u.d;
break;
case 'u':
@@ -647,7 +697,24 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
lck.l_len = 0; /* lock the whole file */
if (timeout > 0) {
- time_t end = time(NULL) + (time_t)timeout;
+ /*
+ * Get current time, calculate timeout time.
+ * No need to check for overflow, already checked above.
+ */
+ struct timespec now, end;
+ double timeout_s;
+ long remaining_us;
+ zgettime_monotonic_if_available(&now);
+ end.tv_sec = now.tv_sec;
+ end.tv_nsec = now.tv_nsec;
+ end.tv_nsec += ceil(modf(timeout, &timeout_s) * 1000000000L);
+ end.tv_sec += timeout_s;
+ if (end.tv_nsec >= 1000000000L) {
+ end.tv_nsec -= 1000000000L;
+ end.tv_sec += 1;
+ }
+
+ /* Try acquiring lock, loop until timeout. */
while (fcntl(flock_fd, F_SETLK, &lck) < 0) {
if (errflag) {
zclose(flock_fd);
@@ -658,11 +725,16 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
zwarnnam(nam, "failed to lock file %s: %e", args[0], errno);
return 1;
}
- if (time(NULL) >= end) {
+ zgettime_monotonic_if_available(&now);
+ remaining_us = timespec_diff_us(&now, &end);
+ if (remaining_us <= 0) {
zclose(flock_fd);
return 2;
}
- sleep(1);
+ if (remaining_us <= timeout_interval) {
+ timeout_interval = remaining_us;
+ }
+ zsleep(timeout_interval);
}
} else {
while (fcntl(flock_fd, timeout == 0 ? F_SETLK : F_SETLKW, &lck) < 0) {
diff --git a/Src/watch.c b/Src/Modules/watch.c
index 93b3cb134..d45c3cf3d 100644
--- a/Src/watch.c
+++ b/Src/Modules/watch.c
@@ -27,7 +27,7 @@
*
*/
-#include "zsh.mdh"
+#include "watch.mdh"
/* Headers for utmp/utmpx structures */
#ifdef HAVE_UTMP_H
@@ -139,9 +139,6 @@
# define DEFAULT_WATCHFMT "%n has %a %l."
#endif /* !WATCH_UTMP_UT_HOST */
-/**/
-char const * const default_watchfmt = DEFAULT_WATCHFMT;
-
#ifdef WATCH_STRUCT_UTMP
# include "watch.pro"
@@ -152,11 +149,14 @@ char const * const default_watchfmt = DEFAULT_WATCHFMT;
static int wtabsz = 0;
static WATCH_STRUCT_UTMP *wtab = NULL;
+
+/* the last time we checked the people in the WATCH variable */
+static time_t lastwatch;
+
static time_t lastutmpcheck = 0;
/* get the time of login/logout for WATCH */
-/**/
static time_t
getlogtime(WATCH_STRUCT_UTMP *u, int inout)
{
@@ -169,9 +169,9 @@ getlogtime(WATCH_STRUCT_UTMP *u, int inout)
return u->ut_time;
if (!(in = fopen(WATCH_WTMP_FILE, "r")))
return time(NULL);
- fseek(in, 0, 2);
+ fseek(in, 0, SEEK_END);
do {
- if (fseek(in, ((first) ? -1 : -2) * sizeof(WATCH_STRUCT_UTMP), 1)) {
+ if (fseek(in, ((first) ? -1 : -2) * sizeof(WATCH_STRUCT_UTMP), SEEK_CUR)) {
fclose(in);
return time(NULL);
}
@@ -202,7 +202,6 @@ getlogtime(WATCH_STRUCT_UTMP *u, int inout)
# define BEGIN3 '('
# define END3 ')'
-/**/
static char *
watch3ary(int inout, WATCH_STRUCT_UTMP *u, char *fmt, int prnt)
{
@@ -247,6 +246,7 @@ watchlog2(int inout, WATCH_STRUCT_UTMP *u, char *fmt, int prnt, int fini)
struct tm *tm;
char *fm2;
int len;
+ zattr atr;
# ifdef WATCH_UTMP_UT_HOST
char *p;
int i;
@@ -348,6 +348,40 @@ watchlog2(int inout, WATCH_STRUCT_UTMP *u, char *fmt, int prnt, int fini)
case '%':
putchar('%');
break;
+ case 'F':
+ if (*fmt == '{') {
+ fmt++;
+ atr = match_colour((const char**)&fmt, 1, 0);
+ if (*fmt == '}')
+ fmt++;
+ if (!(atr & (TXT_ERROR | TXTNOFGCOLOUR))) {
+ txtunset(TXT_ATTR_FG_COL_MASK);
+ txtset(atr & TXT_ATTR_FG_ON_MASK);
+ set_colour_attribute(atr, COL_SEQ_FG, TSC_RAW);
+ }
+ }
+ break;
+ case 'f':
+ txtunset(TXT_ATTR_FG_ON_MASK);
+ set_colour_attribute(TXTNOFGCOLOUR, COL_SEQ_FG, TSC_RAW);
+ break;
+ case 'K':
+ if (*fmt == '{') {
+ fmt++;
+ atr = match_colour((const char**)&fmt, 0, 0);
+ if (*fmt == '}')
+ fmt++;
+ if (!(atr & (TXT_ERROR | TXTNOBGCOLOUR))) {
+ txtunset(TXT_ATTR_BG_COL_MASK);
+ txtset(atr & TXT_ATTR_BG_ON_MASK);
+ set_colour_attribute(atr, COL_SEQ_BG, TSC_RAW);
+ }
+ }
+ break;
+ case 'k':
+ txtunset(TXT_ATTR_BG_ON_MASK);
+ set_colour_attribute(TXTNOBGCOLOUR, COL_SEQ_BG, TSC_RAW);
+ break;
case 'S':
txtset(TXTSTANDOUT);
tsetcap(TCSTANDOUTBEG, TSC_RAW);
@@ -407,7 +441,6 @@ watchlog_match(char *teststr, char *actual, int len)
/* check the List for login/logouts */
-/**/
static void
watchlog(int inout, WATCH_STRUCT_UTMP *u, char **w, char *fmt)
{
@@ -470,7 +503,6 @@ watchlog(int inout, WATCH_STRUCT_UTMP *u, char **w, char *fmt)
/* compare 2 utmp entries */
-/**/
static int
ucmp(WATCH_STRUCT_UTMP *u, WATCH_STRUCT_UTMP *v)
{
@@ -481,7 +513,6 @@ ucmp(WATCH_STRUCT_UTMP *u, WATCH_STRUCT_UTMP *v)
/* initialize the user List */
-/**/
static int
readwtab(WATCH_STRUCT_UTMP **head, int initial_sz)
{
@@ -592,10 +623,19 @@ dowatch(void)
wtab = utab;
wtabsz = utabsz;
fflush(stdout);
+ lastwatch = time(NULL);
+}
+
+static void
+checksched(void)
+{
+ /* Do nothing if WATCH is not set, or LOGCHECK has not elapsed */
+ if (watch && (int) difftime(time(NULL), lastwatch) > getiparam("LOGCHECK"))
+ dowatch();
}
/**/
-int
+static int
bin_log(UNUSED(char *nam), UNUSED(char **argv), UNUSED(Options ops), UNUSED(int func))
{
if (!watch)
@@ -611,16 +651,109 @@ bin_log(UNUSED(char *nam), UNUSED(char **argv), UNUSED(Options ops), UNUSED(int
#else /* !WATCH_STRUCT_UTMP */
-/**/
-void dowatch(void)
+static void
+checksched(void)
{
}
/**/
-int
+static int
bin_log(char *nam, char **argv, Options ops, int func)
{
return bin_notavail(nam, argv, ops, func);
}
#endif /* !WATCH_STRUCT_UTMP */
+
+/**/
+static char **watch; /* $watch */
+
+/* module setup */
+
+static struct builtin bintab[] = {
+ BUILTIN("log", 0, bin_log, 0, 0, 0, NULL, NULL),
+};
+
+static struct paramdef partab[] = {
+ PARAMDEF("WATCH", PM_SCALAR|PM_SPECIAL, &watch, NULL),
+ PARAMDEF("watch", PM_ARRAY|PM_SPECIAL, &watch, NULL),
+};
+
+static struct features module_features = {
+ bintab, sizeof(bintab)/sizeof(*bintab),
+ NULL, 0,
+ NULL, 0,
+ partab, sizeof(partab)/sizeof(*partab),
+ 0
+};
+
+/**/
+int
+setup_(UNUSED(Module m))
+{
+ /* On Cygwin, colonarr_gsu exists in libzsh.dll and we can't
+ * use &colonarr_gsu in the initialization of partab[] above */
+ partab[0].gsu = (void *)&colonarr_gsu;
+ partab[1].gsu = (void *)&vararray_gsu;
+ 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_(UNUSED(Module m))
+{
+ static char const * const default_watchfmt = DEFAULT_WATCHFMT;
+
+ Param pma = (Param) paramtab->getnode(paramtab, "watch");
+ Param pms = (Param) paramtab->getnode(paramtab, "WATCH");
+ if (pma && pms && pma->u.arr == watch && pms->u.arr == watch) {
+ /* only tie the two parameters if both were added */
+ pma->ename = "WATCH";
+ pms->ename = "watch";
+ pma->node.flags |= PM_TIED;
+ pms->node.flags |= PM_TIED;
+ }
+ watch = mkarray(NULL);
+
+ /* These two parameters are only set to defaults if not set.
+ * So setting them in .zshrc will not be enough to load the
+ * module. It's useless until the watch array is set anyway. */
+ if (!paramtab->getnode(paramtab, "WATCHFMT"))
+ setsparam("WATCHFMT", ztrdup_metafy(default_watchfmt));
+ if (!paramtab->getnode(paramtab, "LOGCHECK"))
+ setiparam("LOGCHECK", 60);
+
+ addprepromptfn(&checksched);
+
+ return 0;
+}
+
+/**/
+int
+cleanup_(Module m)
+{
+ delprepromptfn(&checksched);
+ return setfeatureenables(m, &module_features, NULL);
+}
+
+/**/
+int
+finish_(UNUSED(Module m))
+{
+ return 0;
+}
diff --git a/Src/Modules/watch.mdd b/Src/Modules/watch.mdd
new file mode 100644
index 000000000..7e8454ede
--- /dev/null
+++ b/Src/Modules/watch.mdd
@@ -0,0 +1,7 @@
+name=zsh/watch
+link=dynamic
+load=yes
+
+autofeatures="b:log p:WATCH p:watch"
+
+objects="watch.o"
diff --git a/Src/Modules/zprof.c b/Src/Modules/zprof.c
index bc97771c0..56cdab888 100644
--- a/Src/Modules/zprof.c
+++ b/Src/Modules/zprof.c
@@ -213,7 +213,25 @@ bin_zprof(UNUSED(char *nam), UNUSED(char **args), Options ops, UNUSED(int func))
return 0;
}
-/**/
+static char *
+name_for_anonymous_function(char *name)
+{
+ char lineno[DIGBUFSIZE];
+ char *parts[7];
+
+ convbase(lineno, funcstack[0].flineno, 10);
+
+ parts[0] = name;
+ parts[1] = " [";
+ parts[2] = funcstack[0].filename ? funcstack[0].filename : "";
+ parts[3] = ":";
+ parts[4] = lineno;
+ parts[5] = "]";
+ parts[6] = NULL;
+
+ return sepjoin(parts, "", 1);
+}
+
static int
zprof_wrapper(Eprog prog, FuncWrap w, char *name)
{
@@ -224,12 +242,19 @@ zprof_wrapper(Eprog prog, FuncWrap w, char *name)
struct timeval tv;
struct timezone dummy;
double prev = 0, now;
+ char *name_for_lookups;
+
+ if (is_anonymous_function_name(name)) {
+ name_for_lookups = name_for_anonymous_function(name);
+ } else {
+ name_for_lookups = name;
+ }
if (zprof_module && !(zprof_module->node.flags & MOD_UNLOAD)) {
active = 1;
- if (!(f = findpfunc(name))) {
+ if (!(f = findpfunc(name_for_lookups))) {
f = (Pfunc) zalloc(sizeof(*f));
- f->name = ztrdup(name);
+ f->name = ztrdup(name_for_lookups);
f->calls = 0;
f->time = f->self = 0.0;
f->next = calls;
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 45fd15ee0..dfd2a2a7a 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -30,6 +30,13 @@
#include "zpty.mdh"
#include "zpty.pro"
+#ifdef __CYGWIN__
+#include <cygwin/version.h>
+#if defined(CYGWIN_VERSION_DLL_MAJOR) && CYGWIN_VERSION_DLL_MAJOR<3002
+#define USE_CYGWIN_FIX 1
+#endif
+#endif
+
/* The number of bytes we normally read when given no pattern and the
* upper bound on the number of bytes we read (even if we are give a
* pattern). */
@@ -428,6 +435,7 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
mypid = 0; /* trick to ensure we _exit() */
zexit(lastval, ZEXIT_NORMAL);
}
+#ifndef USE_CYGWIN_FIX
master = movefd(master);
if (master == -1) {
zerrnam(nam, "cannot duplicate fd %d: %e", master, errno);
@@ -435,6 +443,9 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
ineval = oineval;
return 1;
}
+#else
+ addmodulefd(master, FDT_INTERNAL);
+#endif
p = (Ptycmd) zalloc(sizeof(*p));
diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c
index 24659cb16..2f17c03f1 100644
--- a/Src/Modules/zutil.c
+++ b/Src/Modules/zutil.c
@@ -96,7 +96,7 @@ struct stypat {
Stypat next;
char *pat; /* pattern string */
Patprog prog; /* compiled pattern */
- int weight; /* how specific is the pattern? */
+ zulong weight; /* how specific is the pattern? */
Eprog eval; /* eval-on-retrieve? */
char **vals;
};
@@ -200,7 +200,8 @@ printstylenode(HashNode hn, int printflags)
else {
printf("zstyle %s", (p->eval ? "-e " : ""));
quotedzputs(p->pat, stdout);
- printf(" %s", s->node.nam);
+ putchar(' ');
+ quotedzputs(s->node.nam, stdout);
}
for (v = p->vals; *v; v++) {
putchar(' ');
@@ -293,7 +294,9 @@ newzstyletable(int size, char const *name)
static int
setstypat(Style s, char *pat, Patprog prog, char **vals, int eval)
{
- int weight, tmp, first;
+ zulong weight;
+ int tmp;
+ int first;
char *str;
Stypat p, q, qq;
Eprog eprog = NULL;
@@ -348,6 +351,12 @@ setstypat(Style s, char *pat, Patprog prog, char **vals, int eval)
* - A component that's a literal string scores 2 points.
* - The score of a pattern is the sum of the score of its components.
*
+ * The result of this calculation is stored in the low bits of 'weight'.
+ * The high bits of 'weight' are used to store the number of ':'-separated
+ * components. This provides a lexicographic comparison: first compare
+ * the number of components, and if that's equal, compare the specificity
+ * of the components.
+ *
* This corresponds to the notion of 'more specific' in the zshmodules(1)
* documentation of zstyle.
*/
@@ -367,6 +376,7 @@ setstypat(Style s, char *pat, Patprog prog, char **vals, int eval)
if (*str == ':') {
/* Yet another component. */
+ weight += ZLONG_CONST(1) << (CHAR_BIT * sizeof(weight) / 2);
first = 1;
weight += tmp;
@@ -766,10 +776,12 @@ bin_zstyle(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
* ousedp (*outp)[*ousedp] is where to write next
* olenp *olenp is the size allocated for *outp
* endchar Terminator character in addition to `\0' (may be '\0')
+ * presence -F: Ternary expressions test emptyness instead
* skip If 1, don't output, just parse.
*/
static char *zformat_substring(char* instr, char **specs, char **outp,
- int *ousedp, int *olenp, int endchar, int skip)
+ int *ousedp, int *olenp, int endchar,
+ int presence, int skip)
{
char *s;
@@ -797,27 +809,35 @@ static char *zformat_substring(char* instr, char **specs, char **outp,
if ((*s == '.' || testit) && idigit(s[1])) {
for (max = 0, s++; idigit(*s); s++)
max = (max * 10) + (int) STOUC(*s) - '0';
- }
- else if (testit)
+ } else if (*s == '.' || testit)
s++;
if (testit && STOUC(*s)) {
int actval, testval, endcharl;
- /*
- * One one number is useful for ternary expressions.
- * Remember to put the sign back.
- */
+ /* Only one number is useful for ternary expressions. */
testval = (min >= 0) ? min : (max >= 0) ? max : 0;
- if (right)
- testval *= -1;
- if (specs[STOUC(*s)])
- actval = (int)mathevali(specs[STOUC(*s)]);
- else
- actval = 0;
- /* zero means values are equal, i.e. true */
- actval -= testval;
+ if (specs[STOUC(*s)] && *specs[STOUC(*s)]) {
+ if (presence) {
+ if (testval)
+#ifdef MULTIBYTE_SUPPORT
+ if (isset(MULTIBYTE))
+ actval = MB_METASTRWIDTH(specs[STOUC(*s)]);
+ else
+#endif
+ actval = strlen(specs[STOUC(*s)]);
+ else
+ actval = 1;
+ actval = right ? (testval < actval) : (testval >= actval);
+ } else {
+ if (right) /* put the sign back */
+ testval *= -1;
+ /* zero means values are equal, i.e. true */
+ actval = (int)mathevali(specs[STOUC(*s)]) - testval;
+ }
+ } else
+ actval = presence ? !right : testval;
/* careful about premature end of string */
if (!(endcharl = *++s))
@@ -828,10 +848,10 @@ static char *zformat_substring(char* instr, char **specs, char **outp,
* vice versa... unless we are already skipping.
*/
if (!(s = zformat_substring(s+1, specs, outp, ousedp,
- olenp, endcharl, skip || actval)))
+ olenp, endcharl, presence, skip || actval)))
return NULL;
if (!(s = zformat_substring(s+1, specs, outp, ousedp,
- olenp, ')', skip || !actval)))
+ olenp, ')', presence, skip || !actval)))
return NULL;
} else if (skip) {
continue;
@@ -903,6 +923,7 @@ static int
bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
{
char opt;
+ int presence = 0;
if (args[0][0] != '-' || !(opt = args[0][1]) || args[0][2]) {
zwarnnam(nam, "invalid argument: %s", args[0]);
@@ -911,15 +932,18 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
args++;
switch (opt) {
+ case 'F':
+ presence = 1;
+ /* fall-through */
case 'f':
{
- char **ap, *specs[256], *out;
+ char **ap, *specs[256] = {0}, *out;
int olen, oused = 0;
- memset(specs, 0, 256 * sizeof(char *));
-
specs['%'] = "%";
specs[')'] = ")";
+
+ /* Parse the specs in argv. */
for (ap = args + 2; *ap; ap++) {
if (!ap[0][0] || ap[0][0] == '-' || ap[0][0] == '.' ||
idigit(ap[0][0]) || ap[0][1] != ':') {
@@ -930,7 +954,8 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
}
out = (char *) zhalloc(olen = 128);
- zformat_substring(args[1], specs, &out, &oused, &olen, '\0', 0);
+ zformat_substring(args[1], specs, &out, &oused, &olen, '\0',
+ presence, 0);
out[oused] = '\0';
setsparam(args[0], ztrdup(out));
@@ -1865,7 +1890,10 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
while (*++o) {
if (!(d = sopts[STOUC(*o)])) {
if (fail) {
- zwarnnam(nam, "bad option: %c", *o);
+ if (*o != '-')
+ zwarnnam(nam, "bad option: -%c", *o);
+ else
+ zwarnnam(nam, "bad option: -%s", o);
return 1;
}
o = NULL;
@@ -1878,7 +1906,7 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
} else if (!(d->flags & ZOF_OPT) ||
(pp[1] && pp[1][0] != '-')) {
if (!pp[1]) {
- zwarnnam(nam, "missing argument for option: %s",
+ zwarnnam(nam, "missing argument for option: -%s",
d->name);
return 1;
}
@@ -1905,7 +1933,7 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
else if (!(d->flags & ZOF_OPT) ||
(pp[1] && pp[1][0] != '-')) {
if (!pp[1]) {
- zwarnnam(nam, "missing argument for option: %s",
+ zwarnnam(nam, "missing argument for option: -%s",
d->name);
return 1;
}
diff --git a/Src/Zle/comp.h b/Src/Zle/comp.h
index 2e3249b52..2ca779fe5 100644
--- a/Src/Zle/comp.h
+++ b/Src/Zle/comp.h
@@ -85,8 +85,8 @@ struct cmgroup {
#define CGF_NOSORT 1 /* don't sort this group */
#define CGF_LINES 2 /* these are to be printed on different lines */
#define CGF_HASDL 4 /* has display strings printed on separate lines */
-#define CGF_UNIQALL 8 /* remove all duplicates */
-#define CGF_UNIQCON 16 /* remove consecutive duplicates */
+#define CGF_UNIQALL 8 /* remove consecutive duplicates (if neither are set, */
+#define CGF_UNIQCON 16 /* don't deduplicate */ /* remove all dupes) */
#define CGF_PACKED 32 /* LIST_PACKED for this group */
#define CGF_ROWS 64 /* LIST_ROWS_FIRST for this group */
#define CGF_FILES 128 /* contains file names */
@@ -140,6 +140,7 @@ struct cmatch {
#define CMF_ALL (1<<13) /* a match representing all other matches */
#define CMF_DUMMY (1<<14) /* unselectable dummy match */
#define CMF_MORDER (1<<15) /* order by matches, not display strings */
+#define CMF_DELETE (1<<16) /* used for deduplication of unsorted matches, don't set */
/* Stuff for completion matcher control. */
@@ -299,7 +300,7 @@ struct menuinfo {
#define CAF_NOSORT 2 /* compadd -V: don't sort */
#define CAF_MATCH 4 /* compadd without -U: do matching */
#define CAF_UNIQCON 8 /* compadd -2: don't deduplicate */
-#define CAF_UNIQALL 16 /* compadd -1: deduplicate */
+#define CAF_UNIQALL 16 /* compadd -1: deduplicate consecutive only */
#define CAF_ARRAYS 32 /* compadd -a or -k: array/assoc parameter names */
#define CAF_KEYS 64 /* compadd -k: assoc parameter names */
#define CAF_ALL 128 /* compadd -C: _all_matches */
@@ -329,7 +330,7 @@ struct cadata {
char *exp; /* explanation (-X) */
char *apar; /* array to store matches in (-A) */
char *opar; /* array to store originals in (-O) */
- char *dpar; /* array to delete non-matches in (-D) */
+ char **dpar; /* arrays to delete non-matches in (-D) */
char *disp; /* array with display lists (-d) */
char *mesg; /* message to show unconditionally (-x) */
int dummies; /* add that many dummy matches */
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 7e3badc57..fe3ea10fc 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -648,7 +648,7 @@ callcompfunc(char *s, char *fn)
if (compredirs)
freearray(compredirs);
if (rdstrs)
- compredirs = zlinklist2array(rdstrs);
+ compredirs = zlinklist2array(rdstrs, 1);
else
compredirs = (char **) zshcalloc(sizeof(char *));
@@ -821,6 +821,7 @@ callcompfunc(char *s, char *fn)
sfcontext = SFC_CWIDGET;
NEWHEAPS(compheap) {
LinkList largs = NULL;
+ int oxt = isset(XTRACE);
if (*cfargs) {
char **p = cfargs;
@@ -830,7 +831,9 @@ callcompfunc(char *s, char *fn)
while (*p)
addlinknode(largs, dupstring(*p++));
}
+ opts[XTRACE] = 0;
cfret = doshfunc(shfunc, largs, 1);
+ opts[XTRACE] = oxt;
} OLDHEAPS;
sfcontext = osc;
endparamscope();
@@ -1122,6 +1125,18 @@ check_param(char *s, int set, int test)
*
* TODO: passing s as a parameter while we get some mysterious
* offset "offs" into it via a global sucks badly.
+ *
+ * From ../lex.c we know:
+ * wb is the beginning position of the current word in the line
+ * we is the position of the end of the current word in the line
+ * From zle_tricky.c we know:
+ * offs is position within the word where we are completing
+ *
+ * So wb + offs is the current cursor position if COMPLETE_IN_WORD
+ * is set, otherwise it is the end of the word (same as we).
+ *
+ * Note below we are thus stepping backward from our completion
+ * position to find a '$' in the current word (if any).
*/
for (p = s + offs; ; p--) {
if (*p == String || *p == Qstring) {
@@ -1168,13 +1183,13 @@ check_param(char *s, int set, int test)
char *tb = b;
/* If this is a ${...}, see if we are before the '}'. */
- if (!skipparens(Inbrace, Outbrace, &tb))
+ if (!skipparens(Inbrace, Outbrace, &tb) && tb - s <= offs)
return NULL;
/* Ignore the possible (...) flags. */
b++, br++;
if ((qstring ? skipparens('(', ')', &b) :
- skipparens(Inpar, Outpar, &b)) > 0) {
+ skipparens(Inpar, Outpar, &b)) > 0 || b - s > offs) {
/*
* We are still within the parameter flags. There's no
* point trying to do anything clever here with
@@ -1922,7 +1937,7 @@ set_comp_sep(void)
mod_export void
set_list_array(char *name, LinkList l)
{
- setaparam(name, zlinklist2array(l));
+ setaparam(name, zlinklist2array(l, 1));
}
/* Get the words from a variable or a (list of words). */
@@ -2058,10 +2073,10 @@ addmatches(Cadata dat, char **argv)
/* ms: "match string" - string to use as completion.
* Overloaded at one place as a temporary. */
char *s, *ms, *lipre = NULL, *lisuf = NULL, *lpre = NULL, *lsuf = NULL;
- char **aign = NULL, **dparr = NULL, *oaq = autoq, *oppre = dat->ppre;
+ char **aign = NULL, ***dparr = NULL, *oaq = autoq, *oppre = dat->ppre;
char *oqp = qipre, *oqs = qisuf, qc, **disp = NULL, *ibuf = NULL;
char **arrays = NULL;
- int lpl, lsl, bcp = 0, bcs = 0, bpadd = 0, bsadd = 0;
+ int dind, lpl, lsl, bcp = 0, bcs = 0, bpadd = 0, bsadd = 0;
int ppl = 0, psl = 0, ilen = 0;
int llpl = 0, llsl = 0, nm = mnum, gflags = 0, ohp = haspattern;
int isexact, doadd, ois = instring, oib = inbackt;
@@ -2069,7 +2084,7 @@ addmatches(Cadata dat, char **argv)
struct cmlist mst;
Cmlist oms = mstack;
Patprog cp = NULL, *pign = NULL;
- LinkList aparl = NULL, oparl = NULL, dparl = NULL;
+ LinkList aparl = NULL, oparl = NULL, *dparl = NULL;
Brinfo bp, bpl = brbeg, obpl, bsl = brend, obsl;
Heap oldheap;
@@ -2097,7 +2112,7 @@ addmatches(Cadata dat, char **argv)
curexpl->always = !!dat->mesg;
curexpl->count = curexpl->fcount = 0;
curexpl->str = dupstring(dat->mesg ? dat->mesg : dat->exp);
- if (dat->mesg)
+ if (dat->mesg && !dat->dpar && !dat->opar && !dat->apar)
addexpl(1);
} else
curexpl = NULL;
@@ -2163,11 +2178,24 @@ addmatches(Cadata dat, char **argv)
if (dat->opar)
oparl = newlinklist();
if (dat->dpar) {
- if (*(dat->dpar) == '(')
- dparr = NULL;
- else if ((dparr = get_user_var(dat->dpar)) && !*dparr)
- dparr = NULL;
- dparl = newlinklist();
+ int darr = 0, dparlen = arrlen(dat->dpar);
+ char **tail = dat->dpar + dparlen;
+
+ dparr = (char ***)hcalloc((1 + dparlen) * sizeof(char **));
+ dparl = (LinkList *)hcalloc((1 + dparlen) * sizeof(LinkList));
+ queue_signals();
+ while (darr < dparlen) {
+ if ((dparr[darr] = getaparam(dat->dpar[darr])) && *dparr[darr]) {
+ dparr[darr] = arrdup(dparr[darr]);
+ dparl[darr++] = newlinklist();
+ } else {
+ /* swap in the last -D argument if we didn't get a non-empty array */
+ dat->dpar[darr] = *--tail;
+ *tail = NULL;
+ --dparlen;
+ }
+ }
+ unqueue_signals();
}
/* Store the matcher in our stack of matchers. */
if (dat->match) {
@@ -2484,8 +2512,10 @@ addmatches(Cadata dat, char **argv)
}
if (!addit) {
compignored++;
- if (dparr && !*++dparr)
- dparr = NULL;
+ for (dind = 0; dparl && dparl[dind]; dind++) {
+ if (dparr[dind] && !*++dparr[dind])
+ dparr[dind] = NULL;
+ }
goto next_array;
}
}
@@ -2502,8 +2532,10 @@ addmatches(Cadata dat, char **argv)
!(dat->flags & CMF_FILE) ? 1 : 2) : 0),
&bpl, bcp, &bsl, bcs,
&isexact))) {
- if (dparr && !*++dparr)
- dparr = NULL;
+ for (dind = 0; dparl && dparl[dind]; dind++) {
+ if (dparr[dind] && !*++dparr[dind])
+ dparr[dind] = NULL;
+ }
goto next_array;
}
if (doadd) {
@@ -2530,10 +2562,14 @@ addmatches(Cadata dat, char **argv)
addlinknode(aparl, ms);
if (dat->opar)
addlinknode(oparl, s);
- if (dat->dpar && dparr) {
- addlinknode(dparl, *dparr);
- if (!*++dparr)
- dparr = NULL;
+ if (dat->dpar) {
+ for (dind = 0; dparl[dind]; dind++) {
+ if (dparr[dind]) {
+ addlinknode(dparl[dind], *dparr[dind]);
+ if (!*++dparr[dind])
+ dparr[dind] = NULL;
+ }
+ }
}
free_cline(lc);
}
@@ -2561,8 +2597,10 @@ addmatches(Cadata dat, char **argv)
set_list_array(dat->apar, aparl);
if (dat->opar)
set_list_array(dat->opar, oparl);
- if (dat->dpar)
- set_list_array(dat->dpar, dparl);
+ if (dat->dpar) {
+ for (dind = 0; dparl[dind]; dind++)
+ set_list_array(dat->dpar[dind], dparl[dind]);
+ }
if (dat->exp)
addexpl(0);
if (!hasallmatch && (dat->aflags & CAF_ALL)) {
@@ -3209,17 +3247,20 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp)
}
*cp = NULL;
}
- } else {
+ } else if (n > 0) {
if (!(flags & CGF_NOSORT)) {
/* Now sort the array (it contains matches). */
matchorder = flags;
qsort((void *) rp, n, sizeof(Cmatch),
(int (*) _((const void *, const void *)))matchcmp);
+ /* since the matches are sorted and the default is to remove
+ * all duplicates, -1 (remove only consecutive dupes) is a no-op,
+ * so this condition only checks for -2 */
if (!(flags & CGF_UNIQCON)) {
int dup;
- /* And delete the ones that occur more than once. */
+ /* we did not pass -2 so go ahead and remove those dupes */
for (ap = cp = rp; *ap; ap++) {
*cp++ = *ap;
for (bp = ap; bp[1] && matcheq(*ap, bp[1]); bp++, n--);
@@ -3241,30 +3282,47 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp)
if ((*ap)->flags & (CMF_NOLIST | CMF_MULT))
nl++;
}
+ /* used -O nosort or -V, don't sort */
} else {
+ /* didn't use -1 or -2, so remove all duplicates (efficient) */
if (!(flags & CGF_UNIQALL) && !(flags & CGF_UNIQCON)) {
- int dup;
-
- for (ap = rp; *ap; ap++) {
- for (bp = cp = ap + 1; *bp; bp++) {
- if (!matcheq(*ap, *bp))
- *cp++ = *bp;
- else
+ int dup, del = 0;
+
+ /* To avoid O(n^2) here, sort a copy of the list, then remove marked elements */
+ matchorder = flags;
+ Cmatch *sp, *asp;
+ sp = (Cmatch *) zhalloc((n + 1) * sizeof(Cmatch));
+ memcpy(sp, rp, (n + 1) * sizeof(Cmatch));
+ qsort((void *) sp, n, sizeof(Cmatch),
+ (int (*) _((const void *, const void *)))matchcmp);
+ for (asp = sp + 1; *asp; asp++) {
+ Cmatch *ap = asp - 1, *bp = asp;
+ if (matcheq(*ap, *bp)) {
+ bp[0]->flags = CMF_DELETE;
+ del = 1;
+ } else if (!ap[0]->disp) {
+ /* Mark those, that would show the same string in the list. */
+ for (dup = 0; bp[0] && !(bp[0])->disp &&
+ !strcmp((*ap)->str, (bp[0])->str); bp = ++sp) {
+ (bp[0])->flags |= CMF_MULT;
+ dup = 1;
+ }
+ if (dup)
+ (*ap)->flags |= CMF_FMULT;
+ }
+ }
+ if (del) {
+ int n_orig = n;
+ for (bp = rp, ap = rp; bp < rp + n_orig; ap++, bp++) {
+ while (bp[0]->flags & CMF_DELETE) {
+ bp++;
n--;
+ }
+ *ap = *bp;
}
- *cp = NULL;
- if (!(*ap)->disp) {
- for (dup = 0, bp = ap + 1; *bp; bp++)
- if (!(*bp)->disp &&
- !((*bp)->flags & CMF_MULT) &&
- !strcmp((*ap)->str, (*bp)->str)) {
- (*bp)->flags |= CMF_MULT;
- dup = 1;
- }
- if (dup)
- (*ap)->flags |= CMF_FMULT;
- }
+ *ap = NULL;
}
+ /* passed -1 but not -2, so remove consecutive duplicates (efficient) */
} else if (!(flags & CGF_UNIQCON)) {
int dup;
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index 7beb6d847..67a60963e 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -607,6 +607,7 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
char *oarg = NULL; /* argument of -o option */
int added; /* return value */
Cmatcher match = NULL;
+ size_t dparlen = 0, dparsize = 0; /* no. of -D options and array size */
if (incompfunc != 1) {
zwarnnam(name, "can only be called from completion function");
@@ -614,7 +615,8 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
}
dat.ipre = dat.isuf = dat.ppre = dat.psuf = dat.prpre = dat.mesg =
dat.pre = dat.suf = dat.group = dat.rems = dat.remf = dat.disp =
- dat.ign = dat.exp = dat.apar = dat.opar = dat.dpar = NULL;
+ dat.ign = dat.exp = dat.apar = dat.opar = NULL;
+ dat.dpar = NULL;
dat.match = NULL;
dat.flags = 0;
dat.aflags = CAF_MATCH;
@@ -741,7 +743,12 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
e = "parameter name expected after -%c";
break;
case 'D':
- sp = &(dat.dpar);
+ if (dparsize <= dparlen + 1) {
+ dparsize = (dparsize + 1) * 2;
+ dat.dpar = (char **)zrealloc(dat.dpar, sizeof(char *) * dparsize);
+ }
+ sp = dat.dpar + dparlen++;
+ *sp = dat.dpar[dparlen] = NULL;
e = "parameter name expected after -%c";
break;
case 'd':
@@ -768,11 +775,13 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
} else {
zwarnnam(name, "number expected after -%c", *p);
zsfree(mstr);
+ zfree(dat.dpar, dparsize);
return 1;
}
if (dat.dummies < 0) {
zwarnnam(name, "invalid number: %d", dat.dummies);
zsfree(mstr);
+ zfree(dat.dpar, dparsize);
return 1;
}
break;
@@ -782,6 +791,7 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
default:
zwarnnam(name, "bad option: -%c", *p);
zsfree(mstr);
+ zfree(dat.dpar, dparsize);
return 1;
}
if (sp) {
@@ -802,6 +812,7 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
/* Missing argument: argv[N] == "-X", argv[N+1] == NULL. */
zwarnnam(name, e, *p);
zsfree(mstr);
+ zfree(dat.dpar, dparsize);
return 1;
}
if (m) {
@@ -820,17 +831,21 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
if (mstr && (match = parse_cmatcher(name, mstr)) == pcm_err) {
zsfree(mstr);
+ zfree(dat.dpar, dparsize);
return 1;
}
zsfree(mstr);
if (!*argv && !dat.group && !dat.mesg &&
- !(dat.aflags & (CAF_NOSORT|CAF_UNIQALL|CAF_UNIQCON|CAF_ALL)))
+ !(dat.aflags & (CAF_NOSORT|CAF_UNIQALL|CAF_UNIQCON|CAF_ALL))) {
+ zfree(dat.dpar, dparsize);
return 1;
+ }
dat.match = match = cpcmatcher(match);
added = addmatches(&dat, argv);
freecmatcher(match);
+ zfree(dat.dpar, dparsize);
return added;
}
@@ -1343,7 +1358,7 @@ get_compstate(Param pm)
/**/
static void
-set_compstate(UNUSED(Param pm), HashTable ht)
+set_compstate(Param pm, HashTable ht)
{
struct compparam *cp;
Param *pp;
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 429c8159f..0dc64db6a 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -603,6 +603,16 @@ zcoff(void)
zcputs(NULL, COL_NO);
}
+/* Clear to end of line, if possible and necessary. */
+static void
+cleareol()
+{
+ if (mlbeg >= 0 && tccan(TCCLEAREOL)) {
+ if (*last_cap)
+ zcoff(); /* If we used colors, prevent them from bleeding. */
+ tcout(TCCLEAREOL);
+ }
+}
static void
initiscol(void)
@@ -670,8 +680,7 @@ clprintfmt(char *p, int ml)
doiscol(i++);
cc++;
if (*p == '\n') {
- if (mlbeg >= 0 && tccan(TCCLEAREOL))
- tcout(TCCLEAREOL);
+ cleareol();
cc = 0;
}
if (ml == mlend - 1 && (cc % zterm_columns) == zterm_columns - 1)
@@ -693,8 +702,7 @@ clprintfmt(char *p, int ml)
!--mrestlines && (ask = asklistscroll(ml)))
return ask;
}
- if (mlbeg >= 0 && tccan(TCCLEAREOL))
- tcout(TCCLEAREOL);
+ cleareol();
return 0;
}
@@ -1047,8 +1055,7 @@ compprintnl(int ml)
{
int ask;
- if (mlbeg >= 0 && tccan(TCCLEAREOL))
- tcout(TCCLEAREOL);
+ cleareol();
putc('\n', shout);
if (mscroll && !--mrestlines && (ask = asklistscroll(ml)))
@@ -1263,8 +1270,8 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop)
if ((cc >= zterm_columns - 2 || cchar == ZWC('\n')) && stat)
dopr = 2;
if (cchar == ZWC('\n')) {
- if (dopr == 1 && mlbeg >= 0 && tccan(TCCLEAREOL))
- tcout(TCCLEAREOL);
+ if (dopr == 1)
+ cleareol();
l += 1 + ((cc - 1) / zterm_columns);
cc = 0;
}
@@ -1306,8 +1313,7 @@ compprintfmt(char *fmt, int n, int dopr, int doesc, int ml, int *stop)
if (dopr) {
if (!(cc % zterm_columns))
fputs(" \010", shout);
- if (mlbeg >= 0 && tccan(TCCLEAREOL))
- tcout(TCCLEAREOL);
+ cleareol();
}
if (stat && n)
mfirstl = -1;
@@ -1338,8 +1344,8 @@ compzputs(char const *s, int ml)
c = *s;
s++;
putc(c, shout);
- if (c == '\n' && mlbeg >= 0 && tccan(TCCLEAREOL))
- tcout(TCCLEAREOL);
+ if (c == '\n')
+ cleareol();
if (mscroll && (++col == zterm_columns || c == '\n')) {
ml++;
if (!--mrestlines && (ask = asklistscroll(ml)))
@@ -1692,8 +1698,7 @@ compprintlist(int showall)
lastlistlen = listdat.nlines;
} else if ((nl = listdat.nlines + nlnct - 1) < zterm_lines) {
- if (mlbeg >= 0 && tccan(TCCLEAREOL))
- tcout(TCCLEAREOL);
+ cleareol();
tcmultout(TCUP, TCMULTUP, nl);
showinglist = -1;
@@ -3277,9 +3282,8 @@ domenuselect(Hookdef dummy, Chdata dat)
!strcmp(cmd->nam, "reverse-menu-complete")) {
mode = 0;
comprecursive = 1;
- unmetafy_line();
- reversemenucomplete(zlenoargs);
- metafy_line();
+ zmult = -zmult;
+ do_menucmp(0);
mselect = (*(minfo.cur))->gnum;
setwish = 1;
mline = -1;
diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c
index cc4c3eca9..bb8359f1d 100644
--- a/Src/Zle/compmatch.c
+++ b/Src/Zle/compmatch.c
@@ -693,8 +693,9 @@ match_str(char *l, char *w, Brinfo *bpp, int bc, int *rwlp,
alen = mp->ralen; aol = mp->lalen;
}
/* Give up if we don't have enough characters for the
- * line-string and the anchor. */
- if (ll < llen + alen || lw < alen)
+ * line-string and the anchor, or for both anchors in
+ * the case of the trial completion word. */
+ if (ll < llen + alen || lw < alen + aol)
continue;
if (mp->flags & CMF_LEFT) {
@@ -1318,7 +1319,7 @@ pattern_match_equivalence(Cpattern lp, convchar_t wind, int wmtp,
convchar_t lchr;
int lmtp;
- if (!PATMATCHINDEX(lp->u.str, wind-1, &lchr, &lmtp)) {
+ if (!PATMATCHINDEX(lp->u.str, wind, &lchr, &lmtp)) {
/*
* No equivalent. No possible match; give up.
*/
@@ -1437,7 +1438,7 @@ pattern_match_restrict(Cpattern p, Cpattern wp, convchar_t *wsc, int wsclen,
/*
* If either is "?", they match each other; no further tests.
- * Apply this even if the character wasn't convertable;
+ * Apply this even if the character wasn't convertible;
* there's no point trying to be clever in that case.
*/
if (p->tp != CPAT_ANY || wp->tp != CPAT_ANY)
@@ -1495,7 +1496,7 @@ pattern_match_restrict(Cpattern p, Cpattern wp, convchar_t *wsc, int wsclen,
* characters. We're matching two patterns against
* one another to generate a character to insert.
* This is a bit too psychedelic, so I'm going to
- * bale out now. See you on the ground.
+ * bail out now. See you on the ground.
*/
return 0;
}
@@ -1563,7 +1564,7 @@ pattern_match(Cpattern p, char *s, Cpattern wp, char *ws)
c = unmeta_one(s, &len);
/*
* If either is "?", they match each other; no further tests.
- * Apply this even if the character wasn't convertable;
+ * Apply this even if the character wasn't convertible;
* there's no point trying to be clever in that case.
*/
if (p->tp != CPAT_ANY || wp->tp != CPAT_ANY)
@@ -1933,7 +1934,7 @@ bld_line(Cmatcher mp, ZLE_STRING_T line, char *mword, char *word,
* This is the nightmare case: we have line and
* and word matchers and some pattern which restricts
* the value on the line without us knowing exactly
- * what it is. Despatch to the special function
+ * what it is. Dispatch to the special function
* for that.
*/
if (mp && !mp->flags && mp->wlen <= wlen &&
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 30fc60b78..57789c0f3 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -612,9 +612,10 @@ instmatch(Cmatch m, int *scs)
int pcs = zlemetacs;
l = 0;
- for (bp = brbeg, brpos = m->brpl,
- bradd = (m->pre ? strlen(m->pre) : 0);
- bp; bp = bp->next, brpos++) {
+ bradd = (m->pre ? strlen(m->pre) : 0);
+ for (bp = brbeg, brpos = m->brpl;
+ bp && brpos;
+ bp = bp->next, brpos++) {
zlemetacs = a + *brpos + bradd;
pcs = zlemetacs;
l = strlen(bp->str);
@@ -1583,7 +1584,7 @@ calclist(int showall)
nlines += 1 + printfmt(m->disp, 0, 0, 0);
g->flags |= CGF_HASDL;
} else {
- l = ZMB_nicewidth(m->disp);
+ l = ZMB_nicewidth(m->disp) + !!m->modec;
ndisp++;
if (l > glong)
glong = l;
@@ -2247,15 +2248,13 @@ iprintm(Cmgroup g, Cmatch *mp, UNUSED(int mc), UNUSED(int ml), int lastc, int wi
#ifdef MULTIBYTE_SUPPORT
len = mb_niceformat(m->disp, shout, NULL, 0);
#else
- nicezputs(m->disp, shout);
- len = niceztrlen(m->disp);
+ len = sb_niceformat(m->disp, shout, NULL, 0);
#endif
} else {
#ifdef MULTIBYTE_SUPPORT
len = mb_niceformat(m->str, shout, NULL, 0);
#else
- nicezputs(m->str, shout);
- len = niceztrlen(m->str);
+ len = sb_niceformat(m->str, shout, NULL, 0);
#endif
if ((g->flags & CGF_FILES) && m->modec) {
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 90db8b4b8..59abb4cc4 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -1035,7 +1035,7 @@ freecadef(Cadef d)
freecaargs(d->rest);
zsfree(d->nonarg);
if (d->single)
- zfree(d->single, 256 * sizeof(Caopt));
+ zfree(d->single, 188 * sizeof(Caopt));
zfree(d, sizeof(*d));
d = s;
}
@@ -1079,6 +1079,21 @@ bslashcolon(char *s)
return r;
}
+/* Get an index into the single array used in struct cadef
+ * opt is the option letter and pre is either - or +
+ * we only keep an array for the 94 ASCII characters from ! to ~ so
+ * with - and + prefixes, the array is double that at 188 elements
+ * returns -1 if opt is out-of-range
+ */
+static int
+single_index(char pre, char opt)
+{
+ if (opt <= 0x20 || opt > 0x7e)
+ return -1;
+
+ return opt + (pre == '-' ? -0x21 : 94 - 0x21);
+}
+
/* Parse an argument definition. */
static Caarg
@@ -1151,8 +1166,8 @@ alloc_cadef(char **args, int single, char *match, char *nonarg, int flags)
ret->lastt = time(0);
ret->set = NULL;
if (single) {
- ret->single = (Caopt *) zalloc(256 * sizeof(Caopt));
- memset(ret->single, 0, 256 * sizeof(Caopt));
+ ret->single = (Caopt *) zalloc(188 * sizeof(Caopt));
+ memset(ret->single, 0, 188 * sizeof(Caopt));
} else
ret->single = NULL;
ret->match = ztrdup(match);
@@ -1558,9 +1573,10 @@ parse_cadef(char *nam, char **args)
* pointer for the definition in the array for fast lookup.
* But don't treat '--' as a single option called '-' */
-
- if (single && name[1] && !name[2] && name[1] != '-')
- ret->single[STOUC(name[1])] = opt;
+ if (single && name[1] && !name[2] && name[1] != '-') {
+ int sidx = single_index(*name, name[1]);
+ if (sidx >= 0) ret->single[sidx] = opt;
+ }
if (again == 1) {
/* Do it all again for `*-...'. */
@@ -1738,11 +1754,12 @@ ca_get_sopt(Cadef d, char *line, char **end, LinkList *lp)
Caopt p, pp = NULL;
char pre = *line++;
LinkList l = NULL;
+ int sidx;
*lp = NULL;
for (p = NULL; *line; line++) {
- if ((p = d->single[STOUC(*line)]) && p->active &&
- p->args && p->name[0] == pre) {
+ if ((sidx = single_index(pre, *line)) != -1 &&
+ (p = d->single[sidx]) && p->active && p->args) {
if (p->type == CAO_NEXT) {
if (!l)
*lp = l = newlinklist();
@@ -1813,7 +1830,7 @@ ca_get_arg(Cadef d, int n)
/* Mark options as inactive.
* d: option definitions for a set
* pass either:
- * xor: a list if exclusions
+ * xor: a list of exclusions
* opts: if set, all options excluded leaving only nornal/rest arguments */
static void
@@ -2031,9 +2048,9 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
state.def = state.ddef = NULL;
state.curopt = state.dopt = NULL;
state.argbeg = state.optbeg = state.nargbeg = state.restbeg = state.actopts =
- state.nth = state.inopt = state.inarg = state.opt = state.arg = 1;
+ state.nth = state.inarg = state.opt = state.arg = 1;
state.argend = argend = arrlen(compwords) - 1;
- state.singles = state.oopt = 0;
+ state.inopt = state.singles = state.oopt = 0;
state.curpos = compcurrent;
state.args = znewlinklist();
state.oargs = (LinkList *) zalloc(d->nopts * sizeof(LinkList));
@@ -2080,9 +2097,14 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
remnulargs(line);
untokenize(line);
- ca_inactive(d, argxor, cur - 1, 0);
- if ((d->flags & CDF_SEP) && cur != compcurrent && !strcmp(line, "--")) {
+ if (argxor) {
+ ca_inactive(d, argxor, cur - 1, 0);
+ argxor = NULL;
+ }
+ if ((d->flags & CDF_SEP) && cur != compcurrent && state.actopts &&
+ !strcmp(line, "--")) {
ca_inactive(d, NULL, cur, 1);
+ state.actopts = 0;
continue;
}
@@ -2136,7 +2158,8 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
/* See if it's an option. */
- if (state.opt == 2 && (state.curopt = ca_get_opt(d, line, 0, &pe)) &&
+ if (state.opt == 2 && (*line == '-' || *line == '+') &&
+ (state.curopt = ca_get_opt(d, line, 0, &pe)) &&
(state.curopt->type == CAO_OEQUAL ?
(compwords[cur] || pe[-1] == '=') :
(state.curopt->type == CAO_EQUAL ?
@@ -2184,12 +2207,14 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
state.curopt = NULL;
}
} else if (state.opt == 2 && d->single &&
+ (*line == '-' || *line == '+') &&
((state.curopt = ca_get_sopt(d, line, &pe, &sopts)) ||
(cur != compcurrent && sopts && nonempty(sopts)))) {
/* Or maybe it's a single-letter option? */
char *p;
Caopt tmpopt;
+ int sidx;
if (cur != compcurrent && sopts && nonempty(sopts))
state.curopt = (Caopt) uremnode(sopts, firstnode(sopts));
@@ -2207,7 +2232,8 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
state.singles = (!pe || !*pe);
for (p = line + 1; p < pe; p++) {
- if ((tmpopt = d->single[STOUC(*p)])) {
+ if ((sidx = single_index(*line, *p)) != -1 &&
+ (tmpopt = d->single[sidx])) {
if (!state.oargs[tmpopt->num])
state.oargs[tmpopt->num] = znewlinklist();
@@ -2235,11 +2261,17 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
} else if (multi && (*line == '-' || *line == '+') && cur != compcurrent
&& (ca_foreign_opt(d, all, line)))
return 1;
- else if (state.arg &&
- (!napat || cur <= compcurrent || !pattry(napat, line))) {
+ else if (state.arg && cur <= compcurrent) {
/* Otherwise it's a normal argument. */
- if (napat && cur <= compcurrent)
+
+ /* test pattern passed to -A. if it matches treat this as an unknown
+ * option and continue to the next word */
+ if (napat && cur < compcurrent && state.actopts) {
+ if (pattry(napat, line))
+ continue;
ca_inactive(d, NULL, cur + 1, 1);
+ state.actopts = 0;
+ }
arglast = 1;
/* if this is the first normal arg after an option, may have been
@@ -2293,7 +2325,7 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
if (adef)
state.oopt = adef->num - state.nth;
- if (state.def)
+ if (state.def && cur != compcurrent)
argxor = state.def->xor;
if (state.def && state.def->type != CAA_NORMAL &&
@@ -2375,6 +2407,23 @@ ca_parse_line(Cadef d, Cadef all, int multi, int first)
return 0;
}
+/* Build a NUL-separated from a list.
+ *
+ * This is only used to populate values of $opt_args.
+ */
+
+static char *
+ca_nullist(LinkList l)
+{
+ if (l) {
+ char **array = zlinklist2array(l, 0 /* don't dup elements */);
+ char *ret = zjoin(array, '\0', 0 /* permanent allocation */);
+ free(array); /* the elements are owned by the list */
+ return ret;
+ } else
+ return ztrdup("");
+}
+
/* Build a colon-list from a list.
*
* This is only used to populate values of $opt_args.
@@ -2563,7 +2612,7 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
case 's': min = 1; max = 1; break;
case 'M': min = 1; max = 1; break;
case 'a': min = 0; max = 0; break;
- case 'W': min = 2; max = 2; break;
+ case 'W': min = 3; max = 3; break;
case 'n': min = 1; max = 1; break;
default:
zwarnnam(nam, "invalid option: %s", args[0]);
@@ -2795,11 +2844,20 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
return 0;
return 1;
case 'W':
- /* This gets two parameter names as arguments. The first is set to
- * the current word sans any option prefixes handled by comparguments.
+ /* This gets two parameter names and one integer as arguments.
+ *
+ * The first parameter is set to the current word sans any option
+ * prefixes handled by comparguments.
+ *
* The second parameter is set to an array containing the options on
* the line and their arguments. I.e. the stuff _arguments returns
- * to its caller in the `line' and `opt_args' parameters. */
+ * to its caller in the `line' and `opt_args' parameters.
+ *
+ * The integer is one if the second parameter (which is just $opt_args,
+ * you know) should encode multiple values by joining them with NULs
+ * and zero if it should encode multiple values by joining them with
+ * colons after backslash-escaping colons and backslashes.
+ */
{
Castate s;
char **ret, **p;
@@ -2807,6 +2865,7 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
LinkList *a;
Caopt o;
int num;
+ int opt_args_use_NUL_separators = (args[3][0] != '0');
for (num = 0, s = lstate; s; s = s->snext)
num += countlinknodes(s->args);
@@ -2832,7 +2891,10 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
if (*a) {
*p++ = (o->gsname ? tricat(o->gsname, o->name, "") :
ztrdup(o->name));
- *p++ = ca_colonlist(*a);
+ if (opt_args_use_NUL_separators)
+ *p++ = ca_nullist(*a);
+ else
+ *p++ = ca_colonlist(*a);
}
*p = NULL;
@@ -3591,7 +3653,7 @@ bin_compvalues(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
if (cv_laststate.vals) {
char **ret;
- ret = zlinklist2array(cv_laststate.vals);
+ ret = zlinklist2array(cv_laststate.vals, 1);
sethparam(args[1], ret);
return 0;
@@ -4016,7 +4078,7 @@ bin_comptry(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
set = (Ctset) zalloc(sizeof(*set));
- set->tags = zlinklist2array(list);
+ set->tags = zlinklist2array(list, 1);
set->next = NULL;
set->ptr = NULL;
set->tag = NULL;
diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h
index 609493f8c..391586c4a 100644
--- a/Src/Zle/zle.h
+++ b/Src/Zle/zle.h
@@ -447,6 +447,10 @@ struct region_highlight {
* Any of the flags defined above.
*/
int flags;
+ /*
+ * User-settable "memo" key. Metafied.
+ */
+ const char *memo;
};
/*
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 581ca4979..cfaa70dae 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -683,8 +683,13 @@ insertlastword(char **args)
}
nwords = countlinknodes(l);
} else {
- /* Some stored line. */
- if (!(he = quietgethist(evhist)) || !he->nwords) {
+ /* Some stored line. By default, search for a non-empty line. */
+ while ((he = quietgethist(evhist)) && histstep == -1 && !*args) {
+ if (he->nwords)
+ break;
+ evhist = addhistnum(evhist, histstep, HIST_FOREIGN);
+ }
+ if (!he || !he->nwords) {
unmetafy_line();
return 1;
}
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 49b2a26ad..d90838f03 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -424,7 +424,7 @@ scankeys(HashNode hn, UNUSED(int flags))
/**************************/
/**/
-Keymap
+mod_export Keymap
openkeymap(char *name)
{
KeymapName n = (KeymapName) keymapnamtab->getnode(keymapnamtab, name);
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index be68f4722..9edf30e01 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -906,6 +906,8 @@ getbyte(long do_keytmout, int *timeout, int full)
continue;
stopmsg = 1;
zexit(1, ZEXIT_NORMAL);
+ /* If called from an exit hook, zexit() returns, so: */
+ break;
}
icnt = 0;
if (errno == EINTR) {
@@ -929,6 +931,8 @@ getbyte(long do_keytmout, int *timeout, int full)
zerr("error on TTY read: %e", errno);
stopmsg = 1;
zexit(1, ZEXIT_NORMAL);
+ /* If called from an exit hook, zexit() returns, so: */
+ break;
}
}
if (cc == '\r') /* undo the exchange of \n and \r determined by */
@@ -1056,7 +1060,7 @@ getrestchar(int inchar, char *outstr, int *outcount)
#endif
/**/
-void
+mod_export void
redrawhook(void)
{
Thingy initthingy;
@@ -1065,6 +1069,7 @@ redrawhook(void)
int saverrflag = errflag, savretflag = retflag;
int lastcmd_prev = lastcmd;
int old_incompfunc = incompfunc;
+ int old_viinrepeat = viinrepeat;
char *args[2];
Thingy lbindk_save = lbindk, bindk_save = bindk;
@@ -1079,6 +1084,7 @@ redrawhook(void)
incompfunc = 0;
execzlefunc(initthingy, args, 1, 0);
incompfunc = old_incompfunc;
+ viinrepeat = old_viinrepeat;
/* Restore errflag and retflag as zlecallhook() does */
errflag = saverrflag | (errflag & ERRFLAG_INT);
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 612ac2138..eba28d1ec 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -1508,9 +1508,6 @@ static struct suffixset *suffixlist;
/**/
static char *suffixfunc;
-/* Length associated with the suffix function */
-static int suffixfunclen;
-
/* Whether to remove suffix on uninsertable characters */
/**/
int suffixnoinsrem;
@@ -1611,7 +1608,7 @@ makesuffixstr(char *f, char *s, int n)
if (f) {
zsfree(suffixfunc);
suffixfunc = ztrdup(f);
- suffixfunclen = n;
+ suffixlen = n;
} else if (s) {
int inv, i, z = 0;
ZLE_STRING_T ws, lasts, wptr;
@@ -1685,7 +1682,7 @@ iremovesuffix(ZLE_INT_T c, int keep)
unmetafy_line();
}
- sprintf(buf, "%d", suffixfunclen);
+ sprintf(buf, "%d", suffixlen);
addlinknode(args, suffixfunc);
addlinknode(args, buf);
@@ -1800,5 +1797,5 @@ fixsuffix(void)
suffixlist = next;
}
- suffixfunclen = suffixnoinsrem = suffixlen = 0;
+ suffixnoinsrem = suffixlen = 0;
}
diff --git a/Src/Zle/zle_move.c b/Src/Zle/zle_move.c
index 155fda80d..3bafff3f1 100644
--- a/Src/Zle/zle_move.c
+++ b/Src/Zle/zle_move.c
@@ -166,7 +166,7 @@ decpos(int *pos)
*/
/**/
-char *
+mod_export char *
backwardmetafiedchar(char *start, char *endptr, convchar_t *retchr)
{
#ifdef MULTIBYTE_SUPPORT
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 7b8593dec..30b5d4447 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -212,9 +212,9 @@ static zattr default_atr_on, special_atr_on;
/*
* Array of region highlights, no special termination.
- * The first element (0) always describes the region between
- * point and mark. Any other elements are set by the user
- * via the parameter region_highlight.
+ * The first N_SPECIAL_HIGHLIGHTS elements describe special uses of
+ * highlighting, documented under N_SPECIAL_HIGHLIGHTS.
+ * Any other elements are set by the user via the parameter region_highlight.
*/
/**/
@@ -255,7 +255,9 @@ int cost;
#endif
static const REFRESH_ELEMENT zr_cr = { ZWC('\r'), 0 };
+#ifdef MULTIBYTE_SUPPORT
static const REFRESH_ELEMENT zr_dt = { ZWC('.'), 0 };
+#endif
static const REFRESH_ELEMENT zr_nl = { ZWC('\n'), 0 };
static const REFRESH_ELEMENT zr_sp = { ZWC(' '), 0 };
static const REFRESH_ELEMENT zr_zr = { ZWC('\0'), 0 };
@@ -414,16 +416,19 @@ get_region_highlight(UNUSED(Param pm))
arrsize--;
rhp++, arrp++) {
char digbuf1[DIGBUFSIZE], digbuf2[DIGBUFSIZE];
- int atrlen = 0, alloclen;
+ int atrlen, alloclen;
+ const char memo_equals[] = "memo=";
sprintf(digbuf1, "%d", rhp->start);
sprintf(digbuf2, "%d", rhp->end);
atrlen = output_highlight(rhp->atr, NULL);
alloclen = atrlen + strlen(digbuf1) + strlen(digbuf2) +
- 3; /* 2 spaces, 1 0 */
+ 3; /* 2 spaces, 1 terminating NUL */
if (rhp->flags & ZRH_PREDISPLAY)
alloclen += 2; /* "P " */
+ if (rhp->memo)
+ alloclen += 1 /* space */ + strlen(memo_equals) + strlen(rhp->memo);
*arrp = (char *)zhalloc(alloclen * sizeof(char));
/*
* On input we allow a space after the flags.
@@ -436,6 +441,12 @@ get_region_highlight(UNUSED(Param pm))
(rhp->flags & ZRH_PREDISPLAY) ? "P" : "",
digbuf1, digbuf2);
(void)output_highlight(rhp->atr, *arrp + strlen(*arrp));
+
+ if (rhp->memo) {
+ strcat(*arrp, " ");
+ strcat(*arrp, memo_equals);
+ strcat(*arrp, rhp->memo);
+ }
}
*arrp = NULL;
return retarr;
@@ -460,6 +471,8 @@ set_region_highlight(UNUSED(Param pm), char **aval)
/* no null termination, but include special highlighting at start */
int newsize = len + N_SPECIAL_HIGHLIGHTS;
int diffsize = newsize - n_region_highlights;
+
+ free_region_highlights_memos();
region_highlights = (struct region_highlight *)
zrealloc(region_highlights,
sizeof(struct region_highlight) * newsize);
@@ -476,6 +489,7 @@ set_region_highlight(UNUSED(Param pm), char **aval)
*aval;
rhp++, aval++) {
char *strp, *oldstrp;
+ const char memo_equals[] = "memo=";
oldstrp = *aval;
if (*oldstrp == 'P') {
@@ -502,7 +516,44 @@ set_region_highlight(UNUSED(Param pm), char **aval)
while (inblank(*strp))
strp++;
- match_highlight(strp, &rhp->atr);
+ strp = (char*) match_highlight(strp, &rhp->atr);
+
+ while (inblank(*strp))
+ strp++;
+
+ if (strpfx(memo_equals, strp)) {
+ const char *memo_start = strp + strlen(memo_equals);
+ const char *i, *memo_end;
+
+ /*
+ * Forward compatibility: end parsing at a comma or whitespace to
+ * allow the following extensions:
+ *
+ * - A fifth field: "0 20 bold memo=foo bar".
+ *
+ * - Additional attributes in the fourth field: "0 20 bold memo=foo,bar"
+ * and "0 20 bold memo=foo\0bar".
+ *
+ * For similar reasons, we don't flag an error if the fourth field
+ * doesn't start with "memo=" as we expect.
+ */
+ i = memo_start;
+
+ /* ### TODO: Consider optimizing the common case that memo_start to
+ * end-of-string is entirely ASCII */
+ while (1) {
+ int nbytes;
+ convchar_t c = unmeta_one(i, &nbytes);
+
+ if (c == '\0' || c == ',' || inblank(c)) {
+ memo_end = i;
+ break;
+ } else
+ i += nbytes;
+ }
+ rhp->memo = ztrduppfx(memo_start, memo_end - memo_start);
+ } else
+ rhp->memo = NULL;
}
freearray(av);
@@ -2797,6 +2848,7 @@ zle_refresh_finish(void)
if (region_highlights)
{
+ free_region_highlights_memos();
zfree(region_highlights,
sizeof(struct region_highlight) * n_region_highlights);
region_highlights = NULL;
diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index ce61db27b..cd3f2c356 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -678,6 +678,7 @@ bin_zle_flags(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
else if (!strcmp(*flag, "keepsuffix"))
w->flags |= ZLE_KEEPSUFFIX;
*/
+ /* If you add magic strings here, be consistent with bin_zle_call() */
else if (!strcmp(*flag, "vichange")) {
if (invicmdmode()) {
startvichange(-1);
@@ -703,7 +704,7 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
{
Thingy t;
struct modifier modsave = zmod;
- int ret, saveflag = 0, setbindk = 0, setlbindk, remetafy;
+ int ret, saveflag = 0, setbindk = 0, setlbindk = 0, remetafy;
char *wname = *args++, *keymap_restore = NULL, *keymap_tmp;
if (!wname)
@@ -727,12 +728,26 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
while (*args && **args == '-') {
char skip_this_arg[2] = "x";
char *num;
+ char *flag;
if (!args[0][1] || args[0][1] == '-') {
args++;
break;
}
while (*++(*args)) {
switch (**args) {
+ case 'f':
+ flag = args[0][1] ? args[0]+1 : args[1];
+ if (flag == NULL || strcmp(flag, "nolast")) {
+ zwarnnam(name, "%s", "'nolast' expected after -f");
+ if (remetafy)
+ metafy_line();
+ return 1;
+ }
+ if (!args[0][1])
+ *++args = skip_this_arg;
+ /* If you add magic strings here, be consistent with bin_zle_flags() */
+ setlbindk = 1;
+ break;
case 'n':
num = args[0][1] ? args[0]+1 : args[1];
if (!num) {
@@ -787,7 +802,7 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
* a vi range to detect a repeated key */
setbindk = setbindk ||
(t->widget && (t->widget->flags & (WIDGET_INT | ZLE_VIOPER)) == WIDGET_INT);
- setlbindk = t->widget && (t->widget->flags & ZLE_NOLAST) == ZLE_NOLAST;
+ setlbindk |= t->widget && (t->widget->flags & ZLE_NOLAST) == ZLE_NOLAST;
ret = execzlefunc(t, args, setbindk, setlbindk);
unrefthingy(t);
if (saveflag)
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 2b306fdcd..526216fa7 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -557,6 +557,22 @@ zlegetline(int *ll, int *cs)
}
+/*
+ * free() the 'memo' elements of region_highlights.
+ */
+
+/**/
+void
+free_region_highlights_memos(void)
+{
+ struct region_highlight *rhp;
+ for (rhp = region_highlights;
+ rhp < region_highlights + n_region_highlights;
+ rhp++) {
+ zfree((char*) rhp->memo, 0);
+ }
+}
+
/* Forward reference */
struct zle_region;
@@ -568,6 +584,7 @@ struct zle_region {
int start;
int end;
int flags;
+ const char *memo;
};
/* Forward reference */
@@ -632,6 +649,7 @@ zle_save_positions(void)
newrhp->next = NULL;
newrhp->atr = rhp->atr;
newrhp->flags = rhp->flags;
+ newrhp->memo = ztrdup(rhp->memo);
if (zlemetaline) {
newrhp->start = rhp->start_meta;
newrhp->end = rhp->end_meta;
@@ -682,6 +700,7 @@ zle_restore_positions(void)
nreg++, oldrhp = oldrhp->next)
;
if (nreg + N_SPECIAL_HIGHLIGHTS != n_region_highlights) {
+ free_region_highlights_memos();
n_region_highlights = nreg + N_SPECIAL_HIGHLIGHTS;
region_highlights = (struct region_highlight *)
zrealloc(region_highlights,
@@ -694,6 +713,7 @@ zle_restore_positions(void)
rhp->atr = oldrhp->atr;
rhp->flags = oldrhp->flags;
+ rhp->memo = oldrhp->memo; /* transferring ownership of the permanently-allocated memory */
if (zlemetaline) {
rhp->start_meta = oldrhp->start;
rhp->end_meta = oldrhp->end;
@@ -707,6 +727,7 @@ zle_restore_positions(void)
rhp++;
}
} else if (region_highlights) {
+ free_region_highlights_memos();
zfree(region_highlights, sizeof(struct region_highlight) *
n_region_highlights);
region_highlights = NULL;
@@ -1509,7 +1530,7 @@ mkundoent(void)
struct change *ch;
UNMETACHECK();
- if(lastll == zlell && !ZS_memcmp(lastline, zleline, zlell)) {
+ if(lastll == zlell && lastlinesz >= zlell && !ZS_memcmp(lastline, zleline, zlell)) {
lastcs = zlecs;
return;
}
diff --git a/Src/builtin.c b/Src/builtin.c
index aa5767cf1..8ef678b22 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -71,7 +71,7 @@ static struct builtin builtins[] =
* But that's actually not useful, so it's more consistent to
* cause an error.
*/
- BUILTIN("fc", 0, bin_fc, 0, -1, BIN_FC, "aAdDe:EfiIlLmnpPrRt:W", NULL),
+ BUILTIN("fc", 0, bin_fc, 0, -1, BIN_FC, "aAdDe:EfiIlLmnpPrRst:W", NULL),
BUILTIN("fg", 0, bin_fg, 0, -1, BIN_FG, NULL, NULL),
BUILTIN("float", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "E:%F:%HL:%R:%Z:%ghlp:%rtux", "E"),
BUILTIN("functions", BINF_PLUSOPTS, bin_functions, 0, -1, 0, "ckmMstTuUWx:z", NULL),
@@ -89,7 +89,6 @@ static struct builtin builtins[] =
BUILTIN("kill", BINF_HANDLES_OPTS, bin_kill, 0, -1, 0, NULL, NULL),
BUILTIN("let", 0, bin_let, 1, -1, 0, NULL, NULL),
BUILTIN("local", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%ahi:%lp:%rtux", NULL),
- BUILTIN("log", 0, bin_log, 0, 0, 0, NULL, NULL),
BUILTIN("logout", 0, bin_break, 0, 1, BIN_LOGOUT, NULL, NULL),
#if defined(ZSH_MEM) & defined(ZSH_MEM_DEBUG)
@@ -841,7 +840,6 @@ int
bin_cd(char *nam, char **argv, Options ops, int func)
{
LinkNode dir;
- struct stat st1, st2;
if (isset(RESTRICTED)) {
zwarnnam(nam, "restricted");
@@ -860,23 +858,6 @@ bin_cd(char *nam, char **argv, Options ops, int func)
}
cd_new_pwd(func, dir, OPT_ISSET(ops, 'q'));
- if (stat(unmeta(pwd), &st1) < 0) {
- setjobpwd();
- zsfree(pwd);
- pwd = NULL;
- pwd = metafy(zgetcwd(), -1, META_DUP);
- } else if (stat(".", &st2) < 0) {
- if (chdir(unmeta(pwd)) < 0)
- zwarn("unable to chdir(%s): %e", pwd, errno);
- } else if (st1.st_ino != st2.st_ino || st1.st_dev != st2.st_dev) {
- if (chasinglinks) {
- setjobpwd();
- zsfree(pwd);
- pwd = NULL;
- pwd = metafy(zgetcwd(), -1, META_DUP);
- } else if (chdir(unmeta(pwd)) < 0)
- zwarn("unable to chdir(%s): %e", pwd, errno);
- }
unqueue_signals();
return 0;
}
@@ -1210,6 +1191,7 @@ static void
cd_new_pwd(int func, LinkNode dir, int quiet)
{
char *new_pwd, *s;
+ struct stat st1, st2;
int dirstacksize;
if (func == BIN_PUSHD)
@@ -1239,6 +1221,22 @@ cd_new_pwd(int func, LinkNode dir, int quiet)
}
}
+ if (stat(unmeta(new_pwd), &st1) < 0) {
+ zsfree(new_pwd);
+ new_pwd = NULL;
+ new_pwd = metafy(zgetcwd(), -1, META_DUP);
+ } else if (stat(".", &st2) < 0) {
+ if (chdir(unmeta(new_pwd)) < 0)
+ zwarn("unable to chdir(%s): %e", new_pwd, errno);
+ } else if (st1.st_ino != st2.st_ino || st1.st_dev != st2.st_dev) {
+ if (chasinglinks) {
+ zsfree(new_pwd);
+ new_pwd = NULL;
+ new_pwd = metafy(zgetcwd(), -1, META_DUP);
+ } else if (chdir(unmeta(new_pwd)) < 0)
+ zwarn("unable to chdir(%s): %e", new_pwd, errno);
+ }
+
/* shift around the pwd variables, to make oldpwd and pwd relate to the
current (i.e. new) pwd */
zsfree(oldpwd);
@@ -1600,8 +1598,9 @@ bin_fc(char *nam, char **argv, Options ops, int func)
* command line to avoid giving the user a nasty turn
* if some helpful soul ran "print -s 'rm -rf /'".
*/
- first = OPT_ISSET(ops,'l')? addhistnum(curhist,-16,0)
- : addhistnum(curline.histnum,-1,0);
+ int xflags = OPT_ISSET(ops,'L') ? HIST_FOREIGN : 0;
+ first = OPT_ISSET(ops,'l')? addhistnum(curhist,-16,xflags)
+ : addhistnum(curline.histnum,-1,xflags);
if (first < 1)
first = 1;
if (last < first)
@@ -1644,7 +1643,7 @@ bin_fc(char *nam, char **argv, Options ops, int func)
if (!fclist(out, ops, first, last, asgf, pprog, 1)) {
char *editor;
- if (func == BIN_R)
+ if (func == BIN_R || OPT_ISSET(ops, 's'))
editor = "-";
else if (OPT_HASARG(ops, 'e'))
editor = OPT_ARG(ops, 'e');
@@ -2024,7 +2023,7 @@ typeset_setwidth(const char * name, Param pm, Options ops, int on, int always)
/**/
static Param
-typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
+typeset_single(char *cname, char *pname, Param pm, int func,
int on, int off, int roff, Asgment asg, Param altpm,
Options ops, int joinchar)
{
@@ -2280,7 +2279,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
} else if (asg->flags & ASG_ARRAY) {
int flags = (asg->flags & ASG_KEY_VALUE) ? ASSPM_KEY_VALUE : 0;
if (!(pm = assignaparam(pname, asg->value.array ?
- zlinklist2array(asg->value.array) :
+ zlinklist2array(asg->value.array, 1) :
mkarray(NULL), flags)))
return NULL;
}
@@ -2442,7 +2441,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
} else if (PM_TYPE(on) == PM_ARRAY && ASG_ARRAYP(asg)) {
int flags = (asg->flags & ASG_KEY_VALUE) ? ASSPM_KEY_VALUE : 0;
if (!(pm = assignaparam(pname, asg->value.array ?
- zlinklist2array(asg->value.array) :
+ zlinklist2array(asg->value.array, 1) :
mkarray(NULL), flags)))
return NULL;
dont_set = 1;
@@ -2480,13 +2479,19 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
return NULL;
}
if (on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z)) {
- if (typeset_setwidth(cname, pm, ops, on, 0))
+ if (typeset_setwidth(cname, pm, ops, on, 0)) {
+ unsetparam_pm(pm, 0, 1);
return NULL;
+ }
}
if (on & (PM_INTEGER | PM_EFLOAT | PM_FFLOAT)) {
- if (typeset_setbase(cname, pm, ops, on, 0))
+ if (typeset_setbase(cname, pm, ops, on, 0)) {
+ unsetparam_pm(pm, 0, 1);
return NULL;
+ }
}
+ if (isset(TYPESETTOUNSET))
+ pm->node.flags |= PM_DEFAULTED;
} else {
if (idigit(*pname))
zerrnam(cname, "not an identifier: %s", pname);
@@ -2503,8 +2508,10 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
*/
struct tieddata *tdp = (struct tieddata *)
zalloc(sizeof(struct tieddata));
- if (!tdp)
+ if (!tdp) {
+ unsetparam_pm(pm, 0, 1);
return NULL;
+ }
tdp->joinchar = joinchar;
tdp->arrptr = &altpm->u.arr;
@@ -2536,7 +2543,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
arrayval = mkarray(NULL);
}
} else if (asg->value.array)
- arrayval = zlinklist2array(asg->value.array);
+ arrayval = zlinklist2array(asg->value.array, 1);
else
arrayval = mkarray(NULL);
if (!(pm=assignaparam(pname, arrayval, flags)))
@@ -2597,7 +2604,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
*/
/**/
-int
+mod_export int
bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
{
Param pm;
@@ -2607,7 +2614,12 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
int on = 0, off = 0, roff, bit = PM_ARRAY;
int i;
int returnval = 0, printflags = 0;
- int hasargs;
+ int hasargs = *argv != NULL || (assigns && firstnode(assigns));
+
+ /* POSIXBUILTINS is set for bash/ksh and both ignore -p with args */
+ if ((func == BIN_READONLY || func == BIN_EXPORT) &&
+ isset(POSIXBUILTINS) && hasargs)
+ ops->ind['p'] = 0;
/* hash -f is really the builtin `functions' */
if (OPT_ISSET(ops,'f'))
@@ -2687,7 +2699,6 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
/* -p0 treated as -p for consistency */
}
}
- hasargs = *argv != NULL || (assigns && firstnode(assigns));
if (!hasargs) {
int exclude = 0;
if (!OPT_ISSET(ops,'p')) {
@@ -2830,7 +2841,7 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
unqueue_signals();
return 1;
} else if (pm) {
- if (!(pm->node.flags & PM_UNSET)
+ if ((!(pm->node.flags & PM_UNSET) || pm->node.flags & PM_DECLARED)
&& (locallevel == pm->level || !(on & PM_LOCAL))) {
if (pm->node.flags & PM_TIED) {
if (PM_TYPE(pm->node.flags) != PM_SCALAR) {
@@ -2883,6 +2894,8 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
*
* Don't attempt to set it yet, it's too early
* to be exported properly.
+ *
+ * This may create the array with PM_DEFAULTED.
*/
asg2.name = asg->name;
asg2.flags = 0;
@@ -2923,9 +2936,13 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
apm->ename = ztrdup(asg0.name);
if (asg->value.array) {
int flags = (asg->flags & ASG_KEY_VALUE) ? ASSPM_KEY_VALUE : 0;
- assignaparam(asg->name, zlinklist2array(asg->value.array), flags);
- } else if (oldval)
- assignsparam(asg0.name, oldval, 0);
+ assignaparam(asg->name, zlinklist2array(asg->value.array, 1), flags);
+ } else if (asg0.value.scalar || oldval) {
+ /* We have to undo what we did wrong with asg2 */
+ apm->node.flags &= ~PM_DEFAULTED;
+ if (oldval)
+ assignsparam(asg0.name, oldval, 0);
+ }
unqueue_signals();
return 0;
@@ -3706,14 +3723,12 @@ bin_unset(char *name, char **argv, Options ops, int func)
while ((s = *argv++)) {
char *ss = strchr(s, '['), *subscript = 0;
if (ss) {
- char *sse;
+ char *sse = ss + strlen(ss)-1;
*ss = 0;
- if ((sse = parse_subscript(ss+1, 1, ']'))) {
+ if (*sse == ']') {
*sse = 0;
subscript = dupstring(ss+1);
*sse = ']';
- remnulargs(subscript);
- untokenize(subscript);
}
}
if ((ss && !subscript) || !isident(s)) {
@@ -3901,7 +3916,7 @@ bin_whence(char *nam, char **argv, Options ops, int func)
}
unqueue_signals();
if (all) {
- allmatched = argv = zlinklist2array(matchednodes);
+ allmatched = argv = zlinklist2array(matchednodes, 1);
matchednodes = NULL;
popheap();
} else
@@ -4817,7 +4832,7 @@ bin_print(char *name, char **args, Options ops, int func)
{
fwrite(args[n], len[n], 1, fout);
l = widths[n];
- if (n < argc)
+ if (n < argc && ic < nc - 1)
for (; l < sc; l++)
fputc(' ', fout);
}
@@ -4857,7 +4872,7 @@ bin_print(char *name, char **args, Options ops, int func)
/* normal output */
if (!fmt) {
- if (OPT_ISSET(ops, 'z') || OPT_ISSET(ops, 'v') ||
+ if (OPT_ISSET(ops, 'z') ||
OPT_ISSET(ops, 's') || OPT_ISSET(ops, 'S')) {
/*
* We don't want the arguments unmetafied after all.
@@ -5550,6 +5565,11 @@ bin_getopts(UNUSED(char *name), char **argv, UNUSED(Options ops), UNUSED(int fun
/* check for legality */
if(opch == ':' || !(p = memchr(optstr, opch, lenoptstr))) {
p = "?";
+ /* Keep OPTIND correct if the user doesn't return after the error */
+ if (isset(POSIXBUILTINS)) {
+ optcind = 0;
+ zoptind++;
+ }
zsfree(zoptarg);
setsparam(var, ztrdup(p));
if(quiet) {
@@ -5566,6 +5586,11 @@ bin_getopts(UNUSED(char *name), char **argv, UNUSED(Options ops), UNUSED(int fun
if(p[1] == ':') {
if(optcind == lenstr) {
if(!args[zoptind]) {
+ /* Fix OPTIND as above */
+ if (isset(POSIXBUILTINS)) {
+ optcind = 0;
+ zoptind++;
+ }
zsfree(zoptarg);
if(quiet) {
setsparam(var, ztrdup(":"));
@@ -5607,13 +5632,16 @@ bin_getopts(UNUSED(char *name), char **argv, UNUSED(Options ops), UNUSED(int fun
*/
/**/
-mod_export int
-exit_pending;
+mod_export volatile int exit_pending;
/* Shell level at which we exit if exit_pending */
/**/
-mod_export int
-exit_level;
+mod_export volatile int exit_level;
+
+/* we have printed a 'you have stopped (running) jobs.' message */
+
+/**/
+mod_export volatile int stopmsg;
/* break, bye, continue, exit, logout, return -- most of these take *
* one numeric argument, and the other (logout) is related to return. *
@@ -5705,11 +5733,6 @@ bin_break(char *name, char **argv, UNUSED(Options ops), int func)
return 0;
}
-/* we have printed a 'you have stopped (running) jobs.' message */
-
-/**/
-mod_export int stopmsg;
-
/* check to see if user has jobs running/stopped */
/**/
@@ -5800,8 +5823,11 @@ zexit(int val, enum zexit_t from_where)
* a later value always overrides an earlier.
*/
exit_val = val;
- if (shell_exiting == -1)
+ if (shell_exiting == -1) {
+ retflag = 1;
+ breaks = loops;
return;
+ }
if (isset(MONITOR) && !stopmsg && from_where != ZEXIT_SIGNAL) {
scanjobs(); /* check if jobs need printing */
@@ -6119,7 +6145,7 @@ bin_emulate(char *nam, char **argv, Options ops, UNUSED(int func))
savehackchar = keyboardhackchar;
emulate(shname, opt_R, &new_emulation, new_opts);
optlist = newlinklist();
- if (parseopts(nam, &argv, new_opts, &cmd, optlist, 0)) {
+ if (parseopts(nam, &argv, new_opts, &cmd, optlist, 0, NULL)) {
ret = 1;
goto restore;
}
diff --git a/Src/compat.c b/Src/compat.c
index 8ab335aa1..817bb4aaf 100644
--- a/Src/compat.c
+++ b/Src/compat.c
@@ -126,6 +126,32 @@ zgettime(struct timespec *ts)
return ret;
}
+/* Likewise with CLOCK_MONOTONIC if available. */
+
+/**/
+mod_export int
+zgettime_monotonic_if_available(struct timespec *ts)
+{
+ int ret = -1;
+
+#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
+ struct timespec dts;
+ if (clock_gettime(CLOCK_MONOTONIC, &dts) < 0) {
+ zwarn("unable to retrieve CLOCK_MONOTONIC time: %e", errno);
+ ret--;
+ } else {
+ ret++;
+ ts->tv_sec = (time_t) dts.tv_sec;
+ ts->tv_nsec = (long) dts.tv_nsec;
+ }
+#endif
+
+ if (ret) {
+ ret = zgettime(ts);
+ }
+ return ret;
+}
+
/* compute the difference between two calendar times */
@@ -496,7 +522,7 @@ zgetdir(struct dirsav *d)
*/
/**/
-char *
+mod_export char *
zgetcwd(void)
{
char *ret = zgetdir(NULL);
diff --git a/Src/exec.c b/Src/exec.c
index 50027654a..27d49e005 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -84,7 +84,7 @@ int nohistsave;
/* error flag: bits from enum errflag_bits */
/**/
-mod_export int errflag;
+mod_export volatile int errflag;
/*
* State of trap return value. Value is from enum trap_state.
@@ -122,7 +122,7 @@ int subsh;
/* != 0 if we have a return pending */
/**/
-mod_export int retflag;
+mod_export volatile int retflag;
/**/
long lastval2;
@@ -547,10 +547,29 @@ zexecve(char *pth, char **argv, char **newenvp)
}
}
} else if (eno == ENOEXEC) {
- for (t0 = 0; t0 != ct; t0++)
- if (!execvebuf[t0])
- break;
- if (t0 == ct) {
+ /* Perform binary safety check on classic shell *
+ * scripts (shebang wasn't introduced until UNIX *
+ * Seventh Edition). POSIX says we shall allow *
+ * execution of scripts with concatenated binary *
+ * and suggests checking a line exists before the *
+ * first NUL character with a lowercase letter or *
+ * expansion. This is consistent with FreeBSD sh. */
+ int isbinary, hasletter;
+ if (!(ptr2 = memchr(execvebuf, '\0', ct))) {
+ isbinary = 0;
+ } else {
+ isbinary = 1;
+ hasletter = 0;
+ for (ptr = execvebuf; ptr < ptr2; ptr++) {
+ if (islower(*ptr) || *ptr == '$' || *ptr == '`')
+ hasletter = 1;
+ if (hasletter && *ptr == '\n') {
+ isbinary = 0;
+ break;
+ }
+ }
+ }
+ if (!isbinary) {
argv[-1] = "sh";
winch_unblock();
execve("/bin/sh", argv - 1, newenvp);
@@ -665,8 +684,10 @@ execute(LinkList args, int flags, int defpath)
/* If the parameter STTY is set in the command's environment, *
* we first run the stty command with the value of this *
- * parameter as it arguments. */
- if ((s = STTYval) && isatty(0) && (GETPGRP() == getpid())) {
+ * parameter as it arguments. If the parameter is empty, we *
+ * do nothing, but this causes the terminal settings to be *
+ * restored later which can be useful. */
+ if ((s = STTYval) && *s && isatty(0) && (GETPGRP() == getpid())) {
char *t = tricat("stty", " ", s);
STTYval = 0; /* this prevents infinite recursion */
@@ -1014,7 +1035,8 @@ entersubsh(int flags, struct entersubsh_ret *retp)
if (!(flags & ESUB_KEEPTRAP))
for (sig = 0; sig < SIGCOUNT; sig++)
- if (!(sigtrapped[sig] & ZSIG_FUNC))
+ if (!(sigtrapped[sig] & ZSIG_FUNC) &&
+ !(isset(POSIXTRAPS) && (sigtrapped[sig] & ZSIG_IGNORED)))
unsettrap(sig);
monitor = isset(MONITOR);
job_control_ok = monitor && (flags & ESUB_JOB_CONTROL) && isset(POSIXJOBS);
@@ -1036,7 +1058,8 @@ entersubsh(int flags, struct entersubsh_ret *retp)
} else if (thisjob != -1 && (flags & ESUB_PGRP)) {
if (jobtab[list_pipe_job].gleader && (list_pipe || list_pipe_child)) {
if (setpgrp(0L, jobtab[list_pipe_job].gleader) == -1 ||
- killpg(jobtab[list_pipe_job].gleader, 0) == -1) {
+ (killpg(jobtab[list_pipe_job].gleader, 0) == -1 &&
+ errno == ESRCH)) {
jobtab[list_pipe_job].gleader =
jobtab[thisjob].gleader = (list_pipe_child ? mypgrp : getpid());
setpgrp(0L, jobtab[list_pipe_job].gleader);
@@ -1248,7 +1271,9 @@ execsimple(Estate state)
} else {
int q = queue_signal_level();
dont_queue_signals();
- if (code == WC_FUNCDEF)
+ if (errflag)
+ lv = errflag;
+ else if (code == WC_FUNCDEF)
lv = execfuncdef(state, NULL);
else
lv = (execfuncs[code - WC_CURSH])(state, 0);
@@ -1664,6 +1689,7 @@ execpline(Estate state, wordcode slcode, int how, int last1)
execpline2(state, code, how, opipe[0], ipipe[1], last1);
pline_level--;
if (how & Z_ASYNC) {
+ clearoldjobtab();
lastwj = newjob;
if (thisjob == list_pipe_job)
@@ -2142,14 +2168,15 @@ clobber_open(struct redir *f)
{
struct stat buf;
int fd, oerrno;
+ char *ufname = unmeta(f->name);
/* If clobbering, just open. */
if (isset(CLOBBER) || IS_CLOBBER_REDIR(f->type))
- return open(unmeta(f->name),
+ return open(ufname,
O_WRONLY | O_CREAT | O_TRUNC | O_NOCTTY, 0666);
/* If not clobbering, attempt to create file exclusively. */
- if ((fd = open(unmeta(f->name),
+ if ((fd = open(ufname,
O_WRONLY | O_CREAT | O_EXCL | O_NOCTTY, 0666)) >= 0)
return fd;
@@ -2157,11 +2184,27 @@ clobber_open(struct redir *f)
* Try opening, and if it's a regular file then close it again *
* because we weren't supposed to open it. */
oerrno = errno;
- if ((fd = open(unmeta(f->name), O_WRONLY | O_NOCTTY)) != -1) {
- if(!fstat(fd, &buf) && !S_ISREG(buf.st_mode))
- return fd;
+ if ((fd = open(ufname, O_WRONLY | O_NOCTTY)) != -1) {
+ if(!fstat(fd, &buf)) {
+ if (!S_ISREG(buf.st_mode))
+ return fd;
+ /*
+ * If CLOBBER_EMPTY is in effect and the file is empty,
+ * we are allowed to re-use it.
+ *
+ * Note: there is an intrinsic race here because another
+ * process can write to this file at any time. The only fix
+ * would be file locking, which we wish to avoid in basic
+ * file operations at this level. This would not be
+ * fixed. just additionally complicated, by re-opening the
+ * file and truncating.
+ */
+ if (isset(CLOBBEREMPTY) && buf.st_size == 0)
+ return fd;
+ }
close(fd);
}
+
errno = oerrno;
return -1;
}
@@ -2771,8 +2814,7 @@ execcmd_fork(Estate state, int how, int type, Wordcode varspc,
/* Check if we should run background jobs at a lower priority. */
if ((how & Z_ASYNC) && isset(BGNICE)) {
errno = 0;
- nice(5);
- if (errno)
+ if (nice(5) == -1 && errno)
zwarn("nice(5) failed: %e", errno);
}
#endif /* HAVE_NICE */
@@ -2865,11 +2907,13 @@ execcmd_exec(Estate state, Execcmd_params eparams,
pushnode(args, dupstring("fg"));
}
- if ((how & Z_ASYNC) || output) {
+ if ((how & Z_ASYNC) || output ||
+ (last1 == 2 && input && EMULATION(EMULATE_SH))) {
/*
- * If running in the background, or not the last command in a
- * pipeline, we don't need any of the rest of this function to
- * affect the state in the main shell, so fork immediately.
+ * If running in the background, not the last command in a
+ * pipeline, or the last command in a multi-stage pipeline
+ * in sh mode, we don't need any of the rest of this function
+ * to affect the state in the main shell, so fork immediately.
*
* In other cases we may need to process the command line
* a bit further before we make the decision.
@@ -3383,7 +3427,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
int rmall;
s[l - 2] = 0;
- rmall = checkrmall(s);
+ rmall = checkrmall(l == 2 ? "/" : s);
s[l - 2] = t;
if (!rmall) {
@@ -3913,7 +3957,7 @@ execcmd_exec(Estate state, Execcmd_params eparams,
if (type == WC_AUTOFN) {
/*
* We pre-loaded this to get any redirs.
- * So we execuate a simplified function here.
+ * So we execute a simplified function here.
*/
lastval = execautofn_basic(state, do_exec);
} else
@@ -3968,8 +4012,8 @@ execcmd_exec(Estate state, Execcmd_params eparams,
if (is_shfunc) {
/* It's a shell function */
- pipecleanfilelist(filelist, 0);
execshfunc((Shfunc) hn, args);
+ pipecleanfilelist(filelist, 0);
} else {
/* It's a builtin */
LinkList assigns = (LinkList)0;
@@ -4581,7 +4625,7 @@ getoutput(char *cmd, int qt)
char *s;
int onc = nocomments;
- nocomments = (interact && unset(INTERACTIVECOMMENTS));
+ nocomments = (interact && !sourcelevel && unset(INTERACTIVECOMMENTS));
prog = parse_string(cmd, 0);
nocomments = onc;
@@ -4793,8 +4837,10 @@ getoutputfile(char *cmd, char **eptr)
singsub(&s);
if (errflag)
s = NULL;
- else
+ else {
untokenize(s);
+ s = dyncat(s, "\n");
+ }
}
if (!s) /* Unclear why we need to do this before open() */
@@ -5146,33 +5192,51 @@ exectime(Estate state, UNUSED(int do_exec))
return lastval;
}
-/* Define a shell function */
-
+/* The string displayed in lieu of the name of an anonymous function (in PS4,
+ * zprof output, etc)
+ */
static const char *const ANONYMOUS_FUNCTION_NAME = "(anon)";
+/*
+ * Take a function name argument and return true iff it is equal to the string
+ * used for the names of anonymous functions, "(anon)".
+ *
+ * Note that it's possible to define a named function literally called "(anon)"
+ * (though I doubt anyone would ever do that).
+ */
+/**/
+int is_anonymous_function_name(const char *name)
+{
+ return !strcmp(name, ANONYMOUS_FUNCTION_NAME);
+}
+
+/* Define a shell function */
+
/**/
static int
execfuncdef(Estate state, Eprog redir_prog)
{
Shfunc shf;
char *s = NULL;
- int signum, nprg, sbeg, nstrs, npats, len, plen, i, htok = 0, ret = 0;
+ int signum, nprg, sbeg, nstrs, npats, do_tracing, len, plen, i, htok = 0, ret = 0;
int anon_func = 0;
Wordcode beg = state->pc, end;
Eprog prog;
Patprog *pp;
LinkList names;
+ int tracing_flags;
end = beg + WC_FUNCDEF_SKIP(state->pc[-1]);
names = ecgetlist(state, *state->pc++, EC_DUPTOK, &htok);
- nprg = end - beg;
sbeg = *state->pc++;
nstrs = *state->pc++;
npats = *state->pc++;
+ do_tracing = *state->pc++;
nprg = (end - state->pc);
plen = nprg * sizeof(wordcode);
len = plen + (npats * sizeof(Patprog)) + nstrs;
+ tracing_flags = do_tracing ? PM_TAGGED_LOCAL : 0;
if (htok && names) {
execsubst(names);
@@ -5222,7 +5286,7 @@ execfuncdef(Estate state, Eprog redir_prog)
shf = (Shfunc) zalloc(sizeof(*shf));
shf->funcdef = prog;
- shf->node.flags = 0;
+ shf->node.flags = tracing_flags;
/* No dircache here, not a directory */
shf->filename = ztrdup(scriptfilename);
shf->lineno =
@@ -5317,6 +5381,12 @@ execfuncdef(Estate state, Eprog redir_prog)
*/
removetrapnode(signum);
}
+ /* Is this function traced and redefining itself? */
+ if (funcstack && funcstack->tp == FS_FUNC &&
+ !strcmp(s, funcstack->name)) {
+ Shfunc old = ((Shfunc)shfunctab->getnode(shfunctab, s));
+ shf->node.flags |= old->node.flags & (PM_TAGGED|PM_TAGGED_LOCAL);
+ }
shfunctab->addnode(shfunctab, ztrdup(s), shf);
}
}
@@ -6132,7 +6202,7 @@ stripkshdef(Eprog prog, char *name)
int sbeg = pc[2], nstrs = pc[3], nprg, npats = pc[4], plen, len, i;
Patprog *pp;
- pc += 5;
+ pc += 6;
nprg = end - pc;
plen = nprg * sizeof(wordcode);
diff --git a/Src/glob.c b/Src/glob.c
index f67a376b9..400be12d5 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -279,11 +279,11 @@ addpath(char *s, int l)
* foo/ can be used to reference a non-directory foo. Returns nonzero if *
* the file does not exists. */
-/**/
static int
statfullpath(const char *s, struct stat *st, int l)
{
char buf[PATH_MAX+1];
+ int check_for_being_a_directory = 0;
DPUTS(strlen(s) + !*s + pathpos - pathbufcwd >= PATH_MAX,
"BUG: statfullpath(): pathname too long");
@@ -294,16 +294,44 @@ statfullpath(const char *s, struct stat *st, int l)
* Don't add the '.' if the path so far is empty, since
* then we get bogus empty strings inserted as files.
*/
- buf[pathpos - pathbufcwd] = '.';
- buf[pathpos - pathbufcwd + 1] = '\0';
- l = 0;
+ if (st) {
+ buf[pathpos - pathbufcwd] = '.';
+ buf[pathpos - pathbufcwd + 1] = '\0';
+ l = 0;
+ }
+ else {
+ check_for_being_a_directory = 1;
+ }
}
unmetafy(buf, NULL);
- if (!st) {
+ if (st) {
+ return l ? lstat(buf, st) : stat(buf, st);
+ }
+ else if (check_for_being_a_directory) {
+ struct stat tmp;
+ if (stat(buf, &tmp))
+ return -1;
+
+ return S_ISDIR(tmp.st_mode) ? 0 : -1;
+ }
+ else {
char lbuf[1];
- return access(buf, F_OK) && (!l || readlink(buf, lbuf, 1) < 0);
+
+ /* If it exists, signal success. */
+ if (access(buf, F_OK) == 0)
+ return 0;
+
+ /* Would a dangling symlink be good enough? */
+ if (l == 0)
+ return -1;
+
+ /* Is it a dangling symlink? */
+ if (readlink(buf, lbuf, 1) >= 0)
+ return 0;
+
+ /* Guess it doesn't exist, then. */
+ return -1;
}
- return l ? lstat(buf, st) : stat(buf, st);
}
/* This may be set by qualifier functions to an array of strings to insert
@@ -327,11 +355,13 @@ insert(char *s, int checked)
if (gf_listtypes || gf_markdirs) {
/* Add the type marker to the end of the filename */
mode_t mode;
- checked = statted = 1;
if (statfullpath(s, &buf, 1)) {
unqueue_signals();
return;
}
+ else {
+ checked = statted = 1;
+ }
mode = buf.st_mode;
if (gf_follow) {
if (!S_ISLNK(mode) || statfullpath(s, &buf2, 0))
@@ -387,11 +417,10 @@ insert(char *s, int checked)
qn = qn->next;
}
} else if (!checked) {
- if (statfullpath(s, &buf, 1)) {
+ if (statfullpath(s, NULL, 1)) {
unqueue_signals();
return;
}
- statted = 1;
news = dyncat(pathbuf, news);
} else
news = dyncat(pathbuf, news);
@@ -2191,7 +2220,7 @@ bracechardots(char *str, convchar_t *c1p, convchar_t *c2p)
#ifdef MULTIBYTE_SUPPORT
cstart == WEOF ||
#else
- !cstart ||
+ !*pconv ||
#endif
pnext[0] != '.' || pnext[1] != '.')
return 0;
@@ -2212,7 +2241,7 @@ bracechardots(char *str, convchar_t *c1p, convchar_t *c2p)
#ifdef MULTIBYTE_SUPPORT
cend == WEOF ||
#else
- !cend ||
+ !*pconv ||
#endif
*pnext != Outbrace)
return 0;
@@ -2276,22 +2305,19 @@ xpandbraces(LinkList list, LinkNode *np)
strp = str - str3;
lenalloc = strp + strlen(str2+1) + 1;
do {
-#ifdef MULTIBYTE_SUPPORT
char *ncptr;
int nclen;
+#ifdef MULTIBYTE_SUPPORT
mb_charinit();
ncptr = wcs_nicechar(cend, NULL, NULL);
+#else
+ ncptr = nicechar(cend);
+#endif
nclen = strlen(ncptr);
p = zhalloc(lenalloc + nclen);
memcpy(p, str3, strp);
memcpy(p + strp, ncptr, nclen);
strcpy(p + strp + nclen, str2 + 1);
-#else
- p = zhalloc(lenalloc + 1);
- memcpy(p, str3, strp);
- sprintf(p + strp, "%c", cend);
- strcat(p + strp, str2 + 1);
-#endif
insertlinknode(list, last, p);
if (rev) /* decreasing: add in reverse order. */
last = nextnode(last);
@@ -2539,7 +2565,8 @@ get_match_ret(Imatchdata imd, int b, int e)
addlinknode(imd->repllist, rd);
return imd->mstr;
}
- ll += strlen(replstr);
+ if (replstr)
+ ll += strlen(replstr);
}
if (fl & SUB_MATCH) /* matched portion */
ll += 1 + (e - b);
@@ -2565,6 +2592,9 @@ get_match_ret(Imatchdata imd, int b, int e)
if (bl)
buf[bl - 1] = '\0';
+ if (ll == 0)
+ return NULL;
+
rr = r = (char *) hcalloc(ll);
if (fl & SUB_MATCH) {
@@ -3253,6 +3283,7 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
return 1;
}
if (matched) {
+ /* Default is to match at the start; see comment in MULTIBYTE above */
switch (fl & (SUB_END|SUB_LONG|SUB_SUBSTR)) {
case 0:
case SUB_LONG:
@@ -3300,7 +3331,7 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
/* Largest possible match at tail of string: *
* move forward along string until we get a match. *
* Again there's no optimisation. */
- for (ioff = 0, t = s, umlen = uml; t < send;
+ for (ioff = 0, t = s, umlen = uml; t <= send;
ioff++, t++, umlen--) {
set_pat_start(p, t-s);
if (pattrylen(p, t, send - t, umlen, &patstralloc, ioff)) {
@@ -3322,7 +3353,7 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
/* longest or smallest at start with substrings */
t = s;
if (fl & SUB_GLOBAL) {
- imd.repllist = newlinklist();
+ imd.repllist = (fl & SUB_LIST) ? znewlinklist() : newlinklist();
if (repllistp)
*repllistp = imd.repllist;
}
@@ -3331,7 +3362,7 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
do {
/* loop over all matches for global substitution */
matched = 0;
- for (; t < send; t++, ioff++, umlen--) {
+ for (; t <= send; t++, ioff++, umlen--) {
/* Find the longest match from this position. */
set_pat_start(p, t-s);
if (pattrylen(p, t, send - t, umlen, &patstralloc, ioff)) {
@@ -3372,6 +3403,8 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
* which is already marked for replacement.
*/
matched = 1;
+ if (t == send)
+ break;
while (t < mpos) {
ioff++;
umlen--;
@@ -3379,8 +3412,10 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
}
break;
}
+ if (t == send)
+ break;
}
- } while (matched);
+ } while (matched && t < send);
/*
* check if we can match a blank string, if so do it
* at the start. Goodness knows if this is a good idea
@@ -3452,6 +3487,8 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
* Results from get_match_ret in repllist are all metafied.
*/
s = *sp;
+ if (fl & SUB_LIST)
+ return 1;
i = 0; /* start of last chunk we got from *sp */
for (nd = firstnode(imd.repllist); nd; incnode(nd)) {
rd = (Repldata) getdata(nd);
@@ -3481,7 +3518,7 @@ igetmatch(char **sp, Patprog p, int fl, int n, char *replstr,
imd.replstr = NULL;
imd.repllist = NULL;
*sp = get_match_ret(&imd, 0, 0);
- return 1;
+ return (fl & SUB_RETFAIL) ? 0 : 1;
}
/**/
diff --git a/Src/hashnameddir.c b/Src/hashnameddir.c
index bed43d025..bab7b64b2 100644
--- a/Src/hashnameddir.c
+++ b/Src/hashnameddir.c
@@ -42,17 +42,6 @@
/* Named Directory Hash Table Functions */
/****************************************/
-#ifdef HAVE_NIS_PLUS
-# include <rpcsvc/nis.h>
-#else
-# ifdef HAVE_NIS
-# include <rpc/types.h>
-# include <rpc/rpc.h>
-# include <rpcsvc/ypclnt.h>
-# include <rpcsvc/yp_prot.h>
-# endif
-#endif
-
/* hash table containing named directories */
/**/
@@ -102,122 +91,11 @@ emptynameddirtable(HashTable ht)
/* Add all the usernames in the password file/database *
* to the named directories table. */
-#ifdef HAVE_NIS_PLUS
-static int
-add_userdir(nis_name table, nis_object *object, void *userdata)
-{
- if (object->zo_data.objdata_u.en_data.en_cols.en_cols_len >= 6) {
- static char name[40], dir[PATH_MAX + 1];
- register entry_col *ec =
- object->zo_data.objdata_u.en_data.en_cols.en_cols_val;
- register int nl = minimum(ec[0].ec_value.ec_value_len, 39);
- register int dl = minimum(ec[5].ec_value.ec_value_len, PATH_MAX);
-
- memcpy(name, ec[0].ec_value.ec_value_val, nl);
- name[nl] = '\0';
- memcpy(dir, ec[5].ec_value.ec_value_val, dl);
- dir[dl] = '\0';
-
- adduserdir(name, dir, ND_USERNAME, 1);
- }
- return 0;
-}
-#else
-# ifdef HAVE_NIS
-static int
-add_userdir(int status, char *key, int keylen, char *val, int vallen, char *dummy)
-{
- char *p, *d, *de;
-
- if (status != YP_TRUE)
- return 1;
-
- if (vallen > keylen && *(p = val + keylen) == ':') {
- *p++ = '\0';
- for (de = val + vallen - 1; *de != ':' && de > val; de--);
- if (de > val) {
- *de = '\0';
- if ((d = strrchr(p, ':'))) {
- if (*++d && val[0])
- adduserdir(val, d, ND_USERNAME, 1);
- }
- }
- }
- return 0;
-}
-# endif /* HAVE_NIS */
-#endif /* HAVE_NIS_PLUS */
-
/**/
static void
fillnameddirtable(UNUSED(HashTable ht))
{
if (!allusersadded) {
-#if defined(HAVE_NIS) || defined(HAVE_NIS_PLUS)
- FILE *pwf;
- char buf[BUFSIZ], *p, *d, *de;
- int skipping, oldct = nameddirtab->ct, usepwf = 1;
-
-# ifndef HAVE_NIS_PLUS
- char domain[YPMAXDOMAIN];
- struct ypall_callback cb;
-
- /* Get potential matches from NIS and cull those without local accounts */
- if (getdomainname(domain, YPMAXDOMAIN) == 0) {
- cb.foreach = (int (*)()) add_userdir;
- cb.data = NULL;
- yp_all(domain, PASSWD_MAP, &cb);
- }
-# else /* HAVE_NIS_PLUS */
- /* Maybe we should turn this string into a #define'd constant...? */
-
- nis_list("passwd.org_dir", EXPAND_NAME|ALL_RESULTS|FOLLOW_LINKS|FOLLOW_PATH,
- add_userdir, 0);
-# endif
- if (nameddirtab->ct == oldct) {
- /* Using NIS or NIS+ didn't add any user directories. This seems
- * fishy, so we fall back to using getpwent(). If we don't have
- * that, we only use the passwd file. */
-#ifdef HAVE_GETPWENT
- struct passwd *pw;
-
- setpwent();
-
- /* loop through the password file/database *
- * and add all entries returned. */
- while ((pw = getpwent()) && !errflag)
- adduserdir(pw->pw_name, pw->pw_dir, ND_USERNAME, 1);
-
- endpwent();
- usepwf = 0;
-#endif /* HAVE_GETPWENT */
- }
- if (usepwf) {
- /* Don't forget the non-NIS matches from the flat passwd file */
- if ((pwf = fopen(PASSWD_FILE, "r")) != NULL) {
- skipping = 0;
- while (fgets(buf, BUFSIZ, pwf) != NULL) {
- if (strchr(buf, '\n') != NULL) {
- if (!skipping) {
- if ((p = strchr(buf, ':')) != NULL) {
- *p++ = '\0';
- if ((de = strrchr(p, ':'))) {
- *de = '\0';
- if ((d = strrchr(p, ':'))) {
- if (*++d && buf[0])
- adduserdir(buf, d, ND_USERNAME, 1);
- }
- }
- }
- } else
- skipping = 0;
- } else
- skipping = 1;
- }
- fclose(pwf);
- }
- }
-#else /* no NIS or NIS_PLUS */
#ifdef USE_GETPWENT
struct passwd *pw;
@@ -229,8 +107,7 @@ fillnameddirtable(UNUSED(HashTable ht))
adduserdir(pw->pw_name, pw->pw_dir, ND_USERNAME, 1);
endpwent();
-#endif /* HAVE_GETPWENT */
-#endif
+#endif /* USE_GETPWENT */
allusersadded = 1;
}
}
diff --git a/Src/hashtable.c b/Src/hashtable.c
index e210ddeca..bb165505e 100644
--- a/Src/hashtable.c
+++ b/Src/hashtable.c
@@ -28,25 +28,29 @@
*/
#include "../config.h"
+#include "zsh.mdh"
+#include "hashtable.pro"
+
+typedef struct scanstatus *ScanStatus;
+typedef struct hashtableimpl* HashTableImpl;
+
+struct hashtableimpl {
+ /* Public part of hash table, accessible from outside of hashtable.c. *
+ * Must be the first field to allow casting HashTable to HashTableImpl. */
+ struct hashtable pub;
+
+ /* HASHTABLE INTERNAL MEMBERS */
+ ScanStatus scan; /* status of a scan over this hashtable */
#ifdef ZSH_HASH_DEBUG
-# define HASHTABLE_DEBUG_MEMBERS \
- /* Members of struct hashtable used for debugging hash tables */ \
- HashTable next, last; /* linked list of all hash tables */ \
- char *tablename; /* string containing name of the hash table */ \
+ /* HASHTABLE DEBUG MEMBERS */
+ HashTableImpl next, last; /* linked list of all hash tables */
+ char *tablename; /* string containing name of the hash table */
PrintTableStats printinfo; /* pointer to function to print table stats */
-#else /* !ZSH_HASH_DEBUG */
-# define HASHTABLE_DEBUG_MEMBERS
#endif /* !ZSH_HASH_DEBUG */
+};
-#define HASHTABLE_INTERNAL_MEMBERS \
- ScanStatus scan; /* status of a scan over this hashtable */ \
- HASHTABLE_DEBUG_MEMBERS
-
-typedef struct scanstatus *ScanStatus;
-
-#include "zsh.mdh"
-#include "hashtable.pro"
+static inline HashTableImpl impl(HashTable ht) { return (HashTableImpl)ht; }
/* Structure for recording status of a hashtable scan in progress. When a *
* scan starts, the .scan member of the hashtable structure points to one *
@@ -71,7 +75,8 @@ struct scanstatus {
/********************************/
#ifdef ZSH_HASH_DEBUG
-static HashTable firstht, lastht;
+static void printhashtabinfo(HashTable ht);
+static HashTableImpl firstht, lastht;
#endif /* ZSH_HASH_DEBUG */
/* Generic hash function */
@@ -94,9 +99,9 @@ hasher(const char *str)
mod_export HashTable
newhashtable(int size, UNUSED(char const *name), UNUSED(PrintTableStats printinfo))
{
- HashTable ht;
+ HashTableImpl ht;
- ht = (HashTable) zshcalloc(sizeof *ht);
+ ht = (HashTableImpl) zshcalloc(sizeof *ht);
#ifdef ZSH_HASH_DEBUG
ht->next = NULL;
if(!firstht)
@@ -108,12 +113,12 @@ newhashtable(int size, UNUSED(char const *name), UNUSED(PrintTableStats printinf
ht->printinfo = printinfo ? printinfo : printhashtabinfo;
ht->tablename = ztrdup(name);
#endif /* ZSH_HASH_DEBUG */
- ht->nodes = (HashNode *) zshcalloc(size * sizeof(HashNode));
- ht->hsize = size;
- ht->ct = 0;
+ ht->pub.nodes = (HashNode *) zshcalloc(size * sizeof(HashNode));
+ ht->pub.hsize = size;
+ ht->pub.ct = 0;
ht->scan = NULL;
- ht->scantab = NULL;
- return ht;
+ ht->pub.scantab = NULL;
+ return &ht->pub;
}
/* Delete a hash table. After this function has been used, any *
@@ -125,18 +130,18 @@ deletehashtable(HashTable ht)
{
ht->emptytable(ht);
#ifdef ZSH_HASH_DEBUG
- if(ht->next)
- ht->next->last = ht->last;
+ if(impl(ht)->next)
+ impl(ht)->next->last = impl(ht)->last;
else
- lastht = ht->last;
- if(ht->last)
- ht->last->next = ht->next;
+ lastht = impl(ht)->last;
+ if(impl(ht)->last)
+ impl(ht)->last->next = impl(ht)->next;
else
- firstht = ht->next;
- zsfree(ht->tablename);
+ firstht = impl(ht)->next;
+ zsfree(impl(ht)->tablename);
#endif /* ZSH_HASH_DEBUG */
zfree(ht->nodes, ht->hsize * sizeof(HashNode));
- zfree(ht, sizeof(*ht));
+ zfree(ht, sizeof(struct hashtableimpl));
}
/* Add a node to a hash table. *
@@ -175,7 +180,7 @@ addhashnode2(HashTable ht, char *nam, void *nodeptr)
if (!hp) {
hn->next = NULL;
ht->nodes[hashval] = hn;
- if (++ht->ct >= ht->hsize * 2 && !ht->scan)
+ if (++ht->ct >= ht->hsize * 2 && !impl(ht)->scan)
expandhashtable(ht);
return NULL;
}
@@ -185,15 +190,15 @@ addhashnode2(HashTable ht, char *nam, void *nodeptr)
ht->nodes[hashval] = hn;
replacing:
hn->next = hp->next;
- if(ht->scan) {
- if(ht->scan->sorted) {
- HashNode *hashtab = ht->scan->u.s.hashtab;
+ if(impl(ht)->scan) {
+ if(impl(ht)->scan->sorted) {
+ HashNode *hashtab = impl(ht)->scan->u.s.hashtab;
int i;
- for(i = ht->scan->u.s.ct; i--; )
+ for(i = impl(ht)->scan->u.s.ct; i--; )
if(hashtab[i] == hp)
hashtab[i] = hn;
- } else if(ht->scan->u.u == hp)
- ht->scan->u.u = hn;
+ } else if(impl(ht)->scan->u.u == hp)
+ impl(ht)->scan->u.u = hn;
}
return hp;
}
@@ -211,7 +216,7 @@ addhashnode2(HashTable ht, char *nam, void *nodeptr)
/* else just add it at the front of the list */
hn->next = ht->nodes[hashval];
ht->nodes[hashval] = hn;
- if (++ht->ct >= ht->hsize * 2 && !ht->scan)
+ if (++ht->ct >= ht->hsize * 2 && !impl(ht)->scan)
expandhashtable(ht);
return NULL;
}
@@ -284,15 +289,15 @@ removehashnode(HashTable ht, const char *nam)
ht->nodes[hashval] = hp->next;
gotit:
ht->ct--;
- if(ht->scan) {
- if(ht->scan->sorted) {
- HashNode *hashtab = ht->scan->u.s.hashtab;
+ if(impl(ht)->scan) {
+ if(impl(ht)->scan->sorted) {
+ HashNode *hashtab = impl(ht)->scan->u.s.hashtab;
int i;
- for(i = ht->scan->u.s.ct; i--; )
+ for(i = impl(ht)->scan->u.s.ct; i--; )
if(hashtab[i] == hp)
hashtab[i] = NULL;
- } else if(ht->scan->u.u == hp)
- ht->scan->u.u = hp->next;
+ } else if(impl(ht)->scan->u.u == hp)
+ impl(ht)->scan->u.u = hp->next;
}
return hp;
}
@@ -399,7 +404,7 @@ scanmatchtable(HashTable ht, Patprog pprog, int sorted,
st.sorted = 1;
st.u.s.hashtab = hnsorttab;
st.u.s.ct = ct;
- ht->scan = &st;
+ impl(ht)->scan = &st;
for (htp = hnsorttab, i = 0; i < ct; i++, htp++) {
if ((!flags1 || ((*htp)->flags & flags1)) &&
@@ -410,13 +415,13 @@ scanmatchtable(HashTable ht, Patprog pprog, int sorted,
}
}
- ht->scan = NULL;
+ impl(ht)->scan = NULL;
} else {
int i, hsize = ht->hsize;
HashNode *nodes = ht->nodes;
st.sorted = 0;
- ht->scan = &st;
+ impl(ht)->scan = &st;
for (i = 0; i < hsize; i++)
for (st.u.u = nodes[i]; st.u.u; ) {
@@ -429,7 +434,7 @@ scanmatchtable(HashTable ht, Patprog pprog, int sorted,
}
}
- ht->scan = NULL;
+ impl(ht)->scan = NULL;
}
return match;
@@ -531,7 +536,7 @@ printhashtabinfo(HashTable ht)
int chainlen[MAXDEPTH + 1];
int i, tmpcount, total;
- printf("name of table : %s\n", ht->tablename);
+ printf("name of table : %s\n", impl(ht)->tablename);
printf("size of nodes[] : %d\n", ht->hsize);
printf("number of nodes : %d\n\n", ht->ct);
@@ -560,12 +565,12 @@ printhashtabinfo(HashTable ht)
int
bin_hashinfo(UNUSED(char *nam), UNUSED(char **args), UNUSED(Options ops), UNUSED(int func))
{
- HashTable ht;
+ HashTableImpl ht;
printf("----------------------------------------------------\n");
queue_signals();
for(ht = firstht; ht; ht = ht->next) {
- ht->printinfo(ht);
+ ht->printinfo(&ht->pub);
printf("----------------------------------------------------\n");
}
unqueue_signals();
diff --git a/Src/hist.c b/Src/hist.c
index 5281e8718..f9440dba7 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -339,6 +339,13 @@ hist_in_word(int yesno)
histactive &= ~HA_INWORD;
}
+/**/
+int
+hist_is_in_word(void)
+{
+ return (histactive & HA_INWORD) ? 1 : 0;
+}
+
/* add a character to the current history word */
static void
@@ -842,7 +849,7 @@ histsubchar(int c)
break;
case 'A':
- if (!chrealpath(&sline)) {
+ if (!chrealpath(&sline, 'A', 1)) {
herrflush();
zerr("modifier failed: A");
return -1;
@@ -1854,7 +1861,11 @@ chabspath(char **junkptr)
return 1;
if (**junkptr != '/') {
- *junkptr = zhtricat(metafy(zgetcwd(), -1, META_HEAPDUP), "/", *junkptr);
+ char *here = zgetcwd();
+ if (here[strlen(here)-1] != '/')
+ *junkptr = zhtricat(metafy(here, -1, META_HEAPDUP), "/", *junkptr);
+ else
+ *junkptr = dyncat(here, *junkptr);
}
current = *junkptr;
@@ -1922,9 +1933,20 @@ chabspath(char **junkptr)
return 1;
}
+/*
+ * Resolve symlinks in junkptr.
+ *
+ * If mode is 'A', resolve dot-dot before symlinks. Else, mode should be 'P'.
+ * Refer to the documentation of the :A and :P modifiers for details.
+ *
+ * use_heap is 1 if the result is to be allocated on the heap, 0 otherwise.
+ *
+ * Return 0 for error, non-zero for success.
+ */
+
/**/
int
-chrealpath(char **junkptr)
+chrealpath(char **junkptr, char mode, int use_heap)
{
char *str;
#ifdef HAVE_REALPATH
@@ -1936,12 +1958,14 @@ chrealpath(char **junkptr)
# endif
#endif
+ DPUTS1(mode != 'A' && mode != 'P', "chrealpath: mode='%c' is invalid", mode);
+
if (!**junkptr)
return 1;
- /* Notice that this means ..'s are applied before symlinks are resolved! */
- if (!chabspath(junkptr))
- return 0;
+ if (mode == 'A')
+ if (!chabspath(junkptr))
+ return 0;
#ifndef HAVE_REALPATH
return 1;
@@ -1989,14 +2013,15 @@ chrealpath(char **junkptr)
str++;
}
+ use_heap = (use_heap ? META_HEAPDUP : META_DUP);
if (real) {
- *junkptr = metafy(str = bicat(real, nonreal), -1, META_HEAPDUP);
+ *junkptr = metafy(str = bicat(real, nonreal), -1, use_heap);
zsfree(str);
#ifdef REALPATH_ACCEPTS_NULL
free(real);
#endif
} else {
- *junkptr = metafy(nonreal, lastpos - nonreal + 1, META_HEAPDUP);
+ *junkptr = metafy(nonreal, lastpos - nonreal + 1, use_heap);
}
#endif
@@ -2227,6 +2252,7 @@ casemodify(char *str, int how)
#endif
while (*str) {
int c;
+ int mod = 0;
if (*str == Meta) {
c = str[1] ^ 32;
str += 2;
@@ -2234,13 +2260,17 @@ casemodify(char *str, int how)
c = *str++;
switch (how) {
case CASMOD_LOWER:
- if (isupper(c))
+ if (isupper(c)) {
c = tolower(c);
+ mod = 1;
+ }
break;
case CASMOD_UPPER:
- if (islower(c))
+ if (islower(c)) {
c = toupper(c);
+ mod = 1;
+ }
break;
case CASMOD_CAPS:
@@ -2248,14 +2278,18 @@ casemodify(char *str, int how)
if (!ialnum(c))
nextupper = 1;
else if (nextupper) {
- if (islower(c))
+ if (islower(c)) {
c = toupper(c);
+ mod = 1;
+ }
nextupper = 0;
- } else if (isupper(c))
+ } else if (isupper(c)) {
c = tolower(c);
+ mod = 1;
+ }
break;
}
- if (imeta(c)) {
+ if (mod && imeta(c)) {
*ptr2++ = Meta;
*ptr2++ = c ^ 32;
} else
@@ -2575,11 +2609,13 @@ resizehistents(void)
}
static int
-readhistline(int start, char **bufp, int *bufsiz, FILE *in)
+readhistline(int start, char **bufp, int *bufsiz, FILE *in, int *readbytes)
{
char *buf = *bufp;
if (fgets(buf + start, *bufsiz - start, in)) {
- int len = start + strlen(buf + start);
+ int len = strlen(buf + start);
+ *readbytes += len;
+ len += start;
if (len == start)
return -1;
if (buf[len - 1] != '\n') {
@@ -2588,16 +2624,23 @@ readhistline(int start, char **bufp, int *bufsiz, FILE *in)
return -1;
*bufp = zrealloc(buf, 2 * (*bufsiz));
*bufsiz = 2 * (*bufsiz);
- return readhistline(len, bufp, bufsiz, in);
+ return readhistline(len, bufp, bufsiz, in, readbytes);
}
}
else {
+ int spc;
buf[len - 1] = '\0';
if (len > 1 && buf[len - 2] == '\\') {
buf[--len - 1] = '\n';
if (!feof(in))
- return readhistline(len, bufp, bufsiz, in);
+ return readhistline(len, bufp, bufsiz, in, readbytes);
}
+
+ spc = len - 2;
+ while (spc >= 0 && buf[spc] == ' ')
+ spc--;
+ if (spc != len - 2 && buf[spc] == '\\')
+ buf[--len - 1] = '\0';
}
return len;
}
@@ -2616,7 +2659,7 @@ readhistfile(char *fn, int err, int readflags)
short *words;
struct stat sb;
int nwordpos, nwords, bufsiz;
- int searching, newflags, l, ret, uselex;
+ int searching, newflags, l, ret, uselex, readbytes;
if (!fn && !(fn = getsparam("HISTFILE")))
return;
@@ -2648,7 +2691,7 @@ readhistfile(char *fn, int err, int readflags)
pushheap();
if (readflags & HFILE_FAST && lasthist.text) {
if (lasthist.fpos < lasthist.fsiz) {
- fseek(in, lasthist.fpos, 0);
+ fseek(in, lasthist.fpos, SEEK_SET);
searching = 1;
}
else {
@@ -2658,13 +2701,15 @@ readhistfile(char *fn, int err, int readflags)
} else
searching = 0;
+ fpos = ftell(in);
+ readbytes = 0;
newflags = HIST_OLD | HIST_READ;
if (readflags & HFILE_FAST)
newflags |= HIST_FOREIGN;
if (readflags & HFILE_SKIPOLD
|| (hist_ignore_all_dups && newflags & hist_skip_flags))
newflags |= HIST_MAKEUNIQUE;
- while (fpos = ftell(in), (l = readhistline(0, &buf, &bufsiz, in))) {
+ while (fpos += readbytes, readbytes = 0, (l = readhistline(0, &buf, &bufsiz, in, &readbytes))) {
char *pt;
int remeta = 0;
@@ -2723,7 +2768,7 @@ readhistfile(char *fn, int err, int readflags)
&& histstrcmp(pt, lasthist.text) == 0)
searching = 0;
else {
- fseek(in, 0, 0);
+ fseek(in, 0, SEEK_SET);
histfile_linect = 0;
searching = -1;
}
@@ -2959,7 +3004,7 @@ savehistfile(char *fn, int err, int writeflags)
ret = 0;
for (; he && he->histnum <= xcurhist; he = down_histent(he)) {
- int count_backslashes = 0;
+ int end_backslashes = 0;
if ((writeflags & HFILE_SKIPDUPS && he->node.flags & HIST_DUP)
|| (writeflags & HFILE_SKIPFOREIGN && he->node.flags & HIST_FOREIGN)
@@ -2992,18 +3037,14 @@ savehistfile(char *fn, int err, int writeflags)
if (*t == '\n')
if ((ret = fputc('\\', out)) < 0)
break;
- if (*t == '\\')
- count_backslashes++;
- else
- count_backslashes = 0;
+ end_backslashes = (*t == '\\' || (end_backslashes && *t == ' '));
if ((ret = fputc(*t, out)) < 0)
break;
}
if (ret < 0)
break;
- if (count_backslashes && (count_backslashes % 2 == 0))
- if ((ret = fputc(' ', out)) < 0)
- break;
+ if (end_backslashes)
+ ret = fputc(' ', out);
if (ret < 0 || (ret = fputc('\n', out)) < 0)
break;
}
diff --git a/Src/init.c b/Src/init.c
index 99ccc16cf..871d46b12 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -248,7 +248,8 @@ static int restricted;
/**/
static void
-parseargs(char *zsh_name, char **argv, char **runscript, char **cmdptr)
+parseargs(char *zsh_name, char **argv, char **runscript, char **cmdptr,
+ int *needkeymap)
{
char **x;
LinkList paramlist;
@@ -265,7 +266,7 @@ parseargs(char *zsh_name, char **argv, char **runscript, char **cmdptr)
* matched by code at the end of the present function.
*/
- if (parseopts(zsh_name, &argv, opts, cmdptr, NULL, flags))
+ if (parseopts(zsh_name, &argv, opts, cmdptr, NULL, flags, needkeymap))
exit(1);
/*
@@ -376,7 +377,7 @@ static void parseopts_setemulate(char *nam, int flags)
/**/
mod_export int
parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
- LinkList optlist, int flags)
+ LinkList optlist, int flags, int *needkeymap)
{
int optionbreak = 0;
int action, optno;
@@ -482,8 +483,14 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
return 1;
} else if (optno == RESTRICTED && toplevel) {
restricted = action;
- } else if ((optno == EMACSMODE || optno == VIMODE) && !toplevel) {
- WARN_OPTION("can't change option: %s", *argv);
+ } else if ((optno == EMACSMODE || optno == VIMODE)
+ && (!toplevel || needkeymap)){
+ if (!toplevel) {
+ WARN_OPTION("can't change option: %s", *argv);
+ } else {
+ /* Need to wait for modules to be loadable */
+ *needkeymap = optno;
+ }
} else {
if (dosetopt(optno, action, toplevel, new_opts) &&
!toplevel) {
@@ -1035,7 +1042,6 @@ setupvals(char *cmd, char *runscript, char *zsh_name)
#endif /* FPATH_NEEDS_INIT */
mailpath = mkarray(NULL);
- watch = mkarray(NULL);
psvar = mkarray(NULL);
module_path = mkarray(ztrdup(MODULE_DIR));
modulestab = newmoduletable(17, "modules");
@@ -1705,7 +1711,7 @@ zsh_main(UNUSED(int argc), char **argv)
{
char **t, *runscript = NULL, *zsh_name;
char *cmd; /* argument to -c */
- int t0;
+ int t0, needkeymap = 0;
#ifdef USE_LOCALE
setlocale(LC_ALL, "");
#endif
@@ -1751,7 +1757,7 @@ zsh_main(UNUSED(int argc), char **argv)
createoptiontable();
/* sets emulation, LOGINSHELL, PRIVILEGED, ZLE, INTERACTIVE,
* SHINSTDIN and SINGLECOMMAND */
- parseargs(zsh_name, argv, &runscript, &cmd);
+ parseargs(zsh_name, argv, &runscript, &cmd, &needkeymap);
SHTTY = -1;
init_io(cmd);
@@ -1760,6 +1766,15 @@ zsh_main(UNUSED(int argc), char **argv)
init_signals();
init_bltinmods();
init_builtins();
+
+ if (needkeymap)
+ {
+ /* Saved for after module system initialisation */
+ zleentry(ZLE_CMD_SET_KEYMAP, needkeymap);
+ opts[needkeymap] = 1;
+ opts[needkeymap == EMACSMODE ? VIMODE : EMACSMODE] = 0;
+ }
+
run_init_scripts();
setupshin(runscript);
init_misc(cmd, zsh_name);
diff --git a/Src/input.c b/Src/input.c
index 18228b37d..c59232681 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -223,13 +223,20 @@ shingetchar(void)
return STOUC(*shinbufptr++);
shinbufreset();
- do {
- errno = 0;
- nread = read(SHIN, shinbuffer, SHINBUFSIZE);
- } while (nread < 0 && errno == EINTR);
- if (nread <= 0)
- return -1;
- shinbufendptr = shinbuffer + nread;
+ for (;;) {
+ errno = 0;
+ nread = read(SHIN, shinbufendptr, 1);
+ if (nread > 0) {
+ /* Use line buffering (POSIX requirement) */
+ if (*shinbufendptr++ == '\n')
+ break;
+ if (shinbufendptr == shinbuffer + SHINBUFSIZE)
+ break;
+ } else if (nread == 0 || errno != EINTR)
+ break;
+ }
+ if (shinbufendptr == shinbuffer)
+ return -1;
return STOUC(*shinbufptr++);
}
@@ -595,9 +602,9 @@ stuff(char *fn)
zerr("can't open %s", fn);
return 1;
}
- fseek(in, 0, 2);
+ fseek(in, 0, SEEK_END);
len = ftell(in);
- fseek(in, 0, 0);
+ fseek(in, 0, SEEK_SET);
buf = (char *)zalloc(len + 1);
if (!(fread(buf, len, 1, in))) {
zerr("read error on %s", fn);
diff --git a/Src/jobs.c b/Src/jobs.c
index e7438251e..af0a1233d 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -98,10 +98,12 @@ mod_export int jobtabsize;
mod_export int maxjob;
/* If we have entered a subshell, the original shell's job table. */
-static struct job *oldjobtab;
+/**/
+mod_export struct job *oldjobtab;
/* The size of that. */
-static int oldmaxjob;
+/**/
+mod_export int oldmaxjob;
/* shell timings */
@@ -283,7 +285,8 @@ handle_sub(int job, int fg)
if ((cp = ((WIFEXITED(jn->procs->status) ||
WIFSIGNALED(jn->procs->status)) &&
- killpg(jn->gleader, 0) == -1))) {
+ (killpg(jn->gleader, 0) == -1 &&
+ errno == ESRCH)))) {
Process p;
for (p = jn->procs; p->next; p = p->next);
jn->gleader = p->pid;
@@ -441,7 +444,7 @@ update_job(Job jn)
Process pn;
int job;
int val = 0, status = 0;
- int somestopped = 0, inforeground = 0;
+ int somestopped = 0, inforeground = 0, signalled = 0;
for (pn = jn->auxprocs; pn; pn = pn->next) {
#ifdef WIFCONTINUED
@@ -463,12 +466,15 @@ update_job(Job jn)
return; /* so no need to update job table entry */
if (WIFSTOPPED(pn->status)) /* some processes are stopped */
somestopped = 1; /* so job is not done, but entry needs updating */
- if (!pn->next) /* last job in pipeline determines exit status */
+ if (!pn->next) {
+ /* last job in pipeline determines exit status */
val = (WIFSIGNALED(pn->status) ?
0200 | WTERMSIG(pn->status) :
(WIFSTOPPED(pn->status) ?
0200 | WEXITSTATUS(pn->status) :
WEXITSTATUS(pn->status)));
+ signalled = WIFSIGNALED(pn->status);
+ }
if (pn->pid == jn->gleader) /* if this process is process group leader */
status = pn->status;
}
@@ -541,9 +547,13 @@ update_job(Job jn)
/* is this job in the foreground of an interactive shell? */
if (mypgrp != pgrp && inforeground &&
- (jn->gleader == pgrp || (pgrp > 1 && kill(-pgrp, 0) == -1))) {
+ (jn->gleader == pgrp ||
+ (pgrp > 1 &&
+ (kill(-pgrp, 0) == -1 && errno == ESRCH)))) {
if (list_pipe) {
- if (somestopped || (pgrp > 1 && kill(-pgrp, 0) == -1)) {
+ if (somestopped || (pgrp > 1 &&
+ kill(-pgrp, 0) == -1 &&
+ errno == ESRCH)) {
attachtty(mypgrp);
/* check window size and adjust if necessary */
adjustwinsize(0);
@@ -559,7 +569,7 @@ update_job(Job jn)
}
/* If we have `foo|while true; (( x++ )); done', and hit
* ^C, we have to stop the loop, too. */
- if ((val & 0200) && inforeground == 1 &&
+ if (signalled && inforeground == 1 &&
((val & ~0200) == SIGINT || (val & ~0200) == SIGQUIT)) {
if (!errbrk_saved) {
errbrk_saved = 1;
@@ -576,7 +586,7 @@ update_job(Job jn)
adjustwinsize(0);
}
}
- } else if (list_pipe && (val & 0200) && inforeground == 1 &&
+ } else if (list_pipe && signalled && inforeground == 1 &&
((val & ~0200) == SIGINT || (val & ~0200) == SIGQUIT)) {
if (!errbrk_saved) {
errbrk_saved = 1;
@@ -1708,8 +1718,15 @@ clearjobtab(int monitor)
/* Don't report any job we're part of */
if (thisjob != -1 && thisjob < oldmaxjob)
memset(oldjobtab+thisjob, 0, sizeof(struct job));
+
+ /* oldmaxjob is now the size of the table, but outside
+ * this function, it's used as a job number, which must
+ * be the largest index available in the table.
+ */
+ --oldmaxjob;
}
+
memset(jobtab, 0, jobtabsize * sizeof(struct job)); /* zero out table */
maxjob = 0;
@@ -1723,6 +1740,18 @@ clearjobtab(int monitor)
thisjob = initjob();
}
+/* In a subshell, decide we want our own job table after all. */
+
+/**/
+mod_export void
+clearoldjobtab(void)
+{
+ if (oldjobtab)
+ free(oldjobtab);
+ oldjobtab = NULL;
+ oldmaxjob = 0;
+}
+
static int initnewjob(int i)
{
jobtab[i].stat = STAT_INUSE;
@@ -1854,13 +1883,14 @@ scanjobs(void)
/* This simple function indicates whether or not s may represent *
* a number. It returns true iff s consists purely of digits and *
- * minuses. Note that minus may appear more than once, and the empty *
- * string will produce a `true' response. */
+ * minuses. Note that minus may appear more than once. */
/**/
static int
isanum(char *s)
{
+ if (*s == '\0')
+ return 0;
while (*s == '-' || idigit(*s))
s++;
return *s == '\0';
@@ -1885,6 +1915,26 @@ setcurjob(void)
}
}
+/* Find the job table for reporting jobs */
+
+/**/
+mod_export void
+selectjobtab(Job *jtabp, int *jmaxp)
+{
+ if (oldjobtab)
+ {
+ /* In subshell --- use saved job table to report */
+ *jtabp = oldjobtab;
+ *jmaxp = oldmaxjob;
+ }
+ else
+ {
+ /* Use main job table */
+ *jtabp = jobtab;
+ *jmaxp = maxjob;
+ }
+}
+
/* Convert a job specifier ("%%", "%1", "%foo", "%?bar?", etc.) *
* to a job number. */
@@ -1895,13 +1945,7 @@ getjob(const char *s, const char *prog)
int jobnum, returnval, mymaxjob;
Job myjobtab;
- if (oldjobtab) {
- myjobtab = oldjobtab;
- mymaxjob = oldmaxjob;
- } else {
- myjobtab= jobtab;
- mymaxjob = maxjob;
- }
+ selectjobtab(&myjobtab, &mymaxjob);
/* if there is no %, treat as a name */
if (*s != '%')
@@ -2261,6 +2305,13 @@ bin_fg(char *name, char **argv, Options ops, int func)
memcpy(hackzero, *argv, len);
memset(hackzero + len, 0, hackspace - len);
#endif
+
+#ifdef HAVE_PRCTL
+ /* try to change /proc/$$/comm which will *
+ * be used when checking with "ps -e" */
+#include <sys/prctl.h>
+ prctl(PR_SET_NAME, *argv);
+#endif
unqueue_signals();
return 0;
}
@@ -2417,6 +2468,7 @@ bin_fg(char *name, char **argv, Options ops, int func)
case BIN_BG:
case BIN_WAIT:
if (func == BIN_BG) {
+ clearoldjobtab();
jobtab[job].stat |= STAT_NOSTTY;
jobtab[job].stat &= ~STAT_CURSH;
}
@@ -2469,7 +2521,8 @@ bin_fg(char *name, char **argv, Options ops, int func)
if ((jobtab[job].stat & STAT_SUPERJOB) &&
((!jobtab[job].procs->next ||
(jobtab[job].stat & STAT_SUBLEADER) ||
- killpg(jobtab[job].gleader, 0) == -1)) &&
+ (killpg(jobtab[job].gleader, 0) == -1 &&
+ errno == ESRCH))) &&
jobtab[jobtab[job].other].gleader)
attachtty(jobtab[jobtab[job].other].gleader);
else
diff --git a/Src/lex.c b/Src/lex.c
index 1d86da94e..ece02659e 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -270,7 +270,7 @@ zshlex(void)
do {
if (inrepeat_)
++inrepeat_;
- if (inrepeat_ == 3 && isset(SHORTLOOPS))
+ if (inrepeat_ == 3 && (isset(SHORTLOOPS) || isset(SHORTREPEAT)))
incmdpos = 1;
tok = gettok();
} while (tok != ENDINPUT && exalias());
@@ -541,6 +541,17 @@ cmd_or_math_sub(void)
{
int c = hgetc(), ret;
+ if (c == '\\') {
+ c = hgetc();
+ if (c != '\n') {
+ hungetc(c);
+ hungetc('\\');
+ lexstop = 0;
+ return skipcomm() ? CMD_OR_MATH_ERR : CMD_OR_MATH_CMD;
+ }
+ c = hgetc();
+ }
+
if (c == '(') {
int lexpos = (int)(lexbuf.ptr - tokstr);
add(Inpar);
@@ -998,6 +1009,16 @@ gettokstr(int c, int sub)
break;
case LX2_STRING:
e = hgetc();
+ if (e == '\\') {
+ e = hgetc();
+ if (e != '\n') {
+ hungetc(e);
+ hungetc('\\');
+ lexstop = 0;
+ break;
+ }
+ e = hgetc();
+ }
if (e == '[') {
cmdpush(CS_MATHSUBST);
add(String);
@@ -1868,6 +1889,7 @@ exalias(void)
hwend();
if (interact && isset(SHINSTDIN) && !strin && incasepat <= 0 &&
tok == STRING && !nocorrect && !(inbufflags & INP_ALIAS) &&
+ !hist_is_in_word() &&
(isset(CORRECTALL) || (isset(CORRECT) && incmdpos)))
spckword(&tokstr, 1, incmdpos, 1);
diff --git a/Src/linklist.c b/Src/linklist.c
index 85d9bb367..f64685d9e 100644
--- a/Src/linklist.c
+++ b/Src/linklist.c
@@ -438,22 +438,27 @@ hlinklist2array(LinkList list, int copy)
/*
* Convert a linked list whose data elements are strings to
- * an array. The result is a permanently allocated, freearrayable
- * array.
+ * a permanently-allocated array. The elements of the array are the same
+ * elements as the linked list data if copy is 0, else they are duplicated
+ * into permanent memory so the result is a permanently allocated,
+ * freearrayable array that's a deep copy of the linked list.
*/
/**/
mod_export char **
-zlinklist2array(LinkList list)
+zlinklist2array(LinkList list, int copy)
{
int l = countlinknodes(list);
char **ret = (char **) zalloc((l + 1) * sizeof(char *)), **p;
LinkNode n;
for (n = firstnode(list), p = ret; n; incnode(n), p++) {
- *p = ztrdup((char *) getdata(n));
+ *p = (char *) getdata(n);
+ if (copy)
+ *p = ztrdup(*p);
}
*p = NULL;
return ret;
}
+
diff --git a/Src/loop.c b/Src/loop.c
index 01abc6cc9..db5b3e097 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -43,7 +43,7 @@ mod_export int contflag;
/* # of break levels */
/**/
-mod_export int breaks;
+mod_export volatile int breaks;
/**/
int
@@ -497,13 +497,15 @@ execrepeat(Estate state, UNUSED(int do_exec))
end = state->pc + WC_REPEAT_SKIP(code);
- lastval = 0;
tmp = ecgetstr(state, EC_DUPTOK, &htok);
- if (htok)
+ if (htok) {
singsub(&tmp);
+ untokenize(tmp);
+ }
count = mathevali(tmp);
if (errflag)
return 1;
+ lastval = 0; /* used when the repeat count is zero */
pushheap();
cmdpush(CS_REPEAT);
loops++;
@@ -581,7 +583,7 @@ execif(Estate state, int do_exec)
cmdpop();
} else {
noerrexit = olderrexit;
- if (!retflag)
+ if (!retflag && !errflag)
lastval = 0;
}
state->pc = end;
@@ -742,7 +744,7 @@ exectry(Estate state, int do_exec)
/* The :try clause */
++try_tryflag;
- execlist(state, 1, do_exec);
+ execlist(state, 1, 0);
--try_tryflag;
/* Don't record errflag here, may be reset. However, */
diff --git a/Src/makepro.awk b/Src/makepro.awk
index 226d3f96b..f69660531 100644
--- a/Src/makepro.awk
+++ b/Src/makepro.awk
@@ -79,7 +79,7 @@ BEGIN {
break
}
sub(/^ */, "", line)
- match(line, /^((const|enum|mod_export|static|struct|union) +)*([_0-9A-Za-z]+ +|((char|double|float|int|long|short|unsigned|void) +)+)((const|static) +)*/)
+ match(line, /^((const|enum|mod_export|static|struct|union|volatile) +)*([_0-9A-Za-z]+ +|((char|double|float|int|long|short|unsigned|void) +)+)((const|static) +)*/)
dtype = substr(line, 1, RLENGTH)
sub(/ *$/, "", dtype)
if(" " dtype " " ~ / static /)
diff --git a/Src/math.c b/Src/math.c
index 905b910ec..777ad9c31 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -162,7 +162,7 @@ static int unary = 1;
#define TOKCOUNT 53
/*
- * Opeator recedences: in reverse order, i.e. lower number, high precedence.
+ * Operator precedences: in reverse order, i.e. lower number, high precedence.
* These are the C precedences.
*
* 0 Non-operators: NUM (numeric constant), ID (identifier),
@@ -219,7 +219,7 @@ static int c_prec[TOKCOUNT] =
};
/*
- * Opeator recedences: in reverse order, i.e. lower number, high precedence.
+ * Operator precedences: in reverse order, i.e. lower number, high precedence.
* These are the default zsh precedences.
*
* 0 Non-operators: NUM (numeric constant), ID (identifier),
@@ -831,6 +831,8 @@ zzlex(void)
case ' ': /* Fall through! */
case '\t':
case '\n':
+ case '"': /* POSIX says ignore these */
+ case Dnull:
break;
default:
if (idigit(*--ptr) || *ptr == '.')
@@ -838,13 +840,18 @@ zzlex(void)
if (*ptr == '#') {
if (*++ptr == '\\' || *ptr == '#') {
int v;
+ char *optr = ptr;
ptr++;
if (!*ptr) {
zerr("bad math expression: character missing after ##");
return EOI;
}
- ptr = getkeystring(ptr, NULL, GETKEYS_MATH, &v);
+ if(!(ptr = getkeystring(ptr, NULL, GETKEYS_MATH, &v))) {
+ zerr("bad math expression: bad character after ##");
+ ptr = optr;
+ return EOI;
+ }
yyval.u.l = v;
return NUM;
}
@@ -856,14 +863,18 @@ zzlex(void)
p = ptr;
ptr = ie;
- if (ie - p == 3) {
- if (strncasecmp(p, "NaN", 3) == 0) {
+ if (ie - p == 3 && !EMULATION(EMULATE_SH)) {
+ if ((p[0] == 'N' || p[0] == 'n') &&
+ (p[1] == 'A' || p[1] == 'a') &&
+ (p[2] == 'N' || p[2] == 'n')) {
yyval.type = MN_FLOAT;
yyval.u.d = 0.0;
yyval.u.d /= yyval.u.d;
return NUM;
}
- else if (strncasecmp(p, "Inf", 3) == 0) {
+ else if ((p[0] == 'I' || p[0] == 'i') &&
+ (p[1] == 'N' || p[1] == 'n') &&
+ (p[2] == 'F' || p[2] == 'f')) {
yyval.type = MN_FLOAT;
yyval.u.d = 0.0;
yyval.u.d = 1.0 / yyval.u.d;
diff --git a/Src/mem.c b/Src/mem.c
index 5951e57ed..fb4be47bf 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -1072,19 +1072,6 @@ zrealloc(void *ptr, size_t size)
# endif
#endif
-#if defined(_BSD) && !defined(STDC_HEADERS)
-# define FREE_RET_T int
-# define FREE_ARG_T char *
-# define FREE_DO_RET
-# define MALLOC_RET_T char *
-# define MALLOC_ARG_T size_t
-#else
-# define FREE_RET_T void
-# define FREE_ARG_T void *
-# define MALLOC_RET_T void *
-# define MALLOC_ARG_T size_t
-#endif
-
/* structure for building free list in blocks holding small blocks */
struct m_shdr {
@@ -1198,8 +1185,8 @@ static struct m_hdr *m_l;
#endif /* ZSH_MEM_DEBUG */
-MALLOC_RET_T
-malloc(MALLOC_ARG_T size)
+void *
+malloc(size_t size)
{
struct m_hdr *m, *mp, *mt;
long n, s, os = 0;
@@ -1226,7 +1213,7 @@ malloc(MALLOC_ARG_T size)
#if 1
size = 1;
#else
- return (MALLOC_RET_T) m_high;
+ return (void *) m_high;
#endif
queue_signals(); /* just queue signals rather than handling them */
@@ -1284,7 +1271,7 @@ malloc(MALLOC_ARG_T size)
#endif
unqueue_signals();
- return (MALLOC_RET_T) sh;
+ return (void *) sh;
}
/* we still want a small block but there were no block with a free
small block of the requested size; so we use the real allocation
@@ -1426,14 +1413,14 @@ malloc(MALLOC_ARG_T size)
#endif
unqueue_signals();
- return (MALLOC_RET_T) (((char *)m) + sizeof(struct m_hdr));
+ return (void *) (((char *)m) + sizeof(struct m_hdr));
}
#ifdef ZSH_MEM_DEBUG
m_m[m->len < (1024 * M_ISIZE) ? (m->len / M_ISIZE) : 1024]++;
#endif
unqueue_signals();
- return (MALLOC_RET_T) & m->next;
+ return (void *) & m->next;
}
/* this is an internal free(); the second argument may, but need not hold
@@ -1640,14 +1627,10 @@ zfree(void *p, int sz)
unqueue_signals();
}
-FREE_RET_T
-free(FREE_ARG_T p)
+void
+free(void *p)
{
zfree(p, 0); /* 0 means: size is unknown */
-
-#ifdef FREE_DO_RET
- return 0;
-#endif
}
/* this one is for strings (and only strings, real strings, real C strings,
@@ -1661,8 +1644,8 @@ zsfree(char *p)
zfree(p, strlen(p) + 1);
}
-MALLOC_RET_T
-realloc(MALLOC_RET_T p, MALLOC_ARG_T size)
+void *
+realloc(void *p, size_t size)
{
struct m_hdr *m = (struct m_hdr *)(((char *)p) - M_ISIZE), *mt;
char *r;
@@ -1673,12 +1656,12 @@ realloc(MALLOC_RET_T p, MALLOC_ARG_T size)
queue_signals();
r = malloc(size);
unqueue_signals();
- return (MALLOC_RET_T) r;
+ return (void *) r;
}
/* and some systems even do this... */
if (!p || !size)
- return (MALLOC_RET_T) p;
+ return p;
queue_signals(); /* just queue signals caught rather than handling them */
@@ -1707,17 +1690,17 @@ realloc(MALLOC_RET_T p, MALLOC_ARG_T size)
free(p);
unqueue_signals();
- return (MALLOC_RET_T) r;
+ return (void *) r;
}
-MALLOC_RET_T
-calloc(MALLOC_ARG_T n, MALLOC_ARG_T size)
+void *
+calloc(size_t n, size_t size)
{
long l;
char *r;
if (!(l = n * size))
- return (MALLOC_RET_T) m_high;
+ return (void *) m_high;
/*
* use realloc() (with a NULL `p` argument it behaves exactly the same
@@ -1729,7 +1712,7 @@ calloc(MALLOC_ARG_T n, MALLOC_ARG_T size)
memset(r, 0, l);
- return (MALLOC_RET_T) r;
+ return (void *) r;
}
#ifdef ZSH_MEM_DEBUG
diff --git a/Src/module.c b/Src/module.c
index f41b82f25..bab4d8d73 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -1039,7 +1039,7 @@ checkaddparam(const char *nam, int opt_i)
* non-autoloadable parameter already there. This
* is consistent with the way add_auto* functions work.
*/
- if (!opt_i || !pm->level) {
+ if (!opt_i || pm->level) {
zwarn("Can't add module parameter `%s': %s",
nam, pm->level ?
"local parameter exists" :
diff --git a/Src/openssh_bsd_setres_id.c b/Src/openssh_bsd_setres_id.c
index 65e91a40c..217a6d074 100644
--- a/Src/openssh_bsd_setres_id.c
+++ b/Src/openssh_bsd_setres_id.c
@@ -46,6 +46,8 @@
*
*/
+#include "zsh.mdh"
+#include "openssh_bsd_setres_id.pro"
#include <sys/types.h>
@@ -53,8 +55,6 @@
#include <unistd.h>
#include <string.h>
-#include "zsh.mdh"
-
#if defined(ZSH_IMPLEMENT_SETRESGID) || defined(BROKEN_SETRESGID)
int
setresgid(gid_t rgid, gid_t egid, gid_t sgid)
diff --git a/Src/options.c b/Src/options.c
index 08ba71917..a1fe918fc 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -105,6 +105,7 @@ static struct optname optns[] = {
{{NULL, "bsdecho", OPT_EMULATE|OPT_SH}, BSDECHO},
{{NULL, "caseglob", OPT_ALL}, CASEGLOB},
{{NULL, "casematch", OPT_ALL}, CASEMATCH},
+{{NULL, "casepaths", 0}, CASEPATHS},
{{NULL, "cbases", 0}, CBASES},
{{NULL, "cprecedences", OPT_EMULATE|OPT_NONZSH}, CPRECEDENCES},
{{NULL, "cdablevars", OPT_EMULATE}, CDABLEVARS},
@@ -114,6 +115,7 @@ static struct optname optns[] = {
{{NULL, "checkjobs", OPT_EMULATE|OPT_ZSH}, CHECKJOBS},
{{NULL, "checkrunningjobs", OPT_EMULATE|OPT_ZSH}, CHECKRUNNINGJOBS},
{{NULL, "clobber", OPT_EMULATE|OPT_ALL}, CLOBBER},
+{{NULL, "clobberempty", 0}, CLOBBEREMPTY},
{{NULL, "combiningchars", 0}, COMBININGCHARS},
{{NULL, "completealiases", 0}, COMPLETEALIASES},
{{NULL, "completeinword", 0}, COMPLETEINWORD},
@@ -248,6 +250,7 @@ static struct optname optns[] = {
{{NULL, "shnullcmd", OPT_EMULATE|OPT_BOURNE}, SHNULLCMD},
{{NULL, "shoptionletters", OPT_EMULATE|OPT_BOURNE}, SHOPTIONLETTERS},
{{NULL, "shortloops", OPT_EMULATE|OPT_NONBOURNE},SHORTLOOPS},
+{{NULL, "shortrepeat", OPT_EMULATE}, SHORTREPEAT},
{{NULL, "shwordsplit", OPT_EMULATE|OPT_BOURNE}, SHWORDSPLIT},
{{NULL, "singlecommand", OPT_SPECIAL}, SINGLECOMMAND},
{{NULL, "singlelinezle", OPT_KSH}, SINGLELINEZLE},
@@ -256,6 +259,7 @@ static struct optname optns[] = {
{{NULL, "transientrprompt", 0}, TRANSIENTRPROMPT},
{{NULL, "trapsasync", 0}, TRAPSASYNC},
{{NULL, "typesetsilent", OPT_EMULATE|OPT_BOURNE}, TYPESETSILENT},
+{{NULL, "typesettounset", OPT_EMULATE|OPT_BOURNE}, TYPESETTOUNSET},
{{NULL, "unset", OPT_EMULATE|OPT_BSHELL}, UNSET},
{{NULL, "verbose", 0}, VERBOSE},
{{NULL, "vi", 0}, VIMODE},
@@ -807,7 +811,7 @@ dosetopt(int optno, int value, int force, char *new_opts)
return -1;
}
-# ifdef HAVE_INITGROUPS
+# ifdef USE_INITGROUPS
/* Set the supplementary groups list.
*
* Note that on macOS, FreeBSD, and possibly some other platforms,
diff --git a/Src/params.c b/Src/params.c
index 863b32600..970a207e4 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -63,7 +63,6 @@ char **pparams, /* $argv */
**mailpath, /* $mailpath */
**manpath, /* $manpath */
**psvar, /* $psvar */
- **watch, /* $watch */
**zsh_eval_context; /* $zsh_eval_context */
/**/
mod_export
@@ -98,8 +97,10 @@ char *ifs, /* $IFS */
*pwd; /* $PWD */
/**/
-mod_export
-zlong lastval, /* $? */
+mod_export volatile zlong
+ lastval; /* $? */
+/**/
+mod_export zlong
mypid, /* $$ */
lastpid, /* $! */
zterm_columns, /* $COLUMNS */
@@ -192,6 +193,10 @@ mod_export const struct gsu_hash stdhash_gsu =
mod_export const struct gsu_hash nullsethash_gsu =
{ hashgetfn, nullsethashfn, nullunsetfn };
+/**/
+mod_export const struct gsu_scalar colonarr_gsu =
+{ colonarrgetfn, colonarrsetfn, stdunsetfn };
+
/* Non standard methods (not exported) */
static const struct gsu_integer pound_gsu =
@@ -257,9 +262,6 @@ static const struct gsu_integer varint_readonly_gsu =
static const struct gsu_integer zlevar_gsu =
{ intvargetfn, zlevarsetfn, stdunsetfn };
-static const struct gsu_scalar colonarr_gsu =
-{ colonarrgetfn, colonarrsetfn, stdunsetfn };
-
static const struct gsu_integer argc_gsu =
{ poundgetfn, nullintsetfn, stdunsetfn };
static const struct gsu_array pipestatus_gsu =
@@ -396,7 +398,6 @@ 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),
@@ -428,7 +429,6 @@ 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),
IPDEF9("zsh_eval_context", &zsh_eval_context, "ZSH_EVAL_CONTEXT", PM_TIED|PM_READONLY_SPECIAL),
@@ -451,7 +451,6 @@ IPDEF8("CDPATH", &cdpath, NULL, 0),
IPDEF8("FIGNORE", &fignore, NULL, 0),
IPDEF8("FPATH", &fpath, NULL, 0),
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_SPECIAL),
@@ -759,7 +758,7 @@ split_env_string(char *env, char **name, char **value)
*/
static int dontimport(int flags)
{
- /* If explicitly marked as don't export */
+ /* If explicitly marked as don't import */
if (flags & PM_DONTIMPORT)
return 1;
/* If value already exported */
@@ -819,7 +818,6 @@ createparamtable(void)
* given them in the environment. */
opts[ALLEXPORT] = 0;
setiparam("MAILCHECK", 60);
- setiparam("LOGCHECK", 60);
setiparam("KEYTIMEOUT", 40);
setiparam("LISTMAX", 100);
/*
@@ -834,16 +832,18 @@ createparamtable(void)
*/
setsparam("TMPPREFIX", ztrdup_metafy(DEFAULT_TMPPREFIX));
setsparam("TIMEFMT", ztrdup_metafy(DEFAULT_TIMEFMT));
- setsparam("WATCHFMT", ztrdup_metafy(default_watchfmt));
hostnam = (char *)zalloc(256);
gethostname(hostnam, 256);
setsparam("HOST", ztrdup_metafy(hostnam));
zfree(hostnam, 256);
- setsparam("LOGNAME",
- ztrdup_metafy((str = getlogin()) && *str ?
- str : cached_username));
+ setsparam("LOGNAME", ztrdup_metafy(
+#ifndef DISABLE_DYNAMIC_NSS
+ (str = getlogin()) && *str ? str :
+#endif
+ cached_username
+ ));
#if !defined(HAVE_PUTENV) && !defined(USE_SET_UNSET_ENV)
/* Copy the environment variables we are inheriting to dynamic *
@@ -1008,6 +1008,11 @@ createparam(char *name, int flags)
(oldpm->node.flags & PM_SPECIAL) ||
/* POSIXBUILTINS horror: we need to retain 'export' flags */
(isset(POSIXBUILTINS) && (oldpm->node.flags & PM_EXPORTED))) {
+ if (oldpm->node.flags & PM_RO_BY_DESIGN) {
+ zerr("%s: can't change parameter attribute",
+ name);
+ return NULL;
+ }
oldpm->node.flags &= ~PM_UNSET;
if ((oldpm->node.flags & PM_SPECIAL) && oldpm->ename) {
Param altpm =
@@ -2093,7 +2098,8 @@ fetchvalue(Value v, char **pptr, int bracks, int flags)
if (sav)
*s = sav;
*pptr = s;
- if (!pm || (pm->node.flags & PM_UNSET))
+ if (!pm || ((pm->node.flags & PM_UNSET) &&
+ !(pm->node.flags & PM_DECLARED)))
return NULL;
if (v)
memset(v, 0, sizeof(*v));
@@ -3055,6 +3061,7 @@ assignsparam(char *s, char *val, int flags)
* Don't warn about anything.
*/
flags &= ~ASSPM_WARN;
+ v->pm->node.flags &= ~PM_DEFAULTED;
}
*ss = '[';
v = NULL;
@@ -3080,6 +3087,7 @@ assignsparam(char *s, char *val, int flags)
}
if (flags & ASSPM_WARN)
check_warn_pm(v->pm, "scalar", created, 1);
+ v->pm->node.flags &= ~PM_DEFAULTED;
if (flags & ASSPM_AUGMENT) {
if (v->start == 0 && v->end == -1) {
switch (PM_TYPE(v->pm->node.flags)) {
@@ -3232,6 +3240,7 @@ assignaparam(char *s, char **val, int flags)
if (flags & ASSPM_WARN)
check_warn_pm(v->pm, "array", created, may_warn_about_nested_vars);
+ v->pm->node.flags &= ~PM_DEFAULTED;
/*
* At this point, we may have array entries consisting of
@@ -3444,6 +3453,7 @@ sethparam(char *s, char **val)
return NULL;
}
check_warn_pm(v->pm, "associative array", checkcreate, 1);
+ v->pm->node.flags &= ~PM_DEFAULTED;
setarrvalue(v, val);
unqueue_signals();
return v->pm;
@@ -3515,6 +3525,7 @@ assignnparam(char *s, mnumber val, int flags)
if (flags & ASSPM_WARN)
check_warn_pm(v->pm, "numeric", 0, 1);
}
+ v->pm->node.flags &= ~PM_DEFAULTED;
setnumvalue(v, val);
unqueue_signals();
return v->pm;
@@ -3619,6 +3630,7 @@ unsetparam_pm(Param pm, int altflag, int exp)
else
altremove = NULL;
+ pm->node.flags &= ~PM_DECLARED; /* like ksh, not like bash */
if (!(pm->node.flags & PM_UNSET))
pm->gsu.s->unsetfn(pm, exp);
if (pm->env)
@@ -3652,6 +3664,8 @@ unsetparam_pm(Param pm, int altflag, int exp)
}
zsfree(altremove);
+ if (!(pm->node.flags & PM_SPECIAL))
+ pm->gsu.s = &stdscalar_gsu;
}
/*
@@ -4074,7 +4088,7 @@ arrvarsetfn(Param pm, char **x)
}
/**/
-char *
+mod_export char *
colonarrgetfn(Param pm)
{
char ***dptr = (char ***)pm->u.data;
@@ -4082,7 +4096,7 @@ colonarrgetfn(Param pm)
}
/**/
-void
+mod_export void
colonarrsetfn(Param pm, char *x)
{
char ***dptr = (char ***)pm->u.data;
@@ -4116,6 +4130,11 @@ tiedarrsetfn(Param pm, char *x)
if (*dptr->arrptr)
freearray(*dptr->arrptr);
+ else if (pm->ename) {
+ Param altpm = (Param) paramtab->getnode(paramtab, pm->ename);
+ if (altpm)
+ altpm->node.flags &= ~PM_DEFAULTED;
+ }
if (x) {
char sepbuf[3];
if (imeta(dptr->joinchar))
@@ -4414,7 +4433,7 @@ usernamegetfn(UNUSED(Param pm))
void
usernamesetfn(UNUSED(Param pm), char *x)
{
-#if defined(HAVE_SETUID) && defined(HAVE_GETPWNAM)
+#if defined(HAVE_SETUID) && defined(USE_GETPWNAM)
struct passwd *pswd;
if (x && (pswd = getpwnam(x)) && (pswd->pw_uid != cached_uid)) {
@@ -4431,7 +4450,7 @@ usernamesetfn(UNUSED(Param pm), char *x)
cached_uid = pswd->pw_uid;
}
}
-#endif /* HAVE_SETUID && HAVE_GETPWNAM */
+#endif /* HAVE_SETUID && USE_GETPWNAM */
zsfree(x);
}
@@ -5035,6 +5054,7 @@ arrfixenv(char *s, char **t)
if (isset(ALLEXPORT))
pm->node.flags |= PM_EXPORTED;
+ pm->node.flags &= ~PM_DEFAULTED;
/*
* Do not "fix" parameters that were not exported
@@ -5569,6 +5589,14 @@ startparamscope(void)
locallevel++;
}
+#ifdef USE_LOCALE
+/*
+ * Flag that one of the special LC_ functions or LANG changed on scope
+ * end
+ */
+static int lc_update_needed;
+#endif /* USE_LOCALE */
+
/* End a parameter scope: delete the parameters local to the scope. */
/**/
@@ -5579,7 +5607,28 @@ endparamscope(void)
locallevel--;
/* This pops anything from a higher locallevel */
saveandpophiststack(0, HFILE_USE_OPTIONS);
+#ifdef USE_LOCALE
+ lc_update_needed = 0;
+#endif
scanhashtable(paramtab, 0, 0, 0, scanendscope, 0);
+#ifdef USE_LOCALE
+ if (lc_update_needed)
+ {
+ /* Locale changed --- ensure it is restored. */
+ char *val;
+ if ((val = getsparam_u("LC_ALL")) && *val) {
+ setlocale(LC_ALL, val);
+ } else {
+ struct localename *ln;
+ if ((val = getsparam_u("LANG")) && *val)
+ setlang(val);
+ for (ln = lc_names; ln->name; ln++) {
+ if ((val = getsparam_u(ln->name)) && *val)
+ setlocale(ln->category, val);
+ }
+ }
+ }
+#endif /* USE_LOCALE */
unqueue_signals();
}
@@ -5600,6 +5649,11 @@ scanendscope(HashNode hn, UNUSED(int flags))
*/
Param tpm = pm->old;
+#ifdef USE_LOCALE
+ if (!strncmp(pm->node.nam, "LC_", 3) ||
+ !strcmp(pm->node.nam, "LANG"))
+ lc_update_needed = 1;
+#endif
if (!strcmp(pm->node.nam, "SECONDS"))
{
setsecondstype(pm, PM_TYPE(tpm->node.flags), PM_TYPE(pm->node.flags));
@@ -5805,8 +5859,9 @@ printparamnode(HashNode hn, int printflags)
Param peer = NULL;
if (p->node.flags & PM_UNSET) {
- if (printflags & (PRINT_POSIX_READONLY|PRINT_POSIX_EXPORT) &&
- p->node.flags & (PM_READONLY|PM_EXPORTED)) {
+ if ((printflags & (PRINT_POSIX_READONLY|PRINT_POSIX_EXPORT) &&
+ p->node.flags & (PM_READONLY|PM_EXPORTED)) ||
+ (p->node.flags & PM_DEFAULTED) == PM_DEFAULTED) {
/*
* Special POSIX rules: show the parameter as readonly/exported
* even though it's unset, but with no value.
@@ -5833,8 +5888,12 @@ printparamnode(HashNode hn, int printflags)
* don't.
*/
if (printflags & PRINT_POSIX_EXPORT) {
+ if (!(p->node.flags & PM_EXPORTED))
+ return;
printf("export ");
} else if (printflags & PRINT_POSIX_READONLY) {
+ if (!(p->node.flags & PM_READONLY))
+ return;
printf("readonly ");
} else if (locallevel && p->level >= locallevel) {
printf("typeset "); /* printf("local "); */
diff --git a/Src/parse.c b/Src/parse.c
index de1b27967..d612b7e17 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -102,6 +102,13 @@ struct heredocs *hdocs;
* The parser now produces word code, reducing memory consumption compared
* to the nested structs we had before.
*
+ * Word codes are represented by the "wordcode" type.
+ *
+ * Each wordcode variable consists of a "code", in the least-significant bits
+ * of the value, and "data" in the other bits. The macros wc_code() and wc_data()
+ * access the "code" and "data" parts of a wordcode. The macros wc_bdata() and
+ * wc_bld() build wordcodes from code and data.
+ *
* Word code layout:
*
* WC_END
@@ -166,8 +173,13 @@ struct heredocs *hdocs;
* - followed by offset to first string
* - followed by length of string table
* - followed by number of patterns for body
+ * - followed by an integer indicating tracing status
* - followed by codes for body
* - followed by strings for body
+ * - if number of names is 0, followed by:
+ * - the offset to the end of the funcdef
+ * - the number of arguments to the function
+ * - the arguments to the function
*
* WC_FOR
* - data contains type (list, ...) and offset to after body
@@ -253,14 +265,24 @@ struct heredocs *hdocs;
* to avoid a lot of string parsing and some more string duplication.
*/
-/**/
-int eclen, ecused, ecnpats;
-/**/
-Wordcode ecbuf;
-/**/
-Eccstr ecstrs;
-/**/
-int ecsoffs, ecssub, ecnfunc;
+/* Number of wordcodes allocated. */
+static int eclen;
+/* Number of wordcodes populated. */
+static int ecused;
+/* Number of patterns... */
+static int ecnpats;
+
+static Wordcode ecbuf;
+
+static Eccstr ecstrs;
+
+static int ecsoffs, ecssub;
+
+/*
+ * ### The number of starts and ends of function definitions up to this point.
+ * Never decremented.
+ */
+static int ecnfunc;
#define EC_INIT_SIZE 256
#define EC_DOUBLE_THRESHOLD 32768
@@ -364,7 +386,11 @@ ecispace(int p, int n)
ecadjusthere(p, n);
}
-/* Add one wordcode. */
+/*
+ * Add one wordcode.
+ *
+ * Return the index of the added wordcode.
+ */
static int
ecadd(wordcode c)
@@ -403,6 +429,7 @@ ecstrcode(char *s)
unsigned val = hasher(s);
if ((l = strlen(s) + 1) && l <= 4) {
+ /* Short string. */
t = has_token(s);
wordcode c = (t ? 3 : 2);
switch (l) {
@@ -413,11 +440,13 @@ ecstrcode(char *s)
}
return c;
} else {
+ /* Long string. */
Eccstr p, *pp;
long cmp;
for (pp = &ecstrs; (p = *pp); ) {
if (!(cmp = p->nfunc - ecnfunc) && !(cmp = (((long)p->hashval) - ((long)val))) && !(cmp = strcmp(p->str, s))) {
+ /* Re-use the existing string. */
return p->offs;
}
pp = (cmp < 0 ? &(p->left) : &(p->right));
@@ -494,7 +523,12 @@ init_parse(void)
/* Build eprog. */
-/* careful: copy_ecstr is from arg1 to arg2, unlike memcpy */
+/*
+ * Copy the strings of s and all its descendants in the binary tree to the
+ * memory block p.
+ *
+ * careful: copy_ecstr is from arg1 to arg2, unlike memcpy
+ */
static void
copy_ecstr(Eccstr s, char *p)
@@ -1559,7 +1593,7 @@ par_repeat(int *cmplx)
if (tok != ZEND)
YYERRORV(oecused);
zshlex();
- } else if (unset(SHORTLOOPS)) {
+ } else if (unset(SHORTLOOPS) && unset(SHORTREPEAT)) {
YYERRORV(oecused);
} else
par_save_list1(cmplx);
@@ -1636,6 +1670,7 @@ par_funcdef(int *cmplx)
int oecused = ecused, num = 0, onp, p, c = 0;
int so, oecssub = ecssub;
zlong oldlineno = lineno;
+ int do_tracing = 0;
lineno = 0;
nocorrect = 1;
@@ -1643,7 +1678,21 @@ par_funcdef(int *cmplx)
zshlex();
p = ecadd(0);
- ecadd(0);
+ ecadd(0); /* p + 1 */
+
+ /* Consume an initial (-T), (--), or (-T --).
+ * Anything else is a literal function name.
+ */
+ if (tok == STRING && tokstr[0] == Dash) {
+ if (tokstr[1] == 'T' && !tokstr[2]) {
+ ++do_tracing;
+ zshlex();
+ }
+ if (tok == STRING && tokstr[0] == Dash &&
+ tokstr[1] == Dash && !tokstr[2]) {
+ zshlex();
+ }
+ }
while (tok == STRING) {
if ((*tokstr == Inbrace || *tokstr == '{') &&
@@ -1655,9 +1704,10 @@ par_funcdef(int *cmplx)
num++;
zshlex();
}
- ecadd(0);
- ecadd(0);
- ecadd(0);
+ ecadd(0); /* p + num + 2 */
+ ecadd(0); /* p + num + 3 */
+ ecadd(0); /* p + num + 4 */
+ ecadd(0); /* p + num + 5 */
nocorrect = 0;
incmdpos = 1;
@@ -1695,18 +1745,20 @@ par_funcdef(int *cmplx)
ecadd(WCB_END());
ecbuf[p + num + 2] = so - oecssub;
- ecbuf[p + num + 3] = ecsoffs - so;
- ecbuf[p + num + 4] = ecnpats;
- ecbuf[p + 1] = num;
+ ecbuf[p + num + 3] = ecsoffs - so; /* "length of string table" */
+ ecbuf[p + num + 4] = ecnpats; /* "number of patterns for body" */
+ ecbuf[p + num + 5] = do_tracing;
+ ecbuf[p + 1] = num; /* "number of names" */
ecnpats = onp;
ecssub = oecssub;
ecnfunc++;
- ecbuf[p] = WCB_FUNCDEF(ecused - 1 - p);
+ ecbuf[p] = WCB_FUNCDEF(ecused - 1 - p); /* "offset to after body" */
+ /* If it's an anonymous function... */
if (num == 0) {
- /* Unnamed function */
+ /* ... look for arguments to it. */
int parg = ecadd(0);
ecadd(0);
while (tok == STRING) {
@@ -2000,7 +2052,7 @@ par_simple(int *cmplx, int nr)
/* Error if preceding assignments */
if (assignments || postassigns)
YYERROR(oecused);
- if (hasalias && !isset(ALIASFUNCDEF) && argc &&
+ if (isset(EXECOPT) && hasalias && !isset(ALIASFUNCDEF) && argc &&
hasalias != input_hasalias()) {
zwarn("defining function based on alias `%s'", hasalias);
YYERROR(oecused);
@@ -2019,6 +2071,7 @@ par_simple(int *cmplx, int nr)
ecadd(0);
ecadd(0);
ecadd(0);
+ ecadd(0);
ecnfunc++;
ecssub = so = ecsoffs;
@@ -2074,6 +2127,7 @@ par_simple(int *cmplx, int nr)
ecbuf[p + argc + 2] = so - oecssub;
ecbuf[p + argc + 3] = ecsoffs - so;
ecbuf[p + argc + 4] = ecnpats;
+ ecbuf[p + argc + 5] = 0;
ecnpats = onp;
ecssub = oecssub;
@@ -2081,8 +2135,9 @@ par_simple(int *cmplx, int nr)
ecbuf[p] = WCB_FUNCDEF(ecused - 1 - p);
+ /* If it's an anonymous function... */
if (argc == 0) {
- /* Unnamed function */
+ /* ... look for arguments to it. */
int parg = ecadd(0);
ecadd(0);
while (tok == STRING || IS_REDIROP(tok)) {
@@ -2454,7 +2509,7 @@ par_cond_2(void)
* In "test" compatibility mode, "! -a ..." and "! -o ..."
* are treated as "[string] [and] ..." and "[string] [or] ...".
*/
- if (!(n_testargs > 1 && (check_cond(*testargs, "a") ||
+ if (!(n_testargs > 2 && (check_cond(*testargs, "a") ||
check_cond(*testargs, "o"))))
{
condlex();
@@ -2756,10 +2811,6 @@ freeeprog(Eprog p)
DPUTS(p->nref > 0 && (p->flags & EF_HEAP), "Heap EPROG has nref > 0");
DPUTS(p->nref < 0 && !(p->flags & EF_HEAP), "Real EPROG has nref < 0");
DPUTS(p->nref < -1, "Uninitialised EPROG nref");
-#ifdef MAX_FUNCTION_DEPTH
- DPUTS(zsh_funcnest >=0 && p->nref > zsh_funcnest + 10,
- "Overlarge EPROG nref");
-#endif
if (p->nref > 0 && !--p->nref) {
for (i = p->npats, pp = p->pats; i--; pp++)
freepatprog(*pp);
@@ -2773,6 +2824,13 @@ freeeprog(Eprog p)
}
}
+/*
+ * dup is of type 'enum ec_dup_t'.
+ *
+ * If tokflag is not NULL, *tokflag will be set to 1 if the string contains
+ * tokens and to 0 otherwise.
+ */
+
/**/
char *
ecgetstr(Estate s, int dup, int *tokflag)
diff --git a/Src/patchlevel.h.release b/Src/patchlevel.h.release
index e4475aae7..05403a9e4 100644
--- a/Src/patchlevel.h.release
+++ b/Src/patchlevel.h.release
@@ -1 +1 @@
-#define ZSH_PATCHLEVEL "zsh-5.8.1-0-g1a490c7"
+#define ZSH_PATCHLEVEL "zsh-5.8.1.2-test-0-g6e55c92"
diff --git a/Src/pattern.c b/Src/pattern.c
index c7c2c8bea..c0e31b78e 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -509,7 +509,7 @@ void
patcompstart(void)
{
patcompcharsset();
- if (isset(CASEGLOB))
+ if (isset(CASEGLOB) || isset(CASEPATHS))
patglobflags = 0;
else
patglobflags = GF_IGNCASE;
@@ -632,6 +632,13 @@ patcompile(char *exp, int inflags, char **endexp)
p->patmlen = len;
p->patnpar = patnpar-1;
+#ifndef __CYGWIN__ /* The filesystem itself is case-insensitive on Cygwin */
+ if ((patflags & PAT_FILE) && !isset(CASEGLOB) && !(patflags & PAT_PURES)) {
+ p->globflags |= GF_IGNCASE;
+ p->globend |= GF_IGNCASE;
+ }
+#endif
+
if (!strp) {
pscan = (Upat)(patout + startoff);
@@ -1250,7 +1257,7 @@ patcomppiece(int *flagp, int paren)
int hash, count;
union upat up;
char *nptr, *str0, *ptr, *patprev;
- zrange_t from, to;
+ zrange_t from = 0, to;
char *charstart;
flags = 0;
diff --git a/Src/prompt.c b/Src/prompt.c
index 91e21c8e9..738c7fc7a 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -268,7 +268,7 @@ parsecolorchar(zattr arg, int is_fg)
bv->fm--;
}
} else
- arg = match_colour(NULL, 1, arg);
+ arg = match_colour(NULL, is_fg, arg);
return arg;
}
@@ -1055,9 +1055,9 @@ tsetcap(int cap, int flags)
if (txtisset(TXTUNDERLINE))
tsetcap(TCUNDERLINEBEG, flags);
if (txtisset(TXTFGCOLOUR))
- set_colour_attribute(txtattrmask, COL_SEQ_FG, TSC_PROMPT);
+ set_colour_attribute(txtattrmask, COL_SEQ_FG, flags);
if (txtisset(TXTBGCOLOUR))
- set_colour_attribute(txtattrmask, COL_SEQ_BG, TSC_PROMPT);
+ set_colour_attribute(txtattrmask, COL_SEQ_BG, flags);
}
}
}
@@ -1706,38 +1706,22 @@ match_colour(const char **teststrp, int is_fg, int colour)
return TXT_ERROR;
}
}
- /*
- * 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.
- */
- if (!named && tccan(tc)) {
- if (tccolours >= 0 && colour >= tccolours) {
- /*
- * Out of range of termcap colours.
- * Can we assume ANSI colours work?
- */
- if (colour > 7)
- return TXT_ERROR; /* No. */
- } else {
- /*
- * We can handle termcap colours and the number
- * is in range, so use termcap.
- */
- on |= is_fg ? TXT_ATTR_FG_TERMCAP :
- TXT_ATTR_BG_TERMCAP;
- }
- }
+
+ /* Out of range of termcap colours and basic ANSI set. */
+ if (tccan(tc) && colour > 7 && colour >= tccolours)
+ return TXT_ERROR;
+
return on | (zattr)colour << shft;
}
/*
* Match a set of highlights in the given teststr.
* Set *on_var to reflect the values found.
+ * Return a pointer to the first character not consumed.
*/
/**/
-mod_export void
+mod_export const char *
match_highlight(const char *teststr, zattr *on_var)
{
int found = 1;
@@ -1755,7 +1739,7 @@ match_highlight(const char *teststr, zattr *on_var)
atr = match_colour(&teststr, is_fg, 0);
if (*teststr == ',')
teststr++;
- else if (*teststr)
+ else if (*teststr && *teststr != ' ')
break;
found = 1;
/* skip out of range colours but keep scanning attributes */
@@ -1768,7 +1752,7 @@ match_highlight(const char *teststr, zattr *on_var)
if (*val == ',')
val++;
- else if (*val)
+ else if (*val && *val != ' ')
break;
*on_var |= hl->mask_on;
@@ -1779,6 +1763,8 @@ match_highlight(const char *teststr, zattr *on_var)
}
}
}
+
+ return teststr;
}
/*
@@ -1788,7 +1774,7 @@ match_highlight(const char *teststr, zattr *on_var)
*/
static int
-output_colour(int colour, int fg_bg, int use_tc, int truecol, char *buf)
+output_colour(int colour, int fg_bg, int truecol, char *buf)
{
int atrlen = 3, len;
char *ptr = buf;
@@ -1806,7 +1792,7 @@ output_colour(int colour, int fg_bg, int use_tc, int truecol, char *buf)
* used instead of termcap even for colour > 7. Here this just emits the
* color number, so it works fine for both zle_highlight and tercap cases
*/
- } else if (use_tc || colour > 7) {
+ } else if (colour > 7) {
char digbuf[DIGBUFSIZE];
sprintf(digbuf, "%d", colour);
len = strlen(digbuf);
@@ -1843,7 +1829,6 @@ output_highlight(zattr atr, char *buf)
if (atr & TXTFGCOLOUR) {
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;
@@ -1860,7 +1845,6 @@ output_highlight(zattr 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;
@@ -2025,7 +2009,6 @@ free_colour_buffer(void)
* fg_bg indicates if we're changing the foreground or background.
* tc indicates the termcap code to use, if appropriate.
* def indicates if we're resetting the default colour.
- * use_termcap indicates if we should use termcap to output colours.
* flags is either 0 or TSC_PROMPT.
*/
@@ -2035,7 +2018,7 @@ 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, use_truecolor;
+ int colour, tc, def, use_truecolor;
int is_default_zle_highlight = 1;
if (fg_bg == COL_SEQ_FG) {
@@ -2043,13 +2026,11 @@ set_colour_attribute(zattr atr, int fg_bg, int flags)
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);
}
/* Test if current zle_highlight settings are customized, or
@@ -2064,17 +2045,14 @@ set_colour_attribute(zattr 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.
+ * If we're not restoring the default or applying true color,
+ * try to use the termcap sequence.
*
* 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 && !use_truecolor &&
- (is_default_zle_highlight && (colour > 7 || use_termcap)))
+ if (!def && !use_truecolor && is_default_zle_highlight)
{
/*
* We can if it's available, and either we couldn't get
@@ -2094,7 +2072,8 @@ set_colour_attribute(zattr atr, int fg_bg, int flags)
*bv->bp++ = Outpar;
}
} else {
- tputs(tgoto(tcstr[tc], colour, colour), 1, putshout);
+ tputs(tgoto(tcstr[tc], colour, colour), 1,
+ (flags & TSC_RAW) ? putraw : putshout);
}
/* That worked. */
return;
@@ -2153,7 +2132,7 @@ set_colour_attribute(zattr atr, int fg_bg, int flags)
*bv->bp++ = Outpar;
}
} else
- tputs(colseq_buf, 1, putshout);
+ tputs(colseq_buf, 1, (flags & TSC_RAW) ? putraw : putshout);
if (do_free)
free_colour_buffer();
diff --git a/Src/signals.c b/Src/signals.c
index 96ff9e9b3..5c787e2a8 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -53,7 +53,7 @@ mod_export Eprog siglists[VSIGCOUNT];
/* Total count of trapped signals */
/**/
-mod_export int nsigtrapped;
+mod_export volatile int nsigtrapped;
/* Running an exit trap? */
@@ -72,20 +72,20 @@ static int exit_trap_posix;
/* Variables used by signal queueing */
/**/
-mod_export int queueing_enabled, queue_front, queue_rear;
+mod_export volatile int queueing_enabled, queue_front, queue_rear;
/**/
mod_export int signal_queue[MAX_QUEUE_SIZE];
/**/
mod_export sigset_t signal_mask_queue[MAX_QUEUE_SIZE];
#ifdef DEBUG
/**/
-mod_export int queue_in;
+mod_export volatile int queue_in;
#endif
/* Variables used by trap queueing */
/**/
-mod_export int trap_queueing_enabled, trap_queue_front, trap_queue_rear;
+mod_export volatile int trap_queueing_enabled, trap_queue_front, trap_queue_rear;
/**/
mod_export int trap_queue[MAX_QUEUE_SIZE];
@@ -539,7 +539,8 @@ wait_for_processes(void)
#endif
if (WIFEXITED(status) &&
pn->pid == jn->gleader &&
- killpg(pn->pid, 0) == -1) {
+ killpg(pn->pid, 0) == -1 &&
+ errno == ESRCH) {
if (last_attached_pgrp == jn->gleader &&
!(jn->stat & STAT_NOSTTY)) {
/*
@@ -671,9 +672,9 @@ zhandler(int sig)
if ((isset(PRIVILEGED) || isset(RESTRICTED)) &&
isset(INTERACTIVE) && (noerrexit & NOERREXIT_SIGNAL))
zexit(SIGINT, ZEXIT_SIGNAL);
+ errflag |= ERRFLAG_INT;
if (list_pipe || chline || simple_pline) {
breaks = loops;
- errflag |= ERRFLAG_INT;
inerrflush();
check_cursh_sig(SIGINT);
}
@@ -809,6 +810,7 @@ killjb(Job jn, int sig)
err = killpg(jn->gleader, sig);
if (sig == SIGCONT && err != -1)
makerunning(jn);
+ return err;
}
}
for (pn = jn->procs; pn; pn = pn->next) {
@@ -1265,19 +1267,19 @@ unqueue_traps(void)
/* Are we already executing a trap? */
/**/
-int intrap;
+volatile int intrap;
/* Is the current trap a function? */
/**/
-int trapisfunc;
+volatile int trapisfunc;
/*
* If the current trap is not a function, at what function depth
* did the trap get called?
*/
/**/
-int traplocallevel;
+volatile int traplocallevel;
/*
* sig is the signal number.
diff --git a/Src/sort.c b/Src/sort.c
index 8faf9349c..26949ad9c 100644
--- a/Src/sort.c
+++ b/Src/sort.c
@@ -135,12 +135,23 @@ eltpcmp(const void *a, const void *b)
#endif
if (sortnumeric) {
+ int mul = 0;
for (; *as == *bs && *as; as++, bs++);
#ifndef HAVE_STRCOLL
cmp = (int)STOUC(*as) - (int)STOUC(*bs);
#endif
- if (idigit(*as) || idigit(*bs)) {
+ if (sortnumeric < 0) {
+ if (*as == '-' && idigit(as[1]) && idigit(*bs)) {
+ cmp = -1;
+ mul = 1;
+ } else if (*bs == '-' && idigit(bs[1]) && idigit(*as)) {
+ cmp = 1;
+ mul = 1;
+ }
+ }
+ if (!mul && (idigit(*as) || idigit(*bs))) {
for (; as > ao && idigit(as[-1]); as--, bs--);
+ mul = (sortnumeric < 0 && as > ao && as[-1] == '-') ? -1 : 1;
if (idigit(*as) && idigit(*bs)) {
while (*as == '0')
as++;
@@ -148,13 +159,13 @@ eltpcmp(const void *a, const void *b)
bs++;
for (; idigit(*as) && *as == *bs; as++, bs++);
if (idigit(*as) || idigit(*bs)) {
- cmp = (int)STOUC(*as) - (int)STOUC(*bs);
+ cmp = mul * ((int)STOUC(*as) - (int)STOUC(*bs));
while (idigit(*as) && idigit(*bs))
as++, bs++;
if (idigit(*as) && !idigit(*bs))
- return sortdir;
+ return mul * sortdir;
if (idigit(*bs) && !idigit(*as))
- return -sortdir;
+ return -mul * sortdir;
}
}
}
@@ -195,7 +206,8 @@ zstrcmp(const char *as, const char *bs, int sortflags)
sortdir = 1;
sortnobslash = (sortflags & SORTIT_IGNORING_BACKSLASHES) ? 1 : 0;
- sortnumeric = (sortflags & SORTIT_NUMERICALLY) ? 1 : 0;
+ sortnumeric = (sortflags & SORTIT_NUMERICALLY_SIGNED) ? -1 :
+ (sortflags & SORTIT_NUMERICALLY) ? 1 : 0;
ret = eltpcmp(&aeptr, &beptr);
@@ -389,7 +401,8 @@ strmetasort(char **array, int sortwhat, int *unmetalenp)
oldsortnumeric = sortnumeric;
sortdir = (sortwhat & SORTIT_BACKWARDS) ? -1 : 1;
- sortnumeric = (sortwhat & SORTIT_NUMERICALLY) ? 1 : 0;
+ sortnumeric = (sortwhat & SORTIT_NUMERICALLY_SIGNED) ? -1 :
+ (sortwhat & SORTIT_NUMERICALLY) ? 1 : 0;
qsort(sortptrarr, nsort, sizeof(SortElt), eltpcmp);
diff --git a/Src/string.c b/Src/string.c
index 9e14ef949..5f439926e 100644
--- a/Src/string.c
+++ b/Src/string.c
@@ -103,7 +103,10 @@ wcs_ztrdup(const wchar_t *s)
#endif /* MULTIBYTE_SUPPORT */
-/* concatenate s1, s2, and s3 in dynamically allocated buffer */
+/* Concatenate s1, s2, and s3 into dynamically allocated buffer.
+ *
+ * To concatenate four or more strings, see zjoin().
+ */
/**/
mod_export char *
diff --git a/Src/subst.c b/Src/subst.c
index 79efc9ad2..0f98e6ea3 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -765,7 +765,7 @@ filesubstr(char **namptr, int assign)
*namptr = dyncat(res, ptr2+1);
return 1;
}
- if (isset(NOMATCH))
+ if (isset(NOMATCH) && isset(EXECOPT))
zerr("no directory expansion: ~[%s]", tmp);
return 0;
} else if (!inblank(str[1]) && isend(*ptr) &&
@@ -796,7 +796,7 @@ filesubstr(char **namptr, int assign)
*namptr = dyncat(hom, ptr);
return 1;
}
- } else if (*str == Equals && isset(EQUALS) && str[1]) { /* =foo */
+ } else if (*str == Equals && isset(EQUALS) && str[1] && str[1] != Inpar) { /* =foo */
char *expn = equalsubstr(str+1, assign, isset(NOMATCH));
if (expn) {
*namptr = expn;
@@ -1565,6 +1565,11 @@ check_colon_subscript(char *str, char **endp)
if (!*str || ialpha(*str) || *str == '&')
return NULL;
+ if (*str == ':') {
+ *endp = str;
+ return dupstring("0");
+ }
+
*endp = parse_subscript(str, 0, ':');
if (!*endp) {
/* No trailing colon? */
@@ -1575,8 +1580,10 @@ check_colon_subscript(char *str, char **endp)
sav = **endp;
**endp = '\0';
str = dupstring(str);
- if (parsestr(&str))
+ if (parsestr(&str)) {
+ **endp = sav;
return NULL;
+ }
singsub(&str);
remnulargs(str);
untokenize(str);
@@ -1701,7 +1708,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
/*
* This expressive name refers to the set of flags which
* is applied to matching for #, %, / and their doubled variants:
- * (M), (R), (B), (E), (N), (S).
+ * (M), (R), (B), (E), (N), (S), (*).
*/
int flags = 0;
/* Value from (I) flag, used for ditto. */
@@ -1847,6 +1854,12 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
* nested (P) flags.
*/
int fetch_needed;
+ /*
+ * If an array parameter is quoted but has :offset:length (as in
+ * "${array:off:len}"), we apply :off:len as array index before
+ * joining the array into a string (for compatibility with ksh/bash).
+ */
+ int quoted_array_with_offset = 0;
*s++ = '\0';
/*
@@ -1923,6 +1936,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
case '@':
nojoin = 2; /* nojoin = 2 means force */
break;
+ case '*':
+ case Star:
+ flags |= SUB_EGLOB;
+ break;
case 'M':
flags |= SUB_MATCH;
break;
@@ -1972,6 +1989,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
case 'n':
sortit |= SORTIT_NUMERICALLY;
break;
+ case '-':
+ case Dash:
+ sortit |= SORTIT_NUMERICALLY_SIGNED;
+ break;
case 'a':
sortit |= SORTIT_SOMEHOW;
indord = 1;
@@ -2244,9 +2265,31 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
break;
default:
- flagerr:
- zerr("error in flags");
- return NULL;
+ flagerr:
+ {
+ /*
+ * We're trying to output the string that failed to
+ * parse and the offset of the parse error within that.
+ *
+ * The string is *str. It hasn't been changed since
+ * entry to this function, I think, except that the
+ * first non-variable-declaration line in this function
+ * (currently the 238th line in this function)
+ * writes a NUL to the first place in *str, so we'll
+ * compensate by outputting the dollar sign manually.
+ */
+ char *str_copy_for_output = dupstring(*str + 1);
+
+ /*
+ * Convert to a 1-based offset, because the shell
+ * language is 1-based by default.
+ */
+ zlong offset = s - *str + 1;
+
+ untokenize(str_copy_for_output);
+ zerr("error in flags near position %z in '$%s'", offset, str_copy_for_output);
+ return NULL;
+ }
}
}
s++;
@@ -2526,7 +2569,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
* Handle the (t) flag: value now becomes the type
* information for the parameter.
*/
- if (v && v->pm && !(v->pm->node.flags & PM_UNSET)) {
+ if (v && v->pm && ((v->pm->node.flags & PM_DECLARED) ||
+ !(v->pm->node.flags & PM_UNSET))) {
int f = v->pm->node.flags;
switch (PM_TYPE(f)) {
@@ -2781,7 +2825,6 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
}
if (bct) {
- noclosebrace:
zerr("closing brace expected");
return NULL;
}
@@ -2800,7 +2843,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
c == '#' || c == Pound ||
c == '?' || c == Quest ||
c == '/')) {
-
+ int eglob = isset(EXTENDEDGLOB);
/*
* Default index is 1 if no (I) or (I) gave zero. But
* why don't we set the default explicitly at the start
@@ -2822,9 +2865,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
char *ptr;
/*
* previous flags are irrelevant, except for (S) which
- * indicates shortest substring; else look for longest.
+ * indicates shortest substring; else look for longest,
+ * and (*) which temporarily enables extended globbing.
*/
- flags = (flags & SUB_SUBSTR) ? 0 : SUB_LONG;
+ flags = ((flags & SUB_SUBSTR) ? 0 : SUB_LONG)|(flags & SUB_EGLOB);
if ((c = *s) == '/') {
/* doubled, so replace all occurrences */
flags |= SUB_GLOBAL;
@@ -2937,9 +2981,12 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
}
break;
case ':':
- /* this must be `::=', unconditional assignment */
- if (*s != '=' && *s != Equals)
- goto noclosebrace;
+ /* this could be either `::=', unconditional assignment
+ * or a ${name:offset:length} with an empty offset */
+ if (*s != '=' && *s != Equals) {
+ s -= 1;
+ goto colonsubscript;
+ }
vunset = 1;
s++;
/* Fall through */
@@ -3123,7 +3170,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
for (ap = aval; *ap; ap++) {
untokenize(*ap);
}
+ if (flags & SUB_EGLOB)
+ opts[EXTENDEDGLOB] = 1;
getmatcharr(&aval, s, flags, flnum, replstr);
+ opts[EXTENDEDGLOB] = eglob;
} else {
if (vunset) {
if (vunset > 0 && unset(UNSET)) {
@@ -3138,7 +3188,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
copied = 1;
untokenize(val);
}
+ if (flags & SUB_EGLOB)
+ opts[EXTENDEDGLOB] = 1;
getmatch(&val, s, flags, flnum, replstr);
+ opts[EXTENDEDGLOB] = eglob;
}
break;
}
@@ -3282,6 +3335,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
* if there isn't a trailing modifier? Why don't we do this
* e.g. when we handle the ${(t)...} flag?
*/
+colonsubscript:
if (chkset) {
val = dupstring(vunset ? "0" : "1");
isarr = 0;
@@ -3314,20 +3368,31 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
return NULL;
}
if (*check_offset2) {
+ char *nextp;
check_offset = check_colon_subscript(check_offset2 + 1,
- &check_offset2);
- if (*check_offset2 && *check_offset2 != ':') {
- zerr("invalid length: %s", check_offset);
- return NULL;
- }
+ &nextp);
if (check_offset) {
+ check_offset2 = nextp;
+ if (*check_offset2 && *check_offset2 != ':') {
+ zerr("invalid length: %s", check_offset);
+ return NULL;
+ }
length = mathevali(check_offset);
length_set = 1;
if (errflag)
return NULL;
}
}
- if (isarr) {
+ /*
+ * We've got :OFFSET (and :LENGTH).
+ * If aval is non-NULL but isarr is 0, PARAM is (probably)
+ * an array but quoted like "${PARAM:OFFSET}". We apply
+ * :OFFSET as array index (as if it is not quoted). We will
+ * join them later (search for quoted_array_with_offset).
+ */
+ if (aval && !isarr)
+ quoted_array_with_offset = 1;
+ if (isarr || quoted_array_with_offset) {
int alen, count;
char **srcptr, **dstptr, **newarr;
@@ -3572,9 +3637,9 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
* exception is that ${name:-word} and ${name:+word} will have already
* done any requested splitting of the word value with quoting preserved.
*/
- if (ssub || spbreak || spsep || sep) {
+ if (ssub || spbreak || spsep || sep || quoted_array_with_offset) {
int force_split = !ssub && (spbreak || spsep);
- if (isarr) {
+ if (isarr || quoted_array_with_offset) {
/* sep non-null here means F or j flag, force join */
if (nojoin == 0 || sep) {
val = sepjoin(aval, sep, 1);
@@ -4399,7 +4464,7 @@ modify(char **str, char **ptr, int inbrace)
chabspath(&copy);
break;
case 'A':
- chrealpath(&copy);
+ chrealpath(&copy, 'A', 1);
break;
case 'c':
{
@@ -4485,7 +4550,7 @@ modify(char **str, char **ptr, int inbrace)
chabspath(str);
break;
case 'A':
- chrealpath(str);
+ chrealpath(str, 'A', 1);
break;
case 'c':
{
diff --git a/Src/text.c b/Src/text.c
index 69530ae79..5cd7685fd 100644
--- a/Src/text.c
+++ b/Src/text.c
@@ -335,6 +335,8 @@ getjobtext(Eprog prog, Wordcode c)
tlim = tptr + JOBTEXTSIZE - 1;
tjob = 1;
gettext2(&s);
+ if (tptr[-1] == Meta)
+ --tptr;
*tptr = '\0';
freeeprog(prog); /* mark as unused */
untokenize(jbuf);
@@ -600,7 +602,7 @@ gettext2(Estate state)
n->u._funcdef.end = end;
n->u._funcdef.nargs = nargs;
state->strs += *state->pc;
- state->pc += 3;
+ state->pc += 4;
}
} else {
state->strs = s->u._funcdef.strs;
diff --git a/Src/utils.c b/Src/utils.c
index f5667f389..62bd3e602 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -130,6 +130,7 @@ set_widearray(char *mb_array, Widechar_array wca)
%l const char *, int C string of given length (null not required)
%L long decimal value
%d int decimal value
+ %z zlong decimal value
%% (none) literal '%'
%c int character at that codepoint
%e int strerror() message (argument is typically 'errno')
@@ -331,6 +332,14 @@ zerrmsg(FILE *file, const char *fmt, va_list ap)
num = va_arg(ap, int);
fprintf(file, "%d", num);
break;
+ case 'z':
+ {
+ zlong znum = va_arg(ap, zlong);
+ char buf[DIGBUFSIZE];
+ convbase(buf, znum, 10);
+ fputs(buf, file);
+ break;
+ }
case '%':
putc('%', file);
break;
@@ -429,7 +438,6 @@ putshout(int c)
return 0;
}
-#ifdef MULTIBYTE_SUPPORT
/*
* Turn a character into a visible representation thereof. The visible
* string is put together in a static buffer, and this function returns
@@ -515,62 +523,6 @@ nicechar(int c)
return nicechar_sel(c, 0);
}
-#else /* MULTIBYTE_SUPPORT */
-
-/**/
-mod_export char *
-nicechar(int c)
-{
- static char buf[10];
- char *s = buf;
- c &= 0xff;
- if (ZISPRINT(c))
- goto done;
- if (c & 0x80) {
- if (isset(PRINTEIGHTBIT))
- goto done;
- *s++ = '\\';
- *s++ = 'M';
- *s++ = '-';
- c &= 0x7f;
- if(ZISPRINT(c))
- goto done;
- }
- if (c == 0x7f) {
- *s++ = '\\';
- *s++ = 'C';
- *s++ = '-';
- c = '?';
- } else if (c == '\n') {
- *s++ = '\\';
- c = 'n';
- } else if (c == '\t') {
- *s++ = '\\';
- c = 't';
- } else if (c < 0x20) {
- *s++ = '\\';
- *s++ = 'C';
- *s++ = '-';
- c += 0x40;
- }
- done:
- /*
- * The resulting string is still metafied, so check if
- * we are returning a character in the range that needs metafication.
- * This can't happen if the character is printed "nicely", so
- * this results in a maximum of two bytes total (plus the null).
- */
- if (imeta(c)) {
- *s++ = Meta;
- *s++ = c ^ 32;
- } else
- *s++ = c;
- *s = 0;
- return buf;
-}
-
-#endif /* MULTIBYTE_SUPPORT */
-
/*
* Return 1 if nicechar() would reformat this character.
*/
@@ -711,7 +663,7 @@ wcs_nicechar_sel(wchar_t c, size_t *widthp, char **swidep, int quotable)
if (widthp)
*widthp = 6;
} else {
- strcpy(buf, nicechar((int)c));
+ strcpy(buf, nicechar_sel((int)c, quotable));
/*
* There may be metafied characters from nicechar(),
* so compute width and end position independently.
@@ -771,7 +723,7 @@ mod_export int is_wcs_nicechar(wchar_t c)
if (c == 0x7f || c == L'\n' || c == L'\t' || c < 0x20)
return 1;
if (c >= 0x80) {
- return (c >= 0x100);
+ return (c >= 0x100 || is_nicechar((int)c));
}
}
return 0;
@@ -910,11 +862,14 @@ slashsplit(char *s)
return r;
}
-/* expands symlinks and .. or . expressions */
+/* expands .. or . expressions and one level of symlinks
+ *
+ * Puts the result in the global "xbuf"
+ */
/**/
static int
-xsymlinks(char *s, int full)
+xsymlinks(char *s)
{
char **pp, **opp;
char xbuf2[PATH_MAX*3+1], xbuf3[PATH_MAX*2+1];
@@ -963,7 +918,7 @@ xsymlinks(char *s, int full)
} else {
ret = 1;
metafy(xbuf3, t0, META_NOALLOC);
- if (!full) {
+ {
/*
* If only one expansion requested, ensure the
* full path is in xbuf.
@@ -998,17 +953,6 @@ xsymlinks(char *s, int full)
*/
break;
}
- if (*xbuf3 == '/') {
- strcpy(xbuf, "");
- if (xsymlinks(xbuf3 + 1, 1) < 0)
- ret = -1;
- else
- xbuflen = strlen(xbuf);
- } else
- if (xsymlinks(xbuf3, 1) < 0)
- ret = -1;
- else
- xbuflen = strlen(xbuf);
}
}
freearray(opp);
@@ -1023,17 +967,17 @@ xsymlinks(char *s, int full)
*/
/**/
-char *
+mod_export char *
xsymlink(char *s, int heap)
{
if (*s != '/')
return NULL;
*xbuf = '\0';
- if (xsymlinks(s + 1, 1) < 0)
+ if (!chrealpath(&s, 'P', heap)) {
zwarn("path expansion failed, using root directory");
- if (!*xbuf)
return heap ? dupstring("/") : ztrdup("/");
- return heap ? dupstring(xbuf) : ztrdup(xbuf);
+ }
+ return s;
}
/**/
@@ -1041,12 +985,12 @@ void
print_if_link(char *s, int all)
{
if (*s == '/') {
- *xbuf = '\0';
if (all) {
char *start = s + 1;
char xbuflink[PATH_MAX+1];
+ *xbuf = '\0';
for (;;) {
- if (xsymlinks(start, 0) > 0) {
+ if (xsymlinks(start) > 0) {
printf(" -> ");
zputs(*xbuf ? xbuf : "/", stdout);
if (!*xbuf)
@@ -1059,8 +1003,11 @@ print_if_link(char *s, int all)
}
}
} else {
- if (xsymlinks(s + 1, 1) > 0)
- printf(" -> "), zputs(*xbuf ? xbuf : "/", stdout);
+ if (chrealpath(&s, 'P', 0)) {
+ printf(" -> ");
+ zputs(*s ? s : "/", stdout);
+ zsfree(s);
+ }
}
}
}
@@ -1104,7 +1051,7 @@ substnamedir(char *s)
/* Returns the current username. It caches the username *
* and uid to try to avoid requerying the password files *
- * or NIS/NIS+ database. */
+ * or other source. */
/**/
uid_t cached_uid;
@@ -1115,7 +1062,7 @@ char *cached_username;
char *
get_username(void)
{
-#ifdef HAVE_GETPWUID
+#ifdef USE_GETPWUID
struct passwd *pswd;
uid_t current_uid;
@@ -1128,9 +1075,9 @@ get_username(void)
else
cached_username = ztrdup("");
}
-#else /* !HAVE_GETPWUID */
+#else /* !USE_GETPWUID */
cached_uid = getuid();
-#endif /* !HAVE_GETPWUID */
+#endif /* !USE_GETPWUID */
return cached_username;
}
@@ -1306,7 +1253,7 @@ getnameddir(char *name)
return str;
}
-#ifdef HAVE_GETPWNAM
+#ifdef USE_GETPWNAM
{
/* Retrieve an entry from the password table/database for this user. */
struct passwd *pw;
@@ -1322,7 +1269,7 @@ getnameddir(char *name)
return dupstring(pw->pw_dir);
}
}
-#endif /* HAVE_GETPWNAM */
+#endif /* USE_GETPWNAM */
/* There are no more possible sources of directory names, so give up. */
return NULL;
@@ -1374,6 +1321,9 @@ delprepromptfn(voidvoidfnptr_t func)
{
LinkNode ln;
+ if (!prepromptfns)
+ return;
+
for (ln = firstnode(prepromptfns); ln; ln = nextnode(ln)) {
Prepromptfn ppdat = (Prepromptfn)getdata(ln);
if (ppdat->func == func) {
@@ -1487,14 +1437,9 @@ deltimedfn(voidvoidfnptr_t func)
/**/
time_t lastmailcheck;
-/* the last time we checked the people in the WATCH variable */
-
-/**/
-time_t lastwatch;
-
/*
* Call a function given by "name" with optional arguments
- * "lnklist". If these are present the first argument is the function name.
+ * "lnklst". If these are present the first argument is the function name.
*
* If "arrayp" is not zero, we also look through
* the array "name"_functions and execute functions found there.
@@ -1523,6 +1468,10 @@ callhookfunc(char *name, LinkList lnklst, int arrayp, int *retval)
incompfunc = 0;
if ((shfunc = getshfunc(name))) {
+ if (!lnklst) {
+ lnklst = newlinklist();
+ addlinknode(lnklst, name);
+ }
ret = doshfunc(shfunc, lnklst, 1);
stat = 0;
}
@@ -1535,10 +1484,16 @@ callhookfunc(char *name, LinkList lnklst, int arrayp, int *retval)
memcpy(arrnam + namlen, HOOK_SUFFIX, HOOK_SUFFIX_LEN);
if ((arrptr = getaparam(arrnam))) {
+ char **argarr = lnklst ? hlinklist2array(lnklst, 0) : NULL;
arrptr = arrdup(arrptr);
for (; *arrptr; arrptr++) {
if ((shfunc = getshfunc(*arrptr))) {
- int newret = doshfunc(shfunc, lnklst, 1);
+ int newret, i = 1;
+ LinkList arg0 = newlinklist();
+ addlinknode(arg0, *arrptr);
+ while (argarr && argarr[i])
+ addlinknode(arg0, argarr[i++]);
+ newret = doshfunc(shfunc, arg0, 1);
if (!ret)
ret = newret;
stat = 0;
@@ -1620,17 +1575,6 @@ preprompt(void)
if (errflag)
return;
- /* If WATCH is set, then check for the *
- * specified login/logout events. */
- if (watch) {
- if ((int) difftime(time(NULL), lastwatch) > getiparam("LOGCHECK")) {
- dowatch();
- lastwatch = time(NULL);
- }
- }
- if (errflag)
- return;
-
/* Check mail */
currentmailcheck = time(NULL);
if (mailcheck &&
@@ -2745,6 +2689,42 @@ read_poll(int fd, int *readchar, int polltty, zlong microseconds)
}
/*
+ * Return the difference between 2 times, given as struct timespec*,
+ * expressed in microseconds, as a long. If the difference doesn't fit
+ * into a long, return LONG_MIN or LONG_MAX so that the times can still
+ * be compared.
+ *
+ * Note: returns a long rather than a zlong because zsleep() below
+ * takes a long.
+ */
+
+/**/
+long
+timespec_diff_us(const struct timespec *t1, const struct timespec *t2)
+{
+ int reverse = (t1->tv_sec > t2->tv_sec);
+ time_t diff_sec;
+ long diff_usec, max_margin, res;
+
+ /* Don't just subtract t2-t1 because time_t might be unsigned. */
+ diff_sec = (reverse ? t1->tv_sec - t2->tv_sec : t2->tv_sec - t1->tv_sec);
+ if (diff_sec > LONG_MAX / 1000000L) {
+ goto overflow;
+ }
+ res = diff_sec * 1000000L;
+ max_margin = LONG_MAX - res;
+ diff_usec = (reverse ?
+ t1->tv_nsec - t2->tv_nsec : t2->tv_nsec - t1->tv_nsec
+ ) / 1000;
+ if (diff_usec <= max_margin) {
+ res += diff_usec;
+ return (reverse ? -res : res);
+ }
+ overflow:
+ return (reverse ? LONG_MIN : LONG_MAX);
+}
+
+/*
* Sleep for the given number of microseconds --- must be within
* range of a long at the moment, but this is only used for
* limited internal purposes.
@@ -3088,11 +3068,13 @@ spckword(char **s, int hist, int cmd, int ask)
int preflen = 0;
int autocd = cmd && isset(AUTOCD) && strcmp(*s, ".") && strcmp(*s, "..");
- if ((histdone & HISTFLAG_NOEXEC) || **s == '-' || **s == '%')
+ if (!(*s)[0] || !(*s)[1])
return;
- if (!strcmp(*s, "in"))
+ if ((histdone & HISTFLAG_NOEXEC) ||
+ /* Leading % is a job, else leading hyphen is an option */
+ (cmd ? **s == '%' : (**s == '-' || **s == Dash)))
return;
- if (!(*s)[0] || !(*s)[1])
+ if (!strcmp(*s, "in"))
return;
if (cmd) {
if (shfunctab->getnode(shfunctab, *s) ||
@@ -3111,8 +3093,12 @@ spckword(char **s, int hist, int cmd, int ask)
if (*t == Tilde || *t == Equals || *t == String)
t++;
for (; *t; t++)
- if (itok(*t))
- return;
+ if (itok(*t)) {
+ if (*t == Dash)
+ *t = '-';
+ else
+ return;
+ }
best = NULL;
for (t = *s; *t; t++)
if (*t == '/')
@@ -3556,6 +3542,17 @@ strftimehandling:
return buf - origbuf;
}
+/*
+ * Return a string consisting of the elements of 'arr' joined by the character
+ * 'delim', which will be metafied if necessary. The string will be allocated
+ * on the heap iff 'heap'.
+ *
+ * Comparable to:
+ *
+ * char metafied_delim[] = { Meta, delim ^ 32, '\0' };
+ * sepjoin(arr, metafied_delim, heap)
+ */
+
/**/
mod_export char *
zjoin(char **arr, int delim, int heap)
@@ -3854,10 +3851,12 @@ wordcount(char *s, char *sep, int mul)
/*
* 's' is a NULL-terminated array of strings.
- * 'sep' is a string.
+ * 'sep' is a string, or NULL to split on ${IFS[1]}.
*
* Return a string consisting of the elements of 's' joined by 'sep',
* allocated on the heap iff 'heap'.
+ *
+ * See also zjoin().
*/
/**/
@@ -4268,7 +4267,7 @@ wcsitype(wchar_t c, int itype)
} else {
switch (itype) {
case IIDENT:
- if (!isset(POSIXIDENTIFIERS))
+ if (isset(POSIXIDENTIFIERS))
return 0;
return iswalnum(c);
@@ -5197,26 +5196,11 @@ zputs(char const *s, FILE *stream)
mod_export char *
nicedup(char const *s, int heap)
{
- int c, len = strlen(s) * 5 + 1;
- VARARR(char, buf, len);
- char *p = buf, *n;
+ char *retstr;
- while ((c = *s++)) {
- if (itok(c)) {
- if (c <= Comma)
- c = ztokens[c - Pound];
- else
- continue;
- }
- if (c == Meta)
- c = *s++ ^ 32;
- /* The result here is metafied */
- n = nicechar(c);
- while(*n)
- *p++ = *n++;
- }
- *p = '\0';
- return heap ? dupstring(buf) : ztrdup(buf);
+ (void)sb_niceformat(s, NULL, &retstr, heap ? NICEFLAG_HEAP : 0);
+
+ return retstr;
}
#endif
@@ -5235,20 +5219,7 @@ nicedupstring(char const *s)
mod_export int
nicezputs(char const *s, FILE *stream)
{
- int c;
-
- while ((c = *s++)) {
- if (itok(c)) {
- if (c <= Comma)
- c = ztokens[c - Pound];
- else
- continue;
- }
- if (c == Meta)
- c = *s++ ^ 32;
- if(zputs(nicechar(c), stream) < 0)
- return EOF;
- }
+ sb_niceformat(s, stream, NULL, 0);
return 0;
}
@@ -5737,7 +5708,7 @@ mb_charlenconv(const char *s, int slen, wint_t *wcp)
}
/**/
-#else
+#else /* MULTIBYTE_SUPPORT */
/* Simple replacement for mb_metacharlenconv */
@@ -5777,6 +5748,121 @@ charlenconv(const char *x, int len, int *c)
return 1;
}
+/*
+ * Non-multibyte version of mb_niceformat() above. Same basic interface.
+ */
+
+/**/
+mod_export size_t
+sb_niceformat(const char *s, FILE *stream, char **outstrp, int flags)
+{
+ size_t l = 0, newl;
+ int umlen, outalloc, outleft;
+ char *ums, *ptr, *eptr, *fmt, *outstr, *outptr;
+
+ if (outstrp) {
+ outleft = outalloc = 2 * strlen(s);
+ outptr = outstr = zalloc(outalloc);
+ } else {
+ outleft = outalloc = 0;
+ outptr = outstr = NULL;
+ }
+
+ ums = ztrdup(s);
+ /*
+ * is this necessary at this point? niceztrlen does this
+ * but it's used in lots of places. however, one day this may
+ * be, too.
+ */
+ untokenize(ums);
+ ptr = unmetafy(ums, &umlen);
+ eptr = ptr + umlen;
+
+ while (ptr < eptr) {
+ int c = STOUC(*ptr);
+ if (c == '\'' && (flags & NICEFLAG_QUOTE)) {
+ fmt = "\\'";
+ newl = 2;
+ }
+ else if (c == '\\' && (flags & NICEFLAG_QUOTE)) {
+ fmt = "\\\\";
+ newl = 2;
+ }
+ else {
+ fmt = nicechar_sel(c, flags & NICEFLAG_QUOTE);
+ newl = 1;
+ }
+
+ ++ptr;
+ l += newl;
+
+ if (stream)
+ zputs(fmt, stream);
+ if (outstr) {
+ /* Append to output string */
+ int outlen = strlen(fmt);
+ if (outlen >= outleft) {
+ /* Reallocate to twice the length */
+ int outoffset = outptr - outstr;
+
+ outleft += outalloc;
+ outalloc *= 2;
+ outstr = zrealloc(outstr, outalloc);
+ outptr = outstr + outoffset;
+ }
+ memcpy(outptr, fmt, outlen);
+ /* Update start position */
+ outptr += outlen;
+ /* Update available bytes */
+ outleft -= outlen;
+ }
+ }
+
+ free(ums);
+ if (outstrp) {
+ *outptr = '\0';
+ /* Use more efficient storage for returned string */
+ if (flags & NICEFLAG_NODUP)
+ *outstrp = outstr;
+ else {
+ *outstrp = (flags & NICEFLAG_HEAP) ? dupstring(outstr) :
+ ztrdup(outstr);
+ free(outstr);
+ }
+ }
+
+ return l;
+}
+
+/*
+ * Return 1 if sb_niceformat() would reformat this string, else 0.
+ */
+
+/**/
+mod_export int
+is_sb_niceformat(const char *s)
+{
+ int umlen, ret = 0;
+ char *ums, *ptr, *eptr;
+
+ ums = ztrdup(s);
+ untokenize(ums);
+ ptr = unmetafy(ums, &umlen);
+ eptr = ptr + umlen;
+
+ while (ptr < eptr) {
+ if (is_nicechar(*ptr)) {
+ ret = 1;
+ break;
+ }
+ ++ptr;
+ }
+
+ free(ums);
+
+ return ret;
+}
+
/**/
#endif /* MULTIBYTE_SUPPORT */
@@ -5853,8 +5939,11 @@ zexpandtabs(const char *s, int len, int width, int startpos, FILE *fout,
memset(&mbs, 0, sizeof(mbs));
s++;
len--;
- } else if (ret == MB_INCOMPLETE) {
+ } else if (ret == MB_INCOMPLETE ||
/* incomplete at end --- assume likewise, best we've got */
+ ret == 0) {
+ /* NUL character returns 0, which would loop infinitely, so advance
+ * one byte in this case too */
s++;
len--;
} else {
@@ -6307,6 +6396,22 @@ quotedzputs(char const *s, FILE *stream)
return outstr;
}
}
+#else
+ if (is_sb_niceformat(s)){
+ if (stream) {
+ fputs("$'", stream);
+ sb_niceformat(s, stream, NULL, NICEFLAG_QUOTE);
+ fputc('\'', stream);
+ return NULL;
+ } else {
+ char *substr;
+ sb_niceformat(s, NULL, &substr, NICEFLAG_QUOTE|NICEFLAG_NODUP);
+ outstr = (char *)zhalloc(4 + strlen(substr));
+ sprintf(outstr, "$'%s'", substr);
+ free(substr);
+ return outstr;
+ }
+ }
#endif /* MULTIBYTE_SUPPORT */
if (!hasspecial(s)) {
@@ -6635,13 +6740,21 @@ ucs4toutf8(char *dest, unsigned int wval)
*
* The return value is unmetafied unless GETKEY_DOLLAR_QUOTE is
* in use.
+ *
+ * If GETKEY_SINGLE_CHAR is set in how, a next character in the given
+ * string is parsed, and the character code for it is returned in misc.
+ * The return value of the function is a pointer to the byte in the
+ * given string from where the next parsing should start. If the next
+ * character can't be found then NULL is returned.
+ * CAUTION: Currently, GETKEY_SINGLE_CHAR can be used only via
+ * GETKEYS_MATH. Other use of it may cause trouble.
*/
/**/
mod_export char *
getkeystring(char *s, int *len, int how, int *misc)
{
- char *buf, tmp[1];
+ char *buf = NULL, tmp[1];
char *t, *tdest = NULL, *u = NULL, *sstart = s, *tbuf = NULL;
char svchar = '\0';
int meta = 0, control = 0, ignoring = 0;
@@ -6667,9 +6780,11 @@ getkeystring(char *s, int *len, int how, int *misc)
DPUTS((how & (GETKEY_DOLLAR_QUOTE|GETKEY_SINGLE_CHAR)) ==
(GETKEY_DOLLAR_QUOTE|GETKEY_SINGLE_CHAR),
"BUG: incompatible options in getkeystring");
+ DPUTS((how & GETKEY_SINGLE_CHAR) && (how != GETKEYS_MATH),
+ "BUG: unsupported options in getkeystring");
if (how & GETKEY_SINGLE_CHAR)
- t = buf = tmp;
+ t = tmp;
else {
/* Length including terminating NULL */
int maxlen = 1;
@@ -7103,13 +7218,20 @@ getkeystring(char *s, int *len, int how, int *misc)
*/
DPUTS((how & (GETKEY_DOLLAR_QUOTE|GETKEY_UPDATE_OFFSET)) ==
GETKEY_DOLLAR_QUOTE, "BUG: unterminated $' substitution");
- *t = '\0';
- if (how & GETKEY_DOLLAR_QUOTE)
- *tdest = '\0';
- if (how & GETKEY_SINGLE_CHAR)
+
+ if (how & GETKEY_SINGLE_CHAR) {
+ /* couldn't find a character */
*misc = 0;
- else
- *len = ((how & GETKEY_DOLLAR_QUOTE) ? tdest : t) - buf;
+ return NULL;
+ }
+ if (how & GETKEY_DOLLAR_QUOTE) {
+ *tdest = '\0';
+ *len = tdest - buf;
+ }
+ else {
+ *t = '\0';
+ *len = t - buf;
+ }
return buf;
}
diff --git a/Src/zsh.h b/Src/zsh.h
index 834142895..40f9ea537 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -832,22 +832,59 @@ struct estate {
char *strs; /* strings from prog */
};
+/*
+ * A binary tree of strings.
+ *
+ * Refer to the "Word code." comment at the top of Src/parse.c for details.
+ */
typedef struct eccstr *Eccstr;
-
struct eccstr {
+ /* Child pointers. */
Eccstr left, right;
+
+ /* String; pointer into to estate::strs. */
char *str;
- wordcode offs, aoffs;
+
+ /* Wordcode of a long string, as described in the Src/parse.c comment. */
+ wordcode offs;
+
+ /* Raw memory offset of str in estate::strs. */
+ wordcode aoffs;
+
+ /*
+ * ### The number of starts and ends of function definitions up to this point.
+ *
+ * String reuse may only happen between strings that have the same "nfunc" value.
+ */
int nfunc;
+
+ /* Hash of str. */
int hashval;
};
-#define EC_NODUP 0
-#define EC_DUP 1
-#define EC_DUPTOK 2
+/*
+ * Values for the "dup" parameter to ecgetstr().
+ */
+enum ec_dup_t {
+ /*
+ * Make no promises about how the return value is allocated, except that
+ * the caller does not need to explicitly free it. It might be heap allocated,
+ * a static string, or anything in between.
+ */
+ EC_NODUP = 0,
-#define WC_CODEBITS 5
+ /* Allocate the return value from the heap. */
+ EC_DUP = 1,
+
+ /*
+ * If the string contains tokens (as indicated by the least significant bit
+ * of the wordcode), behave as EC_DUP; otherwise, as EC_NODUP.
+ */
+ EC_DUPTOK = 2
+};
+/* See comment at the top of Src/parse.c for details. */
+#define WC_CODEBITS 5
#define wc_code(C) ((C) & ((wordcode) ((1 << WC_CODEBITS) - 1)))
#define wc_data(C) ((C) >> WC_CODEBITS)
#define wc_bdata(D) ((D) << WC_CODEBITS)
@@ -876,7 +913,11 @@ struct eccstr {
#define WC_AUTOFN 20
#define WC_TRY 21
-/* increment as necessary */
+/*
+ * Increment as necessary.
+ *
+ * If this exceeds 31, increment WC_CODEBITS.
+ */
#define WC_COUNT 22
#define WCB_END() wc_bld(WC_END, 0)
@@ -1156,7 +1197,10 @@ typedef void (*ScanTabFunc) _((HashTable, ScanFunc, int));
typedef void (*PrintTableStats) _((HashTable));
-/* hash table for standard open hashing */
+/* Hash table for standard open hashing. Instances of struct hashtable can be *
+ * created only by newhashtable(). In fact, this function creates an instance *
+ * of struct hashtableimpl, which is made of struct hashtable (public part) *
+ * and additional data members that are only accessible from hashtable.c. */
struct hashtable {
/* HASHTABLE DATA */
@@ -1180,10 +1224,6 @@ struct hashtable {
FreeNodeFunc freenode; /* pointer to function to free a node */
ScanFunc printnode; /* pointer to function to print a node */
ScanTabFunc scantab; /* pointer to function to scan table */
-
-#ifdef HASHTABLE_INTERNAL_MEMBERS
- HASHTABLE_INTERNAL_MEMBERS /* internal use in hashtable.c */
-#endif
};
/* generic hash table node */
@@ -1408,7 +1448,7 @@ struct builtin {
int minargs; /* minimum number of arguments */
int maxargs; /* maximum number of arguments, or -1 for no limit */
int funcid; /* xbins (see above) for overloaded handlerfuncs */
- char *optstr; /* string of legal options */
+ char *optstr; /* string of legal options (see execbuiltin()) */
char *defopts; /* options set by default for overloaded handlerfuncs */
};
@@ -1889,8 +1929,10 @@ struct tieddata {
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_DECLARED (1<<22) /* explicitly named with typeset */
#define PM_RESTRICTED (1<<23) /* cannot be changed in restricted mode */
#define PM_UNSET (1<<24) /* has null value */
+#define PM_DEFAULTED (PM_DECLARED|PM_UNSET)
#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 */
@@ -1951,6 +1993,7 @@ struct tieddata {
#define SUB_START 0x1000 /* force match at start with SUB_END
* and no SUB_SUBSTR */
#define SUB_LIST 0x2000 /* no substitution, return list of matches */
+#define SUB_EGLOB 0x4000 /* use extended globbing in patterns */
/*
* Structure recording multiple matches inside a test string.
@@ -2346,6 +2389,7 @@ enum {
BSDECHO,
CASEGLOB,
CASEMATCH,
+ CASEPATHS,
CBASES,
CDABLEVARS,
CDSILENT,
@@ -2354,6 +2398,7 @@ enum {
CHECKJOBS,
CHECKRUNNINGJOBS,
CLOBBER,
+ CLOBBEREMPTY,
APPENDCREATE,
COMBININGCHARS,
COMPLETEALIASES,
@@ -2484,6 +2529,7 @@ enum {
SHNULLCMD,
SHOPTIONLETTERS,
SHORTLOOPS,
+ SHORTREPEAT,
SHWORDSPLIT,
SINGLECOMMAND,
SINGLELINEZLE,
@@ -2492,6 +2538,7 @@ enum {
TRANSIENTRPROMPT,
TRAPSASYNC,
TYPESETSILENT,
+ TYPESETTOUNSET,
UNSET,
VERBOSE,
VIMODE,
@@ -2683,11 +2730,6 @@ struct ttyinfo {
/* Bits to shift the background colour */
#define TXT_ATTR_BG_COL_SHIFT (40)
-/* Flag to use termcap AF sequence to set colour, if available */
-#define TXT_ATTR_FG_TERMCAP 0x1000
-/* Flag to use termcap AB sequence to set colour, if available */
-#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 */
@@ -2696,16 +2738,15 @@ struct ttyinfo {
/* 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_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|TXT_ATTR_FG_24BIT)
+ (TXTFGCOLOUR|TXT_ATTR_FG_COL_MASK|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|TXT_ATTR_BG_24BIT)
+ (TXTBGCOLOUR|TXT_ATTR_BG_COL_MASK|TXT_ATTR_BG_24BIT)
/* Mask out everything to do with activating colours */
#define TXT_ATTR_COLOUR_ON_MASK \
@@ -2971,17 +3012,18 @@ enum {
SORTIT_ANYOLDHOW = 0, /* Defaults */
SORTIT_IGNORING_CASE = 1,
SORTIT_NUMERICALLY = 2,
- SORTIT_BACKWARDS = 4,
+ SORTIT_NUMERICALLY_SIGNED = 4,
+ SORTIT_BACKWARDS = 8,
/*
* Ignore backslashes that quote another character---which may
* be another backslash; the second backslash is active.
*/
- SORTIT_IGNORING_BACKSLASHES = 8,
+ SORTIT_IGNORING_BACKSLASHES = 16,
/*
* Ignored by strmetasort(); used by paramsubst() to indicate
* there is some sorting to do.
*/
- SORTIT_SOMEHOW = 16,
+ SORTIT_SOMEHOW = 32,
};
/*
@@ -3235,14 +3277,15 @@ enum zexit_t {
#define AFTERTRAPHOOK (zshhooks + 2)
#define GETCOLORATTR (zshhooks + 3)
-#ifdef MULTIBYTE_SUPPORT
-/* Final argument to mb_niceformat() */
+/* Final argument to [ms]b_niceformat() */
enum {
NICEFLAG_HEAP = 1, /* Heap allocation where needed */
NICEFLAG_QUOTE = 2, /* Result will appear in $'...' */
NICEFLAG_NODUP = 4, /* Leave allocated */
};
+#ifdef MULTIBYTE_SUPPORT
+
/* Metafied input */
#define nicezputs(str, outs) (void)mb_niceformat((str), (outs), NULL, 0)
#define MB_METACHARINIT() mb_charinit()
diff --git a/Src/zsh.mdd b/Src/zsh.mdd
index 9bcaccae5..da8d58322 100644
--- a/Src/zsh.mdd
+++ b/Src/zsh.mdd
@@ -13,7 +13,7 @@ objects="builtin.o compat.o cond.o context.o \
exec.o glob.o hashtable.o hashnameddir.o \
hist.o init.o input.o jobs.o lex.o linklist.o loop.o math.o \
mem.o module.o options.o params.o parse.o pattern.o prompt.o signals.o \
-signames.o sort.o string.o subst.o text.o utils.o watch.o \
+signames.o sort.o string.o subst.o text.o utils.o \
openssh_bsd_setres_id.o"
headers="../config.h zsh_system.h zsh.h sigcount.h signals.h \
diff --git a/Src/zsh_system.h b/Src/zsh_system.h
index 161b073b4..6f4efce96 100644
--- a/Src/zsh_system.h
+++ b/Src/zsh_system.h
@@ -235,16 +235,8 @@ char *alloca _((size_t));
# include <errno.h>
#endif
-#ifdef TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif
+#include <sys/time.h>
+#include <time.h>
/* This is needed by some old SCO unices */
#if !defined(HAVE_STRUCT_TIMEZONE) && !defined(ZSH_OOT_MODULE)
@@ -279,16 +271,7 @@ struct timespec {
# include <sys/times.h>
#endif
-#if STDC_HEADERS || HAVE_STRING_H
# include <string.h>
-/* An ANSI string.h and pre-ANSI memory.h might conflict. */
-# if !STDC_HEADERS && HAVE_MEMORY_H
-# include <memory.h>
-# endif /* not STDC_HEADERS and HAVE_MEMORY_H */
-#else /* not STDC_HEADERS and not HAVE_STRING_H */
-# include <strings.h>
-/* memory.h and strings.h conflict on some systems. */
-#endif /* not STDC_HEADERS and not HAVE_STRING_H */
#ifdef HAVE_LOCALE_H
# include <locale.h>
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 1e0e9a04e..0312fe94e 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -557,6 +557,13 @@
>Hip hip hooray
>Hip hip hooray
+ repeat 2*2 print yeah
+0:Tokens in repeat argument
+>yeah
+>yeah
+>yeah
+>yeah
+
case bravo {
(alpha) print schmalpha
;;
@@ -915,7 +922,7 @@ F:Note that the behaviour of 'exit' inside try-list inside a function is unspeci
x=1
x=2 | echo $x
echo $x
-0:Assignment-only current shell commands in LHS of pipelin
+0:Assignment-only current shell commands in LHS of pipeline
>1
>1
@@ -930,5 +937,36 @@ F:Note that the behaviour of 'exit' inside try-list inside a function is unspeci
>or false
$ZTST_testdir/../Src/zsh -fc '{ ( ) } always { echo foo }'
--f:exec last command optimization inhibited for try/always
+0:exec last command optimization inhibited for try/always
+>foo
+
+ a='${'
+ if : ${(e)a}; then echo x; fi
+1:Status on bad substitution in if without else
+?(eval):2: bad substitution
+
+ echo 'echo foo # comment
+ echo $(
+ echo bar # comment
+ )' >source_comments.zsh
+ $ZTST_testdir/../Src/zsh -f -o extendedglob -is -c '. ./source_comments.zsh'
+0:Comments should be handled in command subst in interactively sourced files
>foo
+>bar
+
+ function 'ls,/' () {echo success}
+ {ls,/}
+0:workers/47599: current-shell blocks masquerading as brace expansion
+>success
+F:This test was written to ensure the behaviour doesn't change silently.
+F:If this test fails during development, it *might* be appropriate to change
+F:its expectations.
+
+ (
+ export VALUE=first
+ print -l 'echo Value is $VALUE' 'VALUE=second sh' 'echo Value is $VALUE' |
+ $ZTST_testdir/../Src/zsh -f
+ )
+0:Non-interactive shell command input is line buffered
+>Value is first
+>Value is second
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
index d60519064..17f6dfa29 100644
--- a/Test/A04redirect.ztst
+++ b/Test/A04redirect.ztst
@@ -440,7 +440,7 @@
# This tests the here-string to filename optimisation; we can't
# test that it's actually being optimised, but we can test that it
# still works.
- cat =(<<<$'This string has been replaced\nby a file containing it.\n')
+ cat =(<<<$'This string has been replaced\nby a file containing it.')
0:Optimised here-string to filename
>This string has been replaced
>by a file containing it.
@@ -708,3 +708,17 @@
cat <&$testfd
0:Regression test for here document with fd declarator
> This is, in some sense, a here document.
+
+ (setopt noclobber clobberempty
+ rm -f foo
+ touch foo
+ print Works >foo
+ cat foo
+ print Works not >foo
+ # Make sure the file was not harmed
+ cat foo
+ )
+0:CLOBBER_EMPTY
+>Works
+>Works
+?(eval):6: file exists: foo
diff --git a/Test/A05execution.ztst b/Test/A05execution.ztst
index edc561582..d95ee363c 100644
--- a/Test/A05execution.ztst
+++ b/Test/A05execution.ztst
@@ -258,7 +258,7 @@ F:side of a pipe to block on write after the right side has exited
print -u $ZTST_fd "Skipping pipe leak test, requires MONITOR option"
print "[0] 0 0"
fi
-0:Bug regression: piping to anonymous function; piping to backround function
+0:Bug regression: piping to anonymous function; piping to background function
*>\[<->\] <-> <->
F:This test checks for two different bugs, a parser segfault piping to an
F:anonymous function, and a descriptor leak when backgrounding a pipeline
@@ -326,6 +326,7 @@ F:anonymous function, and a descriptor leak when backgrounding a pipeline
callfromchld() { true && { print CHLD } }
TRAPCHLD() { callfromchld }
sleep 2 & sleep 3; print OK
+ unfunction TRAPCHLD # don't affect future tests
0:Background job exit does not affect reaping foreground job
>CHLD
>OK
@@ -394,3 +395,23 @@ F:anonymous function, and a descriptor leak when backgrounding a pipeline
>127
# TBD: the 0 above is believed to be bogus and should also be turned
# into 127 when the ccorresponding bug is fixed in the main shell.
+
+# Without the outer subshell, the test harness reports the pre-46060 behaviour
+# as "skipped" rather than "failed".
+ (( exit 130 ) | { sleep 1; echo hello })
+0:exit code 130 isn't mistaken for a signal (unit test for workers/46060)
+>hello
+
+ (exit 3); repeat "$?" echo x
+ (exit 3); repeat '?' echo y
+0:'repeat' loop can use lastval in the count
+>x
+>x
+>x
+>y
+>y
+>y
+
+ (exit 4); repeat 0 do done
+0:'repeat 0' resets lastval
+
diff --git a/Test/B01cd.ztst b/Test/B01cd.ztst
index d903b7462..bc6757549 100644
--- a/Test/B01cd.ztst
+++ b/Test/B01cd.ztst
@@ -33,7 +33,7 @@
#
# Tests should use subdirectories ending in `.tmp'. These will be
# removed with all the contents even if the test is aborted.
- mkdir cdtst.tmp cdtst.tmp/real cdtst.tmp/sub
+ mkdir cdtst.tmp cdtst.tmp/foo cdtst.tmp/real cdtst.tmp/sub
ln -s ../real cdtst.tmp/sub/fake
@@ -70,7 +70,7 @@
# the expected status returned by the code when run, or - if it is
# irrelevant. An optional set of single-letter flags follows the status
# or -. The following are understood:
-# . d Don't diff stdout against the expected stdout.
+# d Don't diff stdout against the expected stdout.
# D Don't diff stderr against the expected stderr.
# q All redirection lines given in the test script (not the lines
# actually produced by the test) are subject to ordinary quoted shell
@@ -96,8 +96,8 @@
# itself. (The example below isn't particularly useful as errors with
# `cd' are unusual.)
#
-# A couple of features aren't used in this file, but are usefuil in cases
-# where features may not be available so should not be tested. They boh
+# A couple of features aren't used in this file, but are useful in cases
+# where features may not be available so should not be tested. They both
# take the form of variables. Note that to keep the test framework simple
# there is no magic in setting the variables: the chunk of code being
# executed needs to avoid executing any test code by appropriate structure
@@ -149,6 +149,23 @@ F:something is broken. But you already knew that.
-f:(workers/45367) cd -P squashes multiple leading slashes
>/dev
+ chpwd_hook() { hook_pwd=$PWD; }
+ chpwd_functions=(chpwd_hook)
+ cd $mydir/cdtst.tmp/foo &&
+ (cd $mydir && mv $mydir/cdtst.tmp/{foo,bar}) &&
+ print $PWD &&
+ print $hook_pwd &&
+ cd . &&
+ print $PWD &&
+ print $hook_pwd
+ chpwd_functions=()
+ unfunction chpwd_hook
+0q:cd . with moved PWD
+>$mydir/cdtst.tmp/foo
+>$mydir/cdtst.tmp/foo
+>$mydir/cdtst.tmp/bar
+>$mydir/cdtst.tmp/bar
+
%clean
# This optional section cleans up after the test, if necessary,
# e.g. killing processes etc. This is in addition to the removal of *.tmp
diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst
index e7bf93794..8b3988151 100644
--- a/Test/B02typeset.ztst
+++ b/Test/B02typeset.ztst
@@ -620,7 +620,7 @@
print ${+pbro} >&2
(typeset -g pbro=3)
(pbro=4)
- readonly -p pbro >&2 # shows up as "readonly" although unset
+ readonly -p >&2 # shows up as "readonly" although unset
typeset -gr pbro # idempotent (no error)...
print ${+pbro} >&2 # ...so still readonly...
typeset -g +r pbro # ...can't turn it off
@@ -1050,23 +1050,21 @@
$ZTST_testdir/../Src/zsh --emulate sh -f -c '
PATH=/bin; export PATH; readonly PATH
- export -p PATH
+ export -p PATH # Should be a no-op, -p ignored
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
+ export -p MANPATH # Should be a no-op, -p ignored
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
diff --git a/Test/B03print.ztst b/Test/B03print.ztst
index 0ef3743ce..4d2cf9764 100644
--- a/Test/B03print.ztst
+++ b/Test/B03print.ztst
@@ -4,6 +4,7 @@
# Use of print -p to output to coprocess A01grammar
# Prompt expansion with print -P D01prompt
# -l, -r, -R and -n indirectly tested in various places
+# multibyte tests in D07multibyte
# Not yet tested:
# echo and pushln
@@ -303,15 +304,16 @@
foo=$'one\ttwo\tthree\tfour\n'
foo+=$'\tone\ttwo\tthree\tfour\n'
foo+=$'\t\tone\t\ttwo\t\tthree\t\tfour'
- print -x4 $foo
- print -X4 $foo
+ foo+='\0' # regression test for multibyte tab expand
+ print -x4 $foo | tr '\0' Z # avoid raw nul byte in expected output below
+ print -X4 $foo | tr '\0' Z
0:Tab expansion by print
>one two three four
> one two three four
-> one two three four
+> one two three fourZ
>one two three four
> one two three four
-> one two three four
+> one two three fourZ
unset foo
print -v foo once more
diff --git a/Test/B07emulate.ztst b/Test/B07emulate.ztst
index 7b1592fa9..45c39b51d 100644
--- a/Test/B07emulate.ztst
+++ b/Test/B07emulate.ztst
@@ -276,3 +276,25 @@ F:Some reserved tokens are handled in alias expansion
0:--emulate followed by other options
>yes
>no
+
+ emulate sh -c '
+ foo () {
+ VAR=foo &&
+ echo $VAR | bar &&
+ echo "$VAR"
+ }
+ bar () {
+ tr f b &&
+ VAR="$(echo bar | tr r z)" &&
+ echo "$VAR"
+ }
+ foo
+ '
+ emulate sh -c 'func() { echo | local def="abc"; echo $def;}; func'
+ emulate sh -c 'abc="def"; echo | abc="ghi"; echo $abc'
+0:emulate sh uses subshell for last pipe entry
+>boo
+>baz
+>foo
+>
+>def
diff --git a/Test/B10getopts.ztst b/Test/B10getopts.ztst
index 72c9e209e..e50d177c7 100644
--- a/Test/B10getopts.ztst
+++ b/Test/B10getopts.ztst
@@ -96,3 +96,32 @@
done
0:missing option-argument (quiet mode)
>:,x
+
+ # This function is written so it can be easily referenced against other shells
+ t() {
+ local o i=0 n=$1
+ shift
+ while [ $i -lt $n ]; do
+ i=$(( i + 1 ))
+ getopts a: o "$@" 2> /dev/null
+ done
+ printf '<%d>' "$OPTIND"
+ }
+ # Try all these the native way, then the POSIX_BUILTINS way
+ for 1 in no_posix_builtins posix_builtins; do (
+ setopt $1
+ print -rn - "$1: "
+ t 1
+ t 1 foo
+ t 1 -- foo
+ t 1 -a
+ t 1 -b
+ t 2 -a -b
+ t 4 -a -b -c -d -a
+ t 5 -a -b -c -a -b -c
+ t 5 -a -b -c -d -ax -a
+ print
+ ); done
+0:OPTIND calculation with and without POSIX_BUILTINS (workers/42248)
+>no_posix_builtins: <1><1><2><1><1><3><5><7><6>
+>posix_builtins: <1><1><2><2><2><3><6><7><7>
diff --git a/Test/B11kill.ztst b/Test/B11kill.ztst
new file mode 100644
index 000000000..dc6bf9b89
--- /dev/null
+++ b/Test/B11kill.ztst
@@ -0,0 +1,86 @@
+# Tests for the kill builtin.
+#
+# The exit codes 11 and 19 in this file don't mean anything special; they're
+# just exit codes which are specific enough that the failure of `kill` itself
+# can be differentiated from exiting due to executing a trap.
+
+%test
+
+# Correct invocation
+
+ if zmodload zsh/system &>/dev/null; then
+ (
+ trap 'exit 19' TERM
+ kill $sysparams[pid]
+ )
+ else
+ ZTST_skip='Cannot zmodload zsh/system, skipping kill with no sigspec'
+ fi
+19:kill with no sigspec
+
+
+ if zmodload zsh/system &>/dev/null; then
+ (
+ trap 'exit 11' USR1
+ kill -USR1 $sysparams[pid]
+ )
+ else
+ ZTST_skip='Cannot zmodload zsh/system, skipping kill with sigspec'
+ fi
+11:kill with sigspec
+
+# Incorrect invocation
+
+ (
+ kill a b c
+ )
+3:kill with multiple wrong inputs should increment status
+?(eval):kill:2: illegal pid: a
+?(eval):kill:2: illegal pid: b
+?(eval):kill:2: illegal pid: c
+
+ (
+ kill -INT a b c
+ )
+3:kill with sigspec and wrong inputs should increment status
+?(eval):kill:2: illegal pid: a
+?(eval):kill:2: illegal pid: b
+?(eval):kill:2: illegal pid: c
+
+ (
+ kill
+ )
+1:kill with no arguments
+?(eval):kill:2: not enough arguments
+
+ (
+ kill -INT
+ )
+1:kill with sigspec only
+?(eval):kill:2: not enough arguments
+
+# Regression tests: `kill ''` should not result in `kill 0`.
+#
+# We use SIGURG where an explicit sigspec can be provided as:
+#
+# 1. By default it's non-terminal, so even if we regress, we won't kill the
+# test runner and other processes in the process group since we'll stop
+# running this test before we get to the plain kill (and thus SIGTERM)
+# cases;
+# 2. It's also unlikely to be sent for any other reason during the process
+# lifetime, so the test shouldn't be flaky.
+
+ (
+ trap 'exit 11' URG
+ kill -URG ''
+ )
+1:kill with empty pid and sigspec should not send signal to current process group
+?(eval):kill:3: illegal pid:
+
+ (
+ trap 'exit 19' TERM
+ kill ''
+ )
+1:Plain kill with empty pid should not send signal to current process group
+?(eval):kill:3: illegal pid:
+
diff --git a/Test/B12limit.ztst b/Test/B12limit.ztst
new file mode 100644
index 000000000..9dce59824
--- /dev/null
+++ b/Test/B12limit.ztst
@@ -0,0 +1,28 @@
+
+%prep
+
+ if ! zmodload zsh/rlimits 2>/dev/null
+ then
+ ZTST_unimplemented="the zsh/rlimits module was disabled by configure (see config.modules)"
+ return 0
+ fi
+ zmodload zsh/rlimits
+
+%test
+
+ limit | grep UNKNOWN || print OK
+0:Check if there is unknown resource(s) in the system
+>OK
+F:A failure here does not indicate any error in zsh. It just means there
+F:is a resource in your system that is unknown to zsh developers. Please
+F:report this to zsh-workers mailing list.
+
+ () {
+ set -- ${(f)"$(ulimit -a)"}
+ set -- ${@%%:*}
+ typeset -aU unique_options=( "$@" )
+ # The value of $unique_options is, e.g., ( -t -f '-N 2' -s ... ).
+ (( $# == $#unique_options ))
+ }
+0:check if limit option letters are unique
+
diff --git a/Test/B13whence.ztst b/Test/B13whence.ztst
new file mode 100644
index 000000000..3b35835fe
--- /dev/null
+++ b/Test/B13whence.ztst
@@ -0,0 +1,34 @@
+%prep
+
+ mkdir whence.tmp
+ ln -s . whence.tmp/cwd
+ # cd through the symlink in order to test the case that ${prefix} and
+ # ${prefix:P} are different
+ pushd whence.tmp/cwd
+ ln -s real step3
+ ln -s step3 step2
+ ln -s step2 step1
+ ln -s loop loop
+ ln -s flip flop
+ ln -s flop flip
+ touch real
+ chmod +x real
+ prefix=$PWD
+ popd
+
+%test
+
+ (
+ path=( ${PWD:P}/whence.tmp $path )
+ whence -S step1
+ whence -s step1
+ )
+0q:whence symlink resolution
+>${prefix:P}/step1 -> ${prefix:P}/step2 -> ${prefix:P}/step3 -> ${prefix:P}/real
+>${prefix:P}/step1 -> ${prefix:P}/real
+
+ (
+ path=( $PWD/whence.tmp $path )
+ whence -S flip || whence -S loop || whence -s flip || whence -s loop
+ )
+1:whence deals with symlink loops gracefully
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
index 419f45292..d0092fefa 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -180,9 +180,10 @@
1:bases beyond 36 don't work
?(eval):1: invalid base (must be 2 to 36 inclusive): 37
+ fail=39
print $(( 3 + "fail" ))
-1:parse failure in arithmetic
-?(eval):1: bad math expression: operand expected at `"fail" '
+0:Double quotes are not treated specially in arithmetic
+>42
alias 3=echo
print $(( 3 + "OK"); echo "Worked")
@@ -487,3 +488,8 @@
let noexist==0 )
1:Arithmetic, NO_UNSET part 3
?(eval):2: noexist: parameter not set
+
+ print $(( "6+2" / "1+3" ))
+0:Double quotes are not treated specially in arithmetic (POSIX)
+# and do not do grouping! this is 6 + (2/1) + 3
+>11
diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
index 4b1ec02f0..4366b4142 100644
--- a/Test/C02cond.ztst
+++ b/Test/C02cond.ztst
@@ -146,39 +146,27 @@
# can't be bothered with -S
- if [[ ${mtab::="$({mount || /sbin/mount || /usr/sbin/mount} 2>/dev/null)"} = *[(]?*[)] ]]; then
- print -u $ZTST_fd 'This test takes two seconds...'
- else
- unmodified_ls="$(ls -lu $unmodified)"
- print -u $ZTST_fd 'This test takes up to 60 seconds...'
- fi
- sleep 2
+ print -ru $ZTST_fd 'This test may take two seconds...'
touch $newnewnew
if [[ $OSTYPE == "cygwin" ]]; then
ZTST_skip="[[ -N file ]] not supported on Cygwin"
elif (( isnfs )); then
ZTST_skip="[[ -N file ]] not supported with NFS"
- elif { (( ! $+unmodified_ls )) &&
- cat $unmodified &&
- { df -k -- ${$(print -r -- "$mtab" |
- awk '/noatime/ {print $1,$3}'):-""} | tr -s ' ' |
- fgrep -- "$(df -k . | tail -1 | tr -s ' ')" } >&/dev/null } ||
- { (( $+unmodified_ls )) && SECONDS=0 &&
- ! until (( SECONDS >= 58 )); do
- ZTST_hashmark; sleep 2; cat $unmodified
- [[ $unmodified_ls != "$(ls -lu $unmodified)" ]] && break
- done }; then
- ZTST_skip="[[ -N file ]] not supported with noatime file system"
+ elif ! zmodload -F zsh/stat b:zstat 2> /dev/null; then
+ ZTST_skip='[[ -N file ]] not tested; zsh/stat not available'
+ elif ! { sleep 2; touch -a $unmodified 2> /dev/null }; then
+ ZTST_skip='[[ -N file ]] not tested; touch failed'
+ elif [[ "$(zstat +atime $unmodified)" == "$(zstat +mtime $unmodified)" ]]; then
+ ZTST_skip='[[ -N file ]] not supported on this file system'
else
[[ -N $newnewnew && ! -N $unmodified ]]
fi
0:-N cond
-F:This test can fail on NFS-mounted filesystems as the access and
-F:modification times are not updated separately. The test will fail
-F:on HFS+ (Apple Mac OS X default) filesystems because access times
-F:are not recorded. Also, Linux ext3 filesystems may be mounted
-F:with the noatime option which does not update access times.
-F:Failures in these cases do not indicate a problem in the shell.
+F:This test relies on the file system supporting atime updates. It
+F:should automatically detect whether this is the case, and skip
+F:without failing if it isn't, but it's possible that some
+F:configurations may elude this detection. Please report this
+F:scenario if you encounter it.
[[ $newnewnew -nt $zlnfs && ! ($unmodified -nt $zlnfs) ]]
0:-nt cond
@@ -392,7 +380,7 @@ F:Failures in these cases do not indicate a problem in the shell.
>0
>0
>1
->0
+>1
>0
>0
>1
diff --git a/Test/C04funcdef.ztst b/Test/C04funcdef.ztst
index 407fc471f..af469c527 100644
--- a/Test/C04funcdef.ztst
+++ b/Test/C04funcdef.ztst
@@ -307,7 +307,7 @@
# lsfoo should not be expanded as an anonymous function argument
alias lsfoo='This is not ls.'
() (echo anon func; echo "$@") lsfoo
-0:Anonmous function with arguments in a form nobody sane would ever use but unfortunately we have to support anyway
+0:Anonymous function with arguments in a form nobody sane would ever use but unfortunately we have to support anyway
>anon func
>lsfoo
@@ -508,7 +508,8 @@
# keep spec from getting loaded in parent shell for simplicity
(
- if whence spec; then print spec already loaded >&2; exit 1; fi
+ if [[ $(whence -v spec) = 'spec is a shell function from '$PWD/* ]]
+ then print spec already loaded >&2; exit 1; fi
autoload -Uz $PWD/spec
autoload -Uz $PWD/extra/spec
spec
@@ -517,7 +518,8 @@
>I have been loaded by explicit path.
(
- if whence spec; then print spec already loaded >&2; exit 1; fi
+ if [[ $(whence -v spec) = 'spec is a shell function from '$PWD/* ]]
+ then print spec already loaded >&2; exit 1; fi
autoload -Uz $PWD/extra/spec
autoload spec
spec
diff --git a/Test/D01prompt.ztst b/Test/D01prompt.ztst
index 7ff478e68..6879e6fd1 100644
--- a/Test/D01prompt.ztst
+++ b/Test/D01prompt.ztst
@@ -229,3 +229,37 @@
Ffoo=${(%):-'%F{foo}'} # Unrecognised
[[ $f == $Fdefault && $Fdefault == $Freset && $Freset == $Ffoo ]]
0:Regression test for workers/44029
+
+ if
+ zmodload zsh/terminfo >& /dev/null &&
+ (( terminfo[colors] >= 8 ))
+ then
+ F1=$(echoti setaf 2)
+ F2=${(%):-%2F}
+ F3=${(%):-%F{2}}
+ F4=${(%):-%F{green}}
+ [[ -n $F1 && $F1 = $F2 && $F2 = $F3 && $F3 = $F4 ]]
+ else
+ ZTST_skip='Missing terminfo module or non-colour terminal'
+ fi
+0:Equivalence of terminal colour settings (foreground colour)
+
+ if
+ zmodload zsh/terminfo >& /dev/null &&
+ (( terminfo[colors] >= 8 ))
+ then
+ K1=$(echoti setab 2)
+ K2=${(%):-%2K}
+ K3=${(%):-%K{2}}
+ K4=${(%):-%K{green}}
+ [[ -n $K1 && $K1 = $K2 && $K2 = $K3 && $K3 = $K4 ]]
+ else
+ ZTST_skip='Missing terminfo module or non-colour terminal'
+ fi
+0:Equivalence of terminal colour settings (background colour)
+
+ (RPS1=foo; echo $RPS1 $RPROMPT)
+ (RPS2=bar; echo $RPS2 $RPROMPT2)
+-fD:RPS1 and RPROMPT are aliases (regression from 5.0.6) (workers/49600)
+>foo foo
+>bar bar
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index b0650c8c8..72891a2a7 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -690,10 +690,9 @@
# This is a bit brittle as it depends on PATH_MAX.
# We could use sysconf..
bad_pwd="/${(l:16000:: :):-}"
- print ${bad_pwd:P}
+ print ${#${bad_pwd:P}}
0:modifier ':P' with path too long
-?(eval):4: path expansion failed, using root directory
->/
+>16001
foo=a
value="ac"
@@ -734,7 +733,7 @@
mkdir -m 444 glob.tmp/secret-d444
for 1 in 000 111 444 ; do ln -s secret-d$1 glob.tmp/secret-s$1; done
print -rC 2 -- glob.tmp/secret-*/ glob.tmp/secret-*(-/)
--f:unreadable directories can be globbed (users/24619, users/24626)
+0:unreadable directories can be globbed (users/24619, users/24626)
>glob.tmp/secret-d000/ glob.tmp/secret-d000
>glob.tmp/secret-d111/ glob.tmp/secret-d111
>glob.tmp/secret-d444/ glob.tmp/secret-d444
@@ -742,10 +741,79 @@
>glob.tmp/secret-s111/ glob.tmp/secret-s111
>glob.tmp/secret-s444/ glob.tmp/secret-s444
+ for 1 in 000 111 444 ; do
+ chmod 777 glob.tmp/secret-d$1
+ touch glob.tmp/secret-d$1/file
+ mkdir -m 777 glob.tmp/secret-d$1/dir
+ touch glob.tmp/secret-d$1/dir/file
+ chmod $1 glob.tmp/secret-d$1
+ done
+ print -raC 2 -- glob.tmp/secret-*/* glob.tmp/secret-*/file
+0:names inside unreadable directories can be globbed if searchable
+>glob.tmp/secret-d444/dir glob.tmp/secret-d444/file
+>glob.tmp/secret-s444/dir glob.tmp/secret-s444/file
+>glob.tmp/secret-d111/file glob.tmp/secret-s111/file
+
+ print -rC 2 -- glob.tmp/secret-*/dir/*
+0:glob files in readable directories inside unreadable directories
+>glob.tmp/secret-d111/dir/file glob.tmp/secret-s111/dir/file
+
+ # On macOS, stat(2) allows files to be treated as directories if the calling
+ # process has super-user privileges. e.g., stat() on /my/regular/file/. will
+ # succeed as root but (correctly) fail otherwise. This can produce strange
+ # results when globbing, depending on how it's implemented. This test should,
+ # when run with privileges, confirm that the implementation avoids this
+ # problem. See workers/42891 and workers/45291
+ : > glob.tmp/not-a-directory
+ print -r - glob.tmp/not-a-dir*(N) , glob.tmp/not-a-dir*/(N)
+0:non-directories not globbed as directories
+>glob.tmp/not-a-directory ,
+
() { echo $1:P } ////dev
-f:(workers/45367) modifier ':P' squashes multiple slashes
>/dev
+ ln -s loop glob.tmp/loop
+ ln -s loop glob.tmp/trap
+ {
+ (set -- glob.tmp/trap; echo $1:P)
+ (set -- glob.tmp/loop; echo $1:P)
+ } always {
+ rm -f glob.tmp/trap glob.tmp/loop
+ }
+0:the ':P' modifier handles symlink loops in the last path component
+*>*/(trap|loop)
+*>*/(trap|loop)
+
+ ln -s loop glob.tmp/loop
+ ln -s loop glob.tmp/trap
+ {
+ (set -- glob.tmp/loop/trailing/components; echo $1:P)
+ (set -- glob.tmp/trap/trailing/components; echo $1:P)
+ } always {
+ rm -f glob.tmp/trap glob.tmp/loop
+ }
+0:the ':P' modifier handles symlink loops before the last path component
+*>*/glob.tmp/loop/trailing/components
+*>*/glob.tmp/(loop|trap)/trailing/components
+
+ ln -s flip glob.tmp/flop
+ ln -s flop glob.tmp/flip
+ {
+ (set -- glob.tmp/flip; echo $1:P)
+ (set -- glob.tmp/flip/trailing/components; echo $1:P)
+ } always {
+ rm -f glob.tmp/flip glob.tmp/flop
+ }
+0:the ':P' modifier handles symlink loops other than the trivial case
+*>*/glob.tmp/(flip|flop)
+*>*/glob.tmp/(flip|flop)/trailing/components
+
+ unsetopt extendedglob
+ print -r -- ${(*)=${(@s.+.):-A+B}/(#b)(?)/-${(L)match[1]} ${match[1]}}
+0:the '*' qualfier enables extended_glob for pattern matching
+>-a A -b B
+
%clean
# Fix unreadable-directory permissions so ztst can clean up properly
diff --git a/Test/D03procsubst.ztst b/Test/D03procsubst.ztst
index 8cf4e2a7f..1e5cd9f6c 100644
--- a/Test/D03procsubst.ztst
+++ b/Test/D03procsubst.ztst
@@ -156,3 +156,16 @@
procfunc <(echo argument)
0:With /proc/self file descriptors must not be tidied up too early
>argument
+
+ $ZTST_testdir/../Src/zsh -df -o shfileexpansion -c 'cat =(echo hi)'
+0:EQUALS expansion followed by =(...) (sh ordering) should work
+>hi
+
+ () {
+ local TMPPREFIX=$PWD/tmp
+ command true =(true) =(true) | :
+ print -rC1 -- $TMPPREFIX*(N)
+ }
+0f:external command with =(...) on LHS of pipeline cleans up its tempfiles
+# (Expected result: no output.)
+
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 76f3e77a1..6bf55b4db 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1398,6 +1398,13 @@
>a6 a17 a117 b6 b17 b117
>b117 b17 b6 a117 a17 a6
+ foo=(a-6 a117 a-17 a-34 b6 b-117 b17 b-2)
+ print ${(-)foo}
+ print ${(O-)foo}
+0:Numeric sorting of signed integers
+>a-34 a-17 a-6 a117 b-117 b-2 b6 b17
+>b17 b6 b-2 b-117 a117 a-6 a-17 a-34
+
x=sprodj
x[-10]=scrumf
print $x
@@ -1615,6 +1622,8 @@
print ${foo: -1}
print ${foo: -10}
print ${foo:5:-2}
+ print ${foo::3}
+ print ${foo: }
0:Bash-style offsets, scalar
>456789
>56789
@@ -1627,6 +1636,8 @@
>9
>123456789
>67
+>123
+>123456789
foo=(1 2 3 4 5 6 7 8 9)
print ${foo:3}
@@ -1682,14 +1693,48 @@
>b
>c
+ () {
+ emulate -L sh
+ local a=( one two three )
+ printf '<%s><%s>\n' ${a[*]:0:2}
+ printf '<%s><%s>\n' "${a[*]:0:2}"
+ printf '<%s><%s>\n' ${a[@]:0:2}
+ printf '<%s><%s>\n' "${a[@]:0:2}"
+ printf '<%s><%s>\n' "${a:0:2}"
+ printf '<%s><%s>\n' ${*:1:2}
+ printf '<%s><%s>\n' "${*:1:2}"
+ printf '<%s><%s>\n' ${@:1:2}
+ printf '<%s><%s>\n' "${@:1:2}"
+ printf '<%s><%s>\n' ${*:0:2}
+ printf '<%s><%s>\n' "${*:0:2}"
+ printf '<%s><%s>\n' ${@:0:2}
+ printf '<%s><%s>\n' "${@:0:2}"
+ } one two three
+0:Bash-style offsets, quoted array
+><one><two>
+><one two><>
+><one><two>
+><one><two>
+><on><>
+><one><two>
+><one two><>
+><one><two>
+><one><two>
+><(anon)><one>
+><(anon) one><>
+><(anon)><one>
+><(anon)><one>
+
printf "%n" '[0]'
1:Regression test for identifier test
?(eval):1: not an identifier: [0]
str=rts
+ print ${str:0: }
print ${str:0:}
1:Regression test for missing length after offset
-?(eval):2: unrecognized modifier
+>
+?(eval):3: unrecognized modifier
foo="123456789"
print ${foo:5:-6}
@@ -2650,3 +2695,35 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
>1: pws
>3: pw
>4: pw
+
+ : "${foo:0:${\"}}"
+1:broken length in ${name:offset:length} (workers/45843#1)
+?(eval):1: unrecognized modifier `$'
+
+ $ZTST_testdir/../Src/zsh -fc $'$\\\n('
+1:regression test for workers/45843#2: escaped newline in command substitution start token
+?zsh:2: parse error near `$('
+
+# `
+
+ eval $'echo $\\\n(printf "%d\\n" $(( 4 + 2 )) )'
+0:Normal command substitution with escaped newline
+>6
+
+ eval $'echo $\\\n(( 14 / 2 ))'
+0:Normal math eval with escaped newline after $
+>7
+
+ eval $'echo $(\\\n( 15 / 3 ))'
+0:Normal math eval with escaped newline after $(
+>5
+
+ function '*' { echo What a star; }
+ eval 'echo $(\*)'
+0:Backslash character other than newline is normal after $(
+>What a star
+
+ : ${(zZ+x+):-}
+1:parameter expansion flags parsing error gives a clue
+?(eval):1: error in flags near position 7 in '${(zZ+x+):-}'
+
diff --git a/Test/D06subscript.ztst b/Test/D06subscript.ztst
index c1a8d79cf..adbd398c4 100644
--- a/Test/D06subscript.ztst
+++ b/Test/D06subscript.ztst
@@ -289,3 +289,8 @@ F:Regression test for workers/42297
>14 24
>b b
>b?rbaz foob?r
+
+ i=1,3
+ [[ ${a[$i]} = ${a[i]} ]]
+0f:Math evaluation of commas in array subscripts
+F:In math, (($i)) should be the same as ((i)), see workers/47748.
diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst
index e20315340..cbd802f23 100644
--- a/Test/D07multibyte.ztst
+++ b/Test/D07multibyte.ztst
@@ -178,6 +178,13 @@
>3
?(eval):1: command not found: hähä=3
+ expr='[[ é = [[:IDENT:]] ]]'
+ ( unsetopt posix_identifiers; eval $expr && echo ok unset )
+ ( setopt posix_identifiers; eval $expr || echo ok set )
+0:Regression test for workers/47745
+>ok unset
+>ok set
+
foo="Ølaf«Ødd«øpénëd«ån«àpple"
print -l ${(s.«.)foo}
ioh="Ἐν ἀρχῇ ἦν ὁ λόγος, καὶ ὁ λόγος ἦν πρὸς τὸν θεόν, καὶ θεὸς ἦν ὁ λόγος."
@@ -340,6 +347,18 @@
0:Multibyte characters in printf widths
> főo
+# TODO?: POSIX requires that printf should always compute width and
+# precision of '%s' conversion in bytes, while zsh computes them in
+# characters if multi-byte locale is in use.
+ ARGV0=sh $ZTST_testdir/../Src/zsh -c "printf '<%10s>\n' St$'\M-C\M-)'phane"
+0f:POSIX: width in %s should be computed in bytes, not in characters
+F:This is considered a bugfix in zsh
+>< Stéphane>
+
+ ARGV0=sh $ZTST_testdir/../Src/zsh -c "printf '<%7.5s>\n' St$'\M-C\M-)'phane"
+0f:POSIX: precision should also be computed in bytes, not in characers
+>< Stép>
+
# We ask for case-insensitive sorting here (and supply upper case
# characters) so that we exercise the logic in the shell that lowers the
# case of the string for case-insensitive sorting.
@@ -570,6 +589,15 @@
0:printf %q and quotestring and general metafy / token madness
>你你
+ typeset foo
+ print -v foo 'ÖÓŐ'
+ echo $foo
+ printf -v foo 'ÖÓŐ'
+ echo $foo
+0:print and printf into a variable with multibyte text
+>ÖÓŐ
+>ÖÓŐ
+
# This test is kept last as it introduces an additional
# dependency on the system regex library.
if zmodload zsh/regex 2>/dev/null; then
@@ -585,3 +613,17 @@
>OK
F:A failure here may indicate the system regex library does not
F:support character sets outside the portable 7-bit range.
+
+ (
+ locale=$LANG
+ unset -m 'LC_*|LANG'
+ export LC_CTYPE=$locale
+ echo '\u276F' # this works
+ () {
+ local LC_ALL=C
+ }
+ echo '\u276F' # this doesn't work
+ )
+0:locale gets restored when locale parameters go out of scope (regression test for 45772)
+>❯
+>❯
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index cfe2c75cc..72749e6ab 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -57,7 +57,6 @@
# PROMPT_CR
# PUSHD_SILENT
# REC_EXACT
-# RM_STAR_SILENT
# RM_STAR_WAIT
# SHARE_HISTORY
# SINGLE_LINE_ZLE
@@ -92,6 +91,9 @@
catpath=$(which cat)
lspath==ls
+ # If the module fails to load, individual test points will skip.
+ zmodload zsh/zpty 2>/dev/null || true
+
%test
# setopt should move on to the next operation in the face of an error, but
@@ -1109,15 +1111,22 @@ F:Regression test for workers/41811
eval 'for f (word1 word2) print $f'
eval 'repeat 3 print nonsense'
}
- unsetopt shortloops
- print option unset
+ unsetopt shortloops shortrepeat
+ print shortloops and shortrepeat unset
+ fn
+ setopt shortrepeat
+ print shortrepeat set
fn
setopt shortloops
- print option set
+ print shortloops set
fn
0:SHORT_LOOPS option
->option unset
->option set
+>shortloops and shortrepeat unset
+>shortrepeat set
+>nonsense
+>nonsense
+>nonsense
+>shortloops set
>foo
>bar
>word1
@@ -1128,6 +1137,8 @@ F:Regression test for workers/41811
?(eval):1: parse error near `print'
?(eval):1: parse error near `print'
?(eval):1: parse error near `print'
+?(eval):1: parse error near `print'
+?(eval):1: parse error near `print'
fn() { print -l $*; }
setopt shwordsplit
@@ -1414,3 +1425,44 @@ F:If this test fails at the first unsetopt, refer to P01privileged.ztst.
(( UID == EUID ))
fi
0:PRIVILEGED sanity check: default value is correct
+
+ if zmodload -e zsh/zpty 2>/dev/null; then
+ for target_dir target_pattern in \
+ '.' '*' \
+ '/' '/*'
+ do
+ before=`ls -a -- $target_dir`
+ zpty subshell $ZTST_testdir/../Src/zsh -f +Z
+ [[ $PWD == */options.tmp ]] || return 1 # Sanity check before calling rm(1).
+ zpty -w subshell 'PS1=PROMPT'
+ zpty -r -m subshell REPLY $'*PROMPT'
+ zpty -w subshell "rm $target_pattern"
+ zpty -w -n subshell 'n'
+ sleep 1
+ zpty -rt subshell REPLY && print -r -- ${REPLY%%$'\r\n'}
+ zpty -d subshell
+ after=`ls -a -- $target_dir`
+ [[ $before == $after ]] || return 1
+ done
+ else
+ ZTST_skip="the zsh/zpty module is not available"
+ fi
+ BEL=$'\a'
+0q:RM_STAR_SILENT
+*>zsh: sure you want to delete all 15 files in ${PWD:h}/options.tmp \[yn\]\? ${BEL}(|n)
+*>zsh: sure you want to delete (all <->|more than <->) files in / \[yn\]\? ${BEL}(|n)
+
+ () {
+ local var
+ print ${(t)var}
+ }
+0:(t) returns correct type
+>scalar-local
+
+ () {
+ readonly var
+ typeset -p var
+ }
+0:readonly with typeset -p
+F:compare E03posix.ztst
+>typeset -r var=''
diff --git a/Test/E02xtrace.ztst b/Test/E02xtrace.ztst
index da6191cd0..56bc20f1a 100644
--- a/Test/E02xtrace.ztst
+++ b/Test/E02xtrace.ztst
@@ -146,3 +146,118 @@
?+(anon):0> '(anon)'
?+(anon):0> true
?+fn:0> gn
+
+ test_cases=(
+ f # baseline
+ foo-bar # Dash
+ ヌ # Meta (the UTF-8 representation of this character has an 0x83 byte)
+ \$\'ba\\0z\' # Nul, escaped as though by ${(qqqq)}
+ )
+ for 1 in "$test_cases[@]"; do
+ eval "
+ ${1}() {
+ ${1}() { echo inner }
+ }
+ functions -T ${1}
+ ${1}
+ LC_ALL=C which ${1}
+ "
+ done
+0:a function that redefines itself preserves tracing
+>f () {
+> # traced
+> echo inner
+>}
+>foo-bar () {
+> # traced
+> echo inner
+>}
+>$'\M-c\M-\C-C\M-\C-L' () {
+> # traced
+> echo inner
+>}
+>$'ba\C-@z' () {
+> # traced
+> echo inner
+>}
+
+ function -T { echo traced anonymous function }
+ functions -- -T # no output
+1:define traced function: anonymous function
+?+(anon):0> echo traced anonymous function
+>traced anonymous function
+
+ function -T f { echo traced named function }
+ functions -- -T # no output
+ functions f
+ f
+0:define traced function: named function
+>f () {
+> # traced
+> echo traced named function
+>}
+?+f:0> echo traced named function
+>traced named function
+
+ function -T -- -T { echo trace function literally named "-T" }
+ -T
+ function -T -- { echo trace anonymous function }
+ functions -- -- # no output
+1:define traced function: parse test
+?+-T:0> echo trace function literally named -T
+>trace function literally named -T
+?+(anon):0> echo trace anonymous function
+>trace anonymous function
+
+ function -- g { echo g }
+ g
+ function -- { echo anonymous }
+ functions -- -- # no output
+1:function end-of-"options" syntax, #1
+>g
+>anonymous
+
+ function -- -T { echo runs }
+ functions -- -- # no output
+ echo the definition didn\'t execute it
+ -T
+0:function end-of-"options" syntax, #2
+>the definition didn't execute it
+>runs
+
+ f() g
+ g() :
+ functions -t f
+ f
+0:functions -t smoke test #1
+?+f:4> g
+?+g:4> :
+F:The `4' on the second line is incorrect; see workers/48594.
+
+ f() g
+ g() { () : }
+ functions -t f
+ f
+0:functions -t smoke test #2
+?+f:4> g
+?+g:0> '(anon)'
+?+(anon):0> :
+
+ f() g
+ g() :
+ (
+ functions -T f
+ functions -t f
+ f
+ )
+ (
+ functions -t f
+ functions -T f
+ f
+ )
+0:ensure the behaviour of 'functions -Tt f' doesn't change surreptitiously
+?+f:6> g
+?+f:11> g
+F:If this test fails, the new behaviour may be
+F:workers/48591.
+
diff --git a/Test/E03posix.ztst b/Test/E03posix.ztst
new file mode 100644
index 000000000..caab97ab6
--- /dev/null
+++ b/Test/E03posix.ztst
@@ -0,0 +1,161 @@
+# Test POSIX-specific behavior
+# Currently this covers only POSIXBUILTINS, other behaviors are in their
+# more directly related sections
+#
+
+%prep
+ setopt POSIX_BUILTINS TYPESET_TO_UNSET
+
+%test
+
+ local parentenv=preserved
+ fn() {
+ typeset -h +g -m \*
+ unset -m \*
+ integer i=9
+ float -H f=9
+ declare -t scalar
+ declare -H -a array
+ typeset
+ typeset +
+ }
+ fn
+ echo $parentenv
+0:Parameter hiding and tagging, printing types and values
+>array local array
+>float local f
+>integer local i=9
+>local tagged scalar
+>array local array
+>float local f
+>integer local i
+>local tagged scalar
+>preserved
+
+ readonly foo=bar novalue
+ readonly -p
+0:readonly -p output (no readonly specials)
+>readonly foo=bar
+>readonly novalue
+
+ local -a myarray
+ typeset -p1 myarray
+ myarray=("&" sand '""' "" plugh)
+ typeset -p1 myarray
+0:typeset -p1 output for array
+>typeset -a myarray
+>typeset -a myarray=(
+> '&'
+> sand
+> '""'
+> ''
+> plugh
+>)
+
+ local -A myhash
+ typeset -p1 myhash
+ myhash=([one]=two [three]= [four]="[]")
+ typeset -p1 myhash
+0:typeset -p1 output for associative array
+>typeset -A myhash
+>typeset -A myhash=(
+> [four]='[]'
+> [one]=two
+> [three]=''
+>)
+
+ str=s
+ arr=(a)
+ typeset -A ass
+ ass=(a a)
+ integer i=0
+ float f=0
+ print ${(t)str} ${(t)arr} ${(t)ass} ${(t)i} ${(t)f}
+0:${(t)...}
+>scalar array association-local integer-local float-local
+
+ print $empty[(i)] $empty[(I)]
+0:(i) and (I) return nothing for empty array
+>
+
+ (
+ # reserved words are handled during parsing,
+ # hence eval...
+ disable -r typeset
+ eval '
+ setopt kshtypeset
+ ktvars=(ktv1 ktv2)
+ typeset ktfoo=`echo arg1 arg2` $ktvars
+ () {
+ local ktfoo
+ print $+ktv1 $+ktv2 $+ktv3 $+ktfoo
+ }
+ print $ktfoo
+ unsetopt kshtypeset
+ typeset noktfoo=`echo noktarg1 noktarg2`
+ print $noktfoo
+ print $+noktarg1 $+noktarg2
+ unset ktfoo ktv1 ktv2 noktfoo noktarg2
+ '
+ )
+0:KSH_TYPESET option
+>0 0 0 0
+>arg1 arg2
+>noktarg1
+>0 0
+
+ () {
+ local var
+ print ${(t)var}
+ }
+0:(t) returns correct type
+>scalar-local
+
+ () {
+ readonly var
+ typeset -p var
+ }
+0:readonly with typeset -p
+>typeset -g -r var
+
+# Tests expected to fail
+
+ echo -
+0f:A single "-" for echo does not end the arguments
+F:POSIX requires a solitary "-" to be a plain argument
+>-
+
+ ARGV0=sh $ZTST_testdir/../Src/zsh -c 'foreach() { true; }'
+-f:"foreach" is not a reserved word
+
+ ARGV0=sh $ZTST_testdir/../Src/zsh -c 'end() { true; }
+-f:"end" is not a reserved word
+
+ a='a:b:' ARGV0=sh $ZTST_testdir/../Src/zsh -c 'IFS=:; printf "<%s>\n" $a'
+0f:IFS is a separator, not a delimiter
+><a>
+><b>
+
+ a=$'\ra\r\rb' ARGV0=sh $ZTST_testdir/../Src/zsh -c 'IFS=:; printf "<%s>\n" $a'
+0f:All whitespace characters are "IFS whitespace"
+F:isspace('\r') is true so \r should behave like space, \t, \n
+F:This may also need to apply to multibyte whitespace
+><a>
+><b>
+
+ ARGV0=sh $ZTST_testdir/../Src/zsh -c 'IFS=2; printf "<%s>\n" $((11*11))'
+0f:IFS applies to math results (numbers treated as strings)
+><1>
+><1>
+
+ ARGV0=sh $ZTST_testdir/../Src/zsh -c 'inf=42; echo $((inf))'
+0:All identifiers are variable references in POSIX arithmetic
+F:POSIX has neither math functions nor floating point
+>42
+
+ ARGV0=sh $ZTST_testdir/../Src/zsh -c 'EUID=10; echo "$EUID"'
+-f:EUID is not a special variable
+>10
+
+ PPID=foo
+-f:PPID is not a readonly variable
diff --git a/Test/P01privileged.ztst b/Test/P01privileged.ztst
index c54112bb6..7c4a1be35 100644
--- a/Test/P01privileged.ztst
+++ b/Test/P01privileged.ztst
@@ -13,8 +13,13 @@
# same requirements here.)
#
# If either of the aforementioned environment variables is not set, the test
-# script will try to pick the first two >0 IDs from the passwd/group databases
-# on the current system.
+# script will try to use the UID/GID of the test directory, if not 0, for the
+# two effective IDs. (This is intended to work around issues that might occur
+# when e.g. the test directory lives under a home directory with mode 0700.
+# Unfortunately, if this is the case, it will not be possible to use anything
+# besides the directory owner or root as the test shell's EUID -- maintainers
+# take note.) Otherwise, the script will pick the first >0 ID(s) from the
+# passwd/group databases on the current system.
#
# If either variable is set, the tests will run, but they will likely fail
# without super-user privileges.
@@ -45,10 +50,12 @@
euid=${ZSH_TEST_UNPRIVILEGED_UID##*:}
else
print -ru$ZTST_fd 'Selecting unprivileged UID:EUID pair automatically'
+ # See above for why we do this
+ zmodload -sF zsh/stat b:zstat && euid=${"$( zstat +uid -- $ZTST_testdir )":#0}
local tmp=$( getent passwd 2> /dev/null || < /etc/passwd )
# Note: Some awks require -v and its argument to be separate
- ruid=$( awk -F: '$3 > 0 { print $3; exit; }' <<< $tmp )
- euid=$( awk -F: -v u=$ruid '$3 > u { print $3; exit; }' <<< $tmp )
+ ruid=$( awk -F: -v u=${euid:-0} '$3 > 0 && $3 != u { print $3; exit; }' <<< $tmp )
+ euid=${euid:-"$( awk -F: -v u=$ruid '$3 > u { print $3; exit; }' <<< $tmp )"}
fi
#
if [[ -n $ZSH_TEST_UNPRIVILEGED_GID ]]; then
@@ -56,10 +63,12 @@
egid=${ZSH_TEST_UNPRIVILEGED_GID##*:}
else
print -ru$ZTST_fd 'Selecting unprivileged GID:EGID pair automatically'
+ # See above again -- this shouldn't have the same impact as the UID, though
+ zmodload -sF zsh/stat b:zstat && egid=${"$( zstat +gid -- $ZTST_testdir )":#0}
local tmp=$( getent group 2> /dev/null || < /etc/group )
# Note: Some awks require -v and its argument to be separate
- rgid=$( awk -F: '$3 > 0 { print $3; exit; }' <<< $tmp )
- egid=$( awk -F: -v g=$rgid '$3 > g { print $3; exit; }' <<< $tmp )
+ rgid=$( awk -F: -v g=${egid:-0} '$3 > 0 && $3 != g { print $3; exit; }' <<< $tmp )
+ egid=${egid:="$( awk -F: -v g=$rgid '$3 > g { print $3; exit; }' <<< $tmp )"}
fi
#
[[ $ruid/$euid == <1->/<1-> && $ruid != $euid ]] || ruid= euid=
@@ -134,11 +143,9 @@
%test
- re_zsh $ruid $ruid -1 -1 'echo $UID/$EUID $options[privileged]'
re_zsh $euid $euid -1 -1 'echo $UID/$EUID $options[privileged]'
re_zsh $ruid $euid -1 -1 'echo $UID/$EUID $options[privileged]'
0q:PRIVILEGED automatically enabled when RUID != EUID
->$ruid/$ruid off
>$euid/$euid off
>$ruid/$euid on
diff --git a/Test/V01zmodload.ztst b/Test/V01zmodload.ztst
index 55c3c314b..daf49cd72 100644
--- a/Test/V01zmodload.ztst
+++ b/Test/V01zmodload.ztst
@@ -64,7 +64,7 @@
for m in $mods
do
- zmodload $m || mods[(r)$m]=()
+ zmodload $m || return $?
done
0d:Test loading of all compiled modules
@@ -349,6 +349,52 @@
?(eval):9: file descriptor out of range
$ZTST_testdir/../Src/zsh -fc "
+ MODULE_PATH=${(q)MODULE_PATH}
+ if zmodload -e zsh/parameter; then zmodload -u zsh/parameter; fi
+ unset options
+ zmodload zsh/parameter
+ echo \$+options
+ "
+-f:can unset a non-readonly autoloadable parameter before loading the module
+>0
+# Currently prints '1'.
+
+ $ZTST_testdir/../Src/zsh -fc "
+ MODULE_PATH=${(q)MODULE_PATH}
+ zmodload zsh/parameter
+ unset options
+ echo \$+options
+ "
+0:can unset a non-readonly autoloadable parameter after loading the module
+>0
+
+ $ZTST_testdir/../Src/zsh -fc "
+ MODULE_PATH=${(q)MODULE_PATH}
+ if zmodload -e zsh/parameter; then zmodload -u zsh/parameter; fi
+ unset builtins
+ "
+-f:can't unset a readonly autoloadable parameter before loading the module
+*?zsh:?: read-only variable: builtins
+# Currently, the 'unset' succeeds.
+
+ $ZTST_testdir/../Src/zsh -fc "
+ MODULE_PATH=${(q)MODULE_PATH}
+ zmodload zsh/parameter
+ unset builtins
+ "
+1:can't unset a readonly autoloadable parameter after loading the module
+*?zsh:?: read-only variable: builtins
+
+ $ZTST_testdir/../Src/zsh -fc "
+ MODULE_PATH=${(q)MODULE_PATH}
+ zmodload zsh/parameter
+ zmodload -u zsh/parameter
+ echo \$options
+ "
+0:unloading a module doesn't implicitly unset autoloadable parameters
+*>(on|off) *
+
+ $ZTST_testdir/../Src/zsh -fc "
MODULE_PATH=${(q)MODULE_PATH}
#
zmodload zsh/zutil
diff --git a/Test/V05styles.ztst b/Test/V05styles.ztst
index c221d9db8..61d2cdb0a 100644
--- a/Test/V05styles.ztst
+++ b/Test/V05styles.ztst
@@ -151,3 +151,25 @@
>one
>two
+ (
+ zstyle ':weather:*:Sunday:*' preferred-precipitation snow
+ zstyle ':weather:europe:*' preferred-precipitation rain
+ zstyle -s ':weather:europe:Sunday:foo' preferred-precipitation REPLY && print $REPLY
+ )
+ (
+ zstyle ':weather:europe:*' preferred-precipitation rain
+ zstyle ':weather:*:Sunday:*' preferred-precipitation snow
+ zstyle -s ':weather:europe:Sunday:foo' preferred-precipitation REPLY && print $REPLY
+ )
+0:the example in the documentation remains correct
+>snow
+>snow
+
+ (
+ zstyle $'con\x00text' $'ke\x00y' $'val\x00u' $'e'
+ a=( ${(f)"$(zstyle -L)"} )
+ a=( ${(M)a:#*con*text*ke*y*val*u*e} )
+ print -r -- "$a"
+ )
+0:zstyle -L escapes the key (regression: workers/48424)
+>zstyle $'con\C-@text' $'ke\C-@y' $'val\C-@u' e
diff --git a/Test/V07pcre.ztst b/Test/V07pcre.ztst
index ab67f3d80..c9c844d2a 100644
--- a/Test/V07pcre.ztst
+++ b/Test/V07pcre.ztst
@@ -1,11 +1,10 @@
%prep
- if grep '^name=zsh/pcre .* link=no ' $ZTST_testdir/../config.modules >/dev/null
+ if ! zmodload zsh/pcre 2>/dev/null
then
ZTST_unimplemented="the zsh/pcre module was disabled by configure (see config.modules)"
return 0
fi
- zmodload zsh/pcre
setopt rematch_pcre
# Find a UTF-8 locale.
setopt multibyte
diff --git a/Test/V08zpty.ztst b/Test/V08zpty.ztst
index b0cbfa050..057db2e18 100644
--- a/Test/V08zpty.ztst
+++ b/Test/V08zpty.ztst
@@ -6,8 +6,6 @@
if ! zmodload zsh/zpty 2>/dev/null
then
ZTST_unimplemented="the zsh/zpty module is not available"
- elif [[ $OSTYPE = cygwin ]]; then
- ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
fi
%test
diff --git a/Test/V09datetime.ztst b/Test/V09datetime.ztst
index 9f67ecec3..622bdf6ed 100644
--- a/Test/V09datetime.ztst
+++ b/Test/V09datetime.ztst
@@ -130,3 +130,7 @@
>%6. 2002-02-02 02:02:02.999999
>%9. 2002-02-02 02:02:02.999999999
>%12. 2002-02-02 02:02:02.999999999
+
+ strftime -n 'one line%n' 2> /dev/null
+0:-n option
+>one line
diff --git a/Test/V10private.ztst b/Test/V10private.ztst
index a3a63867b..56ffbc5b4 100644
--- a/Test/V10private.ztst
+++ b/Test/V10private.ztst
@@ -19,14 +19,14 @@
() {
print $scalar_test
private scalar_test
- print $+scalar_test
+ typeset +m scalar_test
unset scalar_test
print $+scalar_test
}
print $scalar_test
0:basic scope hiding
>toplevel
->1
+>local scalar_test
>0
>toplevel
@@ -45,14 +45,14 @@
print $+unset_test
() {
private unset_test
- print $+unset_test
+ typeset +m unset_test
unset_test=setme
print $unset_test
}
print $+unset_test
0:variable defined only in scope
>0
->1
+>local unset_test
>setme
>0
@@ -62,13 +62,13 @@
local -Pa array_test=(in function)
() {
private array_test
- print $+array_test
+ typeset +m array_test
}
print $array_test
}
print $array_test
0:nested scope with different type, correctly restored
->1
+>local array_test
>in function
>top level
@@ -116,14 +116,14 @@
}
outer () {
local -PA hash_test=(in function)
- typeset -p hash_test
+ private + hash_test
inner
}
outer
print ${(kv)hash_test}
0:private hides value from surrounding scope in nested scope
>typeset -a hash_test=( top level )
->typeset -A hash_test=( [in]=function )
+>hash_test=( [in]=function )
>typeset -g -a hash_test=( top level )
>array-local top level
>top level
@@ -246,7 +246,7 @@ F:note "typeset" rather than "private" in output from outer
1:privates are not visible in anonymous functions, part 3
>X top level
>array_test not set
-?(anon):4: array_test: attempt to assign private in nested scope
+?(anon):4: array_test: can't change parameter attribute
F:future revision will create a global with this assignment
typeset -a array_test
diff --git a/Test/V12zparseopts.ztst b/Test/V12zparseopts.ztst
index d7fc33f72..816e1d041 100644
--- a/Test/V12zparseopts.ztst
+++ b/Test/V12zparseopts.ztst
@@ -65,11 +65,11 @@
} $=1
done
0:zparseopts -F
-?(anon):zparseopts:2: bad option: x
+?(anon):zparseopts:2: bad option: -x
>ret: 1, optv: , argv: -a -x -z
-?(anon):zparseopts:2: bad option: x
+?(anon):zparseopts:2: bad option: -x
>ret: 1, optv: , argv: -ax -z
-?(anon):zparseopts:2: bad option: -
+?(anon):zparseopts:2: bad option: --x
>ret: 1, optv: , argv: -a --x -z
for 1 in '-a 1 2 3' '1 2 3'; do
@@ -168,5 +168,5 @@
print -r - ret: $?, optv: $optv, argv: $argv
} -ab1 -c
0:missing optarg
-?(anon):zparseopts:2: missing argument for option: c
+?(anon):zparseopts:2: missing argument for option: -c
>ret: 1, optv: , argv: -ab1 -c
diff --git a/Test/V13zformat.ztst b/Test/V13zformat.ztst
new file mode 100644
index 000000000..035a0a495
--- /dev/null
+++ b/Test/V13zformat.ztst
@@ -0,0 +1,91 @@
+# Test the use of zformat, if the zsh/zutil module is available.
+
+%prep
+
+ if ! zmodload zsh/zutil 2>/dev/null; then
+ ZTST_unimplemented="can't load the zsh/zutil module for testing"
+ fi
+
+ # Helper function. Expects a single format using %s and a value for it.
+ zformat_and_print_s() {
+ zformat -f REPLY "$1" "s:$2"
+ print -r - ${(qq)REPLY}
+ }
+
+%test
+
+ zformat_and_print_s '%s' foo
+ zformat_and_print_s '%5s' min
+ zformat_and_print_s '%-5s' neg
+ zformat_and_print_s '%5.s' empty
+ zformat_and_print_s '%.5s' max
+ zformat_and_print_s '%.5s' truncated
+0:basic zformat test
+>'foo'
+>'min '
+>' neg'
+>'empty'
+>'max'
+>'trunc'
+
+ # There may be a set of digits either before or after the opening parenthesis.
+ zformat_and_print_s 'The answer is "%3(s.yes.no)".' 3
+ zformat_and_print_s 'The answer is "%(3s.yes.no)".' 3
+ # The test number defaults to zero.
+ zformat_and_print_s '%(s.equal.unequal)' -1
+ zformat_and_print_s '%(s.equal.unequal)' 0
+ zformat_and_print_s '%(s.equal.unequal)' 1
+ # Negative numbers are allowed
+ # The delimiter is arbitrary
+ zformat_and_print_s '%-4(s.minus four.)' -4
+ zformat_and_print_s '%(-4s//minus four)' -4
+ # The argument is evaluated as a math expression
+ zformat_and_print_s '%18(s.math.)' '6*3'
+0:basic conditionals test
+>'The answer is "yes".'
+>'The answer is "yes".'
+>'unequal'
+>'equal'
+>'unequal'
+>'minus four'
+>''
+>'math'
+
+ () {
+ zformat -f 1 '%(8n.%(5j.yes.no).no)' 'n:8' 'j:5'
+ echo $1
+ }
+0:nested conditionals test
+>yes
+
+ () {
+ zformat -f 1 '%(w.zero.fail) %(x.fail.present) %(y.empty.fail) %(z.missing.fail)' w:0 x:1 y:
+ zformat -F 2 '%(w.zero.fail) %(x.present.fail) %(y.fail.empty) %(z.fail.missing)' w:0 x:1 y:
+ echo $1
+ echo $2
+ }
+0:conditionals with empty and missing values
+>zero present empty missing
+>zero present empty missing
+
+ () {
+ local l
+ for l in 0 1 2 3; do
+ zformat -F 1 "%$l(a.a.A)%$l(b.b.B)%$l(c.c.C)%$l(d.d.D)" a: b:1 c:12 d:123
+ zformat -F 2 "%-$l(a.a.A)%-$l(b.b.B)%-$l(c.c.C)%-$l(d.d.D)" a: b:1 c:12 d:123
+ print - $1 $2
+ done
+ }
+0:minimum and maximum widths
+>Abcd aBCD
+>ABcd abCD
+>ABCd abcD
+>ABCD abcd
+
+ zformat -a argv . foo:lorem ipsum:bar bazbaz '\\esc\:ape'
+ print -rl -- "$@"
+0:basic -a test
+>foo .lorem
+>ipsum.bar
+>bazbaz
+>\esc:ape
diff --git a/Test/V14system.ztst b/Test/V14system.ztst
new file mode 100644
index 000000000..100daab08
--- /dev/null
+++ b/Test/V14system.ztst
@@ -0,0 +1,149 @@
+# Test zsh/system module
+
+%prep
+
+ if zmodload -s zsh/system && zmodload -s zsh/zselect; then
+ tst_dir=V14.tmp
+ mkdir -p -- $tst_dir
+ else
+ ZTST_unimplemented='the zsh/system and zsh/zselect modules are not available'
+ fi
+ : > $tst_dir/file # File on which to acquire flock.
+
+%test
+
+ (
+ zsystem flock -t 0 -i 0.000001 $tst_dir/file &&
+ zsystem flock -t 0.1 -i 0.000001 $tst_dir/file &&
+ zsystem flock -t 0.1 -i 0.0000001 $tst_dir/file &&
+ zsystem flock -t 1 -i 0.000001 $tst_dir/file
+ )
+0:zsystem flock valid time arguments
+
+ (
+ zsystem flock -t 1073741824 $tst_dir/file ||
+ zsystem flock -t 1e100 $tst_dir/file ||
+ zsystem flock -i -1 $tst_dir/file ||
+ zsystem flock -i 0 $tst_dir/file ||
+ zsystem flock -i 1e100 $tst_dir/file
+ )
+1:zsystem flock invalid time arguments
+?(eval):zsystem:2: flock: invalid timeout value: '1073741824'
+?(eval):zsystem:3: flock: invalid timeout value: '1e100'
+?(eval):zsystem:4: flock: invalid interval value: '-1'
+?(eval):zsystem:5: flock: invalid interval value: '0'
+?(eval):zsystem:6: flock: invalid interval value: '1e100'
+
+ (
+ # Lock file for 1 second in the background.
+ lock_flag=$tst_dir/locked1
+ (zsystem flock $tst_dir/file \
+ && touch $lock_flag \
+ && zselect -t 100
+ mv $lock_flag $lock_flag.done) &
+ # Wait until sub-shell above has started.
+ while ! [[ -f $lock_flag || -f $lock_flag.done ]]; do
+ zselect -t 1
+ done
+ if [[ -f $lock_flag.done ]]; then
+ echo "Background shell should not have completed already." 1>&2
+ else
+ # Attempt to lock file with 0.5 second timeout: must fail.
+ zsystem flock -t 0.5 $tst_dir/file
+ fi
+ )
+2:zsystem flock unsuccessful wait test
+F:This timing test might fail due to process scheduling issues unrelated to zsh.
+
+ (
+ # Lock file for 0.5 second in the background.
+ lock_flag=$tst_dir/locked2
+ (zsystem flock $tst_dir/file \
+ && touch $lock_flag \
+ && zselect -t 50
+ mv $lock_flag $lock_flag.done) &
+ # Wait until sub-shell above has started.
+ while ! [[ -f $lock_flag || -f $lock_flag.done ]]; do
+ zselect -t 1
+ done
+ if [[ -f $lock_flag.done ]]; then
+ echo "Background shell should not have completed already." 1>&2
+ fi
+ typeset -F SECONDS
+ start=$SECONDS
+ # Attempt to lock file without a timeout:
+ # must succeed after sub-shell above releases it (0.5 second).
+ if zsystem flock $tst_dir/file; then
+ elapsed=$[ $SECONDS - $start ]
+ if [[ $elapsed -ge 0.3 && $elapsed -le 0.7 ]]; then
+ echo "elapsed time seems OK" 1>&2
+ else
+ echo "elapsed time $elapsed should be ~ 0.5 second" 1>&2
+ fi
+ fi
+ )
+0:zsystem flock successful wait test, no timeout
+?elapsed time seems OK
+F:This timing test might fail due to process scheduling issues unrelated to zsh.
+
+ (
+ # Lock file for 0.5 second in the background.
+ lock_flag=$tst_dir/locked3
+ (zsystem flock $tst_dir/file \
+ && touch $lock_flag \
+ && zselect -t 50
+ mv $lock_flag $lock_flag.done) &
+ # Wait until sub-shell above has started.
+ while ! [[ -f $lock_flag || -f $lock_flag.done ]]; do
+ zselect -t 1
+ done
+ if [[ -f $lock_flag.done ]]; then
+ echo "Background shell should not have completed already." 1>&2
+ fi
+ typeset -F SECONDS
+ start=$SECONDS
+ # Attempt to lock file with 1-second timeout:
+ # must succeed 1 second after start because we retry every 1 second.
+ if zsystem flock -t 1 $tst_dir/file; then
+ elapsed=$[ $SECONDS - $start ]
+ if [[ $elapsed -ge 0.8 && $elapsed -le 1.2 ]]; then
+ echo "elapsed time seems OK" 1>&2
+ else
+ echo "elapsed time $elapsed should be ~ 1 second" 1>&2
+ fi
+ fi
+ )
+0:zsystem flock successful wait test, integral seconds
+?elapsed time seems OK
+F:This timing test might fail due to process scheduling issues unrelated to zsh.
+
+ (
+ # Lock file for 0.25 second in the background.
+ lock_flag=$tst_dir/locked4
+ (zsystem flock $tst_dir/file \
+ && touch $lock_flag \
+ && zselect -t 25
+ mv $lock_flag $lock_flag.done) &
+ # Wait until sub-shell above has started.
+ while ! [[ -f $lock_flag || -f $lock_flag.done ]]; do
+ zselect -t 1
+ done
+ if [[ -f $lock_flag.done ]]; then
+ echo "Background shell should not have completed already." 1>&2
+ fi
+ typeset -F SECONDS
+ start=$SECONDS
+ # Attempt to lock file with 0.4-second timeout, retrying every 0.1 second:
+ # must succeed 0.3 second after start.
+ if zsystem flock -t 0.4 -i 0.1 $tst_dir/file; then
+ elapsed=$[ $SECONDS - $start ]
+ if [[ $elapsed -ge 0.2 && $elapsed -le 0.5 ]]; then
+ echo "elapsed time seems OK" 1>&2
+ else
+ echo "elapsed time $elapsed should be ~ 0.3 second" 1>&2
+ fi
+ fi
+ )
+0:zsystem flock successful wait test, fractional seconds
+?elapsed time seems OK
+F:This timing test might fail due to process scheduling issues unrelated to zsh.
diff --git a/Test/W01history.ztst b/Test/W01history.ztst
index 0b2f60d1e..1d3f3cf6f 100644
--- a/Test/W01history.ztst
+++ b/Test/W01history.ztst
@@ -88,3 +88,25 @@ F:Check that a history bug introduced by workers/34160 is working again.
0:Modifier :P
>/my/path/for/testing
>/my/path/for/testing
+
+ $ZTST_testdir/../Src/zsh -fgis <<<'
+ SAVEHIST=7
+ print -rs "one\\"
+ print -rs "two\\\\"
+ print -rs "three\\\\\\"
+ print -rs "four\\\\\\\\"
+ print -rs "five\\\\\\\\\\"
+ print -s "while false\ndo\ntrue\\\\\n && break\ndone"
+ print -s "echo one\\\\\ntwo"
+ fc -W hist
+ fc -p -R hist
+ fc -l
+ rm hist' 2>/dev/null
+0:Lines ending in backslash saved and restored to history
+> 1 one\
+> 2 two\\
+> 3 three\\\
+> 4 four\\\\
+> 5 five\\\\\
+> 6 while false\ndo\ntrue\\n && break\ndone
+> 7 echo one\\ntwo
diff --git a/Test/W02jobs.ztst b/Test/W02jobs.ztst
index fe12f979d..d52888dd9 100644
--- a/Test/W02jobs.ztst
+++ b/Test/W02jobs.ztst
@@ -2,9 +2,7 @@
%prep
- if [[ $OSTYPE == cygwin ]]; then
- ZTST_unimplemented='the zsh/zpty module does not work on Cygwin'
- elif zmodload zsh/zpty 2> /dev/null; then
+ if zmodload zsh/zpty 2> /dev/null; then
zpty_start() {
export PS1= PS2=
zpty -d
@@ -146,12 +144,14 @@
zpty_start
zpty_input 'sleep 3 &'
zpty_input 'jobs -r'
+ zpty_input '(jobs -r)'
zpty_input 'print -- -'
zpty_input 'jobs -s'
zpty_stop
0:`jobs -r` and `jobs -s` with running job
*>\[1] [0-9]##
*>\[1] + running*sleep*
+*>\[1] + running*sleep*
*>-
*>zsh:*SIGHUPed*
diff --git a/Test/W03jobparameters.ztst b/Test/W03jobparameters.ztst
new file mode 100644
index 000000000..a6f7a09b1
--- /dev/null
+++ b/Test/W03jobparameters.ztst
@@ -0,0 +1,78 @@
+# Tests for interactive job control with parameter state
+
+%prep
+
+ if zmodload zsh/zpty 2> /dev/null; then
+ zpty_start() {
+ export PS1= PS2=
+ zpty -d
+ zpty zsh "${(q)ZTST_testdir}/../Src/zsh -fiV +Z"
+ }
+ zpty_input() {
+ zpty -w zsh "${(F)@}" $'\n'
+ }
+ zpty_line() {
+ local REPLY
+ integer i
+ for (( i = 0; i < ${1:-1}; ++i )); do
+ zpty -r zsh REPLY
+ print -r -- ${REPLY%%($'\r\n'|$'\n')}
+ done
+ }
+ zpty_stop() {
+ # exit twice in case of check_jobs
+ zpty -w zsh $'exit\nexit\n'
+ # zpty gives no output when piped without these braces (?)
+ { zpty -r zsh } | sed $'/[^[:space:]]/!d; s/\r$//;'
+ zpty -d
+ :
+ }
+ if ! zmodload zsh/parameter 2> /dev/null; then
+ ZTST_unimplemented='the zsh/parameter module is not available'
+ fi
+ else
+ ZTST_unimplemented='the zsh/zpty module is not available'
+ fi
+
+%test
+
+ zpty_start
+ zpty_input "MODULE_PATH=${(q)MODULE_PATH}"
+ zpty_input 'sleep 3 &'
+ zpty_input 'print $jobstates'
+ zpty_input '(print $jobstates)'
+ zpty_input 'jobs -s'
+ zpty_stop
+0:$jobstate for running job in main shell and subshell
+*>\[1] [0-9]##
+*>running:+:*=running
+*>running:+:*=running
+*>zsh:*SIGHUPed*
+
+# $jobstates refers to a job started in the main shell unless
+# one has been started in the subshell. In the latter case,
+# the subshell has no job control so the job is not marked as current.
+ zpty_start
+ zpty_input "MODULE_PATH=${(q)MODULE_PATH}"
+ zpty_input 'sleep 3 &'
+ zpty_input '(print main; print $jobstates; sleep 2& print sub; print $jobstates)'
+ zpty_input 'jobs -s'
+ zpty_stop
+0:$jobstate shows one job started in main shell or one started in subshell
+*>\[1] [0-9]##
+>main
+*>running:+:*=running
+>sub
+*>running::*=running
+*>zsh:*SIGHUPed*
+
+# output from zpty removes empty lines
+ zpty_start
+ zpty_input "MODULE_PATH=${(q)MODULE_PATH}"
+ zpty_input '(print main; print $jobstates; sleep 2& print sub; print $jobstates)'
+ zpty_input 'jobs -s'
+ zpty_stop
+0:$jobstate shows no job started in main shell but one started in subshell
+>main
+>sub
+*>running::*=running
diff --git a/Test/X02zlevi.ztst b/Test/X02zlevi.ztst
index 4e7966e12..8146d6752 100644
--- a/Test/X02zlevi.ztst
+++ b/Test/X02zlevi.ztst
@@ -11,9 +11,7 @@
break;
fi
done
- if [[ $OSTYPE = cygwin ]]; then
- ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
- elif ( zmodload zsh/zpty 2>/dev/null ); then
+ if ( zmodload zsh/zpty 2>/dev/null ); then
. $ZTST_srcdir/comptest
comptestinit -v -z $ZTST_testdir/../Src/zsh
else
diff --git a/Test/X03zlebindkey.ztst b/Test/X03zlebindkey.ztst
index e5aac7379..3e299a337 100644
--- a/Test/X03zlebindkey.ztst
+++ b/Test/X03zlebindkey.ztst
@@ -12,9 +12,7 @@
break;
fi
done
- if [[ $OSTYPE = cygwin ]]; then
- ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
- elif ( zmodload zsh/zpty 2>/dev/null ); then
+ if ( zmodload zsh/zpty 2>/dev/null ); then
. $ZTST_srcdir/comptest
comptestinit -z $ZTST_testdir/../Src/zsh
else
diff --git a/Test/X04zlehighlight.ztst b/Test/X04zlehighlight.ztst
index 475a2e309..f84c02505 100644
--- a/Test/X04zlehighlight.ztst
+++ b/Test/X04zlehighlight.ztst
@@ -5,8 +5,6 @@
export TERM=xterm-256color
if [[ ${+termcap} != 1 || ${termcap[Co]} != <-> || ${termcap[Co]} -lt 256 ]]; then
ZTST_unimplemented="no termcap module OR termcap doesn't support 256 or more colors"
- elif [[ $OSTYPE == cygwin ]]; then
- ZTST_unimplemented='the zsh/zpty module does not work on Cygwin'
elif zmodload zsh/zpty 2> /dev/null; then
zpty_start() {
export PS1= PS2=
@@ -95,6 +93,50 @@
>0m27m24mCDE|32|trueCDE|39|
zpty_start
+ zpty_input 'rh_widget() { region_highlight+=( "0 4 fg=green memo=someplugin" ); typeset -p region_highlight }'
+ zpty_input 'zle -N rh_widget'
+ zpty_input 'bindkey "\C-a" rh_widget'
+ zpty_enable_zle
+ zpty_input $'\C-a'
+ zpty_line
+ zpty_stop
+0:region_highlight memo information round trips
+>typeset -a region_highlight=( '0 4 fg=green memo=someplugin' )
+
+ zpty_start
+ zpty_input 'rh_widget() { region_highlight+=( "0 4 fg=green memo=someplugin,futureattribute=futurevalue" ); typeset -p region_highlight }'
+ zpty_input 'zle -N rh_widget'
+ zpty_input 'bindkey "\C-a" rh_widget'
+ zpty_enable_zle
+ zpty_input $'\C-a'
+ zpty_line
+ zpty_stop
+0:region_highlight memo information forward compatibility, #1
+>typeset -a region_highlight=( '0 4 fg=green memo=someplugin' )
+
+ zpty_start
+ zpty_input 'rh_widget() { region_highlight+=( "0 4 fg=green memo=someplugin futurefifthfield" ); typeset -p region_highlight }'
+ zpty_input 'zle -N rh_widget'
+ zpty_input 'bindkey "\C-a" rh_widget'
+ zpty_enable_zle
+ zpty_input $'\C-a'
+ zpty_line
+ zpty_stop
+0:region_highlight memo information forward compatibility, #2
+>typeset -a region_highlight=( '0 4 fg=green memo=someplugin' )
+
+ zpty_start
+ zpty_input 'rh_widget() { region_highlight+=( "0 4 fg=green memo=some'$'\0''plugin" ); typeset -p region_highlight }'
+ zpty_input 'zle -N rh_widget'
+ zpty_input 'bindkey "\C-a" rh_widget'
+ zpty_enable_zle
+ zpty_input $'\C-a'
+ zpty_line
+ zpty_stop
+0:region_highlight memo information forward compatibility, #3: NULs
+>typeset -a region_highlight=( '0 4 fg=green memo=some' )
+
+ zpty_start
zpty_input 'rh_widget() { BUFFER="true"; region_highlight+=( "0 4 fg=#040810" ); }'
zpty_input 'zle -N rh_widget'
zpty_input 'bindkey "\C-a" rh_widget'
@@ -154,6 +196,17 @@
0:overlapping region_highlight with near-color (hex-triplets at input)
>0m27m24mCDE|340|tCDE|3160|rCDE|39|CDE|340|ueCDE|39|
+ zpty_start
+ zpty_input 'f () { zle clear-screen; zle g -f nolast; BUFFER=": ${(q)LASTWIDGET}" }; zle -N f'
+ zpty_input 'g () { }; zle -N g'
+ zpty_input 'bindkey "\C-a" f'
+ zpty_enable_zle
+ zpty_input $'\C-a'
+ zpty_line 1 p
+ zpty_stop
+0:zle $widgetname -f nolast
+>0m27m24m0m27m24m: clear-screen
+
%clean
zmodload -ui zsh/zpty
diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst
index 51f604bcf..6af0efc6d 100644
--- a/Test/Y01completion.ztst
+++ b/Test/Y01completion.ztst
@@ -11,9 +11,7 @@
break;
fi
done
- if [[ $OSTYPE = cygwin ]]; then
- ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
- elif ( zmodload zsh/zpty 2>/dev/null ); then
+ if ( zmodload zsh/zpty 2>/dev/null ); then
. $ZTST_srcdir/comptest
mkdir comp.tmp
cd comp.tmp
@@ -46,6 +44,35 @@
>line: {: dir1/}{}
>line: {: dir2/}{}
+ comptest $': *\t\t\t\t\t\t'
+0:_expand shows file types
+>line: {: dir1/}{}
+>DESCRIPTION:{expansions}
+>DI:{dir1}
+>DI:{dir2}
+>FI:{file1}
+>FI:{file2}
+>DESCRIPTION:{all expansions}
+>NO:{dir1 dir2 file1 file2}
+>DESCRIPTION:{original}
+>NO:{*}
+>line: {: dir2/}{}
+>line: {: file1 }{}
+>line: {: file2 }{}
+>line: {: dir1 dir2 file1 file2 }{}
+>line: {: *}{}
+
+ comptesteval $'zstyle \'*\' glob no'
+ comptesteval $'typeset -g tst=(*)'
+ comptest $': $tst\C-D'
+0:_expand preserves array form
+>DESCRIPTION:{expansions}
+>NO:{dir1}
+>NO:{dir2}
+>NO:{file1}
+>NO:{file2}
+
+ comptesteval $'zstyle -d \'*\' glob'
comptesteval '_users () { compadd user1 user2 }'
comptest $': ~\t\t\t\t\t'
0:tilde
@@ -156,6 +183,9 @@ F:regression test workers/31611
>line: {tst word:/}{}
# Test for regression introduced by workers/41242, raised in workers/43842
+ if [[ $OSTYPE = cygwin ]]; then
+ ZTST_skip="\\ is equivalent to / in pathname on cygwin"
+ else
{
mkdir sortnobslash
touch sortnobslash/{'!foo','#foo','\foo','|foo','~foo',Afoo,bfoo}
@@ -165,6 +195,7 @@ F:regression test workers/31611
comptesteval 'LC_ALL=$old_LC_ALL'
rm -rf sortnobslash
}
+ fi
0:ignore backslashes when sorting completion matches
>line: {: sortnobslash/}{}
>DESCRIPTION:{file}
@@ -216,6 +247,16 @@ F:regression test workers/31611
>NO:{3pm}
>NO:{10pm}
+ comptesteval "_tst() { _arguments ':desc:_sequence compadd - 1 2 3' }"
+ comptesteval "zstyle ':completion:*:tst:*' ignored-patterns 2"
+ comptest $'tst 1,\t'
+ comptesteval "zstyle -d ':completion:*:tst:*' ignored-patterns"
+0:-F does not break _sequence
+>line: {tst 1,}{}
+>DESCRIPTION:{desc}
+>NO:{2}
+>NO:{3}
+
comptest $'a=() b=(\t'
0:multiple envarrays
>line: {a=() b=(}{}
@@ -225,6 +266,74 @@ F:regression test workers/31611
>FI:{file1}
>FI:{file2}
+ comptesteval "typeset -a bar=({$'\\0'..$'\\C-?'})"
+ comptesteval 'typeset -A bat=( "$bar[@]" )'
+ comptesteval 'typeset bay="$bar"'
+ comptesteval 'zstyle ":completion:*:parameters" extra-verbose yes'
+ comptesteval 'zstyle ":completion:*" fake-parameters bar bat bay'
+ comptest $': $ba\t'
+0:extra-verbose shows parameter values
+>line: {: $ba}{}
+>DESCRIPTION:{parameter}
+>NO:{bar -- ( '^@' '^A' '^B' '^C' '^D' '^E' '^F' '^G' '^H' '\t' '\n' '^K' '^L' '}
+>NO:{bat -- ( [' ']='!' ['"']='#' ['$']=% ['&']=\' ['(']=')' ['*']=+ [,]=- [.]=/}
+>NO:{bay -- '^@ ^A ^B ^C ^D ^E ^F ^G ^H \t \n ^K ^L ^M ^N ^O ^P ^Q ^R ^S ^T ^U ^}
+
+ comptesteval "path=( $ZTST_srcdir:A )"
+ comptesteval 'typeset -H paths=HIDDEN'
+ comptest $': $path\t'
+0:extra-verbose doesn't show special or hidden parameter values
+>line: {: $path}{}
+>DESCRIPTION:{parameter}
+>NO:{path}
+>NO:{paths}
+
+ comptesteval 'zstyle -d ":completion:*:parameters" extra-verbose'
+ comptest $': $ba\t'
+0:parameter values not shown without extra-verbose
+>line: {: $ba}{}
+>DESCRIPTION:{parameter}
+>NO:{bar}
+>NO:{bat}
+>NO:{bay}
+
+ comptesteval '_tst() { local disp=( {a..z} ); compadd -ld disp $disp[@]; comppostfuncs=( _pst ) }'
+ comptesteval '_pst() { local disp=( "<INSERT>$compstate[insert]</INSERT>" ); compadd -Qld disp $disp }'
+ comptesteval "zstyle ':completion:*' menu select=long-list"
+ # This test is sensitive to sorting differences across platforms
+ comptesteval 'export LC_ALL=C'
+ comptest $'tst \C-d'
+ comptesteval "export LC_ALL=${(q)ZSH_TEST_LANG}"
+0: menu select=long-list starts menu selection for list widgets
+>NO:{<INSERT>menu</INSERT>}
+>NO:{a}
+>NO:{b}
+>NO:{c}
+>NO:{d}
+>NO:{e}
+>NO:{f}
+>NO:{g}
+>NO:{h}
+>NO:{i}
+>NO:{j}
+>NO:{k}
+>NO:{l}
+>NO:{m}
+>NO:{n}
+>NO:{o}
+>NO:{p}
+>NO:{q}
+>NO:{r}
+>NO:{s}
+>NO:{t}
+>NO:{u}
+>NO:{v}
+>NO:{w}
+>NO:{x}
+>NO:{y}
+>NO:{z}
+
+
%clean
zmodload -ui zsh/zpty
diff --git a/Test/Y02compmatch.ztst b/Test/Y02compmatch.ztst
index e2f8e1a61..f28913867 100644
--- a/Test/Y02compmatch.ztst
+++ b/Test/Y02compmatch.ztst
@@ -11,9 +11,7 @@
# contains the compadd output.
%prep
- if [[ $OSTYPE = cygwin ]]; then
- ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
- elif ( zmodload zsh/zpty 2>/dev/null ); then
+ if ( zmodload zsh/zpty 2>/dev/null ); then
. $ZTST_srcdir/comptest
mkdir match.tmp
cd match.tmp
@@ -380,15 +378,26 @@
comp.graphics.rendering.misc comp.graphics.rendering.raytracing
comp.graphics.rendering.renderman)
test_code $example4_matcher example4_list
- comptest $'tst c.s.u\t'
-0:Documentation example using input c.s.u
+ comptest $'tst .s.u\t'
+0:r:|.=* should complete .s.u
+>line: {tst comp.sources.unix }{}
+>COMPADD:{}
+>INSERT_POSITIONS:{21}
+
+ example4b_matcher='r:[^.]||.=* r:|=*'
+ test_code $example4b_matcher example4_list
+ comptest $'tst .s.u\t^[bc\t'
+0f:r:[^.]||.=* should not complete .s.u, but should complete c.s.u
+>line: {tst .s.u}{}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
>line: {tst comp.sources.unix }{}
>COMPADD:{}
>INSERT_POSITIONS:{21}
test_code $example4_matcher example4_list
- comptest $'tst c.g.\ta\t.\tp\ta\tg\t'
-0:Documentation example using input c.g.\ta\t.\tp\ta\tg\t
+ comptest $'tst .g.\ta\t.\tp\ta\tg\t'
+0:r:|.=* should complete .g.
>line: {tst comp.graphics.}{}
>COMPADD:{}
>INSERT_POSITIONS:{18}
@@ -426,9 +435,32 @@
>COMPADD:{}
>INSERT_POSITIONS:{32}
+ test_code $example4b_matcher example4_list
+ comptest $'tst .g.\t^[bc\t'
+0f:r:[^.]||.=* should not complete .g., but should complete c.g.
+>line: {tst .g.}{}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
+>line: {tst comp.graphics.}{}
+>COMPADD:{}
+>INSERT_POSITIONS:{18}
+
test_code $example4_matcher example4_list
- comptest $'tst c...pag\t'
-0:Documentation example using input c...pag\t
+ comptest $'tst ...pag\t'
+0:r:|.=* should complete ...pag
+>line: {tst comp.graphics.apps.pagemaker }{}
+>COMPADD:{}
+>INSERT_POSITIONS:{32}
+
+ test_code $example4b_matcher example4_list
+ comptest $'tst ...pag\t^[bc\t^Fg^F^Fa\t'
+0f:r:[^.]||.=* should not complete ...pag or c...pag, but should complete c.g.a.p
+>line: {tst ...pag}{}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
+>line: {tst c...pag}{}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
>line: {tst comp.graphics.apps.pagemaker }{}
>COMPADD:{}
>INSERT_POSITIONS:{32}
@@ -446,8 +478,8 @@
example5_matcher='r:|[.,_-]=* r:|=*'
example5_list=(veryverylongfile.c veryverylongheader.h)
test_code $example5_matcher example5_list
- comptest $'tst v.c\tv.h\t'
-0:Documentation example using input v.c\t
+ comptest $'tst .c\t.h\t'
+0:r:|[.,_-]=* should complete .c and .h
>line: {tst veryverylongfile.c }{}
>COMPADD:{}
>INSERT_POSITIONS:{23}
@@ -455,6 +487,23 @@
>COMPADD:{}
>INSERT_POSITIONS:{44}
+ example5b_matcher='r:[^.,_-]||[.,_-]=* r:|=*'
+ test_code $example5b_matcher example5_list
+ comptest $'tst .c\t^[bv\t.h\t^[bv\t'
+0f:r:[^.,_-]||[.,_-]=* should not complete .c or .h, but should complete v.c and v.h
+>line: {tst .c}{}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
+>line: {tst veryverylongfile.c }{}
+>COMPADD:{}
+>INSERT_POSITIONS:{23}
+>line: {tst veryverylongfile.c .h}{}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
+>line: {tst veryverylongfile.c veryverylongheader.h }{}
+>COMPADD:{}
+>INSERT_POSITIONS:{44}
+
example6_list=(LikeTHIS FooHoo 5foo123 5bar234)
test_code 'r:|[A-Z0-9]=* r:|=*' example6_list
@@ -495,16 +544,57 @@
example7_matcher="r:[^A-Z0-9]||[A-Z0-9]=** r:|=*"
example7_list=($example6_list)
test_code $example7_matcher example7_list
- comptest $'tst H\t2\t'
-0:Documentation example using "r:[^A-Z0-9]||[A-Z0-9]=** r:|=*"
+ comptest $'tst H\t^BF\to\t2\t^B5\tb\t'
+0f:r:[^A-Z0-9]||[A-Z0-9]=** should not complete H, FH, 2 or 52, but should complete FoH and 5b2.
+>line: {tst H}{}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
+>line: {tst F}{H}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
>line: {tst FooHoo }{}
>COMPADD:{}
>INSERT_POSITIONS:{10}
+>line: {tst FooHoo 2}{}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
+>line: {tst FooHoo 5}{2}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
+>line: {tst FooHoo 5bar234 }{}
+>COMPADD:{}
+>INSERT_POSITIONS:{18}
+
+ example7b_matcher="r:?||[A-Z0-9]=* r:|=*"
+ test_code $example7b_matcher example7_list
+ comptest $'tst H\t^BF2\t^B5\t'
+0f:r:?||[A-Z0-9]=* r:|=* should not complete H or 2, but should complete FH and 52.
+>line: {tst H}{}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
+>line: {tst FooHoo }{}
+>COMPADD:{}
+>INSERT_POSITIONS:{10}
+>line: {tst FooHoo 2}{}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
>line: {tst FooHoo 5bar234 }{}
>COMPADD:{}
>INSERT_POSITIONS:{18}
+ example8_list=(passwd.byname)
+ test_code 'r:[^.]||.=* l:.||[^.]=*'
+ comptest $'tst .^B\tpass^Fname\t'
+0f:r:[^.]||.=* and l:.||[^.]=* should work symmetrically.
+>line: {tst }{.}
+>COMPADD:{}
+>INSERT_POSITIONS:{}
+>line: {tst passwd.byname }{}
+>COMPADD:{}
+>INSERT_POSITIONS:{17}
+
+
workers_7311_matcher="m:{a-z}={A-Z} r:|[.,_-]=* r:|=*"
workers_7311_list=(Abc-Def-Ghij.txt Abc-def.ghi.jkl_mno.pqr.txt Abc_def_ghi_jkl_mno_pqr.txt)
test_code $workers_7311_matcher workers_7311_list
@@ -539,11 +629,11 @@
>COMPADD:{}
>INSERT_POSITIONS:{5}
- workers_11081_matcher='m:{a-zA-Z}={A-Za-z} r:|[.,_-]=* r:[^A-Z0-9]||[A-Z0-9]=* r:[A-Z0-9]||[^A-Z0-9]=* r:[^0-9]||[0-9]=* r:|=*'
+ workers_11081_matcher='m:{a-zA-Z}={A-Za-z} r:|[.,_-]=* r:|=*'
workers_11081_list=(build.out build.out1 build.out2)
test_code $workers_11081_matcher workers_11081_list
comptest $'tst bui\t\t\t'
-0:Bug from workers 11081
+0:Erratic completion bug from workers 11081: bui > build.out[] > build[.]out > build.out[] > build.out1[] > build.out2[]
>line: {tst build.out}{}
>COMPADD:{}
>INSERT_POSITIONS:{13}
@@ -580,7 +670,7 @@
workers_11586_list=(c00.abc c01.abc.def.00.0)
test_code $workers_11586_matcher workers_11586_list
comptest $'tst c00\t.\ta\t'
-0:Bug from workers 11586
+0:Disappearing characters bug from workers 11586: c00\t -> c0[], c00\t -> c0.abc[], c00.\t -> c0.abc[]
>line: {tst c00}{}
>COMPADD:{}
>INSERT_POSITIONS:{6}
@@ -613,12 +703,12 @@
>COMPADD:{}
>INSERT_POSITIONS:{22}
- workers_13320_matcher='r:|[.,_-]=** r:[^0-9]||[0-9]=**'
+ workers_13320_matcher='r:|[.,_-]=**'
workers_13320_list=(glibc-2.1.94-3.i386.rpm glibc-devel-2.1.94-3.i386.rpm)
workers_13320_list=($workers_13320_list glibc-profile-2.1.94-3.i386.rpm)
test_code $workers_13320_matcher workers_13320_list
comptest $'tst glibc-2.1\t'
-0:Test from workers 13320
+0:Incorrect cursor position bug from workers 13320: glibc-2.1\t -> glibc-2[.]1.94-3.i386.rpm
>line: {tst glibc}{-2.1.94-3.i386.rpm}
>COMPADD:{}
>INSERT_POSITIONS:{9:27}
@@ -643,11 +733,11 @@
>NO:{A.C}
- workers_13345b_matcher='r:|[.,_-]=** r:[^0-9]||[0-9]=**'
+ workers_13345b_matcher='r:|[.,_-]=** r:|[0-9]=**'
workers_13345b_list=(a-b_1_2_2 a-b_2_0.gz a-b_2_0.zip)
test_code $workers_13345b_matcher workers_13345b_list
comptest $'tst a-b_2\t'
-0:Second test from workers 13345
+0:Disappearing character bug from workers 13345: a-b_2\t -> a-b__
>line: {tst a-b_2_}{}
>COMPADD:{}
>INSERT_POSITIONS:{8:10}
diff --git a/Test/Y03arguments.ztst b/Test/Y03arguments.ztst
index fa4589374..200c83e8c 100644
--- a/Test/Y03arguments.ztst
+++ b/Test/Y03arguments.ztst
@@ -1,9 +1,7 @@
# Tests for _arguments.
%prep
- if [[ $OSTYPE = cygwin ]]; then
- ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
- elif ( zmodload zsh/zpty 2>/dev/null ); then
+ if ( zmodload zsh/zpty 2>/dev/null ); then
. $ZTST_srcdir/comptest
mkdir comp.tmp
cd comp.tmp
@@ -104,6 +102,28 @@
>NO:{+o}
>NO:{-o}
+ tst_arguments -s -{a,b,c} \!-{d,e,f} \!+{d,e,f}
+ comptest $'tst -ad\t\024\t\bef\t'
+0:mix of + and - and exclusion of stacked options
+>line: {tst -ad}{}
+>DESCRIPTION:{option}
+>NO:{-b}
+>NO:{-c}
+>line: {tst -da}{}
+>DESCRIPTION:{option}
+>NO:{-b}
+>NO:{-c}
+>line: {tst -def}{}
+>DESCRIPTION:{option}
+>NO:{-a}
+>NO:{-b}
+>NO:{-c}
+
+ tst_arguments -s -{a,b,c} +{a,b,c}
+ comptest $'tst -a +b +c\t'
+0:mix of + and - and exclusion of stacked options
+>line: {tst -a +b +ca}{}
+
tst_arguments '-o:1:(a):2:(b)'
comptest $'tst \t\t\t'
0:two option arguments
@@ -231,9 +251,15 @@
tst_arguments '-a:one: :two' ':descr:{compadd -Q - $opt_args[-a]}'
comptest $'tst -a 1:x \\2 \t'
-0:opt_args with multiple arguments and quoting of colons and backslashes
+0:opt_args with multiple arguments and quoting of colons and backslashes, part #1: default behaviour
>line: {tst -a 1:x \2 1\:x:\\2 }{}
+ # Same as previous test, except with -0 and (qqqq) added
+ tst_arguments -0 : '-a:one: :two' ':descr:{compadd -Q - ${(qqqq)opt_args[-a]}}'
+ comptest $'tst -a 1:x \\2 \t'
+0:opt_args with multiple arguments and quoting of colons and backslashes, part #2: NUL escaping
+>line: {tst -a 1:x \2 $'1:x\0\\2' }{}
+
tst_arguments -a -b
comptest $'tst rest -\t\C-w\eb\C-b-\t'
0:option completion with rest arguments on the line but not in the specs
@@ -355,6 +381,12 @@
0:allowed option before --
>line: {tst -x }{ --}
+ tst_arguments -S '1:one' '2:two'
+ comptest $'tst -- -- \t'
+0:only first of duplicate -- is ignored
+>line: {tst -- -- }{}
+>DESCRIPTION:{two}
+
tst_arguments -x :word
comptest $'tst word -\t'
0:option after a word
@@ -386,6 +418,25 @@
0:continue completion after rest argument that looks like an option
>line: {tst -a -x more }{}
+ tst_arguments -A '-*' -a -b '*: :(words)'
+ comptest $'tst -x -\t'
+0:word matching -A pattern doesn't exclude options
+>line: {tst -x -}{}
+>DESCRIPTION:{option}
+>NO:{-a}
+>NO:{-b}
+
+ tst_arguments -A '-*' -a -b '1:word:(word)'
+ comptest $'tst -x \t'
+0:unrecognised word matching -A pattern not treated as a rest argument
+>line: {tst -x word }{}
+
+ tst_arguments -A "-*" '(3)-a' '1:one' '2:two' '3:three' '4:four' '*:extra'
+ comptest $'tst x -a \t'
+0:exclusion from option following word matching -A pattern should not apply
+>line: {tst x -a }{}
+>DESCRIPTION:{three}
+
tst_arguments '*-v'
comptest $'tst -v -\t'
0:repeatable options
@@ -474,6 +525,16 @@
>NO:{-b}
>NO:{-v}
+ tst_arguments -a -b -c '(-a)1:one' '(-b)2:two' '(-c)*:extra'
+ comptest $'tst x y z\e6\C-b-\t'
+0:exclude option from normal argument to the right of the cursor
+>line: {tst -}{ x y z}
+>DESCRIPTION:{one}
+>DESCRIPTION:{option}
+>NO:{-a}
+>NO:{-b}
+>NO:{-c}
+
tst_arguments -a - set1 -d - set2 '(set2)-m' -n -o ':arg:(x)' - set2 -x
comptest $'tst -m \t'
0:exclude own set from an option
diff --git a/Test/Z01is-at-least.ztst b/Test/Z01is-at-least.ztst
new file mode 100644
index 000000000..039b3e737
--- /dev/null
+++ b/Test/Z01is-at-least.ztst
@@ -0,0 +1,27 @@
+%prep
+ autoload -Uz is-at-least
+
+%test
+
+ versions=(
+ 1 1.1 1.1.1 1.2 1.2.1
+ 2 2.1 2.1.1 2.2 2.2.1
+ 3 3.1 3.1.1 3.2 3.2.1
+ )
+ for (( i = 1; i <= $#versions; ++i)); do
+ for (( j = i+1; j <= $#versions; ++j)); do
+ is-at-least $versions[i] $versions[j] || echo "$versions[i] ≰ $versions[j]"
+ { ! is-at-least $versions[j] $versions[i] } || echo "$versions[j] ≤ $versions[i]"
+ done
+ done
+0:is-at-least smoke test
+
+ is-at-least 5.8.0.2 5.8
+1f:regression test: Two trailing zeroes are filled in
+# TODO: When fixing this, extend the smoke test to cover this.
+
+ is-at-least 5.8.0.2 5.8.0.0
+1:regression test: Two trailing zeroes are filled in
+# TODO: Extend the smoke test to cover this.
+
+%clean
diff --git a/Test/Z02zmathfunc.ztst b/Test/Z02zmathfunc.ztst
new file mode 100644
index 000000000..2be770a13
--- /dev/null
+++ b/Test/Z02zmathfunc.ztst
@@ -0,0 +1,58 @@
+%prep
+ autoload -Uz zmathfunc && zmathfunc
+
+%test
+
+ echo $(( min(42, 43) )) $(( max(42, 43) )) $(( sum(42, 43) ))
+ echo $(( min(42) )) $(( max(42) )) $(( sum(42) ))
+ echo $(( sum() ))
+0:basic functionality test
+>42 43 85
+>42 42 42
+>0
+
+
+ (set -e; echo $(( min(0, 42) )))
+ (set -e; echo $(( max(0, -42) )))
+ (set -e; echo $(( sum(42, -42) )))
+0:regression test for ERR_EXIT
+>0
+>0
+>0
+
+ echo $(( min(42, 43, 44) ))
+ echo $(( min(44, 42, 43) ))
+ echo $(( min(43, 44, 42) ))
+ #
+ echo $(( max(42, 43, 44) ))
+ echo $(( max(44, 42, 43) ))
+ echo $(( max(43, 44, 42) ))
+0:min() and max() with three arguments
+>42
+>42
+>42
+>44
+>44
+>44
+
+ echo $(( min() ))
+1:error test for min()
+?(eval):1: wrong number of arguments: min()
+
+ echo $(( max() ))
+1:error test for max()
+?(eval):1: wrong number of arguments: max()
+
+ zsh_math_func_min "foo bar" x y z
+2d:check errors from an unsupported use-case (workers/48156)
+# We expect one non-empty line of stderr, but don't care about the specific
+# error message; thus, the expectation is a pattern (*), for stderr (?), which
+# matches any non-empty string (?*).
+#
+# Sorry, Perl, but I had to give you a run for your money.
+*??*
+F:Calling zsh_math_func_min directly isn't a supported use-case, but if it
+F:returns zero, something's probably wrong.
+
+
+%clean
diff --git a/Test/Z03run-help.ztst b/Test/Z03run-help.ztst
new file mode 100644
index 000000000..ca8ba4d04
--- /dev/null
+++ b/Test/Z03run-help.ztst
@@ -0,0 +1,106 @@
+%prep
+ PAGER=cat
+ unalias run-help
+ autoload +X -Uz ${^fpath}/run-help*(N)
+ builtin() {
+ case "$1 $2" in
+ ( 'getln cmd_args' )
+ cmd_args="$BUFFER_STACK"
+ ;;
+ ( 'print -z' )
+ ;;
+ ( 'whence -va' )
+ print -l "$3 is WHENCE:{$3}"
+ ;;
+ ( * )
+ eval $@
+ ;;
+ esac
+ }
+ man() {
+ [[ $1 == -w && -n $NO_SUBCMD_MANUALS ]] &&
+ return 1
+ print "MAN:{${(qq)@}}"
+ }
+ git svn () {
+ print "${(U)0}:{${(qq)@}}"
+ }
+
+
+%test
+
+ BUFFER_STACK='btrfs --help'
+ run-help btrfs
+0:btrfs with option flag, no subcmd
+>btrfs is WHENCE:{btrfs}
+>MAN:{'btrfs'}
+
+ BUFFER_STACK='btrfs subvolume snapshot –r /btrfs/SV1 /btrfs/SV1-rosnap'
+ run-help btrfs
+0:btrfs with subcmd
+>btrfs is WHENCE:{btrfs}
+>MAN:{'btrfs-subvolume'}
+
+ BUFFER_STACK="sudo $BUFFER_STACK"
+ run-help btrfs
+0:sudo btrfs with subcmd
+>btrfs is WHENCE:{btrfs}
+>MAN:{'btrfs-subvolume'}
+
+ BUFFER_STACK='ip addr add 192.168.50.5 dev eth1'
+ run-help ip
+0:ip with subcmd
+>ip is WHENCE:{ip}
+>MAN:{'ip-address'}
+
+ NO_SUBCMD_MANUALS=1
+ run-help ip
+ unset NO_SUBCMD_MANUALS
+0:ip with subcmd, but no subcmd manuals
+>ip is WHENCE:{ip}
+>MAN:{'ip'}
+
+ BUFFER_STACK='ip -s -s link ls up'
+ run-help ip
+0:ip with options and subcmd
+>ip is WHENCE:{ip}
+>MAN:{'ip-link'}
+
+ BUFFER_STACK="sudo $BUFFER_STACK"
+ run-help ip
+0:sudo ip with options and subcmd
+>ip is WHENCE:{ip}
+>MAN:{'ip-link'}
+
+ BUFFER_STACK='svn -vq'
+ run-help svn
+0:svn with options
+>svn is WHENCE:{svn}
+>SVN:{'help'}
+
+ BUFFER_STACK+=' commit -m "log messages"'
+ run-help svn
+0:svn with options and subcmd
+>svn is WHENCE:{svn}
+>SVN:{'help' 'commit'}
+
+ BUFFER_STACK='git --exec-path'
+ run-help git
+0:git with option
+>git is WHENCE:{git}
+>GIT:{'help' 'git'}
+
+ BUFFER_STACK='git -C $PWD/.. difftool --no-prompt --tool opendiff --dir-diff'
+ run-help git
+0:git with option, file & subcmd
+>git is WHENCE:{git}
+>GIT:{'help' 'difftool'}
+
+ BUFFER_STACK='git -c http.proxy=someproxy clone https://github.com/user/repo.git'
+ run-help git
+0:git with option, assignment & subcmd
+>git is WHENCE:{git}
+>GIT:{'help' 'clone'}
+
+
+%clean
diff --git a/Test/comptest b/Test/comptest
index 166d0b404..79c69979a 100644
--- a/Test/comptest
+++ b/Test/comptest
@@ -40,6 +40,7 @@ KEYTIMEOUT=1
setopt zle
autoload -U compinit
compinit -u
+zstyle ":completion:*" completer _expand _complete _ignored
zstyle ":completion:*:default" list-colors "no=<NO>" "fi=<FI>" "di=<DI>" "ln=<LN>" "pi=<PI>" "so=<SO>" "bd=<BD>" "cd=<CD>" "ex=<EX>" "mi=<MI>" "tc=<TC>" "sp=<SP>" "lc=<LC>" "ec=<EC>\n" "rc=<RC>"
zstyle ":completion:*" group-name ""
zstyle ":completion:*:messages" format "<MESSAGE>%d</MESSAGE>
@@ -50,9 +51,9 @@ zstyle ":completion:*:options" verbose yes
zstyle ":completion:*:values" verbose yes
setopt noalwayslastprompt listrowsfirst completeinword
zmodload zsh/complist
-expand-or-complete-with-report () {
- print -lr "<WIDGET><expand-or-complete>"
- zle expand-or-complete
+complete-word-with-report () {
+ print -lr "<WIDGET><complete-word>"
+ zle complete-word
print -lr - "<LBUFFER>$LBUFFER</LBUFFER>" "<RBUFFER>$RBUFFER</RBUFFER>"
zle clear-screen
zle -R
@@ -80,11 +81,11 @@ zle-finish () {
(( $+mark )) && print -lr "MARK: $mark"
zle accept-line
}
-zle -N expand-or-complete-with-report
+zle -N complete-word-with-report
zle -N list-choices-with-report
zle -N comp-finish
zle -N zle-finish
-bindkey "^I" expand-or-complete-with-report
+bindkey "^I" complete-word-with-report
bindkey "^D" list-choices-with-report
bindkey "^Z" comp-finish
bindkey "^X" zle-finish
@@ -112,17 +113,26 @@ zpty_run() {
}
comptesteval () {
- local tmp=/tmp/comptest.$$
+ {
+ # Avoid symlink attacks on the predictable filename
+ # TODO: either use =(:) or create this file in the tests' workdir
+ local tmp=/tmp/comptest.$$
+ () {
+ setopt localoptions NO_CLOBBER ERR_EXIT
+ print -lr - "$@" > $tmp
+ } "$@"
- print -lr - "$@" > $tmp
- # zpty_flush Before comptesteval
- zpty -w zsh ". $tmp"
- zpty -r -m zsh log_eval "*<PROMPT>*" || {
- print "prompt hasn't appeared."
- return 1
- }
- zpty_flush After comptesteval
- rm $tmp
+ # zpty_flush Before comptesteval
+ zpty -w zsh ". ${(q)tmp}"
+ zpty -r -m zsh log_eval "*<PROMPT>*" || {
+ print "prompt hasn't appeared."
+ return 1
+ }
+ zpty_flush After comptesteval
+ : Suppress error from zpty_flush
+ } always {
+ rm $tmp
+ }
}
comptest () {
diff --git a/Test/runtests.zsh b/Test/runtests.zsh
index 562234d91..b66d579b6 100644
--- a/Test/runtests.zsh
+++ b/Test/runtests.zsh
@@ -7,7 +7,7 @@ emulate zsh
# protect from catastrophic failure of an individual test.
# We could probably do that with subshells instead.
-integer success failure skipped retval
+integer success=0 failure=0 skipped=0 retval
for file in "${(f)ZTST_testlist}"; do
$ZTST_exe +Z -f $ZTST_srcdir/ztst.zsh $file
retval=$?
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index 375efd16c..89fe69b5b 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -25,6 +25,7 @@ emulate -R zsh
# Ensure the locale does not screw up sorting. Don't supply a locale
# unless there's one set, to minimise problems.
[[ -n $LC_ALL ]] && LC_ALL=C
+[[ -n $LC_CTYPE ]] && LC_CTYPE=C
[[ -n $LC_COLLATE ]] && LC_COLLATE=C
[[ -n $LC_NUMERIC ]] && LC_NUMERIC=C
[[ -n $LC_MESSAGES ]] && LC_MESSAGES=C
@@ -36,8 +37,6 @@ typeset +x WORDCHARS
# Set the module load path to correspond to this build of zsh.
# This Modules directory should have been created by "make check".
[[ -d Modules/zsh ]] && module_path=( $PWD/Modules )
-# Allow this to be passed down.
-export MODULE_PATH
# We need to be able to save and restore the options used in the test.
# We use the $options variable of the parameter module for this.
@@ -60,7 +59,7 @@ ZTST_mainopts=(${(kv)options})
ZTST_testdir=$PWD
ZTST_testname=$1
-integer ZTST_testfailed
+integer ZTST_testfailed=0
# This is POSIX nonsense. Because of the vague feeling someone, somewhere
# may one day need to examine the arguments of "tail" using a standard
@@ -146,6 +145,19 @@ $ZTST_failmsg"
ZTST_testfailed=1
return 1
}
+ZTST_testxpassed() {
+ print -r "Test $ZTST_testname was expected to fail, but passed."
+ if [[ -n $ZTST_message ]]; then
+ print -r "Was testing: $ZTST_message"
+ fi
+ print -r "$ZTST_testname: test XPassed."
+ if [[ -n $ZTST_failmsg ]]; then
+ print -r "The following may (or may not) help identifying the cause:
+$ZTST_failmsg"
+ fi
+ ZTST_testfailed=1
+ return 1
+}
# Print messages if $ZTST_verbose is non-empty
ZTST_verbose() {
@@ -520,7 +532,7 @@ $ZTST_code"
return 1
fi
if (( expected_to_fail )); then
- ZTST_testfailed "test was expected to fail, but passed."
+ ZTST_testxpassed
return 1
fi
fi
diff --git a/Util/ztst-syntax.vim b/Util/ztst-syntax.vim
index a39fe3fbb..639b9a4ec 100644
--- a/Util/ztst-syntax.vim
+++ b/Util/ztst-syntax.vim
@@ -35,22 +35,22 @@ syn match ztstPayload /^\s.*/ contains=@zsh
syn match ztstExitCode /^\d\+\|^-/ nextgroup=ztstFlags
syn match ztstFlags /[.dDqf]*:/ contained nextgroup=ztstTestName contains=ztstColon
-syn match ztstColon /:/ contained
+syn match ztstColon /:.\@=/ contained
syn region ztstTestName start=// end=/$/ contained
-syn match ztstInputMarker /^</ nextgroup=ztstInput
+syn match ztstInputMarker /^<.\@=/ nextgroup=ztstInput
syn region ztstInput start=// end=/$/ contained
syn match ztstOutputPattern /^[*]>/ nextgroup=ztstOutput contains=ztstOutputPatternSigil,ztstOutputPatternMarker
syn match ztstOutputPatternSigil /[*]/ contained
-syn match ztstOutputPatternMarker /[>]/ contained conceal
-syn match ztstOutputLiteral /^>/ nextgroup=ztstOutput
+syn match ztstOutputPatternMarker /[>].\@=/ contained conceal
+syn match ztstOutputLiteral /^>.\@=/ nextgroup=ztstOutput
syn region ztstOutput start=// end=/$/ contained
syn match ztstErrputPattern /^[*][?]/ nextgroup=ztstErrput contains=ztstErrputPatternSigil,ztstErrputPatternMarker
syn match ztstErrputPatternSigil /[*]/ contained
-syn match ztstErrputPatternMarker /[?]/ contained conceal
-syn match ztstErrputLiteral /^[?]/ nextgroup=ztstErrput
+syn match ztstErrputPatternMarker /[?].\@=/ contained conceal
+syn match ztstErrputLiteral /^[?].\@=/ nextgroup=ztstErrput
syn region ztstErrput start=// end=/$/ contained
syn match ztstFrequentExplanationMarker /^F:/ nextgroup=ztstFrequentExplanation
@@ -75,6 +75,15 @@ syn keyword ztstSpecialVariable ZTST_unimplemented ZTST_skip ZTST_testdir ZTST_f
syn sync maxlines=1
"" Highlight groups:
+" Note: every group that's defaulted to "Ignore" has a match pattern that ends
+" with /.\@=/. This ensures the Ignore will only be effective if there is an
+" immediately following group that _will_ be highlighted. (That group will be
+" one of ztstTestName, ztstInput, ztstOutput, and ztstErrput.)
+"
+" ### The Ignore would still apply if the rest of the line is all-whitespace.
+" ###
+" ### If you run into such lines, consider setting the 'list' and 'listchars'
+" ### options appropriately.
hi def link ztstExitCode Number
hi def link ztstFlags Normal
hi def link ztstColon Ignore
diff --git a/Util/zyodl.vim b/Util/zyodl.vim
index 7acd1dfaf..7579365ac 100644
--- a/Util/zyodl.vim
+++ b/Util/zyodl.vim
@@ -12,6 +12,11 @@
" autocmd BufRead,BufNewFile **/Doc/Zsh/*.yo setfiletype zyodl
" Or alternatively:
" 1. Append the contents of Doc/Zsh/.vimrc to your .vimrc, changing «<sfile>» to «%».
+"
+" You may also wish to set:
+" autocmd FileType zyodl setlocal conceallevel=2
+" in order to benefit from the 'conceal' behaviour for LPAR(), RPAR(), and
+" friends.
"" Test case:
" texinode()()()()
@@ -49,7 +54,6 @@ syn region zyodlVar start="\<var(" end=")" contains=zyodlSpecial,zyodlPa
syn region zyodlBold start="\<bf(" end=")" contains=zyodlSpecial,zyodlParenthetical
syn region zyodlEmph start="\<em(" end=")" contains=zyodlSpecial,zyodlParenthetical
syn region zyodlIndex start="\<.index(" end=")" contains=zyodlSpecial
-syn match zyodlSpecial "+\?\<\(LPAR\|RPAR\|PLUS\)()"
syn match zyodlNumber "\d\+"
syn region zyodlItem start="\<xitem(" end=")" contains=zyodlSpecial,@zyodlInline
syn region zyodlItem start="\<item(" end=")" contains=zyodlSpecial,@zyodlInline
@@ -70,6 +74,19 @@ syn keyword zyodlKeyword sitem nextgroup=zyodlSItemArg1
syn region zyodlSItemArg1 oneline start="(" end=")" contains=zyodlSpecial,@zyodlInline nextgroup=zyodlSItemArg2 contained
syn region zyodlSItemArg2 start="(" end=")" contains=zyodlSpecial,@zyodlInline contained skip="\w\@<!([^)]*)"
+" Miscellany
+syn match zyodlLineJoiner /\\$/
+syn keyword zyodlNote note Note NOTE
+
+syn keyword zyodlBullet itemiz conceal cchar=•
+syn match zyodlSpecial "\<DASH()-" conceal cchar=—
+syn match zyodlSpecial "+\?LPAR()" conceal cchar=(
+syn match zyodlSpecial "+\?RPAR()" conceal cchar=)
+syn match zyodlSpecial "+\?_LPAR_" conceal cchar=(
+syn match zyodlSpecial "+\?_RPAR_" conceal cchar=)
+syn match zyodlSpecial "+\?PLUS()" conceal cchar=+
+syn match zyodlFAQDash "+\?\<emdash()" conceal cchar=—
+
"" Highlight groups:
hi def link zyodlTt Constant
hi def link zyodlVar Identifier
@@ -87,6 +104,11 @@ hi def link zyodlCond Conditional
hi def link zyodlRef Include
hi def link zyodlSItemArg1 Macro
hi def link zyodlSItemArg2 Underlined
+hi def link zyodlLineJoiner Special
+hi def link zyodlNote Todo
+
+"" Derived highlighting groups:
+hi def link zyodlFAQDash zyodlSpecial
let b:current_syntax = "zyodl"
let &cpo = s:cpo_save
diff --git a/aclocal.m4 b/aclocal.m4
index e91be3c0d..c26e2d834 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -35,14 +35,14 @@ ac_save_CFLAGS="$CFLAGS"
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" -Xc
do
CFLAGS="$ac_save_CFLAGS $ac_arg"
- AC_TRY_COMPILE(
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
[#ifndef __STDC__
choke me
#endif
-], [int test (int i, double x);
+]], [[int test (int i, double x);
struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};],
-[fp_cv_prog_cc_stdc="$ac_arg"; break])
+struct s2 {int (*f) (double a);};]])],
+[fp_cv_prog_cc_stdc="$ac_arg"; break],[])
done
CFLAGS="$ac_save_CFLAGS"
])
diff --git a/aczsh.m4 b/aczsh.m4
index 1200ace38..1209ac614 100644
--- a/aczsh.m4
+++ b/aczsh.m4
@@ -39,7 +39,7 @@ dnl before finding the right type.
dnl
AC_DEFUN(zsh_64_BIT_TYPE,
-[AC_TRY_RUN([
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@@ -50,7 +50,7 @@ main()
int bar = (int) foo;
return sizeof($1) != 8;
}
-], $2="$1", $2=no,
+]])],[$2="$1"],[$2=no],
[if test x$3 != x ; then
$2="$1"
else
@@ -113,11 +113,11 @@ void *zsh_getaddr1()
};
' > conftest1.c
sed 's/zsh_getaddr1/zsh_getaddr2/' < conftest1.c > conftest2.c
-if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AC_FD_CC); then
- AC_TRY_RUN([
+if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AS_MESSAGE_LOG_FD) &&
+AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD) &&
+AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AS_MESSAGE_LOG_FD) &&
+AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#ifdef HPUX10DYNAMIC
#include <dl.h>
@@ -170,7 +170,7 @@ main()
if(sym1 != sym2) exit(1);
exit(0);
}
-], [zsh_cv_shared_$1=yes],
+]])],[zsh_cv_shared_$1=yes],
[zsh_cv_shared_$1=no],
[zsh_cv_shared_$1=no]
)
@@ -195,11 +195,11 @@ else
fi
echo 'int fred () { return 42; }' > conftest1.c
echo 'int fred () { return 69; }' > conftest2.c
-if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AC_FD_CC); then
- AC_TRY_RUN([
+if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AS_MESSAGE_LOG_FD) &&
+AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD) &&
+AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AS_MESSAGE_LOG_FD) &&
+AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#ifdef HPUX10DYNAMIC
#include <dl.h>
@@ -242,7 +242,7 @@ main()
if(!fred1 || !fred2) exit(1);
exit((*fred1)() != 42 || (*fred2)() != 69);
}
-], [zsh_cv_sys_dynamic_clash_ok=yes],
+]])],[zsh_cv_sys_dynamic_clash_ok=yes],
[zsh_cv_sys_dynamic_clash_ok=no],
[zsh_cv_sys_dynamic_clash_ok=no]
)
@@ -271,11 +271,11 @@ else
fi
echo 'int fred () { return 42; }' > conftest1.c
echo 'extern int fred(); int barney () { return fred() + 27; }' > conftest2.c
-if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AC_FD_CC); then
- AC_TRY_RUN([
+if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AS_MESSAGE_LOG_FD) &&
+AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD) &&
+AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AS_MESSAGE_LOG_FD) &&
+AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#ifdef HPUX10DYNAMIC
#include <dl.h>
@@ -316,7 +316,7 @@ main()
if(!barneysym) exit(1);
exit((*barneysym)() != 69);
}
-], [zsh_cv_sys_dynamic_rtld_global=yes],
+]])],[zsh_cv_sys_dynamic_rtld_global=yes],
[zsh_cv_sys_dynamic_rtld_global=no],
[zsh_cv_sys_dynamic_rtld_global=no]
)
@@ -341,11 +341,11 @@ else
us=
fi
echo 'extern int fred(); int barney () { return fred() + 27; }' > conftest1.c
-if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC); then
+if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AS_MESSAGE_LOG_FD) &&
+AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
save_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
- AC_TRY_RUN([
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#ifdef HPUX10DYNAMIC
#include <dl.h>
@@ -386,7 +386,7 @@ main()
}
int fred () { return 42; }
-], [zsh_cv_sys_dynamic_execsyms=yes],
+]])],[zsh_cv_sys_dynamic_execsyms=yes],
[zsh_cv_sys_dynamic_execsyms=no],
[zsh_cv_sys_dynamic_execsyms=no]
)
@@ -415,11 +415,11 @@ elif
us=
fi
echo 'extern int fred(); int barney() { return fred() + 27; }' > conftest1.c
- AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) &&
- AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC); then
+ AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AS_MESSAGE_LOG_FD) &&
+ AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
save_ldflags=$LDFLAGS
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS -s"
- AC_TRY_RUN([
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#ifdef HPUX10DYNAMIC
#include <dl.h>
@@ -460,7 +460,7 @@ main()
}
int fred () { return 42; }
-], [zsh_cv_sys_dynamic_strip_exe=yes],
+]])],[zsh_cv_sys_dynamic_strip_exe=yes],
[zsh_cv_sys_dynamic_strip_exe=no],
[zsh_cv_sys_dynamic_strip_exe=no]
)
@@ -485,9 +485,9 @@ else
us=
fi
echo 'int fred () { return 42; }' > conftest1.c
-if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) &&
-AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS -s conftest1.o $LIBS 1>&AC_FD_CC); then
- AC_TRY_RUN([
+if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AS_MESSAGE_LOG_FD) &&
+AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS -s conftest1.o $LIBS 1>&AS_MESSAGE_LOG_FD); then
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#ifdef HPUX10DYNAMIC
#include <dl.h>
@@ -526,7 +526,7 @@ main()
if(!fredsym) exit(1);
exit((*fredsym)() != 42);
}
-], [zsh_cv_sys_dynamic_strip_lib=yes],
+]])],[zsh_cv_sys_dynamic_strip_lib=yes],
[zsh_cv_sys_dynamic_strip_lib=no],
[zsh_cv_sys_dynamic_strip_lib=no]
)
@@ -544,9 +544,9 @@ dnl
AC_DEFUN(zsh_PATH_UTMP,
[AC_CACHE_CHECK([for $1 file], [zsh_cv_path_$1],
[for dir in /etc /usr/etc /var/adm /usr/adm /var/run /var/log ./conftest; do
- zsh_cv_path_$1=${dir}/$1
+ m4_foreach([file],[$@],[zsh_cv_path_$1=${dir}/file
test -f $zsh_cv_path_$1 && break
- zsh_cv_path_$1=no
+ ])zsh_cv_path_$1=no
done
])
AH_TEMPLATE([PATH_]translit($1, [a-z], [A-Z])[_FILE],
@@ -564,7 +564,7 @@ dnl
AC_DEFUN(zsh_TYPE_EXISTS,
[AC_CACHE_CHECK([for $2], [zsh_cv_type_exists_[]translit($2, [ ], [_])],
-[AC_TRY_COMPILE([$1], [$2 testvar;],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2 testvar;]])],
[zsh_cv_type_exists_[]translit($2, [ ], [_])=yes],
[zsh_cv_type_exists_[]translit($2, [ ], [_])=no])
])
@@ -583,7 +583,7 @@ dnl
AC_DEFUN(zsh_STRUCT_MEMBER,
[AC_CACHE_CHECK([for $3 in $2], [zsh_cv_struct_member_[]translit($2, [ ], [_])_$3],
-[AC_TRY_COMPILE([$1], [$2 testvar; testvar.$3;],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2 testvar; testvar.$3;]])],
[zsh_cv_struct_member_[]translit($2, [ ], [_])_$3=yes],
[zsh_cv_struct_member_[]translit($2, [ ], [_])_$3=no])
])
@@ -621,25 +621,25 @@ AC_SUBST(tzsh)dnl
AC_DEFUN(zsh_COMPILE_FLAGS,
[AC_ARG_ENABLE(cppflags,
- AC_HELP_STRING([--enable-cppflags=...], [specify C preprocessor flags]),
+ AS_HELP_STRING([--enable-cppflags=...], [specify C preprocessor flags]),
if test "$enableval" = "yes"
then CPPFLAGS="$1"
else CPPFLAGS="$enable_cppflags"
fi)
AC_ARG_ENABLE(cflags,
- AC_HELP_STRING([--enable-cflags=...], [specify C compiler flags]),
+ AS_HELP_STRING([--enable-cflags=...], [specify C compiler flags]),
if test "$enableval" = "yes"
then CFLAGS="$2"
else CFLAGS="$enable_cflags"
fi)
AC_ARG_ENABLE(ldflags,
- AC_HELP_STRING([--enable-ldflags=...], [specify linker flags]),
+ AS_HELP_STRING([--enable-ldflags=...], [specify linker flags]),
if test "$enableval" = "yes"
then LDFLAGS="$3"
else LDFLAGS="$enable_ldflags"
fi)
AC_ARG_ENABLE(libs,
- AC_HELP_STRING([--enable-libs=...], [specify link libraries]),
+ AS_HELP_STRING([--enable-libs=...], [specify link libraries]),
if test "$enableval" = "yes"
then LIBS="$4"
else LIBS="$enable_libs"
@@ -658,10 +658,10 @@ AC_DEFUN([zsh_CHECK_SOCKLEN_T],[
[zsh_cv_type_socklen_t],
[zsh_cv_type_socklen_t=
for zsh_type in socklen_t int "unsigned long" size_t ; do
- AC_TRY_COMPILE(
- [#include <sys/types.h>
- #include <sys/socket.h>],
- [extern int accept (int, struct sockaddr *, $zsh_type *);],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[#include <sys/types.h>
+ #include <sys/socket.h>]],
+ [[extern int accept (int, struct sockaddr *, $zsh_type *);]])],
[zsh_cv_type_socklen_t="$zsh_type"; break],
[]
)
@@ -680,17 +680,36 @@ AC_DEFUN(zsh_LIMIT_PRESENT,
[Define to 1 if ]$1[ is present (whether or not as a macro).])
AC_CACHE_CHECK([for limit $1],
zsh_cv_have_$1,
-[AC_TRY_COMPILE([
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#include <sys/resource.h>],
-[$1],
- zsh_cv_have_$1=yes,
- zsh_cv_have_$1=no)])
+#include <sys/resource.h>]],
+[[$1]])],
+ [zsh_cv_have_$1=yes],
+ [zsh_cv_have_$1=no])])
if test $zsh_cv_have_$1 = yes; then
AC_DEFINE(HAVE_$1)
fi])
+dnl Check whether rlmit $1, e.g. AS, is the same as rlmit $3, e.g. VMEM.
+dnl $2 is lowercase $1, $4 is lowercase $3.
+AC_DEFUN(zsh_LIMITS_EQUAL,
+[AH_TEMPLATE([RLIMIT_]$1[_IS_]$3,
+[Define to 1 if RLIMIT_]$1[ and RLIMIT_]$3[ both exist and are equal.])
+AC_CACHE_CHECK([if RLIMIT_]$1[ and RLIMIT_]$3[ are the same],
+zsh_cv_rlimit_$2_is_$4,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <sys/resource.h>]],
+[[static char x[(RLIMIT_$1 == RLIMIT_$3)? 1 : -1]]])],
+ [zsh_cv_rlimit_$2_is_$4=yes],
+ [zsh_cv_rlimit_$2_is_$4=no])])
+if test x$zsh_cv_rlimit_$2_is_$4 = xyes; then
+ AC_DEFINE(RLIMIT_$1_IS_$3)
+fi])
diff --git a/config.guess b/config.guess
index ae713942d..11fda528b 100755
--- a/config.guess
+++ b/config.guess
@@ -1,8 +1,8 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2019 Free Software Foundation, Inc.
+# Copyright 1992-2020 Free Software Foundation, Inc.
-timestamp='2019-05-28'
+timestamp='2020-04-26'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2019 Free Software Foundation, Inc.
+Copyright 1992-2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -99,6 +99,8 @@ tmp=
trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
set_cc_for_build() {
+ # prevent multiple calls if $tmp is already set
+ test "$tmp" && return 0
: "${TMPDIR=/tmp}"
# shellcheck disable=SC2039
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
@@ -262,6 +264,9 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
*:SolidBSD:*:*)
echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
exit ;;
+ *:OS108:*:*)
+ echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
+ exit ;;
macppc:MirBSD:*:*)
echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
exit ;;
@@ -271,12 +276,15 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
*:Sortix:*:*)
echo "$UNAME_MACHINE"-unknown-sortix
exit ;;
+ *:Twizzler:*:*)
+ echo "$UNAME_MACHINE"-unknown-twizzler
+ exit ;;
*:Redox:*:*)
echo "$UNAME_MACHINE"-unknown-redox
exit ;;
mips:OSF1:*.*)
- echo mips-dec-osf1
- exit ;;
+ echo mips-dec-osf1
+ exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
@@ -918,7 +926,7 @@ EOF
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
@@ -1621,6 +1629,12 @@ copies of config.guess and config.sub with the latest versions from:
https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and
https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+EOF
+
+year=`echo $timestamp | sed 's,-.*,,'`
+# shellcheck disable=SC2003
+if test "`expr "\`date +%Y\`" - "$year"`" -lt 3 ; then
+ cat >&2 <<EOF
If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to
@@ -1648,6 +1662,7 @@ UNAME_RELEASE = "$UNAME_RELEASE"
UNAME_SYSTEM = "$UNAME_SYSTEM"
UNAME_VERSION = "$UNAME_VERSION"
EOF
+fi
exit 1
diff --git a/config.h.in b/config.h.in
index bb49984db..9651ec202 100644
--- a/config.h.in
+++ b/config.h.in
@@ -445,15 +445,9 @@
/* Define to 1 if you have the `nice' function. */
#undef HAVE_NICE
-/* Define to 1 if you have NIS. */
-#undef HAVE_NIS
-
/* Define to 1 if you have the `nis_list' function. */
#undef HAVE_NIS_LIST
-/* Define to 1 if you have NISPLUS. */
-#undef HAVE_NIS_PLUS
-
/* Define to 1 if you have the `nl_langinfo' function. */
#undef HAVE_NL_LANGINFO
@@ -496,6 +490,9 @@
/* Define to 1 if you have the `posix_openpt' function. */
#undef HAVE_POSIX_OPENPT
+/* Define to 1 if the system supports `prctl' to change process name */
+#undef HAVE_PRCTL
+
/* Define to 1 if you have the `ptsname' function. */
#undef HAVE_PTSNAME
@@ -574,6 +571,9 @@
/* Define to 1 if RLIMIT_RTPRIO is present (whether or not as a macro). */
#undef HAVE_RLIMIT_RTPRIO
+/* Define to 1 if RLIMIT_RTTIME is present (whether or not as a macro). */
+#undef HAVE_RLIMIT_RTTIME
+
/* Define to 1 if RLIMIT_SBSIZE is present (whether or not as a macro). */
#undef HAVE_RLIMIT_SBSIZE
@@ -1150,10 +1150,6 @@
/* Define if sys/time.h and sys/select.h cannot be both included. */
#undef TIME_H_SELECT_H_CONFLICTS
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. This
- macro is obsolete. */
-#undef TIME_WITH_SYS_TIME
-
/* Define to 1 if all the kit for using /dev/ptmx for ptys is available. */
#undef USE_DEV_PTMX
diff --git a/config.sub b/config.sub
index 5b158ac41..973a2980a 100755
--- a/config.sub
+++ b/config.sub
@@ -1,8 +1,8 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2019 Free Software Foundation, Inc.
+# Copyright 1992-2020 Free Software Foundation, Inc.
-timestamp='2019-05-23'
+timestamp='2020-05-04'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -67,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2019 Free Software Foundation, Inc.
+Copyright 1992-2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -337,17 +337,14 @@ case $1 in
basic_machine=m88k-harris
os=sysv3
;;
- hp300)
+ hp300 | hp300hpux)
basic_machine=m68k-hp
+ os=hpux
;;
hp300bsd)
basic_machine=m68k-hp
os=bsd
;;
- hp300hpux)
- basic_machine=m68k-hp
- os=hpux
- ;;
hppaosf)
basic_machine=hppa1.1-hp
os=osf
@@ -360,10 +357,6 @@ case $1 in
basic_machine=i386-mach
os=mach
;;
- vsta)
- basic_machine=i386-pc
- os=vsta
- ;;
isi68 | isi)
basic_machine=m68k-isi
os=sysv
@@ -612,6 +605,10 @@ case $1 in
basic_machine=vax-dec
os=vms
;;
+ vsta)
+ basic_machine=i386-pc
+ os=vsta
+ ;;
vxworks960)
basic_machine=i960-wrs
os=vxworks
@@ -1346,11 +1343,11 @@ case $os in
| hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
| sym* | kopensolaris* | plan9* \
| amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
- | aos* | aros* | cloudabi* | sortix* \
+ | aos* | aros* | cloudabi* | sortix* | twizzler* \
| nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
| clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
| knetbsd* | mirbsd* | netbsd* \
- | bitrig* | openbsd* | solidbsd* | libertybsd* \
+ | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \
| ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \
| bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
| ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
@@ -1368,7 +1365,8 @@ case $os in
| powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
| skyos* | haiku* | rdos* | toppers* | drops* | es* \
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
- | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi*)
+ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
+ | nsk* | powerunix* | genode*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
qnx*)
@@ -1452,9 +1450,6 @@ case $os in
ns2)
os=nextstep2
;;
- nsk*)
- os=nsk
- ;;
# Preserve the version number of sinix5.
sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
diff --git a/configure b/configure
index c7e788f6f..992313a85 100755
--- a/configure
+++ b/configure
@@ -1498,7 +1498,8 @@ Optional Features:
run-time library dependencies)
--enable-cap enable the search for POSIX capabilities (may
require additional headers to be added by hand)
- --disable-gdbm turn off search for gdbm library
+ --enable-gdbm enable the search for the GDBM library (see the
+ zsh/db/gdbm module)
--disable-largefile omit support for large files
--enable-multibyte support multibyte characters
--enable-unicode9 compile with unicode9 character widths
@@ -2645,7 +2646,6 @@ as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H"
as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H"
as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H"
as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H"
-as_fn_append ac_header_c_list " sys/time.h sys_time_h HAVE_SYS_TIME_H"
as_fn_append ac_header_c_list " sys/param.h sys_param_h HAVE_SYS_PARAM_H"
as_fn_append ac_func_c_list " getpagesize HAVE_GETPAGESIZE"
@@ -3415,12 +3415,13 @@ then :
fi
+# Default off for licensing reasons
# Check whether --enable-gdbm was given.
if test ${enable_gdbm+y}
then :
enableval=$enable_gdbm; gdbm="$enableval"
else $as_nop
- gdbm=yes
+ gdbm=no
fi
@@ -4929,6 +4930,7 @@ do
CFLAGS="$ac_save_CFLAGS $ac_arg"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+
#ifndef __STDC__
choke me
#endif
@@ -6067,93 +6069,6 @@ fi
fi
-# Autoupdate added the next two lines to ensure that your configure
-# script's behavior did not change. They are probably safe to remove.
-
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-printf %s "checking for egrep... " >&6; }
-if test ${ac_cv_path_EGREP+y}
-then :
- printf %s "(cached) " >&6
-else $as_nop
- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
- then ac_cv_path_EGREP="$GREP -E"
- else
- if test -z "$EGREP"; then
- ac_path_EGREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- case $as_dir in #(((
- '') as_dir=./ ;;
- */) ;;
- *) as_dir=$as_dir/ ;;
- esac
- for ac_prog in egrep
- do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_EGREP" || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
- # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
- ac_count=0
- printf %s 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- printf "%s\n" 'EGREP' >> "conftest.nl"
- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_EGREP="$ac_path_EGREP"
- ac_path_EGREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_EGREP_found && break 3
- done
- done
- done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_EGREP"; then
- as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
-else
- ac_cv_path_EGREP=$EGREP
-fi
-
- fi
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-printf "%s\n" "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-
-
-
-# Obsolete code to be removed.
-if test $ac_cv_header_sys_time_h = yes; then
-
-printf "%s\n" "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
-
-fi
-# End of obsolete code.
-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5
printf %s "checking whether stat file-mode macros are broken... " >&6; }
if test ${ac_cv_header_stat_broken+y}
@@ -8744,7 +8659,6 @@ then :
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#define _POSIX_C_SOURCE 200809L
#include <sys/types.h>
#include <signal.h>
int
@@ -12172,6 +12086,44 @@ if test $zsh_cv_have_RLIMIT_RTPRIO = yes; then
fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for limit RLIMIT_RTTIME" >&5
+printf %s "checking for limit RLIMIT_RTTIME... " >&6; }
+if test ${zsh_cv_have_RLIMIT_RTTIME+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <sys/resource.h>
+int
+main (void)
+{
+RLIMIT_RTTIME
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ zsh_cv_have_RLIMIT_RTTIME=yes
+else $as_nop
+ zsh_cv_have_RLIMIT_RTTIME=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $zsh_cv_have_RLIMIT_RTTIME" >&5
+printf "%s\n" "$zsh_cv_have_RLIMIT_RTTIME" >&6; }
+
+if test $zsh_cv_have_RLIMIT_RTTIME = yes; then
+ printf "%s\n" "#define HAVE_RLIMIT_RTTIME 1" >>confdefs.h
+
+fi
+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for limit RLIMIT_POSIXLOCKS" >&5
printf %s "checking for limit RLIMIT_POSIXLOCKS... " >&6; }
if test ${zsh_cv_have_RLIMIT_POSIXLOCKS+y}
@@ -12369,10 +12321,6 @@ if test ${zsh_cv_rlimit_vmem_is_rss+y}
then :
printf %s "(cached) " >&6
else $as_nop
- if test "$cross_compiling" = yes
-then :
- zsh_cv_rlimit_vmem_is_rss=no
-else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -12381,46 +12329,35 @@ else $as_nop
#include <sys/time.h>
#endif
#include <sys/resource.h>
-int main()
+int
+main (void)
{
-int ret = 1;
-#if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_RSS)
-if (RLIMIT_RSS == RLIMIT_VMEM) ret = 0;
-#endif
-return ret;
+static char x[(RLIMIT_VMEM == RLIMIT_RSS)? 1 : -1]
+ ;
+ return 0;
}
_ACEOF
-if ac_fn_c_try_run "$LINENO"
+if ac_fn_c_try_compile "$LINENO"
then :
zsh_cv_rlimit_vmem_is_rss=yes
else $as_nop
zsh_cv_rlimit_vmem_is_rss=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $zsh_cv_rlimit_vmem_is_rss" >&5
printf "%s\n" "$zsh_cv_rlimit_vmem_is_rss" >&6; }
-
if test x$zsh_cv_rlimit_vmem_is_rss = xyes; then
printf "%s\n" "#define RLIMIT_VMEM_IS_RSS 1" >>confdefs.h
fi
-
-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if RLIMIT_VMEM and RLIMIT_AS are the same" >&5
printf %s "checking if RLIMIT_VMEM and RLIMIT_AS are the same... " >&6; }
if test ${zsh_cv_rlimit_vmem_is_as+y}
then :
printf %s "(cached) " >&6
else $as_nop
- if test "$cross_compiling" = yes
-then :
- zsh_cv_rlimit_vmem_is_as=no
-else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -12429,46 +12366,35 @@ else $as_nop
#include <sys/time.h>
#endif
#include <sys/resource.h>
-int main()
+int
+main (void)
{
-int ret = 1;
-#if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_AS)
-if (RLIMIT_AS == RLIMIT_VMEM) ret = 0;
-#endif
-return ret;
+static char x[(RLIMIT_VMEM == RLIMIT_AS)? 1 : -1]
+ ;
+ return 0;
}
_ACEOF
-if ac_fn_c_try_run "$LINENO"
+if ac_fn_c_try_compile "$LINENO"
then :
zsh_cv_rlimit_vmem_is_as=yes
else $as_nop
zsh_cv_rlimit_vmem_is_as=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $zsh_cv_rlimit_vmem_is_as" >&5
printf "%s\n" "$zsh_cv_rlimit_vmem_is_as" >&6; }
-
if test x$zsh_cv_rlimit_vmem_is_as = xyes; then
printf "%s\n" "#define RLIMIT_VMEM_IS_AS 1" >>confdefs.h
fi
-
-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if RLIMIT_RSS and RLIMIT_AS are the same" >&5
printf %s "checking if RLIMIT_RSS and RLIMIT_AS are the same... " >&6; }
if test ${zsh_cv_rlimit_rss_is_as+y}
then :
printf %s "(cached) " >&6
else $as_nop
- if test "$cross_compiling" = yes
-then :
- zsh_cv_rlimit_rss_is_as=no
-else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -12477,35 +12403,29 @@ else $as_nop
#include <sys/time.h>
#endif
#include <sys/resource.h>
-int main()
+int
+main (void)
{
-int ret = 1;
-#if defined(HAVE_RLIMIT_RSS) && defined(HAVE_RLIMIT_AS)
-if (RLIMIT_AS == RLIMIT_RSS) ret = 0;
-#endif
-return ret;
+static char x[(RLIMIT_RSS == RLIMIT_AS)? 1 : -1]
+ ;
+ return 0;
}
_ACEOF
-if ac_fn_c_try_run "$LINENO"
+if ac_fn_c_try_compile "$LINENO"
then :
zsh_cv_rlimit_rss_is_as=yes
else $as_nop
zsh_cv_rlimit_rss_is_as=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $zsh_cv_rlimit_rss_is_as" >&5
printf "%s\n" "$zsh_cv_rlimit_rss_is_as" >&6; }
-
if test x$zsh_cv_rlimit_rss_is_as = xyes; then
printf "%s\n" "#define RLIMIT_RSS_IS_AS 1" >>confdefs.h
fi
-
if test x$ac_cv_func_getrusage = xyes; then
ac_fn_c_check_member "$LINENO" "struct rusage" "ru_maxrss" "ac_cv_member_struct_rusage_ru_maxrss" "#include <sys/types.h>
#ifdef HAVE_SYS_TIME_H
@@ -12884,32 +12804,15 @@ fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for NIS" >&5
-printf %s "checking for NIS... " >&6; }
-if test ${zsh_cv_sys_nis+y}
-then :
- printf %s "(cached) " >&6
-else $as_nop
- test -f /usr/bin/ypcat && /usr/bin/ypcat passwd.byname > /dev/null 2>&1 && \
-zsh_cv_sys_nis=yes || zsh_cv_sys_nis=no
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $zsh_cv_sys_nis" >&5
-printf "%s\n" "$zsh_cv_sys_nis" >&6; }
-if test x$zsh_cv_sys_nis = xyes; then
- printf "%s\n" "#define HAVE_NIS 1" >>confdefs.h
-
- ac_fn_c_check_header_compile "$LINENO" "rpc/rpc.h" "ac_cv_header_rpc_rpc_h" "$ac_includes_default"
-if test "x$ac_cv_header_rpc_rpc_h" = xyes
+ac_fn_c_check_func "$LINENO" "prctl" "ac_cv_func_prctl"
+if test "x$ac_cv_func_prctl" = xyes
then :
+ printf "%s\n" "#define HAVE_PRCTL 1" >>confdefs.h
else $as_nop
- test -f /usr/include/tirpc/rpc/rpc.h && \
- CPPFLAGS="$CPPFLAGS -I/usr/include/tirpc"
-fi
-
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing yp_all" >&5
-printf %s "checking for library containing yp_all... " >&6; }
-if test ${ac_cv_search_yp_all+y}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing prctl" >&5
+printf %s "checking for library containing prctl... " >&6; }
+if test ${ac_cv_search_prctl+y}
then :
printf %s "(cached) " >&6
else $as_nop
@@ -12920,16 +12823,16 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
-char yp_all ();
+char prctl ();
int
main (void)
{
-return yp_all ();
+return prctl ();
;
return 0;
}
_ACEOF
-for ac_lib in '' nsl
+for ac_lib in '' c
do
if test -z "$ac_lib"; then
ac_res="none required"
@@ -12939,53 +12842,37 @@ do
fi
if ac_fn_c_try_link "$LINENO"
then :
- ac_cv_search_yp_all=$ac_res
+ ac_cv_search_prctl=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext
- if test ${ac_cv_search_yp_all+y}
+ if test ${ac_cv_search_prctl+y}
then :
break
fi
done
-if test ${ac_cv_search_yp_all+y}
+if test ${ac_cv_search_prctl+y}
then :
else $as_nop
- ac_cv_search_yp_all=no
+ ac_cv_search_prctl=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_yp_all" >&5
-printf "%s\n" "$ac_cv_search_yp_all" >&6; }
-ac_res=$ac_cv_search_yp_all
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_prctl" >&5
+printf "%s\n" "$ac_cv_search_prctl" >&6; }
+ac_res=$ac_cv_search_prctl
if test "$ac_res" != no
then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+ printf "%s\n" "#define HAVE_PRCTL 1" >>confdefs.h
fi
fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for NIS+" >&5
-printf %s "checking for NIS+... " >&6; }
-if test ${zsh_cv_sys_nis_plus+y}
-then :
- printf %s "(cached) " >&6
-else $as_nop
- test x$ac_cv_func_nis_list = xyes && test -f /usr/bin/nisls && \
- /usr/bin/nisls > /dev/null 2>&1 && \
-zsh_cv_sys_nis_plus=yes || zsh_cv_sys_nis_plus=no
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $zsh_cv_sys_nis_plus" >&5
-printf "%s\n" "$zsh_cv_sys_nis_plus" >&6; }
-if test x$zsh_cv_sys_nis_plus = xyes; then
- printf "%s\n" "#define HAVE_NIS_PLUS 1" >>confdefs.h
-
-fi
-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for utmp file" >&5
printf %s "checking for utmp file... " >&6; }
if test ${zsh_cv_path_utmp+y}
@@ -13037,6 +12924,8 @@ else $as_nop
for dir in /etc /usr/etc /var/adm /usr/adm /var/run /var/log ./conftest; do
zsh_cv_path_utmpx=${dir}/utmpx
test -f $zsh_cv_path_utmpx && break
+ zsh_cv_path_utmpx=${dir}/utx.active
+ test -f $zsh_cv_path_utmpx && break
zsh_cv_path_utmpx=no
done
@@ -13659,7 +13548,7 @@ else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
- #include <sys/socket.h>
+ #include <sys/socket.h>
int
main (void)
{
@@ -13714,7 +13603,7 @@ then :
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#ifdef __linux
+#if defined(__linux) || defined(__CYGWIN__)
#define _GNU_SOURCE 1
#endif
#include <stdlib.h>
@@ -13774,6 +13663,7 @@ fi
printf "%s\n" "$as_me: all functions found, multibyte support enabled" >&6;}
zsh_cv_c_unicode_support=yes
else
+ # Warns at the end of configure
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: missing functions, multibyte support disabled" >&5
printf "%s\n" "$as_me: missing functions, multibyte support disabled" >&6;}
zsh_cv_c_unicode_support=no
@@ -16719,6 +16609,21 @@ printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2
fi
+for manpage in `cd ${srcdir} && echo Doc/*.1`; do
+ if test x"$manpage" != x"Doc/*.1" && ! test -e "${manpage}"; then
+ cp ${srcdir}/${manpage} ./Doc/
+ fi
+done
+if ! test -e Doc/help.txt; then
+ cp ${srcdir}/Doc/help.txt ./Doc/
+fi
+mkdir -p ./Doc/help
+for helpfile in `cd ${srcdir} && echo Doc/help/*`; do
+ if test x"$helpfile" != x"Doc/help/*" && ! test -e "${helpfile}"; then
+ cp ${srcdir}/${helpfile} ./Doc/help/
+ fi
+done
+
eval "zshbin1=${bindir}"
eval "zshbin2=${zshbin1}"
eval "zshman1=${mandir}"
@@ -16762,14 +16667,23 @@ fi
echo "See config.modules for installed modules and functions.
"
-case x$LIBS in
- *-lgdbm*)
- echo "WARNING: zsh will be linked against libgdbm.
-This means the binary is covered by the GNU General Public License.
-This does not affect the source code.
-Run configure with --disable-gdbm if required."
- ;;
-esac
+if test x$zsh_cv_c_unicode_support != xyes; then
+ if test "x$zfuncs_absent" = x; then
+ # The user opted out.
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You have chosen to build without multibyte support." >&5
+printf "%s\n" "$as_me: WARNING: You have chosen to build without multibyte support." >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: This configuration may not be suitable for production use. It is known to cause errors in 'make test'. We strongly recommend to re-run configure with --enable-multibyte." >&5
+printf "%s\n" "$as_me: WARNING: This configuration may not be suitable for production use. It is known to cause errors in 'make test'. We strongly recommend to re-run configure with --enable-multibyte." >&2;}
+ else
+ # Some requisite functions are missing.
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Multibyte support cannot be enabled: some standard library functions are missing: $zfuncs_absent" >&5
+printf "%s\n" "$as_me: WARNING: Multibyte support cannot be enabled: some standard library functions are missing: $zfuncs_absent" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: This configuration may not be suitable for production use. It is known to cause errors in 'make test'. If your system provides those functions, we recommend to re-run configure appropriately." >&5
+printf "%s\n" "$as_me: WARNING: This configuration may not be suitable for production use. It is known to cause errors in 'make test'. If your system provides those functions, we recommend to re-run configure appropriately." >&2;}
+ # If your system doesn't have those functions, consider patching the
+ # test suite and sending the patch to zsh-workers@ for inclusion.
+ fi
+fi
exit 0
diff --git a/configure.ac b/configure.ac
index af8c5bba8..8bba78c56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,7 +28,7 @@ dnl
AC_INIT
AC_CONFIG_SRCDIR([Src/zsh.h])
AC_PREREQ([2.69])
-AC_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS([config.h])
dnl What version of zsh are we building ?
. ${srcdir}/Config/version.mk
@@ -444,9 +444,10 @@ dnl Do you want to look for capability support?
AC_ARG_ENABLE(cap,
AS_HELP_STRING([--enable-cap],[enable the search for POSIX capabilities (may require additional headers to be added by hand)]))
+# Default off for licensing reasons
AC_ARG_ENABLE(gdbm,
-AS_HELP_STRING([--disable-gdbm],[turn off search for gdbm library]),
-[gdbm="$enableval"], [gdbm=yes])
+AS_HELP_STRING([--enable-gdbm],[enable the search for the GDBM library (see the zsh/db/gdbm module)]),
+[gdbm="$enableval"], [gdbm=no])
dnl ------------------
dnl CHECK THE COMPILER
@@ -656,8 +657,6 @@ dnl ------------------
dnl CHECK HEADER FILES
dnl ------------------
AC_HEADER_DIRENT
-AC_HEADER_STDC
-AC_HEADER_TIME
AC_HEADER_STAT
AC_HEADER_SYS_WAIT
@@ -1136,8 +1135,7 @@ dnl Check for sigset_t. Currently I'm looking in
dnl <sys/types.h> and <signal.h>. Others might need
dnl to be added.
AC_CACHE_CHECK(for sigset_t, zsh_cv_type_sigset_t,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_C_SOURCE 200809L
-#include <sys/types.h>
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <signal.h>]], [[sigset_t tempsigset;]])],[zsh_cv_type_sigset_t=yes],[zsh_cv_type_sigset_t=no])])
AH_TEMPLATE([sigset_t],
[Define to `unsigned int' if <sys/types.h> or <signal.h> doesn't define])
@@ -1939,83 +1937,16 @@ zsh_LIMIT_PRESENT(RLIMIT_SIGPENDING)
zsh_LIMIT_PRESENT(RLIMIT_MSGQUEUE)
zsh_LIMIT_PRESENT(RLIMIT_NICE)
zsh_LIMIT_PRESENT(RLIMIT_RTPRIO)
+zsh_LIMIT_PRESENT(RLIMIT_RTTIME)
zsh_LIMIT_PRESENT(RLIMIT_POSIXLOCKS)
zsh_LIMIT_PRESENT(RLIMIT_NPTS)
zsh_LIMIT_PRESENT(RLIMIT_SWAP)
zsh_LIMIT_PRESENT(RLIMIT_KQUEUES)
zsh_LIMIT_PRESENT(RLIMIT_UMTXP)
-AH_TEMPLATE([RLIMIT_VMEM_IS_RSS],
-[Define to 1 if RLIMIT_VMEM and RLIMIT_RSS both exist and are equal.])
-AC_CACHE_CHECK(if RLIMIT_VMEM and RLIMIT_RSS are the same,
-zsh_cv_rlimit_vmem_is_rss,
-[AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <sys/types.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <sys/resource.h>
-int main()
-{
-int ret = 1;
-#if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_RSS)
-if (RLIMIT_RSS == RLIMIT_VMEM) ret = 0;
-#endif
-return ret;
-}]])],[zsh_cv_rlimit_vmem_is_rss=yes],[zsh_cv_rlimit_vmem_is_rss=no],[zsh_cv_rlimit_vmem_is_rss=no])])
-
-if test x$zsh_cv_rlimit_vmem_is_rss = xyes; then
- AC_DEFINE(RLIMIT_VMEM_IS_RSS)
-fi
-
-
-AH_TEMPLATE([RLIMIT_VMEM_IS_AS],
-[Define to 1 if RLIMIT_VMEM and RLIMIT_AS both exist and are equal.])
-AC_CACHE_CHECK(if RLIMIT_VMEM and RLIMIT_AS are the same,
-zsh_cv_rlimit_vmem_is_as,
-[AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <sys/types.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <sys/resource.h>
-int main()
-{
-int ret = 1;
-#if defined(HAVE_RLIMIT_VMEM) && defined(HAVE_RLIMIT_AS)
-if (RLIMIT_AS == RLIMIT_VMEM) ret = 0;
-#endif
-return ret;
-}]])],[zsh_cv_rlimit_vmem_is_as=yes],[zsh_cv_rlimit_vmem_is_as=no],[zsh_cv_rlimit_vmem_is_as=no])])
-
-if test x$zsh_cv_rlimit_vmem_is_as = xyes; then
- AC_DEFINE(RLIMIT_VMEM_IS_AS)
-fi
-
-
-AH_TEMPLATE([RLIMIT_RSS_IS_AS],
-[Define to 1 if RLIMIT_RSS and RLIMIT_AS both exist and are equal.])
-AC_CACHE_CHECK(if RLIMIT_RSS and RLIMIT_AS are the same,
-zsh_cv_rlimit_rss_is_as,
-[AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <sys/types.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <sys/resource.h>
-int main()
-{
-int ret = 1;
-#if defined(HAVE_RLIMIT_RSS) && defined(HAVE_RLIMIT_AS)
-if (RLIMIT_AS == RLIMIT_RSS) ret = 0;
-#endif
-return ret;
-}]])],[zsh_cv_rlimit_rss_is_as=yes],[zsh_cv_rlimit_rss_is_as=no],[zsh_cv_rlimit_rss_is_as=no])])
-
-if test x$zsh_cv_rlimit_rss_is_as = xyes; then
- AC_DEFINE(RLIMIT_RSS_IS_AS)
-fi
-
+zsh_LIMITS_EQUAL(VMEM, vmem, RSS, rss)
+zsh_LIMITS_EQUAL(VMEM, vmem, AS, as)
+zsh_LIMITS_EQUAL(RSS, rss, AS, as)
dnl --------------------------------------------
dnl Check for members of struct rusage
@@ -2133,44 +2064,18 @@ AH_TEMPLATE([HAVE_SETPROCTITLE],
AC_CHECK_FUNC(setproctitle,AC_DEFINE(HAVE_SETPROCTITLE),
AC_SEARCH_LIBS(setproctitle,util,AC_DEFINE(HAVE_SETPROCTITLE)))
-dnl -------------
-dnl CHECK FOR NIS
-dnl -------------
-AH_TEMPLATE([HAVE_NIS],
-[Define to 1 if you have NIS.])
-AC_CACHE_CHECK(for NIS, zsh_cv_sys_nis,
-[test -f /usr/bin/ypcat && /usr/bin/ypcat passwd.byname > /dev/null 2>&1 && \
-zsh_cv_sys_nis=yes || zsh_cv_sys_nis=no])
-if test x$zsh_cv_sys_nis = xyes; then
- AC_DEFINE(HAVE_NIS)
-dnl RPC is removed from glibc-2.26 and replaced by libtirpc
- AC_CHECK_HEADER(rpc/rpc.h, [],
- [test -f /usr/include/tirpc/rpc/rpc.h && \
- CPPFLAGS="$CPPFLAGS -I/usr/include/tirpc"])
-dnl Some systems (Solaris 2.x, Linux Redhat 5.x) require
-dnl libnsl (Network Services Library) to find yp_all
- AC_SEARCH_LIBS(yp_all, nsl)
-fi
-
-dnl -----------------
-dnl CHECK FOR NISPLUS
-dnl -----------------
-AH_TEMPLATE([HAVE_NIS_PLUS],
-[Define to 1 if you have NISPLUS.])
-AC_CACHE_CHECK(for NIS+, zsh_cv_sys_nis_plus,
-[test x$ac_cv_func_nis_list = xyes && test -f /usr/bin/nisls && \
- /usr/bin/nisls > /dev/null 2>&1 && \
-zsh_cv_sys_nis_plus=yes || zsh_cv_sys_nis_plus=no])
-if test x$zsh_cv_sys_nis_plus = xyes; then
- AC_DEFINE(HAVE_NIS_PLUS)
-fi
+dnl CHECK FOR prctl() FOR jobs -Z / ARGV0 when checking with ps -e
+AH_TEMPLATE([HAVE_PRCTL],
+[Define to 1 if the system supports `prctl' to change process name])
+AC_CHECK_FUNC(prctl,AC_DEFINE(HAVE_PRCTL),
+AC_SEARCH_LIBS(prctl,c,AC_DEFINE(HAVE_PRCTL)))
dnl ----------------------------------------
dnl CHECK FOR LOCATION OF {U,W}TMP{,X} FILES
dnl ----------------------------------------
zsh_PATH_UTMP(utmp)
zsh_PATH_UTMP(wtmp)
-zsh_PATH_UTMP(utmpx)
+zsh_PATH_UTMP(utmpx,utx.active)
zsh_PATH_UTMP(wtmpx)
dnl -------------------
@@ -2526,7 +2431,7 @@ if test x$ac_cv_have_dev_ptmx = xyes -o x$ac_cv_func_posix_openpt = xyes && \
test x$ac_cv_func_ptsname = xyes; then
AC_CACHE_CHECK([if /dev/ptmx is usable],
ac_cv_use_dev_ptmx,
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef __linux
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__linux) || defined(__CYGWIN__)
#define _GNU_SOURCE 1
#endif
#include <stdlib.h>
@@ -2562,6 +2467,7 @@ wmemcpy wmemmove wmemset; do
AC_MSG_NOTICE([all functions found, multibyte support enabled])
zsh_cv_c_unicode_support=yes
else
+ # Warns at the end of configure
AC_MSG_NOTICE([missing functions, multibyte support disabled])
zsh_cv_c_unicode_support=no
fi
@@ -3267,6 +3173,22 @@ AC_CONFIG_COMMANDS([stamp-h], [echo >stamp-h])
AC_OUTPUT
+dnl Copy pre-built man pages and help files, for tarball out-of-tree builds.
+for manpage in `cd ${srcdir} && echo Doc/*.1`; do
+ if test x"$manpage" != x"Doc/*.1" && ! test -e "${manpage}"; then
+ cp ${srcdir}/${manpage} ./Doc/
+ fi
+done
+if ! test -e Doc/help.txt; then
+ cp ${srcdir}/Doc/help.txt ./Doc/
+fi
+mkdir -p ./Doc/help
+for helpfile in `cd ${srcdir} && echo Doc/help/*`; do
+ if test x"$helpfile" != x"Doc/help/*" && ! test -e "${helpfile}"; then
+ cp ${srcdir}/${helpfile} ./Doc/help/
+ fi
+done
+
eval "zshbin1=${bindir}"
eval "zshbin2=${zshbin1}"
eval "zshman1=${mandir}"
@@ -3310,13 +3232,18 @@ fi
echo "See config.modules for installed modules and functions.
"
-case x$LIBS in
- *-lgdbm*)
- echo "WARNING: zsh will be linked against libgdbm.
-This means the binary is covered by the GNU General Public License.
-This does not affect the source code.
-Run configure with --disable-gdbm if required."
- ;;
-esac
+if test x$zsh_cv_c_unicode_support != xyes; then
+ if test "x$zfuncs_absent" = x; then
+ # The user opted out.
+ AC_MSG_WARN([You have chosen to build without multibyte support.])
+ AC_MSG_WARN([This configuration may not be suitable for production use. It is known to cause errors in 'make test'. We strongly recommend to re-run configure with --enable-multibyte.])
+ else
+ # Some requisite functions are missing.
+ AC_MSG_WARN([Multibyte support cannot be enabled: some standard library functions are missing: $zfuncs_absent])
+ AC_MSG_WARN([This configuration may not be suitable for production use. It is known to cause errors in 'make test'. If your system provides those functions, we recommend to re-run configure appropriately.])
+ # If your system doesn't have those functions, consider patching the
+ # test suite and sending the patch to zsh-workers@ for inclusion.
+ fi
+fi
exit 0