diff options
Diffstat (limited to '')
| -rwxr-xr-x | fetch.sh | 2 | ||||
| -rwxr-xr-x | git-radar | 15 | ||||
| -rwxr-xr-x | radar-base.sh | 7 | 
3 files changed, 15 insertions, 9 deletions
| @@ -10,7 +10,7 @@ dot="$(cd "$(dirname "$([ -L "$0" ] && $READLINK_CMD -f "$0" || echo "$0")")"; p  source $dot/radar-base.sh -if [[ -z "$1" ]]; then +if [[ -z "$@" ]]; then    fetch;  else    fetch $1; @@ -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 diff --git a/radar-base.sh b/radar-base.sh index ee5fa00..886a6e9 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -167,12 +167,7 @@ time_to_update() {  }  fetch() { -  if [ -z "$1" ]; then -    # Default 5 minutes -    local timeToUpdate="$((5 * 60))" -  else -    local timeToUpdate="$1" -  fi +  local timeToUpdate = ${"$1":-"$((5 * 60))"}    if time_to_update $timeToUpdate; then      record_timestamp | 
