cli

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultProfileName = "Default"
View Source
const (
	InitialInstallationsVersion = InstallationsVersion(iota)
)
View Source
const (
	InitialProfilesVersion = ProfilesVersion(iota)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DependencyResolver added in v0.0.9

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

func NewDependencyResolver added in v0.0.9

func NewDependencyResolver(apiClient graphql.Client) DependencyResolver

func (DependencyResolver) ResolveModDependencies added in v0.0.9

func (d DependencyResolver) ResolveModDependencies(constraints map[string]string, lockFile *LockFile, gameVersion int) (LockFile, error)

type GlobalContext

type GlobalContext struct {
	Installations *Installations
	Profiles      *Profiles
	APIClient     graphql.Client
}

func InitCLI

func InitCLI() (*GlobalContext, error)

func (*GlobalContext) Save

func (g *GlobalContext) Save() error

type InstallUpdate added in v0.0.9

type InstallUpdate struct {
	ModName          string
	OverallProgress  float64
	DownloadProgress float64
	ExtractProgress  float64
}

type Installation

type Installation struct {
	Path    string `json:"path"`
	Profile string `json:"profile"`
}

func (*Installation) GetGameVersion added in v0.0.9

func (i *Installation) GetGameVersion(ctx *GlobalContext) (int, error)

func (*Installation) GetPlatform added in v0.0.9

func (i *Installation) GetPlatform(ctx *GlobalContext) (*Platform, error)

func (*Installation) Install

func (i *Installation) Install(ctx *GlobalContext, updates chan InstallUpdate) error

func (*Installation) LockFile added in v0.0.9

func (i *Installation) LockFile(ctx *GlobalContext) (*LockFile, error)

func (*Installation) LockFilePath added in v0.0.9

func (i *Installation) LockFilePath(ctx *GlobalContext) (string, error)

func (*Installation) SetProfile added in v0.0.9

func (i *Installation) SetProfile(ctx *GlobalContext, profile string) error

func (*Installation) Validate

func (i *Installation) Validate(ctx *GlobalContext) error

func (*Installation) WriteLockFile added in v0.0.9

func (i *Installation) WriteLockFile(ctx *GlobalContext, lockfile LockFile) error

type Installations

type Installations struct {
	Version              InstallationsVersion `json:"version"`
	Installations        []*Installation      `json:"installations"`
	SelectedInstallation string               `json:"selected_installation"`
}

func InitInstallations

func InitInstallations() (*Installations, error)

func (*Installations) AddInstallation

func (i *Installations) AddInstallation(ctx *GlobalContext, installPath string, profile string) (*Installation, error)

func (*Installations) DeleteInstallation added in v0.0.9

func (i *Installations) DeleteInstallation(installPath string) error

func (*Installations) GetInstallation

func (i *Installations) GetInstallation(installPath string) *Installation

func (*Installations) Save

func (i *Installations) Save() error

type InstallationsVersion

type InstallationsVersion int

type LockFile added in v0.0.9

type LockFile map[string]LockedMod

func (LockFile) Clone added in v0.0.9

func (l LockFile) Clone() LockFile

type LockedMod added in v0.0.9

type LockedMod struct {
	Version      string            `json:"version"`
	Hash         string            `json:"hash"`
	Link         string            `json:"link"`
	Dependencies map[string]string `json:"dependencies"`
}

type ModVersion added in v0.0.9

type ModVersion struct {
	ID           string
	Version      string
	Link         string
	Hash         string
	Dependencies []VersionDependency
}

type Platform added in v0.0.9

type Platform struct {
	VersionPath  string
	LockfilePath string
}

type Profile

type Profile struct {
	Name string                `json:"name"`
	Mods map[string]ProfileMod `json:"mods"`
}

func (*Profile) AddMod

func (p *Profile) AddMod(reference string, version string) error

AddMod adds a mod to the profile with given version.

func (*Profile) HasMod

func (p *Profile) HasMod(reference string) bool

HasMod returns true if the profile has a mod with the given reference.

func (*Profile) IsModEnabled added in v0.0.23

func (p *Profile) IsModEnabled(reference string) bool

func (*Profile) RemoveMod

func (p *Profile) RemoveMod(reference string)

RemoveMod removes a mod from the profile.

func (*Profile) Resolve added in v0.0.9

func (p *Profile) Resolve(resolver DependencyResolver, lockFile *LockFile, gameVersion int) (LockFile, error)

Resolve resolves all mods and their dependencies.

An optional lockfile can be passed if one exists.

Returns an error if resolution is impossible.

func (*Profile) SetModEnabled added in v0.0.23

func (p *Profile) SetModEnabled(reference string, enabled bool)

type ProfileMod

type ProfileMod struct {
	Version string `json:"version"`
	Enabled bool   `json:"enabled"`
}

type Profiles

type Profiles struct {
	Version         ProfilesVersion     `json:"version"`
	Profiles        map[string]*Profile `json:"profiles"`
	SelectedProfile string              `json:"selected_profile"`
}

func InitProfiles

func InitProfiles() (*Profiles, error)

func (*Profiles) AddProfile

func (p *Profiles) AddProfile(name string) (*Profile, error)

AddProfile adds a new profile with the given name to the profiles list.

func (*Profiles) DeleteProfile

func (p *Profiles) DeleteProfile(name string) error

DeleteProfile deletes the profile with the given name.

func (*Profiles) GetProfile

func (p *Profiles) GetProfile(name string) *Profile

GetProfile returns the profile with the given name or nil if it doesn't exist.

func (*Profiles) RenameProfile added in v0.0.7

func (p *Profiles) RenameProfile(ctx *GlobalContext, oldName string, newName string) error

func (*Profiles) Save

func (p *Profiles) Save() error

Save the profiles to the profiles file.

type ProfilesVersion

type ProfilesVersion int

type VersionDependency added in v0.0.9

type VersionDependency struct {
	ModReference string
	Constraint   string
	Optional     bool
}

Jump to

Keyboard shortcuts

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