From e07cdfdfde2b8f374bef3cc78f8cc9048e50dd18 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Wed, 16 Oct 2024 23:08:50 +0300 Subject: [PATCH] Add example and building for example --- Makefile | 4 ++++ examples/test/main.go | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Makefile create mode 100644 examples/test/main.go diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..52883a4 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +def: test + +test: + go build -o ./bin/$@ ./examples/$@ diff --git a/examples/test/main.go b/examples/test/main.go new file mode 100644 index 0000000..760cf71 --- /dev/null +++ b/examples/test/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + + "git.qowevisa.me/Qowevisa/tuimenu/simple" +) + +func main() { + m := simple.CreateMenu( + simple.WithCustomTitle("My Custom Title"), + ) + nameName, err := m.AddCommand("0", "NameName", func(m *simple.Menu) error { + fmt.Printf("hello, world\n") + return nil + }) + if err != nil { + panic(err) + } + gr := nameName.AddGroupingCommand("gr1", "Some grouping") + gr.AddExecCommand("some1", "Some func that does funny stuff", func(m *simple.Menu) error { + fmt.Printf("Some funcy stuff\n") + return nil + }) + m.AddCommand("lalalla", "something", simple.EmptyAction) + m.Start() +}