ok you win
This commit is contained in:
parent
c9a1908276
commit
67c52b7be4
2 changed files with 37 additions and 49 deletions
11
main.go
11
main.go
|
@ -13,8 +13,8 @@ import (
|
||||||
|
|
||||||
var isuwuified bool = true
|
var isuwuified bool = true
|
||||||
|
|
||||||
func checkforconfigfolder(){
|
func checkforconfigfolder() {
|
||||||
_, folder := os.Stat(data.GetHome()+"/.config")
|
_, folder := os.Stat(data.GetHome() + "/.config")
|
||||||
if os.IsNotExist(folder) {
|
if os.IsNotExist(folder) {
|
||||||
os.Mkdir(data.GetHome()+"/.config", os.ModePerm)
|
os.Mkdir(data.GetHome()+"/.config", os.ModePerm)
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,9 @@ func handleConfig() {
|
||||||
}
|
}
|
||||||
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"
|
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) {
|
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, _ := os.Create(data.GetConfigFile())
|
||||||
_, _ = f.WriteString(defaultconfig)
|
_, _ = f.WriteString(defaultconfig)
|
||||||
os.Exit(0)
|
}
|
||||||
} else {
|
|
||||||
body, _ := ioutil.ReadFile(data.GetConfigFile())
|
body, _ := ioutil.ReadFile(data.GetConfigFile())
|
||||||
sbody := (string(body))
|
sbody := (string(body))
|
||||||
if utils.Defaultconf {
|
if utils.Defaultconf {
|
||||||
|
@ -49,9 +47,6 @@ func handleConfig() {
|
||||||
rest := strings.Join(word[2:], " ")
|
rest := strings.Join(word[2:], " ")
|
||||||
handlePrint(action, color, rest)
|
handlePrint(action, color, rest)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlePrint(action, format string, rest string) {
|
func handlePrint(action, format string, rest string) {
|
||||||
|
|
|
@ -20,6 +20,17 @@ func rgb(r, g, b int) string {
|
||||||
|
|
||||||
var colors = make(map[string]string)
|
var colors = make(map[string]string)
|
||||||
var oldcolors = make(map[string]int)
|
var oldcolors = make(map[string]int)
|
||||||
|
var color_map = map[string]string{
|
||||||
|
"black": "30",
|
||||||
|
"red": "31",
|
||||||
|
"green": "32",
|
||||||
|
"yellow": "33",
|
||||||
|
"blue": "34",
|
||||||
|
"magenta": "35",
|
||||||
|
"cyan": "36",
|
||||||
|
"white": "37",
|
||||||
|
"*": "37",
|
||||||
|
}
|
||||||
|
|
||||||
var logoIndex = 0
|
var logoIndex = 0
|
||||||
var isInProgressLine = false
|
var isInProgressLine = false
|
||||||
|
@ -41,10 +52,8 @@ func Initcolor() {
|
||||||
os.Mkdir(folderconf, os.ModePerm)
|
os.Mkdir(folderconf, os.ModePerm)
|
||||||
}
|
}
|
||||||
if os.IsNotExist(existcolorconf) {
|
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, _ := os.Create(colorconf)
|
||||||
_, _ = f.WriteString("red 255 0 0 \ngreen 0 255 0\nblue 0 0 255\nwhite 255 255 255")
|
_, _ = f.WriteString("red 255 0 0 \ngreen 0 255 0\nblue 0 0 255\nwhite 255 255 255")
|
||||||
os.Exit(0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c, _ := os.ReadFile(colorconf)
|
c, _ := os.ReadFile(colorconf)
|
||||||
|
@ -184,31 +193,15 @@ func CutePrint(
|
||||||
fmt.Printf("%s%s\x1b[0m", parsedFormat.colorFormat, message)
|
fmt.Printf("%s%s\x1b[0m", parsedFormat.colorFormat, message)
|
||||||
} else {
|
} else {
|
||||||
if os.IsNotExist(existcolorconf) {
|
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, _ := os.Create(colorconf)
|
||||||
_, _ = f.WriteString("red 255 0 0 \ngreen 0 255 0\nblue 0 0 255\nwhite 255 255 255")
|
_, _ = 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 {
|
if colorold && hascolor {
|
||||||
switch {
|
for k, v := range color_map {
|
||||||
case strings.Contains(format, "black"):
|
if strings.Contains(format, k) {
|
||||||
fmt.Printf("\033[1;30m%s\033[0m", message)
|
fmt.Printf("\033[1;%sm%s\033[m", v, message)
|
||||||
case strings.Contains(format, "red"):
|
break
|
||||||
fmt.Printf("\033[1;31m%s\033[0m", message)
|
}
|
||||||
case strings.Contains(format, "green"):
|
|
||||||
fmt.Printf("\033[1;32m%s\033[0m", message)
|
|
||||||
case strings.Contains(format, "yellow"):
|
|
||||||
fmt.Printf("\033[1;33m%s\033[0m", message)
|
|
||||||
case strings.Contains(format, "blue"):
|
|
||||||
fmt.Printf("\033[1;34m%s\033[0m", message)
|
|
||||||
case strings.Contains(format, "magenta"):
|
|
||||||
fmt.Printf("\033[1;35m%s\033[0m", message)
|
|
||||||
case strings.Contains(format, "cyan"):
|
|
||||||
fmt.Printf("\033[1;36m%s\033[0m", message)
|
|
||||||
case strings.Contains(format, "white"):
|
|
||||||
fmt.Printf("\033[1;37m%s\033[0m", message)
|
|
||||||
case strings.Contains(format, "*"):
|
|
||||||
fmt.Printf("\033[1;37m%s\033[0m", message)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue