예제 #1
0
func (this *Dispatcher) Dispatch(request *io.Request, response *io.Response) Interactor {
	_, hasHelpParam := request.GetUniversalParamString("h")
	if hasHelpParam {
		return this.locator.GetInteractorByName("help")
	}

	interator := this.locator.GetInteractorByName(request.InteractorName)
	if interator == nil {
		return this.locator.GetInteractorByName("help")
	}
	return interator
}
예제 #2
0
func (this *OptionsApplier) Apply(request *io.Request, response *io.Response) {
	var ok bool
	_, ok = request.GetUniversalParamString("v")
	if ok {
		response.SetVerbose(true)
	}

	_, ok = request.GetUniversalParamString("n")
	if ok {
		response.SetVerbose(false)
	}
}
예제 #3
0
func (this *Validator) isInteractorEmpty(request *io.Request) bool {
	_, hasHelpOption := request.GetUniversalParamString("h")
	return !hasHelpOption && request.InteractorNameEmpty()
}