Skip to content

Commit

Permalink
feat: 🎸 strictly check unexpected options
Browse files Browse the repository at this point in the history
  • Loading branch information
shufo committed Aug 7, 2022
1 parent 9b1087c commit 8286d0e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ export default async function cli() {
})
.help('h')
.alias('h', 'help')
.strictOptions()
.fail(function (msg, err, yargs) {
if (err) throw err; // preserve stack
process.stdout.write(`${chalk.red(`error: `)}${msg}\n\n`);
process.stdout.write(`${chalk.yellow(`Usage: `)} ${name} [options] [file glob | ...]\n\n`);
process.stdout.write(`For more information try ${chalk.green(`--help`)}\n`);
process.exit(1);
})
.epilog(`Copyright Shuhei Hayashibara 2022\nFor more information, see https://github.com/shufo/blade-formatter`);

// @ts-ignore
Expand Down

0 comments on commit 8286d0e

Please sign in to comment.