blob: 299b70d3a314d5fbb27044f080910fc782aa0056 (
plain)
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
|
/*
pow! - the pow!erful package manager
Copyright (C) 2026 forever2k38
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "args.h"
#include "build.h"
#include "config.h"
#include "repo.h"
#include "log.h"
#include "curl/curl.h"
#include "stdio.h"
#include "stdlib.h"
int main(int argc, char *argv[]) {
curl_global_init(CURL_GLOBAL_ALL);
pow_args args = {0};
pow_args_parse(argc, argv, &args);
if (args.flags & POW_FLAG_HELP) {
pow_args_print_help();
curl_global_cleanup();
return 0;
}
pow_config config = {0};
pow_open_config(&config, args.cfg_path);
if (args.flags & POW_FLAG_QUERY) {
pow_repo_check_package(&config, args.package);
}
if (args.flags & POW_FLAG_SYNC) {
pow_package *pkg = malloc(sizeof(pow_package));
if (pow_repo_get_package(&config, pkg,
args.package)) {
pow_log_error("failed to get package");
return 1;
}
pow_package_build(pkg);
pow_package_close(pkg);
}
if (args.flags == 0) {
pow_log_error("no command specified");
}
pow_close_config(&config);
fflush(stdout);
curl_global_cleanup();
return 0;
}
|