diff options
-rw-r--r-- | go/vaxis-test/.gitignore | 1 | ||||
-rw-r--r-- | go/vaxis-test/Makefile | 2 | ||||
-rw-r--r-- | go/vaxis-test/go.mod | 14 | ||||
-rw-r--r-- | go/vaxis-test/go.sum | 18 | ||||
-rw-r--r-- | go/vaxis-test/main.go | 24 |
5 files changed, 59 insertions, 0 deletions
diff --git a/go/vaxis-test/.gitignore b/go/vaxis-test/.gitignore new file mode 100644 index 0000000..f2808f6 --- /dev/null +++ b/go/vaxis-test/.gitignore @@ -0,0 +1 @@ +vaxis-test diff --git a/go/vaxis-test/Makefile b/go/vaxis-test/Makefile new file mode 100644 index 0000000..c3c81c0 --- /dev/null +++ b/go/vaxis-test/Makefile @@ -0,0 +1,2 @@ +vaxis-test: main.go + go build -o vaxis-test diff --git a/go/vaxis-test/go.mod b/go/vaxis-test/go.mod new file mode 100644 index 0000000..8786df1 --- /dev/null +++ b/go/vaxis-test/go.mod @@ -0,0 +1,14 @@ +module git.sr.ht/~runxiyu/proground/go/vaxis-test + +go 1.22.5 + +require ( + git.sr.ht/~rockorager/vaxis v0.10.3 // indirect + github.com/containerd/console v1.0.4 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/mattn/go-sixel v0.0.5 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + github.com/soniakeys/quant v1.0.0 // indirect + golang.org/x/image v0.19.0 // indirect + golang.org/x/sys v0.24.0 // indirect +) diff --git a/go/vaxis-test/go.sum b/go/vaxis-test/go.sum new file mode 100644 index 0000000..833cb3c --- /dev/null +++ b/go/vaxis-test/go.sum @@ -0,0 +1,18 @@ +git.sr.ht/~rockorager/vaxis v0.10.3 h1:r9oHYKPfItWh05SQE/UJ4wDrmWRY9MDJKtA9HEl5nBI= +git.sr.ht/~rockorager/vaxis v0.10.3/go.mod h1:h94aKek3frIV1hJbdXjqnBqaLkbWXvV+UxAsQHg9bns= +github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= +github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-sixel v0.0.5 h1:55w2FR5ncuhKhXrM5ly1eiqMQfZsnAHIpYNGZX03Cv8= +github.com/mattn/go-sixel v0.0.5/go.mod h1:h2Sss+DiUEHy0pUqcIB6PFXo5Cy8sTQEFr3a9/5ZLNw= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/soniakeys/quant v1.0.0 h1:N1um9ktjbkZVcywBVAAYpZYSHxEfJGzshHCxx/DaI0Y= +github.com/soniakeys/quant v1.0.0/go.mod h1:HI1k023QuVbD4H8i9YdfZP2munIHU4QpjsImz6Y6zds= +golang.org/x/image v0.19.0 h1:D9FX4QWkLfkeqaC62SonffIIuYdOk/UE2XKUBgRIBIQ= +golang.org/x/image v0.19.0/go.mod h1:y0zrRqlQRWQ5PXaYCOMLTW2fpsxZ8Qh9I/ohnInJEys= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= diff --git a/go/vaxis-test/main.go b/go/vaxis-test/main.go new file mode 100644 index 0000000..6cc9783 --- /dev/null +++ b/go/vaxis-test/main.go @@ -0,0 +1,24 @@ +package main + +import "git.sr.ht/~rockorager/vaxis" + +func main() { + vx, err := vaxis.New(vaxis.Options{}) + if err != nil { + panic(err) + } + defer vx.Close() + for ev := range vx.Events() { + switch ev := ev.(type) { + case vaxis.Key: + switch ev.String() { + case "Ctrl+c": + return + } + } + win := vx.Window() + win.Clear() + win.Print(vaxis.Segment{Text: "Hello, World!"}) + vx.Render() + } +} |