From eef0d9cdbe000f3f8e162cb331674131981379e2 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Thu, 16 Nov 2017 19:11:17 +0100 Subject: [PATCH] Print help even for expected errors Change-Type: patch --- build/actions/os.js | 2 +- build/utils/patterns.js | 2 +- doc/cli.markdown | 2 +- lib/actions/os.coffee | 2 +- lib/utils/patterns.coffee | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/actions/os.js b/build/actions/os.js index 13198d99..8c409852 100644 --- a/build/actions/os.js +++ b/build/actions/os.js @@ -165,7 +165,7 @@ buildConfig = function(image, deviceType, advanced) { exports.buildConfig = { signature: 'os build-config ', description: 'build the OS config and save it to the JSON file', - help: 'Use this command to prebuild the OS config once and skip the interactive part of `resin os configure`.\n\nExamples:\n\n $ resin os build-config ../path/rpi3.img raspberrypi3 --output rpi3-config.json\n $ resin os configure ../path/rpi3.img 7cf02a6 --config "$(cat rpi3-config.json)"', + help: 'Use this command to prebuild the OS config once and skip the interactive part of `resin os configure`.\n\nExample:\n\n $ resin os build-config ../path/rpi3.img raspberrypi3 --output rpi3-config.json\n $ resin os configure ../path/rpi3.img 7cf02a6 --config "$(cat rpi3-config.json)"', permission: 'user', options: [ commandOptions.advancedConfig, { diff --git a/build/utils/patterns.js b/build/utils/patterns.js index 9de8bdc1..5f6e1f2f 100644 --- a/build/utils/patterns.js +++ b/build/utils/patterns.js @@ -224,6 +224,6 @@ exports.expectedError = function(message) { if (message instanceof Error) { message = message.message; } - console.error(chalk.red(message)); + exports.printErrorMessage(message); return process.exit(1); }; diff --git a/doc/cli.markdown b/doc/cli.markdown index 403cde8d..18db89d2 100644 --- a/doc/cli.markdown +++ b/doc/cli.markdown @@ -894,7 +894,7 @@ or 'menu' (will show the interactive menu) Use this command to prebuild the OS config once and skip the interactive part of `resin os configure`. -Examples: +Example: $ resin os build-config ../path/rpi3.img raspberrypi3 --output rpi3-config.json $ resin os configure ../path/rpi3.img 7cf02a6 --config "$(cat rpi3-config.json)" diff --git a/lib/actions/os.coffee b/lib/actions/os.coffee index b055d965..a5836b6b 100644 --- a/lib/actions/os.coffee +++ b/lib/actions/os.coffee @@ -169,7 +169,7 @@ exports.buildConfig = help: ''' Use this command to prebuild the OS config once and skip the interactive part of `resin os configure`. - Examples: + Example: $ resin os build-config ../path/rpi3.img raspberrypi3 --output rpi3-config.json $ resin os configure ../path/rpi3.img 7cf02a6 --config "$(cat rpi3-config.json)" diff --git a/lib/utils/patterns.coffee b/lib/utils/patterns.coffee index f279e161..fc586abd 100644 --- a/lib/utils/patterns.coffee +++ b/lib/utils/patterns.coffee @@ -177,5 +177,5 @@ exports.printErrorMessage = (message) -> exports.expectedError = (message) -> if message instanceof Error message = message.message - console.error(chalk.red(message)) + exports.printErrorMessage(message) process.exit(1)