Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count lines in files of arbitrary extensions #122

Open
alanhogan opened this issue Sep 27, 2019 · 0 comments
Open

Count lines in files of arbitrary extensions #122

alanhogan opened this issue Sep 27, 2019 · 0 comments

Comments

@alanhogan
Copy link

alanhogan commented Sep 27, 2019

I’d like for loc to take an option that allows counting of any arbitrary file extension(s). It could ignore blank lines without knowing the specific syntax.

Perhaps a few generic formats could be defined, such as "pound-commented" and "C-like". The former would recognize # this style of comment; the latter could ignore lines with only } end brackets (I’m not sure if LOC already does this for C, JS, etc) and would recognize /* this */ and // this style of comments.

Alternatively, extensions could be treated as other existing languages; I might alias .hdbs to .html.

From a purely utilitarian point of view, counting lines in unknown formats is still useful even if the comments can not be identified.

I’m personally curious to see .hdbs (handlebars) statistics, but this issue could resolve (or nearly resolve) many other specific requests: #113, #109, #100, #101, #102, and so on.

Example syntax might be:

loc my_folder/ --include-extensions=hdbs
loc --include-extensions=hdbs --parse-as=hdbs,html
loc --include-extensions=hdbs,pyw --parse-as=hdbs,html,pyw,py
loc --include-extensions=acme-config --parse-as=acme-config,pound-commented
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant