cli: minor cleanup

Signed-off-by: dzdidi <deniszalessky@gmail.com>
This commit is contained in:
dzdidi
2024-02-11 16:58:58 +00:00
parent af65558870
commit 47e388b89b

View File

@@ -57,7 +57,7 @@ program
branchToShare = options.share branchToShare = options.share
} }
if (options.share) share(name, branchToShare) if (options.share) await share(name, branchToShare)
}) })
program program
@@ -78,7 +78,7 @@ program
const currentBranch = await git.getCurrentBranch() const currentBranch = await git.getCurrentBranch()
const branchToShare = options.branch || currentBranch const branchToShare = options.branch || currentBranch
share(name, branchToShare, options) await share(name, branchToShare, options)
}) })
program program
@@ -217,12 +217,10 @@ function localBranchProtectionRules(a, b, p, options) {
} }
if (a === 'list' && !b) { logBranches(name) } if (a === 'list' && !b) { logBranches(name) }
if (a === 'add') { if (a === 'add') {
acl.addProtectedBranch(name, b) acl.addProtectedBranch(name, b)
logBranches(name) logBranches(name)
} }
if (a === 'remove') { if (a === 'remove') {
acl.removeProtectedBranch(name, b) acl.removeProtectedBranch(name, b)
logBranches(name) logBranches(name)
@@ -302,9 +300,9 @@ function checkIfGitRepo(p) {
} }
} }
function share(name, branchToShare, options) { async function share(name, branchToShare, options) {
let aclOptions let aclOptions
let message = `Shared "${name}" project, ${branchToShare} branch`) let message = `Shared "${name}" project, ${branchToShare} branch`
if (options?.visibility) { if (options?.visibility) {
aclOptions = { visibility: options.visibility } aclOptions = { visibility: options.visibility }
message = `${message}, as ${options.visibility} repo` message = `${message}, as ${options.visibility} repo`