-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
executable file
·37 lines (32 loc) · 959 Bytes
/
index.ts
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
#!/bin/env -S node --loader ts-node/esm
import {has} from '@0cfg/utils-common/lib/has';
import {program} from 'commander';
import {deploy} from './src/ts/Landscape';
import {createLogger, logCollector} from './src/ts/log/Logger';
program.option('--dryRun [dryRun]');
program.option('--level [logLevel]');
program.option('--log-format [logFormat]');
program.option('-f, --values [letters...]');
void (async function () {
program.parse();
const args = program.opts();
const dryRun = args.dryRun === 'true';
if (has(args.level)) {
const logLevel = args.level;
logCollector.setLevel(logLevel);
console.log(`Log level set to ${logLevel}`);
}
if (has(args['log-format'])) {
logCollector.setFormat(args['log-format']);
}
try {
await deploy({
dryRun,
defaultNamespace: 'default',
valueFiles: args.values,
});
} catch (error: any) {
createLogger('').error(error);
process.exit(1);
}
})();