aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-04-18 23:42:04 +0200
committerTeddy Wing2018-04-18 23:44:28 +0200
commit383ed25682cbea2444223f08e7e00b08024b4bab (patch)
tree31feee67c02370111b41ef0ca1f7f253409795ae
parent2e2e18f87a4a125b6cd3ec87c66df20c5df87cdb (diff)
downloadredprine-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-xredprine9
1 files changed, 2 insertions, 7 deletions
diff --git a/redprine b/redprine
index 12cda44..7fb277d 100755
--- a/redprine
+++ b/redprine
@@ -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 () {