diff --git a/src/config.go b/src/config.go index cc35b80..7ba3804 100644 --- a/src/config.go +++ b/src/config.go @@ -10,7 +10,6 @@ import ( type StormfetchConfig struct { Ascii string `yaml:"distro_ascii"` - DistroName string `yaml:"distro_name"` Modules []stormfetchModuleConfig `yaml:"modules"` AnsiiColors []int `yaml:"ansii_colors"` ForceConfigAnsii bool `yaml:"force_config_ansii"` diff --git a/src/main.go b/src/main.go index 23b5e87..46ecfb1 100644 --- a/src/main.go +++ b/src/main.go @@ -31,7 +31,6 @@ func parseFlags() { flag.StringVar(&ConfigPath, "config", "", "Use the specified config file") flag.BoolVar(&ShowModuleTimeTaken, "time-taken", false, "Show time taken to execute each module") flag.StringVar(&Ascii, "ascii", "", "Set distro ascii") - flag.StringVar(&config.DistroName, "distro-name", config.DistroName, "Set distro name") flag.Parse() } diff --git a/src/system.go b/src/system.go index 8207668..c9ad51c 100644 --- a/src/system.go +++ b/src/system.go @@ -22,10 +22,6 @@ func GetDistroInfo() DistroInfo { LongName: "Unknown", ShortName: "Unknown", } - if strings.TrimSpace(config.DistroName) != "" { - info.LongName = strings.TrimSpace(config.DistroName) - info.ShortName = strings.TrimSpace(config.DistroName) - } // Detect release file location var releaseFile string @@ -39,20 +35,23 @@ func GetDistroInfo() DistroInfo { return info } + // Read release file releaseMap, err := ReadKeyValueFile(releaseFile) if err != nil { return info } + // Set struct fields if id, ok := releaseMap["ID"]; ok { info.ID = id } - if longName, ok := releaseMap["PRETTY_NAME"]; ok && info.LongName == "Unknown" { + if longName, ok := releaseMap["PRETTY_NAME"]; ok { info.LongName = longName } - if shortName, ok := releaseMap["NAME"]; ok && info.ShortName == "Unknown" { + if shortName, ok := releaseMap["NAME"]; ok { info.ShortName = shortName } + return info }