-
Notifications
You must be signed in to change notification settings - Fork 10
/
flag.go
93 lines (86 loc) · 2.72 KB
/
flag.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
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"os"
"strings"
aflag "github.com/xmdhs/gomclauncher/flag"
"github.com/xmdhs/gomclauncher/lang"
"github.com/xmdhs/gomclauncher/launcher"
)
var f *aflag.Flag = aflag.NewFlag()
var (
credit bool
update bool
list bool
remove bool
ms bool
v bool
tidy bool
buildDate string
buildOn string
uselang string
)
func init() {
f.Gmlconfig = make(aflag.Gmlconfig)
b, err := ioutil.ReadFile("gml.json")
if err != nil {
if os.IsNotExist(err) {
return
}
panic(err)
}
err = json.Unmarshal(b, &f.Gmlconfig)
if err != nil {
fmt.Println(lang.Lang("jsonBreak"))
panic(err)
}
}
func init() {
str, err := os.Getwd()
str = strings.ReplaceAll(str, `\`, `/`)
if err != nil {
panic(err)
}
f.Minecraftpath = str + "/" + launcher.Minecraft
flag.StringVar(&f.Name, "username", "", lang.Lang("username"))
flag.StringVar(&f.Email, "email", "", lang.Lang("emailusage"))
flag.StringVar(&f.Password, "password", "", lang.Lang("emailusage"))
flag.StringVar(&f.Download, "downver", "", lang.Lang("Downloadusage"))
flag.StringVar(&f.Verlist, "verlist", "", lang.Lang("verlistusage"))
flag.IntVar(&f.Downint, "int", 64, lang.Lang("intusage"))
flag.StringVar(&f.Run, "run", "", lang.Lang("runusage"))
flag.BoolVar(&f.Runlist, "runlist", false, lang.Lang("runlistusage"))
flag.StringVar(&f.RAM, "ram", "2048", lang.Lang("ramusage"))
flag.StringVar(&f.Runflag, "flag", "", lang.Lang("flagusage"))
flag.StringVar(&f.Proxy, `proxy`, "", lang.Lang("proxyusage"))
flag.StringVar(&f.Atype, "type", "", lang.Lang("typeusage"))
flag.BoolVar(&f.Independent, "independent", true, lang.Lang("Independentusage"))
flag.BoolVar(&f.Outmsg, "test", true, lang.Lang("testusage"))
flag.BoolVar(&credit, "credits", false, lang.Lang("creditsusage"))
flag.BoolVar(&update, "update", true, lang.Lang("updateusage"))
flag.BoolVar(&f.Log, "log", false, lang.Lang("logusage"))
flag.StringVar(&f.ApiAddress, "yggdrasil", "", lang.Lang("yggdrasilusage"))
flag.BoolVar(&list, "list", false, lang.Lang("listusage"))
flag.BoolVar(&remove, "remove", false, lang.Lang("removeusage"))
flag.StringVar(&f.JavePath, "javapath", "java", lang.Lang("javapathusage"))
flag.BoolVar(&ms, "ms", false, lang.Lang("msusage"))
//flag.StringVar(&uselang, "lang", "", lang.Lang("langusage"))
flag.BoolVar(&v, "v", false, lang.Lang("vusage"))
flag.BoolVar(&tidy, "tidy", false, lang.Lang("tidy"))
flag.Parse()
if uselang != "" {
err := lang.Setlanguge(uselang)
if err != nil {
fmt.Println(lang.Lang("nofindLanguage"))
os.Exit(0)
}
}
}
func credits() {
fmt.Println(lang.Lang("bmclapiinfo"))
fmt.Println(lang.Lang("authlib-injectorinfo"))
fmt.Println(lang.Lang("useproject"))
}