input

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfirmDefaultAllow

func ConfirmDefaultAllow() bool

ConfirmDefaultAllow is a helper function to confirm with the user for a question. It will only return false if the user types "no". If the user types "quit" then the program will exit. This method does NOT offer a text prompt to the user. You must do that before calling this method. For example

	output.Println("Are you sure you want to do this? (YES/no)")
    if !input.ConfirmDefaultAllow() {
        return
    }
	output.Println("Doing the thing...")

The prompt can be whatever you want, but you should include the final `(YES/no)` part as if the user does not type anything it will default to "yes".

func ConfirmDefaultDeny

func ConfirmDefaultDeny() bool

ConfirmDefaultDeny is a helper function to confirm with the user for a question. It will only return true if the user types "yes". If the user types "quit" then the program will exit. This method does NOT offer a text prompt to the user. You must do that before calling this method. For example

	output.Println("Are you sure you want to do this? (yes/NO)")
    if !input.ConfirmDefaultDeny() {
        return
    }
	output.Println("Doing the thing...")

The prompt can be whatever you want, but you should include the final `(yes/NO)` part as if the user does not type anything it will default to "no".

func Get

func Get() string

Get is a helper function to get input from the user. If the user types "quit" then the program will exit.

Types

This section is empty.

Jump to

Keyboard shortcuts

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