Use shFlags to parse flags given to main and subcommands.
Implement the flags for each of the 'feature' subcommands.
diff --git a/git-flow b/git-flow
index 4179fde..303e8a7 100755
--- a/git-flow
+++ b/git-flow
@@ -80,12 +80,13 @@
# run command
. "$GITFLOW_DIR/git-flow-$SUBCOMMAND"
- #
- # TODO: How to handle 'git flow feature --verbose'
- # instead of 'git flow feature list --verbose'
- # "--verbose" is not a subcommand!
- #
- SUBACTION="${1:-default}"; shift
+ # test if the first argument is a flag (i.e. starts with '-')
+ # in that case, we interpret this arg as a flag for the default
+ # command
+ SUBACTION="default"
+ if [ "$1" != "" ] && ! echo "$1" | grep -q "^-"; then
+ SUBACTION="$1"; shift
+ fi
if ! typeset -f cmd_$SUBACTION 2>&1 >/dev/null; then
warn "Unknown subcommand: '$1'"
usage