dotfiles/.local/bin/scripts/help

15 lines
673 B
Bash
Executable File

#!/bin/sh
# open info-page, man-page or buffered help flag
set -o pipefail
paginate="${PAGER:-less} +Gg"
case $1 in
(zsh|zmv) # https://unix.stackexchange.com/questions/19290/zmv-for-zsh-dry-runs-and-man-pages
search="${@:$#}"
# need to install zsh-doc package for info pages
info --vi-keys $(test $search != zsh && echo --index-search=$search) zsh || LESS="$LESS +/^ *${@:$#} *\\[" man zshall;;
(vlc) unbuffer vlc --full-help "${@:2}" | $paginate;;
(gh|chordpro) $@ --help | $paginate;;
(caddy) $1 help ${@:2} | $paginate;;
(*) man "$@" || { info "$1" -w | grep -v "manpages" && pinfo "$@"; } || ( "$@" --help || "$@" -help ) 2>&1 | $paginate;;
esac