diff options
author | Seppia <seppia@seppia.net> | 2018-05-30 01:47:52 +0200 |
---|---|---|
committer | Seppia <seppia@seppia.net> | 2018-05-30 01:47:52 +0200 |
commit | 34197addaeb85f5a51dde716265309643b769961 (patch) | |
tree | 271769bb60484e8454bac6b457bad71c00a41b9a | |
parent | 643050c24c76f20ea7eaa76c57e52d285b217a14 (diff) | |
download | repofish-34197addaeb85f5a51dde716265309643b769961.tar.gz repofish-34197addaeb85f5a51dde716265309643b769961.tar.bz2 repofish-34197addaeb85f5a51dde716265309643b769961.zip |
Variable and input checks
Now checks if hardcoded variables have been set and eventually if
their values are acceptable.
-rwxr-xr-x | repo.sh | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -109,7 +109,11 @@ print_help() { echo } -if [ "$1" == '' ]; then +if [ "${SRC_PATH}" == '' ];then + echo 'ERROR: SRC_PATH variable not set.' +elif [ ! -d "${SRC_PATH}" ]; then + echo 'ERROR: SRC_PATH variable set to invalid path.' +elif [ "$1" == '' ]; then echo 'warning: no command called.' elif [ "$1" == 'add' ]; then if [ "$3" != '' ]; then @@ -144,6 +148,12 @@ elif [ "$1" == 'list' ]; then elif [ "$1" == 'update' ]; then if [ "$3" != '' ]; then echo 'error: too many arguments.' + elif [ "${REPO_PATH}" == '' ];then + echo 'ERROR: REPO_PATH variable not set.' + elif [ ! -d "${REPO_PATH}" ]; then + echo 'ERROR: REPO_PATH variable set to invalid path.' + elif [ "${REPO_NAME}" == '' ];then + echo 'ERROR: REPO_NAME variable not set.' elif [ "$2" != '' ]; then update_repo $2 else |