-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.jule
65 lines (56 loc) · 1.48 KB
/
main.jule
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
// jpu CLI
// Copyright 2025 Adam Perkowski.
// Use of this source code is governed by the BSD 3-Clause License.
// See the LICENSE file for details.
use cq "cliq"
use cy "colorify"
use "jpu"
use "std/sys"
const protonGeURL = "https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases"
const defaultInstallDir = "~/.steam/root/compatibilitytools.d/"
static argMap: map[int][2]str = {}
static successMessage = cy::Colorify("#", cy::Style{
Foreground: cy::Foreground.Green,
Background: cy::Background.Black,
})
static infoMessage = cy::Colorify("*", cy::Style{
Foreground: cy::Foreground.Blue,
Background: cy::Background.Black,
})
static errorMessage = cy::Colorify("!", cy::Style{
Foreground: cy::Foreground.Red,
Background: cy::Background.Black,
})
fn main() {
mut cq := cq::Builder{
Args: {
"dir": defaultInstallDir,
},
}.Help().Build()
cq.GetCLI()
cq.Parse()
mut dir := str(cq.Get("dir"))
println(infoMessage + " No arguments provided. Assuming you want to update.")
update(dir)
}
fn update(mut installDir: str) {
println(infoMessage + " Getting the latest Proton-GE release...")
proton := jpu::GetProton("", protonGeURL, installDir) else {
handleErr(error)
ret
}
println(infoMessage + " Downloading...")
proton.Download() else {
handleErr(error)
}
println(infoMessage + " Installing...")
proton.Install() else {
handleErr(error)
}
println(successMessage + " Done!")
}
fn handleErr(err: any) {
print(errorMessage + " ")
println(err)
sys::Exit(1)
}