summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthieu Coudron <mattator@gmail.com>2019-06-04 18:06:08 +0900
committerMatthieu Coudron <mattator@gmail.com>2019-06-04 18:57:42 +0900
commitcf45c7857ad71363eede99c245e97f7204a8d519 (patch)
tree939367a9317436864308a36e37ac7b7b44c6541b
parent441ef28ac5a3d15e6914e2e9ba0b9ed3a7677de3 (diff)
update-luarocks: doesn't crash when no arguments
define print_help function before it gets called.
-rwxr-xr-xmaintainers/scripts/update-luarocks-packages18
1 files changed, 9 insertions, 9 deletions
diff --git a/maintainers/scripts/update-luarocks-packages b/maintainers/scripts/update-luarocks-packages
index e7ab61b1a9c7..f4b8eeac3d89 100755
--- a/maintainers/scripts/update-luarocks-packages
+++ b/maintainers/scripts/update-luarocks-packages
@@ -12,11 +12,6 @@
# stop the script upon C-C
set -eu -o pipefail
-if [ $# -lt 1 ]; then
- print_help
- exit 1
-fi
-
CSV_FILE="maintainers/scripts/luarocks-packages.csv"
TMP_FILE="$(mktemp)"
@@ -25,16 +20,21 @@ exit_trap()
local lc="$BASH_COMMAND" rc=$?
test $rc -eq 0 || echo -e "*** error $rc: $lc.\nGenerated temporary file in $TMP_FILE" >&2
}
-trap exit_trap EXIT
print_help() {
echo "Usage: $0 <GENERATED_FILE>"
echo "(most likely pkgs/development/lua-modules/generated-packages.nix)"
- echo ""
- echo " -c <CSV_FILE> to set the list of luarocks package to generate"
- exit 1
+ echo ""
+ echo " -c <CSV_FILE> to set the list of luarocks package to generate"
+ exit 1
}
+if [ $# -lt 1 ]; then
+ print_help
+ exit 1
+fi
+
+trap exit_trap EXIT
while getopts ":hc:" opt; do
case $opt in