Commit 170dc747 authored by Vincent Driessen's avatar Vincent Driessen

Refactored the feature, release and support subcommands, too.

parent 186d2b5f
...@@ -47,8 +47,8 @@ parse_args() { ...@@ -47,8 +47,8 @@ parse_args() {
} }
cmd_default() { cmd_default() {
# TODO: refactor this, because passing in this dummy "foo" is really ugly! # TODO: Refactor getting this prefix into a general function
parse_args "$@" foo PREFIX=$(git config --get gitflow.prefix.feature || echo feature/)
FEATURE_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")" FEATURE_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$FEATURE_BRANCHES" ]; then if [ -z "$FEATURE_BRANCHES" ]; then
warn "No feature branches exist." warn "No feature branches exist."
......
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
# #
usage() { usage() {
echo "usage: git flow start release <version>" echo "usage: git flow release"
echo " git flow finish release <version>" echo " git flow release start <version>"
echo " git flow release finish <version>"
# TODO # TODO
#echo "" #echo ""
#echo "options:" #echo "options:"
...@@ -40,6 +41,17 @@ parse_args() { ...@@ -40,6 +41,17 @@ parse_args() {
BRANCH=$PREFIX$VERSION 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() { cmd_help() {
usage usage
exit 0 exit 0
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
# #
usage() { usage() {
echo "usage: git flow start support <version> [<base>]" echo "usage: git flow support"
echo " git flow support start <version> [<base>]"
} }
parse_args() { parse_args() {
...@@ -29,6 +30,17 @@ parse_args() { ...@@ -29,6 +30,17 @@ parse_args() {
BRANCH=$PREFIX$VERSION 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() { cmd_help() {
usage usage
exit 0 exit 0
......
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