logo
0
0
Login
Forkfromlooc/git-cnb, behind:main50 commits

git-cnb, a Git command-line extension tool specifically for cnb, allows you to quickly view cnb information in the terminal using git commands, such as repositories, users, issues, PRs, releases, etc.

Installation

Binary installation [Recommended]

curl https://cnb.cool/looc/git-cnb/-/git/raw/main/install.sh -sSfL | sh

Install using Golang

go install cnb.cool/looc/git-cnb@latest

Usage

Use it as a Git extension subcommand.

NOTE: Since it needs to call CNB's OpenAPI to get related information, you need to configure the CNB Token using environment variables. The token permissions depend on the features used, you can configure token permissions as needed.

$ export CNB_TOKEN="... your token ..."

If you need to operate multiple CNB instances with different domains, you can configure different CNB_TOKENs for each domain. The rule is CNB_TOKEN_{domain-without-dot} (environment variables don't support ., so we use the domain name without . as suffix to distinguish, e.g.

$ export CNB_TOKEN_cnbcool=".. your token ..." #cnb.cool $ export CNB_TOKEN_cnbdev=".. your token ..." #cnb.dev

The TOKEN requires at least the following permissions:

repo-notes:r repo-pr:r repo-code:rw repo-basic-info:r account-profile:r

Supported Features

$ git cnb -h Available Commands: commit Manage commits help Help about any command info Print information of this repo issue Manage issue pull Manage pull requests release Manage releases stars Print star trend info of this repo stats Print stats information of this repo version Print the version number of git-cnb

Usage Examples

NOTE: CNB OpenAPI updates may have delays, please refer to actual situation

Get repository statistics

git cnb stats

View repository star trends

git cnb stars

List issues related to you in current repository (also view issues related to you in feedback under this organization)

git cnb issue list

List PRs related to you in current repository

git cnb pull list

Create PR with one click after pushing code

git cnb pull create

Statistics and clean up release assets in current repository

git cnb release asset-stats

git cnb release asset-clean --keep-days=1

Statistics and clean up commit assets in current repository

git cnb commit asset-stats

git cnb commit asset-clean --keep-num=1

About

一个 cnb 专属的 Git 命令行扩展工具

Language
Go88.7%
Markdown4.7%
Shell4.1%
Dockerfile1.3%
Others1.2%