From 5cc0fc3652bdc9373d0b6be47fb4b83550839667 Mon Sep 17 00:00:00 2001 From: echo <91651232+exhq@users.noreply.github.com> Date: Tue, 4 Oct 2022 14:05:41 +0330 Subject: [PATCH] added no config settings, and like 3 letters to a string. --- main.go | 7 +++++-- utils/args.go | 6 ++++++ utils/printing.go | 12 ++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 78d068f..9855202 100644 --- a/main.go +++ b/main.go @@ -21,12 +21,15 @@ func handleConfig() { } if os.IsNotExist(file) { - println("config was not found. a default config file has been generated in '~/.config/neowofetch/conf'") + 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 magenta 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("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") } 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" + } fbody := strings.Split(sbody, "\n") for _, line := range fbody { word := strings.Split(line, " ") diff --git a/utils/args.go b/utils/args.go index 201a46f..798c2f9 100644 --- a/utils/args.go +++ b/utils/args.go @@ -15,6 +15,8 @@ var Customascii = false var asciidir string var asciiforced = false var forceddistro string +var Defaultconf bool = false +var Defaultcolor bool = false func Gethn() string { cmd := exec.Command("whoami") @@ -41,6 +43,10 @@ func Initargs() { usepng = true case "--nocolor": hascolor = false + case "--noconf": + Defaultconf = true + case "--nocolorconf": + Defaultcolor = true } } } diff --git a/utils/printing.go b/utils/printing.go index 179c8ab..0f474be 100644 --- a/utils/printing.go +++ b/utils/printing.go @@ -46,7 +46,11 @@ func Initcolor() { os.Exit(0) } - content, _ := os.ReadFile(colorconf) + c, _ := os.ReadFile(colorconf) + content := string(c) + if Defaultcolor { + content = "red 255 0 0 \ngreen 0 255 0\nblue 0 0 255\nwhite 255 255 255" + } lines := strings.Split(string(content), "\n") for _, line := range lines { word := strings.Split(line, " ") @@ -99,14 +103,14 @@ func printLogoIfAtBeginningOfNewLine() { } } -func uwuify(message string) (ret string) { +func uwuify(message string) string { sentence := strings.Split(message, " ") - ret = "" + ret := "" for i, word := range sentence { if !strings.Contains(strings.ToLower(word), "uwu") { word = strings.ReplaceAll(word, "u", "UwU") - if strings.Contains(strings.ToLower(word), "owo") { + if !strings.Contains(strings.ToLower(word), "owo") { word = strings.ReplaceAll(word, "o", "OwO") } word = strings.ReplaceAll(word, "r", "w")