From 3a50d322995d10b6c30f8157df66f405b1c8a9b8 Mon Sep 17 00:00:00 2001 From: Tim Fuller Date: Thu, 29 Feb 2024 17:51:42 -0700 Subject: Show extension commands with spack -h (#41726) * Execute `args.help` after setting main options so that extension commands will show with `spack -h` --------- Co-authored-by: psakievich --- lib/spack/spack/main.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py index 9676d436dd..bff07ccbfb 100644 --- a/lib/spack/spack/main.py +++ b/lib/spack/spack/main.py @@ -950,14 +950,10 @@ def _main(argv=None): parser.print_help() return 1 - # -h, -H, and -V are special as they do not require a command, but - # all the other options do nothing without a command. + # version is special as it does not require a command or loading and additional infrastructure if args.version: print(get_version()) return 0 - elif args.help: - sys.stdout.write(parser.format_help(level=args.help)) - return 0 # ------------------------------------------------------------------------ # This part of the `main()` sets up Spack's configuration. @@ -996,6 +992,12 @@ def _main(argv=None): print_setup_info(*args.print_shell_vars.split(",")) return 0 + # -h and -H are special as they do not require a command, but + # all the other options do nothing without a command. + if args.help: + sys.stdout.write(parser.format_help(level=args.help)) + return 0 + # At this point we've considered all the options to spack itself, so we # need a command or we're done. if not args.command: -- cgit v1.2.3-70-g09d2