summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth Fischer <rpf2116@columbia.edu>2016-12-28 16:31:18 -0500
committerTodd Gamblin <tgamblin@llnl.gov>2016-12-28 13:31:18 -0800
commit88f57d7543a6b08d6b0436cca9649e9dd1eb6b6d (patch)
tree4082a73eb3fac05a190deab5724e872e146be3d3
parent17b13b161b3ddcd691ea7ed90165cfab6dec3950 (diff)
downloadspack-88f57d7543a6b08d6b0436cca9649e9dd1eb6b6d.tar.gz
spack-88f57d7543a6b08d6b0436cca9649e9dd1eb6b6d.tar.bz2
spack-88f57d7543a6b08d6b0436cca9649e9dd1eb6b6d.tar.xz
spack-88f57d7543a6b08d6b0436cca9649e9dd1eb6b6d.zip
Allow exclusion of packages from `spack module loads` (#2667)
* Allow exclusion of packages from `spack module loads` * Comment out excluded packages instead of not showing them at all.
-rw-r--r--lib/spack/spack/cmd/module.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/spack/spack/cmd/module.py b/lib/spack/spack/cmd/module.py
index 31460b3124..5887cbf495 100644
--- a/lib/spack/spack/cmd/module.py
+++ b/lib/spack/spack/cmd/module.py
@@ -90,6 +90,10 @@ def setup_parser(subparser):
'-p', '--prefix', dest='prefix', default='',
help='Prepend to module names when issuing module load commands'
)
+ loads_parser.add_argument(
+ '-x', '--exclude', dest='exclude', action='append', default=[],
+ help="Exclude package from output; may be specified multiple times"
+ )
arguments.add_common_arguments(
loads_parser, ['constraint', 'module_type', 'recurse_dependencies']
)
@@ -136,8 +140,10 @@ def loads(mtype, specs, args):
'prefix': args.prefix
}
- prompt_template = '{comment}{command}{prefix}{name}'
+ exclude_set = set(args.exclude)
+ prompt_template = '{comment}{exclude}{command}{prefix}{name}'
for spec, mod in modules:
+ d['exclude'] = '## ' if spec.name in exclude_set else ''
d['comment'] = '' if not args.shell else '# {0}\n'.format(
spec.format())
d['name'] = mod