lib/magellan/cli/command.rb in magellan-cli-0.4.2 vs lib/magellan/cli/command.rb in magellan-cli-0.4.3

- old
+ new

@@ -10,24 +10,32 @@ class << self # override Thor::Base.start method def start(given_args = ARGV, config = {}) Magellan::Cli::FileAccess.ensure_config_dir + verbose = ARGV.include?("-V") || ARGV.include?("--verbose") # class_options verbose and version are defined in Magellan::Cli::Base if (ARGV == ["-v"] || ARGV == ["--version"]) log_info(File.basename($0) << " " << Magellan::Cli::VERSION) exit(0) elsif ARGV.include?("-v") || ARGV.include?("--version") log_info(File.basename($0) << " " << Magellan::Cli::VERSION) end begin + GemUpdate.search do |name, v| + log_info("\n\e[32mNew version available. try `gem install #{name} -v #{v}`\e[0m\n") + end + rescue => e + log_verbose("[#{e.class}] #{e.message}", verbose) + end + begin super(given_args, config) rescue Magellan::Cli::Error => e log_error(e.message) block_given? ? yield(e) : exit(1) rescue => e log_error("[#{e.class}] #{e.message}") - log_verbose(" " << e.backtrace.join("\n "), ARGV.include?("-V") || ARGV.include?("--verbose")) + log_verbose(" " << e.backtrace.join("\n "), verbose) block_given? ? yield(e) : exit(1) end end # overwrite Magellan::Cli::Base.help method