--- 1/Completion/Zsh/Command/_run-help +++ 1/Completion/Zsh/Command/_run-help @@ -0,0 +1,7 @@ +#compdef run-help +local d expl +local HELPDIR=${HELPDIR:-/usr/share/zsh/$ZSH_VERSION/help} +[[ -d $HELPDIR ]] && { + d=($HELPDIR/*(:t)) + (($#d)) && _wanted commands expl 'command' compadd -a d +} || _man --- 1/Doc/Makefile.in +++ 1/Doc/Makefile.in @@ -33,6 +33,7 @@ VPATH = @srcdir@ sdir = @srcdir@ sdir_top = @top_srcdir@ +runhelpdir = @runhelpdir@ INSTALL = @INSTALL@ @DEFS_MK@ @@ -82,7 +83,7 @@ # ========== DEPENDENCIES FOR BUILDING ========== -all: man texi ../META-FAQ +all: man runhelp texi ../META-FAQ .PHONY: all everything: all dvi html pdf info @@ -183,6 +184,11 @@ man: $(MAN) .PHONY: man +runhelp: man + test x"$(runhelpdir)" = x"" || \ + ${SHELL} $(sdir)/generate-help.sh $(sdir_top) $(sdir)/runhelp $(lc_ctype) +.PHONY: runhelp + $(MAN): zmacros.yo zman.yo zsh.1 zshall.1: Zsh/intro.yo Zsh/metafaq.yo Zsh/invoke.yo Zsh/files.yo \ @@ -285,12 +291,12 @@ # ========== DEPENDENCIES FOR INSTALLING ========== -# install just installs the manual pages -install: install.man +# install just installs the manual and runhelp pages +install: install.man install.runhelp .PHONY: install -# uninstall just unistalls the manual pages -uninstall: uninstall.man +# uninstall just uninstalls the manual and runhelp pages +uninstall: uninstall.man uninstall.runhelp .PHONY: uninstall # install man pages, creating install directory if necessary @@ -302,6 +308,17 @@ done .PHONY: install.man +# install runhelp pages, creating install directory if necessary +install.runhelp: runhelp + if test x"$(runhelpdir)" != x""; then \ + ${SHELL} $(sdir_top)/mkinstalldirs $(DESTDIR)$(runhelpdir); \ + for file in $(sdir)/runhelp/*; do \ + $(INSTALL_DATA) $$file $(DESTDIR)$(runhelpdir); \ + test -h $$file && cp -P $$file $(DESTDIR)$(runhelpdir) || :; \ + done; \ + fi +.PHONY: install.runhelp + # install info pages, creating install directory if necessary install.info: texi ${SHELL} $(sdir_top)/mkinstalldirs $(DESTDIR)$(infodir) @@ -334,6 +349,11 @@ done .PHONY: uninstall.man +# uninstall runhelp pages +uninstall.runhelp: + test x"$(runhelpdir)" = x"" || rm -rf -- $(DESTDIR)$(runhelpdir) +.PHONY: uninstall.runhelp + # uninstall info pages uninstall.info: rm -f $(DESTDIR)$(infodir)/$(tzsh).info --- 1/Doc/generate-help.sh +++ 1/Doc/generate-help.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env sh + +Echo() { + printf '%s\n' "${*}" +} + +[ ${#} -ge 2 ] && test -f "${1}/Doc/zshbuiltins.1" || { Echo \ +'Usage: generate-help.sh zsh-sources-directory destination-directory [LC_CTYPE] +If you pass LC_CTYPE it must be utf8 aware. +If you do not pass LC_CTYPE a heuristics is used to guess some for your system' + exit 1 +} + +case ${1} in +/*) S=${1};; +*) S=${PWD}/${1};; +esac +D=${2} + +Die() { + Echo "generate-help.sh: fatal: ${*}" >&2 + exit 1 +} + +Info() { + Echo "generate-help.sh: ${*}" +} + +test -d "${D}" || mkdir -- "${D}" || Die "failed to create ${D}" + +# We need GROFF_NO_SGR to produce "classical" formatting: +export GROFF_NO_SGR= + +# This is self-explaining +export MANWIDTH=80 + +# In case the user has exported this, we restore the default: +unset MANPL MANROFFSEQ + +# Now we must prepare locales: +# Problem is LC_CTYPE since this must be utf8-aware for man to work properly. +# Since there is no standard utf8-aware locale, we must use heuristics. +unset LC_ALL LC_CTYPE +export LANG=C +if [ ${#} -eq 3 ] +then LC_CTYPE=${3} +else # Prefer en*utf8* (case ignored) over *utf8* over en*|*.* over rest + unset i j + for i in `locale -a 2>/dev/null` + do case ${i} in + en*[uU][tT][fF]8*) + LC_CTYPE=${i} + break;; + *[uU][tT][fF]8*) + [ -n "${LC_CTYPE}" ] || LC_CTYPE=${i};; + en*|*.*) + j=${i};; + esac + done + [ -n "${LC_CTYPE}" ] || [ -z "${j}" ] || LC_CTYPE=${j} +fi +if [ -z "${LC_CTYPE}" ] +then Info "LC_CTYPE unset" +else Info "LC_CTYPE=${LC_CTYPE}" + export LC_CTYPE +fi + +Info "generating files into ${D}" + +# It is necessary to be paranoid about the success of the following pipe, +# since any change in locale or environment can break it completely. +# In the lack of pipestatus, we better use temporary files +rm -f -- "${D}/tmp1" "${D}/tmp2" +man "${S}/Doc/zshbuiltins.1" >"${D}/tmp1" || Die 'man zshbuiltins.1 failed' +colcrt "${D}/tmp1" >"${D}/tmp2" || Die 'colcrt failed' +( cd -- "${D}" >/dev/null 2>&1 || Die "cannot cd to ${D}" +perl "${S}/Util/helpfiles"