summaryrefslogtreecommitdiff
path: root/nocui/stdin.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-18 00:12:59 -0600
committerJeff Carr <[email protected]>2024-01-18 00:12:59 -0600
commit0674bd89b798f7512462402817c496e8a80ac3d4 (patch)
tree2d520204b18c5cb09481b461642cb183db8bf74a /nocui/stdin.go
parenta0baba0821441d9cf38f0b33fe12fb96925c6236 (diff)
move everything into seperate repos
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'nocui/stdin.go')
-rw-r--r--nocui/stdin.go74
1 files changed, 0 insertions, 74 deletions
diff --git a/nocui/stdin.go b/nocui/stdin.go
deleted file mode 100644
index 9b9f794..0000000
--- a/nocui/stdin.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package main
-
-import (
- "os"
- "fmt"
- "bufio"
- "runtime/debug"
- "strings"
- "strconv"
-
- "go.wit.com/log"
- "go.wit.com/lib/widget"
-)
-
-func simpleStdin() {
- defer func() {
- if r := recover(); r != nil {
- log.Warn("nocui YAHOOOO Recovered in simpleStdin()", r)
- log.Println("Recovered from panic:", r)
- log.Println("Stack trace:")
- debug.PrintStack()
- me.myTree.DoToolkitPanic()
- }
- }()
- scanner := bufio.NewScanner(os.Stdin)
- for scanner.Scan() {
- s := scanner.Text()
- s = strings.TrimSuffix(s, "\n")
- switch s {
- case "l":
- log.Log(NOW, "list widgets")
- me.treeRoot.ListWidgets()
- case "b":
- log.Log(NOW, "show buttons")
- me.treeRoot.ShowButtons()
- case "g":
- me.myTree.DoToolkitLoad("gocui")
- case "a":
- me.myTree.DoToolkitLoad("andlabs")
- case "d":
- me.myTree.DoEnableDebugger()
- case "":
- fmt.Println("")
- fmt.Println("Enter:")
- fmt.Println("'l': list all widgets")
- fmt.Println("'b': for buttons")
- fmt.Println("'g': load gocui plugin")
- fmt.Println("'a': load andlabs plugin")
- fmt.Println("'d': enable debugging")
- default:
- i, _ := strconv.Atoi(s)
- log.Log(NOW, "got input:", i)
- n := me.treeRoot.FindWidgetId(i)
- if (n != nil) {
- n.DumpWidget("found node")
- for i, s := range n.State.Strings {
- log.Warn("n.State.Strings =", i, s)
- }
- switch n.WidgetType {
- case widget.Root:
- log.Warn("this is the root widget")
- case widget.Dropdown:
- log.Warn("print out dropdown values here")
- case widget.Button:
- me.myTree.DoUserEvent(n)
- case widget.Checkbox:
- me.myTree.DoUserEvent(n)
- default:
- log.Warn("you haven't defined an event for", n.WidgetType)
- }
- }
- }
- }
-}