Skip to content

Commit

Permalink
Handle invalid user input
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdehaven committed Aug 26, 2021
1 parent 7c01c8b commit fa9f11d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion fetchurls.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

VERSION="v3.3.1"
VERSION="v3.4.0"

# Set Defaults
WGET_INSTALLED=0
Expand Down Expand Up @@ -494,6 +494,13 @@ elif [ -z "$USER_SAVE_LOCATION" ] && [ "$RUN_NONINTERACTIVE" -eq 1 ]; then
# Running non-interactive, so set to default
USER_SAVE_LOCATION="$DEFAULT_SAVE_LOCATION"
fi

# If user cleared out the default save location and continued, revert to back to default
if [ -z "$USER_SAVE_LOCATION" ]; then
USER_SAVE_LOCATION="$DEFAULT_SAVE_LOCATION"
echo "${COLOR_YELLOW}NOTE: Saving to default location '$USER_SAVE_LOCATION'${COLOR_RESET}"
fi

# Create directory if it does not exist
mkdir -p $USER_SAVE_LOCATION

Expand All @@ -510,6 +517,12 @@ elif [ -z "$USER_FILENAME" ] && [ "$RUN_NONINTERACTIVE" -eq 1 ]; then
USER_FILENAME="$GENERATED_FILENAME"
fi

# If user cleared out the default filename and continued, revert to back to default
if [ -z "$USER_FILENAME" ]; then
USER_FILENAME="$GENERATED_FILENAME"
echo "${COLOR_YELLOW}NOTE: Saving as '$USER_FILENAME'${COLOR_RESET}"
fi

# USER_EXCLUDED_EXTENTIONS
if [ -z "$USER_EXCLUDED_EXTENTIONS" ] && [ "$RUN_NONINTERACTIVE" -eq 0 ]; then
# Prompt user for excluded file extensions
Expand Down

0 comments on commit fa9f11d

Please sign in to comment.