2025-09-28 Using pass the non standard way

Pass [1] is The Standard Unix Password Manager, a CLI bash script that I use to manage my private passwords and sensitive information at work.

It serves me well since 2017 but one thing that I never liked about it is the choice of using "tree" program to display list of passwords and search results. Unfortunately this is not configurable. I dislike "tree" output because with short file names it waste most of the terminal space. It also expands content of directories and output it produce doesn't allow to copy and paste file path. Essentially I always have to pipe pass output to less with extra flags to handle color escape codes.

Only recently I fixed those problems by changing source code [2] (which is just a single bash script). I'm using basic "ls" for listing and "find" for search results. With that I'm getting compact output with all my passwords on single terminal screen, I expand directories only when I want to and search results produce paths that can be copied and pasted.

I thought about contributing such change to repo but I found no elegant way to make those changes configurable. You can't rly do them with environment variables which are primary configuration strategy in pass. Also this change is not yet battle tested. My changes are simpler than "tree" version because I don't have to handle escape codes but I would not be surprised if there are some edge cases that I'm not handling.

[1] The Standard Unix Password Manager
[2] Pass git repo

Patch

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

 cmd_grep() {

EOF