From 3f42e2d147cb9909542fc2ee07712cd36bf67e6a Mon Sep 17 00:00:00 2001 From: echo <91651232+exhq@users.noreply.github.com> Date: Sat, 10 Sep 2022 11:01:27 +0430 Subject: [PATCH] default config actually does something now. also print > fmt.Print --- go.mod | 1 + go.sum | 11 +++++++++++ main.go | 6 ++++-- util/printing.go | 13 +++++++------ 4 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 go.sum diff --git a/go.mod b/go.mod index 6a67dc1..2e8bfa6 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,4 @@ module github.com/exhq/neowofetch go 1.19 + diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..6ab7ee4 --- /dev/null +++ b/go.sum @@ -0,0 +1,11 @@ +github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/main.go b/main.go index 96e9ce9..8a8485c 100644 --- a/main.go +++ b/main.go @@ -38,9 +38,9 @@ func handleConfig() { } if os.IsNotExist(file) { - println("bruh you aint got tha file? bruh fr fr bruh wtf") + println("config was not found. a default config file has been generated in '~/.config/neowofetch/conf'") f, _ := os.Create(getConfigFile()) - _, _ = f.WriteString("test\namong") + _, _ = f.WriteString("println neOwOfetch 🔥\ninfo username\nprint @\ninfoln distro\nprint uptime: \ninfo uptime") } else { body, _ := ioutil.ReadFile(getConfigFile()) fbody := strings.Split(string(body), "\n") @@ -82,6 +82,8 @@ func PrintInfo(infoType string, noUwuOverride bool) { } else if infoType == "uptime" { among, _ := strconv.Atoi(getUptime()) util.UwuPrint(formatTime(among), true) + } else if infoType == "distro" { + util.UwuPrint(getDistro(), noUwuOverride) } } diff --git a/util/printing.go b/util/printing.go index 376d8b9..1363f15 100644 --- a/util/printing.go +++ b/util/printing.go @@ -56,25 +56,26 @@ func initLine() { logoLine := logoLines[logoIndex] logoLineLength := len([]rune(logoLine)) padding := strings.Repeat(" ", logoWidth-logoLineLength) - fmt.Printf("%s%s", logoLine, padding) + print(logoLine, padding) logoIndex += 1 } else { - fmt.Printf("%s", strings.Repeat(" ", logoWidth)) + print(strings.Repeat(" ", logoWidth)) } } } func UwuPrint(message string, noUwuOverride bool) { + //will add color eventually, my brain hurts initLine() if noUwuOverride || !shouldUwuify { - fmt.Printf("%s", message) + print(message) return } words := strings.Split(message, " ") hadAnyContent := false for _, word := range words { if word == "" { - fmt.Print(" ") + print(" ") continue } word = strings.ReplaceAll(word, "r", "w") @@ -92,11 +93,11 @@ func UwuPrint(message string, noUwuOverride bool) { word = strings.ReplaceAll(word, "u", "uwu") } hadAnyContent = true - fmt.Printf("%s ", word) + print(word) } if hadAnyContent && rand.Intn(5) == 0 { - fmt.Printf("%s", uwuEmotes[rand.Intn(len(uwuEmotes))]) + print(uwuEmotes[rand.Intn(len(uwuEmotes))]) } }