fnogatz / clocker

Command-line tool to track project hours
Other
420 stars 31 forks source link

more verbose json output #25

Open chmanie opened 9 years ago

chmanie commented 9 years ago

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.

fnogatz commented 9 years ago

Yeah, refactoring the different output formats is definitely a good thing to work on. I suggest the following interface:

What do you think?

yoshuawuyts commented 9 years ago

@fnogatz lgtm!

fnogatz commented 9 years ago

RFC @substack

chmanie commented 9 years ago

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

fnogatz commented 9 years ago

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 :)