A2-ai / devious

Large/sensitive file linker for Git repositories
MIT License
5 stars 0 forks source link

Add `--json` flag to all outputs #22

Closed dpastoor closed 1 year ago

dpastoor commented 1 year ago

any command that prints information to the user about state should also be able to print as json so other tools can consume it.

To do this no other print information should leak so parsers won't choke

eg consider: https://github.com/A2-ai/devious/pull/21

how would the data structure look like if this was instead returned as a json blob.

The target tool will be R, so the structure should try to minimize nesting and is ideally mostly flat

for example an output structure might look like

{ results: [ {name: path/to/file.ext, wrote: true, cleanup: true, path: stored/path/location}, ....], errors: ... }

where results would be easily transformed into a tabular structure. the R package jsonlite will do this automagically for arrays of objects like the above so it works out well.

name | wrote | cleanup | path path/file.ext | true | true | path