From 855c51d36d2bb61e3ce90794d4a1f17fb5a9dd88 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Thu, 28 May 2020 22:25:23 +0200 Subject: [PATCH] Improve behaviour regarding "help" (#509) Also accept -h for help. This is the usual behaviour of most utils that accept --help. Also, now an empty call to ./emsdk does not print the full help, as discussed in #509. --- emsdk.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/emsdk.py b/emsdk.py index 04a33aa..e0ff593 100755 --- a/emsdk.py +++ b/emsdk.py @@ -2677,11 +2677,11 @@ def error_on_missing_tool(name): def main(): global emscripten_config_directory, BUILD_FOR_TESTING, ENABLE_LLVM_ASSERTIONS, TTY_OUTPUT - if len(sys.argv) <= 1 or sys.argv[1] == 'help' or sys.argv[1] == '--help': - if len(sys.argv) <= 1: - print(' emsdk: No command given. Please call one of the following:') - else: - print(' emsdk: Available commands:') + if len(sys.argv) <= 1: + print("Missing command; Type 'emsdk help' to get a list of commands.") + return 1 + if sys.argv[1] in ('help', '--help', '-h'): + print(' emsdk: Available commands:') print(''' emsdk list [--old] [--uses] - Lists all available SDKs and tools and their @@ -2798,7 +2798,7 @@ def main(): 'activate' commands and the invocation of 'emsdk_env', or otherwise these commands will default to operating on the default build type which in and RelWithDebInfo.''') - return 1 + return 0 # Extracts a boolean command line argument from sys.argv and returns True if it was present def extract_bool_arg(name):