diff --git a/bin/sekrit.sh b/bin/sekrit.sh index 2789966..f6297a1 100644 --- a/bin/sekrit.sh +++ b/bin/sekrit.sh @@ -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 }