forked from x/icebergs
add some
This commit is contained in:
parent
9829b5c3ef
commit
eed06ba25c
@ -200,10 +200,10 @@ func init() {
|
||||
}},
|
||||
mdb.CREATE: {Name: "create name*=hi icon@icons repos binary template", Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(!strings.Contains(m.Option(mdb.NAME), "-") || !strings.HasPrefix(m.Option(mdb.NAME), "20"), func() { m.Option(mdb.NAME, m.Time("20060102-")+m.Option(mdb.NAME)) })
|
||||
m.OptionDefault(mdb.ICON, nfs.USR_ICONS_ICEBERGS)
|
||||
kit.If(mdb.Config(m, nfs.REPOS), func(p string) { m.OptionDefault(nfs.REPOS, p+m.Option(mdb.NAME)) })
|
||||
kit.If(mdb.Config(m, nfs.BINARY), func(p string) { m.OptionDefault(nfs.BINARY, p+m.Option(mdb.NAME)) })
|
||||
kit.If(mdb.Config(m, nfs.REPOS), func(p string) { m.OptionDefault(nfs.REPOS, p+m.Option(mdb.NAME)) })
|
||||
m.Option(nfs.REPOS, kit.Select("", kit.Slice(kit.Split(m.Option(nfs.REPOS)), -1), 0))
|
||||
m.OptionDefault(mdb.ICON, nfs.USR_ICONS_ICEBERGS)
|
||||
if mdb.HashCreate(m); !m.IsCliUA() {
|
||||
_dream_start(m, m.Option(mdb.NAME))
|
||||
}
|
||||
|
@ -146,14 +146,14 @@ func toastContent(m *ice.Message, state string, arg ...ice.Any) string {
|
||||
return kit.JoinWord(kit.Simple(Icons[state], m.ActionKey(), state, arg)...)
|
||||
}
|
||||
func ToastSuccess(m *ice.Message, arg ...ice.Any) {
|
||||
Toast(m, toastContent(m, ice.SUCCESS, arg...))
|
||||
Toast(m, toastContent(m, ice.SUCCESS, arg...), "", "1s")
|
||||
}
|
||||
func ToastFailure(m *ice.Message, arg ...ice.Any) {
|
||||
Toast(m, toastContent(m, ice.FAILURE, arg...), "", m.OptionDefault(ice.TOAST_DURATION, "3s")).Sleep(m.OptionDefault(ice.TOAST_DURATION, "3s"))
|
||||
}
|
||||
func ToastProcess(m *ice.Message, arg ...ice.Any) func() {
|
||||
Toast(m, toastContent(m, ice.PROCESS, arg...))
|
||||
return func() { Toast(m, toastContent(m, ice.SUCCESS, arg...)) }
|
||||
Toast(m, toastContent(m, ice.PROCESS, arg...), "", "30s")
|
||||
return func() { Toast(m, toastContent(m, ice.SUCCESS, arg...), "", "1s") }
|
||||
}
|
||||
func GoToast(m *ice.Message, title string, cb func(toast func(name string, count, total int)) []string) *ice.Message {
|
||||
_total := 0
|
||||
@ -166,7 +166,7 @@ func GoToast(m *ice.Message, title string, cb func(toast func(name string, count
|
||||
}
|
||||
if list := cb(toast); len(list) > 0 {
|
||||
icon = Icons[ice.FAILURE]
|
||||
m.Option(ice.TOAST_DURATION, "30s")
|
||||
m.Option(ice.TOAST_DURATION, "10s")
|
||||
toast(kit.JoinWord(list...), len(list), _total)
|
||||
} else {
|
||||
icon = Icons[ice.SUCCESS]
|
||||
|
@ -36,14 +36,16 @@ func init() {
|
||||
switch m.Option(ctx.ACTION) {
|
||||
case INIT:
|
||||
m.Cmd("web.spide", ice.OptionFields(web.CLIENT_ORIGIN), func(value ice.Maps) { m.Push(arg[0], value[web.CLIENT_ORIGIN]+"/x/"+path.Base(kit.Path(""))) })
|
||||
m.Push(arg[0], web.UserHost(m)+"/x/")
|
||||
case INSTEADOF:
|
||||
m.Cmd("web.spide", ice.OptionFields(web.CLIENT_ORIGIN), func(value ice.Maps) { m.Push(arg[0], value[web.CLIENT_ORIGIN]+"/x/") })
|
||||
m.Push(arg[0], web.UserHost(m)+"/x/")
|
||||
default:
|
||||
switch arg[0] {
|
||||
case aaa.EMAIL:
|
||||
m.Push(arg[0], _configs_get(m, USER_EMAIL), ice.Info.Make.Email)
|
||||
case aaa.USERNAME:
|
||||
m.Push(arg[0], kit.Select(m.Option(ice.MSG_USERNAME), _configs_get(m, USER_NAME)), ice.Info.Make.Username)
|
||||
case aaa.EMAIL:
|
||||
m.Push(arg[0], _configs_get(m, USER_EMAIL), ice.Info.Make.Email)
|
||||
default:
|
||||
m.Cmdy(REPOS, mdb.INPUTS, arg)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user