Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
cli/rad: issue list --output json
Draft did:key:z6MkuCCE...SEyW opened 7 months ago

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
did:key:z6MkuCCE...SEyW opened with revision 6e63c4b8 on base f00d1d67 +100 -37 7 months ago

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
did:key:z6MkwcUR...q1kL rejected · 3 comments 7 months ago

I like the general idea, but there needs to be cleanup done here ;-)

did:key:z6MkgFq6...nBGz commented on revision 1 7 months ago

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.

did:key:z6MkgFq6...nBGz pushed revision 2 fc84bb11 on base f1c7c986 +65 -8 7 months ago
  • Rebase onto new clap-based implementation of rad issue
  • Remove intermediate type IssueSummary