summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorTodd Gamblin <gamblin2@llnl.gov>2022-12-09 10:07:54 -0800
committerGitHub <noreply@github.com>2022-12-09 10:07:54 -0800
commitd991ec90e3b5d9ec993dcde0ed99fb6539dd5e14 (patch)
tree7de3c0e6f27798d8ce314fda9a8cdd30368320c3 /var
parent8353d1539f6027c04567daa5ad82309fc5a58178 (diff)
downloadspack-d991ec90e3b5d9ec993dcde0ed99fb6539dd5e14.tar.gz
spack-d991ec90e3b5d9ec993dcde0ed99fb6539dd5e14.tar.bz2
spack-d991ec90e3b5d9ec993dcde0ed99fb6539dd5e14.tar.xz
spack-d991ec90e3b5d9ec993dcde0ed99fb6539dd5e14.zip
new command: `spack pkg grep` to search package files (#34388)
It's very common for us to tell users to grep through the existing Spack packages to find examples of what they want, and it's also very common for package developers to do it. Now, searching packages is even easier. `spack pkg grep` runs grep on all `package.py` files in repos known to Spack. It has no special options other than the search string; all options passed to it are forwarded along to `grep`. ```console > spack pkg grep --help usage: spack pkg grep [--help] ... positional arguments: grep_args arguments for grep options: --help show this help message and exit ``` ```console > spack pkg grep CMakePackage | head -3 /Users/gamblin2/src/spack/var/spack/repos/builtin/packages/3dtk/package.py:class _3dtk(CMakePackage): /Users/gamblin2/src/spack/var/spack/repos/builtin/packages/abseil-cpp/package.py:class AbseilCpp(CMakePackage): /Users/gamblin2/src/spack/var/spack/repos/builtin/packages/accfft/package.py:class Accfft(CMakePackage, CudaPackage): ``` ```console > spack pkg grep -Eho '(\S*)\(PythonPackage\)' | head -3 AwsParallelcluster(PythonPackage) Awscli(PythonPackage) Bueno(PythonPackage) ``` ## Return Value This retains the return value semantics of `grep`: * 0 for found, * 1 for not found * >1 for error ## Choosing a `grep` You can set the ``SPACK_GREP`` environment variable to choose the ``grep`` executable this command should use.
Diffstat (limited to 'var')
0 files changed, 0 insertions, 0 deletions