alpha

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WORD = "word"
	LINE = "line"
)
View Source
const ALPHA = "alpha"
View Source
const CACHE = "cache"

Variables

View Source
var Index = &ice.Context{Name: ALPHA, Help: "英汉词典", Configs: map[string]*ice.Config{
	ALPHA: {Name: ALPHA, Help: "英汉词典", Value: kit.Data(
		kit.SSH_REPOS, "word-dict", kit.MDB_FIELD, "word,translation,definition",
		kit.MDB_STORE, path.Join(ice.USR_LOCAL_EXPORT, ALPHA), kit.MDB_FSIZE, "300000",
		kit.MDB_LIMIT, "50000", kit.MDB_LEAST, "1000",
	)},
}, Commands: map[string]*ice.Command{
	ALPHA: {Name: "alpha method=word,line word auto", Help: "英汉", Action: map[string]*ice.Action{
		mdb.IMPORT: {Name: "import file=usr/word-dict/ecdict name=ecdict", Help: "加载词库", Hand: func(m *ice.Message, arg ...string) {
			_alpha_load(m, m.Option(kit.MDB_FILE), kit.Select(path.Base(m.Option(kit.MDB_FILE)), m.Option(kit.MDB_NAME)))
		}},
		mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
			if arg[0] == ALPHA {
				_alpha_find(m, kit.Select(WORD, arg, 2), arg[1])
			}
		}},
		mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
			m.Cmdy(CACHE, mdb.REMOVE)
		}},
	}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
		if len(arg) < 2 {
			m.Cmdy(CACHE, kit.Select("", arg, 1))
			return
		}
		defer m.StatusTimeCountTotal(m.Config(kit.MDB_COUNT))
		if arg[0] == WORD {
			if msg := m.Cmd(CACHE, arg[1]); msg.Length() > 0 {
				m.Copy(msg)
				return
			}
			m.OptionFields(mdb.DETAIL)
		} else {
			m.OptionFields(m.Config(kit.MDB_FIELD))
		}
		if _alpha_find(m, arg[0], arg[1]); arg[0] == WORD && m.Length() > 0 {
			m.Cmd(CACHE, mdb.CREATE, m.AppendSimple())
		}
	}},
}}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL