clocker icon indicating copy to clipboard operation
clocker copied to clipboard

more verbose json output

Open chmanie opened this issue 11 years ago • 5 comments

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.

chmanie avatar Apr 17 '15 10:04 chmanie

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 as clocker csv today
  • clocker list --json --aggrate day: similar to clocker data today
  • All existing output commands are aliases to clocker list.

What do you think?

fnogatz avatar Apr 18 '15 14:04 fnogatz

@fnogatz lgtm!

yoshuawuyts avatar Apr 18 '15 18:04 yoshuawuyts

RFC @substack

fnogatz avatar Apr 25 '15 12:04 fnogatz

I am working on some pinning tests to support the refactoring. I could share them with you soon.

chmanie avatar Apr 25 '15 14:04 chmanie

Thanks for working on some tests at chmanie/clocker, @chmanie! My favorite approach would be:

  1. Write tests to document current expected behavior
  2. Create v2 branch
  3. Rewrite the current features in a /lib, so one could also require('clocker').stop() etc.
  4. Rewrite the current CLI to use the lib
  5. Publish v2 :)

fnogatz avatar May 05 '15 16:05 fnogatz