-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
39 lines (29 loc) · 1.08 KB
/
index.ts
File metadata and controls
39 lines (29 loc) · 1.08 KB
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
import Flags from '@oclif/core/flags'
import * as path from 'node:path';
import { BaseCommand } from '../../common/base-command.js';
import { PlanOrchestrator } from '../../orchestrators/plan.js';
export default class Plan extends BaseCommand {
static description = 'Generate a plan based on a codify.json file. This plan will list ' +
'out the changes Codify will need to make in order to meet the desired config.'
static examples = [
'<%= config.bin %> <%= command.id %>',
]
static flags = {
// flag with a value (-p, --path=VALUE)
path: Flags.string({ char: 'p', description: 'path to project' }),
}
async init(): Promise<void> {
console.log('Running Codify plan...')
return super.init();
}
public async run(): Promise<void> {
const { flags } = await this.parse(Plan)
if (flags.path) {
this.log(`Applying Codify from: ${flags.path}`);
}
const resolvedPath = path.resolve(flags.path ?? '.');
const { plan } = await PlanOrchestrator.run(resolvedPath, flags.secure);
this.reporter.displayPlan(plan);
process.exit(0);
}
}