ccmodupdater

package module
v1.2.1-0...-1897428 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: MIT Imports: 3 Imported by: 12

README

CCUpdaterCLI

A CLI tool to install mods for CrossCode

This is a Command Line Interface to install CrossCode mods easier.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GameInstance

type GameInstance struct {

	// Read-write: Local plugins
	LocalPlugins []LocalPackagePlugin
	// contains filtered or unexported fields
}

GameInstance represents an active instance.

func NewGameInstance

func NewGameInstance(base string) *GameInstance

NewGameInstance creates a new GameInstance with the given base directory. This has no LocalPlugins, so isn't fully usable by default.

func (GameInstance) Base

func (gi GameInstance) Base() string

Base returns the base directory of the GameInstance.

func (*GameInstance) Packages

func (gi *GameInstance) Packages() map[string]LocalPackage

Packages returns a map of the LocalPackages that are installed, where the keys are the .Metadata().Name values for those packages.

type LocalPackage

type LocalPackage interface {
	Package
	// Attempts to remove the package. This does not check dependencies. This may affect other packages.
	Remove() error
}

LocalPackage represents a package installed in a GameInstance. It is invalidated when the GameInstance is modified.

type LocalPackagePlugin

type LocalPackagePlugin interface {
	Packages() []LocalPackage
}

LocalPackagePlugin represents a plugin to the system that adds a scanner for local packages. It is assumed that the *GameInstance is supplied upon construction. The system is built this way because local packages are

type Package

type Package interface {
	// Returns the metadata for this package.
	Metadata() PackageMetadata
}

Package represents a package, local or remote.

type PackageMetadata

type PackageMetadata map[string]interface{}

PackageMetadata represents the metadata for a package. For further details, please see the inputLocationsFormat.md file.

func (PackageMetadata) Dependencies

func (pm PackageMetadata) Dependencies() map[string]*semver.Constraints

Dependencies gets the dependencies of the package.

func (PackageMetadata) Description

func (pm PackageMetadata) Description() string

Description gets the description of the package.

func (PackageMetadata) FullReferent

func (pm PackageMetadata) FullReferent() string

FullReferent combines the ID and human name.

func (PackageMetadata) HumanName

func (pm PackageMetadata) HumanName() string

HumanName gets the 'human name' of the package.

func (PackageMetadata) Name

func (pm PackageMetadata) Name() string

Name gets the name of the package.

func (PackageMetadata) Type

func (pm PackageMetadata) Type() PackageType

Type gets the type of the package.

func (PackageMetadata) Verify

func (pm PackageMetadata) Verify() error

Verify verifies that the PackageMetadata is valid and won't panic.

func (PackageMetadata) Version

func (pm PackageMetadata) Version() *semver.Version

Version gets the version of the package.

type PackageTX

type PackageTX map[string]PackageTXOperation

A PackageTX is a proposed set of operations to perform on a GameInstance. It should be treated immutably, using clone-and-edit where required.

func (PackageTX) Append

func (tx PackageTX) Append(b PackageTX) PackageTX

Append creates a PackageTX from two PackageTXes, showing the result of them having been concatenated.

func (PackageTX) Clone

func (tx PackageTX) Clone() PackageTX

Clone clones the PackageTX.

func (PackageTX) Equals

func (tx PackageTX) Equals(other PackageTX) bool

Equals checks for equality with another PackageTX.

type PackageTXContext

type PackageTXContext struct {
	LocalPackages map[string]LocalPackage
	// Leave non-nil but blank if offline.
	RemotePackages map[string]RemotePackage
}

A PackageTXContext is a view of the current local and remote packages from before a package transaction.

func (PackageTXContext) AllPackageIDs

func (ctx PackageTXContext) AllPackageIDs() []string

func (PackageTXContext) PackageAfter

func (ctx PackageTXContext) PackageAfter(tx PackageTX, pkg string) Package

func (PackageTXContext) Perform

func (ctx PackageTXContext) Perform(gi *GameInstance, tx PackageTX, stats func(pkg string, pre bool, rm bool, add bool)) error

Perform actually performs a PackageTX (invalidating the PackageTXContext LocalPackages as a result) in dependency order.

func (PackageTXContext) Solve

func (ctx PackageTXContext) Solve(tx PackageTX) ([]PackageTX, error)

Solve returns a set of solved versions of the package transactions.

func (PackageTXContext) Verify

func (ctx PackageTXContext) Verify(tx PackageTX) []PackageTXProblem

Verify checks if the Package Transaction is invalid, and if so, why.

type PackageTXOperation

type PackageTXOperation int

A PackageTXOperation describes something to perform on a package.

const (
	// PackageTransactionOperationInstall updates the package to the latest version.
	PackageTXOperationInstall PackageTXOperation = iota
	// PackageTransactionOperationRemove removes the package from the system.
	PackageTXOperationRemove
)

type PackageTXProblem

type PackageTXProblem struct {
	Text string
	// Solutions. Each solution is a PackageTX to be appended to the original.
	Solutions []PackageTX
}

PackageTXProblem represents a problem with the PackageTX and a number of potential solutions.

type PackageTXSet

type PackageTXSet []PackageTX

PackageTXSet represents a set of PackageTXes. Refer to it via *PackageTXSet.

func (*PackageTXSet) Contains

func (set *PackageTXSet) Contains(ptx PackageTX) bool

Contains returns true if the PackageTX is contained in this set.

func (*PackageTXSet) Len

func (set *PackageTXSet) Len() int

Len implements sort.Interface.Len

func (*PackageTXSet) Less

func (set *PackageTXSet) Less(a int, b int) bool

Less implements sort.Interface.Less

func (*PackageTXSet) Put

func (set *PackageTXSet) Put(ptx PackageTX) bool

Put puts a PackageTX into the set. Returns false if it was already there.

func (*PackageTXSet) Swap

func (set *PackageTXSet) Swap(a int, b int)

Swap implements sort.Interface.Swap

type PackageType

type PackageType int

PackageType represents a specific kind of package.

const (
	// PackageTypeBase represents a hidden base package that should not be visible from UI (but may be visible in CLI).
	PackageTypeBase PackageType = iota
	// PackageTypeMod represents a mod.
	PackageTypeMod
	// PackageTypeTool represents a tool.
	PackageTypeTool
	// PackageTypeAfterLast is above the last PackageType, to allow iteration in for loops. If it appears, it means "unknown".
	PackageTypeAfterLast
)
const PackageTypeFirst PackageType = 0

PackageTypeFirst is the first PackageType.

func (PackageType) String

func (pt PackageType) String() string

func (PackageType) StringPlural

func (pt PackageType) StringPlural() string

StringPlural is similar to String, but the resulting string is a plural

type RemotePackage

type RemotePackage interface {
	Package
	// Installs the package. This does not check dependencies. This may affect other packages.
	Install(target *GameInstance) error
}

RemotePackage represents a package on a remote server.

Directories

Path Synopsis
cmd
api

Jump to

Keyboard shortcuts

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