diff --git a/asciiarts/asciiart.go b/asciiarts/asciiart.go index 139060b..0ed4eb2 100644 --- a/asciiarts/asciiart.go +++ b/asciiarts/asciiart.go @@ -99,7 +99,7 @@ var xerolinux string var windows string func GetAsciiInternal(distroID string) string { - switch distroID { + switch strings.ToLower(distroID) { case "alpine": return alpine case "arcolinux": @@ -150,9 +150,7 @@ func GetAsciiInternal(distroID string) string { return void case "xerolinux": return xerolinux - case "arch": - return arch - case "Archcraft": + case "arch", "Archcraft": return arch case "windows": return windows diff --git a/main.go b/main.go index 9855202..f6c8705 100644 --- a/main.go +++ b/main.go @@ -19,16 +19,17 @@ func handleConfig() { if os.IsNotExist(folder) { os.Mkdir(filepath.Dir(data.GetConfigFile()), os.ModePerm) } - + defaultconfig := "println green neOwOfetchh 🔥\ninfo white username\nprint blue @\ninfoln blue hostname\nprint white uptime: \ninfoln red uptime\nprint white shell: \ninfoln blue shell\nprint white distro: \ninfoln blue distro\nprint white terminal: \ninfoln blue terminal\nprint white memory: \ninfo blue memoryUsed\nprint white /\ninfoln blue memoryAll" if os.IsNotExist(file) { println("config was not found. a default config file has been generated in '~/.config/neowofetch/conf'. rerun the program") f, _ := os.Create(data.GetConfigFile()) - _, _ = f.WriteString("println green neOwOfetch 🔥\ninfo white username\nprint blue @\ninfoln blue hostname\nprint white uptime: \ninfoln red uptime\nprint white shell: \ninfoln blue shell\nprint white distro: \ninfoln blue distro\nprint white terminal: \ninfoln blue terminal\nprint white memory: \ninfo blue memoryUsed\nprint white /\ninfoln blue memoryAll") + _, _ = f.WriteString(defaultconfig) + os.Exit(0) } else { body, _ := ioutil.ReadFile(data.GetConfigFile()) sbody := (string(body)) if utils.Defaultconf { - sbody = "println green neOwOfetchh 🔥\ninfo white username\nprint blue @\ninfoln blue hostname\nprint white uptime: \ninfoln red uptime\nprint white shell: \ninfoln blue shell\nprint white distro: \ninfoln blue distro\nprint white terminal: \ninfoln blue terminal\nprint white memory: \ninfo blue memoryUsed\nprint white /\ninfoln blue memoryAll" + sbody = defaultconfig } fbody := strings.Split(sbody, "\n") for _, line := range fbody { diff --git a/utils/printing.go b/utils/printing.go index 4645bef..677315d 100644 --- a/utils/printing.go +++ b/utils/printing.go @@ -30,12 +30,12 @@ var pngWidth = 12 var pngHeight = 12 var pngData []byte -func Initcolor() { - colorconf := os.Getenv("HOME") + "/.config/neowofetch/colors" - folderconf := filepath.Dir(colorconf) +var colorconf = os.Getenv("HOME") + "/.config/neowofetch/colors" +var folderconf = filepath.Dir(colorconf) +var _, existcolorconf = os.Stat(colorconf) +var _, existfolderconf = os.Stat(folderconf) - _, existcolorconf := os.Stat(colorconf) - _, existfolderconf := os.Stat(folderconf) +func Initcolor() { if os.IsNotExist(existfolderconf) { os.Mkdir(folderconf, os.ModePerm) @@ -180,8 +180,12 @@ func CutePrint( if !colorold { fmt.Printf("%s%s\x1b[0m", parsedFormat.colorFormat, message) } else { - - if colorold && hascolor { + if os.IsNotExist(existcolorconf) { + println("color was not found. a default config file has been generated in '~/.config/neowofetch/colors'. rerun the program") + f, _ := os.Create(colorconf) + _, _ = f.WriteString("red 255 0 0 \ngreen 0 255 0\nblue 0 0 255\nwhite 255 255 255") + os.Exit(0) + } else if colorold && hascolor { switch { case strings.Contains(format, "black"): fmt.Printf("\033[1;30m%s\033[0m", message) @@ -201,6 +205,7 @@ func CutePrint( fmt.Printf("\033[1;37m%s\033[0m", message) case strings.Contains(format, "*"): fmt.Printf("\033[1;37m%s\033[0m", message) + } } }