mirror of
https://github.com/EnumeratedDev/stormfetch.git
synced 2026-09-15 23:46:12 +00:00
Remove 'distro name' flag and config option
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
|||||||
|
|
||||||
type StormfetchConfig struct {
|
type StormfetchConfig struct {
|
||||||
Ascii string `yaml:"distro_ascii"`
|
Ascii string `yaml:"distro_ascii"`
|
||||||
DistroName string `yaml:"distro_name"`
|
|
||||||
Modules []stormfetchModuleConfig `yaml:"modules"`
|
Modules []stormfetchModuleConfig `yaml:"modules"`
|
||||||
AnsiiColors []int `yaml:"ansii_colors"`
|
AnsiiColors []int `yaml:"ansii_colors"`
|
||||||
ForceConfigAnsii bool `yaml:"force_config_ansii"`
|
ForceConfigAnsii bool `yaml:"force_config_ansii"`
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ func parseFlags() {
|
|||||||
flag.StringVar(&ConfigPath, "config", "", "Use the specified config file")
|
flag.StringVar(&ConfigPath, "config", "", "Use the specified config file")
|
||||||
flag.BoolVar(&ShowModuleTimeTaken, "time-taken", false, "Show time taken to execute each module")
|
flag.BoolVar(&ShowModuleTimeTaken, "time-taken", false, "Show time taken to execute each module")
|
||||||
flag.StringVar(&Ascii, "ascii", "", "Set distro ascii")
|
flag.StringVar(&Ascii, "ascii", "", "Set distro ascii")
|
||||||
flag.StringVar(&config.DistroName, "distro-name", config.DistroName, "Set distro name")
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-6
@@ -22,10 +22,6 @@ func GetDistroInfo() DistroInfo {
|
|||||||
LongName: "Unknown",
|
LongName: "Unknown",
|
||||||
ShortName: "Unknown",
|
ShortName: "Unknown",
|
||||||
}
|
}
|
||||||
if strings.TrimSpace(config.DistroName) != "" {
|
|
||||||
info.LongName = strings.TrimSpace(config.DistroName)
|
|
||||||
info.ShortName = strings.TrimSpace(config.DistroName)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Detect release file location
|
// Detect release file location
|
||||||
var releaseFile string
|
var releaseFile string
|
||||||
@@ -39,20 +35,23 @@ func GetDistroInfo() DistroInfo {
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read release file
|
||||||
releaseMap, err := ReadKeyValueFile(releaseFile)
|
releaseMap, err := ReadKeyValueFile(releaseFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set struct fields
|
||||||
if id, ok := releaseMap["ID"]; ok {
|
if id, ok := releaseMap["ID"]; ok {
|
||||||
info.ID = id
|
info.ID = id
|
||||||
}
|
}
|
||||||
if longName, ok := releaseMap["PRETTY_NAME"]; ok && info.LongName == "Unknown" {
|
if longName, ok := releaseMap["PRETTY_NAME"]; ok {
|
||||||
info.LongName = longName
|
info.LongName = longName
|
||||||
}
|
}
|
||||||
if shortName, ok := releaseMap["NAME"]; ok && info.ShortName == "Unknown" {
|
if shortName, ok := releaseMap["NAME"]; ok {
|
||||||
info.ShortName = shortName
|
info.ShortName = shortName
|
||||||
}
|
}
|
||||||
|
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user