Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Commit

Permalink
add quiet mode to lint subcommand; fixes #54
Browse files Browse the repository at this point in the history
  • Loading branch information
Alif Rachmawadi committed Jul 4, 2019
1 parent c70c2ee commit 887d950
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,19 @@ async function jsonCmd(input, cmd) {
}
}

async function lintCmd(input) {
async function lintCmd(input, cmd) {
try {
const result = await lint(input);

if (result.length === 0) {
console.log("OK");
if (!cmd.quiet) {
console.log("OK");
}
} else {
renderLint(result);
if (!cmd.quiet) {
renderLint(result);
}

process.exit(1);
}
} catch (err) {
Expand Down Expand Up @@ -278,6 +283,7 @@ commander
commander
.command("lint")
.description("validate API blueprint")
.option("-q, --quiet", "quiet mode")
.arguments("<input>")
.action(lintCmd);

Expand Down

0 comments on commit 887d950

Please sign in to comment.