Skip to content

Commit aa23381

Browse files
committed
Added path as an arg to apply and plan
1 parent b73f126 commit aa23381

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

src/commands/apply.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Flags } from '@oclif/core'
1+
import { Args, Flags } from '@oclif/core'
22
import chalk from 'chalk';
33

44
import { BaseCommand } from '../common/base-command.js';
@@ -27,6 +27,10 @@ For more information, visit: https://docs.codifycli.com/commands/apply
2727
}),
2828
}
2929

30+
static args = {
31+
pathArgs: Args.string(),
32+
}
33+
3034
static examples = [
3135
'<%= config.bin %> <%= command.id %>',
3236
'<%= config.bin %> <%= command.id %> --path ~',
@@ -40,10 +44,14 @@ For more information, visit: https://docs.codifycli.com/commands/apply
4044
}
4145

4246
public async run(): Promise<void> {
43-
const { flags } = await this.parse(Apply)
47+
const { flags, args } = await this.parse(Apply)
48+
49+
if (flags.path && args.pathArgs) {
50+
throw new Error('Cannot specify both --path and path argument');
51+
}
4452

4553
await ApplyOrchestrator.run({
46-
path: flags.path,
54+
path: flags.path ?? args.pathArgs,
4755
verbosityLevel: flags.debug ? 3 : 0,
4856
// secure: flags.secure,
4957
}, this.reporter);

src/commands/plan.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import chalk from 'chalk';
22
import { BaseCommand } from '../common/base-command.js';
33
import { PlanOrchestrator } from '../orchestrators/plan.js';
4+
import { Args } from '@oclif/core';
45

56
export default class Plan extends BaseCommand {
67
static description =
@@ -22,16 +23,24 @@ For more information, visit: https://docs.codifycli.com/commands/plan`
2223
'<%= config.bin %> <%= command.id %> -p ../',
2324
]
2425

26+
static args = {
27+
pathArgs: Args.string(),
28+
}
29+
2530
async init(): Promise<void> {
2631
return super.init();
2732
}
2833

2934
public async run(): Promise<void> {
30-
const { flags } = await this.parse(Plan)
35+
const { flags, args } = await this.parse(Plan)
36+
37+
if (flags.path && args.pathArgs) {
38+
throw new Error('Cannot specify both --path and path argument');
39+
}
3140

3241
await PlanOrchestrator.run({
3342
verbosityLevel: flags.debug ? 3 : 0,
34-
path: flags.path,
43+
path: flags.path ?? args.pathArgs,
3544
secureMode: flags.secure,
3645
}, this.reporter);
3746

0 commit comments

Comments
 (0)