pash: Split list into list + tree

This commit is contained in:
Dylan Araps 2019-11-30 15:00:57 +00:00
parent 369514574b
commit fa4547f2de
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
2 changed files with 12 additions and 7 deletions

View File

@ -59,6 +59,7 @@ COMMANDS
[d]el [name] - Delete a password entry. [d]el [name] - Delete a password entry.
[l]ist - List all entries. [l]ist - List all entries.
[s]how [name] - Show password for an entry. [s]how [name] - Show password for an entry.
[t]ree - List all entries in a tree.
OPTIONS OPTIONS

16
pash
View File

@ -84,13 +84,15 @@ pw_copy() {
} }
pw_list() { pw_list() {
if command -v tree >/dev/null 2>&1; then
tree --noreport
else
set +f set +f
find -- * -type f -name \*.gpg find -- * -type f -name \*.gpg
fi }
pw_tree() {
command -v tree >/dev/null 2>&1 ||
die "'tree' command not found"
tree --noreport
} }
yn() { yn() {
@ -133,13 +135,14 @@ die() {
} }
usage() { printf %s "\ usage() { printf %s "\
pash 2.2.1 - simple password manager. pash 2.3.0 - simple password manager.
=> [a]dd [name] - Create a new password entry. => [a]dd [name] - Create a new password entry.
=> [c]opy [name] - Copy entry to the clipboard. => [c]opy [name] - Copy entry to the clipboard.
=> [d]el [name] - Delete a password entry. => [d]el [name] - Delete a password entry.
=> [l]ist - List all entries. => [l]ist - List all entries.
=> [s]how [name] - Show password for an entry. => [s]how [name] - Show password for an entry.
=> [t]ree - List all entries in a tree.
Using a key pair: export PASH_KEYID=XXXXXXXX Using a key pair: export PASH_KEYID=XXXXXXXX
Password length: export PASH_LENGTH=50 Password length: export PASH_LENGTH=50
@ -211,6 +214,7 @@ main() {
d*) pw_del "$2" ;; d*) pw_del "$2" ;;
s*) pw_show "$2" ;; s*) pw_show "$2" ;;
l*) pw_list | sed 's/\.gpg$//' ;; l*) pw_list | sed 's/\.gpg$//' ;;
t*) pw_tree ;;
*) usage *) usage
esac esac
} }