Skip to content

Commit

Permalink
去除cleanbranch指令权限控制
Browse files Browse the repository at this point in the history
  • Loading branch information
saqqdy committed Nov 19, 2021
1 parent 1ca3274 commit 9a1270b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
8 changes: 0 additions & 8 deletions bin/gitm-cleanbranch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ if (!isGitProject()) {
sh.echo(error('当前目录不是git项目目录'))
sh.exit(1)
}
const getUserToken = require('./js/api')
const getConfig = require('./js/getConfig')
const config = getConfig()

import {
GitmarsOptionOptionsType,
FetchDataType,
GitmarsBranchType
} from '../typings'

Expand Down Expand Up @@ -56,21 +54,15 @@ options.forEach((o: GitmarsOptionOptionsType) => {
// .option('-r, --remote', '是否清理远程分支,默认清理本地分支', false)
// .option('--deadline [deadline]', '删除固定时长之前的分支,填写格式:10s/2m/2h/3d/4M/5y', '15d') -----------------------
program.action(async (opt: GitmBuildOption) => {
const { level } = config.api ? getUserToken() : ({} as FetchDataType)
const spinner = ora()
spinner.color = 'green'
// 管理员以上级别才可执行,必须先配置好权限项
if (!opt.list && (!level || level > 2)) {
sh.echo(success('仅管理员以上的权限可执行这个指令'))
sh.exit(0)
}
const current = getCurrent()
sh.exec(`git fetch`, { silent: true })
current !== config.develop &&
sh.exec(`git checkout ${config.develop}`, { silent: true })
const branches = searchBranches({
remote: opt.remote,
local: !opt.remote,
type: opt.type,
except: opt.except
})
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 更新日志

## 2021.11.19 v2.13.3 更新日志

1. `cleanbranch`指令放开权限控制

## 2021.11.19 v2.13.2 更新日志

1. `searchBranches`方法改进,删除`local`参数
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gitmars",
"description": "一个高度定制化的git工作流工具",
"version": "2.13.2",
"version": "2.13.3",
"scripts": {
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs",
Expand Down

0 comments on commit 9a1270b

Please sign in to comment.