Allow --json option for list#128
Conversation
|
Thanks! Will check it out. |
|
Thanks Jonas — happy to see this picked up. A couple of things to sort out before we merge, mostly about making the JSON useful for the scripting use case from #35. Main concern: the JSON should be structured data, not pre-formatted strings. Right now the values are the same human-formatted strings the table prints, e.g.: { "Date": "2026-01-15 14:30", "Source": "/srv/a\n/srv/b", "Files": "1.2k", "Size": "11 B", "Host": "" }A consumer would have to reparse Both serde_json::to_string_pretty(&snapshots)? // Vec<(SnapshotEntry, Option<SnapshotStats>)>That gives you ISO-8601 timestamps from chrono, the snapshot id, the full The test would be a bit stronger if it round-trips through Two questions on the larger plan, both worth deciding before this lands so we don't end up with seven copies of the same branching:
No new third-party dep concerns — |
|
Thanks for the guidance - these all make sense. I'll see if I can work on these towards the end of this week. Concering direction - if all the subcommands want to have a Depending on the representation of the values, the |
e18d01c to
c6fc586
Compare
| use crate::passphrase::with_repo_passphrase; | ||
| use crate::table::CliTableTheme; | ||
|
|
||
| // use serde_json::Value; |
There was a problem hiding this comment.
This feels out of place here. Where would you place SnapshotView?
This is my first attempt at the JSON output mentioned in #35. Please advise if you'd rather pull these into
AsciiTablePrinterandJsonPrinterrespectively - I don't think it's neccessary forlist.Also please let me know if you've got a "larger plan" for the JSON output or if you're fine with adding branches for each command.