Mislav Marohnić
ead6bf87d9
api: handle HTTP 409 error message from the server
...
Previously, "errors" field was either an array of strings or an array of
error objects. This covers an additional case when "errors" is a string:
$ gh api orgs/cli/actions/permissions/repositories
{
"message": "Conflict",
"errors": "Actions are enabled for all repositories",
"documentation_url": "https://docs.github.com/rest/reference/actions#list-selected-repositories-enabled-for-github-actions-in-an-organization "
}
2021-12-06 19:54:54 +01:00
Stefan Huber
a1daf96314
Clarify magic type conversion of api params ( #4434 )
...
Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-11-18 14:14:50 +00:00
Alan Donovan
f4491c7a80
Add FlagErrorf; encapsulate FlagError.error
2021-10-21 11:40:20 -04:00
Mislav Marohnić
01adff037f
api: prevent repeating GET parameters when paginating
2021-10-18 20:18:23 +02:00
Mislav Marohnić
2ca18e0600
Warn about missing OAuth scopes when reporting HTTP 4xx errors
...
If a 4xx server response lists scopes in the X-Accepted-Oauth-Scopes
header that are not present in the X-Oauth-Scopes header, the final
error messaging on stderr will now include a hint for the user that they
might need to request the additional scope:
$ gh codespace list
error getting codespaces: HTTP 403: Must have admin rights to Repository. (https://api.github.com/user/codespaces?per_page=30 )
This API operation needs the "codespace" scope. To request it, run: gh auth refresh -h github.com -s codespace
2021-10-13 23:24:14 +02:00
Reto Hablützel
f6e9734f17
add more hints to docs
2021-09-25 08:38:26 +02:00
rethab
f5b0d01e86
docs: add hint how to use use stdin in api command
2021-09-25 08:11:47 +02:00
Mislav Marohnić
11fbb60ae7
Rename the module to "github.com/cli/cli/v2"
2021-08-25 12:41:30 +02:00
Heath Stewart
e2973453b5
Add helper template functions for rendering tables ( #3519 )
...
Co-authored-by: Mislav Marohnić <mislav@github.com>
2021-08-23 21:00:25 +02:00
Robin Neatherway
0e51ec1699
Correct benign mistake in off-by-one guard
...
m[2] is the third element of m, rather than the second, so we have to
check instead that the len of m is at least 3.
Because the regular expression has two capture groups, the length of m
will always be 3, so currently the guard will always be true.
2021-08-19 14:41:04 +01:00
Cristian Dominguez
2f94adabb2
Use T.TempDir for temporary dirs in tests ( #3580 )
2021-05-07 12:21:26 +02:00
Mislav Marohnić
6a57dcfd7d
💅 cleanup placeholder implementation
2021-04-30 14:22:25 +02:00
Robin Neatherway
59b4d5cb7c
Support standard path variable replacement syntax
...
Add support for the following synonyms:
{owner} for :owner
{repo} for :repo
{branch} for :branch
2021-04-30 14:22:25 +02:00
Mislav Marohnić
a3a7deadb8
Merge pull request #3400 from embano1/patch-1
...
Add note on supported value types in raw-fields
2021-04-20 18:49:41 +02:00
Mislav Marohnić
e327b42f79
Add gh help formatting topic & link to it from commands with JSON output
2021-04-14 18:27:15 +02:00
Mislav Marohnić
61a8049592
Extract JSON filtering functionality from gh api
2021-04-13 16:48:21 +02:00
Michael Gasch
42b518191c
Add note on supported value types in raw-fields
...
Proposing a slight amendment to the `gh api` field docs to clarify the current limitation around "complex" field values, e.g. arrays/objects.
Related: #1484
Signed-off-by: Michael Gasch <mgasch@vmware.com>
2021-04-12 15:20:43 +02:00
Sam
9ec1e21d4c
Default to GHES host if only GHES is authenticated ( #3286 )
2021-03-30 16:51:00 +02:00
Kid
3a8313b4f7
Fix a typo in gh api
2021-03-08 22:14:29 +08:00
Mislav Marohnić
4e24f36495
Declare --jq, --template, --silent options mutually exclusive
2021-03-04 17:29:59 +01:00
Mislav Marohnić
d89756c94c
Add test for api --jq
2021-03-04 17:10:48 +01:00
Mislav Marohnić
06eeea0737
Change the api --filter flag to api --jq
2021-03-04 17:05:31 +01:00
Mislav Marohnić
4c26d617d3
Merge remote-tracking branch 'origin/api-template' into api-jq
2021-03-04 17:00:41 +01:00
Mislav Marohnić
eb08774370
Assert that executeTemplate is invoked
2021-03-04 16:48:06 +01:00
Mislav Marohnić
f53ad7161a
Add more api --template tests
2021-03-04 16:35:08 +01:00
Mislav Marohnić
0f27084f57
Add flag parsing test for api --template
2021-03-04 15:01:59 +01:00
Mislav Marohnić
07cb5e9e17
Merge remote-tracking branch 'origin' into api-template
2021-03-04 14:53:08 +01:00
Mislav Marohnić
440b59f8c3
Add the api --preview flag to opt into GitHub API previews
...
This was previously available manually via the `-H` flag, but it was
verbose, especially when opting into multiple previews.
2021-03-03 20:12:51 +01:00
Mislav Marohnić
03baeb2645
Add documentation and tests for api --filter
2021-03-03 19:24:38 +01:00
Mislav Marohnić
9f4eb55b66
Merge remote-tracking branch 'origin/api-template' into api-jq
2021-03-03 17:35:18 +01:00
Mislav Marohnić
bf97c6e273
Add template functions, documentation, tests
2021-03-02 20:07:04 +01:00
Mislav Marohnić
ed219ab5f3
Merge remote-tracking branch 'origin' into api-template
2021-03-02 18:31:28 +01:00
Mislav Marohnić
e32e6406a7
Add test for api --cache behavior
2021-03-01 16:04:19 +01:00
Mislav Marohnić
329ba1d57b
Add --filter to api command to filter data using jq syntax
2021-02-22 17:51:58 +01:00
Mislav Marohnić
fd82d621d5
Add color function to api templates
2021-02-22 16:54:27 +01:00
Mislav Marohnić
517cfc2365
Add api --format flag for specifying an output template
...
With the `--format` flag, the value of the flag is parsed as a Go
template which is then evaluated against parsed response data.
https://golang.org/pkg/text/template
2021-02-22 16:15:02 +01:00
Mislav Marohnić
9dff05bf20
Add api --cache flag
...
Cache API responses on disk for a specified duration.
2021-02-22 16:13:24 +01:00
Mislav Marohnić
335f0117c0
Add more examples to api docs
...
- Clarify that fields need to be in "key=value" format
- Headers need to be in "key:value" format
- Contrast POST vs GET requests with params in examples
- Add an example of how to add HTTP headers
- Use backticks where applicable
2021-02-11 19:17:10 +01:00
vilmibm
e92cd43259
add IOStreams.ReadUserFile
2020-11-23 11:21:28 -08:00
Sam Coe
414de332fb
cleanup
2020-11-12 09:52:14 +03:00
Sam Coe
a79a0bbfd7
Add support for GH_TOKEN and GH_ENTERPRISE_TOKEN
2020-11-12 09:52:10 +03:00
Mislav Marohnić
fbff1fcfd2
Clarify the --hostname flag
2020-10-21 16:45:06 +00:00
Mislav Marohnić
228191bf85
Document GH_HOST for api command
2020-10-21 16:43:48 +00:00
Mislav Marohnić
460d55f723
Move HostnameValidator to ghinstance
2020-10-21 16:31:20 +00:00
wilso199
3ecb9de1a7
Adding a hostname flag option for use with gh api
2020-10-21 16:31:20 +00:00
Mislav Marohnić
50291aa6de
Add PAGER support to the api command
2020-09-15 11:43:49 +02:00
Mislav Marohnić
ece17c4ce2
Add GITHUB_ENTERPRISE_TOKEN mention to api help
2020-09-07 21:37:55 +02:00
Mislav Marohnić
d8c5b7bfc0
Merge pull request #1517 from cli/select-host
...
Allow explicitly setting hostname for gh operations
2020-08-14 19:08:13 +02:00
Mislav Marohnić
c095a4bead
Allow explicitly specifying the hostname for gh operations
...
Accept the "HOST/OWNER/REPO" syntax or passing a full URL for both the
`--repo` flag and the GH_REPO environment variable and allow setting
GH_HOST environment variable to override just the hostname for
operations that assume "github.com" by default.
Examples:
$ gh repo clone example.org/owner/repo
$ GH_HOST=example.org gh repo clone repo
$ GH_HOST=example.org gh api user
$ GH_HOST=example.org gh gist create myfile.txt
$ gh issue list -R example.org/owner/repo
$ gh issue list -R https://example.org/owner/repo.git
$ GH_REPO=example.org/owner/repo gh issue list
2020-08-12 16:16:34 +02:00
Mislav Marohnić
e7a8b1e94e
Add documentation for ":branch" placeholder
2020-08-12 14:54:58 +02:00