class Samovar::Nested

def parse(input, parent = nil, default = nil)

Parameters:
  • default (Command) -- the default command if any.
def parse(input, parent = nil, default = nil)
	if command = @commands[input.first]
		name = input.shift
		
		# puts "Instantiating #{command} with #{input}"
		command.new(input, name: name, parent: parent)
	elsif default
		return default
	elsif @default
		@commands[@default].new(input, name: @default, parent: parent)
	elsif @required
		raise MissingValueError.new(parent, self)
	end
end