remote-acl: list (cleaner)

Signed-off-by: dzdidi <deniszalessky@gmail.com>
This commit is contained in:
dzdidi
2024-02-14 18:32:33 +00:00
parent 20599d854f
commit 711d717606
3 changed files with 92 additions and 51 deletions

35
src/utils.js Normal file
View File

@@ -0,0 +1,35 @@
function printACL(repoACL) {
console.log('Repo Visibility:', '\t', repoACL.visibility)
console.log('Protected Branch(s):', '\t', repoACL.protectedBranches.join(', '))
console.log('User:', '\t', 'Role:')
for (const user in repoACL.ACL) {
console.log(user, '\t', repoACL.ACL[user])
}
}
function printACLForUser(repoACL, u) {
console.log('Repo Visibility:', '\t', repoACL.visibility)
console.log('Protected Branch(s):', '\t', repoACL.protectedBranches.join(', '))
console.log('User:', u, '\t', repoACL.ACL[u])
}
function checkIfGitRepo(p) {
if (!fs.existsSync(path.join(p, '.git'))) {
console.error('Not a git repo')
process.exit(1)
}
}
function logBranches(repoACL) {
console.log('Repo Visibility:', '\t', repoACL.visibility)
console.log('Protected Branch(s):', '\t', repoACL.protectedBranches.join(', '))
}
module.exports = {
printACL,
checkIfGitRepo,
logBranches,
}