Documentation ¶
Overview ¶
Package input provides input parsing utilities for the Inertia CLI
Index ¶
- Variables
- func CatchSigterm(cancelFunc func())
- type PromptConfig
- type PromptInteraction
- func (p *PromptInteraction) GetBool() (bool, error)
- func (p *PromptInteraction) GetString() (string, error)
- func (p *PromptInteraction) Prompt(query ...interface{}) *PromptInteraction
- func (p *PromptInteraction) PromptFromList(optionName string, options []string) *PromptInteraction
- func (p *PromptInteraction) Promptf(query string, args ...interface{}) *PromptInteraction
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyInput is returned on empty imputs - toggle with AllowEmpty ErrEmptyInput = errors.New("empty input") // ErrInvalidInput is returned on disallowed inputs - toggle with AllowInvalid ErrInvalidInput = errors.New("invalid input") )
Functions ¶
func CatchSigterm ¶
func CatchSigterm(cancelFunc func())
CatchSigterm listens in the background for some kind of interrupt and calls the given cancelFunc as necessary
Types ¶
type PromptConfig ¶ added in v0.6.1
PromptConfig offers prompt configuration
type PromptInteraction ¶ added in v0.6.1
type PromptInteraction struct {
// contains filtered or unexported fields
}
PromptInteraction is a builder for interactions - use .PromptX followed by .GetX
func NewPrompt ¶ added in v0.6.1
func NewPrompt(conf *PromptConfig) *PromptInteraction
NewPrompt instantiates a new prompt interaction on standard in
func NewPromptOnInput ¶ added in v0.6.1
func NewPromptOnInput(in io.Reader, conf *PromptConfig) *PromptInteraction
NewPromptOnInput instantiates a new prompt on specified input
func (*PromptInteraction) GetBool ¶ added in v0.6.1
func (p *PromptInteraction) GetBool() (bool, error)
GetBool retrieves a boolean response based on "y" or "yes"
func (*PromptInteraction) GetString ¶ added in v0.6.1
func (p *PromptInteraction) GetString() (string, error)
GetString retreives the raw string response from the prompt
func (*PromptInteraction) Prompt ¶ added in v0.6.1
func (p *PromptInteraction) Prompt(query ...interface{}) *PromptInteraction
Prompt prints the given query and reads the response
func (*PromptInteraction) PromptFromList ¶ added in v0.6.1
func (p *PromptInteraction) PromptFromList(optionName string, options []string) *PromptInteraction
PromptFromList creates a choose-one-from-x prompt
func (*PromptInteraction) Promptf ¶ added in v0.6.1
func (p *PromptInteraction) Promptf(query string, args ...interface{}) *PromptInteraction
Promptf prints the given query and reads the response