ui

package
v1.223.1-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InitUI

type InitUI struct {
	// contains filtered or unexported fields
}

InitUI handles the user interface for the init command.

func NewInitUI

func NewInitUI(ioCtx iolib.Context, term terminal.Terminal) *InitUI

NewInitUI creates a new InitUI instance.

func (*InitUI) ConfirmUpdateInstead

func (ui *InitUI) ConfirmUpdateInstead(targetPath string) (bool, error)

ConfirmUpdateInstead prompts whether to update an existing, non-empty target directory via a 3-way merge instead of failing outright. Callers should only invoke this after confirming a real TTY is available for prompting.

func (*InitUI) DisplayScaffoldTemplateTable

func (ui *InitUI) DisplayScaffoldTemplateTable(templatesMap map[string]interface{})

DisplayScaffoldTemplateTable displays scaffold templates in a table format.

func (*InitUI) DisplayTemplateTable

func (ui *InitUI) DisplayTemplateTable(header []string, rows [][]string)

DisplayTemplateTable displays template data in a formatted table.

func (*InitUI) Execute

func (ui *InitUI) Execute(embedsConfig *tmpl.Configuration, targetPath string, force, update, useDefaults bool, cmdTemplateValues map[string]interface{}) error

Execute runs the initialization process with UI.

func (*InitUI) ExecuteWithBaseRef

func (ui *InitUI) ExecuteWithBaseRef(embedsConfig *tmpl.Configuration, targetPath string, force, update, useDefaults bool, baseRef string, cmdTemplateValues map[string]interface{}) error

ExecuteWithBaseRef runs the initialization process with UI and specified base ref.

func (*InitUI) ExecuteWithDelimiters

func (ui *InitUI) ExecuteWithDelimiters(embedsConfig *tmpl.Configuration, targetPath string, force, update, useDefaults bool, baseRef string, cmdTemplateValues map[string]interface{}, delimiters []string) error

ExecuteWithDelimiters runs the initialization process with UI and custom delimiters.

func (*InitUI) ExecuteWithInteractiveFlow

func (ui *InitUI) ExecuteWithInteractiveFlow(
	embedsConfig *tmpl.Configuration,
	targetPath string,
	force, update, useDefaults bool,
	cmdTemplateValues map[string]interface{},
) error

ExecuteWithInteractiveFlow provides a unified flow for both init and scaffold commands. This ensures both commands have identical behavior - the only difference is the source of templates.

func (*InitUI) ExecuteWithInteractiveFlowAndBaseRef

func (ui *InitUI) ExecuteWithInteractiveFlowAndBaseRef(
	embedsConfig *tmpl.Configuration,
	targetPath string,
	force, update, useDefaults bool,
	baseRef string,
	cmdTemplateValues map[string]interface{},
) error

ExecuteWithInteractiveFlowAndBaseRef provides a unified flow with base ref support.

func (*InitUI) ExecuteWithInteractiveFlowAndBaseRefResult

func (ui *InitUI) ExecuteWithInteractiveFlowAndBaseRefResult(
	embedsConfig *tmpl.Configuration,
	targetPath string,
	force, update, useDefaults bool,
	baseRef string,
	cmdTemplateValues map[string]interface{},
) (string, error)

ExecuteWithInteractiveFlowAndBaseRefResult provides the interactive flow with base ref support and returns the final target path.

func (*InitUI) ExecuteWithInteractiveFlowResult

func (ui *InitUI) ExecuteWithInteractiveFlowResult(
	embedsConfig *tmpl.Configuration,
	targetPath string,
	force, update, useDefaults bool,
	cmdTemplateValues map[string]interface{},
) (string, error)

ExecuteWithInteractiveFlowResult provides the same flow as ExecuteWithInteractiveFlow and returns the final target path selected by the user.

func (*InitUI) GetTerminalWidth

func (ui *InitUI) GetTerminalWidth() int

GetTerminalWidth returns the current terminal width with a fallback.

func (*InitUI) PromptForTargetDirectory

func (ui *InitUI) PromptForTargetDirectory(templateInfo interface{}, mergedValues map[string]interface{}) (string, error)

PromptForTargetDirectory prompts the user for the target directory with evaluated template values This works for both init and scaffold commands.

func (*InitUI) PromptForTemplate

func (ui *InitUI) PromptForTemplate(templateType string, templates interface{}) (string, error)

PromptForTemplate prompts the user to select a template from available options. This works for both init (embeds) and scaffold (local/remote) templates.

func (*InitUI) RunSetupForm

func (ui *InitUI) RunSetupForm(scaffoldConfig *config.ScaffoldConfig, targetPath string, useDefaults bool, cmdTemplateValues map[string]interface{}) (map[string]interface{}, map[string]string, error)

RunSetupForm runs the interactive setup form to collect configuration values This method can be used by both init and scaffold commands.

func (*InitUI) SetConflictStrategy

func (ui *InitUI) SetConflictStrategy(strategy merge.ConflictStrategy)

SetConflictStrategy sets how a real ours/theirs divergence is resolved during a 3-way merge (manual/ours/theirs). The zero value (merge.ConflictStrategyManual) is today's existing behavior.

func (*InitUI) SetDryRun

func (ui *InitUI) SetDryRun(dryRun bool)

SetDryRun toggles dry-run mode: rendering and 3-way merge still run (so real conflicts are reported), but no files are written to disk.

func (*InitUI) SetSkipHooks

func (ui *InitUI) SetSkipHooks(skip func(string) bool)

SetSkipHooks configures the --skip-hooks predicate (see hooks.NewSkipPredicate) consulted before running any scaffold hook. A nil predicate (the zero value) runs every hook, matching today's behavior for templates that don't set one.

func (*InitUI) SetThreshold

func (ui *InitUI) SetThreshold(thresholdPercent int)

SetThreshold sets the threshold for merge operations.

Jump to

Keyboard shortcuts

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