diff options
-rw-r--r-- | lib/spack/spack/cmd/module.py | 8 |
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 |