Documentation
¶
Index ¶
- func AddAppToGroup(groupName string, appName string) error
- func AddCustomGroup(name string, tools []string) error
- func AddInstalledApp(appName string) error
- func CheckEnvironmentConfigurations() []string
- func CreateDirectories() error
- func GenerateDefaultSettings() error
- func GenerateDefaultSettingsWithVersion(version string) error
- func GetAnvilConfigDirectory() string
- func GetAnvilConfigPath() string
- func GetAppConfigPath(appName string) (string, bool, error)
- func GetAvailableGroups() (map[string][]string, error)
- func GetBuiltInGroups() []string
- func GetConfiguredApps() ([]string, error)
- func GetGroupTools(groupName string) ([]string, error)
- func GetInstalledApps() ([]string, error)
- func GetTempAppPath(appName string) (string, bool, error)
- func IsAppTracked(appName string) (bool, error)
- func IsBuiltInGroup(groupName string) bool
- func PopulateGitConfigFromSystem(gitConfig *GitConfig) error
- func RemoveInstalledApp(appName string) error
- func SaveConfig(config *AnvilConfig) error
- func SetAppConfigPath(appName, configPath string) error
- func UpdateGroupTools(groupName string, tools []string) error
- func ValidateAndFixGitHubConfig(config *AnvilConfig) bool
- func ValidateFileAccess(filePath string) error
- type AnvilConfig
- type AnvilGroups
- type AnvilTools
- type ConfigValidator
- type GitConfig
- type GitHubConfig
- type LocationSource
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAppToGroup ¶
AddAppToGroup adds an app to a group, creating the group if it doesn't exist
func AddCustomGroup ¶
AddCustomGroup adds a new custom group
func AddInstalledApp ¶
AddInstalledApp adds an app to the installed apps list if it's not already there
func CheckEnvironmentConfigurations ¶
func CheckEnvironmentConfigurations() []string
CheckEnvironmentConfigurations checks local environment configurations
func CreateDirectories ¶
func CreateDirectories() error
CreateDirectories creates necessary directories for anvil
func GenerateDefaultSettings ¶
func GenerateDefaultSettings() error
GenerateDefaultSettings generates the default settings.yaml file
func GenerateDefaultSettingsWithVersion ¶
GenerateDefaultSettingsWithVersion generates the default settings.yaml file with a specific version
func GetAnvilConfigDirectory ¶
func GetAnvilConfigDirectory() string
GetAnvilConfigDirectory returns the path to the anvil config directory
func GetAnvilConfigPath ¶
func GetAnvilConfigPath() string
GetAnvilConfigPath returns the path to the anvil config file
func GetAppConfigPath ¶
GetAppConfigPath checks if an app has a configured local path in the configs section
func GetAvailableGroups ¶
GetAvailableGroups returns all available groups
func GetBuiltInGroups ¶
func GetBuiltInGroups() []string
GetBuiltInGroups returns the list of built-in group names
func GetConfiguredApps ¶
GetConfiguredApps returns a list of all apps that have configured paths
func GetGroupTools ¶
GetGroupTools returns the tools for a specific group
func GetInstalledApps ¶
GetInstalledApps returns the list of individually installed applications
func GetTempAppPath ¶
GetTempAppPath checks if an app directory exists in the temp directory (from previous pull)
func IsAppTracked ¶
IsAppTracked checks if an app is being tracked in any category
func IsBuiltInGroup ¶
IsBuiltInGroup checks if a group name is a built-in group
func PopulateGitConfigFromSystem ¶
PopulateGitConfigFromSystem populates git configuration from local git settings and auto-detects SSH keys
func RemoveInstalledApp ¶
RemoveInstalledApp removes an app from the installed apps list
func SaveConfig ¶
func SaveConfig(config *AnvilConfig) error
SaveConfig saves the anvil configuration to settings.yaml
func SetAppConfigPath ¶
SetAppConfigPath sets the config path for an app in the configs section
func UpdateGroupTools ¶
UpdateGroupTools updates the tools list for an existing group
func ValidateAndFixGitHubConfig ¶
func ValidateAndFixGitHubConfig(config *AnvilConfig) bool
ValidateAndFixGitHubConfig validates and automatically fixes GitHub configuration
func ValidateFileAccess ¶
ValidateFileAccess validates that a file exists and is accessible
Types ¶
type AnvilConfig ¶
type AnvilConfig struct {
Version string `yaml:"version"`
Tools AnvilTools `yaml:"tools"`
Groups AnvilGroups `yaml:"groups"`
Configs map[string]string `yaml:"configs"` // Maps app names to their local config paths
Sources map[string]string `yaml:"sources"` // Maps app names to their download URLs
Git GitConfig `yaml:"git"`
GitHub GitHubConfig `yaml:"github"`
}
AnvilConfig represents the main anvil configuration
func LoadConfig ¶
func LoadConfig() (*AnvilConfig, error)
LoadConfig loads the anvil configuration from settings.yaml
func LoadSampleConfig ¶
func LoadSampleConfig() (*AnvilConfig, error)
LoadSampleConfig loads the sample configuration from the assets file
func LoadSampleConfigWithVersion ¶
func LoadSampleConfigWithVersion(version string) (*AnvilConfig, error)
LoadSampleConfigWithVersion loads the sample configuration with a specific version
type AnvilGroups ¶
AnvilGroups represents grouped tool configurations
type AnvilTools ¶
type AnvilTools struct {
RequiredTools []string `yaml:"required_tools"`
InstalledApps []string `yaml:"installed_apps"` // Tracks individually installed applications
}
AnvilTools represents tool configurations
type ConfigValidator ¶
type ConfigValidator struct {
// contains filtered or unexported fields
}
ConfigValidator implements the Validator interface for configuration validation
func (*ConfigValidator) ValidateAppName ¶
func (cv *ConfigValidator) ValidateAppName(appName string) error
ValidateAppName validates an application name
func (*ConfigValidator) ValidateConfig ¶
func (cv *ConfigValidator) ValidateConfig(config interface{}) error
ValidateConfig validates the entire configuration
func (*ConfigValidator) ValidateFont ¶
func (cv *ConfigValidator) ValidateFont(font string) error
ValidateFont validates a font name
func (*ConfigValidator) ValidateGroupName ¶
func (cv *ConfigValidator) ValidateGroupName(groupName string) error
ValidateGroupName validates a group name
type GitConfig ¶
type GitConfig struct {
Username string `yaml:"username"`
Email string `yaml:"email"`
SSHKeyPath string `yaml:"ssh_key_path,omitempty"` // Reference to SSH private key
}
GitConfig represents git configuration
type GitHubConfig ¶
type GitHubConfig struct {
ConfigRepo string `yaml:"config_repo"` // GitHub repository URL for configs (e.g., "username/dotfiles")
Branch string `yaml:"branch"` // Branch to use (default: "main")
LocalPath string `yaml:"local_path"` // Local path where configs are stored/synced
Token string `yaml:"token,omitempty"` // GitHub token (use env var reference)
TokenEnvVar string `yaml:"token_env_var,omitempty"` // Environment variable name for token
}
GitHubConfig represents GitHub repository configuration for config sync
type LocationSource ¶
type LocationSource int
LocationSource represents where an app config location was found
const ( LocationConfigs LocationSource = iota // Found in configs section of settings.yaml LocationTemp // Found in temp directory (pulled but not configured) )
func ResolveAppLocation ¶
func ResolveAppLocation(appName string) (string, LocationSource, error)
ResolveAppLocation finds the config location for an app following the priority order
func (LocationSource) String ¶
func (ls LocationSource) String() string
String returns a string representation of the location source
type Validator ¶
type Validator interface {
ValidateGroupName(groupName string) error
ValidateAppName(appName string) error
ValidateFont(font string) error
ValidateConfig(config interface{}) error
}
Validator defines the interface for input validation
func NewConfigValidator ¶
func NewConfigValidator(config *AnvilConfig) Validator
NewConfigValidator creates a new configuration validator