1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 09:34:05 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-03-10 10:26:03 +08:00
parent 94b7c4b4a1
commit c843dd8ac9
2 changed files with 16 additions and 9 deletions

View File

@ -4,7 +4,6 @@ import (
"os"
"path"
"regexp"
"runtime"
"strings"
ice "shylinux.com/x/icebergs"
@ -179,9 +178,7 @@ func init() {
aaa.Black(m, ice.USR_LOCAL)
}}, mdb.UPLOAD: {},
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
m.Debug("what ")
if arg[0] == mdb.FOREACH && arg[1] == "" && runtime.GOOS == "darwin" && m.Cmdx("host", "islocal", m.Option(ice.MSG_USERIP)) == ice.OK {
m.Debug("what ")
if arg[0] == mdb.FOREACH && arg[1] == "" && m.Cmdx("host", "islocal", m.Option(ice.MSG_USERIP)) == ice.OK {
for _, p := range []string{"Desktop", "Documents", "Downloads", "Pictures"} {
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) {

View File

@ -1,13 +1,14 @@
package chat
import (
"strings"
"runtime"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/cli"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
)
const SEARCH = "search"
@ -16,10 +17,19 @@ func init() {
Index.MergeCommands(ice.Commands{
web.P(SEARCH): {Name: "/search", Help: "搜索框", Actions: ice.MergeActions(ice.Actions{
cli.OPENS: {Hand: func(m *ice.Message, arg ...string) {
if strings.HasSuffix(arg[0], ".app") {
m.Cmd(cli.SYSTEM, cli.OPEN, "-a", arg[0])
} else {
m.Cmd(cli.SYSTEM, cli.OPEN, arg[0])
switch runtime.GOOS {
case cli.DARWIN:
if kit.Ext(arg[0]) == "app" {
m.Cmd(cli.SYSTEM, cli.OPEN, "-a", arg[0])
} else {
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) {