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

23
pash
View File

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