Skip to content

Commit

Permalink
Clean Up Config
Browse files Browse the repository at this point in the history
  • Loading branch information
frenchie0x4ff committed May 22, 2020
1 parent 10d5bd0 commit 8b48761
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 47 deletions.
26 changes: 0 additions & 26 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@ package main

type Config struct {
Format []string `json:"format"`
ShowUser bool `json:"showUser"`
ShowSep bool `json:"showSep"`
ShowUptime bool `json:"showUptime"`
ShowMem bool `json:"showMem"`
ShowCPU bool `json:"showCPU"`
ShowTotalCPUCores bool `json:"showTotalCPUCores"`
ShowTotalCPUThreads bool `json:"showTotalCPUThreads"`
ShowGPUS bool `json:"showGPUS"`
ShowTotalDiskSize bool `json:"showTotalDiskSize"`
ShowWindowsVersion bool `json:"showWindowsVersion"`
ShowBios bool `json:"showBios"`
ShowBaseboard bool `json:"showBaseboard"`
ShowProcessCount bool `json:"showProcessCount"`
ShowAscii bool `json:"showAscii"`
UseDefaultColors bool `json:"useDefaultColors"`
UseSmallAscii bool `json:"useSmallAscii"`
Expand Down Expand Up @@ -45,20 +32,7 @@ type TitleValues struct {
func newConfig() Config {
config := Config{}
config.Format = []string{"user", "sep", "uptime", "mem", "cpu", "procs", "cpuCores", "cpuThreads", "disk", "wversion", "gpus", "bios", "baseboard"}
config.ShowUser = true
config.ShowUptime = true
config.ShowSep = true
config.ShowMem = true
config.ShowCPU = true
config.ShowTotalCPUCores = true
config.ShowTotalCPUThreads = true
config.ShowGPUS = true
config.ShowTotalDiskSize = true
config.ShowWindowsVersion = true
config.ShowBios = true
config.ShowBaseboard = true
config.ShowAscii = true
config.ShowProcessCount = true
config.UseSmallAscii = false
config.UseCustomAscii = false
config.CustomAsciiPath = ""
Expand Down
48 changes: 27 additions & 21 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,28 +151,34 @@ llllllllllll lllllllllllllllll
info = getCustomColor(config.InfoColor)
}
s = generateInfo(config, title, info, userc, sep)
scanner := bufio.NewScanner(strings.NewReader(""))
if (config.UseSmallAscii){
scanner = bufio.NewScanner(strings.NewReader(winArtSmall))
} else {
scanner = bufio.NewScanner(strings.NewReader(winArt))
}
if (config.UseCustomAscii){
content, err := ioutil.ReadFile(config.CustomAsciiPath)
if (err != nil) {
log.Fatal(err)
if (config.ShowAscii){
scanner := bufio.NewScanner(strings.NewReader(""))
if (config.UseSmallAscii){
scanner = bufio.NewScanner(strings.NewReader(winArtSmall))
} else {
scanner = bufio.NewScanner(strings.NewReader(winArt))
}
text := string(content)
scanner = bufio.NewScanner(strings.NewReader(text))
}
index := 0
for i, str := range s {
fmt.Println(xterm256.Sprint(ascii, winArtResult[i]) + " " + str)
}
for scanner.Scan() {
if index >= len(s) {
fmt.Println(xterm256.Sprint(ascii, scanner.Text()))
if (config.UseCustomAscii){
content, err := ioutil.ReadFile(config.CustomAsciiPath)
if (err != nil) {
log.Fatal(err)
}
text := string(content)
scanner = bufio.NewScanner(strings.NewReader(text))
}
index := 0
for i, str := range s {
fmt.Println(xterm256.Sprint(ascii, winArtResult[i]) + " " + str)
}
for scanner.Scan() {
if index >= len(s) {
fmt.Println(xterm256.Sprint(ascii, scanner.Text()))
}
index++
}
} else {
for _, str := range s {
fmt.Println(str)
}
index++
}
}

0 comments on commit 8b48761

Please sign in to comment.