spm

simple password manager
git clone anongit@rnpnr.xyz:spm.git
Log | Files | Refs | Feed | README | LICENSE

Commit: e0d7a479f757e6b396f2d3d31c7311aa523b533f
Parent: 9d0021f8c50c5a9f59c8c46c7edc9c794348edb5
Author: Klemens Nanni
Date:   Sat, 22 Apr 2017 01:27:13 +0200

Make sure rm(1) is called directly, style fixes

Prevent invocations of rm(1) through user defined functions or aliases
that could cause the '-i' flag to be ignored.

Diffstat:
Mspm | 39+++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/spm b/spm @@ -58,9 +58,7 @@ find() { command find "${STORE_DIR}" -type f -o -type l | grep -Gie "${1}" } -view() { - less -EiKRX -} +alias view='less -EiKRX' ## Commands add() { @@ -86,7 +84,7 @@ list() { del() { entry=$(find "${1}" | head -n2) - check; rm -i "${entry}" && printf '\n' + check; command rm -i "${entry}" && printf '\n' } search() { @@ -104,22 +102,19 @@ show() { usage 'wrong number of arguments' case "${1}" in - add|del|search|show) - [ -z "${2:-}" ] && usage 'empty name' - ${1} "${2}" - ;; - list) - if [ "${2:-}" = -g ] && [ ${#} -le 3 ]; then - gflag=1; shift 1 - elif [ ${#} -gt 2 ]; then - usage 'too many arguments' - fi - list "${2:-}" - ;; - help) - usage - ;; - *) - usage 'invalid command' - ;; +add|del|search|show) + [ -z "${2:-}" ] && usage 'empty name' + ${1} "${2}" + ;; +list) + [ "${2:-}" = -g ] && gflag=1 && shift 1 + [ ${#} -gt 2 ] && usage 'too many arguments' + list "${2:-}" + ;; +help) + usage + ;; +*) + usage 'invalid command' + ;; esac