-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapply.ts
More file actions
66 lines (54 loc) · 1.97 KB
/
Copy pathapply.ts
File metadata and controls
66 lines (54 loc) · 1.97 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
54
55
56
57
58
59
60
61
62
63
64
65
66
import { Args, 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.jsonc 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://codifycli.com/docs/commands/apply
`
static flags = {
'sudoPassword': Flags.string({
optional: true,
description: 'Automatically use this password for any handlers that require elevated permissions.',
char: 'S'
}),
'yes': Flags.boolean({
description: 'Automatically approve the apply without prompting for confirmation.',
char: 'y',
default: false,
}),
'verbose': Flags.boolean({
char: 'v',
description: 'Print plugin output (stdout/stderr) to the terminal.',
}),
}
static args = {
pathArgs: Args.string(),
}
static examples = [
'<%= config.bin %> <%= command.id %>',
'<%= config.bin %> <%= command.id %> --path ~',
'<%= config.bin %> <%= command.id %> -o json',
'<%= config.bin %> <%= command.id %> -S <sudo password>',
]
public async run(): Promise<void> {
const { flags, args } = await this.parse(Apply)
if (flags.path && args.pathArgs) {
throw new Error('Cannot specify both --path and path argument');
}
await ApplyOrchestrator.run({
path: flags.path ?? args.pathArgs,
verbosityLevel: flags.debug || flags.verbose ? 3 : 0,
autoApprove: flags.yes,
// secure: flags.secure,
}, this.reporter);
process.exit(0);
}
}