[PATCH] feat: support exa

Wu Zhenyu wuzhenyu at ustc.edu
Thu Jan 19 09:28:15 UTC 2023


---
 src/password-store.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index 22e818f..0dd7e0b 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -402,7 +402,14 @@ 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
+		if command -v exa &> /dev/null; then
+			tree="exa --color=always --icons --tree"
+		elif command -v tree &> /dev/null; then
+			tree="tree -N -C -l --noreport"
+		else
+			die "Error: please install exa/tree firstly!"
+		fi
+		$tree "$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
 	elif [[ -z $path ]]; then
 		die "Error: password store is empty. Try \"pass init\"."
 	else
-- 
2.39.0


More information about the Password-Store mailing list