Help us shape the future of Go! Take the 2026 Go Developer Survey

scaffold

package
v1.233.1 Latest Latest
Warning

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

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

Documentation

Overview

Package scaffold is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockScaffoldUI

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

MockScaffoldUI is a mock of ScaffoldUI interface.

func NewMockScaffoldUI

func NewMockScaffoldUI(ctrl *gomock.Controller) *MockScaffoldUI

NewMockScaffoldUI creates a new mock instance.

func (*MockScaffoldUI) ConfirmUpdateInstead

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

ConfirmUpdateInstead mocks base method.

func (*MockScaffoldUI) DisplayTemplateTable

func (m *MockScaffoldUI) DisplayTemplateTable(header []string, rows [][]string)

DisplayTemplateTable mocks base method.

func (*MockScaffoldUI) EXPECT

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

func (*MockScaffoldUI) ExecuteWithBaseRef

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

ExecuteWithBaseRef mocks base method.

func (*MockScaffoldUI) ExecuteWithInteractiveFlowAndBaseRefResult

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

ExecuteWithInteractiveFlowAndBaseRefResult mocks base method.

func (*MockScaffoldUI) PromptForTemplate

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

PromptForTemplate mocks base method.

func (*MockScaffoldUI) ResolveTargetPath added in v1.227.0

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

ResolveTargetPath mocks base method.

func (*MockScaffoldUI) SetConflictStrategy

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

SetConflictStrategy mocks base method.

func (*MockScaffoldUI) SetDryRun

func (m *MockScaffoldUI) SetDryRun(dryRun bool)

SetDryRun mocks base method.

func (*MockScaffoldUI) SetMaxChanges added in v1.231.0

func (m *MockScaffoldUI) SetMaxChanges(thresholdPercent int)

SetMaxChanges mocks base method.

func (*MockScaffoldUI) SetMergeDriver added in v1.226.0

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

SetMergeDriver mocks base method.

func (*MockScaffoldUI) SetRecreateDeleted added in v1.231.0

func (m *MockScaffoldUI) SetRecreateDeleted(recreate bool)

SetRecreateDeleted mocks base method.

func (*MockScaffoldUI) SetRenderedBaseSource added in v1.230.0

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

SetRenderedBaseSource mocks base method.

func (*MockScaffoldUI) SetSkipHooks

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

SetSkipHooks mocks base method.

func (*MockScaffoldUI) SetUpdateStrategy added in v1.230.0

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

SetUpdateStrategy mocks base method.

type MockScaffoldUIMockRecorder

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

MockScaffoldUIMockRecorder is the mock recorder for MockScaffoldUI.

func (*MockScaffoldUIMockRecorder) ConfirmUpdateInstead

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

ConfirmUpdateInstead indicates an expected call of ConfirmUpdateInstead.

func (*MockScaffoldUIMockRecorder) DisplayTemplateTable

func (mr *MockScaffoldUIMockRecorder) DisplayTemplateTable(header, rows any) *gomock.Call

DisplayTemplateTable indicates an expected call of DisplayTemplateTable.

func (*MockScaffoldUIMockRecorder) ExecuteWithBaseRef

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

ExecuteWithBaseRef indicates an expected call of ExecuteWithBaseRef.

func (*MockScaffoldUIMockRecorder) ExecuteWithInteractiveFlowAndBaseRefResult

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

ExecuteWithInteractiveFlowAndBaseRefResult indicates an expected call of ExecuteWithInteractiveFlowAndBaseRefResult.

func (*MockScaffoldUIMockRecorder) PromptForTemplate

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

PromptForTemplate indicates an expected call of PromptForTemplate.

func (*MockScaffoldUIMockRecorder) ResolveTargetPath added in v1.227.0

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

ResolveTargetPath indicates an expected call of ResolveTargetPath.

func (*MockScaffoldUIMockRecorder) SetConflictStrategy

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

SetConflictStrategy indicates an expected call of SetConflictStrategy.

func (*MockScaffoldUIMockRecorder) SetDryRun

func (mr *MockScaffoldUIMockRecorder) SetDryRun(dryRun any) *gomock.Call

SetDryRun indicates an expected call of SetDryRun.

func (*MockScaffoldUIMockRecorder) SetMaxChanges added in v1.231.0

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

SetMaxChanges indicates an expected call of SetMaxChanges.

func (*MockScaffoldUIMockRecorder) SetMergeDriver added in v1.226.0

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

SetMergeDriver indicates an expected call of SetMergeDriver.

func (*MockScaffoldUIMockRecorder) SetRecreateDeleted added in v1.231.0

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

SetRecreateDeleted indicates an expected call of SetRecreateDeleted.

func (*MockScaffoldUIMockRecorder) SetRenderedBaseSource added in v1.230.0

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

SetRenderedBaseSource indicates an expected call of SetRenderedBaseSource.

func (*MockScaffoldUIMockRecorder) SetSkipHooks

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

SetSkipHooks indicates an expected call of SetSkipHooks.

func (*MockScaffoldUIMockRecorder) SetUpdateStrategy added in v1.230.0

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

SetUpdateStrategy indicates an expected call of SetUpdateStrategy.

type ScaffoldCommandProvider

type ScaffoldCommandProvider struct{}

ScaffoldCommandProvider implements the CommandProvider interface.

func (*ScaffoldCommandProvider) GetAliases

func (s *ScaffoldCommandProvider) GetAliases() []internal.CommandAlias

GetAliases returns command aliases (none for scaffold).

func (*ScaffoldCommandProvider) GetCommand

func (s *ScaffoldCommandProvider) GetCommand() *cobra.Command

GetCommand returns the scaffold command.

func (*ScaffoldCommandProvider) GetCompatibilityFlags

func (s *ScaffoldCommandProvider) GetCompatibilityFlags() map[string]compat.CompatibilityFlag

GetCompatibilityFlags returns nil as this command doesn't need compatibility flags.

func (*ScaffoldCommandProvider) GetFlagsBuilder

func (s *ScaffoldCommandProvider) GetFlagsBuilder() flags.Builder

GetFlagsBuilder returns nil since the parent scaffold command has no flags. Flags (--force, --dry-run, --set) belong to the generate subcommand.

func (*ScaffoldCommandProvider) GetGroup

func (s *ScaffoldCommandProvider) GetGroup() string

GetGroup returns the command group for help organization.

func (*ScaffoldCommandProvider) GetName

func (s *ScaffoldCommandProvider) GetName() string

GetName returns the command name.

func (*ScaffoldCommandProvider) GetPositionalArgsBuilder

func (s *ScaffoldCommandProvider) GetPositionalArgsBuilder() *flags.PositionalArgsBuilder

GetPositionalArgsBuilder returns nil as this command doesn't use positional args builder.

func (*ScaffoldCommandProvider) IsExperimental

func (s *ScaffoldCommandProvider) IsExperimental() bool

IsExperimental returns whether this command is experimental. Scaffold ships as experimental while the template schema and update workflow mature; behavior may change between releases.

type ScaffoldUI

type ScaffoldUI 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 selects the merger used by scaffold updates (YAML-aware
	// auto-detection vs. forcing the line-oriented text merger).
	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)
	SetDryRun(dryRun 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)
	DisplayTemplateTable(header []string, rows [][]string)
	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 resolves (prompting interactively when targetPath is
	// "") the final target directory generation will use, without running
	// generation itself. Callers that need the real target directory before
	// resolving other per-target inputs (e.g. the --update base ref) can call
	// this first, then pass the result back as targetPath to one of the
	// Execute* methods to skip prompting a second time.
	ResolveTargetPath(embedsConfig *templates.Configuration, targetPath string, update, useDefaults bool, cmdTemplateValues map[string]interface{}) (string, map[string]interface{}, bool, error)
	ConfirmUpdateInstead(targetPath string) (bool, error)
}

ScaffoldUI is the subset of *generatorUI.InitUI's behavior the scaffold command depends on, extracted so tests can substitute a mock instead of driving the real interactive TUI (prompts, huh forms) end to end.

Jump to

Keyboard shortcuts

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