Skip to content

Commit 8b48761

Browse files
committed
Clean Up Config
1 parent 10d5bd0 commit 8b48761

File tree

2 files changed

+27
-47
lines changed

2 files changed

+27
-47
lines changed

config.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,6 @@ package main
22

33
type Config struct {
44
Format []string `json:"format"`
5-
ShowUser bool `json:"showUser"`
6-
ShowSep bool `json:"showSep"`
7-
ShowUptime bool `json:"showUptime"`
8-
ShowMem bool `json:"showMem"`
9-
ShowCPU bool `json:"showCPU"`
10-
ShowTotalCPUCores bool `json:"showTotalCPUCores"`
11-
ShowTotalCPUThreads bool `json:"showTotalCPUThreads"`
12-
ShowGPUS bool `json:"showGPUS"`
13-
ShowTotalDiskSize bool `json:"showTotalDiskSize"`
14-
ShowWindowsVersion bool `json:"showWindowsVersion"`
15-
ShowBios bool `json:"showBios"`
16-
ShowBaseboard bool `json:"showBaseboard"`
17-
ShowProcessCount bool `json:"showProcessCount"`
185
ShowAscii bool `json:"showAscii"`
196
UseDefaultColors bool `json:"useDefaultColors"`
207
UseSmallAscii bool `json:"useSmallAscii"`
@@ -45,20 +32,7 @@ type TitleValues struct {
4532
func newConfig() Config {
4633
config := Config{}
4734
config.Format = []string{"user", "sep", "uptime", "mem", "cpu", "procs", "cpuCores", "cpuThreads", "disk", "wversion", "gpus", "bios", "baseboard"}
48-
config.ShowUser = true
49-
config.ShowUptime = true
50-
config.ShowSep = true
51-
config.ShowMem = true
52-
config.ShowCPU = true
53-
config.ShowTotalCPUCores = true
54-
config.ShowTotalCPUThreads = true
55-
config.ShowGPUS = true
56-
config.ShowTotalDiskSize = true
57-
config.ShowWindowsVersion = true
58-
config.ShowBios = true
59-
config.ShowBaseboard = true
6035
config.ShowAscii = true
61-
config.ShowProcessCount = true
6236
config.UseSmallAscii = false
6337
config.UseCustomAscii = false
6438
config.CustomAsciiPath = ""

main.go

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -151,28 +151,34 @@ llllllllllll lllllllllllllllll
151151
info = getCustomColor(config.InfoColor)
152152
}
153153
s = generateInfo(config, title, info, userc, sep)
154-
scanner := bufio.NewScanner(strings.NewReader(""))
155-
if (config.UseSmallAscii){
156-
scanner = bufio.NewScanner(strings.NewReader(winArtSmall))
157-
} else {
158-
scanner = bufio.NewScanner(strings.NewReader(winArt))
159-
}
160-
if (config.UseCustomAscii){
161-
content, err := ioutil.ReadFile(config.CustomAsciiPath)
162-
if (err != nil) {
163-
log.Fatal(err)
154+
if (config.ShowAscii){
155+
scanner := bufio.NewScanner(strings.NewReader(""))
156+
if (config.UseSmallAscii){
157+
scanner = bufio.NewScanner(strings.NewReader(winArtSmall))
158+
} else {
159+
scanner = bufio.NewScanner(strings.NewReader(winArt))
164160
}
165-
text := string(content)
166-
scanner = bufio.NewScanner(strings.NewReader(text))
167-
}
168-
index := 0
169-
for i, str := range s {
170-
fmt.Println(xterm256.Sprint(ascii, winArtResult[i]) + " " + str)
171-
}
172-
for scanner.Scan() {
173-
if index >= len(s) {
174-
fmt.Println(xterm256.Sprint(ascii, scanner.Text()))
161+
if (config.UseCustomAscii){
162+
content, err := ioutil.ReadFile(config.CustomAsciiPath)
163+
if (err != nil) {
164+
log.Fatal(err)
165+
}
166+
text := string(content)
167+
scanner = bufio.NewScanner(strings.NewReader(text))
168+
}
169+
index := 0
170+
for i, str := range s {
171+
fmt.Println(xterm256.Sprint(ascii, winArtResult[i]) + " " + str)
172+
}
173+
for scanner.Scan() {
174+
if index >= len(s) {
175+
fmt.Println(xterm256.Sprint(ascii, scanner.Text()))
176+
}
177+
index++
178+
}
179+
} else {
180+
for _, str := range s {
181+
fmt.Println(str)
175182
}
176-
index++
177183
}
178184
}

0 commit comments

Comments
 (0)