summaryrefslogtreecommitdiffstats
path: root/Test
diff options
context:
space:
mode:
authorMarlon Richert <marlon.richert@gmail.com>2021-09-06 13:45:36 -0700
committerBart Schaefer <schaefer@ipost.com>2021-09-06 13:47:10 -0700
commit1508dc7486636edcb54e81f6a2fcf0faf180c7fa (patch)
treecdab91cbac7e0c0b1268111ab0266173b11a4da7 /Test
parentunposted (cf. 49202 and 49217): insertlastword ignores blank/missing history ... (diff)
downloadzsh-1508dc7486636edcb54e81f6a2fcf0faf180c7fa.tar
zsh-1508dc7486636edcb54e81f6a2fcf0faf180c7fa.tar.gz
zsh-1508dc7486636edcb54e81f6a2fcf0faf180c7fa.tar.bz2
zsh-1508dc7486636edcb54e81f6a2fcf0faf180c7fa.tar.lz
zsh-1508dc7486636edcb54e81f6a2fcf0faf180c7fa.tar.xz
zsh-1508dc7486636edcb54e81f6a2fcf0faf180c7fa.tar.zst
zsh-1508dc7486636edcb54e81f6a2fcf0faf180c7fa.zip
49218: run-help filters cmd_args before calling run-help-<command>
Diffstat (limited to 'Test')
-rw-r--r--Test/Z03run-help.ztst106
1 files changed, 106 insertions, 0 deletions
diff --git a/Test/Z03run-help.ztst b/Test/Z03run-help.ztst
new file mode 100644
index 000000000..2bb3bceed
--- /dev/null
+++ b/Test/Z03run-help.ztst
@@ -0,0 +1,106 @@
+%prep
+ PAGER=cat
+ unalias run-help
+ autoload +X -Uz $PWD/../Functions/Misc/run-help*
+ 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