diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-04-25 02:50:12 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-04-25 02:50:12 +0200 |
commit | fdf0699953bcbc48c390219d303503ceb81f0201 (patch) | |
tree | bfc49b39bf253bbb20a82f4feff932956513832d | |
parent | Pipe everything to a pager. (diff) | |
download | password-store-pager.tar.xz password-store-pager.zip |
Only page when output is a tty.pager
-rwxr-xr-x | src/password-store.sh | 14 |
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 |