binhonglee/coco

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

Closed this issue · 2 comments

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 nim-lang/Nim#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

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.

Done! See the latest readme.