Skip to content

TTibbs/project-line-counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Count-Lines

A simple command-line tool that counts lines of code in your project, excluding comments. It supports TypeScript, JavaScript, and Python files.

Features

  • Counts non-comment lines of code in your project
  • Skips node_modules and hidden folders
  • Works with TypeScript (.ts, .tsx), JavaScript (.js, .jsx), and Python (.py) files
  • Interactive mode with easy language selection
  • Command-line flags for quick counting

Installation

npm install -g count-lines

Usage

Interactive Mode

Simply run the command without any flags to enter interactive mode:

count-lines

You'll be prompted to select which language you want to count or choose "All" to count all supported languages.

Command-line Flags

You can also use command-line flags to specify which language to count:

count-lines --typescript    # Count only TypeScript files
count-lines --javascript    # Count only JavaScript files
count-lines --python        # Count only Python files
count-lines --all           # Count all supported languages

How It Works

Count-Lines works by:

  1. Scanning your project directory (excluding node_modules and hidden folders)
  2. Identifying files with the selected extensions
  3. Reading each file and removing comment lines:
  • For JavaScript/TypeScript: Removes both /_ block comments _/ and // line comments
  • For Python: Removes # line comments
  1. Counting the remaining lines of code
  2. Displaying a summary with files scanned and total lines count

Contributing

We welcome contributions to Count-Lines! Here's how you can help:

Setting Up for Development

  1. Fork the repository on GitHub
  2. Clone your fork to your local machine:
git clone https://github.com/TTibbs/project-line-counter
  1. Install dependencies:
cd count-lines
npm install

Making Changes

  1. Create a new branch for your changes:
git checkout -b your-feature-branch
  1. Make your changes to the code
  2. Test your changes thoroughly
  3. Commit your changes with a descriptive message:
git commit -m "Add support for new language"

Submitting a Pull Request

  1. Push your changes to your fork:
git push origin your-feature-branch
  1. Go to the original repository on GitHub
  2. Click "New Pull Request"
  3. Select your fork and branch
  4. Add a title and description explaining your changes
  5. Submit the pull request

Code Style

  1. Use consistent indentation (2 spaces)
  2. Follow TypeScript best practices
  3. Add comments for complex logic
  4. Update documentation for any new features

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •