GNU/Linux ◆ xterm-256color ◆ bash 8332 views

Code used (test.go):

package main

import (

"fmt"
"log"

wlog "gopkg.in/dixonwille/wlog.v2"

"github.com/daviddengcn/go-colortext"
"github.com/dixonwille/wmenu"

)

func main() {

menu := wmenu.NewMenu("What is your favorite food?")
menu.AddColor(wlog.Color{Code: ct.Green}, wlog.Color{Code: ct.Yellow}, wlog.Color{Code: ct.Magenta}, wlog.Color{Code: ct.Yellow})
menu.Action(func(opts []wmenu.Opt) error {
    fmt.Println(opts[0].Text + " is your favorite food.")
    return nil
})
menu.Option("Pizza", nil, true, nil)
menu.Option("Ice Cream", nil, false, nil)
menu.Option("Tacos", nil, false, func(o wmenu.Opt) error {
    fmt.Println("Tacos are great")
    return nil
})
err := menu.Run()
if err != nil {
    log.Fatal(err)
}

}

More by jojomi

gonsole 00:23

by jojomi

paulrademacher/climenu 00:30

by jojomi

See all