diff --git a/.gitignore b/.gitignore index 66fd13c9..17df1834 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ # Dependency directories (remove the comment below to include it) # vendor/ +*.swp diff --git a/type.go b/type.go new file mode 100644 index 00000000..4d5b1b49 --- /dev/null +++ b/type.go @@ -0,0 +1,62 @@ +package ice + +import ( + "time" +) + +type Cache struct { + Value string + Name string + Help string + Hand func(m *Message, x *Cache, arg ...string) string +} +type Config struct { + Value interface{} + Name string + Help string + Hand func(m *Message, x *Config, arg ...string) string +} +type Command struct { + Form map[string]int + Name string + Help interface{} + Auto func(m *Message, c *Context, key string, arg ...string) (ok bool) + Hand func(m *Message, c *Context, key string, arg ...string) (e error) +} +type Context struct { + Name string + Help string + + Caches map[string]*Cache + Configs map[string]*Config + Commands map[string]*Command + + contexts map[string]*Context + context *Context + root *Context + + exit chan bool + Server +} +type Server interface { + Spawn(m *Message, c *Context, arg ...string) Server + Begin(m *Message, arg ...string) Server + Start(m *Message, arg ...string) bool + Close(m *Message, arg ...string) bool +} + +type Message struct { + time time.Time + code int + + Meta map[string][]string + Data map[string]interface{} + + messages []*Message + message *Message + root *Message + + source *Context + target *Context + Hand bool +}