51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"log"
|
||
|
|
||
|
"github.com/dixonwille/wmenu/v5"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
menu := wmenu.NewMenu("Choose a program.")
|
||
|
menu.Action(func(opts []wmenu.Opt) error {
|
||
|
fmt.Printf("You chose " + opts[0].Text + ". Launching...\n")
|
||
|
switch opts[0].Text {
|
||
|
case "Pass or Fail":
|
||
|
passFail()
|
||
|
case "Guessing Game":
|
||
|
guess()
|
||
|
case "Shopping List":
|
||
|
shopping()
|
||
|
case "Commandline Test":
|
||
|
terminalTest()
|
||
|
case "Wall Area":
|
||
|
wallArea()
|
||
|
case "myIntPointer":
|
||
|
myIntPointer()
|
||
|
case "Double":
|
||
|
double()
|
||
|
case "Convert To Celsius":
|
||
|
toCelsius()
|
||
|
case "Get the Average":
|
||
|
average()
|
||
|
}
|
||
|
return nil
|
||
|
})
|
||
|
menu.PadOptionID()
|
||
|
menu.Option("Pass or Fail", nil, false, nil)
|
||
|
menu.Option("Guessing Game", nil, false, nil)
|
||
|
menu.Option("Shopping List", nil, false, nil)
|
||
|
menu.Option("Commandline Test", nil, false, nil)
|
||
|
menu.Option("Wall Area", nil, false, nil)
|
||
|
menu.Option("myIntPointer", nil, false, nil)
|
||
|
menu.Option("Double", nil, false, nil)
|
||
|
menu.Option("Convert To Celsius", nil, false, nil)
|
||
|
menu.Option("Get the Average", nil, false, nil)
|
||
|
err := menu.Run()
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
}
|