Permalink
Browse files

Merge branch 'feature/subcmd-structure' into develop

Conflicts:
	git-flow-feature
	git-flow-hotfix
	git-flow-release
	git-flow-support
  • Loading branch information...
2 parents 04839ae + b866b01 commit 46e9c86aff4a1c9b2c45ff3ea2e670205922ac43 @nvie committed Jan 28, 2010
Showing with 71 additions and 52 deletions.
  1. +4 −0 git-flow
  2. +15 −11 git-flow-feature
  3. +15 −11 git-flow-hotfix
  4. +4 −5 git-flow-init
  5. +14 −10 git-flow-release
  6. +15 −11 git-flow-support
  7. +4 −4 git-flow-version
View
4 git-flow
@@ -80,6 +80,10 @@ main() {
fi
# run the specified action
+ # if the subcommand declares a setup() function, call that first
+ if typeset -f setup >/dev/null; then
+ setup
+ fi
cmd_$SUBACTION "$@"
}
View
26 git-flow-feature
@@ -15,7 +15,7 @@
PREFIX=$(git config --get gitflow.prefix.feature || echo feature/)
usage() {
- echo "usage: git flow feature"
+ echo "usage: git flow feature [list]"
echo " git flow feature start <name> [<base>]"
echo " git flow feature finish <name> [<base>]"
echo " git flow feature publish <name>"
@@ -36,18 +36,11 @@ usage() {
#echo "--push Push to the origin repo when finished"
}
-parse_args() {
- NAME="$1"
- BASE="${2:-$DEVELOP_BRANCH}"
- if [ "$NAME" = "" ]; then
- echo "Missing argument <name>."
- usage
- exit 1
- fi
- BRANCH=$PREFIX$NAME
+cmd_default() {
+ cmd_list "$@"
}
-cmd_default() {
+cmd_list() {
FEATURE_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$FEATURE_BRANCHES" ]; then
warn "No feature branches exist."
@@ -61,6 +54,17 @@ cmd_help() {
exit 0
}
+parse_args() {
+ NAME="$1"
+ BASE="${2:-$DEVELOP_BRANCH}"
+ if [ "$NAME" = "" ]; then
+ echo "Missing argument <name>."
+ usage
+ exit 1
+ fi
+ BRANCH=$PREFIX$NAME
+}
+
cmd_start() {
parse_args "$@"
View
26 git-flow-hotfix
@@ -15,7 +15,7 @@
PREFIX=$(git config --get gitflow.prefix.hotfix || echo hotfix/)
usage() {
- echo "usage: git flow hotfix"
+ echo "usage: git flow hotfix [list]"
echo " git flow hotfix start <version> [<base>]"
echo " git flow hotfix finish <version> [<base>]"
# TODO
@@ -30,18 +30,11 @@ usage() {
#echo "--push Push to the origin repo when finished"
}
-parse_args() {
- VERSION="$1"
- BASE="${2:-$MASTER_BRANCH}"
- if [ "$VERSION" = "" ]; then
- echo "Missing argument <version>."
- usage
- exit 1
- fi
- BRANCH=$PREFIX$VERSION
+cmd_default() {
+ cmd_list "$@"
}
-cmd_default() {
+cmd_list() {
HOTFIX_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$HOTFIX_BRANCHES" ]; then
warn "No hotfix branches exist."
@@ -55,6 +48,17 @@ cmd_help() {
exit 0
}
+parse_args() {
+ VERSION="$1"
+ BASE="${2:-$MASTER_BRANCH}"
+ if [ "$VERSION" = "" ]; then
+ echo "Missing argument <version>."
+ usage
+ exit 1
+ fi
+ BRANCH=$PREFIX$VERSION
+}
+
cmd_start() {
parse_args "$@"
View
9 git-flow-init
@@ -16,11 +16,6 @@ usage() {
echo "usage: git flow init"
}
-cmd_help() {
- usage
- exit 0
-}
-
# Default entry when no SUBACTION is given
cmd_default() {
echo
@@ -76,3 +71,7 @@ cmd_default() {
fi
}
+cmd_help() {
+ usage
+ exit 0
+}
View
24 git-flow-release
@@ -16,7 +16,7 @@ VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag)
PREFIX=$(git config --get gitflow.prefix.release || echo release/)
usage() {
- echo "usage: git flow release"
+ echo "usage: git flow release [list]"
echo " git flow release start <version>"
echo " git flow release finish <version>"
# TODO
@@ -32,17 +32,11 @@ usage() {
#echo "--push Push to the origin repo when finished"
}
-parse_args() {
- VERSION="$1"
- if [ "$VERSION" = "" ]; then
- echo "Missing argument <version>."
- usage
- exit 1
- fi
- BRANCH=$PREFIX$VERSION
+cmd_default() {
+ cmd_list "$@"
}
-cmd_default() {
+cmd_list() {
RELEASE_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$RELEASE_BRANCHES" ]; then
warn "No release branches exist."
@@ -56,6 +50,16 @@ cmd_help() {
exit 0
}
+parse_args() {
+ VERSION="$1"
+ if [ "$VERSION" = "" ]; then
+ echo "Missing argument <version>."
+ usage
+ exit 1
+ fi
+ BRANCH=$PREFIX$VERSION
+}
+
cmd_start() {
parse_args "$@"
View
26 git-flow-support
@@ -16,22 +16,15 @@ VERSION_PREFIX=$(git config --get gitflow.prefix.versiontag)
PREFIX=$(git config --get gitflow.prefix.support || echo support/)
usage() {
- echo "usage: git flow support"
+ echo "usage: git flow support [list]"
echo " git flow support start <version> [<base>]"
}
-parse_args() {
- VERSION="$1"
- BASE="${2:-${VERSION_PREFIX}${VERSION}}"
- if [ "$VERSION" = "" ]; then
- echo "Missing argument <version>."
- usage
- exit 1
- fi
- BRANCH=$PREFIX$VERSION
+cmd_default() {
+ cmd_list "$@"
}
-cmd_default() {
+cmd_list() {
SUPPORT_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
if [ -z "$SUPPORT_BRANCHES" ]; then
warn "No support branches exist."
@@ -45,6 +38,17 @@ cmd_help() {
exit 0
}
+parse_args() {
+ VERSION="$1"
+ BASE="${2:-${VERSION_PREFIX}${VERSION}}"
+ if [ "$VERSION" = "" ]; then
+ echo "Missing argument <version>."
+ usage
+ exit 1
+ fi
+ BRANCH=$PREFIX$VERSION
+}
+
cmd_start() {
parse_args "$@"
View
8 git-flow-version
@@ -17,11 +17,11 @@ usage() {
echo "usage: git flow version"
}
+cmd_default() {
+ echo "$GITFLOW_VERSION"
+}
+
cmd_help() {
usage
exit 0
}
-
-cmd_default() {
- echo "$GITFLOW_VERSION"
-}

1 comment on commit 46e9c86

@hollow

nice work :) but i think typeset is not posix compliant. at least it's not in the specs

Please sign in to comment.