Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to count total no of lines from .ts files

I have app folder and under that number of modules and components. I need to count only .ts files lines of code. So is there any plugin for VS Code or any other way please suggest?

like image 791
Rahul Pawar Avatar asked Dec 05 '22 09:12

Rahul Pawar


2 Answers

You can use the command-line tool CLOC (Count Lines of Code).

Installation :

npm install -g cloc  

Usage :

cloc my/app/folder --include-lang=TypeScript

You will get an output looking like this :

      88 text files.
      88 unique files.
      32 files ignored.

github.com/AlDanial/cloc v 1.82  T=0.12 s (516.3 files/s, 19421.4 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
TypeScript                      60            276            101           1880
-------------------------------------------------------------------------------
SUM:                            60            276            101           1880
-------------------------------------------------------------------------------

More info

like image 101
Augustin R Avatar answered Dec 07 '22 22:12

Augustin R


On Unix you can use wc to count the number of lines of documents.

wc -l **/*.ts
like image 34
theJian Avatar answered Dec 07 '22 22:12

theJian