summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcac14
1 files changed, 12 insertions, 2 deletions
diff --git a/cac b/cac
index 08cc820..5762803 100755
--- a/cac
+++ b/cac
@@ -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