diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2016-06-20 17:17:25 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2016-06-20 17:17:25 -0700 |
commit | 70a25c45871656b0e4007ffe5912bd6e51a5e4dd (patch) | |
tree | d4035eadae9c8af54e0f7385af1b05a2b2f305fb /lib | |
parent | cbd5a0a6e39c055c2622ae2eada8adcdc2213eef (diff) | |
download | spack-70a25c45871656b0e4007ffe5912bd6e51a5e4dd.tar.gz spack-70a25c45871656b0e4007ffe5912bd6e51a5e4dd.tar.bz2 spack-70a25c45871656b0e4007ffe5912bd6e51a5e4dd.tar.xz spack-70a25c45871656b0e4007ffe5912bd6e51a5e4dd.zip |
Change --insensitive to --sensitive in `spack list`
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/list.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/spack/spack/cmd/list.py b/lib/spack/spack/cmd/list.py index 974c4778ab..c921efd1bd 100644 --- a/lib/spack/spack/cmd/list.py +++ b/lib/spack/spack/cmd/list.py @@ -39,8 +39,9 @@ def setup_parser(subparser): 'filter', nargs=argparse.REMAINDER, help='Optional glob patterns to filter results.') subparser.add_argument( - '-i', '--insensitive', action='store_true', default=False, - help='Filtering will be case insensitive.') + '-s', '--sensitive', action='store_true', default=False, + help='Use case-sensitive filtering. Default is case sensitive, ' + 'unless the query contains a capital letter.') subparser.add_argument( '-d', '--search-description', action='store_true', default=False, help='Filtering will also search the description for a match.') @@ -58,8 +59,11 @@ def list(parser, args): r = fnmatch.translate('*' + f + '*') else: r = fnmatch.translate(f) - rc = re.compile(r, flags=re.I if args.insensitive or not any( - l.isupper() for l in f) else 0) + + re_flags = re.I + if any(l.isupper for l in f) or args.sensitive: + re_flags = 0 + rc = re.compile(r, flags=re_flags) res.append(rc) if args.search_description: |