more verbose json output
https://github.com/substack/clocker/pull/22 added csv output, which is great! additionally we have the data option which outputs json, but this is squashed to days to be compatible with invoicer.
I'd like to have the verbose list / csv output formatted as json.
To simplify the api I'd propose a flag for the list command either like this
clocker list --output=json / --output=csv, (or --json / --csv) because right now the csv command basically just reformats the list output. Maybe we could alias the csv command to not break the api?
I'd also happily start working on a PR for that. Let me know what you think.
Yeah, refactoring the different output formats is definitely a good thing to work on. I suggest the following interface:
-
clocker list: same as today -
clocker list --aggregate day: aggregate by day -
clocker list --aggregate month: aggregate by month (and maybe other times) -
clocker list --csv: same asclocker csvtoday -
clocker list --json --aggrate day: similar toclocker datatoday - All existing output commands are aliases to
clocker list.
What do you think?
@fnogatz lgtm!
RFC @substack
I am working on some pinning tests to support the refactoring. I could share them with you soon.
Thanks for working on some tests at chmanie/clocker, @chmanie! My favorite approach would be:
- Write tests to document current expected behavior
- Create v2 branch
- Rewrite the current features in a
/lib, so one could alsorequire('clocker').stop()etc. - Rewrite the current CLI to use the lib
- Publish v2 :)