From 9b580acf14d5f3cdcaac94b3bb0ef656f694b7dc Mon Sep 17 00:00:00 2001 From: Brian Phillips Date: Wed, 2 Dec 2009 08:55:46 -0600 Subject: [PATCH] support PAGER pipe for help output --- todo.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/todo.sh b/todo.sh index 2c38de4..879e12a 100755 --- a/todo.sh +++ b/todo.sh @@ -787,7 +787,13 @@ case $action in cleanup ;; "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" )