TomasVotruba / lines

CLI tool for quick size measure of PHP project, runs anywhere
https://tomasvotruba.com/blog/easy-and-quick-way-to-measure-lines-of-code-in-php
MIT License
161 stars 4 forks source link

Add Key Value output formatter #39

Closed benr77 closed 6 months ago

benr77 commented 6 months ago

Here is an additional output formatter that simply creates a single line of comma separated key-value pairs.

The use-case is for ingesting the output of the measure command into InfluxDB, which is a data source for Grafana - basically so we can have nice dashboards showing the history of LOC, number of static methods etc from each CI build.

TomasVotruba commented 6 months ago

Hi, thanks for proposal.

I'd like to keep this package as simple as possible. The JSON already allow transforming to any format, so instead of hardcoding the output formatters here, anyone can do the conversion on the JSON output to any project they need.

Thanks for understanding

benr77 commented 6 months ago

Not a problem but I figured key-value was a good generic second choice to be alongside JSON.

I was looking for a one-liner to use in CI without any additional dependencies apart from bash, to extract the data to key-values and figured it would be much easier to allow the lines package itself to do the work, rather than have some esoteric bash command.