[PATCH] Adds tree -d to cmd_show(){}
asdfasdfasdfasdf
fleskywood at gmail.com
Thu Mar 25 18:15:56 UTC 2021
>From 2208fda74260d7d07e38c51b58087bf7cff7a532 Mon Sep 17 00:00:00 2001
From: Beethoven <fleskywood at gmail.com>
Date: Mon, 22 Mar 2021 16:33:52 -0500
Subject: [PATCH] Adds tree -d to cmd_show(){}
tree is used, so tree -d should follow suit.
this patch adds a -d argument to cmd_show() to show only your folders.
might try and add regular ls support later if that's a thing i can do,
so that large amounts of folders take up less lines on a terminal
---
src/password-store.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/password-store.sh b/src/password-store.sh
index 77f3eda..4fe79f1 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -365,12 +365,13 @@ cmd_init() {
cmd_show() {
local opts selected_line clip=0 qrcode=0
- opts="$($GETOPT -o q::c:: -l qrcode::,clip:: -n "$PROGRAM" -- "$@")"
+ opts="$($GETOPT -o q::c::d:: -l qrcode::,clip:: -n "$PROGRAM" -- "$@")"
local err=$?
eval set -- "$opts"
while true; do case $1 in
-q|--qrcode) qrcode=1; selected_line="${2:-1}"; shift 2 ;;
-c|--clip) clip=1; selected_line="${2:-1}"; shift 2 ;;
+ -d|--dir) dir=1; selected_line="${2:-1}"; shift 2 ;;
--) shift; break ;;
esac done
@@ -400,6 +401,7 @@ cmd_show() {
else
echo "${path%\/}"
fi
+ [[ $dir -eq 1 ]] && tree -C -l -d --noreport "$PREFIX/$path" | tail
-n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' && exit # use
-d to tree -d your password store
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
elif [[ -z $path ]]; then
die "Error: password store is empty. Try \"pass init\"."
--
2.31.0
More information about the Password-Store
mailing list