-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
79 lines (73 loc) · 2.12 KB
/
Copy pathmain.go
File metadata and controls
79 lines (73 loc) · 2.12 KB
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
package main
import (
"errors"
"flag"
"fmt"
"os"
"github.com/fxManagerProject/cli-installer/internal/actions"
"github.com/fxManagerProject/cli-installer/internal/config"
"github.com/fxManagerProject/cli-installer/internal/platform"
"github.com/fxManagerProject/cli-installer/internal/theme"
"github.com/fxManagerProject/cli-installer/internal/ui"
)
func main() {
platformValue, err := platform.Detect()
if err != nil {
fmt.Fprintln(os.Stderr, "error:", err)
os.Exit(2)
}
params := []config.Param{
{
Key: "action",
Flag: "action",
Usage: "What do you want to do?",
Prompt: true,
Options: []config.Option{
{Value: "install", Title: "Install", Desc: "Fresh fxServer & fxManager installation"},
{Value: "update-fxmanager", Title: "Update fxManager", Desc: "Update fxManager installation"},
{Value: "update-fxserver", Title: "Update fxServer", Desc: "Update fxServer installation"},
{Value: "update-all", Title: "Update all", Desc: "Update fxManager and fxServer installations"},
},
},
{
Key: "dir",
Flag: "dir",
Usage: "Directory for the installation or directory where the project is located",
Default: "./",
},
{
Key: "os",
Flag: "os",
Usage: fmt.Sprintf("Operating system (current: %s)", string(platformValue)),
Default: string(platformValue),
Action: "install",
},
{
Key: "cfxlicense",
Flag: "cfxlicense",
Usage: "CFX license key used in creating server.cfg (obtained from https://portal.cfx.re/servers/registration-keys)",
Prompt: true,
PromptType: config.PromptInput,
Action: "install",
},
{
Key: "artifact",
Flag: "artifact",
Usage: "Define the Artifact version to install/update to (i.e. 32561)",
Default: "",
},
}
res, err := config.Parse(params)
if err != nil {
if errors.Is(err, flag.ErrHelp) {
os.Exit(0)
}
fmt.Fprintln(os.Stderr, "error:", err)
os.Exit(2)
}
// Run UI with actions.Build routing the task creation
if err := ui.Run(theme.Default(), res, actions.Build); err != nil {
fmt.Fprintln(os.Stderr, "install failed:", err)
os.Exit(1)
}
}