cli
cli copied to clipboard
Adds `--json` support to `gh release list`
Fixes: https://github.com/cli/cli/issues/4572
This pull request adds --json support to the gh release list command. It's my very first go at go, in case I need to change anything, please guide me.
@jessehouwing ➜ /workspaces/gh-cli/bin (trunk) $ ./gh release list --repo https://github.com/jessehouwing/azure-pipelines-tasks-zips --json tagName
[
{
"Name": "m208",
"TagName": "m208",
"IsDraft": false,
"IsLatest": true,
"IsPrerelease": false,
"CreatedAt": "2022-07-05T17:36:20Z",
"PublishedAt": "2022-07-15T19:17:42Z"
},
{
"Name": "m207",
"TagName": "m207",
"IsDraft": false,
"IsLatest": false,
"IsPrerelease": false,
"CreatedAt": "2022-07-04T20:26:14Z",
"PublishedAt": "2022-07-05T15:31:11Z"
},
{
"Name": "m206",
"TagName": "m206",
"IsDraft": false,
"IsLatest": false,
"IsPrerelease": false,
"CreatedAt": "2022-05-08T19:36:51Z",
"PublishedAt": "2022-06-02T05:16:27Z"
},
{
"Name": "m205",
"TagName": "m205",
"IsDraft": false,
"IsLatest": false,
"IsPrerelease": false,
"CreatedAt": "2022-05-08T19:36:51Z",
"PublishedAt": "2022-05-10T21:33:18Z"
},
{
"Name": "m204",
"TagName": "m204",
"IsDraft": false,
"IsLatest": false,
"IsPrerelease": false,
"CreatedAt": "2022-03-16T18:48:41Z",
"PublishedAt": "2022-04-19T15:32:10Z"
},
{
"Name": "m203",
"TagName": "m203",
"IsDraft": false,
"IsLatest": false,
"IsPrerelease": false,
"CreatedAt": "2022-03-16T18:48:41Z",
"PublishedAt": "2022-03-30T17:45:43Z"
},
{
"Name": "m202",
"TagName": "m202",
"IsDraft": false,
"IsLatest": false,
"IsPrerelease": false,
"CreatedAt": "2022-03-12T17:20:38Z",
"PublishedAt": "2022-03-12T17:39:06Z"
},
{
"Name": "m201",
"TagName": "m201",
"IsDraft": false,
"IsLatest": false,
"IsPrerelease": false,
"CreatedAt": "2022-03-02T11:33:30Z",
"PublishedAt": "2022-03-02T11:50:11Z"
}
]
@jessehouwing ➜ /workspaces/gh-cli/bin (trunk) $
it seems to work, though I'm forced to provide a list of fields. That list subsequently isn't used it seems...
It seems that a more generic fix is wanted. My experience with go it very short (I ventured into my first things today), switching over to GraphQL without breaking things seems a little farfetched.
Yes, I agree this is a bit more complex than what you probably signed for when you started out this PR 😄 This is also why we don't yet have release list --json support.
I think your initial PR is a great contribution for your first foray into Go, and if you don't mind keeping your PR open and being patient with us a little bit, we (the core team) could take over from here and implement the requirements from my review. Sounds good?
Sounds great. I may actually see how far I'll get. Is there a list command that's a good startingpoint or a doc somewhere that explains the magic of the Json magic function?
Seeing as this PR has been open for over a year without any progress I am going to close this as stale. Please let me know if this is in error.