Class: Smith::Commands::Group

Inherits:
Smith::CommandBase show all
Includes:
Common
Defined in:
lib/smith/commands/agency/group.rb

Instance Attribute Summary

Attributes inherited from Smith::CommandBase

#options, #target

Instance Method Summary collapse

Methods included from Common

#agent_group

Methods inherited from Smith::CommandBase

#banner, #format_help, #initialize, #parse_options

Methods included from Logger

included

Constructor Details

This class inherits a constructor from Smith::CommandBase

Instance Method Details

#executeObject



9
10
11
12
13
# File 'lib/smith/commands/agency/group.rb', line 9

def execute
  group do |value|
    responder.succeed(value)
  end
end

#group(&blk) ⇒ Object

Returns the agents in a group.



16
17
18
19
20
21
22
23
# File 'lib/smith/commands/agency/group.rb', line 16

def group(&blk)
  separator = (options[:one_column]) ? "\n" : " "
  begin
    blk.call(agent_group(target.first).join(separator))
  rescue RuntimeError => e
    blk.call(e.message)
  end
end

#options_specObject



25
26
27
28
29
# File 'lib/smith/commands/agency/group.rb', line 25

def options_spec
  banner "Lists the agents in a group.", "<group>"

  opt    :one_column, "Lists one agent per line", :short => :s
end