fixed the default config and some other stuff idk
This commit is contained in:
parent
51f01af6d8
commit
dcc3c10bb3
3 changed files with 18 additions and 14 deletions
|
@ -99,7 +99,7 @@ var xerolinux string
|
||||||
var windows string
|
var windows string
|
||||||
|
|
||||||
func GetAsciiInternal(distroID string) string {
|
func GetAsciiInternal(distroID string) string {
|
||||||
switch distroID {
|
switch strings.ToLower(distroID) {
|
||||||
case "alpine":
|
case "alpine":
|
||||||
return alpine
|
return alpine
|
||||||
case "arcolinux":
|
case "arcolinux":
|
||||||
|
@ -150,9 +150,7 @@ func GetAsciiInternal(distroID string) string {
|
||||||
return void
|
return void
|
||||||
case "xerolinux":
|
case "xerolinux":
|
||||||
return xerolinux
|
return xerolinux
|
||||||
case "arch":
|
case "arch", "Archcraft":
|
||||||
return arch
|
|
||||||
case "Archcraft":
|
|
||||||
return arch
|
return arch
|
||||||
case "windows":
|
case "windows":
|
||||||
return windows
|
return windows
|
||||||
|
|
7
main.go
7
main.go
|
@ -19,16 +19,17 @@ func handleConfig() {
|
||||||
if os.IsNotExist(folder) {
|
if os.IsNotExist(folder) {
|
||||||
os.Mkdir(filepath.Dir(data.GetConfigFile()), os.ModePerm)
|
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) {
|
if os.IsNotExist(file) {
|
||||||
println("config was not found. a default config file has been generated in '~/.config/neowofetch/conf'. rerun the program")
|
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("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 {
|
} else {
|
||||||
body, _ := ioutil.ReadFile(data.GetConfigFile())
|
body, _ := ioutil.ReadFile(data.GetConfigFile())
|
||||||
sbody := (string(body))
|
sbody := (string(body))
|
||||||
if utils.Defaultconf {
|
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")
|
fbody := strings.Split(sbody, "\n")
|
||||||
for _, line := range fbody {
|
for _, line := range fbody {
|
||||||
|
|
|
@ -30,12 +30,12 @@ var pngWidth = 12
|
||||||
var pngHeight = 12
|
var pngHeight = 12
|
||||||
var pngData []byte
|
var pngData []byte
|
||||||
|
|
||||||
func Initcolor() {
|
var colorconf = os.Getenv("HOME") + "/.config/neowofetch/colors"
|
||||||
colorconf := os.Getenv("HOME") + "/.config/neowofetch/colors"
|
var folderconf = filepath.Dir(colorconf)
|
||||||
folderconf := filepath.Dir(colorconf)
|
var _, existcolorconf = os.Stat(colorconf)
|
||||||
|
var _, existfolderconf = os.Stat(folderconf)
|
||||||
|
|
||||||
_, existcolorconf := os.Stat(colorconf)
|
func Initcolor() {
|
||||||
_, existfolderconf := os.Stat(folderconf)
|
|
||||||
|
|
||||||
if os.IsNotExist(existfolderconf) {
|
if os.IsNotExist(existfolderconf) {
|
||||||
os.Mkdir(folderconf, os.ModePerm)
|
os.Mkdir(folderconf, os.ModePerm)
|
||||||
|
@ -180,8 +180,12 @@ func CutePrint(
|
||||||
if !colorold {
|
if !colorold {
|
||||||
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 colorold && hascolor {
|
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 {
|
switch {
|
||||||
case strings.Contains(format, "black"):
|
case strings.Contains(format, "black"):
|
||||||
fmt.Printf("\033[1;30m%s\033[0m", message)
|
fmt.Printf("\033[1;30m%s\033[0m", message)
|
||||||
|
@ -201,6 +205,7 @@ func CutePrint(
|
||||||
fmt.Printf("\033[1;37m%s\033[0m", message)
|
fmt.Printf("\033[1;37m%s\033[0m", message)
|
||||||
case strings.Contains(format, "*"):
|
case strings.Contains(format, "*"):
|
||||||
fmt.Printf("\033[1;37m%s\033[0m", message)
|
fmt.Printf("\033[1;37m%s\033[0m", message)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue