diff options
author | Steven Hall <Hallzy.18@gmail.com> | 2015-10-16 11:31:21 -0700 |
---|---|---|
committer | Steven Hall <Hallzy.18@gmail.com> | 2015-10-16 11:41:34 -0700 |
commit | b8797284031edbfd4c22f19f4878418cf4b2ec10 (patch) | |
tree | c34fb18605023a564a8a9c116ba654b253c91cc6 /git-radar | |
parent | 9e46dc2520728237e48f9fea879b85601a3aebf3 (diff) | |
download | git-sonar-b8797284031edbfd4c22f19f4878418cf4b2ec10.tar.gz git-sonar-b8797284031edbfd4c22f19f4878418cf4b2ec10.zip |
Made changes recommeneded by @michaeldfallen
in fetch.sh "if" now checks for $@ instead of just $1
in radar-base.sh there is now a parameter expansion on line 170 instead of the
if statements.
in git-radar, now there is a shift, and a regex check that the next value is a
number. If the next value after --fetch_t is not a number, an error is echo'd
and it resorts to the default behaviour of 5 minutes.
Diffstat (limited to '')
-rwxr-xr-x | git-radar | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -100,8 +100,19 @@ while [[ $# > 0 ]];do # Custom fetch of whatever time interval the user wants if [[ "$command" == "--fetch_t" ]]; then - # Now $1 is the value of fetch_t - nohup $dot/fetch.sh $1 >/dev/null 2>&1 & + # Now $1 is the value for fetch_t + # If value is not a number produce an error + if ! [[ $1 =~ ^[0-9]+$ ]] ; then + echo "" + echo "Error: fetch_t did not receive a number" + echo "Defaulting to 5 min." + echo " " + nohup $dot/fetch.sh >/dev/null 2>&1 & + else + command="$1" + shift + nohup $dot/fetch.sh $command >/dev/null 2>&1 & + fi fi if [[ "$command" == "--zsh" ]]; then |