clearer STDOUT interface

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-27 12:55:27 -06:00
parent 4445695b68
commit 267c941790
3 changed files with 24 additions and 16 deletions

6
go.mod
View File

@ -3,9 +3,9 @@ module go.wit.com/toolkits/nocui
go 1.21.4 go 1.21.4
require ( require (
go.wit.com/log v0.13.0 go.wit.com/log v0.13.18
go.wit.com/toolkits/tree v0.13.14 go.wit.com/toolkits/tree v0.13.18
go.wit.com/widget v1.1.8 go.wit.com/widget v1.1.9
) )
require go.wit.com/dev/davecgh/spew v1.1.4 // indirect require go.wit.com/dev/davecgh/spew v1.1.4 // indirect

12
go.sum
View File

@ -1,8 +1,8 @@
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek= go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA= go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
go.wit.com/log v0.13.0 h1:0vyW3mHwDww3wCsyGnmQuX2P4V7aBMoJgxCy0GfA20g= go.wit.com/log v0.13.18 h1:XJNaQWX+8m12p3mH+kYih3zNjb0kScZDFpJa4c2TvKE=
go.wit.com/log v0.13.0/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo= go.wit.com/log v0.13.18/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
go.wit.com/toolkits/tree v0.13.14 h1:Hy1tbgSL67rvlXkPCz65CDq03i2VeilL95gtOpkzOpo= go.wit.com/toolkits/tree v0.13.18 h1:oGoLNc1Ax9/sM9nrQQvutjbpDAyORA2q/9R2vXprw/0=
go.wit.com/toolkits/tree v0.13.14/go.mod h1:f9ihlbRaORRqgWiqOslfUbLkFRgIjBWY0nG0MidHC7g= go.wit.com/toolkits/tree v0.13.18/go.mod h1:rrcu2kaZH9gAy9DzEgAGNVI8hOB/BsoKaR03zRCcPW0=
go.wit.com/widget v1.1.8 h1:5cHcmfgwCyHjf02Af/9UMrbLhBR7Z/LFAjPuCx4dx5A= go.wit.com/widget v1.1.9 h1:iltjAL8UZu0YPfia8/qyfDx04BDxhj8rURcx0OHVBEc=
go.wit.com/widget v1.1.8/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ= go.wit.com/widget v1.1.9/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=

View File

@ -12,6 +12,19 @@ import (
"go.wit.com/widget" "go.wit.com/widget"
) )
func showOptions() {
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")
fmt.Println("")
fmt.Println("Enter the number of the widget to click:")
fmt.Print("Option: ")
}
func simpleStdin() { func simpleStdin() {
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
@ -41,13 +54,7 @@ func simpleStdin() {
case "d": case "d":
me.myTree.SendEnableDebugger() me.myTree.SendEnableDebugger()
case "": case "":
fmt.Println("") showOptions()
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: default:
i, _ := strconv.Atoi(s) i, _ := strconv.Atoi(s)
log.Log(NOW, "got input:", i) log.Log(NOW, "got input:", i)
@ -71,5 +78,6 @@ func simpleStdin() {
} }
} }
} }
showOptions()
} }
} }