Refactored the subcommand invocation logic to form a more hierarchical structure and a cleaner design.
diff --git a/git-flow-feature b/git-flow-feature
index 663e788..43132d7 100644
--- a/git-flow-feature
+++ b/git-flow-feature
@@ -13,12 +13,12 @@
#
usage() {
- echo "usage: git flow list feature"
- echo " git flow start feature <name> [<base>]"
- echo " git flow finish feature <name> [<base>]"
- echo " git flow publish feature <name>"
- echo " git flow track feature <name>"
- echo " git flow diff feature <name>"
+ echo "usage: git flow feature"
+ echo " git flow feature start <name> [<base>]"
+ echo " git flow feature finish <name> [<base>]"
+ echo " git flow feature publish <name>"
+ echo " git flow feature track <name>"
+ echo " git flow feature diff <name>"
# TODO
#echo ""
#echo "options:"
@@ -46,6 +46,17 @@
BRANCH=$PREFIX$NAME
}
+cmd_default() {
+ # TODO: refactor this, because passing in this dummy "foo" is really ugly!
+ parse_args "$@" foo
+ FEATURE_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
+ if [ -z "$FEATURE_BRANCHES" ]; then
+ warn "No feature branches exist."
+ exit 0
+ fi
+ echo "$FEATURE_BRANCHES" | sed "s?^$PREFIX??g"
+}
+
cmd_help() {
usage
exit 0
@@ -157,17 +168,6 @@
echo
}
-cmd_list() {
- # TODO: refactor this, because passing in this dummy "foo" is really ugly!
- parse_args "$@" foo
- FEATURE_BRANCHES="$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
- if [ -z "$FEATURE_BRANCHES" ]; then
- warn "No feature branches exist."
- exit 0
- fi
- echo "$FEATURE_BRANCHES" | sed "s?^$PREFIX??g"
-}
-
cmd_diff() {
parse_args "$@"
# TODO: if this feature has been based on a non-develop branch, we really