diff options
author | tv <tv@shackspace.de> | 2015-08-05 23:08:47 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-08-05 23:09:53 +0200 |
commit | 71ef6469e17e876d99555e55532a61758e51a25b (patch) | |
tree | ef5d6df092f77b69f45cb7b6fa853230b985f543 /cac | |
parent | 2a19b0ade0967ae0e9919fde722f370007699f5c (diff) |
cac help: invoke $PAGER when stdin is a terminal
Diffstat (limited to 'cac')
-rwxr-xr-x | cac | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -64,12 +64,22 @@ cac() { } #? cac help -#? Print this help message. +#? Show this help message. #? __cac_cli__help() {( + # test -t expects GNU coreutils + if test -t 0 >/dev/null 2>&1; then + filter() { + $PAGER "$@" + } + else + filter() { + cat "$@" + } + fi exec sed < "$0" -n ' s/^#?\( \(.*\)\)\?/\2/p - ' + ' | filter )} #? cac console SERVERSPEC |