GithubHelp home page GithubHelp logo

cloc's Introduction

cloc

This is a simple command-line tool written in Rust that counts the number of Lines Of Code in a specified directory.

Usage

Run the tool by executing the following command:

cargo run -- [OPTIONS]

Replace [OPTIONS] with the desired options for the tool. Options

The tool supports the following options:

-p, --path [DIRECTORY]: Specifies the directory to count lines of code in. If not provided, the tool will count lines of code in the current working directory.

-l, --log: Enables logging of the line counting process.

Examples

  1. Count lines of code in the current working directory:

    cargo run
  2. Count lines of code in a specific directory:

    cargo run -- -p /path/to/directory
  3. Count lines of code in a specific directory and log results into a sqlite database (not yet implemented)

    cargo run -- -p /path/to/directory -l

Output

The tool leverages the ignore crate to iterate through the files in the specified directory and its subdirectories. For each file encountered, it counts the number of lines of code and displays the filename along with the line count.

The ignore crate will exclude hidden and git related files by default but there´s an extra "ignore.g" file to expand the exclusion list.

Logging (NOT YET IMPLEMENTED)

Adding the logging option (-l, --log) will save statistics into a SQLITE database. When logging is enabled, it updates the database with the total line count for the parent folder of the specified directory.

cloc's People

Contributors

cakeisdead avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.