diff mbox

[RFC,4/4] genimage.sh: add usage to die function

Message ID 20170418155554.28732-5-etienne.phelip@savoirfairelinux.com
State Changes Requested
Headers show

Commit Message

Phelip Etienne April 18, 2017, 3:55 p.m. UTC
This also re-indents the die function using tabulations.

Signed-off-by: Etienne Phelip <etienne.phelip@savoirfairelinux.com>
---
 support/scripts/genimage.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Arnout Vandecappelle April 18, 2017, 5:56 p.m. UTC | #1
Ah, sorry, I won't ack it :-)

On 18-04-17 17:55, Etienne Phelip wrote:
> This also re-indents the die function using tabulations.
> 
> Signed-off-by: Etienne Phelip <etienne.phelip@savoirfairelinux.com>
> ---
>  support/scripts/genimage.sh | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/support/scripts/genimage.sh b/support/scripts/genimage.sh
> index 50d6907..d0d3491 100755
> --- a/support/scripts/genimage.sh
> +++ b/support/scripts/genimage.sh
> @@ -1,8 +1,11 @@
>  #!/bin/bash
>  
>  die() {
> -  echo "Error: $@" >&2
> -  exit 1
> +	echo "Usage: ${0##*/} BINARIES_DIR -c GENIMAGE_CFG" >&2
> +	echo "" >&2
> +

 This empty line is not needed IMO.

> +	echo "Error: $@" >&2

 IMO Error should come first, then usage.

 And of course, to be compatible with Abhimanyu's patch, BINARIES_DIR should be
left out.

 Regards,
 Arnout

> +	exit 1
>  }
>  
>  GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
> @@ -18,7 +21,7 @@ while getopts :c: OPT ; do
>  	esac
>  done
>  
> -[ -n "${GENIMAGE_CFG}" ] || die "Missing argument"
> +[ -n "${GENIMAGE_CFG}" ] || die "missing option 'c'"
>  
>  rm -rf "${GENIMAGE_TMP}"
>  
>
diff mbox

Patch

diff --git a/support/scripts/genimage.sh b/support/scripts/genimage.sh
index 50d6907..d0d3491 100755
--- a/support/scripts/genimage.sh
+++ b/support/scripts/genimage.sh
@@ -1,8 +1,11 @@ 
 #!/bin/bash
 
 die() {
-  echo "Error: $@" >&2
-  exit 1
+	echo "Usage: ${0##*/} BINARIES_DIR -c GENIMAGE_CFG" >&2
+	echo "" >&2
+
+	echo "Error: $@" >&2
+	exit 1
 }
 
 GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
@@ -18,7 +21,7 @@  while getopts :c: OPT ; do
 	esac
 done
 
-[ -n "${GENIMAGE_CFG}" ] || die "Missing argument"
+[ -n "${GENIMAGE_CFG}" ] || die "missing option 'c'"
 
 rm -rf "${GENIMAGE_TMP}"