From 86a936fbf026c1f2c417fe4fe5fed64a7d45afd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Mon, 28 Sep 2015 10:29:49 +0200 Subject: [PATCH] Declared readonly constants, fix local variables Declaration and assignment must be separate statements when the assignment value is provided by a command substitution; as the 'local' builtin does not propagate the exit code from the command substitution. #24 --- love-release.sh | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/love-release.sh b/love-release.sh index bc387a5..317a39c 100755 --- a/love-release.sh +++ b/love-release.sh @@ -1,8 +1,14 @@ #!/usr/bin/env bash # LÖVE version -LOVE_DEF_VERSION=0.9.2 +readonly LOVE_DEF_VERSION=0.9.2 +readonly INSTALLED=false +readonly EMBEDDED=false + +readonly OPTIONS="La:d:e:hi:l:p:r:t:u:v:x:" +readonly LONG_OPTIONS="author:,clean,description:,email:,exclude:,help,icon:,love:,pkg:,release:,title:,url:,version:" +readonly ARGS=$(getopt -o "$OPTIONS" -l "$LONG_OPTIONS" -n 'love-release' -- "$@") # Helper functions @@ -25,7 +31,8 @@ check_deps () { local opt=false } && { unset GETOPT_COMPATIBLE - local out=$(getopt -T) + local out + out=$(getopt -T) if (( $? != 4 )) && [[ -n $out ]]; then local opt=false fi @@ -157,7 +164,8 @@ compare_version () { ## $1: system name read_config () { if [[ $LUA == true ]] && [[ -f "conf.lua" ]]; then - local var=$(lua - <" | tail -n 1 | grep -Eo "[0-9]+.[0-9]+.[0-9]+") gen_version $LOVE_WEB_VERSION - INSTALLED=false - EMBEDDED=false - DEFAULT_MODULE=true TITLE="$(basename $(pwd))" @@ -409,9 +418,6 @@ main () { FILES=() EXCLUDE=() - OPTIONS="La:d:e:hi:l:p:r:t:u:v:x:" - LONG_OPTIONS="author:,clean,description:,email:,exclude:,help,icon:,love:,pkg:,release:,title:,url:,version:" - ARGS=$(getopt -o "$OPTIONS" -l "$LONG_OPTIONS" -n 'love-release' -- "$@") if (( $? != 0 )); then short_help; exit_module "options"; fi eval set -- "$ARGS" read_options