-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
47 lines (40 loc) · 1017 Bytes
/
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
package main
import (
_ "embed"
"strings"
"os"
"github.com/SumDeusVitae/cli-assistant-client/internal/assistant"
"github.com/SumDeusVitae/cli-assistant-client/internal/variables"
"github.com/SumDeusVitae/cli-assistant-client/internal/version"
)
type config struct {
assistantClient assistant.Client
Variables struct {
Login string
Password string
Api string
Version string
Outdated bool
}
}
//go:embed version.txt
var ver string
func main() {
cliClient := assistant.NewClient()
cfg := &config{
assistantClient: cliClient,
}
// Getting local variavbles and storing them in our config struct
cfg.Variables.Login = variables.LoadoadVariable("login")
cfg.Variables.Password = variables.LoadoadVariable("password")
cfg.Variables.Api = variables.LoadoadVariable("apiKey")
cfg.Variables.Version = strings.Trim(ver, "\n")
check, err := version.CheckMajor(cfg.Variables.Version)
if err != nil {
os.Exit(1)
}
if check {
cfg.Variables.Outdated = true
}
runRep(cfg)
}