Skip to content

Commit

Permalink
Lowercase match entire dataset to account for user error
Browse files Browse the repository at this point in the history
E.g. 100105 game field is not capitalized, unlike all other game fields
  • Loading branch information
p3lim committed Jul 20, 2023
1 parent 74392d4 commit 1becf8a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ elif [[ -z "$data" ]]; then
exit 1
fi

# lowercase entire dataset
data="$(tr A-Z a-z <<< "$data")"

# map interface versions
declare -A versions
versions[mainline]="$(jq -r --arg v 'Retail' '.[] | select(.game == $v) | .interface' <<< "$data" | sort -n -r | head -n1)"
versions[classic]="$(jq -r --arg v 'Classic' '.[] | select(.game == $v) | .interface' <<< "$data" | sort -n -r | head -n1)"
versions[bcc]="$(jq -r --arg v 'TBC-Classic' '.[] | select(.game == $v) | .interface' <<< "$data" | sort -n -r | head -n1)"
versions[wrath]="$(jq -r --arg v 'WOTLK-Classic' '.[] | select(.game == $v) | .interface' <<< "$data" | sort -n -r | head -n1)"
versions[mainline]="$(jq -r --arg v 'retail' '.[] | select(.game == $v) | .interface' <<< "$data" | sort -n -r | head -n1)"
versions[classic]="$(jq -r --arg v 'classic' '.[] | select(.game == $v) | .interface' <<< "$data" | sort -n -r | head -n1)"
versions[bcc]="$(jq -r --arg v 'tbc-classic' '.[] | select(.game == $v) | .interface' <<< "$data" | sort -n -r | head -n1)"
versions[wrath]="$(jq -r --arg v 'wotlk-classic' '.[] | select(.game == $v) | .interface' <<< "$data" | sort -n -r | head -n1)"

# ensure we have interface versions
if [[ -z "${versions[mainline]}" ]]; then
Expand Down

0 comments on commit 1becf8a

Please sign in to comment.