mirror of
https://github.com/packwiz/packwiz.git
synced 2025-10-14 06:54:32 +02:00
Added author + pack version (#6)
* Added author + pack version * Remove unnecessary binary * Apply suggestions, clean up somewhat Co-authored-by: comp500 <comp500@users.noreply.github.com>
This commit is contained in:
23
core/pack.go
23
core/pack.go
@@ -13,16 +13,19 @@ import (
|
||||
|
||||
// Pack stores the modpack metadata, usually in pack.toml
|
||||
type Pack struct {
|
||||
Name string `toml:"name"`
|
||||
Index struct {
|
||||
Name string `toml:"name"`
|
||||
Author string `toml:"author"`
|
||||
Version string `toml:"version"`
|
||||
Index struct {
|
||||
// Path is stored in forward slash format relative to pack.toml
|
||||
File string `toml:"file"`
|
||||
HashFormat string `toml:"hash-format"`
|
||||
Hash string `toml:"hash"`
|
||||
} `toml:"index"`
|
||||
Versions map[string]string `toml:"versions"`
|
||||
Client map[string]toml.Primitive `toml:"client"`
|
||||
Server map[string]toml.Primitive `toml:"server"`
|
||||
Versions map[string]string `toml:"versions"`
|
||||
Client map[string]toml.Primitive `toml:"client"`
|
||||
Server map[string]toml.Primitive `toml:"server"`
|
||||
Export map[string]map[string]interface{} `toml:"export"`
|
||||
}
|
||||
|
||||
// LoadPack loads the modpack metadata to a Pack struct
|
||||
@@ -105,3 +108,13 @@ func (pack Pack) GetMCVersion() (string, error) {
|
||||
}
|
||||
return mcVersion, nil
|
||||
}
|
||||
|
||||
func (pack Pack) GetPackName() string {
|
||||
if pack.Name == "" {
|
||||
return "export"
|
||||
} else if pack.Version == "" {
|
||||
return pack.Name
|
||||
} else {
|
||||
return pack.Name + "-" + pack.Version
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user