-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.go
44 lines (35 loc) · 1.01 KB
/
install.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
package main
import (
"ghaf-installer/screen"
"reflect"
"time"
"github.com/pterm/pterm"
)
func showcase(title string, seconds int, content func()) {
pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgBlue)).
WithTextStyle(pterm.NewStyle(pterm.FgWhite, pterm.BgBlue, pterm.Bold)).
WithFullWidth().
Println(title)
pterm.Println()
time.Sleep(time.Second / 2)
content()
time.Sleep(time.Second * time.Duration(seconds))
print("\033[H\033[2J")
}
func main() {
// use for retrieving methods
var methodlist screen.ScreensMethods
// Look for all screens in folder ./screen
screen.InitScreen()
for (screen.GetCurrentScreen()) < len(screen.Screens) {
currentScreen := screen.GetCurrentScreen()
screenHeading := reflect.ValueOf(methodlist).
MethodByName(screen.Screens[currentScreen] + "Heading").
Call(nil)[0].
Interface().(string)
screenFunc := reflect.ValueOf(methodlist).
MethodByName(screen.Screens[currentScreen]).
Interface().(func())
showcase(screenHeading, 2, screenFunc)
}
}