Give all subcommands an optional setup() function that will be called by git-flow in order to let the subcommand initialize its environment.
Give all the branch-type subcommands a default explicit "list" action, too.
Order the functions inside each of the subcommands in a specific order, for consistency:
- usage()
- setup()
- cmd_default()
- cmd_list()
- cmd_help()
- parse_args()
- other commands
diff --git a/git-flow b/git-flow
index de8d9a1..96c2e52 100755
--- a/git-flow
+++ b/git-flow
@@ -90,6 +90,10 @@
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 "$@"
}