Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/raspi/github-stats
Generate GitHub traffic statistics charts
https://github.com/raspi/github-stats
chart clones command-line github github-api http-client rest-api rust statistics svg traffic views
Last synced: about 19 hours ago
JSON representation
Generate GitHub traffic statistics charts
- Host: GitHub
- URL: https://github.com/raspi/github-stats
- Owner: raspi
- License: gpl-2.0
- Created: 2023-04-17T11:40:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-19T11:49:51.000Z (over 1 year ago)
- Last Synced: 2024-11-10T23:13:07.927Z (about 2 months ago)
- Topics: chart, clones, command-line, github, github-api, http-client, rest-api, rust, statistics, svg, traffic, views
- Language: Rust
- Homepage:
- Size: 84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# github-stats
![GitHub All Releases](https://img.shields.io/github/downloads/raspi/github-stats/total?style=for-the-badge)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/raspi/github-stats?style=for-the-badge)
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/raspi/github-stats?style=for-the-badge)Generate GitHub traffic statistics SVG charts.
Traffic statistics for views and clones are downloaded from GitHub API to a local SQLite database.
GitHub keeps these statistics only for 14 days. With this program you can keep infinite days in local database and update the statistics once per day.
Example for this project:
## Usage
```
% github-stats --help
Generate project traffic statistics charts from GitHub APIUsage: github-stats [OPTIONS]
Commands:
fetch Fetch traffic statistics from Github to a local database
list-repos List repositories found in local database
stats Generate statistics for repo from local database
generate Generate all statistics from local database
help Print this message or the help of the given subcommand(s)Options:
-v, --verbose Be verbose?
-c, --config Config file [default: config.toml]
-h, --help Print help
-V, --version Print version
```## Setting up
First copy `config.example.toml` to `config.toml` and edit the config with your favorite editor.
[Generate](https://github.com/settings/tokens) new API key or use existing one.## Example:
Fetch latest statistics from GitHub to local database:
```shell
github-stats fetch
```Note: data from GitHub API is cached for one hour in `cache` directory.
Generate SVG chart for a repository named *heksa*:
```shell
github-stats stats heksa
```The generated chart is saved to `stats` directory. Stats for last 30 days is displayed.
Now you can for example copy the result to your web page and for example display the chart in your project's `README.md`.
Generate all statistics charts at once:
```shell
github-stats generate
```See [example](example) directory for how to automate updates with systemd.
## Internals
* [reqwest](https://crates.io/crates/reqwest) as HTTP client
* [rusqlite](https://crates.io/crates/rusqlite) as SQLite library
* [plotters](https://crates.io/crates/plotters) as SVG renderer## Is it any good?
Yes.