Documentation ¶
Overview ¶
Example (Printf) ¶
SetWriter(os.Stdout) defer SetWriter(os.Stderr) Printf("hello")
Output: hello
Example (Printlf) ¶
SetWriter(os.Stdout) defer SetWriter(os.Stderr) Printlf(DEBUG, "debug mode is off") SetDebugMode(true) Printlf(DEBUG, "debug mode is on")
Output: [DEBUG] debug mode is on
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Print ¶ added in v0.0.2
func Print(str string)
Print prints the given string on the terminals to user.
func Printf ¶
func Printf(str string, objs ...interface{})
Printf prints formatted strings on the terminals to user.
func Printlf ¶
Printlf prints formatted strings with a message level prefix on the terminals to user.
func SetDebugMode ¶
func SetDebugMode(debugMode bool)
SetDebugMode set the debug mode. Debug level message sent to user only when debug mode is on.
Types ¶
type Level ¶
type Level uint
Level defines the log level of the message that is printed to the user. Debug level messages are printed to the user only when debug mode is on.
type Prompter ¶
type Prompter struct {
// contains filtered or unexported fields
}
Prompter contains the logic to interact with users.
func (*Prompter) Prompt ¶
Prompt prompts message to users.
Example ¶
// Disable parallel because we temporarily redirect the writer. SetWriter(os.Stdout) defer SetWriter(os.Stderr) p := NewPrompter() p.Prompt("hello")
Output: >>> hello
func (*Prompter) Promptf ¶
Promptf prompts message to users.
Example ¶
// Disable parallel because we temporarily redirect the writer. SetWriter(os.Stdout) defer SetWriter(os.Stderr) p := NewPrompter() p.Promptf("%s\n %s", "some", "message")
Output: >>> some message
func (*Prompter) ReadString ¶
ReadString reads input string from users.
Click to show internal directories.
Click to hide internal directories.