Class: BoxCli::SettingsCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/box_cli/settings_command.rb

Constant Summary

Constants inherited from Command

Command::GLOBAL_OPTION_NAMES

Instance Attribute Summary

Attributes inherited from Command

#args, #global_options, #local_options

Instance Method Summary collapse

Constructor Details

#initialize(options, args) ⇒ SettingsCommand

Returns a new instance of SettingsCommand.



3
4
5
6
# File 'lib/box_cli/settings_command.rb', line 3

def initialize(options, args)
  super
  collect_globals_from_env
end

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/box_cli/settings_command.rb', line 8

def call
  STDOUT.puts("Options:\n".tap do |s|
    if @options.__hash__.empty?
      s << "  (none)\n"
    else
      s << @options.__hash__.keys.map(&:to_s).sort.map { |k| "  %s: %s" % [k, @options.__hash__[k.to_sym]] }.join("\n")
    end
    s << "\n\nArguments:\n"
    if @args.empty?
      s << "  (none)\n"
    else
      s << @args.map { |p| "  #{p}" }.join("\n")
    end
  end)
end