From 6f94c6d5e3c93bcf62820dabfc691dbbfc9f8461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Tue, 2 Apr 2019 12:52:01 +0200 Subject: [PATCH] feat: point to --verbose when command fails --- packages/cli/src/cliEntry.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/cliEntry.js b/packages/cli/src/cliEntry.js index 1b69ccee7..532531e31 100644 --- a/packages/cli/src/cliEntry.js +++ b/packages/cli/src/cliEntry.js @@ -35,7 +35,18 @@ commander.on('command:*', () => { const defaultOptParser = val => val; const handleError = err => { - logger.error(err.message); + if (commander.verbose) { + logger.error(err.message); + } else { + logger.error( + `${err.message}. ${chalk.dim( + `Run CLI with ${chalk.reset('--verbose')} ${chalk.dim( + 'flag for more details.', + )}`, + )}`, + ); + } + logger.debug(err.stack); process.exit(1); };