Documentation ¶
Index ¶
- Variables
- func AddOnsPath() string
- func DependencyName(input string) []string
- func ESOHome() string
- func Pluralize(s string, c int) string
- func SavedVariablesPath() string
- func StripESOColorCodes(input string) string
- func ToKey(input string) string
- func ValidateESOHOME() error
- type AddOn
- func (A *AddOn) AddError(err error)
- func (A AddOn) CleanAuthor() string
- func (A AddOn) CleanDescription() string
- func (A AddOn) CleanTitle() string
- func (A *AddOn) Dir() string
- func (A AddOn) Errors() []error
- func (A *AddOn) IsDependency() bool
- func (A *AddOn) IsLibrary() bool
- func (A AddOn) IsSubmodule() bool
- func (A AddOn) Key() string
- func (A *AddOn) SetDependency(value bool)
- func (A *AddOn) SetDir(dir string)
- func (A *AddOn) SetLibrary(value bool)
- func (A AddOn) String() string
- func (A AddOn) TitleString() string
- func (A AddOn) ToHeader() string
- func (A AddOn) ToJson() ([]byte, error)
- func (A AddOn) ToMarkdown() string
- func (A AddOn) ToOnelineMarkdown() string
- func (A *AddOn) Validate() bool
- type AddOnDefinition
- type AddOns
- type SavedVars
Constants ¶
This section is empty.
Variables ¶
var AppFs = afero.NewReadOnlyFs(afero.NewOsFs())
Functions ¶
func AddOnsPath ¶
func AddOnsPath() string
func DependencyName ¶
Removes version dependencies and returns the plain dependency name
func SavedVariablesPath ¶
func SavedVariablesPath() string
func StripESOColorCodes ¶
func ToKey ¶
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 ¶
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) CleanAuthor ¶
CleanAuthor returns the Author without any ESO color codes
func (AddOn) CleanDescription ¶
CleanDescription returns the Author without any ESO color codes
func (AddOn) CleanTitle ¶
CleanTitle returns the Title without any ESO color codes
func (*AddOn) IsDependency ¶
IsDependency returns the dependency status of the AddOn.
func (AddOn) IsSubmodule ¶
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) SetDependency ¶
SetDependency sets the dependency status of the AddOn.
func (*AddOn) SetLibrary ¶
SetLibrary sets the library status of the AddOn.
func (AddOn) String ¶
String returns a string representation of the AddOn. It includes all fields of the AddOn, separated by commas.
func (AddOn) TitleString ¶
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 ¶
ToHeader returns a string representation of the AddOn in Markdown format, with a header (##) before each field.
func (AddOn) ToJson ¶
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 ¶
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 ¶
ToOnelineMarkdown returns a string representation of the AddOn in Markdown format, with a hyphen (-) before the title.
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 ¶
Global AddOn Container to store all AddOns.
func (*AddOns) Add ¶
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 ¶
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) Keys ¶
Keys returns a slice of keys from the global AddOns map. It sorts the keys in alphabetical order.
func (AddOns) Print ¶
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.