-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.go
157 lines (149 loc) · 4.77 KB
/
main.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
package main
import (
"fmt"
"log"
"runtime"
"github.com/mr-pmillz/pimp-my-shell/v2/cheat"
"github.com/mr-pmillz/pimp-my-shell/v2/extra"
"github.com/mr-pmillz/pimp-my-shell/v2/linux"
"github.com/mr-pmillz/pimp-my-shell/v2/localio"
"github.com/mr-pmillz/pimp-my-shell/v2/macosx"
"github.com/mr-pmillz/pimp-my-shell/v2/nerdfonts"
"github.com/mr-pmillz/pimp-my-shell/v2/tmux"
"github.com/mr-pmillz/pimp-my-shell/v2/vim"
"github.com/mr-pmillz/pimp-my-shell/v2/zsh"
)
// pimpMyShell runs all the installation setup tasks
func pimpMyShell(osType string, dirs *localio.Directories, installedPackages *localio.InstalledPackages) error {
fmt.Println(`
_______________
< Pimp My Shell >
---------------
\
\
\ __---__
_- /--______
__--( / \ )XXXXXXXXXXX\v.
.-XXX( O O )XXXXXXXXXXXXXXX-
/XXX( U ) XXXXXXX\
/XXXXX( )--_ XXXXXXXXXXX\
/XXXXX/ ( O ) XXXXXX \XXXXX\
XXXXX/ / XXXXXX \__ \XXXXX
XXXXXX__/ XXXXXX \__---->
---___ XXX__/ XXXXXX \__ /
\- --__/ ___/\ XXXXXX / ___--/=
\-\ ___/ XXXXXX '--- XXXXXX
\-\/XXX\ XXXXXX /XXXXX
\XXXXXXXXX \ /XXXXX/
\XXXXXX > _/XXXXX/
\XXXXX--__/ __-- XXXX/
-XXXXXXXX--------------- XXXXXX-
\XXXXXXXXXXXXXXXXXXXXXXXXXX/
""VXXXXXXXXXXXXXXXXXXV""`)
switch osType {
case "darwin":
if err := localio.BrewInstallProgram("ca-certificates", "ca-certificates", installedPackages); err != nil {
return err
}
if err := localio.BrewInstallProgram("zsh", "zsh", installedPackages); err != nil {
return err
}
// install gnu-sed because mac BSD sed doesn't work very good
if err := localio.BrewInstallProgram("gnu-sed", "gsed", installedPackages); err != nil {
return err
}
case "linux":
if err := localio.AptInstall(installedPackages, "zsh", "apt-transport-https"); err != nil {
return err
}
if err := linux.CustomTerminalBookmarks(); err != nil {
return err
}
// Install the latest version of golang
if err := localio.DownloadAndInstallLatestVersionOfGolang(dirs.HomeDir, installedPackages); err != nil {
return err
}
}
// install oh-my-zsh if not already installed
if err := zsh.InstallOhMyZsh(osType, dirs); err != nil {
return err
}
// install oh-my-tmux and tpm
if err := tmux.InstallOhMyTmux(osType, dirs, installedPackages); err != nil {
return err
}
// install extra packages
if err := extra.InstallExtraPackages(osType, dirs, installedPackages); err != nil {
return err
}
// install awesome vim configuration
if err := vim.InstallVimAwesome(osType, dirs, installedPackages); err != nil {
return err
}
// install cheat
if err := cheat.InstallCheat(osType, dirs, installedPackages); err != nil {
return err
}
// install nerdfonts
if err := nerdfonts.InstallNerdFontsLSD(osType, dirs, installedPackages); err != nil {
return err
}
fmt.Println("To Customize Powerlevel10k Theme, Run")
fmt.Println("p10k configure")
fmt.Println(`
______________________
< See you >
----------------------
\
\
.::!!!!!!!:.
.!!!!!:. .:!!!!!!!!!!!!
~~~~!!!!!!. .:!!!!!!!!!UWWW$$$
:$$NWX!!: .:!!!!!!XUWW$$$$$$$$$P
$$$$$##WX!: .<!!!!UW$$$$" $$$$$$$$#
$$$$$ $$$UX :!!UW$$$$$$$$$ 4$$$$$*
^$$$B $$$$\ $$$$$$$$$$$$ d$$R"
"*$bd$$$$ '*$$$$$$$$$$$o+#"
"""" """""""`)
return tmux.StartTMUX()
}
func main() {
dirs, err := localio.NewDirectories()
if err != nil {
log.Panic(err)
}
var packages = &localio.InstalledPackages{}
os := runtime.GOOS
switch os {
case "windows":
fmt.Println("[-] Doesn't work for Windows yet...")
case "darwin":
fmt.Println("[+] Pimping your Mac Terminal")
if err = macosx.InstallHomebrew(dirs); err != nil {
log.Panic(err)
}
// generate the brew installed cli cache
installedBrewPackages, err := localio.NewBrewInstalled()
if err != nil {
log.Panic(err)
}
packages.BrewInstalledPackages = installedBrewPackages
if err = pimpMyShell(os, dirs, packages); err != nil {
log.Panic(err)
}
case "linux":
fmt.Println("[+] Pimping your Linux Terminal")
// generate apt installed cli cache
installedAptPackages, err := localio.NewAptInstalled()
if err != nil {
log.Panic(err)
}
packages.AptInstalledPackages = installedAptPackages
// do linux pimp my shell work
if err = pimpMyShell(os, dirs, packages); err != nil {
log.Panic(err)
}
default:
fmt.Printf("Unknown OS: %s .\n", os)
}
}