mirror of
https://shylinux.com/x/icebergs
synced 2025-04-27 01:48:27 +08:00
opt windows
This commit is contained in:
parent
0ef5509ccf
commit
eceea605ad
@ -149,7 +149,7 @@ const RUNTIME = "runtime"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
RUNTIME: {Name: "runtime info=bootinfo,ifconfig,hostinfo,hostname,userinfo,procinfo,diskinfo,api,cli,cmd,env,chain auto", Help: "运行环境", Actions: ice.MergeActions(ice.Actions{
|
RUNTIME: {Name: "runtime info=bootinfo,ifconfig,hostinfo,hostname,userinfo,procinfo,diskinfo,api,cli,cmd,env,chain auto upgrade", Help: "运行环境", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { _runtime_init(m) }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { _runtime_init(m) }},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { m.Conf("", "", nil) }},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { m.Conf("", "", nil) }},
|
||||||
IFCONFIG: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("tcp.host") }},
|
IFCONFIG: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("tcp.host") }},
|
||||||
@ -201,6 +201,14 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
"chain": {Hand: func(m *ice.Message, arg ...string) { m.Echo(m.FormatChain()) }},
|
"chain": {Hand: func(m *ice.Message, arg ...string) { m.Echo(m.FormatChain()) }},
|
||||||
|
"upgrade": {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
file := kit.Keys("ice", runtime.GOOS, runtime.GOARCH)
|
||||||
|
_file := file
|
||||||
|
if runtime.GOOS == WINDOWS {
|
||||||
|
_file = file + "." + m.Time() + ".exe"
|
||||||
|
}
|
||||||
|
m.Cmd("web.spide", "dev", "save", _file, "GET", ice.Info.Make.Domain+"/publish/"+file)
|
||||||
|
}},
|
||||||
}, ctx.ConfAction("")), Hand: func(m *ice.Message, arg ...string) {
|
}, ctx.ConfAction("")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 0 && arg[0] == BOOTINFO {
|
if len(arg) > 0 && arg[0] == BOOTINFO {
|
||||||
arg = arg[1:]
|
arg = arg[1:]
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
@ -52,6 +53,9 @@ func _system_cmd(m *ice.Message, arg ...string) *exec.Cmd {
|
|||||||
m.Logs(mdb.SELECT, "mirrors cmd", bin)
|
m.Logs(mdb.SELECT, "mirrors cmd", bin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if bin == "" && runtime.GOOS == WINDOWS {
|
||||||
|
bin = path.Join("C:/Windows", arg[0])
|
||||||
|
}
|
||||||
cmd := exec.Command(bin, arg[1:]...)
|
cmd := exec.Command(bin, arg[1:]...)
|
||||||
if cmd.Dir = kit.TrimPath(m.Option(CMD_DIR)); len(cmd.Dir) > 0 {
|
if cmd.Dir = kit.TrimPath(m.Option(CMD_DIR)); len(cmd.Dir) > 0 {
|
||||||
if m.Logs(mdb.PARAMS, CMD_DIR, cmd.Dir); !nfs.ExistsFile(m, cmd.Dir) {
|
if m.Logs(mdb.PARAMS, CMD_DIR, cmd.Dir); !nfs.ExistsFile(m, cmd.Dir) {
|
||||||
|
@ -41,6 +41,7 @@ func _host_list(m *ice.Message, name string) {
|
|||||||
m.Push("mask", "255.0.0.0")
|
m.Push("mask", "255.0.0.0")
|
||||||
m.Push("hard", "")
|
m.Push("hard", "")
|
||||||
}
|
}
|
||||||
|
m.SortInt(mdb.INDEX)
|
||||||
m.StatusTimeCount()
|
m.StatusTimeCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,8 @@ func _cache_upload(m *ice.Message, r *http.Request) (mime, name, file, size stri
|
|||||||
return "", "", "", "0"
|
return "", "", "", "0"
|
||||||
}
|
}
|
||||||
func _cache_download(m *ice.Message, r *http.Response, file string, cb ice.Any) string {
|
func _cache_download(m *ice.Message, r *http.Response, file string, cb ice.Any) string {
|
||||||
if f, p, e := miss.CreateFile(file); !m.Warn(e, ice.ErrNotValid, DOWNLOAD) {
|
if f, p, e := nfs.CreateFile(m, file); m.Assert(e) {
|
||||||
|
// if f, p, e := miss.CreateFile(file); !m.Warn(e, ice.ErrNotValid, DOWNLOAD) {
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
last, base := 0, 10
|
last, base := 0, 10
|
||||||
nfs.CopyFile(m, f, r.Body, base*ice.MOD_BUFS, kit.Int(kit.Select("100", r.Header.Get(ContentLength))), func(count, total, step int) {
|
nfs.CopyFile(m, f, r.Body, base*ice.MOD_BUFS, kit.Int(kit.Select("100", r.Header.Get(ContentLength))), func(count, total, step int) {
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
@ -165,7 +166,16 @@ func init() {
|
|||||||
_serve_start(m)
|
_serve_start(m)
|
||||||
}},
|
}},
|
||||||
SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Sleep30ms().Cmd(ssh.PRINTF, kit.Dict(nfs.CONTENT, "\r"+ice.Render(m, ice.RENDER_QRCODE, m.Cmdx(SPACE, DOMAIN))+ice.NL)).Cmd(ssh.PROMPT)
|
domain := m.Cmdx(SPACE, DOMAIN)
|
||||||
|
if ice.Info.Colors {
|
||||||
|
m.Sleep30ms().Cmd(ssh.PRINTF, kit.Dict(nfs.CONTENT, "\r"+ice.Render(m, ice.RENDER_QRCODE, domain)+ice.NL)).Cmd(ssh.PROMPT)
|
||||||
|
} else {
|
||||||
|
m.Sleep30ms().Cmd(ssh.PRINTF, kit.Dict(nfs.CONTENT, "\r"+domain+ice.NL)).Cmd(ssh.PROMPT)
|
||||||
|
}
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case cli.WINDOWS:
|
||||||
|
m.Cmd(cli.SYSTEM, "explorer.exe", domain)
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
SERVE_REWRITE: {Hand: func(m *ice.Message, arg ...string) {
|
SERVE_REWRITE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if arg[0] != http.MethodGet {
|
if arg[0] != http.MethodGet {
|
||||||
|
@ -85,7 +85,12 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
PUBLISH: {Name: "publish path auto create volcanos icebergs intshell", Help: "发布", Actions: ice.MergeActions(ice.Actions{
|
PUBLISH: {Name: "publish path auto create volcanos icebergs intshell", Help: "发布", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { m.Config(ice.CONTEXTS, _contexts) }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { m.Config(ice.CONTEXTS, _contexts) }},
|
||||||
web.SERVE_START: {Hand: func(m *ice.Message, arg ...string) { _publish_file(m, ice.ICE_BIN) }},
|
web.SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if runtime.GOOS == cli.WINDOWS {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_publish_file(m, ice.ICE_BIN)
|
||||||
|
}},
|
||||||
ice.VOLCANOS: {Help: "火山架", Hand: func(m *ice.Message, arg ...string) {
|
ice.VOLCANOS: {Help: "火山架", Hand: func(m *ice.Message, arg ...string) {
|
||||||
defer func() { m.EchoQRCode(m.Option(ice.MSG_USERWEB)) }()
|
defer func() { m.EchoQRCode(m.Option(ice.MSG_USERWEB)) }()
|
||||||
defer func() { m.Cmdy(PUBLISH, ice.CONTEXTS, ice.MISC) }()
|
defer func() { m.Cmdy(PUBLISH, ice.CONTEXTS, ice.MISC) }()
|
||||||
|
8
init.go
8
init.go
@ -102,7 +102,9 @@ func Run(arg ...string) string {
|
|||||||
Pulse._cmd = &Command{RawHand: logs.FileLines(3)}
|
Pulse._cmd = &Command{RawHand: logs.FileLines(3)}
|
||||||
}
|
}
|
||||||
if len(arg) == 0 && runtime.GOOS == "windows" {
|
if len(arg) == 0 && runtime.GOOS == "windows" {
|
||||||
arg = append(arg, "serve", "start")
|
arg = append(arg, SERVE, "start", "dev", "shy")
|
||||||
|
logs.Disable(true)
|
||||||
|
os.Stderr.Close()
|
||||||
}
|
}
|
||||||
switch Index.Merge(Index).Begin(Pulse, arg...); kit.Select("", arg, 0) {
|
switch Index.Merge(Index).Begin(Pulse, arg...); kit.Select("", arg, 0) {
|
||||||
case SERVE, SPACE:
|
case SERVE, SPACE:
|
||||||
@ -111,9 +113,7 @@ func Run(arg ...string) string {
|
|||||||
os.Exit(kit.Int(Pulse.Option(EXIT)))
|
os.Exit(kit.Int(Pulse.Option(EXIT)))
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if runtime.GOOS == "windows" {
|
if logs.Disable(true); len(arg) == 0 {
|
||||||
|
|
||||||
} else if logs.Disable(true); len(arg) == 0 {
|
|
||||||
arg = append(arg, HELP)
|
arg = append(arg, HELP)
|
||||||
}
|
}
|
||||||
if Pulse.Cmd(INIT).Cmdy(arg); strings.TrimSpace(Pulse.Result()) == "" {
|
if Pulse.Cmd(INIT).Cmdy(arg); strings.TrimSpace(Pulse.Result()) == "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user