Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AppVersion string
AppVersion is the current version of the application.
Functions ¶
func FindConfigFile ¶
func FindConfigFile() string
FindConfigFile searches for the configuration file in standard locations. It searches in the current working directory, then in ~/.config, and finally in the home directory. It returns the path to the first file found, or an empty string if no file is found.
func SetVersion ¶ added in v1.5.0
func SetVersion(v string)
SetVersion sets the application version.
Types ¶
type AppCliConfig ¶
type AppCliConfig struct {
// ConfigFile is the path to the configuration file.
ConfigFile string
// Debug enables or disables debug mode.
Debug *bool
// CheckUpdates enables or disables checking for updates.
CheckUpdates *bool
// Filter is a list of installer names to filter by.
Filter []string
// LogFile is the path to the log file.
LogFile *string
// ShowLogFile indicates that only the log file path should be shown.
ShowLogFile bool
}
AppCliConfig represents the command-line interface configuration.
func ParseCliConfig ¶
func ParseCliConfig() *AppCliConfig
ParseCliConfig parses command-line arguments and returns an AppCliConfig.
type AppConfig ¶
type AppConfig struct {
// Debug enables or disables debug mode.
Debug *bool `json:"debug" yaml:"debug"`
// CheckUpdates enables or disables checking for updates.
CheckUpdates *bool `json:"check_updates" yaml:"check_updates"`
// Install is a list of installers to run.
Install []InstallerData `json:"install" yaml:"install"`
// Defaults provides default configurations for installer types.
Defaults *AppConfigDefaults `json:"defaults" yaml:"defaults"`
// Env is a map of environment variables to set.
Env *map[string]string `json:"env" yaml:"env"`
// PlatformEnv is a map of platform-specific environment variables to set.
PlatformEnv *platform.PlatformMap[map[string]string] `json:"platform_env" yaml:"platform_env"`
// Filter is a list of installer names to filter by.
Filter []string
}
AppConfig represents the main application configuration.
func NewAppConfig ¶ added in v1.4.0
func NewAppConfig() AppConfig
NewAppConfig creates a new AppConfig with default values.
func ParseConfig ¶
func ParseConfig(overrides *AppCliConfig) (*AppConfig, error)
ParseConfig parses the configuration file and applies overrides.
func ParseConfigFrom ¶ added in v1.4.0
ParseConfigFrom parses the configuration from the given file.
func ParseConfigFromContent ¶ added in v1.13.0
ParseConfigFromContent parses the configuration from YAML content.
func (*AppConfig) Environ ¶ added in v1.1.0
Environ returns the combined environment variables as a slice of strings.
func (*AppConfig) GetConfigDesc ¶ added in v1.9.0
GetConfigDesc returns a string slice describing the current configuration.
type AppConfigDefaults ¶
type AppConfigDefaults struct {
// Type is a map of installer types to their default configurations.
Type *map[InstallerType]InstallerData `json:"type" yaml:"type"`
}
AppConfigDefaults provides default configurations for installer types.
type InstallerData ¶ added in v1.5.0
type InstallerData struct {
// Enabled determines if the installer is enabled. Can be a boolean string ("true", "false") or a condition.
Enabled *string `json:"enabled" yaml:"enabled"`
// Name is the name of the installer.
Name *string `json:"name" yaml:"name"`
// Type is the type of the installer.
Type InstallerType `json:"type" yaml:"type"`
// Tags is a space-separated list of tags for the installer.
Tags *string `json:"tags" yaml:"tags"`
// Env is a map of environment variables to set for the installer.
Env *map[string]string `json:"env" yaml:"env"`
// PlatformEnv is a map of platform-specific environment variables to set for the installer.
PlatformEnv *platform.PlatformMap[map[string]string] `json:"platform_env" yaml:"platform_env"`
// Platforms is a list of platforms where this installer should run.
Platforms *platform.Platforms `json:"platforms" yaml:"platforms"`
// Steps is a list of sub-installers for group installers.
Steps *[]InstallerData `json:"steps" yaml:"steps"`
// Opts is a map of options specific to the installer type.
Opts *map[string]any `json:"opts" yaml:"opts"`
// BinName is the name of the binary to check for existence.
BinName *string `json:"bin_name" yaml:"bin_name"`
// CheckHasUpdate is a command to check if an update is available.
CheckHasUpdate *string `json:"check_has_update" yaml:"check_has_update"`
// CheckInstalled is a command to check if the software is installed.
CheckInstalled *string `json:"check_installed" yaml:"check_installed"`
// PostInstall is a command to run after installation.
PostInstall *string `json:"post_install" yaml:"post_install"`
// PreInstall is a command to run before installation.
PreInstall *string `json:"pre_install" yaml:"pre_install"`
// PostUpdate is a command to run after updating.
PostUpdate *string `json:"post_update" yaml:"post_update"`
// PreUpdate is a command to run before updating.
PreUpdate *string `json:"pre_update" yaml:"pre_update"`
// EnvShell is a platform-specific shell to use for running commands.
EnvShell *platform.PlatformMap[string] `json:"env_shell" yaml:"env_shell"`
}
InstallerData represents the configuration for a single installer.
func (*InstallerData) Environ ¶ added in v1.5.0
func (i *InstallerData) Environ() []string
Environ returns the combined environment variables for the installer as a slice of strings.
func (*InstallerData) GetTagsList ¶ added in v1.5.0
func (i *InstallerData) GetTagsList() []string
GetTagsList returns the list of tags for the installer.
type InstallerType ¶
type InstallerType string
InstallerType represents the type of an installer.
const ( InstallerTypeGroup InstallerType = "group" // InstallerTypeGroup represents a group of installers. InstallerTypeShell InstallerType = "shell" // InstallerTypeShell represents a shell command installer. InstallerTypeDocker InstallerType = "docker" // InstallerTypeDocker represents a Docker image installer. InstallerTypeBrew InstallerType = "brew" // InstallerTypeBrew represents a Homebrew package installer. InstallerTypeApt InstallerType = "apt" // InstallerTypeApt represents an APT package installer. InstallerTypeApk InstallerType = "apk" // InstallerTypeApk represents an APK package installer. InstallerTypeGit InstallerType = "git" // InstallerTypeGit represents a Git repository installer. InstallerTypeGitHubRelease InstallerType = "github-release" // InstallerTypeGitHubRelease represents a GitHub release installer. InstallerTypeRsync InstallerType = "rsync" // InstallerTypeRsync represents an rsync installer. InstallerTypeNpm InstallerType = "npm" // InstallerTypeNpm represents an npm package installer. InstallerTypePnpm InstallerType = "pnpm" // InstallerTypePnpm represents a pnpm package installer. InstallerTypeYarn InstallerType = "yarn" // InstallerTypeYarn represents a yarn package installer. InstallerTypePipx InstallerType = "pipx" // InstallerTypePipx represents a pipx package installer. InstallerTypeManifest InstallerType = "manifest" // InstallerTypeManifest represents a manifest file installer. InstallerTypePacman InstallerType = "pacman" // InstallerTypePacman represents a pacman package installer. InstallerTypeYay InstallerType = "yay" // InstallerTypeYay represents a yay (AUR helper) package installer. )
Constants for the different installer types.