[pass] [PATCH] Display only actual password entries (*.gpg)

Héctor Rivas Gándara keymon at gmail.com
Thu Apr 21 23:15:17 CEST 2016


Password stores might contain things that are not password entries -
for example, a README.md file, if uploaded to a service like GitLab
and used by multiple people. Such a file has no reason to be shown
by "pass show" or "pass find".

(Originally submitted by George Angelopoulos)
---
 src/password-store.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index 63be840..7ec4618 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -324,7 +324,7 @@ cmd_show() {
  else
  echo "${path%\/}"
  fi
- tree -C -l --noreport "$PREFIX/$path" | tail -n +2 | sed -E
's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of line,
but keep colors
+ tree -P '*.gpg' -C -l --noreport "$PREFIX/$path" | tail -n +2 | sed
-E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of
line, but keep colors
  elif [[ -z $path ]]; then
  die "Error: password store is empty. Try \"pass init\"."
  else
@@ -336,7 +336,7 @@ cmd_find() {
  [[ -z "$@" ]] && die "Usage: $PROGRAM $COMMAND pass-names..."
  IFS="," eval 'echo "Search Terms: $*"'
  local terms="*$(printf '%s*|*' "$@")"
- tree -C -l --noreport -P "${terms%|*}" --prune --matchdirs
--ignore-case "$PREFIX" | tail -n +2 | sed -E
's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g'
+ tree -C -l --noreport -P "${terms%|*}.gpg" --prune --matchdirs
--ignore-case "$PREFIX" | tail -n +2 | sed -E
's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g'
 }

 cmd_grep() {
-- 
2.7.2


More information about the Password-Store mailing list