Sha256: 78a5236ebc22418494b06ec753d33aaa13a6117169a3e2351367b95f49f230b2
Contents?: true
Size: 1.5 KB
Versions: 6
Compression:
Stored size: 1.5 KB
Contents
module Brightbox extend GLI # Global options desc "Simple output (tab separated, don't draw fancy tables)" switch [:s, :simple] desc "Set the api client to use (named in #{CONFIG.config_filename})" flag [:c, :client] desc "Disable peer SSL certificate verification" switch [:k, :insecure] desc "Display Help" switch [:h, :help] # Load the command libraries for the current group cmd_group_name = File.basename($0).gsub(/brightbox\-/, '') cmd_group_files = File.join(File.dirname(__FILE__), "commands/#{cmd_group_name}*.rb") Dir.glob(cmd_group_files).each do |f| load f end pre do |global_options, command, options, args| CONFIG.client_name = ENV["CLIENT"] if ENV["CLIENT"] CONFIG.client_name = global_options[:c] if global_options[:c] if global_options[:k] or ENV["INSECURE"] Excon.defaults[:ssl_verify_peer] = false end unless global_options[:s] Hirb.enable Hirb::View.resize end command = commands[:help] if global_options[:h] config_alias = CONFIG.alias == CONFIG.client_name ? nil : "(#{CONFIG.alias})" info "INFO: client_id: #{CONFIG.client_name} #{config_alias}" if CONFIG.clients.size > 1 true end on_error do |e| ErrorParser.new(e).pretty_print() debug e debug e.class.to_s debug e.backtrace.join("\n") exit 1 end desc 'Display version information' command [:version] do |c| c.action do |global_options, options, args| info "Brightbox CLI version: #{Brightbox::VERSION}" end end end
Version data entries
6 entries across 6 versions & 1 rubygems