package cli

import "sync"

type Context struct {
	ID     int32
	locker sync.RWMutex
	CmdStr string
	Values map[string]interface{}
}

func (ctx *Context) Get(s string) interface{} {
	ctx.locker.RLock()
	defer ctx.locker.RUnlock()
	if ctx.Values == nil {
		return ""
	}
	return ctx.Values[s]
}

func (ctx *Context) Set(key string, value interface{}) {
	ctx.locker.Lock()
	defer ctx.locker.Unlock()
	if ctx.Values == nil {
		ctx.Values = make(map[string]interface{})
	}
	ctx.Values[key] = value
}

func (ctx *Context) Bind(i interface{}) (err error) {
	return
}

func (ctx *Context) Error(code int, msg string) (err error) {
	return
}

func (ctx *Context) Success(i interface{}) (err error) {
	return
}
