spm

Personal fork of spm (simple password manager)

commit 44475a26bc2b8b643edb588deef5f31257bcf9cb
parent 5e6676a5a48ca73dc917707edb991fee79b5e4a6
Author: Sören Tempel <soeren+git@soeren-tempel.net>
Date: Fri, 25 Sep 2015 21:44:59 +0200

tpm improve input handling
1 file changed, 10 insertions(+), 3 deletions(-)
M
tpm
|
13
++++++++++---
diff --git a/tpm b/tpm
@@ -103,9 +103,16 @@ insert() {
 # Parse input
 ##
 
-case "${1}" in
-  "show")   show   "${2}" ;;
-  "insert") insert "${2}" ;;
+if [ $# -gt 2 ]; then
+  abort "tpm doesn't accept more than two arguments"
+fi
+
+cmd="${1}"
+shift
+
+case "${cmd}" in
+  "show")   show   "${@}" ;;
+  "insert") insert "${@}" ;;
   *) abort "USAGE: tpm COMMAND ENTRY" ;;
 esac