input

package
v0.6.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resolve

func Resolve(ctx context.Context, rp *ResolveParams) (map[string]string, error)

Resolve combines flags, user prompts, and defaults to get the full set of template inputs.

Types

type Prompter

type Prompter interface {
	Prompt(ctx context.Context, msg string, args ...any) (string, error)
	Stdin() io.Reader
}

Prompter prints messages to the user asking them to enter a value. This is implemented by *cli.Command.

type ResolveParams

type ResolveParams struct {
	FS common.FS

	// The template spec.yaml model.
	Spec *spec.Spec

	// The value of --input. Template input values.
	Inputs map[string]string

	// The value of --input-file. A list of YAML filenames defining template inputs.
	InputFiles []string

	// Prompt is the value of --prompt, it enables or disables the prompting feature.
	Prompt bool

	// Prompter is used to print prompts to the user requesting them to enter
	// input.
	Prompter            Prompter
	SkipInputValidation bool

	// Normally, we'll only prompt if the input is a TTY. For testing, this
	// can be set to true to bypass the check and allow stdin to be something
	// other than a TTY, like an os.Pipe.
	SkipPromptTTYCheck bool
}

ResolveParams are the parameters to Resolve(), wrapped in a struct because there are so many.

Jump to

Keyboard shortcuts

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