Skip to content

Commit

Permalink
cli: avoid printing duplicate help, and print help on invalid command
Browse files Browse the repository at this point in the history
  • Loading branch information
Rugvip committed Oct 10, 2020
1 parent dc0261e commit 9a3b3db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/proud-eagles-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---

Fixed duplicate help output, and print help on invalid command
10 changes: 2 additions & 8 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,12 @@ const main = (argv: string[]) => {

program.on('command:*', () => {
console.log();
console.log(
chalk.red(`Invalid command: ${chalk.cyan(program.args.join(' '))}`),
);
console.log(chalk.red('See --help for a list of available commands.'));
console.log(chalk.red(`Invalid command: ${program.args.join(' ')}`));
console.log();
program.outputHelp();
process.exit(1);
});

if (!process.argv.slice(2).length) {
program.outputHelp(chalk.yellow);
}

program.parse(argv);
};

Expand Down

0 comments on commit 9a3b3db

Please sign in to comment.