{"id":15404506,"url":"https://github.com/k1low/gh-grep","last_synced_at":"2025-04-04T10:05:38.907Z","repository":{"id":42685506,"uuid":"422935143","full_name":"k1LoW/gh-grep","owner":"k1LoW","description":":octocat: Print lines matching a pattern in repositories using GitHub API","archived":false,"fork":false,"pushed_at":"2025-03-23T04:57:54.000Z","size":156,"stargazers_count":202,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T09:05:09.194Z","etag":null,"topics":["gh-extension"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/k1LoW.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"k1LoW","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-10-30T16:35:25.000Z","updated_at":"2025-03-23T04:57:34.000Z","dependencies_parsed_at":"2024-01-08T23:45:17.930Z","dependency_job_id":"5a066d4d-94f6-4577-91a0-2bd90168c97e","html_url":"https://github.com/k1LoW/gh-grep","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fgh-grep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fgh-grep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fgh-grep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k1LoW%2Fgh-grep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k1LoW","download_url":"https://codeload.github.com/k1LoW/gh-grep/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157044,"owners_count":20893202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gh-extension"],"created_at":"2024-10-01T16:13:25.069Z","updated_at":"2025-04-04T10:05:38.886Z","avatar_url":"https://github.com/k1LoW.png","language":"Go","funding_links":["https://github.com/sponsors/k1LoW"],"categories":[],"sub_categories":[],"readme":"# gh-grep\n\n:octocat: Print lines matching a pattern in repositories using GitHub API\n\n## Usage\n\n``` console\n$ gh grep func.*schema.Schema --include=**/*.go --owner k1LoW --repo tbls\nk1LoW/tbls:cmd/doc.go:func withDot(s *schema.Schema, c *config.Config, force bool) (e error) {\nk1LoW/tbls:cmd/doc.go:func outputErExists(s *schema.Schema, path string) bool {\nk1LoW/tbls:config/config.go:func (c *Config) ModifySchema(s *schema.Schema) error {\nk1LoW/tbls:config/config.go:func (c *Config) MergeAdditionalData(s *schema.Schema) error {\nk1LoW/tbls:config/config.go:func (c *Config) FilterTables(s *schema.Schema) error {\nk1LoW/tbls:config/config.go:func (c *Config) mergeDictFromSchema(s *schema.Schema) {\nk1LoW/tbls:config/config.go:func excludeTableFromSchema(name string, s *schema.Schema) error {\n[...]\n```\n\n( Do grep the codes (`**/*.go`) of [k1LoW/tbls](https://github.com/k1LoW/tbls) with the pattern `func.*schema.Schema` )\n\n``` console\n$ gh grep --help\nPrint lines matching a pattern in repositories using GitHub API\n\nUsage:\n  gh-grep [PATTERN] [flags]\n\nFlags:\n  -e, -- strings         match pattern\n      --branch string    branch name\n  -c, --count            show the number of matches instead of matching lines\n      --exclude string   skip files and directories matching pattern\n  -h, --help             help for gh-grep\n  -i, --ignore-case      case insensitive matching\n      --include string   search only files that match pattern (default \"**/*\")\n  -n, --line-number      show line numbers\n      --name-only        show only repository:filenames\n  -o, --only-matching    show only matching parts of a line\n      --owner string     repository owner or org\n      --repo strings     repository name\n      --repo-only        show only repositories\n      --tag string       tag name\n      --url              show URL\n  -v, --version          version for gh-grep\n```\n\n#### :warning: Notice :warning:\n\n**`gh-grep` is very slow because it does all its scanning through the GitHub API.**\n\n**It is recommended to specify the `--include` option to get the results in a realistic time.**\n\n## Examples\n\n### List base Docker images used in the Dockerfile of the project root\n\n``` console\n$ gh grep ^FROM --include=Dockerfile --owner k1LoW\nk1LoW/centve:Dockerfile:FROM centos:7\nk1LoW/docker-alpine-pandoc-ja:Dockerfile:FROM frolvlad/alpine-glibc\nk1LoW/docker-sshd:Dockerfile:FROM docker.io/alpine:3.9\nk1LoW/gh-grep:Dockerfile:FROM debian:buster-slim\nk1LoW/ghdag:Dockerfile:FROM debian:buster-slim\nk1LoW/ghdag-action:Dockerfile:FROM ghcr.io/k1low/ghdag:v0.16.0\nk1LoW/ghput:Dockerfile:FROM alpine:3.13\nk1LoW/ghput-release-action:Dockerfile:FROM ghcr.io/k1low/ghput:v0.12.0\nk1LoW/github-script-ruby:Dockerfile:FROM ghcr.io/k1low/github-script-ruby-base:v1.1.0\n[...]\n```\n\n### List Actions you are using\n\n``` console\n$ gh grep uses: --include=.github/workflows/* --owner k1LoW | sed -e 's/.*uses:\\s*//g' | sort | uniq -c\n   9 ./\n   1 EndBug/add-and-commit@v7\n   2 actions/checkout@master\n  10 actions/checkout@v1\n  50 actions/checkout@v2\n  18 actions/setup-go@v1\n  21 actions/setup-go@v2\n   4 aquasecurity/trivy-action@master\n[...]\n```\n\n### Open the matched lines in a browser.\n\n``` console\n$ gh grep 'ioutil\\.' --include=**/*.go --owner k1LoW --repo ghput --url\nhttps://github.com/k1LoW/ghput/blob/main/gh/gh.go#L300\nhttps://github.com/k1LoW/ghput/blob/main/gh/gh.go#L313\n$ gh grep 'ioutil\\.' --include=**/*.go --owner k1LoW --repo ghput --url | xargs open\n```\n\n*`open` command only works on macOS.\n\n## Install\n\n`gh-grep` can be installed as a standalone command or as [a GitHub CLI extension](https://cli.github.com/manual/gh_extension)\n\n### Install as a GitHub CLI extension\n\n``` console\n$ gh extension install k1LoW/gh-grep\n```\n\n### Install as a standalone command\n\nRun `gh-grep` instead of `gh grep`.\n\n**deb:**\n\n``` console\n$ export GH_GREP_VERSION=X.X.X\n$ curl -o gh-grep.deb -L https://github.com/k1LoW/gh-grep/releases/download/v$GH_GREP_VERSION/gh-grep_$GH_GREP_VERSION-1_amd64.deb\n$ dpkg -i gh-grep.deb\n```\n\n**RPM:**\n\n``` console\n$ export GH_GREP_VERSION=X.X.X\n$ yum install https://github.com/k1LoW/gh-grep/releases/download/v$GH_GREP_VERSION/gh-grep_$GH_GREP_VERSION-1_amd64.rpm\n```\n\n**apk:**\n\n``` console\n$ export GH_GREP_VERSION=X.X.X\n$ curl -o gh-grep.apk -L https://github.com/k1LoW/gh-grep/releases/download/v$GH_GREP_VERSION/gh-grep_$GH_GREP_VERSION-1_amd64.apk\n$ apk add gh-grep.apk\n```\n\n**homebrew tap:**\n\n```console\n$ brew install k1LoW/tap/gh-grep\n```\n\n**macports:**\n\n```console\n$ sudo port install gh-grep\n```\n\nMaintainer: @herbygillot\n\n**manually:**\n\nDownload binary from [releases page](https://github.com/k1LoW/gh-grep/releases)\n\n**go get:**\n\n```console\n$ go get github.com/k1LoW/gh-grep\n```\n\n**docker:**\n\n```console\n$ docker pull ghcr.io/k1low/gh-grep:latest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk1low%2Fgh-grep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk1low%2Fgh-grep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk1low%2Fgh-grep/lists"}