Documentation
¶
Index ¶
- type InitUI
- func (ui *InitUI) ConfirmUpdateInstead(targetPath string) (bool, error)
- func (ui *InitUI) DisplayScaffoldTemplateTable(templatesMap map[string]interface{})
- func (ui *InitUI) DisplayTemplateTable(header []string, rows [][]string)
- func (ui *InitUI) Execute(embedsConfig *tmpl.Configuration, targetPath string, ...) error
- func (ui *InitUI) ExecuteWithBaseRef(embedsConfig *tmpl.Configuration, targetPath string, ...) error
- func (ui *InitUI) ExecuteWithDelimiters(embedsConfig *tmpl.Configuration, targetPath string, ...) error
- func (ui *InitUI) ExecuteWithInteractiveFlow(embedsConfig *tmpl.Configuration, targetPath string, ...) error
- func (ui *InitUI) ExecuteWithInteractiveFlowAndBaseRef(embedsConfig *tmpl.Configuration, targetPath string, ...) error
- func (ui *InitUI) ExecuteWithInteractiveFlowAndBaseRefResult(embedsConfig *tmpl.Configuration, targetPath string, ...) (string, error)
- func (ui *InitUI) ExecuteWithInteractiveFlowResult(embedsConfig *tmpl.Configuration, targetPath string, ...) (string, error)
- func (ui *InitUI) GetTerminalWidth() int
- func (ui *InitUI) PromptForTargetDirectory(templateInfo interface{}, mergedValues map[string]interface{}) (string, error)
- func (ui *InitUI) PromptForTemplate(templateType string, templates interface{}) (string, error)
- func (ui *InitUI) RunSetupForm(scaffoldConfig *config.ScaffoldConfig, targetPath string, useDefaults bool, ...) (map[string]interface{}, map[string]string, error)
- func (ui *InitUI) SetConflictStrategy(strategy merge.ConflictStrategy)
- func (ui *InitUI) SetDryRun(dryRun bool)
- func (ui *InitUI) SetSkipHooks(skip func(string) bool)
- func (ui *InitUI) SetThreshold(thresholdPercent int)
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 (*InitUI) ConfirmUpdateInstead ¶
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 ¶
DisplayScaffoldTemplateTable displays scaffold templates in a table format.
func (*InitUI) DisplayTemplateTable ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
SetThreshold sets the threshold for merge operations.