trying_out_go/playground/playground.go

66 lines
1.6 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 My Solution":
averageMySolution()
case "Get the Average Head First Solution":
averageHeadFirstSolution()
case "Get the Average Variadic":
averageVariadic()
case "Slices":
slices()
case "Variadic Functions":
variadic()
case "Count Votes":
countVotes()
}
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 My Solution", nil, false, nil)
menu.Option("Get the Average Head First Solution", nil, false, nil)
menu.Option("Get the Average Variadic", nil, false, nil)
menu.Option("Slices", nil, false, nil)
menu.Option("Variadic Functions", nil, false, nil)
menu.Option("Count Votes", nil, false, nil)
err := menu.Run()
if err != nil {
log.Fatal(err)
}
}