dotfiles/.local/bin/scripts/help

15 lines
673 B
Plaintext
Raw Normal View History

#!/bin/sh
2021-07-29 14:02:20 +00:00
# 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;;
2021-09-20 06:57:20 +00:00
(caddy) $1 help ${@:2} | $paginate;;
2021-09-21 15:45:29 +00:00
(*) man "$@" || { info "$1" -w | grep -v "manpages" && pinfo "$@"; } || ( "$@" --help || "$@" -help ) 2>&1 | $paginate;;
esac