-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.v
More file actions
116 lines (105 loc) · 2.35 KB
/
Copy pathmain.v
File metadata and controls
116 lines (105 loc) · 2.35 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
module main
import cli
fn main() {
// Parse command-line arguments.
mut args := cli.parse_args()
// Load config and initialise Handle with CLI overrides.
// (Config is loaded at startup per pacman's parsearg_global pattern.)
init_res := cli.init_from_args(mut args) or {
eprintln(cli.err(err.msg()))
exit(1)
}
// --transfer: migrate pacman data to ace native directories, then exit.
if args.transfer {
cli.run_transfer(&args, &init_res.handle) or {
eprintln(cli.err(err.msg()))
exit(1)
}
exit(0)
}
// --deptree: display dependency tree, then exit.
if args.deptree {
cli.run_deptree(&args, &init_res.handle) or {
eprintln(cli.err(err.msg()))
exit(1)
}
exit(0)
}
// --history: display transaction history, then exit.
if args.show_history {
cli.run_history(&args, &init_res.handle) or {
eprintln(cli.err(err.msg()))
exit(1)
}
exit(0)
}
// --keyring-init: initialize GPG keyring, then exit.
if args.keyring_init {
cli.run_keyring_init(&init_res.handle) or {
eprintln(cli.err(err.msg()))
exit(1)
}
exit(0)
}
// --keyring-populate: import keyring keys, then exit.
if args.keyring_populate != '' {
cli.run_keyring_populate(&init_res.handle, args.keyring_populate) or {
eprintln(cli.err(err.msg()))
exit(1)
}
exit(0)
}
// Dispatch operation.
mut error_occurred := false
match args.operation {
.query {
cli.run_query(&args, &init_res.cfg, &init_res.handle) or {
eprintln(cli.err(err.msg()))
error_occurred = true
}
}
.deptest {
cli.run_deptest(&args, &init_res.cfg, &init_res.handle) or {
eprintln(cli.err(err.msg()))
error_occurred = true
}
}
.remove {
cli.run_remove(&args, &init_res.cfg, &init_res.handle) or {
eprintln(cli.err(err.msg()))
error_occurred = true
}
}
.upgrade {
cli.run_upgrade(&args, &init_res.cfg, &init_res.handle) or {
eprintln(cli.err(err.msg()))
error_occurred = true
}
}
.sync {
cli.run_sync(&args, &init_res.cfg, &init_res.handle) or {
eprintln(cli.err(err.msg()))
error_occurred = true
}
}
.database {
cli.run_database(&args) or {
eprintln(cli.err(err.msg()))
error_occurred = true
}
}
.files {
cli.run_files(&args) or {
eprintln(cli.err(err.msg()))
error_occurred = true
}
}
.main {
cli.print_usage()
exit(0)
}
}
if error_occurred {
exit(1)
}
}