Skip to content

Blueemi/lines-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lines

A tiny Rust CLI for counting lines in a file or across a directory tree.

What It Does

  • Counts lines in a single file
  • Counts total lines across a directory recursively
  • Skips .git and target directories when scanning folders
  • Treats files with NUL bytes as non-text during directory scans and counts them as 0
  • Uses a small amount of parallelism for larger directory scans

Requirements

  • Rust and Cargo installed

Build

cargo build --release

The compiled binary will be available at:

target/release/lines

Usage

lines [file-or-directory]

If you do not pass a path, lines counts the current working directory.

Examples

Count the current directory:

cargo run --release

Count a specific directory:

cargo run --release -- src

Count a single file:

cargo run --release -- src/main.rs

Run the built binary directly:

./target/release/lines .

Example Output

1234 total lines in /path/to/project
187 lines in src/main.rs

Notes

  • Directory mode is recursive.
  • Single-file mode counts the file directly.
  • Passing more than one argument returns a usage error.

Test

cargo test

About

A tiny Rust CLI for counting lines in a file or across a directory tree.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages