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 <psakiev@sandia.gov>
This commit is contained in:
Tim Fuller 2024-02-29 17:51:42 -07:00 committed by GitHub
parent 50ee3624c0
commit 3a50d32299
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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: