Skip to content

Commit

Permalink
Refactored the feature, release and support subcommands, too.
Browse files Browse the repository at this point in the history
  • Loading branch information
nvie committed Jan 27, 2010
1 parent 186d2b5 commit 170dc74
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
4 changes: 2 additions & 2 deletions git-flow-feature
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ parse_args() {
}

cmd_default() {
# TODO: refactor this, because passing in this dummy "foo" is really ugly!
parse_args "$@" foo
# TODO: Refactor getting this prefix into a general function
PREFIX=$(git config --get gitflow.prefix.feature || echo feature/)
FEATURE_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$FEATURE_BRANCHES" ]; then
warn "No feature branches exist."
Expand Down
16 changes: 14 additions & 2 deletions git-flow-release
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
#

usage() {
echo "usage: git flow start release <version>"
echo " git flow finish release <version>"
echo "usage: git flow release"
echo " git flow release start <version>"
echo " git flow release finish <version>"
# TODO
#echo ""
#echo "options:"
Expand All @@ -40,6 +41,17 @@ parse_args() {
BRANCH=$PREFIX$VERSION
}

cmd_default() {
# TODO: Refactor getting this prefix into a general function
PREFIX=$(git config --get gitflow.prefix.release || echo release/)
RELEASE_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$RELEASE_BRANCHES" ]; then
warn "No release branches exist."
exit 0
fi
echo "$RELEASE_BRANCHES" | sed "s?^$PREFIX??g"
}

cmd_help() {
usage
exit 0
Expand Down
14 changes: 13 additions & 1 deletion git-flow-support
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#

usage() {
echo "usage: git flow start support <version> [<base>]"
echo "usage: git flow support"
echo " git flow support start <version> [<base>]"
}

parse_args() {
Expand All @@ -29,6 +30,17 @@ parse_args() {
BRANCH=$PREFIX$VERSION
}

cmd_default() {
# TODO: Refactor getting this prefix into a general function
PREFIX=$(git config --get gitflow.prefix.support || echo support/)
SUPPORT_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$SUPPORT_BRANCHES" ]; then
warn "No support branches exist."
exit 0
fi
echo "$SUPPORT_BRANCHES" | sed "s?^$PREFIX??g"
}

cmd_help() {
usage
exit 0
Expand Down

0 comments on commit 170dc74

Please sign in to comment.