config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Validator = validator.New()
	Path      = path.NewPath()
)

Functions

func DefaultSteamCMDPath

func DefaultSteamCMDPath() string

Types

type App

type App struct {
	Name  string `json:"name" mapstructure:"name"`                                              // Name of the game
	AppID string `json:"id" mapstructure:"id" validate:"required"`                              // Steam App ID
	Path  string `json:"path,omitempty" mapstructure:"path" validate:"required,dir"`            // Path to the mod directory
	Mods  []*Mod `json:"mods,omitempty" mapstructure:"mods" validate:"omitempty,dive,required"` // List of mods to download for the game
}

func (*App) String

func (a *App) String() string

type Apps

type Apps []*App

func (*Apps) CmdArgs

func (a *Apps) CmdArgs() []string

func (*Apps) Destinations

func (a *Apps) Destinations() map[string]string

Destinations returns a map of appID to destination path

func (*Apps) String

func (a *Apps) String() string

func (*Apps) Strings

func (a *Apps) Strings() []string

type Config

type Config struct {
	Steam Steam `json:"steam" mapstructure:"steam" validate:"required"`                        // Steam config
	Apps  Apps  `json:"apps,omitempty" mapstructure:"apps" validate:"omitempty,dive,required"` // List of games with mods to download
}

func (*Config) ExportPath

func (c *Config) ExportPath(appID, modId string) (ModPath, error)

func (*Config) PrintJSON

func (c *Config) PrintJSON() error

func (*Config) PrintYAML

func (c *Config) PrintYAML() error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the config

type Login

type Login struct {
	Username string `json:"username" mapstructure:"username" validate:"required"` // Username
	Password string `json:"password" mapstructure:"password"`                     // Password
}

func (*Login) CmdArgs

func (l *Login) CmdArgs() []string

Login for steamcmd

func (*Login) String

func (l *Login) String() string

String returns the username and masked password if set

func (*Login) Validate

func (l *Login) Validate() error

Validate validates the login

type Mod

type Mod struct {
	Name       string `json:"name,omitempty" mapstructure:"name"`       // Name of the mod
	WorkshopID string `json:"id" mapstructure:"id" validate:"required"` // Steam Workshop ID
}

type ModPath

type ModPath struct {
	AppName string
	AppPath string
	ModName string
}

type Steam

type Steam struct {
	Login Login  `json:"login" mapstructure:"login" validate:"required"`  // Login credentials
	Cmd   string `json:"cmd" mapstructure:"cmd" validate:"required,file"` // SteamCMD path e.g. /usr/bin/steamcmd
}

Jump to

Keyboard shortcuts

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