Commit graph

160 commits

Author SHA1 Message Date
itchyny
6057bfadbf Use pre-compiled regexp for matching Content-Type 2026-02-25 19:43:45 +09:00
Babak K. Shandiz
ba5c9af957
docs(api): add example for --input option
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-10-31 13:44:17 +00:00
Babak K. Shandiz
ad0252e845
docs(api): mention use of @<path> and @- for --field
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-10-31 13:35:20 +00:00
William Martin
43e76099a5
Merge pull request #11274 from jsoref/issue-11239
Improve `api` `--preview` docs
2025-07-23 10:42:13 +02:00
Andy Feller
313d20ba83 Ensure hostnames are visible in CLI website
This commit changes <github.com> and <ghe.com> references to `github.com` and `ghe.com` so they are visible on the GitHub CLI marketing website.

GitHub Pages will render URLs with a protocol as clickable links, however hostnames are treated as HTML elements and not rendered.
2025-07-14 08:33:20 -04:00
Josh Soref
4687f3312d
Improve api --preview docs
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2025-07-11 12:35:10 -04:00
William Martin
8deae3038a Use active token stubbing on auth config 2025-06-17 15:53:13 +02:00
Anuraag Agrawal
cc9a2411e0 Cleanup 2025-05-29 12:28:26 +09:00
Anuraag Agrawal
f294a5f533 fix: get token for active user instead of blank if possible 2025-05-29 12:13:21 +09:00
William Martin
f4382d1345 Revert "Merge pull request #10384 from iamazeem/9798-gh-api-encode-package-name"
This reverts commit ed2c322a73, reversing
changes made to f019cf7cea.
2025-03-18 13:13:06 +01:00
Azeem Sajid
33c30d5bd1 Inconsistent format of examples in help text 2025-02-27 16:26:25 +05:00
Tyler McGoffin
ed2c322a73
Merge pull request #10384 from iamazeem/9798-gh-api-encode-package-name
[gh api] Escape package name (URL encoding) for packages endpoint
2025-02-25 11:12:48 -08:00
Azeem Sajid
9c87069199 Add docs; rename function name 2025-02-25 10:37:14 +05:00
Azeem Sajid
026f64ce6f Standardize URLs 2025-02-13 10:41:53 +05:00
Josh Soref
023e347078 Do not try to parse bodies for HEAD requests
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2025-02-07 14:31:15 -05:00
Azeem Sajid
4107944f39 [gh api] Escape package name (URL encoding) for packages endpoint 2025-02-07 13:12:04 +05:00
Azeem Sajid
9e14550f11 [gh api] Fix mutual exclusion messages of --slurp flag 2025-01-30 10:21:18 +05:00
Chris Buckley
a6a1a58dd8
Update documentation for gh api PATCH 2024-07-22 19:36:20 +01:00
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
Babak K. Shandiz
7c4e45cc9d
Fix issue with closing pager stream (#9020)
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-29 15:48:08 +02:00
William Martin
fd4f2c9c1f
Merge pull request #8620 from heaths/merge-json
Merge JSON responses from `gh api`
2024-04-17 11:45:13 +02:00
Heath Stewart
2758b80013
Remove unnecessary --help comment 2024-04-15 21:38:16 -07:00
Andy Feller
88a7e529ab
Merge pull request #8762 from Ebonsignori/8761/allow-multiple-items-in-nested-array
allow multiple items in nested array
2024-04-09 14:23:19 -04:00
Andy Feller
b722dd4151 Add tests for non-happy field paths
This commit as a suite of test around different combination of `gh api` field scenarios that result in errors.

In the course of creating this test, there were 2 scenarios that did not raise an error as expected involving overriding an existing map value.
2024-04-05 17:21:28 -04:00
William Martin
9738d68bba Fix api cache test 2024-04-05 16:47:29 +02:00
Heath Stewart
4ea7bcacb3
Run defers in queue 2024-04-04 01:26:10 -07:00
Heath Stewart
a76af8588c
Resolve PR comments 2024-04-04 01:26:09 -07:00
Heath Stewart
e83e049306
Wrap JSON arrays, objects in array with --slurp
Effectively copies `jq --slurp` since `--jq` already uses the same grammar.
2024-04-04 01:26:05 -07:00
Heath Stewart
f41876d64c
Resolve PR comments 2024-04-04 01:21:04 -07:00
Heath Stewart
0dfe6ec4b4
Clarify --merge-pages docs
Only works when piping or redirecting stdout.
2024-04-04 01:21:03 -07:00
Heath Stewart
48f0cd6f11
Replace --paginate-all with --merge-pages 2024-04-04 01:21:02 -07:00
Heath Stewart
310e5524ba
Resolve test issues 2024-04-04 01:21:01 -07:00
Heath Stewart
e7f5dded06
Add more JSON merge tests 2024-04-04 01:21:00 -07:00
Heath Stewart
a65103667e
Move jsonmerge package to internal 2024-04-04 01:20:57 -07:00
Heath Stewart
8e27e9a8cd
Merge JSON responses from gh api
Partly resolves cli/cli#1268 and replaces cli/cli#5652. Requires cli/go-gh#148 to be merged and optionally released.
2024-04-04 01:06:43 -07:00
Evan Bonsignori
fce871f3f4
Apply suggestions from code review
Co-authored-by: Andy Feller <andyfeller@github.com>
2024-04-02 17:39:20 -07:00
Evan Bonsignori
3c3bed779f update example for deeply nested array update 2024-03-15 18:43:00 -07:00
Evan Bonsignori
234e0b3c8a allow multiple items in nested array 2024-02-26 17:43:51 -08:00
Yukai Chou
ba585149c3 Leftovers 2023-11-23 07:12:47 +08:00
Yukai Chou
e81b9b2517 Wrap HTTP methods 2023-11-23 07:10:08 +08:00
Yukai Chou
07a87ca8a4 Wrap special values and placeholders like - and $1 2023-11-23 07:09:29 +08:00
Yukai Chou
21bf1babdf Proof-reading 2023-11-17 02:04:35 +08:00
Sam Coe
ebcf3a1022
Set default Accept header for api command when one is not specified (#8303) 2023-11-06 15:22:32 +01:00
Jun Nishimura
508065b72d
Add verbose flag to api cmd (#7826) 2023-08-25 09:37:37 -07:00
Alex Petrov
343896fdac
Do not interpret "branch" placeholder in api command when GH_REPO is set (#7626)
* fix(api): do not interpret "branch" placeholder when `GH_REPO` is set

Before, we would always interpret the "branch" placeholder, typically
setting it to the currently checked-out branch in the repository in the
current working directory. It didn't make sense to do that when the
`GH_REPO` environment variable was specified because the repository
would likely be different from the one in the current working directory.

Now, we instead report an error if both `GH_REPO` environment variable
and `branch` placeholder are specified.
2023-07-06 07:05:40 +00:00
Mislav Marohnić
63a4319f6c
api: output a single JSON array in REST pagination mode (#7190)
When fetching N pages, avoid printing N separate JSON arrays to the output stream. Instead, massage the output so that the N pages of data are merged into a single JSON array. This is achieved by omitting the final `]` for the first page, and omitting the initial `[` for all subsequent pages.
2023-06-09 20:55:06 +02:00
ffalor
e4e7bf5c8c
force method to uppercase (#7514)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2023-06-01 13:54:56 +00:00
Mislav Marohnić
7a814b31c2
api: support array params in GET queries (#7513) 2023-05-31 20:23:31 +02:00
Martijn Pieters
530002ee7a
Pretty-print JSON results of jq filtering (#7236)
When connected to a TTY, tell the jq formatter to indent the output, and
enable colorization of the output if the terminal supports it.

Co-authored-by: Mislav Marohnić <mislav@github.com>
2023-04-25 13:27:17 +00:00
Sam Coe
dbc2f05124
Update go-gh to v2 (#7299)
* Update go-gh

* Update code for go-gh v2
2023-04-16 15:34:23 +10:00