aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-04-25 02:50:12 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-04-25 02:50:12 +0200
commitfdf0699953bcbc48c390219d303503ceb81f0201 (patch)
treebfc49b39bf253bbb20a82f4feff932956513832d
parentPipe everything to a pager. (diff)
downloadpassword-store-pager.tar.xz
password-store-pager.zip
Only page when output is a tty.pager
-rwxr-xr-xsrc/password-store.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 6233a00..fbeef0e 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -18,11 +18,15 @@ CLIP_TIME="${PASSWORD_STORE_CLIP_TIME:-45}"
export GIT_DIR="${PASSWORD_STORE_GIT:-$PREFIX}/.git"
export GIT_WORK_TREE="${PASSWORD_STORE_GIT:-$PREFIX}"
-export LESS="${PASSWORD_STORE_LESS:-FRSXMK}"
-PAGER="${PAGER:-pager}"
-which "$PAGER" &>/dev/null || PAGER="less"
-which "$PAGER" &>/dev/null || PAGER="more"
-which "$PAGER" &>/dev/null || PAGER="cat"
+if [[ -t 1 ]]; then
+ export LESS="${PASSWORD_STORE_LESS:-FRSXMK}"
+ PAGER="${PAGER:-pager}"
+ which "$PAGER" &>/dev/null || PAGER="less"
+ which "$PAGER" &>/dev/null || PAGER="more"
+ which "$PAGER" &>/dev/null || PAGER="cat"
+else
+ PAGER="cat"
+fi
#
# BEGIN helper functions