1 Star 2 Fork 0

xna/gitee-cli

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
cli.js 1.43 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env node
const { program } = require('commander')
const api = require('./index.js')
const pkg = require('./package.json')
program.version(pkg.version)
const config = program.command('config');
const set = config.command('set')
set.option('-u --username <username>', 'set username')
.option('-t --token <token>', 'set token')
.option('-c --cookie <cookie>', 'set cookie')
.option('-x --X-CSRF-Token <XCSRFToken>')
.description('set username, token, cookie')
.action(({ username, token, cookie, XCSRFToken }) => {
if (username || token || cookie || XCSRFToken) {
api.setConfig({ username, token, cookie, XCSRFToken })
} else {
set.help()
}
})
config.command('get')
.action(api.getConfig)
const repo = program.command('repo')
repo.command('create <name>')
.description('创建仓库')
.action(api.createRepo)
repo.command('delete <repo>')
.description('删除仓库')
.action(api.deleteRepo)
repo.command('list')
.description('列出所有仓库')
.action(api.listRepo)
const pages = program.command('pages')
pages.command('build <repo>')
.description('启动/更新 pages')
.option('-d --build-directory <buildDirectory>', '部署目录', '')
.option('-b --branch <branch>', '部署分支', 'master')
.action((repo, { buildDirectory, branch }) => {
api.buildPages(repo, buildDirectory, branch)
})
program.parse(process.argv);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xna00/gitee-cli.git
git@gitee.com:xna00/gitee-cli.git
xna00
gitee-cli
gitee-cli
main

搜索帮助