Commit f50df990 authored by Vincent Driessen's avatar Vincent Driessen

Manually select the last argument.

This implementation does not rely on Bash-specific functionality.
parent ca8be527
...@@ -180,7 +180,7 @@ parse_args() { ...@@ -180,7 +180,7 @@ parse_args() {
parse_cmdline "$@" parse_cmdline "$@"
# read arguments into global variables # read arguments into global variables
NAME=${!#} NAME=$(last_arg "$@")
BRANCH=$PREFIX$NAME BRANCH=$PREFIX$NAME
} }
......
...@@ -124,7 +124,7 @@ parse_args() { ...@@ -124,7 +124,7 @@ parse_args() {
eval set -- "${FLAGS_ARGV}" eval set -- "${FLAGS_ARGV}"
# read arguments into global variables # read arguments into global variables
VERSION=${!#} VERSION=$(last_arg "$@")
BRANCH=$PREFIX$VERSION BRANCH=$PREFIX$VERSION
} }
......
...@@ -121,7 +121,7 @@ parse_args() { ...@@ -121,7 +121,7 @@ parse_args() {
eval set -- "${FLAGS_ARGV}" eval set -- "${FLAGS_ARGV}"
# read arguments into global variables # read arguments into global variables
VERSION=${!#} VERSION=$(last_arg "$@")
BRANCH=$PREFIX$VERSION BRANCH=$PREFIX$VERSION
} }
......
...@@ -44,6 +44,14 @@ ...@@ -44,6 +44,14 @@
warn() { echo "$@" >&2; } warn() { echo "$@" >&2; }
die() { warn "$@"; exit 1; } die() { warn "$@"; exit 1; }
# argument processing
last_arg() {
if [ $# -ne 0 ]; then
shift $(expr $# - 1)
echo "$1"
fi
}
# set logic # set logic
has() { has() {
local item=$1; shift local item=$1; shift
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment