From d6d7074341ad199eeca20fe31f6acc5c543adf26 Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Mon, 30 Jan 2017 22:20:22 +0100 Subject: [PATCH] fix error message when there is a bad option --- bin/mpw | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/mpw b/bin/mpw index 8e578f8..464980c 100755 --- a/bin/mpw +++ b/bin/mpw @@ -21,6 +21,7 @@ $: << File.expand_path('../../lib', __FILE__) require 'locale' require 'set' require 'i18n' +require 'colorize' # --------------------------------------------------------- # # Set local @@ -45,7 +46,11 @@ bin_dir = File.dirname(__FILE__) command = "#{bin_dir}/mpw-#{ARGV[0]}" if Dir.glob("#{bin_dir}/mpw-*").include?("#{command}") - Kernel.load(command) + begin + Kernel.load(command) + rescue Exception => e + puts "#{I18n.t('display.error')}: #{e}".red + end else puts "#{I18n.t('option.usage')}: mpw COMMAND [options]\n\n" puts 'Commands:'