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