summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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: