input

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 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

	// Whether to silently accept default values for template inputs in the case
	// where prompting is disabled.
	AcceptDefaults bool

	// Ignore any values in the Inputs map that aren't valid template inputs,
	// rather than returning error.
	IgnoreUnknownInputs bool

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

	// This is only set in the case where this template is being rendered as
	// part of an upgrade operation, and contains the set of inputs that were
	// saved in the manifest from the previous render operation. They're
	// separate from the other inputs so they can be given lowest precedence.
	InputsFromManifest 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

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

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