Skip to content

Commit

Permalink
Merge pull request #32 from Akianonymus/fix2
Browse files Browse the repository at this point in the history
upload.sh: Fix longoptions argument capturing
  • Loading branch information
labbots committed May 4, 2020
2 parents 80a6a17 + ecce415 commit ca84da1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ setupArguments() {
case "$OPTION" in
# Parse longoptions # https://stackoverflow.com/questions/402377/using-getopts-to-process-long-and-short-command-line-options/28466267#28466267
-)
checkLongoptions() { [[ -z ${!OPTIND} ]] && printf '%s: --%s: option requires an argument\nTry '"%s -h/--help"' for more information.\n' "$0" "$OPTARG" "$0" && exit 1; }
checkLongoptions() { [[ -n ${!OPTIND} ]] && printf '%s: --%s: option requires an argument\nTry '"%s -h/--help"' for more information.\n' "${0##*/}" "$OPTARG" "${0##*/}" && exit 1 || :; }
case "$OPTARG" in
help)
usage
Expand Down Expand Up @@ -510,7 +510,7 @@ setupArguments() {
shorthelp
;;
*)
printf '%s: --%s: Unknown option\nTry '"%s -h/--help"' for more information.\n' "$0" "$OPTARG" "$0" && exit 1
printf '%s: --%s: Unknown option\nTry '"%s -h/--help"' for more information.\n' "${0##*/}" "$OPTARG" "${0##*/}" && exit 1
;;
esac
;;
Expand Down Expand Up @@ -578,10 +578,10 @@ setupArguments() {
DEBUG=true
;;
:)
printf '%s: -%s: option requires an argument\nTry '"%s -h/--help"' for more information.\n' "$0" "$OPTARG" "$0" && exit 1
printf '%s: -%s: option requires an argument\nTry '"%s -h/--help"' for more information.\n' "${0##*/}" "$OPTARG" "${0##*/}" && exit 1
;;
?)
printf '%s: -%s: Unknown option\nTry '"%s -h/--help"' for more information.\n' "$0" "$OPTARG" "$0" && exit 1
printf '%s: -%s: Unknown option\nTry '"%s -h/--help"' for more information.\n' "${0##*/}" "$OPTARG" "${0##*/}" && exit 1
;;
esac
done
Expand Down

0 comments on commit ca84da1

Please sign in to comment.