You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve gh api short flag output to mention @ support #9966
Describe the feature or problem you’d like to solve
I'm trying to submit a ~200KB SARIF file to the upload SARIF endpoint.
Using gh involves constructing the entire payload as a command-line, and shells don't really approve of 200KB command-lines...
Proposed solution
Add some syntax to allow passing data via a file instead of expanded on a command line will allow users to use gh to submit large SARIF files (and probably other payloads) instead of resorting to curl.
(check-spelling is currently on the fence and uses gh some of the time and curl some of the time.)
Is the --input flag insufficient for your use case?
--input file The file to use as body for the HTTP request (use "-" to read from standard input)
I'm honestly not sure how it interacts with -f, but based on your curl I'm also not sure if you need it? Happy to spend time doing further investigation if it is something you need.
I couldn't tell. If it works, it needs to be documented in the -f documentation.
Actually it looks like it's covered in the Long description:
To pass pre-constructed JSON or payloads in other formats, a request body may be read
from file specified by --input. Use - to read from standard input. When passing the
request body this way, any parameters specified via field flags are added to the query
string of the endpoint URL.
changed the title [-]Provide an equivalent to `curl`'s `-d @filename` for at least `gh api`[/-][+]Improve `gh api` short flag output to mention `@` support[/+]on Nov 29, 2024
Hmm, it sounds like the feature is indeed there. I'd argue that the @ stuff should be hinted in the summary just as - is for -i:
-F, --field key=value Add a typed parameter in key=value format
-H, --header key:value Add a HTTP request header in key:value format
--hostname string The GitHub hostname for the request (default "github.com")
-i, --include Include HTTP response status line and headers in the output
--input file The file to use as body for the HTTP request (use "-" to read from standard input)
Activity
williammartin commentedon Nov 29, 2024
Hey @jsoref,
Is the
--inputflag insufficient for your use case?I'm honestly not sure how it interacts with -
f, but based on your curl I'm also not sure if you need it? Happy to spend time doing further investigation if it is something you need.Cheers.
jsoref commentedon Nov 29, 2024
I couldn't tell. If it works, it needs to be documented in the
-fdocumentation.williammartin commentedon Nov 29, 2024
Actually it looks like it's covered in the Long description:
williammartin commentedon Nov 29, 2024
And in fact, in the
-F/--fieldflag part in the long description it says:Which I had no idea about!
This looks like it satisfies the same feature as curl right?
[-]Provide an equivalent to `curl`'s `-d @filename` for at least `gh api`[/-][+]Improve `gh api` short flag output to mention `@` support[/+]jsoref commentedon Nov 29, 2024
Hmm, it sounds like the feature is indeed there. I'd argue that the
@stuff should be hinted in the summary just as-is for-i: