From ec4270c43f1ddd37d1eb19da5db78129b93f72b7 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Thu, 4 May 2017 22:36:53 +0200 Subject: add "cli" package with a Query method --- main.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 72768ea..3633b0e 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,7 @@ import ( "os" "path/filepath" + "github.com/majewsky/gofu/pkg/cli" "github.com/majewsky/gofu/pkg/rtree" ) @@ -44,5 +45,12 @@ func execApplet(applet string, args []string, allowGofu bool) { switch applet { case "rtree": rtree.Exec(args) + case "test": + choice, _ := cli.Query("Which is the best editor?", + cli.Choice{Shortcut: 'v', Text: "vim"}, + cli.Choice{Shortcut: 'e', Text: "emacs"}, + cli.Choice{Text: "atom"}, + ) + fmt.Printf("You selected %s. Good choice!\n", choice.Text) } } -- cgit v1.3.1