support PAGER pipe for help output

This commit is contained in:
Brian Phillips
2009-12-02 08:55:46 -06:00
parent 0d5904658e
commit 9b580acf14

View File

@@ -787,7 +787,13 @@ case $action in
cleanup ;; cleanup ;;
"help" ) "help" )
help if [ -t 1 ] ; then # STDOUT is a TTY
if (exec which ${PAGER:-less} 2>/dev/null >/dev/null); then
# we have a working PAGER (or less as a default)
help | exec ${PAGER:-less}
fi
fi
help # just in case something failed above, we go ahead and just spew to STDOUT
;; ;;
"list" | "ls" ) "list" | "ls" )