AlDanial / cloc

cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.
GNU General Public License v2.0
19.75k stars 1.02k forks source link

Support of pipe of single sourcefile #865

Open paul-hammant opened 3 weeks ago

paul-hammant commented 3 weeks ago

I've read https://github.com/AlDanial/cloc/issues/465 and this is different, but still about pipes, though.

Give a concise description of what you want cloc to be able to do.

cat My.java | sed '/\w*}\w*/d' | cloc --src-file-from-pip

In this situation I'm trying to make a claim to readers that only have so many consequential lines of code. The source is in the end-of-line-bracing style and I don't care to count } on a line on their own. Sed can remove those for me (the source would not longer compile) and it'd be great if cloc could still do the stats. Workaround is to make a temp file.

AlDanial commented 3 weeks ago

Rather than supporting source code piped into cloc, my plan is to implement "ignore" filters such as requested in #862 . I'll keep this open until I implement that.