From 3df1a0943c57d21bf906743135190e3eb040a01f Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Tue, 11 Jul 2017 16:36:58 +0100 Subject: [PATCH] Make help instantaneous in the weave script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are 3 ways to get help: • weave --help • weave help • weave --help At the moment, only the first one prints the usage instantaneously, the others go much further in the script and take quite some time, which is not idea of impatient users. Note that "help" only works because it's not a recognized command and ends up in the default case of "case $COMMAND" (and indeed, "Unknown weave command 'help'" is displayed). This is because handle_help_arg() always returns true and so the second part of: handle_help_arg "$1" || handle_help_arg "--$1" is never evaluated. This commit changes things a bit so all 3 ways to get help are recognized early, print the usage and exit. --- weave | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/weave b/weave index d1a4f716..166386ff 100755 --- a/weave +++ b/weave @@ -222,9 +222,11 @@ kill_container() { [ "$1" = "--local" ] && shift 1 && IS_LOCAL=1 -# "--help|help" are special because we always want to process them -# at the client end. -handle_help_arg "$1" || handle_help_arg "--$1" +# "--help|help" and " --help" are special because we always want to +# process them at the client end. +handle_help_arg "$1" +handle_help_arg "--$1" +handle_help_arg "$2" if [ "$1" = "version" -a -z "$IS_LOCAL" ] ; then # non-local "version" is special because we want to show the @@ -1343,8 +1345,6 @@ fi COMMAND=$1 shift 1 -handle_help_arg "$1" - case "$COMMAND" in setup) for img in $IMAGE $EXEC_IMAGE $WEAVEDB_IMAGE ; do