Installation and Requirements
cloc is written in perl and the binary that this package exposes is the
cloc perl script. You must have perl installed on your machine for this binary to work.
Node & npm
This is distributed as an
npm package (some say that stands for "Node Package Manager"). So you must have Node.js and npm installed.
Here are quick instructions on how to get those: http://blog.nodeknockout.com/post/65463770933/how-to-install-node-js-and-npm
Congratulations, you've opened your life to a whole new world of awesome tooling and other cool things :-)
Install this tool via
$ npm install -g cloc
In your terminal, simply type
cloc to get output of the options available.
See the official cloc website for documentation on how to use
Here's the output when you type
Locally in a project
I use this in my project to keep track of my lines of code as the project grows (mostly for fun). Here's what I do:
- Install it as one of your
$ npm i -D cloc
- Add this to your
// your other config stuff"scripts":"count": "cloc app/" // <-- other options would go here as well..."devDependencies":"cloc": "2.0.0" // <-- this should be added automatically when you install with the `-D` flag// more config stuff
- Whenever you want to count your lines of code, simply enter:
$ npm run count
This package is and the
cloc cli itself is licensed with GPL 2.