#!/usr/bin/env ruby # Hack to allow testing with Aruba (for now) $:.push File.expand_path(File.join("..", "..", "lib"), __FILE__) require 'hobo' require 'slop' error_handler = Hobo::ErrorHandlers::Friendly.new Hobo.ui = Hobo::Ui.new # win32console unfortunately has issues with Open3 # Simply disabling color for now; --ansi can be explicitly passed if required # We also take the opportunity to disable ansi for pipes Hobo.ui.use_color false if Gem.win_platform? || !STDOUT.tty? # Options parsed here will be hidden from the main app slop = Slop.parse! do on '--debug', 'Enable debugging' do error_handler = Hobo::ErrorHandlers::Debug.new end on '--ansi', 'Enable / disable ansi output' do |*args| Hobo.ui.use_color self.to_hash[:ansi] end end begin Hobo::Cli.new(slop: slop).start rescue Exception => error exit error_handler.handle(error) end