FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mcpp/src/cli/cmd_registry.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
111
Code
Issues
35
Pull requests
5
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_registry.cppm
Copy path
More file actions
More file actions
Latest commit
History
History
History
75 lines (62 loc) · 2.14 KB
Breadcrumbs
mcpp
/
src
/
cli
/
cmd_registry.cppm
Copy path
File metadata and controls
75 lines (62 loc) · 2.14 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
75
//
mcpp.cli.cmd_registry — CLI parsing + routing for search and the
//
`mcpp index` family. Implementations live in mcpp.pm.index_management.
module
;
#
include
<
cstdio
>
#
include
<
cstdlib
>
export
module
mcpp.cli.cmd_registry;
import
std;
import
mcpplibs.cmdline;
import
mcpp.pm.index_management;
import
mcpp.ui;
namespace
mcpp
::cli {
export
int
cmd_search
(
const
mcpplibs::cmdline::ParsedArgs& parsed) {
std::string keyword = parsed.
positional
(
0
);
if
(keyword.
empty
()) {
std::println
(stderr,
"
error: `mcpp search` requires a keyword
"
);
return
2
;
}
return
mcpp::pm::search_packages
(keyword);
}
export
int
cmd_index_list
(
const
mcpplibs::cmdline::ParsedArgs&
/*
parsed
*/
) {
return
mcpp::pm::index_list
();
}
export
int
cmd_index_add
(
const
mcpplibs::cmdline::ParsedArgs& parsed) {
std::string name = parsed.
positional
(
0
);
std::string url = parsed.
positional
(
1
);
if
(name.
empty
() || url.
empty
()) {
mcpp::ui::error
(
"
usage: mcpp index add <name> <url>
"
);
return
2
;
}
return
mcpp::pm::index_add
(name, url);
}
export
int
cmd_index_remove
(
const
mcpplibs::cmdline::ParsedArgs& parsed) {
std::string name = parsed.
positional
(
0
);
if
(name.
empty
()) {
mcpp::ui::error
(
"
usage: mcpp index remove <name>
"
);
return
2
;
}
return
mcpp::pm::index_remove
(name);
}
export
int
cmd_index_update
(
const
mcpplibs::cmdline::ParsedArgs& parsed) {
return
mcpp::pm::index_update
(parsed.
positional
(
0
));
}
export
int
cmd_index_status
(
const
mcpplibs::cmdline::ParsedArgs&
/*
parsed
*/
) {
return
mcpp::pm::index_status
();
}
export
int
cmd_index_pin
(
const
mcpplibs::cmdline::ParsedArgs& parsed) {
std::string name = parsed.
positional
(
0
);
if
(name.
empty
()) {
mcpp::ui::error
(
"
usage: mcpp index pin <name> [<rev>]
"
);
return
2
;
}
return
mcpp::pm::index_pin
(name, parsed.
positional
(
1
));
}
export
int
cmd_index_unpin
(
const
mcpplibs::cmdline::ParsedArgs& parsed) {
std::string name = parsed.
positional
(
0
);
if
(name.
empty
()) {
mcpp::ui::error
(
"
usage: mcpp index unpin <name>
"
);
return
2
;
}
return
mcpp::pm::index_unpin
(name);
}
}
//
namespace mcpp::cli
Back
|
FazBrowse Home
|
New Git URL