sekrit: code nits

This commit is contained in:
Lucas 2019-12-27 22:53:22 +00:00
parent 5d9c0c0830
commit c0f051acd7

View File

@ -90,7 +90,7 @@ sekrit_gen()
l) len=$(to_number "$OPTARG") || l) len=$(to_number "$OPTARG") ||
err "Invalid password length." err "Invalid password length."
;; ;;
[?]) usage *) usage
;; ;;
esac esac
done done
@ -116,7 +116,7 @@ sekrit_get()
shift shift
f=$SEKRIT_DIR/$key.gpg f=$SEKRIT_DIR/$key.gpg
[ ! -f "$f" ] && err "No data for key \"$key\"." [ -f "$f" ] || err "No data for key \"$key\"."
gpg2 -qd "$f" gpg2 -qd "$f"
} }
@ -133,8 +133,8 @@ sekrit_has()
ls_key() ls_key()
{ {
d=$SEKRIT_DIR$1 d=$SEKRIT_DIR$1
find "$d" -type f -name "*.gpg" | sort | cut -c $((${#d} + 1))- | find "$d" -type f -name "*.gpg" | sort |
sed "s/\.gpg$//" sed -e "s#^$d##" -e "s#\.gpg\$##"
} }
sekrit_ls() sekrit_ls()
@ -162,7 +162,7 @@ umask 077
mkdir -p "$SEKRIT_DIR" mkdir -p "$SEKRIT_DIR"
case "$cmd" in case "$cmd" in
add) sekrit_add "$@";; add) sekrit_add "$@" ;;
gen) sekrit_gen "$@" ;; gen) sekrit_gen "$@" ;;
get) sekrit_get "$@" ;; get) sekrit_get "$@" ;;
has) sekrit_has "$@" ;; has) sekrit_has "$@" ;;