src/cli/index.ts   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 45
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 38
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 1
mnd 1
bc 1
fnc 0
bpm 0
cpm 0
noi 0
1
import packageJson from '@/../package.json';
2
import { Application } from '@/lib/Application';
3
import { APP_VERSION } from '@/lib/consts';
4
import { Command } from 'commander';
5
import { resolve } from 'path';
6
import updateNotifier from 'simple-update-notifier';
7
8
updateNotifier({ pkg: packageJson });
9
10
const program = new Command();
11
12
program.name('codeboost');
13
program.version(APP_VERSION);
14
15
program
16
    .command('run')
17
    .description('Run the specified boost against a repository.')
18
    .argument('[name]', 'boost name', null)
19
    .option('-r,--repo <repoName>', 'repository to run against', '')
20
    .option('-c,--config <configFile>', 'config file to use', '')
21
    .option('-d,--dry-run', 'dry run, only run scripts locally (do not fork/push/create pr)', false)
22
    .option('-b,--batch <filename>', 'batch mode using filename as a json database of repositories', false)
23
    .option('-s,--size <batchSize>', 'size of the batch to run', '2')
24
    .action(async (name, options) => {
25
        options.size = Number(options.size);
26
27
        if (options.batch) {
28
            options.batch = resolve(options.batch);
29
        }
30
31
        const app = new Application(options.config, options.config.length > 0);
32
        await app.executeRun(options.repo, name, options);
33
    });
34
35
program
36
    .command('init')
37
    .description('Initialize codeboost.')
38
    .option('-c,--config <configFile>', 'config file to use', '')
39
    .action(async options => {
40
        const app = new Application(options.config, options.config.length > 0);
41
        await app.executeInit();
42
    });
43
44
program.parse();
45