A tool for counting the number of lines of code in any folder under "original" Mac--cloc

Source: Internet
Author: User
Tags install homebrew

Here is a tool cloc for the number of lines of statistical code for a Mac system.

1, first, install homebrew, have installed please skip.

Open Terminal Tools terminal and enter the following commands. The process will let you press the return key and enter the Mac desktop password, follow the prompts to do the following:

" $ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install) "

2, download and install Cloc using homebrew.

Continue to enter in terminal:

Brew Install Cloc

3. Basic usage:

Count the current folder code lines (CD to destination directory first):

Cloc./

Exclude the code of a folder in the current directory, it is more common to exclude the code in pods, because half of pods is a third-party library, so here is the Pods folder as an example:

Cloc./--exclude-dir=pods

The statistical results are clear and extremely fast:

4. Advanced Usage

What should we do if we want to exclude more folders? Each person's memory ability is limited, want to know more usage the best way is to look at the cloc of the use of documents, in the terminal input:

Cloc--help

The results appear in several pages of instructions, according to the keyword we find the exclude option, which is described here:

This is simple, so we knock out the following command to achieve our goal:

Cloc./--exclude-dir=pods,wujiecaojoketest

In addition, based on the documentation, we can also filter out specific suffixes (EXT) and so on.

# #THAT is all.

Original articles, reproduced please indicate the program small Weng @ Blog Park, Mail [email Protected],jilon, welcome you and I in the c/c++/objective-c/machine vision and other fields to start communication!

A tool for counting the number of lines of code in any folder under "original" Mac--cloc

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.