-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fortsphere.js
executable file
·39 lines (33 loc) · 1.1 KB
/
fortsphere.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env node
const { Command } = require('commander')
const { listPolicies, applyPolicy } = require('./lib/utils')
const logger = require('./lib/logger')
const pkg = require('./package.json')
const command = new Command()
// Version Command
command
.command('version')
.description('Display fortSphere version')
.action(() => {
logger.info(`fortSphere version: ${pkg.version}`)
logger.warn('IMPORTANT: This is an experimental version of fortSphere', 'warn')
})
// Policy Management Command
command
.command('policy')
.description('Policy management commands')
.option('-a, --apply <policy>', 'Apply a new policy')
.option('-l, --list', 'List all policies')
.option('-gho, --github-org <githubOrg>', 'Specify GitHub organization')
.action(async (options) => {
const { apply, list, githubOrg } = options
if (list) {
listPolicies()
} else if (apply) {
await applyPolicy(apply, githubOrg)
} else {
logger.error('Please provide an option. Use --help to see available options.', 'error')
}
})
// Parse Command Line Arguments
command.parse(process.argv)