载入中...
搜索中...
未找到
Get.cpp
浏览该文件的文档.
1#include "cmdline.h"
2#include "common/config.h"
3
4#include <filesystem>
5#include <CLI11.hpp>
6#include <rang.hpp>
7
8using namespace std::filesystem;
9using namespace std;
10
11namespace eve::cmd
12{
13
14struct GetArgs : Handler {
15 void setup(CLI::App& app, std::shared_ptr<CLI::Formatter> formatter) override {
16 auto subcmd = app.add_subcommand("get", "Get a external module from Github");
17 subcmd->allow_extras();
18 }
19
20 int parse(CLI::App& app, Cmdline& cmd) override {
21 auto subcmd = app.get_subcommand("get");
22 if (subcmd->parsed()) {
23 string name = cmd.get_remaining(subcmd, "");
24 int res = cmd.Get(name);
25 if (res == 0) cout << rang::fg::green << "Get " << name << rang::fg::reset << endl;
26 return res;
27 }
28 return -1; // not handle
29 }
30};
31
33
34
35// create a new project
36int Cmdline::Get(std::string url) {
37 return 0;
38}
39
40} // namespace eve
const char * name
Definition RockMesh.cpp:21
命令行模块(eve.cmd):run / build / package / test / zip / dev-server 等子命令入口。
Definition cmdline.h:30
static std::string get_remaining(CLI::App *sub, std::string default_path=".")
子命令剩余位置参数。
Definition cmdline.cpp:79
int Get(std::string url)
获取第三方源码。
Definition Get.cpp:36
#define CMD_REG(name)
Definition cmdline.h:92
void setup(CLI::App &app, std::shared_ptr< CLI::Formatter > formatter) override
Registers options on the CLI11 sub-app.
Definition Get.cpp:15
int parse(CLI::App &app, Cmdline &cmd) override
Parses arguments and runs the command; returns the exit code.
Definition Get.cpp:20
One eve <subcommand> handler: CLI setup + argument parsing.
Definition cmdline.h:21