rustloc

Crates.iorustloc
lib.rsrustloc
version0.7.0
created_at2026-01-09 23:45:11.193884+00
updated_at2026-01-16 02:36:13.989603+00
descriptionCLI tool for counting lines of code in Rust projects with test/code separation
homepage
repositoryhttps://github.com/arthur-debert/rustloc
max_upload_size
id2033175
size120,633
Arthur Debert (arthur-debert)

documentation

README

rustloc

A CLI tool for counting lines of code in Rust projects with test/code separation.

Crates.io License: MIT

Installation

cargo install rustloc

Or download pre-built binaries from GitHub Releases.

Usage

# Analyze current directory
rustloc .

# Analyze specific path
rustloc /path/to/rust/project

# Filter to specific crates in a workspace
rustloc . --crate my-lib --crate my-cli

# Output as JSON
rustloc . --format json

# Output as CSV
rustloc . --format csv

# Show per-crate breakdown
rustloc . --per-crate

# Show per-file breakdown
rustloc . --per-file

# Filter files with glob patterns
rustloc . --exclude "**/generated/**" --include "**/src/**"

Options

Usage: rustloc [OPTIONS] [PATH]

Arguments:
  [PATH]  Path to analyze [default: .]

Options:
  -c, --crate <CRATES>     Filter by crate name (can be repeated)
  -i, --include <INCLUDE>  Include files matching glob pattern (can be repeated)
  -e, --exclude <EXCLUDE>  Exclude files matching glob pattern (can be repeated)
  -f, --format <FORMAT>    Output format [default: table] [values: table, json, csv]
      --per-crate          Show per-crate breakdown
      --per-file           Show per-file breakdown
  -h, --help               Print help
  -V, --version            Print version

Output Formats

Table (default)

File count: 10
Type         |         Code |        Blank | Doc comments |     Comments |        Total
-------------------------------------------------------------------------------
Main         |         1256 |          224 |          296 |           25 |         1801
Tests        |          586 |          113 |           78 |           30 |          807
Examples     |           46 |            4 |            1 |            0 |           51
-------------------------------------------------------------------------------
             |         1888 |          341 |          375 |           55 |         2659

JSON

Structured output suitable for programmatic consumption.

CSV

Machine-readable format for spreadsheet import or data analysis.

Library

For programmatic use, see rustloclib.

License

MIT License

Commit count: 51

cargo fmt