inputs

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectUserInputs

func CollectUserInputs(collector inputsCollector) error

func ParseCLIArgsInputs

func ParseCLIArgsInputs(collector inputsCollector, args []string) error

Parse CLI args that were passed to the templating system. Argse are parsed and those that have values are stored in the inputsCollector.

Types

type InputSpec

type InputSpec struct {
	ID   string `yaml:"id"`
	Text string `yaml:"text"`
	Type string `yaml:"type"`
}

type PromptResponse

type PromptResponse struct {
	InputSpec
	// Answer string
	Answer string
	// Has this been answered already?
	Answered bool
}

type Prompter

type Prompter interface {
	GetID() string
	Prompt() (PromptResponse, error)
	SetStringResponse(string) (PromptResponse, error)
}

Prompter is a user-input prompter capabale of storing user inputs as well as prompting for interactive user input

func FromSpec

func FromSpec(specs []InputSpec) []Prompter

func NewPrompt

func NewPrompt(spec InputSpec) Prompter

Create a new prompt based on spec.Type

Jump to

Keyboard shortcuts

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