interactive

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IncomingRelationship

type IncomingRelationship struct {
	SourceID   string
	SourceName string
	Type       string
}

IncomingRelationship represents a relationship from another feature pointing to the target

type MockCall

type MockCall struct {
	Method string
	Args   []interface{}
}

MockCall records a method call for verification

type MockPrompter

type MockPrompter struct {
	// Function stubs for customizing behavior
	SelectFromSimilarFeaturesFunc func(query string, matches []search.Match) (*fogit.Feature, bool, error)
	SelectVersionIncrementFunc    func(currentVersion, versionFormat string) (fogit.VersionIncrement, error)
	ConfirmFunc                   func(message string) (bool, error)
	ConfirmDeletionFunc           func(feature *fogit.Feature, incomingRels []IncomingRelationship) (bool, error)
	ReadLineFunc                  func(prompt string) (string, error)
	SelectFeatureFunc             func(features []*fogit.Feature, title string) (*fogit.Feature, error)
	InputTextFunc                 func(title, defaultValue string) (string, error)

	// Call tracking
	Calls []MockCall
}

MockPrompter is a mock implementation of Prompter for testing

func NewMockPrompter

func NewMockPrompter() *MockPrompter

NewMockPrompter creates a new mock prompter with default behaviors

func (*MockPrompter) Confirm

func (m *MockPrompter) Confirm(message string) (bool, error)

Confirm implements Prompter

func (*MockPrompter) ConfirmDeletion

func (m *MockPrompter) ConfirmDeletion(feature *fogit.Feature, incomingRels []IncomingRelationship) (bool, error)

ConfirmDeletion implements Prompter

func (*MockPrompter) GetCallCount

func (m *MockPrompter) GetCallCount(method string) int

GetCallCount returns the number of times a method was called

func (*MockPrompter) InputText

func (m *MockPrompter) InputText(title, defaultValue string) (string, error)

InputText implements Prompter

func (*MockPrompter) ReadLine

func (m *MockPrompter) ReadLine(prompt string) (string, error)

ReadLine implements Prompter

func (*MockPrompter) Reset

func (m *MockPrompter) Reset()

Reset clears all recorded calls

func (*MockPrompter) SelectFeature

func (m *MockPrompter) SelectFeature(features []*fogit.Feature, title string) (*fogit.Feature, error)

SelectFeature implements Prompter

func (*MockPrompter) SelectFromSimilarFeatures

func (m *MockPrompter) SelectFromSimilarFeatures(query string, matches []search.Match) (*fogit.Feature, bool, error)

SelectFromSimilarFeatures implements Prompter

func (*MockPrompter) SelectVersionIncrement

func (m *MockPrompter) SelectVersionIncrement(currentVersion, versionFormat string) (fogit.VersionIncrement, error)

SelectVersionIncrement implements Prompter

func (*MockPrompter) WasCalled

func (m *MockPrompter) WasCalled(method string) bool

WasCalled returns true if the method was called at least once

type Prompter

type Prompter interface {
	SelectFromSimilarFeatures(query string, matches []search.Match) (*fogit.Feature, bool, error)
	SelectVersionIncrement(currentVersion, versionFormat string) (fogit.VersionIncrement, error)
	Confirm(message string) (bool, error)
	ConfirmDeletion(feature *fogit.Feature, incomingRels []IncomingRelationship) (bool, error)
	ReadLine(prompt string) (string, error)
}

Prompter defines the interface for user interaction

type StdPrompter

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

StdPrompter implements Prompter using standard input/output

func NewPrompter

func NewPrompter() *StdPrompter

NewPrompter creates a new StdPrompter

func (*StdPrompter) Confirm

func (p *StdPrompter) Confirm(message string) (bool, error)

Confirm shows a yes/no confirmation prompt

func (*StdPrompter) ConfirmDeletion

func (p *StdPrompter) ConfirmDeletion(feature *fogit.Feature, incomingRels []IncomingRelationship) (bool, error)

ConfirmDeletion shows a deletion confirmation with feature details

func (*StdPrompter) InputText

func (p *StdPrompter) InputText(title, defaultValue string) (string, error)

InputText prompts for text input

func (*StdPrompter) ReadLine

func (p *StdPrompter) ReadLine(prompt string) (string, error)

ReadLine reads a single line from stdin with a prompt

func (*StdPrompter) SelectFeature

func (p *StdPrompter) SelectFeature(features []*fogit.Feature, title string) (*fogit.Feature, error)

SelectFeature prompts user to select a feature from a list

func (*StdPrompter) SelectFromSimilarFeatures

func (p *StdPrompter) SelectFromSimilarFeatures(query string, matches []search.Match) (*fogit.Feature, bool, error)

SelectFromSimilarFeatures prompts user to select from similar features or create new Returns: selected feature (if any), createNew flag, error

func (*StdPrompter) SelectVersionIncrement

func (p *StdPrompter) SelectVersionIncrement(currentVersion, versionFormat string) (fogit.VersionIncrement, error)

SelectVersionIncrement prompts user for version increment type

Jump to

Keyboard shortcuts

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