diff --git a/base/nfs/nfs.go b/base/nfs/nfs.go index 513bfef5..5aa2a99f 100644 --- a/base/nfs/nfs.go +++ b/base/nfs/nfs.go @@ -8,6 +8,7 @@ import ( "crypto/sha1" "encoding/hex" "fmt" + "io" "io/ioutil" "os" "path" @@ -165,6 +166,18 @@ var Index = &ice.Context{Name: "nfs", Help: "存储模块", } } }}, + "copy": {Name: "save path text", Help: "保存", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + if f, _, e := kit.Create(arg[0]); m.Assert(e) { + defer f.Close() + for _, v := range arg[1:] { + if s, e := os.Open(v); !m.Warn(e != nil, "%s", e) { + if n, e := io.Copy(f, s); m.Assert(e) { + m.Log(ice.LOG_IMPORT, "%d: %v", n, v) + } + } + } + } + }}, }, } diff --git a/core/wiki/template.go b/core/wiki/template.go index 962b6bda..7d167bd5 100644 --- a/core/wiki/template.go +++ b/core/wiki/template.go @@ -4,7 +4,7 @@ var title = `<{{.Option "level"}} class="story" data-type="{{.Option "type"}}" d var brief = `

{{.Option "text"}}

` var refer = `` +{{range $index, $value := .Optionv "list"}}
  • {{index $value 0}} {{index $value 1}}
  • {{end}}` var spark = `

    {{.}}

    ` var shell = `
    $ {{.Option "input"}} diff --git a/core/wiki/wiki.go b/core/wiki/wiki.go index d9eac756..410ee78c 100644 --- a/core/wiki/wiki.go +++ b/core/wiki/wiki.go @@ -8,6 +8,7 @@ import ( "bytes" "fmt" + "html" "path" "strings" ) @@ -101,9 +102,10 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心", switch arg = arg[2:]; arg[0] { case "install", "compile": - m.Option("input", strings.Join(arg[1:], " ")) + m.Option("input", html.EscapeString(strings.Join(arg[1:], " "))) default: - m.Option("output", m.Cmdx("cli.system", "sh", "-c", m.Option("input", strings.Join(arg, " ")))) + m.Option("input", html.EscapeString(strings.Join(arg, " "))) + m.Option("output", html.EscapeString(m.Cmdx("cli.system", "sh", "-c", strings.Join(arg, " ")))) } m.Render(m.Conf("spark", ice.Meta("template")), m.Option("name")) m.Render(m.Conf("shell", ice.Meta("template"))) @@ -120,7 +122,11 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心", m.Option("type", "refer") m.Option("name", arg[0]) m.Option("text", arg[1]) - m.Optionv("list", kit.Split(arg[1], "\n")) + list := []interface{}{} + for _, v := range kit.Split(arg[1], "\n") { + list = append(list, kit.Split(v, " ")) + } + m.Optionv("list", list) m.Render(m.Conf("order", ice.Meta("template"))) }}, "brief": {Name: "brief text", Help: "摘要", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { diff --git a/miss/ice.md b/miss/ice.md index e2603cb3..d7639ed0 100644 --- a/miss/ice.md +++ b/miss/ice.md @@ -50,9 +50,9 @@ mkdir miss; cd miss && curl -s https://shylinux.com/publish/build.sh | sh mkdir miss; cd miss && curl -s https://shylinux.com/publish/ice.sh | sh ``` -## {{chapter "元始模块 base/ctx"}} +## {{chapter "配置模块 base/ctx"}} -## {{chapter "配置模块 base/cli"}} +## {{chapter "命令模块 base/cli"}} cli模块用于与系统进行交互。 - 系统信息 ice.CLI_RUNTIME