ask

package module
v0.0.0-...-ab3df2b Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2014 License: BSD-2-Clause Imports: 2 Imported by: 0

README

go.ask

Package ask asks the user a question on the commandline and returns the result.

Package documentation at godoc: godoc.org/github.com/GeertJohan/go.ask

Documentation

Overview

Package ask helps with writing simple yes/no cli-based questions. There are several methods, following these rules

Methods starting with "Must" do not return an error. Instead they panic if an error occurs (pty not available? closed stdin/stdout?).

Methods containing "Default" have an extra argument (placed first), which is returned when the user simply hits [enter].

When user replies with "y", "Y" or "yes", true is returned When user replies with "n", "N" or "no", false is returned

Methods with a trailing "f" wrap fmt.Sprintf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ask

func Ask(question string) (bool, error)

func Askf

func Askf(questionFormat string, a ...interface{}) (bool, error)

func DefaultAsk

func DefaultAsk(def bool, question string) (bool, error)

func DefaultAskf

func DefaultAskf(def bool, questionFormat string, a ...interface{}) (bool, error)

func MustAsk

func MustAsk(question string) bool

func MustAskf

func MustAskf(questionFormat string, a ...interface{}) bool

func MustDefaultAsk

func MustDefaultAsk(def bool, question string) bool

func MustDefaultAskf

func MustDefaultAskf(def bool, questionFormat string, a ...interface{}) bool

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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