Skip to content

Commit

Permalink
Manually select the last argument.
Browse files Browse the repository at this point in the history
This implementation does not rely on Bash-specific functionality.
  • Loading branch information
nvie committed Oct 8, 2010
1 parent ca8be52 commit f50df99
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion git-flow-feature
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ parse_args() {
parse_cmdline "$@"

# read arguments into global variables
NAME=${!#}
NAME=$(last_arg "$@")
BRANCH=$PREFIX$NAME
}

Expand Down
2 changes: 1 addition & 1 deletion git-flow-hotfix
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ parse_args() {
eval set -- "${FLAGS_ARGV}"

# read arguments into global variables
VERSION=${!#}
VERSION=$(last_arg "$@")
BRANCH=$PREFIX$VERSION
}

Expand Down
2 changes: 1 addition & 1 deletion git-flow-release
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ parse_args() {
eval set -- "${FLAGS_ARGV}"

# read arguments into global variables
VERSION=${!#}
VERSION=$(last_arg "$@")
BRANCH=$PREFIX$VERSION
}

Expand Down
8 changes: 8 additions & 0 deletions gitflow-common
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f50df99

Please sign in to comment.