{"id":42371165,"url":"https://github.com/liu-cn/search","last_synced_at":"2026-01-27T19:36:31.359Z","repository":{"id":57691913,"uuid":"481664583","full_name":"liu-cn/search","owner":"liu-cn","description":"全局文本代码搜索，可以搜索出指定文件内的指定文本，支持跳转到文本所在的行。","archived":false,"fork":false,"pushed_at":"2023-02-15T01:01:07.000Z","size":3601,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-20T01:46:42.447Z","etag":null,"topics":["codesearch","golang","textsearch"],"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/liu-cn.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2022-04-14T15:57:44.000Z","updated_at":"2023-06-13T09:16:17.000Z","dependencies_parsed_at":"2024-06-20T01:20:58.563Z","dependency_job_id":"7f8b507b-2a08-4339-a132-0f114ae9f19d","html_url":"https://github.com/liu-cn/search","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/liu-cn/search","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liu-cn%2Fsearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liu-cn%2Fsearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liu-cn%2Fsearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liu-cn%2Fsearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liu-cn","download_url":"https://codeload.github.com/liu-cn/search/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liu-cn%2Fsearch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28819509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["codesearch","golang","textsearch"],"created_at":"2026-01-27T19:36:30.603Z","updated_at":"2026-01-27T19:36:31.354Z","avatar_url":"https://github.com/liu-cn.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# search\n\n全局文本搜索，可以搜索出指定文件内的指定文本，支持跳转到文本所在的行。\n\n如果有go环境的话可以直接go install 安装，\n\n```go\n    go install github.com/liu-cn/search@latest\n```\n\n没有go环境，可自行下载windows macos linux 指定操作系统文件夹下可执行文件，下载后添加到环境变量即可使用\n\n\n\n使用方式\n\n```shell\nsearch -f \"文件\" -t \"文本\" -p \"目录(不指定默认从当前目录搜索)\" -e \"排除搜索的文本\"\n```\n\n例如：我想要搜索该目录下所有go文件中包含 \"跑路\" 的文本，应该这样的搜索\n\n```shell\nsearch -f \"*.go\" -t \"跑路\"\n```\n\ngoland/idea 显示效果 只要是jetbrains的编辑器都是支持直接点击后跳转到该行的\n\n![输出效果](http://cdn.motianli.com/cdn/%E6%88%AA%E5%B1%8F2022-04-15%2000.21.53.png)\n\nvscode显示效果，也支持点击跳转到文本位置\n\n![](http://cdn.motianli.com/cdn/%E6%88%AA%E5%B1%8F2022-04-15%2000.39.34.png)\n\n\n\n可以看到搜索到原代码是这样的，\n\n![](http://cdn.motianli.com/cdn/%E6%88%AA%E5%B1%8F2022-04-15%2000.41.40.png)\n\n可以看到第八行是注释，我们不想搜索到第八行，我们可以排除 注释 // 的行\n\n接下来命令可以改一下，改成这样\n\n```shell\nsearch -f \"*.go\" -t \"跑路\" -e \"//\"\n```\n\n显示效果，注释行已经被排除掉了\n\n![](http://cdn.motianli.com/cdn/%E6%88%AA%E5%B1%8F2022-04-15%2000.46.02.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliu-cn%2Fsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliu-cn%2Fsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliu-cn%2Fsearch/lists"}