Code Peek is a command-line tool written in Rust that helps you gain insights into your codebases. It recursively traverses a directory, counts the lines of code for each file, and provides a summarized output based on your preferences.
- Line Count: Get the line count for each file in the specified directory.
- Top Files: Display the top N files with the highest line counts.
- Grouping: Group the output by file extension or programming language.
- Exclusions: Exclude specific files or patterns from the analysis using globs.
- Git Integration: Get information about the number of commits made to each file.
Code Peek can be installed directly from the GitHub repository using cargo install (you need to have Rust installed):
cargo install --git https://github.com/DerTimonius/code-peek.git
This will download the latest version of Code Peek and install it in your Cargo bin directory (~/.cargo/bin/). Make sure that ~/.cargo/bin is in your system's PATH for easy access to the code-peek command.
code-peek [FLAGS] [OPTIONS] [ARGS]
- -a, --all: Display all available information.
- -g, --group: Group the results by file extension or programming language.
- -t, --git: Get Git information (number of commits) for each file.
- --skip-lockfiles: Skips lockfiles in analysis.
- -d, --dir : Directory to search (defaults to the current working directory).
- -n, --num : Number of files to display (defaults to 10).
- -e, --exclude : Globs to exclude files or directories other than those specified in the .gitignore file. Expects a comma-separated list (e.g., '*.txt,*.csv').
- -m, --match : Globs to check, expects a comma separated list. E.g. '*.txt,*.csv' (Only files that match the pattern will be processed)
Display the top 10 files with the highest line counts in the current directory:
code-peek
Display the top 20 files in the /path/to/project directory, grouped by file extension:
code-peek -d /path/to/project -n 20 -g
Display all available information, excluding .txt and .csv files:
code-peek -a -e '*.txt,*.csv'
Display all available information, processing only Astro and Svelte files:
code-peek -a -m '*.astro,*.svelte'
Contributions are welcome! Please open an issue or submit a pull request if you have any improvements, bug fixes, or new features to propose.
Code Peek is licensed under the MIT License.