diff options
-rw-r--r-- | docs/markdown/snippets/improved-help.md | 6 | ||||
-rw-r--r-- | mesonbuild/mesonmain.py | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/docs/markdown/snippets/improved-help.md b/docs/markdown/snippets/improved-help.md new file mode 100644 index 0000000..db7e852 --- /dev/null +++ b/docs/markdown/snippets/improved-help.md @@ -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. diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index e354cce..69b4e31 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -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': |