head	3.1;
branch	3.1.0;
access;
symbols;
locks;
comment	@# @;


3.1
date	96.10.30.23.41.13;	author hzoli;	state Exp;
branches
	3.1.0.0;
next	3.0;

3.0
date	96.10.30.23.39.35;	author hzoli;	state Exp;
branches
	3.0.1.0;
next	;

3.0.1.0
date	96.10.30.23.40.21;	author hzoli;	state Exp;
branches;
next	;

3.1.0.0
date	96.10.30.23.41.58;	author hzoli;	state Exp;
branches;
next	;


desc
@@


3.1
log
@# branch point
@
text
@#!/usr/local/bin/zsh
#
# Figure out where to get the best help, and get it.
#
# Install this function by placing it in your FPATH and then
# adding to your .zshrc the lines:
#	unalias run-help
#	autoload run-help
#
# Bart Schaefer <schaefer@@brasslantern.com>
#
emulate -R zsh				# Requires zsh 3.0-pre5 or later
setopt localoptions

# Check whether Util/helpfiles has been used to generate zsh help
if [[ $1 == "-l" ]]
then
    if [[ -n "${HELPDIR:-}" ]]
    then
	echo 'Here is a list of topics for which help is available:'
	echo ""
	print -rc $HELPDIR/*(:t)
    else
	echo 'There is no list of help topics available at this time'
    fi
    return 0
elif [[ -n "${HELPDIR:-}" && -r $HELPDIR/$1 && $1 != compctl ]]
then
    ${=PAGER:-more} $HELPDIR/$1
    return $?
fi

# No zsh help, use "whence" to figure out where else we might look
local what places newline='
'
integer i=0 didman=0

places=( "${(@@f)$(builtin whence -va $1)}" )

while ((i++ < $#places))
do
    what=$places[$i]
    builtin print -r $what
    case $what in
    (*( is an alias)*)
	[[ ${what[(w)6]:t} != ${what[(w)1]} ]] && run-help ${what[(w)6]:t}
	;;
    (*( is a * function))
	builtin functions ${what[(w)1]} | ${=PAGER:-more}
	;;
    (*( is a * builtin))
	case ${what[(w)1]} in
	(compctl) man zshcompctl;;
	(bindkey) man zshzle;;
	(*setopt) man zshoptions;;
	(*) man zshbuiltins;;
	esac
	;;
    (*( is hashed to *))
	man ${what[(w)-1]:t}
	;;
    (*)
	((! didman++)) && man $1
	;;
    esac
    if ((i < $#places && ! didman))
    then
	builtin print -nP "%SPress any key for more help or q to quit%s"
	builtin read -k what
	[[ $what != $newline ]] && echo
	[[ $what == [qQ] ]] && break
    fi
done
@


3.1.0.0
log
@# create 3.1.0 branch
@
text
@@


3.0
log
@# bounce the revision numbers to 3.0
@
text
@@


3.0.1.0
log
@# create 3.0.1 branch
@
text
@@
