1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 08:48:06 +08:00

add yac.type

This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-04-06 15:35:23 +08:00
parent c3df162d11
commit 8f1a284feb
6 changed files with 135 additions and 46 deletions

View File

@ -6,6 +6,7 @@ binpack = src/binpack.go
all: def
@date +"%Y-%m-%d %H:%M:%S"
go build -v -o ${binarys} src/main.go ${version} ${binpack} && ./${binarys} forever restart &>/dev/null
# go build -v -o ${binarys} src/main.go ${version} ${binpack}
app: def
CGO_ENABLED=1 go build -v -o ${publish}/contexts.app/Contents/MacOS/contexts src/webview.go ${version} ${binpack} && ./${binarys} forever restart &>/dev/null

View File

@ -1,6 +1,102 @@
#! yac.stack
package main
var s1 = ""
var s2 = ""
var s3 = ""
var s4 = ""
type student struct {
name string
age int
}
func (s student) Name(m) {
m.Echo("hello %s world\n", s.name)
return s.name
}
func demo() {
s1 = map[string]string{"hi": "hi"}
m.Echo("what %#v\n", s1)
s2 = []string{"hi", "hi"}
m.Echo("what %#v\n", s2)
for k, v := range s1 {
}
s3 = student{name: "shy"}
m.Echo("what %#v\n", s3)
m.Echo("what %#v\n", s3.Name())
s4 = struct{ name string }{name: "shy"}
m.Echo("what %#v\n", s4)
defer func() { m.Echo("hello defer\n") }()
}
func init() {
s1 = map[string]string{"hi": "h1"}
m.Echo("what %#v\n", s1)
for k, v := range s1 {
m.Echo("what %v %v", k, v)
}
s2 = []string{"h0", "h1"}
for i, v := range s2 {
m.Echo("what %v %v", i, v)
}
}
import (
. "shylinux.com/x/contexts/src/shy"
_ "shylinux.com/x/contexts/src/shy"
kit "shylinux.com/x/toolkits"
)
const (
CONST1 = "const"
)
const VAR1 = "var"
type student struct {
name string
age int
}
func (s student) Name(a, b string) (c, d string) {
m.Echo("hello %s world", s.name)
}
func Name(a, b string) (c, d string) {
m.Echo("hello world")
}
var (
const1 = "const"
)
var var1 = "var"
func list(m, arg) {
show()
m.Echo("hello world")
Name()
show()
m.Echo("hello world")
}
func init() {
s := map[string]string{"hi": "hi"}
m.Echo("what %v", kit.Formats(s))
s := student{name: "hi"}
s.Name()
m.Echo("what %v", kit.Formats(s))
s := map[string]student{"one": student{name: "hi"}}
m.Echo("what %v", kit.Formats(s))
s := []student{"one": student{name: "hi"}}
}
func list(m, arg, name) {
cli.system "pwd"
m.Copy(cli.system("pwd"))
m.Cmdy("cli.system", "pwd")
m.Cmdy(cli.SYSTEM, "pwd")

View File

@ -1,49 +1,23 @@
#! yac.stack
package tmux
func list(m, arg, name) {
cli.system "pwd"
m.Copy(cli.system("pwd"))
m.Cmdy("cli.system", "pwd")
m.Cmdy(cli.SYSTEM, "pwd")
m.Cmdy(SYSTEM, "pwd")
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/cli"
kit "shylinux.com/x/toolkits"
)
m.Echo("%v", tcp.IsLocalHost(m, "127.0.0.1"))
func init() { m.DebugStack() }
defer func() { m.Echo("hello defer") }()
m.Push("h1", "hi").Push("h1", "he")
m.Table(func(value) { m.Echo(value["h1"]) })
m.Cmdy("tcp.host")
m.Action("list1", "list2", "list3")
}
func inputs(m, key) {
switch key {
case "name":
m.Push(key, "hi")
default:
m.Push(key, "good")
}
}
func list1(m) {
let dict = kit.Dict("a", 1, "b", 2)
m.Echo("%#v", dict).Echo("\n")
m.Echo("%#v", dict["a"]).Echo("\n")
let data = kit.List("a", 1, "b", 2)
m.Echo("%#v", data).Echo("\n")
m.Echo("%#v", data[0]).Echo("\n")
}
func list2(m, name) {
if name == "h1" {
m.Echo("h1")
} else if name == "h2" {
m.Echo("h2")
} else {
m.Echo("h3")
}
}
func list3(m) {
for i = 0; i < 10; i++ {
m.Echo(i)
if i < 5 { continue }
if i > 1 { break }
}
}
const TMUX = "tmux"
var Index = &ice.Context{Name: TMUX, Help: "工作台", Commands: ice.Commands{
TMUX: {Name: "tmux path auto start order build download", Help: "服务", Actions: ice.MergeActions(ice.Actions{
cli.START: {Help: "启动", Hand: func(m *ice.Message, arg ...string) {}},
}), Hand: func(m *ice.Message, arg ...string) {}},
}}
// func init() { code.Index.Register(Index, &web.Frame{}) }
func init() { m.DebugStack() }
func init() { m.Echo(kit.Formats(Index)) }
func init() { m.Echo(kit.Formats(Index.Name)) }
func init() { m.Echo(kit.Formats(Index.Commands[TMUX].Name)) }

View File

@ -0,0 +1,8 @@
func create(m, type) {
m.Echo("hello world")
}
func list(m, hash) {
m.Echo("hello world")
m.Echo("hello world")
m.Action("create").StatusTime().Display()
}

View File

@ -0,0 +1,4 @@
func _init(can, msg) {
msg.Echo("hello world")
msg.Dump(can)
}

6
src/shy/data.shy Normal file
View File

@ -0,0 +1,6 @@
#! yac.stack
func show(m) {
m.Echo("hello world")
}