sekrit: code nits
This commit is contained in:
parent
5d9c0c0830
commit
c0f051acd7
@ -29,11 +29,11 @@ usage()
|
|||||||
{
|
{
|
||||||
cat - <<. >&2
|
cat - <<. >&2
|
||||||
Usage:
|
Usage:
|
||||||
${0##*/} add key [value ...]
|
${0##*/} add key [value ...]
|
||||||
${0##*/} gen [-l length] [chars]
|
${0##*/} gen [-l length] [chars]
|
||||||
${0##*/} get key
|
${0##*/} get key
|
||||||
${0##*/} has key
|
${0##*/} has key
|
||||||
${0##*/} ls [keys ...]
|
${0##*/} ls [keys ...]
|
||||||
|
|
||||||
If no value was provided on command line, add reads from stdin.
|
If no value was provided on command line, add reads from stdin.
|
||||||
.
|
.
|
||||||
@ -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 "$@" ;;
|
||||||
|
Loading…
Reference in New Issue
Block a user