Hey guys,
I added an option to get a flat view of the stored passwords. Add
(-f|--flat) to the ls command to have the tree flattened.
I'm not really into building bash scripts, so the code might need some
improvements before being stable.
Yours,
Martin
--
Martin Vielsmaier
Softwareentwickler
Tel: +49 851-213728-0
Fax: +49 851-213728-88
E-Mail: [email protected]
crealytics GmbH - Profit Driven Search Marketing
Brunngasse 1
94032 Passau
http://www.crealytics.de/
Reg.-Gericht: Amtsgericht Passau, HRB 7466
Geschäftsführer: Andreas Reiffen, Christof König, Daniel Trost
diff --git a/src/password-store.sh b/src/password-store.sh
index 26a4bd0..af5d0d0 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -33,7 +33,7 @@ Usage:
$program init [--reencrypt,-e] gpg-id
Initialize new password storage and use gpg-id for encryption.
Optionally reencrypt existing passwords using new gpg-id.
- $program [ls] [subfolder]
+ $program [ls] [subfolder] [--flat|-f]
List passwords.
$program [show] [--clip,-c] pass-name
Show existing password and optionally put it on the clipboard.
@@ -192,17 +192,19 @@ fi
case "$command" in
show|ls|list)
clip=0
+ flat=0
- opts="$($GETOPT -o c -l clip -n "$program" -- "$@")"
+ opts="$($GETOPT -o cf -l clip,flat -n "$program" -- "$@")"
err=$?
eval set -- "$opts"
while true; do case $1 in
-c|--clip) clip=1; shift ;;
+ -f|--flat) flat=1; shift ;;
--) shift; break ;;
esac done
if [[ $err -ne 0 ]]; then
- echo "Usage: $program $command [--clip,-c] [pass-name]"
+ echo "Usage: $program $command [--clip,-c] [--flat,-f] [pass-name]"
exit 1
fi
@@ -213,7 +215,11 @@ case "$command" in
else
echo "${path%\/}"
fi
- tree --noreport "$PREFIX/$path" | tail -n +2 | sed 's/\(.*\)\.gpg$/\1/'
+ if [[ $flat -eq 1 ]]; then
+ find "$PREFIX/$path" -ls | awk '{print $11}' | sed s/`echo "$PREFIX/$path" | sed 's/\\//\\\\\\//g'`// | grep -v -E ".git|-id" | grep .gpg | sed 's/\.gpg//g' | sort
+ else
+ tree --noreport "$PREFIX/$path" | tail -n +2 | sed 's/\(.*\)\.gpg$/\1/'
+ fi
else
passfile="$PREFIX/$path.gpg"
if [[ ! -f $passfile ]]; then
_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/listinfo.cgi/password-store-zx2c4.com