-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.jule
60 lines (53 loc) · 1.38 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
// 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/cliq"
use cy "colorify"
use "jpu"
use "std/maps"
use "std/slices"
use "std/sys"
const protonGeURL = "https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases"
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::Init(argMap)
cq.Parse(false)
if !slices::Contains(maps::Values(cq.Res), true) {
println(infoMessage + " No arguments provided. Assuming you want to update.")
update()
}
}
fn update() {
println(infoMessage + " Getting the latest Proton-GE release...")
proton := jpu::GetProton("", protonGeURL) 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)
}