Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tom-draper/repo-stats

Generates a statistical overview for a local or remote repository.
https://github.com/tom-draper/repo-stats

cli command-line command-line-tool file-stats github programming-language project project-analysis repo-stats repository rust rust-lang statistics stats

Last synced: 26 days ago
JSON representation

Generates a statistical overview for a local or remote repository.

Awesome Lists containing this project

README

        

# Repo Stats

A command-line tool for generating statistical overview for a local or remote repository including metrics like line count, average line length and proportion of whitespace, broken down by file extension.

## Installation

```bash
git clone https://github.com/tom-draper/repo-stats.git
cd repo-stats
cargo build --release
```

This builds the executable in `/target/release`.

Setting the path to `repo-stats.exe` as an environment variable will allow it to be run in the terminal from within any directory.

## Usage

When run without arguments the program will target the current directory, scanning all subfolders recursively and logging all files.

```bash
repo-stats
```

#### Path

A path to the target repo directory can be specified with the `-p` or `--path` flag followed by the path. If this argument is excluded, the current working directory is used as default.

```bash
repo-stats -p
```

#### Ignore directory

A specific directory can be ignored with the `-i` or `--ignore` flag followed by the name of the directory to ignore. Any directory path containing this directory name will be ignored. The directory names provided must be relative to the selected path (either specified by the path argument or the current working directory).

```bash
repo-stats -i bin
```

To ignore multiple directories, separate the directory names by commas.

```bash
repo-stats -i bin,target,.vscode
```

#### Target directory

A specific directory can be targeted using the '-t' or '--target' flag followed by the name of the directory to target. Only paths containing this target directory will be used. The directory names provided must be relative to the selected path (either specified by the path argument or the current working directory).

```bash
repo-stats -t src
```

To target multiple directories, separate the directory names by commas.

```bash
repo-stats -t src,example,test
```

#### Remote repository

Project statistics can also be displayed for a remote repository. Simply specify the name of the remote GitHub repo with the `-r` or `--remote` flag. The repo name must be specified in the form / and the repo must be public.

```bath
repo-stats -r tom-draper/repo-stats
```

## Example

```text
> repo-stats

---- Total -------------------------
Files: 2,386
Lines: 34,116
Characters: 1,880,326
Average line length: 55.1
Whitespace: 10.56%
Memory: 572.5 MB
Carridge returns: 2474
------------------------------------

---- Source code -------------------
Languages:
.h: 68.72%
Files: 98
Lines: 28,004
Characters: 942,236
Average line length: 33.6
Whitespace: 16.53%
Memory: 942.2 KB
Carridge returns: 98
.d: 22.65%
Files: 118
Lines: 1,553
Characters: 310,586
Average line length: 200.0
Whitespace: 0.69%
Memory: 310.6 KB
Carridge returns: 118
.json: 4.69%
Files: 131
Lines: 135
Characters: 64,309
Average line length: 476.4
Whitespace: 0.28%
Memory: 64.3 KB
Carridge returns: 135
.rs: 2.94%
Files: 4
Lines: 1,156
Characters: 40,257
Average line length: 34.8
Whitespace: 41.01%
Memory: 40.3 KB
Carridge returns: 1156
.lock: 0.88%
Files: 42
Lines: 511
Characters: 12,035
Average line length: 23.6
Whitespace: 4.87%
Memory: 12.0 KB
Carridge returns: 42
.md: 0.11%
Files: 1
Lines: 53
Characters: 1,448
Average line length: 27.3
Whitespace: 12.15%
Memory: 1.4 KB
Carridge returns: 53
.toml: 0.02%
Files: 1
Lines: 15
Characters: 324
Average line length: 21.6
Whitespace: 10.19%
Memory: 324 B
Carridge returns: 1
------------------------------------

---- Binaries ----------------------
Files: 28
Memory: 1.0 KB
------------------------------------
```