initcmd

package
v1.231.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package initcmd is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Preflight added in v1.231.0

func Preflight(args []string) error

Preflight rejects occupied copy destinations using only arguments, environment, and local source metadata, before startup loads configuration or starts progress. Sources whose mode depends on configuration or a remote manifest are checked later.

func SetAtmosConfig added in v1.231.0

func SetAtmosConfig(config *schema.AtmosConfiguration)

SetAtmosConfig supplies the configuration already resolved after global flags and profiles are applied, avoiding another configuration load inside init.

func SetStartupProgress added in v1.231.0

func SetStartupProgress(progress Progress)

SetStartupProgress shares the invocation's progress indicator with project init. The caller owns its lifetime and clears it after command execution.

Types

type InitCommandProvider

type InitCommandProvider struct{}

InitCommandProvider implements the CommandProvider interface.

func (*InitCommandProvider) GetAliases

func (i *InitCommandProvider) GetAliases() []internal.CommandAlias

GetAliases returns command aliases for the init command.

func (*InitCommandProvider) GetCommand

func (i *InitCommandProvider) GetCommand() *cobra.Command

GetCommand returns the init command.

func (*InitCommandProvider) GetCompatibilityFlags

func (i *InitCommandProvider) GetCompatibilityFlags() map[string]compat.CompatibilityFlag

GetCompatibilityFlags returns compatibility flags for this command. Init command has no compatibility flags.

func (*InitCommandProvider) GetFlagsBuilder

func (i *InitCommandProvider) GetFlagsBuilder() flags.Builder

GetFlagsBuilder returns the flags builder for this command. Init command flags are defined in cobra directly.

func (*InitCommandProvider) GetGroup

func (i *InitCommandProvider) GetGroup() string

GetGroup returns the command group for help organization.

func (*InitCommandProvider) GetName

func (i *InitCommandProvider) GetName() string

GetName returns the command name.

func (*InitCommandProvider) GetPositionalArgsBuilder

func (i *InitCommandProvider) GetPositionalArgsBuilder() *flags.PositionalArgsBuilder

GetPositionalArgsBuilder returns the positional args builder for this command. Init command has no positional args builder.

func (*InitCommandProvider) IsExperimental

func (i *InitCommandProvider) IsExperimental() bool

IsExperimental returns whether this command is experimental. Init ships as experimental while the project-template catalog and update workflow mature; behavior may change between releases.

type InitUI added in v1.229.0

type InitUI interface {
	// SetMaxChanges sets the maximum percentage of changed lines allowed in a
	// 3-way merge before --update fails instead of applying it. Note:
	// engine.Processor.SetMaxChanges replaces the processor's merger wholesale,
	// so callers must call SetMaxChanges before SetConflictStrategy/SetMergeDriver
	// or those settings would be discarded.
	SetMaxChanges(thresholdPercent int)
	SetConflictStrategy(strategy merge.ConflictStrategy)
	SetMergeDriver(driver merge.Driver)
	// SetRecreateDeleted controls whether --update recreates a file the user
	// deleted but the template still generates (default false: the deletion
	// is left in place).
	SetRecreateDeleted(recreate bool)
	SetSkipHooks(skip func(string) bool)
	// SetUpdateStrategy selects where --update's 3-way merge base comes from
	// (engine.UpdateStrategyTracked, the default: the target's own git
	// history; engine.UpdateStrategyRendered: a pristine template
	// re-render, see SetRenderedBaseSource).
	SetUpdateStrategy(strategy engine.UpdateStrategy)
	// SetRenderedBaseSource supplies the pristine "old ref" template
	// configuration and its originally-recorded answers that
	// engine.UpdateStrategyRendered re-renders as the merge base.
	SetRenderedBaseSource(cfg *templates.Configuration, values map[string]interface{})
	PromptForTemplate(templateType string, templates interface{}) (string, error)
	ExecuteWithBaseRef(embedsConfig *templates.Configuration, targetPath string, force, update, useDefaults bool, baseRef string, cmdTemplateValues map[string]interface{}) error
	ExecuteWithInteractiveFlowAndBaseRefResult(embedsConfig *templates.Configuration, targetPath string, force, update, useDefaults bool, baseRef string, cmdTemplateValues map[string]interface{}) (string, error)
	ResolveTargetPath(embedsConfig *templates.Configuration, targetPath string, update, useDefaults bool, cmdTemplateValues map[string]interface{}) (string, map[string]interface{}, bool, error)
	ConfirmUpdateInstead(targetPath string) (bool, error)
}

InitUI is the subset of *generatorUI.InitUI's behavior the init command depends on, extracted so tests can substitute a mock instead of driving the real interactive TUI (prompts, huh forms) end to end. Mirrors cmd/scaffold's ScaffoldUI, which solves the same problem for the sibling command.

type MockInitUI added in v1.229.0

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

MockInitUI is a mock of InitUI interface.

func NewMockInitUI added in v1.229.0

func NewMockInitUI(ctrl *gomock.Controller) *MockInitUI

NewMockInitUI creates a new mock instance.

func (*MockInitUI) ConfirmUpdateInstead added in v1.229.0

func (m *MockInitUI) ConfirmUpdateInstead(targetPath string) (bool, error)

ConfirmUpdateInstead mocks base method.

func (*MockInitUI) EXPECT added in v1.229.0

func (m *MockInitUI) EXPECT() *MockInitUIMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockInitUI) ExecuteWithBaseRef added in v1.229.0

func (m *MockInitUI) ExecuteWithBaseRef(embedsConfig *templates.Configuration, targetPath string, force, update, useDefaults bool, baseRef string, cmdTemplateValues map[string]any) error

ExecuteWithBaseRef mocks base method.

func (*MockInitUI) ExecuteWithInteractiveFlowAndBaseRefResult added in v1.229.0

func (m *MockInitUI) ExecuteWithInteractiveFlowAndBaseRefResult(embedsConfig *templates.Configuration, targetPath string, force, update, useDefaults bool, baseRef string, cmdTemplateValues map[string]any) (string, error)

ExecuteWithInteractiveFlowAndBaseRefResult mocks base method.

func (*MockInitUI) PromptForTemplate added in v1.229.0

func (m *MockInitUI) PromptForTemplate(templateType string, arg1 any) (string, error)

PromptForTemplate mocks base method.

func (*MockInitUI) ResolveTargetPath added in v1.229.0

func (m *MockInitUI) ResolveTargetPath(embedsConfig *templates.Configuration, targetPath string, update, useDefaults bool, cmdTemplateValues map[string]any) (string, map[string]any, bool, error)

ResolveTargetPath mocks base method.

func (*MockInitUI) SetConflictStrategy added in v1.229.0

func (m *MockInitUI) SetConflictStrategy(strategy merge.ConflictStrategy)

SetConflictStrategy mocks base method.

func (*MockInitUI) SetMaxChanges added in v1.231.0

func (m *MockInitUI) SetMaxChanges(thresholdPercent int)

SetMaxChanges mocks base method.

func (*MockInitUI) SetMergeDriver added in v1.229.0

func (m *MockInitUI) SetMergeDriver(driver merge.Driver)

SetMergeDriver mocks base method.

func (*MockInitUI) SetRecreateDeleted added in v1.231.0

func (m *MockInitUI) SetRecreateDeleted(recreate bool)

SetRecreateDeleted mocks base method.

func (*MockInitUI) SetRenderedBaseSource added in v1.230.0

func (m *MockInitUI) SetRenderedBaseSource(cfg *templates.Configuration, values map[string]any)

SetRenderedBaseSource mocks base method.

func (*MockInitUI) SetSkipHooks added in v1.229.0

func (m *MockInitUI) SetSkipHooks(skip func(string) bool)

SetSkipHooks mocks base method.

func (*MockInitUI) SetUpdateStrategy added in v1.230.0

func (m *MockInitUI) SetUpdateStrategy(strategy engine.UpdateStrategy)

SetUpdateStrategy mocks base method.

type MockInitUIMockRecorder added in v1.229.0

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

MockInitUIMockRecorder is the mock recorder for MockInitUI.

func (*MockInitUIMockRecorder) ConfirmUpdateInstead added in v1.229.0

func (mr *MockInitUIMockRecorder) ConfirmUpdateInstead(targetPath any) *gomock.Call

ConfirmUpdateInstead indicates an expected call of ConfirmUpdateInstead.

func (*MockInitUIMockRecorder) ExecuteWithBaseRef added in v1.229.0

func (mr *MockInitUIMockRecorder) ExecuteWithBaseRef(embedsConfig, targetPath, force, update, useDefaults, baseRef, cmdTemplateValues any) *gomock.Call

ExecuteWithBaseRef indicates an expected call of ExecuteWithBaseRef.

func (*MockInitUIMockRecorder) ExecuteWithInteractiveFlowAndBaseRefResult added in v1.229.0

func (mr *MockInitUIMockRecorder) ExecuteWithInteractiveFlowAndBaseRefResult(embedsConfig, targetPath, force, update, useDefaults, baseRef, cmdTemplateValues any) *gomock.Call

ExecuteWithInteractiveFlowAndBaseRefResult indicates an expected call of ExecuteWithInteractiveFlowAndBaseRefResult.

func (*MockInitUIMockRecorder) PromptForTemplate added in v1.229.0

func (mr *MockInitUIMockRecorder) PromptForTemplate(templateType, arg1 any) *gomock.Call

PromptForTemplate indicates an expected call of PromptForTemplate.

func (*MockInitUIMockRecorder) ResolveTargetPath added in v1.229.0

func (mr *MockInitUIMockRecorder) ResolveTargetPath(embedsConfig, targetPath, update, useDefaults, cmdTemplateValues any) *gomock.Call

ResolveTargetPath indicates an expected call of ResolveTargetPath.

func (*MockInitUIMockRecorder) SetConflictStrategy added in v1.229.0

func (mr *MockInitUIMockRecorder) SetConflictStrategy(strategy any) *gomock.Call

SetConflictStrategy indicates an expected call of SetConflictStrategy.

func (*MockInitUIMockRecorder) SetMaxChanges added in v1.231.0

func (mr *MockInitUIMockRecorder) SetMaxChanges(thresholdPercent any) *gomock.Call

SetMaxChanges indicates an expected call of SetMaxChanges.

func (*MockInitUIMockRecorder) SetMergeDriver added in v1.229.0

func (mr *MockInitUIMockRecorder) SetMergeDriver(driver any) *gomock.Call

SetMergeDriver indicates an expected call of SetMergeDriver.

func (*MockInitUIMockRecorder) SetRecreateDeleted added in v1.231.0

func (mr *MockInitUIMockRecorder) SetRecreateDeleted(recreate any) *gomock.Call

SetRecreateDeleted indicates an expected call of SetRecreateDeleted.

func (*MockInitUIMockRecorder) SetRenderedBaseSource added in v1.230.0

func (mr *MockInitUIMockRecorder) SetRenderedBaseSource(cfg, values any) *gomock.Call

SetRenderedBaseSource indicates an expected call of SetRenderedBaseSource.

func (*MockInitUIMockRecorder) SetSkipHooks added in v1.229.0

func (mr *MockInitUIMockRecorder) SetSkipHooks(skip any) *gomock.Call

SetSkipHooks indicates an expected call of SetSkipHooks.

func (*MockInitUIMockRecorder) SetUpdateStrategy added in v1.230.0

func (mr *MockInitUIMockRecorder) SetUpdateStrategy(strategy any) *gomock.Call

SetUpdateStrategy indicates an expected call of SetUpdateStrategy.

type Progress added in v1.231.0

type Progress interface {
	Update(string)
	Stop()
}

Progress carries the startup indicator through initialization without starting another terminal renderer. Interactive scaffold prompts stop it before taking over.

Jump to

Keyboard shortcuts

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