-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapply.ts
More file actions
53 lines (42 loc) · 1.54 KB
/
apply.ts
File metadata and controls
53 lines (42 loc) · 1.54 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { Flags } from '@oclif/core'
import chalk from 'chalk';
import { BaseCommand } from '../common/base-command.js';
import { ApplyOrchestrator } from '../orchestrators/apply.js';
export default class Apply extends BaseCommand {
static description =
`Install or update resources on the system based on a codify.json file.
Codify first generates a plan to determine the necessary execution steps. See
${chalk.bold.bgMagenta(' codify plan --help ')} for more details.
The execution plan will be presented and approval will be asked before Codify applies
any changes.
For scripts: use ${chalk.bold.bgMagenta(' --output json ')} which will skip approval and
apply changes directly.
For more information, visit: https://docs.codifycli.com/commands/apply
`
static flags = {
'sudoPassword': Flags.string({
optional: true,
description: 'Automatically use this password for any commands that require elevated permissions.',
char: 'S'
}),
}
static examples = [
'<%= config.bin %> <%= command.id %>',
'<%= config.bin %> <%= command.id %> --path ~',
'<%= config.bin %> <%= command.id %> -o json',
'<%= config.bin %> <%= command.id %> -S <sudo password>',
]
async init(): Promise<void> {
console.log('Running Codify apply...')
return super.init();
}
public async run(): Promise<void> {
const { flags } = await this.parse(Apply)
await ApplyOrchestrator.run({
path: flags.path,
verbosityLevel: flags.debug ? 3 : 0,
// secure: flags.secure,
}, this.reporter);
process.exit(0);
}
}