Class: ITRP::Cmd_getlabel

Inherits:
Cmd
  • Object
show all
Defined in:
lib/handlers/getlabel.rb

Instance Attribute Summary

Attributes inherited from Cmd

#attach_cmd, #children, #enabled_in_state, #trigger

Instance Method Summary collapse

Methods inherited from Cmd

#appstate, #completions, #find_node, #is_root?, #place_node, #print_state, #set_time_window, #treeprint

Constructor Details

#initialize(e) ⇒ Cmd_getlabel

Returns a new instance of Cmd_getlabel.



5
6
7
8
9
10
# File 'lib/handlers/getlabel.rb', line 5

def initialize (e)
	super(e)
	@enabled_in_state = :counter
	@attach_cmd  = ''
	@trigger = 'getlabel'
end

Instance Method Details

#enter(cmdline) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/handlers/getlabel.rb', line 12

def enter(cmdline)

    patt = cmdline.scan(/getlabel (.*)/).flatten

    print("Search [#{patt[0]}]\n")
    req =mk_request(TRP::Message::Command::SEARCH_KEYS_REQUEST,
                     :counter_group => appstate(:cgguid),
                     :pattern  => patt[0])


    rows = []
    get_response_zmq(@appenv.zmq_endpt,req) do |resp|
        resp.keys.each do |k|
            rows << [ k.key, k.label, k.readable ]
        end
    end


    table = Terminal::Table.new( :headings => %w(Key  Label Readable ), :rows => rows)
    puts(table) 

end