Documentation
¶
Index ¶
- Constants
- Variables
- type DeployMode
- type DownloadableFile
- type ExportedProfile
- type Game
- type GameHooks
- type GameHooksExplicit
- type HookConfig
- type HookExplicitFlags
- type InstalledMod
- type LinkMethod
- type Mod
- type ModFile
- type ModReference
- type Profile
- type Update
- type UpdatePolicy
- type UpdateProgressFunc
Constants ¶
const SourceLocal = "local"
SourceLocal is the source ID for mods imported from local files
Variables ¶
var ( ErrModNotFound = errors.New("mod not found") ErrGameNotFound = errors.New("game not found") ErrProfileNotFound = errors.New("profile not found") ErrDependencyLoop = errors.New("circular dependency detected") ErrAuthRequired = errors.New("authentication required") ErrInvalidConfig = errors.New("invalid configuration") ErrFileConflict = errors.New("file conflict detected") ErrDownloadFailed = errors.New("download failed") ErrLinkFailed = errors.New("link operation failed") )
var UpdateProgressContextKey = &updateProgressKey{}
UpdateProgressContextKey is the context key for UpdateProgressFunc. Attach with context.WithValue.
Functions ¶
This section is empty.
Types ¶
type DeployMode ¶ added in v1.1.0
type DeployMode int
DeployMode determines how downloaded mod archives are handled
const ( DeployExtract DeployMode = iota // Default: extract archives to mod path DeployCopy // Copy files as-is (for games like Hytale where .zip IS the mod) )
func ParseDeployMode ¶ added in v1.1.0
func ParseDeployMode(s string) DeployMode
ParseDeployMode converts a string to DeployMode
func (DeployMode) String ¶ added in v1.1.0
func (m DeployMode) String() string
type DownloadableFile ¶
type DownloadableFile struct {
ID string // Source-specific file ID
Name string // Display name
FileName string // Actual filename (e.g., "mod-1.0.zip")
Version string // File version
Size int64 // Size in bytes
IsPrimary bool // Whether this is the primary/main file
Category string // Category: "MAIN", "OPTIONAL", "UPDATE", etc.
Description string // File description
}
DownloadableFile represents a file available for download from a mod source
type ExportedProfile ¶
type ExportedProfile struct {
Name string `yaml:"name"`
GameID string `yaml:"game_id"`
Mods []ModReference `yaml:"mods"`
LinkMethod string `yaml:"link_method,omitempty"`
Overrides map[string]string `yaml:"overrides,omitempty"` // path (relative to game install) -> file content
}
ExportedProfile is the YAML-serializable format for sharing
type Game ¶
type Game struct {
ID string // Unique slug, e.g., "skyrim-se"
Name string // Display name
InstallPath string // Game installation directory
ModPath string // Where mods should be deployed
SourceIDs map[string]string // Map source to game ID, e.g., "nexusmods" -> "skyrimspecialedition"
LinkMethod LinkMethod // How to deploy mods
LinkMethodExplicit bool // True if LinkMethod was explicitly set in config
CachePath string // Optional: custom cache path for this game's mods
Hooks GameHooks // Optional: hooks for install/uninstall operations
DeployMode DeployMode // How to handle downloaded files (extract vs copy)
}
Game represents a moddable game
type GameHooks ¶ added in v1.1.0
type GameHooks struct {
Install HookConfig `yaml:"install"`
Uninstall HookConfig `yaml:"uninstall"`
}
GameHooks contains all hooks for a game
type GameHooksExplicit ¶ added in v1.1.0
type GameHooksExplicit struct {
Install HookExplicitFlags
Uninstall HookExplicitFlags
}
GameHooksExplicit tracks which hooks were explicitly set
type HookConfig ¶ added in v1.1.0
type HookConfig struct {
BeforeAll string `yaml:"before_all"`
BeforeEach string `yaml:"before_each"`
AfterEach string `yaml:"after_each"`
AfterAll string `yaml:"after_all"`
}
HookConfig defines scripts for a single operation type (install or uninstall)
func (HookConfig) IsEmpty ¶ added in v1.1.0
func (h HookConfig) IsEmpty() bool
IsEmpty returns true if no hooks are configured
type HookExplicitFlags ¶ added in v1.1.0
HookExplicitFlags tracks which hooks were explicitly set in profile config This allows distinguishing between "not set" (inherit from game) and "set to empty" (disable)
type InstalledMod ¶
type InstalledMod struct {
Mod
ProfileName string
UpdatePolicy UpdatePolicy
InstalledAt time.Time
Enabled bool // User intent: wants this mod active
Deployed bool // Current state: files are in game directory
PreviousVersion string // Version before last update (for rollback)
LinkMethod LinkMethod // How the mod was deployed (symlink, hardlink, copy)
FileIDs []string // Source-specific file IDs that were downloaded
ManualDownload bool // True if mod requires manual download (CurseForge restricted, etc.)
}
InstalledMod tracks a mod installed in a profile
type LinkMethod ¶
type LinkMethod int
LinkMethod determines how mods are deployed to game directories
const ( LinkSymlink LinkMethod = iota // Default: symlink (space efficient) LinkHardlink // Hardlink (transparent to games) LinkCopy // Copy (maximum compatibility) )
func ParseLinkMethod ¶
func ParseLinkMethod(s string) LinkMethod
ParseLinkMethod converts a string to LinkMethod
func (LinkMethod) String ¶
func (m LinkMethod) String() string
type Mod ¶
type Mod struct {
ID string
SourceID string
Name string
Version string
Author string
Summary string
Description string
GameID string
Category string
Downloads int64
Endorsements *int64
PictureURL string // Main image URL (e.g. NexusMods picture_url)
SourceURL string // Web page URL (e.g. CurseForge mod page)
Files []ModFile
Dependencies []ModReference
UpdatedAt time.Time
}
Mod represents a mod from any source
type ModFile ¶
type ModFile struct {
Path string // Relative path within mod archive
Size int64
Checksum string // SHA256
}
ModFile represents a single file within a mod archive (after extraction)
type ModReference ¶
type ModReference struct {
SourceID string `yaml:"source_id"` // "nexusmods", "curseforge", etc.
ModID string `yaml:"mod_id"` // Source-specific identifier
Version string `yaml:"version"` // Empty string means "latest"
FileIDs []string `yaml:"file_ids,omitempty"` // Source-specific file IDs that were installed
}
ModReference is a pointer to a mod (used in profiles, dependencies)
type Profile ¶
type Profile struct {
Name string // Profile identifier
GameID string // Which game this profile is for
Mods []ModReference // Mods in load order (first = lowest priority)
Overrides map[string][]byte // Config file overrides (path -> content)
LinkMethod LinkMethod // Override game's default link method (optional)
IsDefault bool // Is this the default profile for the game?
Hooks GameHooks // Profile-level hook overrides
HooksExplicit GameHooksExplicit // Tracks which hooks were explicitly set
}
Profile represents a collection of mods with a specific configuration
type Update ¶
type Update struct {
InstalledMod InstalledMod
NewVersion string
Changelog string
FileIDReplacements map[string]string // Old file ID -> new file ID when a file was superseded (e.g. NexusMods FileUpdates)
}
Update represents an available update for an installed mod
type UpdatePolicy ¶
type UpdatePolicy int
UpdatePolicy determines how a mod handles updates
const ( UpdateNotify UpdatePolicy = iota // Default: show available, require approval UpdateAuto // Automatically apply updates UpdatePinned // Never update )
type UpdateProgressFunc ¶ added in v1.1.0
UpdateProgressFunc is called during update checks with (current 1-based index, total count, mod name). Set via context when running "lmm -v update" to get per-mod progress.