From 2b45a1d3a29958e462d5a3ebb77263c7a6f37897 Mon Sep 17 00:00:00 2001 From: Stuart Hayhurst Date: Mon, 4 Jan 2021 17:53:38 +0000 Subject: [PATCH] Don't display excess spaces on warnings --- install.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index baee165..dec4982 100755 --- a/install.sh +++ b/install.sh @@ -501,20 +501,27 @@ warnArgs() { if [[ "$background" == "" ]] && [[ "$backgroundColour" == "" ]]; then output "error" "No background or colour specified, use -b to list available backgrounds" output "warning" " - Call the program with '-b [background]'" - exit 1 + return 1 fi if [[ "$background" != "" ]] && [[ "$backgroundColour" != "" ]]; then output "error" "Use either a background or a colour, not both" - exit 1 + return 1 fi if [[ "$backgroundColour" != "" ]] && ! checkCommand convert; then output "error" "Imagemagick / convert is required to use a custom background colour" - exit 1 + return 1 fi } if [[ "$programOperation" == "install" ]] || [[ "$programOperation" == "preview" ]]; then - echo ""; warnArgs; echo "" + argWarnings="$(warnArgs)" || argsFailed="true" + if [[ "$argWarnings" != "" ]]; then + echo ""; echo "$argWarnings"; echo "" + if [[ "$argsFailed" == "true" ]]; then + exit 1 + fi + fi + output "success" "Using the following settings:" output "list" "Resolution: ${resolution^}" if [[ "$background" != "" ]]; then