Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoveHTML ¶
RemoveHTML in case a user input interface does not support HTML. This is used internally by an interface implementation.
Types ¶
type Choice ¶
type Choice struct { Text string // the text the user can input. Shortcut rune // leave zero for no shortcut. Default bool // set to true if it's the default option. }
Choice is a user input choice for use with Input.GetInput
type Interface ¶
type Interface interface {
GetInput(ctx context.Context, output string, choice ...Choice) (string, error)
}
Interface gets user input. GetInput's output string is what is presented to the user. The returned string is the user input. The output string can contain basic HTML tags and entities, which may be used or stripped. Waits until either the user inputs or the ctx is done.
type NotifyInput ¶
type NotifyInput struct { Summary string AppIcon string Category string SoundName string // contains filtered or unexported fields }
NotifyInput gets user input via dbus notifications.
func (*NotifyInput) GetInput ¶
func (input *NotifyInput) GetInput(ctx context.Context, output string, choices ...Choice) (string, error)
GetInput implements Input.
func (*NotifyInput) Supported ¶
func (input *NotifyInput) Supported() error
Supported returns nil on success if supported.
type TermInput ¶
type TermInput struct {
// contains filtered or unexported fields
}
TermInput reads input from the terminal.
func (*TermInput) GetInput ¶
func (input *TermInput) GetInput(ctx context.Context, output string, choices ...Choice) (string, error)
GetInput implements Input; Run must be called first. Instance thread safe when properly using Run. What the user inputs is not validated, it simply returns the first thing the user enters.