cli: path as option; lint; quit option

Signed-off-by: dzdidi <deniszalessky@gmail.com>
This commit is contained in:
dzdidi
2024-02-15 18:58:07 +00:00
parent 7e53bfb9bb
commit ffaecc0382
15 changed files with 104 additions and 118 deletions

View File

@@ -1,7 +1,7 @@
const fs = require('fs')
const path = require('path')
function printACL(repoACL) {
function printACL (repoACL) {
console.log('Repo Visibility:', '\t', repoACL.visibility)
console.log('Protected Branch(s):', '\t', repoACL.protectedBranches.join(', '))
console.log('User:', '\t', 'Role:')
@@ -10,20 +10,20 @@ function printACL(repoACL) {
}
}
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 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) {
function checkIfGitRepo (p) {
if (!fs.existsSync(path.join(p, '.git'))) {
console.error(` ${p} is not a git repo`)
process.exit(1)
}
}
function logBranches(repoACL) {
function logBranches (repoACL) {
console.log('Repo Visibility:', '\t', repoACL.visibility)
console.log('Protected Branch(s):', '\t', repoACL.protectedBranches.join(', '))
}
@@ -32,5 +32,5 @@ module.exports = {
printACL,
printACLForUser,
checkIfGitRepo,
logBranches,
logBranches
}