-
Notifications
You must be signed in to change notification settings - Fork 16
/
github_cli.cli.txt
365 lines (264 loc) · 18.1 KB
/
github_cli.cli.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
GITHUB_CLI
VERSION ==> #2.37.0
ENVVAR GH_NO_UPDATE_NOTIFIER #Unless set, automatically updates
GOAL ==> #Both:
# - a command for every GitHub API endpoint with `gh api`
# - CLI commands to simplify DX flow
INSTALLATION ==> #Go binary, installed through OS package
HUB ==> #Old unofficial CLI, to avoid
/=+===============================+=\
/ : : \
)==: CONFIG :==(
\ :_______________________________: /
\=+===============================+=/
ENVVAR GH_PATH #PATH to `gh` binary
GH_CONFIG_DIR #DIR of config files. Def:
# - $XDG_CONFIG_HOME/gh (if available)
# - $AppData/GitHub CLI (if available, Windows only)
# - ~/.config/gh
GH_CONFIG_DIR/config.yml #CONFIG
gh config --host|-h #'HOST'. Per-HOST CONFIG
gh config list #Print CONFIG
gh config get 'VAR' #Get CONFIG.VAR
gh config set 'VAR' VAL #Set CONFIG.VAR
gh config clear-cache #Clear CLI cache
/=+===============================+=\
/ : : \
)==: ALIAS :==(
\ :_______________________________: /
\=+===============================+=/
gh alias set ALIAS '...' #Make `gh ALIAS [...]` a shortcut for gh ...
#'...' can use:
# - $NUM: additional arguments in [...]
# - - (stdin)
--shell|-s #Run in `sh`
#Can also prepend ALIAS with !
--clobber #Overwrite
CONFIG.aliases.ALIAS #'...'
gh alias list #
gh alias delete ALIAS #
--all #
gh alias import PATH|- #Import ALIASes
#PATH is YAML, with keys being ALIAS, and values '...'
--clobber #Overwrite
/=+===============================+=\
/ : : \
)==: CLI :==(
\ :_______________________________: /
\=+===============================+=/
ENVVAR GH_FORCE_TTY #Force TTY. If NUM, number of COLs. If percentage, number of COLs multiplied by detected one
CONF.prompt
GH_PROMPT_DISABLED #No interactive prompt
INTERACTIVE PROMPT ==> #Many commands show interactive prompt when required arguments are missing
ENVVAR GLAMOUR_STYLE #Markdown style
ENVVAR NO_COLOR #
ENVVAR CLICOLOR=0 #
ENVVAR CLICOLOR_FORCE=1 #
gh completion #Completion script
--shell|-s #bash|zsh|fish|powershell
/=+===============================+=\
/ : : \
)==: EDIT :==(
\ :_______________________________: /
\=+===============================+=/
CONFIG.pager
ENVVAR GH_PAGER|PAGER #Used to read files
CONFIG.editor
ENVVAR GH_EDITOR|GIT_EDITOR
|VISUAL|EDITOR #Used to edit files
CONFIG.browser
ENVVAR GH_BROWSER|BROWSER #Used to open links
--web|-w #Use browser. Only with commands:
# - auth login
# - gist|issue|pr|project|release|repo|run|ruleset|workflow view
# - codespace|issue|label|pr|project|ruleset list
# - codespace|gist|issue|pr create
# - issue|pr comment
# - pr checks|diff
# - search, extension search
# - codespace code
gh browse [ARG] #Browse a REPO
gh browse NUM #Open issue|PR NUM
gh browse PATH #Open file
gh browse SHA #Open commit
--projects|-p #Open Projects page
--releases|-r #Open Releases page
--settings|-s #Open Settings page
--wiki|-w #Open Wiki page
--no-browser|-n #Print REPO URL without opening it
--commit|-c #'SHA' (def: 'last')
/=+===============================+=\
/ : : \
)==: OUTPUT :==(
\ :_______________________________: /
\=+===============================+=/
ENVVAR GH_DEBUG #false, true, or 'api'. Verbose mode
--json #'VAR,...'. Outputs as JSON instead of text
#If 'VAR,...' omitted, prints list of possible VARs
#Only with commands:
# - codespace|issue|label|pr|repo|run|workflow list
# - codespace|issue|pr|release|repo|run view
# - issue|pr status
# - codespace ports
# - search, extension search
# - api: always enabled
--jq|-q #STR. Applies jq filter.
#Requires --json
--template|-t #STR. Applies Go template.
#Requires --json
/=+===============================+=\
/ : : \
)==: AUTH :==(
\ :_______________________________: /
\=+===============================+=/
ENVVAR GH_HOST
gh auth ...
--hostname|-h #'HOSTNAME' (def: 'github.com')
gh auth login|refresh
--scopes|-s #Additional 'PRIVILEGE,...'. Default: repo, read:org, gist
--insecure-storage #Do not encrypt gho_* token locally
gh auth login #Authenticate as an OAuth app, then keep gho_* token locally
--with-token #Read token from stdin instead of browser
CONFIG.git_protocol
--git-protocol|-p #'ssh' (def) or 'https'
ENVVAR GH_TOKEN|GITHUB_TOKEN #Can be used too
gh auth logout #
gh auth status #Show auth status
--show-token|-t #Do not hide gho_* token
gh auth token #Print gho_* token
gh auth refresh #Grant more PRIVILEGEs
--remove-scopes|-r #'PRIVILEGE,...' to remove instead
--reset-scopes #Resets to min PRIVILEGEs
gh auth setup-git #Make `git` use `gh auth` for authentication
/=+===============================+=\
/ : : \
)==: API :==(
\ :_______________________________: /
\=+===============================+=/
--limit|-L #NUM (def: 30). ?per_page API parameter
#Only for commands:
# - * list, except alias|config|variable|secret|extension|gpg-key|ssh-key
# - search, extension search
--sort|-s #'PROP'. ?sort API parameter
#Only for command: cache list
--order|-o #'asc|desc'. ?direction API parameter
#Only for command: cache list
CONFIG.http_unix_socket #Proxies HTTP requests to this Unix socket
gh api PATH #Run GitHub REST API request
gh api graphql #Run GitHub GraphQL API request
--method|-X #'HTTP_METHOD'
#Def: 'POST' if -F|-f, 'GET' otherwise
--field|-F VARR=VAL #Query|body parameter
#'{owner|repo|branch}' are guessed from current DIR
#'@PATH' and '-' can be used
#'VARR' are []-delimited
#With GraphQL, VARR is query, operationName, or GraphQL variable
--raw-field|-f VARR=STR #Query|body parameter, with STR value
--input #Request body parameter, as 'PATH', or '-' for stdin
--header|-H VAR:VAL #Request header
--paginate #Get full response through pagination
#With GraphQL, requires using $endCursor variable and returning pageInfo.endCursor|hasNextPage
--include|-i #Print response status and headers
--silent #Do not print response
--verbose #Like ENVVAR GH_DEBUG
--cache #'DURATION'. Cache response
/=+===============================+=\
/ : : \
)==: EXTENSIONS :==(
\ :_______________________________: /
\=+===============================+=/
CLI EXTENSION ==> #Use topic `gh-extension`
gh extension install STR #Install EXTENSION
#STR can be 'USER/REPO', URL or DIR
--force #If already installed, upgrade
--pin #'TAG|COMMIT' to pin version
gh extension remove EXTENSION #
gh EXTENSION ...
gh extension exec EXTENSION ... #Run an EXTENSION
gh extension list #List installed EXTENSIONs
gh extension browse #Browse available EXTENSIONs in TUI
gh extension search QUERY #Search available EXTENSIONs
gh extension create NAME #Create a new
--precompiled #'go|other'. Precompiled binary
/=+===============================+=\
/ : : \
)==: REPO :==(
\ :_______________________________: /
\=+===============================+=/
--repo-owner #'USER'
#Only for commands:
# - codespace code|cp|delete|edit|jupyter|logs|ports|rebuild|ssh|stop|view
ENVVAR GH_REPO #'USER/REPO'
--repo|-R #For same commands as --repo-owner, plus:
# - codespace create|list
# - search (can be 'USER/REPO,...')
# - issue|pr|label|release|workflow|run|secret|variable|cache|ruleset ...
#Def: based on cwd
--repos|-r #'USER/REPO,...'
#Only for commands: git secret|variable set
#Def: based on cwd
--branch|-b #'BRANCH'
#Only for commands: browse, codespace create, pr checkout, repo sync|view, run list
#Def: based on current `git`
--user|-u #'USER'
#Only for commands: codespace delete|list|stop, secret delete|list|set, run list
--org|-o #'ORG'
#Same commands as --user, plus: variable delete|list|set, repo fork, status, ruleset list|view
gh org list #List ORGs
/=+===============================+=\
/ : : \
)==: COMMANDS :==(
\ :_______________________________: /
\=+===============================+=/
gh status #Shows assigned issues|PRs, PR reviews, @-mentions, new issues|PR|comments
--exclude|-e #'USER/REPO,...'
gh repo ... #Commands related to repos:
# - create, clone, delete, list, edit, view, rename
# - fork, sync, set-default
# - [un]archive
# - deploy-key [add|delete|list]
gh pr ... #Commands related to PRs:
# - create, list, view
# - comment, ready, review
# - edit, close, reopen status
# - [un]lock
# - diff
# - checkout, merge (git operations)
# - checks (checks status)
gh issue ... #Commands related to issues:
# - create, delete, list, view
# - comment
# - edit, close, reopen, status
# - [un]lock, [un]pin, transfer
# - develop (create branches based on issue)
gh label ... #Commands related to labels: create, clone, delete, list, edit
gh release ... #Commands related to releases:
# - create, delete, edit, list, view
# - upload, download, delete-asset
gh ruleset ... #Commands related to repo rulesets
gh ruleset list|view #
--parents|-p #Include parent rulesets
gh ruleset check [BRANCH] #View rulesets for a given BRANCH (def: current)
--default #Use REPO default BRANCH
gh workflow|run ... #Commands related to WORKFLOW|RUNs. See GitHub actions doc
gh cache ... #Commands related to GitHub actions (see its doc) cache
gh project ... #Commands related to GitHub projects:
# - create, copy, delete, close, edit, list, view
# - item-create, item-delete, item-edit, item-list, item-add, item-archive
# - field-create, field-delete, field-list
# - mark-template
gh secret ... #Commands related to repo secrets: set, delete, list
gh variable ... #Commands related to repo variables: set, delete, list
gh gpg-key ... #Commands related to GPG keys: add, delete, list
gh ssh-key ... #Commands related to SSH keys: add, delete, list
gh gist ... #Commands related to gist: create, clone, delete, list, view, edit, rename
gh codespace ... #Commands related to Codespace:
# - code (open), create, delete, list, view, edit, rebuild, stop
# - cp (files)
# - jupyter
# - ssh
# - logs
# - ports [forward|visibility]
gh search ... #Commands searching: code, repos, issues, prs, commits