Skip to content

aisk/wizard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

wizard

Command line wizard helper in go.

Install

go get -u github.com/aisk/wizard

Example

package main

import (
	"fmt"
	"github.com/aisk/wizard"
)

func main() {
	username := ""
	password := ""
	loginNextTime := false
	questions := []wizard.Question{
		{
			Content: "PLease input your user name:",
			Input: &wizard.Input{
				Result: &username,
			},
		},
		{
			Content: "Please input your password:",
			Input: &wizard.Input{
				Result: &password,
				Hidden: true,
			},
		},
		{
			Content: "Login next time?",
			Answers: []wizard.Answer{
				{
					Content: "yes",
					Handler: func() {
						loginNextTime = true
					},
				},
				{
					Content: "no",
					Handler: func() {
						loginNextTime = false
					},
				},
			},
		},
	}
	wizard.Ask(questions)
	fmt.Println("Your username is", username)
	fmt.Println("Your password is", password)
	fmt.Println("Login next time is", loginNextTime)
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages