cli

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: GPL-3.0 Imports: 8 Imported by: 2

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
}

func InitCLI

func InitCLI() (*GlobalContext, error)

func (*GlobalContext) Save

func (g *GlobalContext) Save() error

type Installation

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

func (*Installation) Install

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

func (*Installation) Validate

func (i *Installation) Validate(ctx *GlobalContext) 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) GetInstallation

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

func (*Installations) Save

func (i *Installations) Save() error

type InstallationsVersion

type InstallationsVersion int

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) RemoveMod

func (p *Profile) RemoveMod(reference string)

RemoveMod removes a mod from the profile.

type ProfileMod

type ProfileMod struct {
	Version          string `json:"version"`
	InstalledVersion string `json:"installed_version"`
}

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(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

Jump to

Keyboard shortcuts

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