eso

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func AddOnsPath

func AddOnsPath() string

func DependencyName

func DependencyName(input string) []string

Removes version dependencies and returns the plain dependency name

func ESOHome

func ESOHome() string

func Pluralize

func Pluralize(s string, c int) string

func SavedVariablesPath

func SavedVariablesPath() string

func StripESOColorCodes

func StripESOColorCodes(input string) string

func ToKey

func ToKey(input string) string

Helper function to convert a string to a key. It replaces any spaces in the input string with hyphens.

func ValidateESOHOME

func ValidateESOHOME() error

Types

type AddOn

type AddOn struct {
	Title             string
	Author            string
	Contributors      string
	Version           string
	Description       string
	AddOnVersion      string
	APIVersion        string
	SavedVariables    []string
	DependsOn         []string
	OptionalDependsOn []string
	// contains filtered or unexported fields
}

func NewAddOn

func NewAddOn(key string) (AddOn, error)

NewAddOn creates a new instance of AddOn with the provided key. The key is converted to a standardized format using ToKey function. If the key is empty, an error is returned.

func (*AddOn) AddError

func (A *AddOn) AddError(err error)

AddError appends an error to the list of errors of the AddOn.

func (AddOn) CleanAuthor

func (A AddOn) CleanAuthor() string

CleanAuthor returns the Author without any ESO color codes

func (AddOn) CleanDescription

func (A AddOn) CleanDescription() string

CleanDescription returns the Author without any ESO color codes

func (AddOn) CleanTitle

func (A AddOn) CleanTitle() string

CleanTitle returns the Title without any ESO color codes

func (*AddOn) Dir

func (A *AddOn) Dir() string

Dir returns the directory of the AddOn.

func (AddOn) Errors

func (A AddOn) Errors() []error

Errors returns the list of errors of the AddOn.

func (*AddOn) IsDependency

func (A *AddOn) IsDependency() bool

IsDependency returns the dependency status of the AddOn.

func (*AddOn) IsLibrary

func (A *AddOn) IsLibrary() bool

IsLibrary returns the library status of the AddOn.

func (AddOn) IsSubmodule

func (A AddOn) IsSubmodule() bool

IsSubmodule returns true if the AddOn is a submodule, and false otherwise. It checks if the directory of the AddOn contains more than one path element.

func (AddOn) Key

func (A AddOn) Key() string

Key returns the key of the AddOn.

func (*AddOn) SetDependency

func (A *AddOn) SetDependency(value bool)

SetDependency sets the dependency status of the AddOn.

func (*AddOn) SetDir

func (A *AddOn) SetDir(dir string)

SetDir sets the directory of the AddOn.

func (*AddOn) SetLibrary

func (A *AddOn) SetLibrary(value bool)

SetLibrary sets the library status of the AddOn.

func (AddOn) String

func (A AddOn) String() string

String returns a string representation of the AddOn. It includes all fields of the AddOn, separated by commas.

func (AddOn) TitleString

func (A AddOn) TitleString() string

TitleString returns a string representation of the AddOn's title, version, and author. It includes the title, version, and author, separated by parentheses and the word "by".

func (AddOn) ToHeader

func (A AddOn) ToHeader() string

ToHeader returns a string representation of the AddOn in Markdown format, with a header (##) before each field.

func (AddOn) ToJson

func (A AddOn) ToJson() ([]byte, error)

ToJson returns a byte slice and an error. It marshals the AddOn into JSON format and returns the byte slice. If an error occurs during the marshalling process, it returns the error.

func (AddOn) ToMarkdown

func (A AddOn) ToMarkdown() string

ToMarkdown returns a string representation of the AddOn in Markdown format, with a header (##) before the title and a newline before the description.

func (AddOn) ToOnelineMarkdown

func (A AddOn) ToOnelineMarkdown() string

ToOnelineMarkdown returns a string representation of the AddOn in Markdown format, with a hyphen (-) before the title.

func (*AddOn) Validate

func (A *AddOn) Validate() bool

Validate validates the AddOn. It checks if the title, author, and version fields are not empty. If any of these fields are empty, it sets an error and returns false. Otherwise, it returns true.

type AddOnDefinition

type AddOnDefinition struct {
	Name string // Name of the add-on file (without the .txt extension).
	Dir  string // Directory where the add-on file is located.
}

AddOnDefinition represents a single ESO add-on definition.

func FindAddOns

func FindAddOns(AppFs afero.Fs) ([]AddOnDefinition, error)

func (AddOnDefinition) Key

func (AD AddOnDefinition) Key() string

Key returns the unique identifier of the add-on. It trims the .txt extension from the name and converts it to a key using the ToKey function from the eso package.

func (AddOnDefinition) Path

func (AD AddOnDefinition) Path() string

Path returns the full path to the add-on file. It joins the directory (Dir) and the name (with .txt extension) of the add-on file.

func (AddOnDefinition) String

func (AD AddOnDefinition) String() string

String returns a string representation of the AddOnDefinition. The format is "[ID: <key>, name: <Name>, dir: <Dir>]".

type AddOns

type AddOns map[string]AddOn

Global AddOn Container to store all AddOns.

func GetAddOns

func GetAddOns(AppFs afero.Fs) (AddOns, []error)

func Run

func Run() (AddOns, []error)

func (*AddOns) Add

func (A *AddOns) Add(addon AddOn)

Add adds an AddOn to the global AddOns map. It checks if the AddOn with the same key already exists in the map. If it does, it panics with an error message. Otherwise, it adds the AddOn to the map.

func (*AddOns) Find

func (A *AddOns) Find(key string) (AddOn, bool)

Find returns an AddOn and a boolean from the global AddOns map based on the given key. The boolean is true if the AddOn is found, and false otherwise.

func (*AddOns) Get

func (A *AddOns) Get(key string) AddOn

Get returns an AddOn from the global AddOns map based on the given key.

func (AddOns) Keys

func (A AddOns) Keys() []string

Keys returns a slice of keys from the global AddOns map. It sorts the keys in alphabetical order.

func (AddOns) Print

func (A AddOns) Print(format string) string

Print prints the global AddOns map in the specified format. It checks the format and calls the corresponding function to print the AddOns. If the format is "json", it marshals the AddOns into JSON format and prints the byte slice. Otherwise, it prints the AddOns in Markdown format.

func (AddOns) Strings

func (A AddOns) Strings() string

Strings returns a string representation of the global AddOns map. It includes all AddOns in the map, separated by newlines.

func (*AddOns) Update

func (A *AddOns) Update(addon AddOn)

Update updates an AddOn in the global AddOns map. It checks if the AddOn with the same key exists in the map. If it doesn't, it panics with an error message. Otherwise, it updates the AddOn in the map.

type SavedVars

type SavedVars struct {
	fs.FileInfo
}

func FindSavedVars

func FindSavedVars(AppFs afero.Fs) ([]SavedVars, error)

func (SavedVars) FullPath

func (sv SavedVars) FullPath() string

Jump to

Keyboard shortcuts

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