mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 17:44:05 +08:00
opt can
This commit is contained in:
parent
51d87c3f54
commit
6ed14de57c
@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
"shylinux.com/x/go-qrcode"
|
"shylinux.com/x/go-qrcode"
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -129,12 +130,24 @@ const QRCODE = "qrcode"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||||
QRCODE: {Name: "qrcode text fg bg size auto", Help: "二维码", Action: map[string]*ice.Action{
|
QRCODE: {Name: "qrcode text@key fg@key bg@key size auto", Help: "二维码", Action: map[string]*ice.Action{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
ice.AddRender(ice.RENDER_QRCODE, func(m *ice.Message, cmd string, args ...ice.Any) string {
|
ice.AddRender(ice.RENDER_QRCODE, func(m *ice.Message, cmd string, args ...ice.Any) string {
|
||||||
return m.Cmd(QRCODE, kit.Simple(args...)).Result()
|
return m.Cmd(QRCODE, kit.Simple(args...)).Result()
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
switch arg[0] {
|
||||||
|
case "text":
|
||||||
|
m.Push("text", "hi")
|
||||||
|
m.Push("text", "hello")
|
||||||
|
m.Push("text", "world")
|
||||||
|
case "fg", "bg":
|
||||||
|
m.Push("color", "red")
|
||||||
|
m.Push("color", "green")
|
||||||
|
m.Push("color", "blue")
|
||||||
|
}
|
||||||
|
}},
|
||||||
}, Hand: func(m *ice.Message, arg ...string) {
|
}, Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(SIZE, kit.Select("240", arg, 3))
|
m.Option(SIZE, kit.Select("240", arg, 3))
|
||||||
m.Option(BG, kit.Select(WHITE, arg, 2))
|
m.Option(BG, kit.Select(WHITE, arg, 2))
|
||||||
|
@ -200,7 +200,7 @@ const STATUS = "status"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||||
STATUS: {Name: "status repos@key auto", Help: "状态机", Action: map[string]*ice.Action{
|
STATUS: {Name: "status repos auto", Help: "状态机", Action: map[string]*ice.Action{
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case mdb.NAME, REPOS:
|
case mdb.NAME, REPOS:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user