logo
1
0
WeChat Login
Forkfromlooc/git-cnb, aheadmain2 commits, behindmain54 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
  completion  Generate the autocompletion script for the specified shell
  download    Download raw files from repository
  groups      Manage gruops
  help        Help about any command
  info        Print information of this repo
  issue       Manage issue
  knowledges  Manage knowledges
  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

Flags:
      --domain string   domain, eg: cnb.cool, default: cnb.cool
  -h, --help            help for git-cnb
      --repo string     repo name, eg: looc/git-cnb

cnb plugin

git-cnb also provides some cnb plugins, and you can use the plugins to quickly complete some complex tasks.

About

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

Language
Go89.1%
Shell7.9%
Dockerfile2.2%
Makefile0.8%