前言
不久前 GitHub发布了自己的CLI应用,不得不多说,在微软收购GitHub迎来的大的进步,近期出现了很多很多的大动作,发布CLI应用,发布移动端的应用等等,虽然不一定和微软有必然关系,不过GitHub最近确实不错。本期主要是学习GitHub CLI 的应用,并分析GitHub CLI的优缺点。
问题前置: GitHub api 好像不是那么好连接 要想办法的。
内容
首先展示GitHub CLI 的功能 支持整个的工作流(处理issue 拉取请求 check 发行 和更多) 脚本和个性化 商业同样适用 代码开源
首先我们来进行安装 本次采用MacBook来安装 命令如下:
$ brew install gh
此处因为某些原因brew的下载速度不是很理想,可以采用换用清华的源进行调整https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/ 其中可能会遇到一些其他的问题 比如brew link gh 显示权限不足 可以 chmod 77 { {提示的路径}} 而后再次运行 brew link gh即可
安装完成后即可以使用
gh
返回结果
Work seamlessly with GitHub from the command line.
USAGE
gh <command> <subcommand> [flags]
CORE COMMANDS
issue: Manage issues
pr: Manage pull requests
repo: Create, clone, fork, and view repositories
ADDITIONAL COMMANDS
alias: Create command shortcuts
api: Make an authenticated GitHub API request
auth: Login, logout, and refresh your authentication
completion: Generate shell completion scripts
config: Manage configuration for gh
gist: Create gists
help: Help about any command
FLAGS
--help Show help for command
--version Show gh version
EXAMPLES
$ gh issue create
$ gh repo clone cli/cli
$ gh pr checkout 321
ENVIRONMENT VARIABLES
GITHUB_TOKEN: an authentication token for github.com API requests. Setting this avoids
being prompted to authenticate and takes precedence over previously stored credentials.
GITHUB_ENTERPRISE_TOKEN: an authentication to