1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-01 18:30:55 +01:00

49218: run-help filters cmd_args before calling run-help-<command>

This commit is contained in:
Marlon Richert 2021-09-06 13:45:36 -07:00 committed by Bart Schaefer
parent 35c87f0b3b
commit 1508dc7486
9 changed files with 125 additions and 26 deletions

View file

@ -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

View file

@ -1,7 +1,3 @@
while [[ $# != 0 && $1 == -* ]]; do
shift
done
case $1 in
(b*) man btrfs-balance ;;
(c*) man btrfs-check ;;

View file

@ -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}

View file

@ -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 ;;

View file

@ -2,4 +2,4 @@ if (( ! $# )); then
p4 help commands
else
p4 help $1
fi | ${=PAGER:-less}
fi | ${=PAGER:-more}

View file

@ -1 +1 @@
svk help ${${@:#-*}[1]} | ${=PAGER:-more}
svk help $1 | ${=PAGER:-more}

View file

@ -1 +1 @@
svn help ${${@:#-*}[1]} | ${=PAGER:-more}
svn help $1 | ${=PAGER:-more}