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.
This commit is contained in:
parent
0377f3580b
commit
6180e6c047
@ -24,12 +24,29 @@ Spack can install:
|
|||||||
|
|
||||||
.. command-output:: spack list
|
.. command-output:: spack list
|
||||||
|
|
||||||
The packages are listed by name in alphabetical order. You can also
|
The packages are listed by name in alphabetical order. If you specify a
|
||||||
do wildcats searches using ``*``:
|
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:
|
.. _spack-info:
|
||||||
|
|
||||||
|
@ -58,7 +58,8 @@ def list(parser, args):
|
|||||||
r = fnmatch.translate('*' + f + '*')
|
r = fnmatch.translate('*' + f + '*')
|
||||||
else:
|
else:
|
||||||
r = fnmatch.translate(f)
|
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)
|
res.append(rc)
|
||||||
|
|
||||||
if args.search_description:
|
if args.search_description:
|
||||||
|
Loading…
Reference in New Issue
Block a user