@@ -19,29 +19,75 @@ var logo = `
19
19
|__/
20
20
`
21
21
22
+ var finish = `
23
+ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
24
+ | |
25
+ | Open http://localhost:3000/ in your browser |
26
+ | to complete the installation! |
27
+ | |
28
+ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
29
+ `
30
+
22
31
func main () {
23
32
fmt .Println (chalk .Yellow .Color (logo ))
24
33
fmt .Println (chalk .Bold .TextStyle ("Installer for Wiki.js 2.x" ))
25
- fmt .Printf ("for %s-%s\n \n " , runtime .GOOS , runtime .GOARCH )
34
+ fmt .Printf ("%s-%s\n \n " , runtime .GOOS , runtime .GOARCH )
35
+
36
+ // Check system requirements
37
+
38
+ fmt .Println (chalk .Bold .TextStyle ("Verifying system requirements..." ))
39
+ CheckNodeJs ()
40
+ CheckRAM ()
41
+ fmt .Println (chalk .Bold .TextStyle ("\n Setup" ))
26
42
27
43
// Prompt for build to install
28
44
29
- prompt := promptui.Select {
45
+ promptBuild := promptui.Select {
30
46
Label : "Select Build to install" ,
31
47
Items : []string {"Stable" , "Dev" },
48
+ Templates : & promptui.SelectTemplates {
49
+ Help : " " ,
50
+ Selected : chalk .Green .Color ("✔" ) + " Build: {{ . }}" ,
51
+ },
32
52
}
33
53
34
- _ , result , err := prompt .Run ()
54
+ _ , _ , err := promptBuild .Run ()
35
55
36
56
if err != nil {
37
57
fmt .Printf ("Prompt failed %v\n " , err )
38
58
return
39
59
}
40
60
41
- fmt .Printf ("You choose %q\n " , result )
61
+ // Choose database driver
62
+
63
+ promptDB := promptui.Select {
64
+ Label : "Select database driver" ,
65
+ Items : []string {"MariaDB" , "MySQL" , "MS SQL Server" , "PostgreSQL" , "SQLite" },
66
+ Templates : & promptui.SelectTemplates {
67
+ Help : " " ,
68
+ Selected : chalk .Green .Color ("✔" ) + " Database Driver: {{ . }}" ,
69
+ },
70
+ Size : 10 ,
71
+ }
72
+
73
+ _ , _ , err = promptDB .Run ()
74
+
75
+ // Port
76
+
77
+ promptPort := promptui.Prompt {
78
+ Label : "Port" ,
79
+ Default : "3000" ,
80
+ Templates : & promptui.PromptTemplates {
81
+ Success : chalk .Green .Color ("✔" ) + " Port: {{ . }}" ,
82
+ },
83
+ }
84
+
85
+ _ , err = promptPort .Run ()
42
86
43
87
// Download archives...
44
88
89
+ fmt .Println (chalk .Bold .TextStyle ("\n Downloading packages..." ))
90
+
45
91
uiprogress .Start ()
46
92
bar := uiprogress .AddBar (100 )
47
93
@@ -51,4 +97,6 @@ func main() {
51
97
for bar .Incr () {
52
98
time .Sleep (time .Millisecond * 20 )
53
99
}
100
+
101
+ fmt .Println ("\n " + chalk .Yellow .Color (finish ))
54
102
}
0 commit comments