FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mcpp/src/cli/cmd_cache.cppm at main · mcpp-community/mcpp · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
mcpp-community
/
mcpp
Public
Notifications
You must be signed in to change notification settings
Fork
12
Star
109
Code
Issues
35
Pull requests
6
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
mcpp
/
src
/
cli
/
cmd_cache.cppm
Copy path
More file actions
More file actions
Latest commit
History
History
History
74 lines (62 loc) · 2.43 KB
Breadcrumbs
mcpp
/
src
/
cli
/
cmd_cache.cppm
Copy path
File metadata and controls
74 lines (62 loc) · 2.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
//
mcpp.cli.cmd_cache — CLI parsing + routing for the `mcpp cache` family.
//
Implementations live in mcpp.bmi_cache.maintenance.
module
;
#
include
<
cstdio
>
#
include
<
cstdlib
>
export
module
mcpp.cli.cmd_cache;
import
std;
import
mcpplibs.cmdline;
import
mcpp.bmi_cache.maintenance;
import
mcpp.ui;
import
mcpp.wire;
import
mcpp.libs.json;
namespace
mcpp
::cli {
export
int
cmd_cache_dir
(
const
mcpplibs::cmdline::ParsedArgs&
/*
parsed
*/
) {
return
mcpp::bmi_cache::cache_dir
();
}
export
int
cmd_cache_list
(
const
mcpplibs::cmdline::ParsedArgs& parsed) {
//
`--format json` is enveloped; `--json` keeps the payload it shipped
//
with (`{root, entries}` at the top level, which this repo's own e2e
//
asserts). Spelling compatibility is not payload compatibility, and
//
wrapping the old spelling would break every consumer that already
//
reads it.
if
(
auto
f = parsed.
value
(
"
format
"
)) {
auto
fmt =
mcpp::wire::parse_format
(*f);
if
(!fmt) {
std::println
(stderr,
"
error: {}
"
,
mcpp::wire::unsupported_format
(*f));
return
2
;
}
mcpp::wire::emit
({
.
kind
=
"
mcpp.cache
"
,
.
data
=
mcpp::bmi_cache::cache_list_json
(),
});
return
0
;
}
return
mcpp::bmi_cache::cache_list
(parsed.
is_flag_set
(
"
json
"
));
}
export
int
cmd_cache_info
(
const
mcpplibs::cmdline::ParsedArgs& parsed) {
std::string needle = parsed.
positional
(
0
);
if
(needle.
empty
()) {
mcpp::ui::error
(
"
usage: mcpp cache info <pkg>@<ver>
"
);
return
2
;
}
return
mcpp::bmi_cache::cache_info
(needle);
}
export
int
cmd_cache_prune
(
const
mcpplibs::cmdline::ParsedArgs& parsed) {
return
mcpp::bmi_cache::cache_prune
(parsed.
option_or_empty
(
"
older-than
"
).
value
());
}
export
int
cmd_cache_gc
(
const
mcpplibs::cmdline::ParsedArgs& parsed) {
return
mcpp::bmi_cache::cache_gc
(
parsed.
option_or_empty
(
"
max-size
"
).
value
(),
parsed.
option_or_empty
(
"
older-than
"
).
value
());
}
export
int
cmd_cache_clean
(
const
mcpplibs::cmdline::ParsedArgs& parsed) {
return
mcpp::bmi_cache::cache_clean
(parsed.
is_flag_set
(
"
deps
"
),
parsed.
is_flag_set
(
"
std
"
),
parsed.
is_flag_set
(
"
all
"
),
parsed.
is_flag_set
(
"
legacy
"
));
}
export
int
cmd_cache_verify
(
const
mcpplibs::cmdline::ParsedArgs&
/*
parsed
*/
) {
return
mcpp::bmi_cache::cache_verify
();
}
}
//
namespace mcpp::cli
Back
|
FazBrowse Home
|
New Git URL