Skip to content

mhabibi/go-prompt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

forked from segmentio/go-prompt

go-prompt

Terminal prompts for Go.

View the docs.

Example

package main

import "github.com/segmentio/go-prompt"

var langs = []string{
  "c",
  "c++",
  "lua",
  "go",
  "js",
  "ruby",
  "python",
}

func main() {
  i := prompt.Choose("What's your favorite language?", langs)
  println("picked: " + langs[i])
}
package main

import (
	"fmt"
	"os"

	"bufio"

	prompt "github.com/segmentio/go-prompt"
)

func main() {
	println("Getting Started!")
	scanner := bufio.NewScanner(os.Stdin)
	longLine := prompt.Stringln(scanner, "Enter a long senctence")
	singleWord := prompt.String("Single Word")
	fmt.Printf("\nHello \n long: %s \n short: %s\n", longLine, singleWord)
}

About

Go terminal prompts.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%