Make "meson help" and "meson help <subcommand>" do the expected thing.

This commit is contained in:
Jukka Laurila 2018-03-05 22:25:27 +01:00 committed by Jussi Pakkanen
parent fa1401bec1
commit 048508c989
2 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,6 @@
## "meson help" now shows command line help
Command line parsing is now less surprising. "meson help" is now
equivalent to "meson --help" and "meson help <subcommand>" is
equivalent to "meson <subcommand> --help", instead of creating a build
directory called "help" in these cases.

View File

@ -284,6 +284,13 @@ def run(original_args, mainfile=None):
# First check if we want to run a subcommand.
cmd_name = args[0]
remaining_args = args[1:]
# "help" is a special case: Since printing of the help may be
# delegated to a subcommand, we edit cmd_name before executing
# the rest of the logic here.
if cmd_name == 'help':
remaining_args += ['--help']
args = remaining_args
cmd_name = args[0]
if cmd_name == 'test':
return mtest.run(remaining_args)
elif cmd_name == 'setup':