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

Report by language and by file in the same report #756

Closed nkh closed 1 year ago

nkh commented 1 year ago

--by-file doesn't say what language the files have

--by-file-by-lan generates two report

two option could make the report more useful to me and hopefully many more

--by-file-show-lang which would add a column with the language, or an abreviation of it

--by-lang-and-file where the files are listed within a language section

AlDanial commented 1 year ago

I get your point; the challenge is displaying the information cleanly in a terminal because the lines become excessively long. You can get by file + by language information in CSV, SQL, YAML, XML, and JSON formats. Try, for example,

  cloc --by-file --csv

From the standard file formats one can write utilities to display the information in any desired manner. The SQL option makes it easy to write cloc's results to an SQLite database. Then you can use sqlite_formatter (included with cloc) for nicely formatted output, ref. https://github.com/AlDanial/cloc#sql-

Since there are many ways to produce the by file + language results I do not plan to change the basic text output.