Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Render ¶
Render does the full sequence of steps involved in rendering a template. It downloads the template, parses the spec file, read template inputs, conditionally prompts the user for missing inputs, runs all the template actions, commits the output to the destination, and more.
This is a library function because template rendering is a reusable operation that is called as a subroutine by "golden-test" and "upgrade" commands.
Types ¶
type Params ¶
type Params struct { // BackupDir is the directory where overwritten files will be backed up. // BackupDir is ignored if Backups is false. BackupDir string Backups bool // If len(OverrideBuiltinVars)>0, then these values replace the normal // undercore-prefixed vars (_git_tag, All map keys must begin with // underscore. OverrideBuiltinVars map[string]string // Fakeable time for testing. Clock clock.Clock // The fakeable working directory for testing. Cwd string // The value of --debug-scratch-contents. DebugScratchContents bool // The value of --debug-step-diffs. DebugStepDiffs bool // The value of --dest. DestDir string // The downloader that will provide the template. Downloader templatesource.Downloader // The value of --force-overwrite. ForceOverwrite bool // A fakeable filesystem for error injection in tests. FS common.FS // The value of --git-protocol. GitProtocol string // The value of --input-files. InputFiles []string // The value of --input, or another source of input values (e.g. the golden // test test.yaml). Inputs map[string]string // The value of --keep-temp-dirs. KeepTempDirs bool // The value of --manifest. Manifest bool // Whether to prompt the user for inputs on stdin in the case where they're // not all provided in Inputs or InputFiles. Prompt bool // If Prompt is true, Prompter will be used if needed to ask the user for // any missing inputs. If Prompt is false, this is ignored. Prompter input.Prompter // The value of --skip-input-validation. 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 location from which the template is installed, as provided by the // user on the command line, or from the manifest. This is only used in // log messages and for the _flag_source variable in print actions. SourceForMessages string // The output stream used by "print" actions. Stdout io.Writer // The directory under which to create temp directories. Normally empty, // except in testing. TempDirBase string }
Params contains the arguments to Render().
Click to show internal directories.
Click to hide internal directories.