default config actually does something now. also print > fmt.Print

This commit is contained in:
echo 2022-09-10 11:01:27 +04:30 committed by nea
parent 7270f98d31
commit 9935e437d6
No known key found for this signature in database
GPG key ID: AA563E93EB628D91
4 changed files with 23 additions and 8 deletions

1
go.mod
View file

@ -1,3 +1,4 @@
module github.com/exhq/neowofetch module github.com/exhq/neowofetch
go 1.19 go 1.19

11
go.sum Normal file
View file

@ -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=

View file

@ -38,9 +38,9 @@ func handleConfig() {
} }
if os.IsNotExist(file) { 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, _ := os.Create(getConfigFile())
_, _ = f.WriteString("test\namong") _, _ = f.WriteString("println neOwOfetch 🔥\ninfo username\nprint @\ninfoln distro\nprint uptime: \ninfo uptime")
} else { } else {
body, _ := ioutil.ReadFile(getConfigFile()) body, _ := ioutil.ReadFile(getConfigFile())
fbody := strings.Split(string(body), "\n") fbody := strings.Split(string(body), "\n")
@ -82,6 +82,8 @@ func PrintInfo(infoType string, noUwuOverride bool) {
} else if infoType == "uptime" { } else if infoType == "uptime" {
among, _ := strconv.Atoi(getUptime()) among, _ := strconv.Atoi(getUptime())
util.UwuPrint(formatTime(among), true) util.UwuPrint(formatTime(among), true)
} else if infoType == "distro" {
util.UwuPrint(getDistro(), noUwuOverride)
} }
} }

View file

@ -56,25 +56,26 @@ func initLine() {
logoLine := logoLines[logoIndex] logoLine := logoLines[logoIndex]
logoLineLength := len([]rune(logoLine)) logoLineLength := len([]rune(logoLine))
padding := strings.Repeat(" ", logoWidth-logoLineLength) padding := strings.Repeat(" ", logoWidth-logoLineLength)
fmt.Printf("%s%s", logoLine, padding) print(logoLine, padding)
logoIndex += 1 logoIndex += 1
} else { } else {
fmt.Printf("%s", strings.Repeat(" ", logoWidth)) print(strings.Repeat(" ", logoWidth))
} }
} }
} }
func UwuPrint(message string, noUwuOverride bool) { func UwuPrint(message string, noUwuOverride bool) {
//will add color eventually, my brain hurts
initLine() initLine()
if noUwuOverride || !shouldUwuify { if noUwuOverride || !shouldUwuify {
fmt.Printf("%s", message) print(message)
return return
} }
words := strings.Split(message, " ") words := strings.Split(message, " ")
hadAnyContent := false hadAnyContent := false
for _, word := range words { for _, word := range words {
if word == "" { if word == "" {
fmt.Print(" ") print(" ")
continue continue
} }
word = strings.ReplaceAll(word, "r", "w") word = strings.ReplaceAll(word, "r", "w")
@ -92,11 +93,11 @@ func UwuPrint(message string, noUwuOverride bool) {
word = strings.ReplaceAll(word, "u", "uwu") word = strings.ReplaceAll(word, "u", "uwu")
} }
hadAnyContent = true hadAnyContent = true
fmt.Printf("%s ", word) print(word)
} }
if hadAnyContent && rand.Intn(5) == 0 { if hadAnyContent && rand.Intn(5) == 0 {
fmt.Printf("%s", uwuEmotes[rand.Intn(len(uwuEmotes))]) print(uwuEmotes[rand.Intn(len(uwuEmotes))])
} }
} }