diff options
author | Tim Fuller <tjfulle@sandia.gov> | 2024-02-29 17:51:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-29 16:51:42 -0800 |
commit | 3a50d322995d10b6c30f8157df66f405b1c8a9b8 (patch) | |
tree | bcbefe94e5eefb85b4d60338f6f5a4b7de7afab6 /lib | |
parent | 50ee3624c0de235a8ec5251da1e5297fc4f3f2cc (diff) | |
download | spack-3a50d322995d10b6c30f8157df66f405b1c8a9b8.tar.gz spack-3a50d322995d10b6c30f8157df66f405b1c8a9b8.tar.bz2 spack-3a50d322995d10b6c30f8157df66f405b1c8a9b8.tar.xz spack-3a50d322995d10b6c30f8157df66f405b1c8a9b8.zip |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/main.py | 12 |
1 files changed, 7 insertions, 5 deletions
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: |