summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Scogland <scogland1@llnl.gov>2016-06-20 11:33:56 -0700
committerTom Scogland <scogland1@llnl.gov>2016-06-20 11:33:56 -0700
commit6180e6c047ba09a8c7359ba9327ca6a332b4e073 (patch)
tree7f9b4795ea49efb94efa9a10c12893de97c53917 /lib
parent0377f3580b0985bd65fb64e82a6fbb9b397b56ab (diff)
downloadspack-6180e6c047ba09a8c7359ba9327ca6a332b4e073.tar.gz
spack-6180e6c047ba09a8c7359ba9327ca6a332b4e073.tar.bz2
spack-6180e6c047ba09a8c7359ba9327ca6a332b4e073.tar.xz
spack-6180e6c047ba09a8c7359ba9327ca6a332b4e073.zip
automatic case-insensitive like smartsearch, docs
New documentation for the new options, also case insensitive by default unless the user includes an upper-case character in their pattern.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/docs/basic_usage.rst25
-rw-r--r--lib/spack/spack/cmd/list.py3
2 files changed, 23 insertions, 5 deletions
diff --git a/lib/spack/docs/basic_usage.rst b/lib/spack/docs/basic_usage.rst
index 50c48b802b..f4d42c23ad 100644
--- a/lib/spack/docs/basic_usage.rst
+++ b/lib/spack/docs/basic_usage.rst
@@ -24,12 +24,29 @@ Spack can install:
.. command-output:: spack list
-The packages are listed by name in alphabetical order. You can also
-do wildcats searches using ``*``:
+The packages are listed by name in alphabetical order. If you specify a
+pattern to match, it will follow this set of rules. A pattern with no
+wildcards, ``*`` or ``?``, will be treated as though it started and ended iwth
+``*``, so ``util`` is equivalent to ``*util*``. A pattern with no capitol
+letters will be treated as case-insensitive. You can also add the ``-i`` flag
+to specify a case insensitive search, or ``-d`` to search the description of
+the package in addition to the name. Some examples:
-.. command-output:: spack list m*
+All packages whose names contain "sql" case insensitive:
-.. command-output:: spack list *util*
+.. command-output:: spack list sql
+
+All packages whose names start with a capitol M:
+
+.. command-output:: spack list M*
+
+All packages whose names or descriptions contain Documentation:
+
+.. command-output:: spack list -d Documentation
+
+All packages whose names contain documentation case insensitive:
+
+.. command-output:: spack list -d documentation
.. _spack-info:
diff --git a/lib/spack/spack/cmd/list.py b/lib/spack/spack/cmd/list.py
index 9ce63fa1a4..974c4778ab 100644
--- a/lib/spack/spack/cmd/list.py
+++ b/lib/spack/spack/cmd/list.py
@@ -58,7 +58,8 @@ def list(parser, args):
r = fnmatch.translate('*' + f + '*')
else:
r = fnmatch.translate(f)
- rc = re.compile(r, flags=re.I if args.insensitive else 0)
+ rc = re.compile(r, flags=re.I if args.insensitive or not any(
+ l.isupper() for l in f) else 0)
res.append(rc)
if args.search_description: