spm

Personal fork of spm (simple password manager)

commit 17cc56061e392f7a3760fd791e4c8fe0bc162c31
parent 63ad505b4f2e883cd78c27bb57948370809929ad
Author: Klemens Nanni <kl3@posteo.org>
Date: Mon, 15 Aug 2016 22:10:18 +0200

Fix regression in 'list' command when used with '-g'

82e26fd fixed the parsing with regards to proper handling of too many
arguments but introduced a regression where 'spm list -g' would through
an error instead of listing groups only.
1 file changed, 5 insertions(+), 4 deletions(-)
M
spm.sh
|
9
+++++----
diff --git a/spm.sh b/spm.sh
@@ -115,10 +115,11 @@ case "${1}" in
 		${1}	"${2}"
 		;;
 	list)
-		[ "${2}" = -g ] \
-			&& groups_only=1 && shift 1 \
-			|| [ ${#} -eq 3 ] \
-				&& usage 'Wrong number of arguments'
+		if [ "${2}" = -g ] && [ ${#} -le 3 ]; then
+			groups_only=1 && shift 1
+		elif [ ${#} -gt 3 ]; then
+			usage 'Wrong number of arguments'
+		fi
 		list	"${2}"
 		;;
 	help)