json output added to put customized output into the users’ control.
Issue: 2e51b37 Topic: https://radicle.zulipchat.com/#narrow/channel/369873-Support/topic/.60rad.20issue.20list.60.20as.20tsv.20or.20json.3F/with/538037563
Refactored list command to collect new IssueSummary struct via map.
Move table printing into dedicated function.
Dispatched on new output format option (OutputFormat).
Currently, options are ‘table’ or new ‘json’ via serde_json.
An alternative to this code might be using cache.db with sqlite3.
But getting author and assignee aliases from DID isn’t easy (?)
sqlite3 $(rad self --home)/cobs/cache.db "
select json_group_array(json_insert(json_extract(issue,'$'),'$.id',id))
from issues
where repo = '$(rad .)'"|
jq '.[] |
[.id, .state.status,
([(.thread.comments[]|[(.edits[0].timestamp/1000|todate),.author])]|sort[0]),
.title]|
flatten(1) | @tsv' -r
json output added to put customized output into the users’ control.
Issue: 2e51b37 Topic: https://radicle.zulipchat.com/#narrow/channel/369873-Support/topic/.60rad.20issue.20list.60.20as.20tsv.20or.20json.3F/with/538037563
Refactored list command to collect new IssueSummary struct via map.
Move table printing into dedicated function.
Dispatched on new output format option (OutputFormat).
Currently, options are ‘table’ or new ‘json’ via serde_json.
An alternative to this code might be using cache.db with sqlite3.
But getting author and assignee aliases from DID isn’t easy (?)
sqlite3 $(rad self --home)/cobs/cache.db "
select json_group_array(json_insert(json_extract(issue,'$'),'$.id',id))
from issues
where repo = '$(rad .)'"|
jq '.[] |
[.id, .state.status,
([(.thread.comments[]|[(.edits[0].timestamp/1000|todate),.author])]|sort[0]),
.title]|
flatten(1) | @tsv' -r
I like the general idea, but there needs to be cleanup done here ;-)
Thanks a lot for your contribution! We want JSON output, but we’re also working on migrating the default CLI argument parsing library, starting with rad issue. So I’d like to rebase and only merge this after the migration has been done.
- Rebase onto new
clap-based implementation ofrad issue - Remove intermediate type
IssueSummary