Add chalked output to main
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import program from 'commander';
|
||||
import chalk from 'chalk';
|
||||
import createPluginCommand from './commands/createPlugin';
|
||||
import watch from './commands/watch-deps';
|
||||
import serve from './commands/serve';
|
||||
@@ -24,14 +25,19 @@ const main = (argv: string[]) => {
|
||||
.action(watch);
|
||||
|
||||
program.on('command:*', () => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
'Invalid command: %s\nSee --help for a list of available commands.',
|
||||
program.args.join(' '),
|
||||
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();
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
if (!process.argv.slice(2).length) {
|
||||
program.outputHelp(chalk.yellow);
|
||||
}
|
||||
|
||||
program.parse(argv);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user