Skip to content

Commit

Permalink
fix: Adding dependency on --format json for outputFile flag
Browse files Browse the repository at this point in the history
  • Loading branch information
scalvert committed Aug 12, 2020
1 parent 8414f57 commit 00f7e5e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"@typescript-eslint/no-unused-vars": "error",
"no-global-assign": ["error", { "exceptions": ["console"] }],
"unicorn/no-reduce": "off",
"unicorn/prevent-abbreviations": "off"
"unicorn/prevent-abbreviations": "off",
"unicorn/no-process-exit": "off"
},
"overrides": [
{
Expand Down
12 changes: 11 additions & 1 deletion packages/cli/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ export default class RunCommand extends BaseCommand {
outputFile: flags.string({
char: 'o',
default: '',
description: 'Specify file to write report to.',
description:
'Specify file to write JSON output to. Requires the `--format` flag to be set to `json`',
}),
listTasks: flags.boolean({
char: 'l',
Expand All @@ -111,6 +112,14 @@ export default class RunCommand extends BaseCommand {
public async init() {
let { argv, flags } = this.parse(RunCommand);

if (flags.outputFile && flags.format !== OutputFormat.json) {
this.error(
new Error(
'Missing --format flag. --format=json must also be provided when using --outputFile'
)
);
}

this.runArgs = argv;
this.runFlags = flags;
}
Expand Down Expand Up @@ -161,6 +170,7 @@ export default class RunCommand extends BaseCommand {
'Run `checkup --listTasks` to see available tasks'
)
);
ui.action.stop();
}
} else {
[this.pluginTaskResults, this.pluginTaskErrors] = await this.pluginTasks.runTasks();
Expand Down

0 comments on commit 00f7e5e

Please sign in to comment.