1
0
forked from x/icebergs
This commit is contained in:
harveyshao 2023-02-13 22:30:39 +08:00
parent bc93ec6fa0
commit 0ef5509ccf
5 changed files with 25 additions and 4 deletions

View File

@ -3,6 +3,7 @@ package cli
import ( import (
"os" "os"
"path" "path"
"runtime"
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/gdb" "shylinux.com/x/icebergs/base/gdb"
@ -64,6 +65,10 @@ func init() {
m.Cmd(SYSTEM, "cp", "-r", "var/log", back, ice.Maps{CMD_OUTPUT: ""}) m.Cmd(SYSTEM, "cp", "-r", "var/log", back, ice.Maps{CMD_OUTPUT: ""})
m.Cmd(SYSTEM, "cp", "bin/boot.log", path.Join(back, "boot.log"), ice.Maps{CMD_OUTPUT: ""}) m.Cmd(SYSTEM, "cp", "bin/boot.log", path.Join(back, "boot.log"), ice.Maps{CMD_OUTPUT: ""})
} }
if runtime.GOOS == "windows" {
m.Sleep("3s")
break
}
} }
}}, }},
}) })

View File

@ -169,7 +169,8 @@ func init() {
return return
} }
// mdb.HashCreate(m.Spawn(), ice.CMD, arg[0], ice.ARG, kit.Join(arg[1:], ice.SP)) // mdb.HashCreate(m.Spawn(), ice.CMD, arg[0], ice.ARG, kit.Join(arg[1:], ice.SP))
if _system_exec(m, _system_cmd(m, kit.Simple(kit.Split(arg[0]), arg[1:])...)); IsSuccess(m) && m.Append(CMD_ERR) == "" { if _system_exec(m, _system_cmd(m, arg...)); IsSuccess(m) && m.Append(CMD_ERR) == "" {
// if _system_exec(m, _system_cmd(m, kit.Simple(kit.Split(arg[0]), arg[1:])...)); IsSuccess(m) && m.Append(CMD_ERR) == "" {
m.SetAppend() m.SetAppend()
} }
}}, }},

View File

@ -103,7 +103,11 @@ func _dir_list(m *ice.Message, root string, dir string, level int, deep bool, di
} }
m.Push(mdb.HASH, kit.Select(h[:6], h[:], field == mdb.HASH)) m.Push(mdb.HASH, kit.Select(h[:6], h[:], field == mdb.HASH))
case mdb.LINK: case mdb.LINK:
if strings.Contains(p, "ice.windows.") {
m.PushDownload(mdb.LINK, kit.Select("", f.Name(), !isDir)+".exe", p)
} else {
m.PushDownload(mdb.LINK, kit.Select("", f.Name(), !isDir), p) m.PushDownload(mdb.LINK, kit.Select("", f.Name(), !isDir), p)
}
case mdb.SHOW: case mdb.SHOW:
switch p := kit.MergeURL("/share/local/"+p, ice.POD, m.Option(ice.MSG_USERPOD)); kit.Ext(f.Name()) { switch p := kit.MergeURL("/share/local/"+p, ice.POD, m.Option(ice.MSG_USERPOD)); kit.Ext(f.Name()) {
case PNG, JPG: case PNG, JPG:

View File

@ -41,7 +41,12 @@ func (f *Frame) prompt(m *ice.Message, list ...string) *Frame {
if len(list) == 0 { if len(list) == 0 {
list = append(list, f.ps1...) list = append(list, f.ps1...)
} }
if ice.Info.Colors {
fmt.Fprintf(f.stdout, "\r\033[2K") fmt.Fprintf(f.stdout, "\r\033[2K")
} else {
fmt.Fprintf(f.stdout, "\r")
}
for _, v := range list { for _, v := range list {
switch v { switch v {
case mdb.COUNT: case mdb.COUNT:

View File

@ -2,6 +2,7 @@ package ice
import ( import (
"os" "os"
"runtime"
"strings" "strings"
"time" "time"
@ -100,6 +101,9 @@ func Run(arg ...string) string {
if Pulse._cmd == nil { if Pulse._cmd == nil {
Pulse._cmd = &Command{RawHand: logs.FileLines(3)} Pulse._cmd = &Command{RawHand: logs.FileLines(3)}
} }
if len(arg) == 0 && runtime.GOOS == "windows" {
arg = append(arg, "serve", "start")
}
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:
if Index.Start(Pulse, arg...) { if Index.Start(Pulse, arg...) {
@ -107,7 +111,9 @@ func Run(arg ...string) string {
os.Exit(kit.Int(Pulse.Option(EXIT))) os.Exit(kit.Int(Pulse.Option(EXIT)))
} }
default: default:
if logs.Disable(true); len(arg) == 0 { if runtime.GOOS == "windows" {
} 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()) == "" {