Fix: Of course, in sh, true=0 and false=1. In order to never mess this up
again, the convenience functions flag() and noflag() have been used and
all occurrences of 0 and 1 are replaces by true and false. This makes it
safe (and more readable!) to test for active/inactive flags.
Also specify $FLAGS_PARENT explicitly, to avoid having the generated usage
texts by shFlags mention the full Unix path to $0, but instead use the
more recognizable varient 'git flow feature'.
diff --git a/git-flow b/git-flow
index 4ff458b..99c9510 100755
--- a/git-flow
+++ b/git-flow
@@ -55,6 +55,7 @@
# use the shFlags project to parse the command line arguments
. "$GITFLOW_DIR/shFlags.sh"
+ FLAGS_PARENT="git flow"
#DEFINE_boolean quiet 0 'run without output' q
#DEFINE_boolean verbose 0 'run verbose (more output)' v
FLAGS "$@" || exit $?
@@ -79,6 +80,7 @@
# run command
. "$GITFLOW_DIR/git-flow-$SUBCOMMAND"
+ FLAGS_PARENT="git flow $SUBCOMMAND"
# 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
@@ -200,4 +202,8 @@
has $BASE $ALL_MERGES
}
+# convenience functions for checking whether flags have been set or not
+flag() { eval FLAG=\$FLAGS_$1; [ $FLAG -eq $FLAGS_TRUE ]; }
+noflag() { eval FLAG=\$FLAGS_$1; [ $FLAG -ne $FLAGS_TRUE ]; }
+
main "$@"