cli

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: GPL-3.0 Imports: 21 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 GlobalContext

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

func InitCLI

func InitCLI(apiOnly bool) (*GlobalContext, error)

func (*GlobalContext) ReInit added in v0.2.0

func (g *GlobalContext) ReInit() error

ReInit will initialize the context

Used only by tests

func (*GlobalContext) Save

func (g *GlobalContext) Save() error

func (*GlobalContext) Wipe added in v0.2.0

func (g *GlobalContext) Wipe() error

Wipe will remove any trace of ficsit anywhere

type InstallUpdate added in v0.0.9

type InstallUpdate struct {
	Type     InstallUpdateType
	Item     InstallUpdateItem
	Progress utils.GenericProgress
}

type InstallUpdateItem added in v0.2.0

type InstallUpdateItem struct {
	Mod     string
	Version string
}

type InstallUpdateType added in v0.2.0

type InstallUpdateType string
var (
	InstallUpdateTypeOverall     InstallUpdateType = "overall"
	InstallUpdateTypeModDownload InstallUpdateType = "download"
	InstallUpdateTypeModExtract  InstallUpdateType = "extract"
	InstallUpdateTypeModComplete InstallUpdateType = "complete"
)

type Installation

type Installation struct {
	DiskInstance disk.Disk `json:"-"`
	Path         string    `json:"path"`
	Profile      string    `json:"profile"`
	Vanilla      bool      `json:"vanilla"`
}

func (*Installation) BasePath added in v0.1.0

func (i *Installation) BasePath() string

func (*Installation) GetDisk added in v0.1.0

func (i *Installation) GetDisk() (disk.Disk, error)

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) (*resolver.LockFile, error)

func (*Installation) LockFilePath added in v0.0.9

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

func (*Installation) ResolveProfile added in v0.2.0

func (i *Installation) ResolveProfile(ctx *GlobalContext) (*resolver.LockFile, error)

func (*Installation) SetProfile added in v0.0.9

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

func (*Installation) UpdateMods added in v0.2.0

func (i *Installation) UpdateMods(ctx *GlobalContext, mods []string) error

func (*Installation) Validate

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

func (*Installation) Wipe added in v0.2.0

func (i *Installation) Wipe() error

func (*Installation) WriteLockFile added in v0.0.9

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

type Installations

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

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 MockProvider added in v0.2.0

type MockProvider struct {
	resolver.MockProvider
}

func (MockProvider) GetMod added in v0.2.0

func (MockProvider) IsOffline added in v0.2.0

func (m MockProvider) IsOffline() bool

func (MockProvider) ModVersionsWithDependencies added in v0.2.0

func (m MockProvider) ModVersionsWithDependencies(ctx context.Context, modID string) ([]resolver.ModVersion, error)

func (MockProvider) Mods added in v0.2.0

type Platform added in v0.0.9

type Platform struct {
	VersionPath  string
	LockfilePath string
	TargetName   string
}

type Profile

type Profile struct {
	Mods            map[string]ProfileMod `json:"mods"`
	Name            string                `json:"name"`
	RequiredTargets []resolver.TargetName `json:"required_targets"`
}

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 resolver.DependencyResolver, lockFile *resolver.LockFile, gameVersion int) (*resolver.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 {
	Profiles        map[string]*Profile `json:"profiles"`
	SelectedProfile string              `json:"selected_profile"`
	Version         ProfilesVersion     `json:"version"`
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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