A fast and efficient command-line tool to count lines of code in your projects. Respects .gitignore
rules and supports various file extensions.
- 📂 Counts lines in files with specific extensions
- 🚫 Respects
.gitignore
rules automatically - ⚡️ Fast and lightweight
- 🔍 Recursive directory search
- 📊 Clear, formatted output
go install github.com/richardamare/countlines@latest
Basic usage:
countlines [extension]
Examples:
countlines go # Count lines in Go files
countlines js # Count lines in JavaScript files
countlines py # Count lines in Python files
Output example:
$ countlines go
124 cmd/root.go
89 internal/counter/counter.go
67 internal/counter/gitignore.go
12 main.go
Total: 292 lines in 4 files
- Searches for a
.gitignore
file in the current directory and parent directories - If found, uses git's ignore rules to exclude files
- Counts lines in all matching files
- Displays individual file counts and total
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE for details