Skip to content

Commit

Permalink
Check for user settings if non-interactive is set. Fixes #12.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdehaven committed Dec 7, 2020
1 parent c07a779 commit a4a0b41
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fetchurls.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

VERSION="v3.2.3"
VERSION="v3.2.4"

# Set Defaults
WGET_INSTALLED=0
Expand Down Expand Up @@ -490,7 +490,7 @@ if [ -z "$USER_SAVE_LOCATION" ] && [ "$RUN_NONINTERACTIVE" -eq 0 ]; then
echo "${COLOR_RESET}"
echo "Save file to directory"
read -e -p "Location: ${COLOR_CYAN}" -i "${DEFAULT_SAVE_LOCATION}" USER_SAVE_LOCATION
else
elif [ -z "$USER_SAVE_LOCATION" ] && [ "$RUN_NONINTERACTIVE" -eq 1 ]; then
# Running non-interactive, so set to default
USER_SAVE_LOCATION="$DEFAULT_SAVE_LOCATION"
fi
Expand All @@ -505,7 +505,7 @@ if [ -z "$USER_FILENAME" ] && [ "$RUN_NONINTERACTIVE" -eq 0 ]; then
read -e -p "Filename (no file extension, and no spaces): ${COLOR_CYAN}" -i "${GENERATED_FILENAME}" USER_FILENAME
# Remove non-alpha-numeric characters (other than dash)
USER_FILENAME="$(echo "$USER_FILENAME" | sed 's/[^[:alnum:]-]/-/g')"
else
elif [ -z "$USER_FILENAME" ] && [ "$RUN_NONINTERACTIVE" -eq 1 ]; then
# Running non-interactive, so set to default
USER_FILENAME="$GENERATED_FILENAME"
fi
Expand All @@ -518,7 +518,7 @@ if [ -z "$USER_EXCLUDED_EXTENTIONS" ] && [ "$RUN_NONINTERACTIVE" -eq 0 ]; then
read -e -p "Excluded extensions: ${COLOR_CYAN}" -i "${DEFAULT_EXCLUDED_EXTENTIONS}" USER_EXCLUDED_EXTENTIONS
# Remove first and last character, if either is a pipe
USER_EXCLUDED_EXTENTIONS="$(echo "$USER_EXCLUDED_EXTENTIONS" | sed 's/^|//' | sed 's/|$//')"
else
elif [ -z "$USER_EXCLUDED_EXTENTIONS" ] && [ "$RUN_NONINTERACTIVE" -eq 1 ]; then
# Running non-interactive, so set to default
USER_EXCLUDED_EXTENTIONS="$DEFAULT_EXCLUDED_EXTENTIONS"
fi
Expand Down

0 comments on commit a4a0b41

Please sign in to comment.