Permalink
Browse files

Manually select the last argument.

This implementation does not rely on Bash-specific functionality.
  • Loading branch information...
1 parent ca8be52 commit f50df990af7a8cc70a8b42cd539538728c067df7 @nvie nvie committed Oct 8, 2010
Showing with 11 additions and 3 deletions.
  1. +1 −1 git-flow-feature
  2. +1 −1 git-flow-hotfix
  3. +1 −1 git-flow-release
  4. +8 −0 gitflow-common
View
@@ -180,7 +180,7 @@ parse_args() {
parse_cmdline "$@"
# read arguments into global variables
- NAME=${!#}
+ NAME=$(last_arg "$@")
BRANCH=$PREFIX$NAME
}
View
@@ -124,7 +124,7 @@ parse_args() {
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
- VERSION=${!#}
+ VERSION=$(last_arg "$@")
BRANCH=$PREFIX$VERSION
}
View
@@ -121,7 +121,7 @@ parse_args() {
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
- VERSION=${!#}
+ VERSION=$(last_arg "$@")
BRANCH=$PREFIX$VERSION
}
View
@@ -44,6 +44,14 @@
warn() { echo "$@" >&2; }
die() { warn "$@"; exit 1; }
+# argument processing
+last_arg() {
+ if [ $# -ne 0 ]; then
+ shift $(expr $# - 1)
+ echo "$1"
+ fi
+}
+
# set logic
has() {
local item=$1; shift

0 comments on commit f50df99

Please sign in to comment.