Skip to content

Commit 487159f

Browse files
committed
Added path as an arg to validate
1 parent aa23381 commit 487159f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/commands/validate.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { Args } from '@oclif/core';
12
import { BaseCommand } from '../common/base-command.js';
23
import { ValidateOrchestrator } from '../orchestrators/validate.js';
34
import { CodifyParser } from '../parser/index.js';
5+
import Apply from './apply.js';
46

57
export default class Validate extends BaseCommand {
68
static description =
@@ -11,6 +13,10 @@ For more information, visit: https://docs.codifycli.com/commands/validate
1113

1214
static flags = {}
1315

16+
static args = {
17+
pathArgs: Args.string(),
18+
}
19+
1420
static examples = [
1521
'<%= config.bin %> <%= command.id %>',
1622
'<%= config.bin %> <%= command.id %> --path=../../import.codify.jsonc',
@@ -22,13 +28,17 @@ For more information, visit: https://docs.codifycli.com/commands/validate
2228
}
2329

2430
public async run(): Promise<void> {
25-
const { flags } = await this.parse(Validate)
31+
const { flags, args } = await this.parse(Apply)
32+
33+
if (flags.path && args.pathArgs) {
34+
throw new Error('Cannot specify both --path and path argument');
35+
}
2636

2737
await ValidateOrchestrator.run({
28-
path: flags.path,
38+
path: flags.path ?? args.pathArgs,
2939
}, this.reporter)
3040

31-
await CodifyParser.parse(flags.path);
41+
await CodifyParser.parse(flags.path ?? args.pathArgs ?? '.');
3242

3343
process.exit(0);
3444
}

0 commit comments

Comments
 (0)