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
Support using both --jq and --template for gh repo list #8734
Then I can use the --jq option to get the data structure I need: gh repo list cli --json name,primaryLanguage --jq '. | reduce .[] as { $primaryLanguage, $name } ({}; .[$primaryLanguage.name | tostring] += [$name])', which will output:
Now, to get the output I shown above (in Markdown), I can use --template, with something like: gh repo list cli --json name,primaryLanguage --jq '. | reduce .[] as { $primaryLanguage, $name } ({}; .[$primaryLanguage.name | tostring] += [$name])' --template '{{ range $language, $repositories := . }}## {{ .language }}{{ "\n\n" }}{{ range $repository := $repositories }}- {{ .name }}{{ "\n" }}{{ end }}{{ end }}'. But that will give me the same output as before (the JSON object).
The other way around, running gh repo list cli --json name,primaryLanguage --template '{{ range . }}- {{ .name }}{{ "\n" }}{{ end }}' will output:
Activity
ronnypolley commentedon Feb 21, 2024
I would like to see the same in other subcommands too (like
search).williammartin commentedon Feb 26, 2024
Thanks for the detailed description of what you're wanting to do, it's very useful to have the context.
This looks like a duplicate of #8415 and there are some workarounds offered there. If I've misunderstood feel free to reopen.