head	2.2;
access;
symbols
	3_0_1:2.2
	3_0_0:2.1
	3_0-pre6:2.0
	3_0-pre5:2.0
	3_0-pre4:2.0
	beta15:1.1
	beta14:1.1
	beta13:1.1
	beta12:1.1
	beta11:1.1
	beta10:1.1
	3_0-pre3:2.0
	3_0-pre2:2.0
	3_0-pre1:2.0
	beta21:2.0
	beta20:2.0
	beta19:2.0
	beta18:2.0
	beta17:2.0
	beta16:2.0;
locks;
comment	@# @;


2.2
date	96.08.23.19.18.06;	author hzoli;	state Exp;
branches;
next	2.1;

2.1
date	96.08.15.15.09.54;	author hzoli;	state Exp;
branches;
next	2.0;

2.0
date	96.05.02.22.57.04;	author hzoli;	state Exp;
branches;
next	1.1;

1.1
date	94.11.08.07.01.18;	author zsh;	state Exp;
branches;
next	;


desc
@@


2.2
log
@fixed compctl handling
@
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
@


2.1
log
@new version from Bart with some modifications
@
text
@d27 1
a27 1
elif [[ -n "${HELPDIR:-}" && -r $HELPDIR/$1 ]]
@


2.0
log
@New maintainer: Zoltn Hidvgi <hzoli@@cs.elte.hu>
@
text
@d3 1
a3 1
# zsh script to peruse the help directory
d5 23
a27 9
if [[ $1 = "-l" ]]; then
  if [[ ${HELPDIR:-} != "" ]]; then
    echo 'Here is a list of topics for which help is available:'
    echo ""
    ls $HELPDIR
  else
    echo 'There is no help available at this time'
  fi
elif [[ ${HELPDIR:-} != "" && -r $HELPDIR/$1 ]]
d30 1
a30 2
else
    man $1
d32 42
@


1.1
log
@Initial revision
@
text
@@
