mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 17:44:05 +08:00
opt some
This commit is contained in:
parent
94b7c4b4a1
commit
c843dd8ac9
@ -4,7 +4,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
@ -179,9 +178,7 @@ func init() {
|
|||||||
aaa.Black(m, ice.USR_LOCAL)
|
aaa.Black(m, ice.USR_LOCAL)
|
||||||
}}, mdb.UPLOAD: {},
|
}}, mdb.UPLOAD: {},
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Debug("what ")
|
if arg[0] == mdb.FOREACH && arg[1] == "" && m.Cmdx("host", "islocal", m.Option(ice.MSG_USERIP)) == ice.OK {
|
||||||
if arg[0] == mdb.FOREACH && arg[1] == "" && runtime.GOOS == "darwin" && m.Cmdx("host", "islocal", m.Option(ice.MSG_USERIP)) == ice.OK {
|
|
||||||
m.Debug("what ")
|
|
||||||
for _, p := range []string{"Desktop", "Documents", "Downloads", "Pictures"} {
|
for _, p := range []string{"Desktop", "Documents", "Downloads", "Pictures"} {
|
||||||
p := kit.HomePath(p)
|
p := kit.HomePath(p)
|
||||||
m.Cmd(DIR, PWD, mdb.NAME, mdb.TIME, kit.Dict(DIR_ROOT, p)).SortTimeR(mdb.TIME).TablesLimit(5, func(value ice.Maps) {
|
m.Cmd(DIR, PWD, mdb.NAME, mdb.TIME, kit.Dict(DIR_ROOT, p)).SortTimeR(mdb.TIME).TablesLimit(5, func(value ice.Maps) {
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package chat
|
package chat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"runtime"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
const SEARCH = "search"
|
const SEARCH = "search"
|
||||||
@ -16,11 +17,20 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
web.P(SEARCH): {Name: "/search", Help: "搜索框", Actions: ice.MergeActions(ice.Actions{
|
web.P(SEARCH): {Name: "/search", Help: "搜索框", Actions: ice.MergeActions(ice.Actions{
|
||||||
cli.OPENS: {Hand: func(m *ice.Message, arg ...string) {
|
cli.OPENS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if strings.HasSuffix(arg[0], ".app") {
|
switch runtime.GOOS {
|
||||||
|
case cli.DARWIN:
|
||||||
|
if kit.Ext(arg[0]) == "app" {
|
||||||
m.Cmd(cli.SYSTEM, cli.OPEN, "-a", arg[0])
|
m.Cmd(cli.SYSTEM, cli.OPEN, "-a", arg[0])
|
||||||
} else {
|
} else {
|
||||||
m.Cmd(cli.SYSTEM, cli.OPEN, arg[0])
|
m.Cmd(cli.SYSTEM, cli.OPEN, arg[0])
|
||||||
}
|
}
|
||||||
|
case cli.WINDOWS:
|
||||||
|
if kit.Ext(arg[0]) == "exe" {
|
||||||
|
m.Cmd(cli.SYSTEM, arg[0])
|
||||||
|
} else {
|
||||||
|
m.Cmd(cli.SYSTEM, "explorer", arg[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(web.Space(m, m.Option(ice.POD)), mdb.SEARCH, arg).StatusTimeCount()
|
m.Cmdy(web.Space(m, m.Option(ice.POD)), mdb.SEARCH, arg).StatusTimeCount()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user