Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📏 File Line Counter

A user-friendly, interactive terminal application for counting lines in any type of file

Python Textual License

✨ Features

  • 🎨 User-Friendly TUI Interface - Clean, colorblind-friendly terminal user interface
  • 📁 Interactive Directory Picker - Browse and select directories with ease
  • 🔍 Multi-Extension Support - Count lines across multiple file types simultaneously
  • 🚫 Smart Filtering - Automatically ignores common development directories
  • 📊 Detailed Analytics - Per-extension breakdowns and comprehensive summaries
  • Real-time Results - See results as files are processed
  • 🎯 Customizable Ignore Rules - Add your own directories to ignore

🚀 Quick Start

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/FileLineCounter.git
    cd FileLineCounter
  2. Install dependencies

    pip install -r requirements.txt
  3. Run the application

    python app.py

Usage

  1. Launch the app and you'll see an interactive directory picker
  2. Select a directory either by browsing the tree or entering a path
  3. Choose file extensions (e.g., py js ts html css)
  4. Optionally add extra ignore rules for directories specific to your project
  5. Watch the results stream in real-time!

📸 Screenshots

File Line Counter Screenshot

🛠️ Technical Details

Built With

  • Textual - Modern TUI framework for Python
  • pathlib - Modern path handling
  • asyncio - Asynchronous processing for real-time updates

Architecture

The application is built as a single-file Textual app with the following key components:

  • FileLineCounterApp - Main application class handling UI states
  • count_lines_in_files() - Core counting logic with async streaming
  • Smart Filtering - Configurable ignore patterns for common dev directories

Default Ignored Directories

The app automatically ignores common development directories:

# Virtual environments
.venv, venv, .env, env

# Node.js
node_modules, .npm

# Version control
.git, .svn, .hg

# Python cache
__pycache__, .pytest_cache

# Build directories
build, dist, target

# IDE directories
.idea, .vscode

# And more...

🎯 Use Cases

  • File Analysis - Get quick insights into any project's file structure and size
  • Documentation Projects - Count lines in markdown, text, and documentation files
  • Code Reviews - Understand the scope of changes in software projects
  • Content Analysis - Analyze writing projects, scripts, configuration files
  • Project Planning - Estimate development or writing effort
  • Portfolio Statistics - Showcase your work volume across any file type
  • Team Metrics - Compare project sizes across teams and file types

⚙️ Configuration

Adding Custom Ignore Rules

During the setup process, you can add project-specific directories to ignore:

Extra directories to ignore: build dist myfolder

Supported File Extensions

The app supports any file extension. Common examples:

  • Web Development: html css js ts jsx tsx
  • Programming: py java cpp c h kt swift go rs php rb
  • Data & Config: sql json yaml yml xml csv ini toml
  • Documentation: md txt rst adoc
  • Markup & Styling: html css scss sass less
  • Scripts & Automation: sh bash ps1 bat cmd

🔧 Development

Project Structure

FileLineCounter/
├── app.py              # Main application (all logic)
├── requirements.txt    # Python dependencies
├── README.md          # This file

Key Design Principles

  1. Single File Architecture - All logic contained in app.py for simplicity
  2. Async Processing - Real-time streaming of results
  3. Colorblind Friendly - Accessible color scheme
  4. Minimal Dependencies - Only essential packages required

Running in Development

# Standard run
python app.py

# With debugging
python -u app.py  # Unbuffered output for debugging

🤝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes following the existing code style
  4. Test your changes thoroughly
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to your branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Development Guidelines

  • All logic should remain in app.py (single-file architecture)
  • Follow existing code style and patterns
  • Test with various directory structures and file types
  • Ensure accessibility (colorblind-friendly design)

📋 Requirements

  • Python 3.8 or higher
  • Dependencies (automatically installed):
    • textual - TUI framework
    • rich - Text formatting (Textual dependency)
    • markdown-it-py - Markdown processing (Textual dependency)

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built with the amazing Textual framework
  • Inspired by the need for better file analysis tools
  • Thanks to the Python community for excellent libraries

📞 Support

If you encounter any issues or have questions:

  1. Check existing issues in the GitHub repository
  2. Create a new issue with detailed information
  3. Include your Python version and operating system
  4. Provide steps to reproduce any bugs

Happy coding! 🚀

Made with ❤️ and Python

About

Interactive terminal app that counts the number of lines of all files, given a directory

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages