From 5cf505b196b8624a72bccc418953aa337290decc Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 5 Aug 2015 23:58:10 +0200 Subject: cac help: $PAGER only on too many lines --- cac | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cac') diff --git a/cac b/cac index bcf745d..ed3d6e7 100755 --- a/cac +++ b/cac @@ -73,7 +73,13 @@ __cac_cli__help() {( # test -t expects GNU coreutils if test -t 0 >/dev/null 2>&1; then filter() { - $PAGER "$@" + help=$(cat) + echo "$help" | + if test $(echo "$help" | wc -l) -gt $(tput lines); then + $PAGER "$@" + else + cat "$@" + fi } else filter() { -- cgit v1.2.3