mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-25 08:48:06 +08:00
add yac.type
This commit is contained in:
parent
c3df162d11
commit
8f1a284feb
1
Makefile
1
Makefile
@ -6,6 +6,7 @@ binpack = src/binpack.go
|
|||||||
all: def
|
all: def
|
||||||
@date +"%Y-%m-%d %H:%M:%S"
|
@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} && ./${binarys} forever restart &>/dev/null
|
||||||
|
# go build -v -o ${binarys} src/main.go ${version} ${binpack}
|
||||||
|
|
||||||
app: def
|
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
|
CGO_ENABLED=1 go build -v -o ${publish}/contexts.app/Contents/MacOS/contexts src/webview.go ${version} ${binpack} && ./${binarys} forever restart &>/dev/null
|
||||||
|
96
src/back.shy
96
src/back.shy
@ -1,6 +1,102 @@
|
|||||||
#! yac.stack
|
#! 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) {
|
func list(m, arg, name) {
|
||||||
|
cli.system "pwd"
|
||||||
m.Copy(cli.system("pwd"))
|
m.Copy(cli.system("pwd"))
|
||||||
m.Cmdy("cli.system", "pwd")
|
m.Cmdy("cli.system", "pwd")
|
||||||
m.Cmdy(cli.SYSTEM, "pwd")
|
m.Cmdy(cli.SYSTEM, "pwd")
|
||||||
|
66
src/demo.shy
66
src/demo.shy
@ -1,49 +1,23 @@
|
|||||||
#! yac.stack
|
package tmux
|
||||||
|
|
||||||
func list(m, arg, name) {
|
import (
|
||||||
cli.system "pwd"
|
ice "shylinux.com/x/icebergs"
|
||||||
m.Copy(cli.system("pwd"))
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
m.Cmdy("cli.system", "pwd")
|
kit "shylinux.com/x/toolkits"
|
||||||
m.Cmdy(cli.SYSTEM, "pwd")
|
)
|
||||||
m.Cmdy(SYSTEM, "pwd")
|
|
||||||
|
|
||||||
m.Echo("%v", tcp.IsLocalHost(m, "127.0.0.1"))
|
func init() { m.DebugStack() }
|
||||||
|
|
||||||
defer func() { m.Echo("hello defer") }()
|
const TMUX = "tmux"
|
||||||
m.Push("h1", "hi").Push("h1", "he")
|
|
||||||
m.Table(func(value) { m.Echo(value["h1"]) })
|
var Index = &ice.Context{Name: TMUX, Help: "工作台", Commands: ice.Commands{
|
||||||
m.Cmdy("tcp.host")
|
TMUX: {Name: "tmux path auto start order build download", Help: "服务", Actions: ice.MergeActions(ice.Actions{
|
||||||
m.Action("list1", "list2", "list3")
|
cli.START: {Help: "启动", Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
}
|
}), Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
func inputs(m, key) {
|
}}
|
||||||
switch key {
|
|
||||||
case "name":
|
// func init() { code.Index.Register(Index, &web.Frame{}) }
|
||||||
m.Push(key, "hi")
|
func init() { m.DebugStack() }
|
||||||
default:
|
func init() { m.Echo(kit.Formats(Index)) }
|
||||||
m.Push(key, "good")
|
func init() { m.Echo(kit.Formats(Index.Name)) }
|
||||||
}
|
func init() { m.Echo(kit.Formats(Index.Commands[TMUX].Name)) }
|
||||||
}
|
|
||||||
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 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
8
src/script/web.chat.favor/list.shy
Normal file
8
src/script/web.chat.favor/list.shy
Normal 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()
|
||||||
|
}
|
4
src/script/web.chat.favor/onimport.shy
Normal file
4
src/script/web.chat.favor/onimport.shy
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
func _init(can, msg) {
|
||||||
|
msg.Echo("hello world")
|
||||||
|
msg.Dump(can)
|
||||||
|
}
|
6
src/shy/data.shy
Normal file
6
src/shy/data.shy
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#! yac.stack
|
||||||
|
|
||||||
|
func show(m) {
|
||||||
|
m.Echo("hello world")
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user