Method: Dispatches#invoke

Defined in:
lib/itrp.rb

#invoke(cmdline) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/itrp.rb', line 82

def invoke(cmdline)
	# system commands
	case cmdline.scan(/(\w+)/).flatten.first 
		when 'reload' ; reload 
		when 'quit'   ; quit 
		when 'help'   ; help
		when 'clear'  ; system("clear") 
		else;
	end 

	# dispatch to correct plugin w/ context
	node=nil
	[Appenv.context, :any].uniq.collect do |ctx|
		node  = @cmd_roots[ctx].find_node(cmdline.strip.split(' '))
		if not node.is_root?
			node.enter(cmdline.strip) 
			return
		end
	end
	node.notfound(cmdline) if node.is_root?
end