Skip to content

Commit 642e7cf

Browse files
committed
Add Linting Changes
1 parent 0a8dfdf commit 642e7cf

4 files changed

Lines changed: 39 additions & 33 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ go build
6565

6666
[xterm-256](https://github.com/gilliek/go-xterm256) - Color Printing To Terminal
6767

68-
[neofetch](https://github.com/dylanaraps/neofetch) - Inspiration and Ascii Art
68+
[neofetch](https://github.com/dylanaraps/neofetch) - Inspiration and ASCII Art
6969

7070

7171
## Contribution

config.go

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,25 @@ import (
66
"os/user"
77
)
88

9+
// Config Struct for Configuration File
910
type Config struct {
10-
Format []string `json:"format"`
11-
ShowAscii bool `json:"showAscii"`
12-
UseDefaultColors bool `json:"useDefaultColors"`
13-
UseSmallAscii bool `json:"useSmallAscii"`
14-
AsciiColor string `json:"asciiColor"`
15-
UseCustomAscii bool `json:"useCustomAscii"`
16-
CustomAsciiPath string `json:"customAsciiPath"`
17-
UserColor string `json:"userColor"`
18-
SepColor string `json:"sepColor"`
19-
TitleColor string `json:"titleColor"`
20-
InfoColor string `json:"infoColor"`
21-
Titles TitleValues `json:"titles"`
22-
AutoUpdate bool `json:"autoupdate"`
23-
Version int64 `json:"configVersion"`
11+
Format []string `json:"format"` // Format Array for Modules
12+
ShowASCII bool `json:"showASCII"` // True/False to Display ASCII
13+
UseDefaultColors bool `json:"useDefaultColors"` // Use Default Colors
14+
UseSmallASCII bool `json:"useSmallASCII"` // Use Small ASCII Art
15+
ASCIIColor string `json:"ASCIIColor"` // Change ASCII Color
16+
UseCustomASCII bool `json:"useCustomASCII"` // Use Custom ASCII TRUE/FALSE
17+
CustomASCIIPath string `json:"customASCIIPath"` // Absolute Path to Custom ASCII
18+
UserColor string `json:"userColor"` // Color for Username
19+
SepColor string `json:"sepColor"` // Color for Separator
20+
TitleColor string `json:"titleColor"` // Color for Title
21+
InfoColor string `json:"infoColor"` // Color for Information
22+
Titles TitleValues `json:"titles"` // Title Struct
23+
AutoUpdate bool `json:"autoupdate"` // Should Auto Update?
24+
Version int64 `json:"configVersion"` // Configuration Version
2425
}
2526

27+
// TitleValues Struct for Title Strings
2628
type TitleValues struct {
2729
Memory string `json:"memory"`
2830
CPU string `json:"cpu"`
@@ -50,12 +52,12 @@ func updateConfig(config Config) {
5052
func newConfig() Config {
5153
config := Config{}
5254
config.Format = []string{"user", "sep", "uptime", "mem", "cpu", "procs", "cpuCores", "cpuThreads", "disk", "wversion", "gpus", "bios", "baseboard"}
53-
config.ShowAscii = true
54-
config.UseSmallAscii = false
55-
config.UseCustomAscii = false
56-
config.CustomAsciiPath = ""
55+
config.ShowASCII = true
56+
config.UseSmallASCII = false
57+
config.UseCustomASCII = false
58+
config.CustomASCIIPath = ""
5759
config.UseDefaultColors = true
58-
config.AsciiColor = "Blue"
60+
config.ASCIIColor = "Blue"
5961
config.UserColor = "Red"
6062
config.SepColor = "Red"
6163
config.TitleColor = "Green"

helpers.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
hst "github.com/shirou/gopsutil/host"
1212
ps "github.com/shirou/gopsutil/process"
13-
// cp "github.com/shirou/gopsutil/cpu"
13+
1414
"github.com/gilliek/go-xterm256/xterm256"
1515
"github.com/jaypipes/ghw"
1616
"golang.org/x/sys/windows/registry"
@@ -25,6 +25,7 @@ func indexOf(element string, data []string) int {
2525
return -1 //not found.
2626
}
2727

28+
// Find - Find String inside String
2829
func Find(slice []string, val string) (int, bool) {
2930
for i, item := range slice {
3031
if item == val {
@@ -34,6 +35,7 @@ func Find(slice []string, val string) (int, bool) {
3435
return -1, false
3536
}
3637

38+
// RoundUp - Round Float Up To New Value
3739
func RoundUp(input float64, places int) (newVal float64) {
3840
var round float64
3941
pow := math.Pow(10, float64(places))
@@ -43,6 +45,7 @@ func RoundUp(input float64, places int) (newVal float64) {
4345
return
4446
}
4547

48+
// ByteFormat - Format Bytes to Human Readable
4649
func ByteFormat(inputNum float64, precision int) string {
4750

4851
if precision <= 0 {

main.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import (
44
"bufio"
55
"encoding/json"
66
"fmt"
7-
"github.com/gilliek/go-xterm256/xterm256"
87
"io/ioutil"
98
"log"
109
"net/http"
1110
"os"
1211
"os/user"
1312
"strings"
1413
"unicode/utf8"
14+
15+
"github.com/gilliek/go-xterm256/xterm256"
1516
)
1617

1718
func getCustomColor(color string) xterm256.Color {
@@ -156,42 +157,42 @@ func main() {
156157
}
157158
}
158159
var winArtResult []string
159-
if config.UseSmallAscii {
160+
if config.UseSmallASCII {
160161
winArtResult = strings.Split(winArtSmall, "\n")
161162
} else {
162163
winArtResult = strings.Split(winArt, "\n")
163164
}
164-
if config.UseCustomAscii {
165-
content, err := ioutil.ReadFile(config.CustomAsciiPath)
165+
if config.UseCustomASCII {
166+
content, err := ioutil.ReadFile(config.CustomASCIIPath)
166167
if err != nil {
167168
log.Fatal(err)
168169
}
169170
winArtResult = strings.Split(string(content), "\n")
170171
}
171172

172173
title := xterm256.Green
173-
ascii := xterm256.Blue
174+
ASCII := xterm256.Blue
174175
sep := xterm256.Red
175176
userc := xterm256.Red
176177
info := xterm256.White
177178

178179
if !config.UseDefaultColors {
179180
title = getCustomColor(config.TitleColor)
180-
ascii = getCustomColor(config.AsciiColor)
181+
ASCII = getCustomColor(config.ASCIIColor)
181182
sep = getCustomColor(config.SepColor)
182183
userc = getCustomColor(config.UserColor)
183184
info = getCustomColor(config.InfoColor)
184185
}
185186
s = generateInfo(config, title, info, userc, sep)
186-
if config.ShowAscii {
187+
if config.ShowASCII {
187188
scanner := bufio.NewScanner(strings.NewReader(""))
188-
if config.UseSmallAscii {
189+
if config.UseSmallASCII {
189190
scanner = bufio.NewScanner(strings.NewReader(winArtSmall))
190191
} else {
191192
scanner = bufio.NewScanner(strings.NewReader(winArt))
192193
}
193-
if config.UseCustomAscii {
194-
content, err := ioutil.ReadFile(config.CustomAsciiPath)
194+
if config.UseCustomASCII {
195+
content, err := ioutil.ReadFile(config.CustomASCIIPath)
195196
if err != nil {
196197
log.Fatal(err)
197198
}
@@ -203,12 +204,12 @@ func main() {
203204
if len(winArtResult)-1 < i {
204205
fmt.Println(strings.Repeat(" ", utf8.RuneCountInString(winArtResult[0])) + " " + str)
205206
} else {
206-
fmt.Println(xterm256.Sprint(ascii, winArtResult[i]) + " " + str)
207+
fmt.Println(xterm256.Sprint(ASCII, winArtResult[i]) + " " + str)
207208
}
208209
}
209210
for scanner.Scan() {
210211
if index >= len(s) {
211-
fmt.Println(xterm256.Sprint(ascii, scanner.Text()))
212+
fmt.Println(xterm256.Sprint(ASCII, scanner.Text()))
212213
}
213214
index++
214215
}

0 commit comments

Comments
 (0)