userprompt

package module
v0.0.0-...-6769dff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2020 License: MIT Imports: 6 Imported by: 1

README

UserPrompt

CircleCI Go Report Card GoDoc GitHub license

Examples:

package main

import (
    "fmt"
    "github.com/hunkeelin/userprompt"
)

func main() {
    userName, err := userprompt.UserPromptWithDefault("Enter username (default: foo)", "foo", false)
    if err != nil {
        panic(err)
    }
    fmt.Println(userName)
    pass, err := userprompt.UserPrompt("Enter Okta Password", true)
    if err != nil {
        panic(err)
    }
    fmt.Println(pass)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Input  io.Reader = os.Stdin
	Output io.Writer = os.Stdout
)

So tests can override

Functions

func UserPrompt

func UserPrompt(prompt string, sensitive bool) (string, error)

UserPrompt: Prompt for input and store it as variable.

func UserPromptWithDefault

func UserPromptWithDefault(prompt, defaultValue string, sensitive bool) (string, error)

UserPromptWithDefault: Prompt the user for input but if user don't put anything it will use default value

func UserPromptWithOutput

func UserPromptWithOutput(prompt string, sensitive bool, output io.Writer, defaultValue string) (string, error)

PromptPromptWithOutput: Prompt the user for input and gives the output

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL