diff options
Diffstat (limited to 'etc')
-rwxr-xr-x | etc/functions/finfo | 2 | ||||
-rwxr-xr-x | etc/functions/help | 2 | ||||
-rwxr-xr-x | etc/functions/whichf | 7 |
3 files changed, 8 insertions, 3 deletions
diff --git a/etc/functions/finfo b/etc/functions/finfo index 87b8acd..a73606d 100755 --- a/etc/functions/finfo +++ b/etc/functions/finfo @@ -3,7 +3,7 @@ ## Assume that a function begins with an introduction, and print it typeset line -[[ -n $(whichf $1) ]] || return 1 +whichf $1 &> /dev/null || return 1 while read line; do [[ $line == \#* ]] || break diff --git a/etc/functions/help b/etc/functions/help index bb061ae..1b338b2 100755 --- a/etc/functions/help +++ b/etc/functions/help @@ -3,7 +3,7 @@ if man -w $1 &> /dev/null; then man $1 -elif [[ -n $(whichf $1) ]]; then +elif whichf $1 &> /dev/null; then finfo $1 elif (( ${+builtins[$1]} )); then man zshbuiltins | less -p " $1" diff --git a/etc/functions/whichf b/etc/functions/whichf index dc8d04b..01026c4 100755 --- a/etc/functions/whichf +++ b/etc/functions/whichf @@ -1,2 +1,7 @@ ## vim:ft=zsh -echo ${^fpath}/$1(-.N) +## locate the file corresponding to a function +if [[ -n $(echo ${^fpath}/$1(-.N)) ]] { + echo ${^fpath}/$1(-.N) +} else { + return 1 +} |