DEV Community

Cover image for A Command-line tool to statistics the GitHub repositories
Keson.An
Keson.An

Posted on

A Command-line tool to statistics the GitHub repositories

banner
When we do research on frameworks, you'll probably start by Google the relevant keywords to get some results, followed by checking out the appropriate Topic from GitHub to choose the right framework. I believe that most people
When choosing a framework, you don't just use it, you look at some of the repository's metrics to decide whether to choose it, or compare multiple frameworks.

Preface

We know that there are already some web comparison tools in the community, such as star-history for star trends, but there are no tools available on the endpoint for comparing GitHub repositories.
When we look at a repository, we usually look at the following metrics to see if it is stable or not?

  • star count (stars)
  • frequency of updates (releases)
  • community activity (contributors)
  • issue resolution cycle (resolve issues)
  • Length of repository creation (age)
  • Organization (organization)

Let's choose Golang microservices framework as an example to compare some of the more popular frameworks in the current community

  • go-zero
  • kratos
  • go-micro
  • kit

Before the tool, we may go to each repository in turn from the above indicators to their repository home page to see the relevant data, which will seem tedious, if you need to land into some comparative data, it is more necessary to manually go to
If you need to make some comparison data, you need to write a table manually.

Let's look at the results of github-compare.

┌─────────────────────────┬─────────────────────┬───────────────────────┬──────────────────────┬──────────────────┐
│ METRICS                 │ ZEROMICRO/GO-ZERO   │ GO-KRATOS/KRATOS      │ ASIM/GO-MICRO        │ GO-KIT/KIT       │
├─────────────────────────┼─────────────────────┼───────────────────────┼──────────────────────┼──────────────────┤
│ 🏠 homepage             │ https://go-zero.dev │ https://go-kratos.dev │ https://go-micro.dev │ https://gokit.io │
│ 🌎 language             │ Go                  │ Go                    │ Go                   │ Go               │
│ 📌 license              │ MIT License         │ MIT License           │ Apache License 2.0   │ MIT License      │
│ ⏰ age                  │ 655 days            │ 1231 days             │ 2688 days            │ 2668 days        │
│ 🌟 stars                │ 17778(27/d)         │ 17856(14/d)           │ 18233(6/d)           │ 23084(8/d)       │
│ 📊 latestDayStarCount   │ 33 (up)             │ 7 (down)              │ 2 (down)             │ 10 (up)          │
│ 📉 latestWeekStarCount  │ 227 (up)            │ 64 (down)             │ 31 (down)            │ 44 (down)        │
│ 📈 latestMonthStarCount │ 916                 │ 531                   │ 176                  │ 235              │
│ 👏 forks                │ 2520(3/d)           │ 3446(2/d)             │ 2087(0/d)            │ 2315(0/d)        │
│ 👀 watchers             │ 266                 │ 424                   │ 510                  │ 690              │
│ 💪 issues               │ 50/741              │ 51/793                │ 76/914               │ 35/548           │
│ 💯 pull requests        │ 13/1155             │ 10/1221               │ 0/1513               │ 9/627            │
│ 👥 contributors         │ 132                 │ 198                   │ 166                  │ 221              │
│ 🚀 releases             │ 63                  │ 49                    │ 206                  │ 12               │
│ 🔭 release circle(avg)  │ 10 days             │ 25 days               │ 13 days              │ 222 days         │
│ 🎯 lastRelease          │ 24 day(s) ago       │ 1 day(s) ago          │ 5 day(s) ago         │ 8 month(s) ago   │
│ 🕦 lastCommit           │ 2 day(s) ago        │ 2 hour(s) ago         │ 5 day(s) ago         │ 6 day(s) ago     │
│ 📝 lastUpdate           │ 47 minute(s) ago    │ 16 minute(s) ago      │ 1 hour(s) ago        │ 1 hour(s) ago    │
└─────────────────────────┴─────────────────────┴───────────────────────┴──────────────────────┴──────────────────┘
Enter fullscreen mode Exit fullscreen mode

You can clearly see the metrics of the GitHub repository in this graph, so let's take a look at how the tool works.

github-compare

A Command-line tool to statistics the GitHub repositories

Install

$ go install github.com/anqiansong/github-compare@latest
Enter fullscreen mode Exit fullscreen mode

Example

$ github-compare zeromicro/go-zero go-kratos/kratos asim/go-micro go-kit/kit
┌─────────────────────────┬─────────────────────┬───────────────────────┬──────────────────────┬──────────────────┐
│ METRICS                 │ ZEROMICRO/GO-ZERO   │ GO-KRATOS/KRATOS      │ ASIM/GO-MICRO        │ GO-KIT/KIT       │
├─────────────────────────┼─────────────────────┼───────────────────────┼──────────────────────┼──────────────────┤
│ 🏠 homepage             │ https://go-zero.dev │ https://go-kratos.dev │ https://go-micro.dev │ https://gokit.io │
│ 🌎 language             │ Go                  │ Go                    │ Go                   │ Go               │
│ 📌 license              │ MIT License         │ MIT License           │ Apache License 2.0   │ MIT License      │
│ ⏰ age                  │ 655 days            │ 1231 days             │ 2688 days            │ 2668 days        │
│ 🌟 stars                │ 17778(27/d)         │ 17856(14/d)           │ 18233(6/d)           │ 23084(8/d)       │
│ 📊 latestDayStarCount   │ 33 (up)             │ 7 (down)              │ 2 (down)             │ 10 (up)          │
│ 📉 latestWeekStarCount  │ 227 (up)            │ 64 (down)             │ 31 (down)            │ 44 (down)        │
│ 📈 latestMonthStarCount │ 916                 │ 531                   │ 176                  │ 235              │
│ 👏 forks                │ 2520(3/d)           │ 3446(2/d)             │ 2087(0/d)            │ 2315(0/d)        │
│ 👀 watchers             │ 266                 │ 424                   │ 510                  │ 690              │
│ 💪 issues               │ 50/741              │ 51/793                │ 76/914               │ 35/548           │
│ 💯 pull requests        │ 13/1155             │ 10/1221               │ 0/1513               │ 9/627            │
│ 👥 contributors         │ 132                 │ 198                   │ 166                  │ 221              │
│ 🚀 releases             │ 63                  │ 49                    │ 206                  │ 12               │
│ 🔭 release circle(avg)  │ 10 days             │ 25 days               │ 13 days              │ 222 days         │
│ 🎯 lastRelease          │ 24 day(s) ago       │ 1 day(s) ago          │ 5 day(s) ago         │ 8 month(s) ago   │
│ 🕦 lastCommit           │ 2 day(s) ago        │ 2 hour(s) ago         │ 5 day(s) ago         │ 6 day(s) ago     │
│ 📝 lastUpdate           │ 47 minute(s) ago    │ 16 minute(s) ago      │ 1 hour(s) ago        │ 1 hour(s) ago    │
└─────────────────────────┴─────────────────────┴───────────────────────┴──────────────────────┴──────────────────┘
Enter fullscreen mode Exit fullscreen mode

Usage

Preparation

  1. Creating a personal access token
  2. Set access token token
    • Copied the access token and export to environment
    • Or you can set the access token by passing github-compare argument --token

Execute

# set access token through the flag --token
# zeromicro/go-zero go-kratos/kratos asim/go-micro go-kit/kit --token ${accessToken}
# or export access token to environment (recommended)
$ export GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN}
$ zeromicro/go-zero go-kratos/kratos asim/go-micro go-kit/kit
Enter fullscreen mode Exit fullscreen mode

Note

  1. A GitHub personal access token is required.
  2. github-compare accepts 1 to 4 repositories data queries.
  3. If you prefer to export the access token to environment, you must use environment key GITHUB_ACCESS_TOKEN

Last

If this repository can help you, give a star please!

Thanks all!

Top comments (0)