binhonglee / coco

Code coverage for Nim lang (CLI + library)
MIT License
46 stars 3 forks source link

need a more user friendly API/cmd line to generate coverage report #2

Closed timotheecour closed 5 years ago

timotheecour commented 5 years ago

cmd line

instead of instructions here: https://github.com/samuelroy/nim-coverage#how-to-make-it-work-with-your-project I think we can have something a lot easier to use that'd only require calling a single command, eg:

nimble install coverage # would install a coverage binary under ~/.nimble/bin (alongside c2nim, nimble, nimgrep etc)
cd pathto/nim-regex # or whatever other code
coverage [options] --cov:outputdir:<outputdir> mainfile.nim

options would forward to nim compiler (eg, allowing to pass stuff like -d:foobar (or anything else) which affect how files are compiled (and affect coverage !) options starting with --cov: (eg --cov:outputdir:<outputdir>) would be specific to coverage binary and not forward to nim compiler

Note: for rationale behind syntax --cov:suboption:value see https://github.com/nim-lang/Nim/pull/8757

API

in addition, having an API (called by the cmd line) would be good to have

[EDIT] Note

cligen could be used to automate generating the cmd line given the API, in which case all that's needed is the API

samuelroy commented 5 years ago

Agree, the task was a simple way to get a code coverage system working. I will work on the API, it should be ready by next week.

Cligen looks really nice, thanks.

samuelroy commented 5 years ago

Done! See the latest readme.