Documentation
¶
Overview ¶
Package input provides user input handling and validation functionality
Index ¶
- func AskForDistributionName() (string, error)
- func AskForDistributionNameWithDefault(defaultValue string) (string, error)
- func AskForTextInput(prompt, placeholder, defaultValue string) (string, error)
- func AskForTextInputWithDescription(prompt, description, placeholder, defaultValue string) (string, error)
- func AskForYesNo(question string, currentAnswer bool) (bool, error)
- func AskForYesNoWithDescription(question, description string, currentAnswer bool) (bool, error)
- func CreateMembersConfig(names []string) *config.MembersConfig
- func DisplayMemberSummary(names []string)
- func DisplayWelcomeMessage()
- func GenerateMembersConfig(options Options) (*config.MembersConfig, error)
- func GetExistingDistributions() ([]string, error)
- func LoadExistingConfiguration() (config2.OriginConfig, error)
- func ProcessMembersFromCSV(file *os.File) ([]string, error)
- func ProcessMembersFromFile(filename string) ([]string, error)
- func ProcessMembersFromReader(scanner *bufio.Scanner) ([]string, error)
- func ProcessMembersFromStdin() ([]string, error)
- func ProcessMembersInput(input string) []string
- func RunInteractiveInput() ([]string, error)
- func RunInteractiveInputWithInitial(initialMembers []string) ([]string, error)
- func SaveMembersConfig(membersConfig *config.MembersConfig, options Options) (string, error)
- type Error
- func NewDirectoryCreateError(err error) *Error
- func NewError(errorType ErrorType, message string, err error) *Error
- func NewFileInputFailedError(err error) *Error
- func NewFileOpenError(err error) *Error
- func NewInputReadError(err error) *Error
- func NewInteractiveInputFailedError(err error) *Error
- func NewMembersConfigSaveError(err error) *Error
- func NewMembersFilePathCreateError(err error) *Error
- func NewMembersPathResolveError(err error) *Error
- func NewNoMemberNamesError() *Error
- func NewProgramRunError(err error) *Error
- func NewStdinInputFailedError(err error) *Error
- func NewUnexpectedModelTypeError(modelTypeName string) *Error
- func NewUnknownMethodError(method Method) *Error
- func NewUserCancelledError() *Error
- type ErrorType
- type ListItemType
- type ListModel
- type Match
- type MatchType
- type MemberInfo
- type Method
- type Model
- type Options
- type Project
- type SearchItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AskForDistributionName ¶
AskForDistributionName prompts the user to enter a distribution name with a default suggestion.
func AskForDistributionNameWithDefault ¶
AskForDistributionNameWithDefault prompts the user to enter a distribution name with a default value.
func AskForTextInput ¶
AskForTextInput prompts the user for text input with the given prompt, placeholder, and default value.
func AskForTextInputWithDescription ¶
func AskForTextInputWithDescription(prompt, description, placeholder, defaultValue string) (string, error)
AskForTextInputWithDescription prompts the user for text input with explanatory copy.
func AskForYesNo ¶
AskForYesNo prompts the user with a yes/no question and returns their answer.
func AskForYesNoWithDescription ¶
AskForYesNoWithDescription prompts the user with a yes/no question plus explanatory copy.
func CreateMembersConfig ¶
func CreateMembersConfig(names []string) *config.MembersConfig
CreateMembersConfig creates a MembersConfig from a list of member names
func DisplayMemberSummary ¶
func DisplayMemberSummary(names []string)
DisplayMemberSummary displays a summary of the members entered
func DisplayWelcomeMessage ¶
func DisplayWelcomeMessage()
DisplayWelcomeMessage displays the welcome message for the initialization process
func GenerateMembersConfig ¶
func GenerateMembersConfig(options Options) (*config.MembersConfig, error)
GenerateMembersConfig generates a MembersConfig based on the provided options
func GetExistingDistributions ¶
GetExistingDistributions returns a list of existing distribution directories
func LoadExistingConfiguration ¶
func LoadExistingConfiguration() (config2.OriginConfig, error)
LoadExistingConfiguration loads the existing configuration from the default location
func ProcessMembersFromCSV ¶
ProcessMembersFromCSV reads member names from a CSV file Expects CSV format: username,email,name,password,id Returns the username column (first column) for each row, skipping the header
func ProcessMembersFromFile ¶
ProcessMembersFromFile reads member names from a file
func ProcessMembersFromReader ¶
ProcessMembersFromReader reads member names from a scanner
func ProcessMembersFromStdin ¶
ProcessMembersFromStdin reads member names from standard input
func ProcessMembersInput ¶
ProcessMembersInput processes the raw text input and extracts member names
func RunInteractiveInput ¶
RunInteractiveInput starts an interactive session for member input
func RunInteractiveInputWithInitial ¶
RunInteractiveInputWithInitial starts an interactive session for member input and preloads existing member names into the editor.
func SaveMembersConfig ¶
func SaveMembersConfig(membersConfig *config.MembersConfig, options Options) (string, error)
SaveMembersConfig saves the members configuration to a file
Types ¶
type Error ¶
type Error struct {
apperror.Carrier
ErrorType ErrorType
Message string
Err error // Wrapped error
}
Error represents a specific error in the input package
func NewDirectoryCreateError ¶
NewDirectoryCreateError creates an error for directory creation failures.
func NewFileInputFailedError ¶
NewFileInputFailedError creates an error for file input failures.
func NewFileOpenError ¶
NewFileOpenError creates an error for file open failures.
func NewInputReadError ¶
NewInputReadError creates an error for input read failures.
func NewInteractiveInputFailedError ¶
NewInteractiveInputFailedError creates an error for interactive input failures.
func NewMembersConfigSaveError ¶
NewMembersConfigSaveError creates an error for members config save failures.
func NewMembersFilePathCreateError ¶
NewMembersFilePathCreateError creates an error for members file path creation failures.
func NewMembersPathResolveError ¶
NewMembersPathResolveError creates an error for members path resolution failures.
func NewNoMemberNamesError ¶
func NewNoMemberNamesError() *Error
NewNoMemberNamesError creates an error for missing member names.
func NewProgramRunError ¶
NewProgramRunError creates an error for program run failures.
func NewStdinInputFailedError ¶
NewStdinInputFailedError creates an error for stdin input failures.
func NewUnexpectedModelTypeError ¶
NewUnexpectedModelTypeError creates an error for unexpected model type.
func NewUnknownMethodError ¶
NewUnknownMethodError creates an error for unknown input method.
func NewUserCancelledError ¶
func NewUserCancelledError() *Error
NewUserCancelledError creates an error for user cancellation.
type ErrorType ¶
type ErrorType int
ErrorType defines domain-based error categories for the input package. Consolidated from 14+ specific types to 4 semantic domains.
type ListItemType ¶
type ListItemType int
ListItemType represents the type of item in the search results list.
const ( // ItemTypeProjectDistro represents a project or distribution item. ItemTypeProjectDistro ListItemType = iota // ItemTypeUser represents a user item. ItemTypeUser )
type ListModel ¶
type ListModel struct {
// contains filtered or unexported fields
}
ListModel represents the BubbleTea model for interactive search
func NewInteractiveModel ¶
func NewInteractiveModel(projects []Project, getMembersFunc func(projectPath string, distributionName string) ([]MemberInfo, error)) ListModel
NewInteractiveModel creates a new interactive search model
func (ListModel) Selected ¶
func (m ListModel) Selected() (SearchItem, bool)
Selected returns the currently selected item and true, or false when none
func (ListModel) SelectedPath ¶
SelectedPath returns the selected project path
type Match ¶
type Match struct {
Type MatchType
Distribution string // The distribution that was matched OR the one the user was found in.
UserName string // If a user name matched
UserUUID string // If a user matched
SearchTerm string // The specific search term that caused this match.
}
Match stores details about what part of a project matched a search query.
type MemberInfo ¶
MemberInfo represents member information for a project distribution
type Method ¶
type Method int
Method represents a method for inputting member names
func DetermineMethod ¶
DetermineMethod determines the input method based on stdin and file flags
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model represents the UI model for member name input
type Options ¶
type Options struct {
// Method is the input method to use
Method Method
// FilePath is the path to the input file (for FileInput)
FilePath string
// DivekitHome is the path to the divekit home directory
DivekitHome string
// DistributionName is the name of the current distribution
DistributionName string
// Target is the target being processed
Target string
}
Options contains options for member input
type Project ¶
type Project struct {
Path string
Name string
Distributions []string
Matches []Match // To store specific info about why this project was matched.
}
Project represents a single Divekit project with its details for display. This is different from index.Project, which is for storage.
type SearchItem ¶
type SearchItem struct {
ItemType ListItemType
Project Project
Distribution string
UserName string
GroupUUID string
}
SearchItem is a list.Item implementation for our interactive list.
func (SearchItem) Description ¶
func (s SearchItem) Description() string
Description returns the description text for this search item.
func (SearchItem) FilterValue ¶
func (s SearchItem) FilterValue() string
FilterValue returns the string value used for filtering/searching this item.
func (SearchItem) Title ¶
func (s SearchItem) Title() string
Title returns the display title for this search item.