Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh: bad option, bash works

On 2011-12-20 at 11:46 +1100, Cameron Simpson wrote:
> Better, maybe, would be a "help" builtin for bash, zsh etc that
> documented builtins and other topics, and offered to divert to "man"
> as well (or on no hit).
> Hmm. I see "bash" has a help comment. Zsh doesn't.

zsh uses the run-help function and ZLE widget, and you can choose to
create per-builtin files at install time, or do so later and repoint
$HELPDIR to somewhere appropriate.

By default, with Emacs key-bindings, run-help is bound to Esc-H.

The RPM .spec I use at $work for building zsh does this:
----------------------------8< cut here >8------------------------------
# HELPDIR support
pushd $RPM_BUILD_ROOT%_datadir/zsh/%srcversion && {
        mkdir help && cd help && \
        man -M $RPM_BUILD_ROOT%_mandir zshbuiltins | colcrt - | perl $helpfiles
----------------------------8< cut here >8------------------------------

So I enter "type anything at all" at a command-prompt, enter Esc-H, get
the relevant documentation from the man-page, and *only* the relevant
documentation, for the word in the command position and when I quit the
text viewer, my command-line is still there waiting for me.

If you want:
  alias help=run-help
and you then have the help command you want.

I don't know why the HELPDIR content isn't generated by default in the
build-process, unless it's the Perl dependency.

Messages sorted by: Reverse Date, Date, Thread, Author