diff options
author | Michael Kuhn <michael.kuhn@ovgu.de> | 2023-11-24 15:56:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-24 15:56:42 +0100 |
commit | 7db386a018e2709bc4e22d61e18ab475ac8dbf33 (patch) | |
tree | 51f1648ca1a774c34aa463154fdcfeb495d2537e /lib | |
parent | 92d076e6834aefdd29e3576ea36a1664e4e793f2 (diff) | |
download | spack-7db386a018e2709bc4e22d61e18ab475ac8dbf33.tar.gz spack-7db386a018e2709bc4e22d61e18ab475ac8dbf33.tar.bz2 spack-7db386a018e2709bc4e22d61e18ab475ac8dbf33.tar.xz spack-7db386a018e2709bc4e22d61e18ab475ac8dbf33.zip |
Fix multi-word aliases (#41126)
PR #40929 reverted the argument parsing to make `spack --verbose
install` work again. It looks like `--verbose` is the only instance
where this kind of argument inheritance is used since all other commands
override arguments with the same name instead. For instance, `spack
--bootstrap clean` does not invoke `spack clean --bootstrap`.
Therefore, fix multi-line aliases again by parsing the resolved
arguments and instead explicitly pass down `args.verbose` to commands.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/main.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index 5f28ab480c..56a4dc0e33 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -1016,14 +1016,16 @@ def _main(argv=None): bootstrap_context = bootstrap.ensure_bootstrap_configuration() with bootstrap_context: - return finish_parse_and_run(parser, cmd_name, args.command, env_format_error) + return finish_parse_and_run(parser, cmd_name, args, env_format_error) -def finish_parse_and_run(parser, cmd_name, cmd, env_format_error): +def finish_parse_and_run(parser, cmd_name, main_args, env_format_error): """Finish parsing after we know the command to run.""" # add the found command to the parser and re-run then re-parse command = parser.add_command(cmd_name) - args, unknown = parser.parse_known_args() + args, unknown = parser.parse_known_args(main_args.command) + # we need to inherit verbose since the install command checks for it + args.verbose = main_args.verbose # Now that we know what command this is and what its args are, determine # whether we can continue with a bad environment and raise if not. |