forked from NikonP/fetchfetch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfetchfetch.go
87 lines (72 loc) · 1.79 KB
/
fetchfetch.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package main
// WARNING: The code that follows may make you cry:
// A Safety Pig has been provided below for your benefit
// _
// _._ _..._ .-', _.._(`))
// '-. ` ' /-._.-' ',/
// ) \ '.
// / _ _ | \
// | a a / |
// \ .-. ;
// '-('' ).-' ,' ;
// '-; | .'
// \ \ /
// | 7 .__ _.-\ \
// | | | ``/ /` /
// /,_| | /,_/ /
// /,_/ '`-'
import (
"os/exec"
"github.com/fatih/color"
)
var fetches = []string{
"fetchfetch",
"shutthefetchup",
"nofetch",
"neofetch",
"pfetch",
"ramfetch",
"ufetch",
"nerdfetch",
"archfetch",
"cfetch",
"onefetch",
"hyfetch",
"uwufetch",
"picofetch",
"macchima",
"minifetch",
"paleofetch",
"cpufetch",
"gpufetch",
}
func fetchExists(fetch string) bool {
_, err := exec.LookPath(fetch)
return err == nil
}
func main() {
headerStyle := color.New(color.FgGreen)
headerStyle.Add(color.Bold)
fetchStyle := color.New(color.BgCyan)
fetchStyle.Add(color.FgBlack)
isInstalledStyle := color.New(color.FgGreen)
isNotInstalledStyle := color.New(color.FgRed)
cyan := color.New(color.FgCyan)
omgStyle := color.New(color.FgRed)
omgStyle.Add(color.BlinkSlow)
headerStyle.Print("### FetchFetch ###\n\n")
installedCount := 0
for _, fetch := range fetches {
fetchStyle.Printf("%20s", fetch)
if fetchExists(fetch) {
isInstalledStyle.Println(" is installed")
installedCount += 1
} else {
isNotInstalledStyle.Println(" is not installed")
}
}
cyan.Printf("\nFetches installed: %d\n", installedCount)
if installedCount == 0 {
omgStyle.Println("OMG no fetches installed!!!")
}
}