sekrit: change ls output

Remove title, stop indenting, output single line if the parameter is
already a valid key.
This commit is contained in:
Lucas 2024-12-16 21:05:20 +00:00
parent 69657b77c3
commit 7abe623fee

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# sekrit # sekrit
# Written in 2018-2020,2022 by Lucas # Written in 2018-2020,2022,2024 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved # CC0 1.0 Universal/Public domain - No rights reserved
# #
# To the extent possible under law, the author(s) have dedicated all # To the extent possible under law, the author(s) have dedicated all
@ -159,10 +159,14 @@ sekrit_has()
ls_key() ls_key()
{ {
d=$SEKRIT_DIR$1 if sekrit_has "$1" 2>/dev/null; then
find "$d" -type f -name "*.gpg" | echo "$1"
sort | else
sed -e "s#^$d##" -e 's#\.gpg$##' d=${SEKRIT_DIR%/}$1
find "$d" -type f -name "*.gpg" |
sort |
sed -e "s#^$d##" -e 's#\.gpg$##'
fi
} }
sekrit_ls() sekrit_ls()
@ -171,9 +175,7 @@ sekrit_ls()
ls_key / ls_key /
else else
for key; do for key; do
printf "%s:\n" "$key" ls_key "/$key/"
ls_key "/$key/" | sed "s/^/ /"
printf "\n"
done done
fi fi
} }