diff --git a/lib/spack/spack/cmd/arch.py b/lib/spack/spack/cmd/arch.py index 29b35000f08..e6633f186ca 100644 --- a/lib/spack/spack/cmd/arch.py +++ b/lib/spack/spack/cmd/arch.py @@ -20,6 +20,10 @@ def setup_parser(subparser): + subparser.add_argument( + '-g', '--generic-target', action='store_true', + help='show the best generic target' + ) subparser.add_argument( '--known-targets', action='store_true', help='show a list of all known targets and exit' @@ -74,6 +78,10 @@ def display_target_group(header, target_group): def arch(parser, args): + if args.generic_target: + print(archspec.cpu.host().generic) + return + if args.known_targets: display_targets(archspec.cpu.TARGETS) return diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index a5610f58720..90bb79a66a0 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -382,7 +382,7 @@ _spack_analyze_run() { } _spack_arch() { - SPACK_COMPREPLY="-h --help --known-targets -p --platform -o --operating-system -t --target -f --frontend -b --backend" + SPACK_COMPREPLY="-h --help -g --generic-target --known-targets -p --platform -o --operating-system -t --target -f --frontend -b --backend" } _spack_audit() {