]> git.sven.stormbind.net Git - sven/scripts.git/commitdiff
change mpass behaviour when no command is given
authorSven Hoexter <sven@stormbind.net>
Thu, 13 Dec 2018 19:00:53 +0000 (20:00 +0100)
committerSven Hoexter <sven@stormbind.net>
Thu, 13 Dec 2018 19:00:53 +0000 (20:00 +0100)
In case no command is given we initialize() anyway, so we
can just act on the default[] repository. We just have to
ensure that our "$command" is always set, thus we can not
just use $1 in the main command parsing case conditional.

home/mpass.sh

index 8d88b6d7735cc35989d351e726d83b6647aabbc7..222349cd134f038a674bb48ca7a0a8d4059c958d 100755 (executable)
@@ -82,15 +82,11 @@ while getopts ":r:" option; do
   esac
 done
 
   esac
 done
 
-if [[ -z "${@}" ]]; then
-    echo "ERROR: no commands given" >&2
-    help
-fi
 
 
-# read our configuration
 initialize
 
 initialize
 
-case $1 in
+command=${1:-}
+case $command in
     pull)
        echo "Trying to update pass repo ${PASSWORD_STORE_DIR}"
        cd ${PASSWORD_STORE_DIR}
     pull)
        echo "Trying to update pass repo ${PASSWORD_STORE_DIR}"
        cd ${PASSWORD_STORE_DIR}
@@ -108,7 +104,6 @@ case $1 in
        cd -
        ;;
     *)
        cd -
        ;;
     *)
-       echo "Remaining pass commands: $@"
        pass ${@}
        ;;
 esac
        pass ${@}
        ;;
 esac