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
# 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
#
# To the extent possible under law, the author(s) have dedicated all
@ -159,10 +159,14 @@ sekrit_has()
ls_key()
{
d=$SEKRIT_DIR$1
find "$d" -type f -name "*.gpg" |
sort |
sed -e "s#^$d##" -e 's#\.gpg$##'
if sekrit_has "$1" 2>/dev/null; then
echo "$1"
else
d=${SEKRIT_DIR%/}$1
find "$d" -type f -name "*.gpg" |
sort |
sed -e "s#^$d##" -e 's#\.gpg$##'
fi
}
sekrit_ls()
@ -171,9 +175,7 @@ sekrit_ls()
ls_key /
else
for key; do
printf "%s:\n" "$key"
ls_key "/$key/" | sed "s/^/ /"
printf "\n"
ls_key "/$key/"
done
fi
}