mirror of
https://github.com/EnumeratedDev/stormfetch.git
synced 2026-09-16 07:56:12 +00:00
Remove 'distro name' flag and config option
This commit is contained in:
@@ -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"`
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
+5
-6
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user