载入中...
搜索中...
未找到
Test.cpp
浏览该文件的文档.
1#include "cmdline.h"
2#include <filesystem>
3#include <CLI11.hpp>
4#include <rang.hpp>
5
6using namespace std::filesystem;
7using namespace std;
8
9namespace eve::cmd
10{
11
12struct TestArgs : Handler {
13 void setup(CLI::App& app, std::shared_ptr<CLI::Formatter> formatter) override {
14 auto subcmd = app.add_subcommand("test", "Run unit testing");
15 subcmd->allow_extras();
16 }
17
18 int parse(CLI::App& app, Cmdline& cmd) override {
19 auto subcmd = app.get_subcommand("test");
20 if (subcmd->parsed()) {
21 string name = cmd.get_remaining(subcmd, "");
22 int res = cmd.Test(name);
23 return res;
24 }
25 return -1; // not handle
26 }
27};
28
30
31
32// create a new project
33int Cmdline::Test(std::string path) {
34 return 0;
35}
36
37} // 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 Test(std::string path)
运行项目测试。
Definition Test.cpp:33
#define CMD_REG(name)
Definition cmdline.h:92
One eve <subcommand> handler: CLI setup + argument parsing.
Definition cmdline.h:21
void setup(CLI::App &app, std::shared_ptr< CLI::Formatter > formatter) override
Registers options on the CLI11 sub-app.
Definition Test.cpp:13
int parse(CLI::App &app, Cmdline &cmd) override
Parses arguments and runs the command; returns the exit code.
Definition Test.cpp:18