Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/groupon/gh-grep
GitHub CLI grep extension
https://github.com/groupon/gh-grep
gh-extension
Last synced: 29 days ago
JSON representation
GitHub CLI grep extension
- Host: GitHub
- URL: https://github.com/groupon/gh-grep
- Owner: groupon
- License: bsd-3-clause
- Created: 2022-08-21T21:18:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-23T21:07:50.000Z (over 2 years ago)
- Last Synced: 2024-08-17T08:05:15.172Z (5 months ago)
- Topics: gh-extension
- Language: TypeScript
- Homepage:
- Size: 136 KB
- Stars: 4
- Watchers: 8
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[![nlm-github](https://img.shields.io/badge/github-groupon%2Fgh--grep%2Fissues-F4D03F?logo=github&logoColor=white)](https://github.com/groupon/gh-grep/issues)
![nlm-node](https://img.shields.io/badge/node-%3E%3D14-blue?logo=node.js&logoColor=white)
![nlm-version](https://img.shields.io/badge/version-1.0.0-blue?logo=version&logoColor=white)
# GitHub CLI "grep" Extension## Requirements
* [GitHub CLI](https://cli.github.com/)
* [NodeJS](https://nodejs.org/) >= 14.x## Installation
```
$ gh extension install groupon/gh-grep
```The first time you run `gh grep` additional dependencies will be automatically
installed.## Usage
```
$ gh grep [options] path/in/repos/to/file [owner1/repo1 [owner2/repo2 [...]]]
$ gh grep [options] '[' path/to/file1 path/to/file2 ']' [owner1/repo1 [...]]
```This command greps files in GitHub repos, without checking out the repo.
Use `--help` to see all of the options.`pattern` is a JavaScript-compatible regexp string.
If you wish to grep multiple files, you must enclose them in `'['` and `']'`
arguments to separate them from the list of owner/repos.If you omit the repos to search, it will do an implicit GH code search first
to get a list of repos to try the `grep` on.## Examples
Find uses of `lodash` as a dependency in a few different repos:
```
$ gh grep lodash package.json groupon/gofer groupon/gofer-openapi testiumjs/testium-driver-wd
groupon/gofer-openapi: "lodash.camelcase": "^4.3.0",
groupon/gofer-openapi: "lodash.upperfirst": "^4.3.1",
groupon/gofer-openapi: "@types/lodash.camelcase": "^4.3.6",
groupon/gofer-openapi: "@types/lodash.upperfirst": "^4.3.6",
groupon/gofer: "lodash.isplainobject": "^4.0.6",
groupon/gofer: "lodash.merge": "^4.6.2",
groupon/gofer: "lodash.mergewith": "^4.6.2"
testiumjs/testium-driver-wd: "lodash.method": "^4.5.2",
```Find a term in specific files in any repo on a private GitHub instance
(performs a search first)```
$ GH_HOST=github.example.com gh grep kittens \[ README.md CHANGELOG.md \]
org1/repo1: README.md: But the kittens are here
org1/repo1: CHANGELOG.md: Removed kittens after
org2/repo2: CHANGELOG.md: Added kittens because
```