diff options
author | Teddy Wing | 2018-04-18 23:42:04 +0200 |
---|---|---|
committer | Teddy Wing | 2018-04-18 23:44:28 +0200 |
commit | 383ed25682cbea2444223f08e7e00b08024b4bab (patch) | |
tree | 31feee67c02370111b41ef0ca1f7f253409795ae | |
parent | 2e2e18f87a4a125b6cd3ec87c66df20c5df87cdb (diff) | |
download | redprine-383ed25682cbea2444223f08e7e00b08024b4bab.tar.bz2 |
argument_error(): Exit after printing
I previously changed this to only print instead of print and exit
because that allowed me to show all errors for multiple missing required
arguments. The trouble was, the script would just keep running afterward
even with missing arguments.
To make things simpler, don't bother tracking all our requirements and
just fail fast after the first error so we don't end up executing the
program without all required data.
-rwxr-xr-x | redprine | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -175,16 +175,11 @@ function update_cache_with_new_pulls () { # update_cache_with_new_pulls "$pr_json" -function echo_error () { - local message="$1" - - echo "redprine: error: $message" 1>&2 -} function exit_with_error () { local message="$1" - echo_error "$message" + echo "redprine: error: $message" 1>&2 exit 1 } @@ -192,7 +187,7 @@ function exit_with_error () { function argument_error () { local flag="$1" - echo_error "Required argument '$flag' not provided, try --help" + exit_with_error "Required argument '$flag' not provided, try --help" } function check_required_argument () { |