input

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package input provides input parsing utilities for the Inertia CLI

Index

Constants

This section is empty.

Variables

View Source
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

type PromptConfig struct {
	AllowEmpty   bool
	AllowInvalid bool
}

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

Jump to

Keyboard shortcuts

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