simplify listing and fix bug with category names.

This commit is contained in:
Dylan Araps 2019-02-26 09:43:26 +02:00
parent 8616243660
commit ca8f29c15e
1 changed files with 12 additions and 11 deletions

15
pash
View File

@ -37,7 +37,14 @@ pw_show() {
pw_list() { pw_list() {
shopt -s globstar nullglob shopt -s globstar nullglob
[[ $tree ]] && if [[ $tree ]]; then
tree
else
printf '%s\e[4D\e[K\n' **/*.gpg
fi
}
tree() {
printf '%s\n' "pash" printf '%s\n' "pash"
for pwrd in **; do for pwrd in **; do
@ -48,16 +55,10 @@ pw_list() {
pwrd=${pwrd//[^[:print:]]/^[} pwrd=${pwrd//[^[:print:]]/^[}
pwrd=${pwrd//.gpg} pwrd=${pwrd//.gpg}
if [[ -z $tree ]]; then
printf '%s\n' "$pwrd"
else
printf '%s\n' "${nest//\//│ }├─ ${pwrd##*/}${dir}" printf '%s\n' "${nest//\//│ }├─ ${pwrd##*/}${dir}"
dir= dir=
fi
done done
[[ $tree ]] &&
printf '└%s\b┘\n' "${nest//\//──┴}" printf '└%s\b┘\n' "${nest//\//──┴}"
} }