mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-17 09:25:17 +00:00
121 lines
2.4 KiB
Groff
121 lines
2.4 KiB
Groff
.nh
|
|
.TH "GH-SEARCH-CODE" "1" "Jul 2025" "GitHub CLI 2.76.2" "GitHub CLI manual"
|
|
|
|
.SH NAME
|
|
gh-search-code - Search within code
|
|
|
|
|
|
.SH SYNOPSIS
|
|
\fBgh search code <query> [flags]\fR
|
|
|
|
|
|
.SH DESCRIPTION
|
|
Search within code in GitHub repositories.
|
|
|
|
.PP
|
|
The search syntax is documented at:
|
|
|
|
\[la]https://docs.github.com/search\-github/searching\-on\-github/searching\-code\[ra]
|
|
|
|
.PP
|
|
Note that these search results are powered by what is now a legacy GitHub code search engine.
|
|
The results might not match what is seen on \fBgithub.com\fR, and new features like regex search
|
|
are not yet available via the GitHub API.
|
|
|
|
|
|
.SH OPTIONS
|
|
.TP
|
|
\fB--extension\fR \fB<string>\fR
|
|
Filter on file extension
|
|
|
|
.TP
|
|
\fB--filename\fR \fB<string>\fR
|
|
Filter on filename
|
|
|
|
.TP
|
|
\fB-q\fR, \fB--jq\fR \fB<expression>\fR
|
|
Filter JSON output using a jq expression
|
|
|
|
.TP
|
|
\fB--json\fR \fB<fields>\fR
|
|
Output JSON with the specified fields
|
|
|
|
.TP
|
|
\fB--language\fR \fB<string>\fR
|
|
Filter results by language
|
|
|
|
.TP
|
|
\fB-L\fR, \fB--limit\fR \fB<int> (default 30)\fR
|
|
Maximum number of code results to fetch
|
|
|
|
.TP
|
|
\fB--match\fR \fB<strings>\fR
|
|
Restrict search to file contents or file path: {file|path}
|
|
|
|
.TP
|
|
\fB--owner\fR \fB<strings>\fR
|
|
Filter on owner
|
|
|
|
.TP
|
|
\fB-R\fR, \fB--repo\fR \fB<strings>\fR
|
|
Filter on repository
|
|
|
|
.TP
|
|
\fB--size\fR \fB<string>\fR
|
|
Filter on size range, in kilobytes
|
|
|
|
.TP
|
|
\fB-t\fR, \fB--template\fR \fB<string>\fR
|
|
Format JSON output using a Go template; see "gh help formatting"
|
|
|
|
.TP
|
|
\fB-w\fR, \fB--web\fR
|
|
Open the search query in the web browser
|
|
|
|
|
|
.SH JSON FIELDS
|
|
\fBpath\fR, \fBrepository\fR, \fBsha\fR, \fBtextMatches\fR, \fBurl\fR
|
|
|
|
|
|
.SH EXIT CODES
|
|
0: Successful execution
|
|
|
|
.PP
|
|
1: Error
|
|
|
|
.PP
|
|
2: Command canceled
|
|
|
|
.PP
|
|
4: Authentication required
|
|
|
|
.PP
|
|
NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.
|
|
|
|
|
|
.SH EXAMPLE
|
|
.EX
|
|
# Search code matching "react" and "lifecycle"
|
|
$ gh search code react lifecycle
|
|
|
|
# Search code matching "error handling"
|
|
$ gh search code "error handling"
|
|
|
|
# Search code matching "deque" in Python files
|
|
$ gh search code deque --language=python
|
|
|
|
# Search code matching "cli" in repositories owned by microsoft organization
|
|
$ gh search code cli --owner=microsoft
|
|
|
|
# Search code matching "panic" in the GitHub CLI repository
|
|
$ gh search code panic --repo cli/cli
|
|
|
|
# Search code matching keyword "lint" in package.json files
|
|
$ gh search code lint --filename package.json
|
|
|
|
.EE
|
|
|
|
|
|
.SH SEE ALSO
|
|
\fBgh-search(1)\fR
|