pash: better listing

This commit is contained in:
Dylan Araps 2019-11-30 16:29:32 +00:00
parent 86d72380ba
commit 3065aa621a
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 4 additions and 9 deletions

13
pash
View File

@ -84,15 +84,14 @@ pw_copy() {
} }
pw_list() { pw_list() {
set +f find . -type f -name \*.gpg | sed 's/..//;s/\.gpg$//'
find -- * -type f -name \*.gpg
} }
pw_tree() { pw_tree() {
command -v tree >/dev/null 2>&1 || command -v tree >/dev/null 2>&1 ||
die "'tree' command not found" die "'tree' command not found"
tree --noreport tree --noreport | sed 's/\.gpg$//'
} }
yn() { yn() {
@ -209,12 +208,8 @@ main() {
c*) pw_copy "$2" ;; c*) pw_copy "$2" ;;
d*) pw_del "$2" ;; d*) pw_del "$2" ;;
s*) pw_show "$2" ;; s*) pw_show "$2" ;;
l*) pw_list ;;
# TODO: Better handle the removal t*) pw_tree ;;
# of '.gpg' from list output.
l*) pw_list | sed 's/\.gpg$//' ;;
t*) pw_tree | sed 's/\.gpg$//' ;;
*) usage *) usage
esac esac
} }