载入中...
搜索中...
未找到
Clean.cpp
浏览该文件的文档.
1#include "cmdline.h"
2
3#include <CLI11.hpp>
4#include <filesystem>
5#include <rang.hpp>
6
7using namespace std::filesystem;
8using namespace std;
9
10namespace eve::cmd {
11
13 void setup(CLI::App& app, std::shared_ptr<CLI::Formatter> formatter) override {
14 auto create = app.add_subcommand("clean", "Clean the build directory");
15 create->allow_extras();
16 }
17
18 int parse(CLI::App& app, Cmdline& cmd) override {
19 auto create = app.get_subcommand("clean");
20 if (create->parsed()) {
21 string name = cmd.get_remaining(create, "debug");
22 int res = cmd.Create(".", name);
23 if (res == 0)
24 cout << rang::fg::green << "Clean " << name << " build in current path" << rang::fg::reset << endl;
25 return res;
26 }
27 return -1; // not handle
28 }
29};
30
32
33
34// create a new project
35int Cmdline::Clean(std::string path) { return 0; }
36
37} // namespace eve::cmd
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 Clean(std::string path)
清理项目并移除内部产物。
Definition Clean.cpp:35
int Create(std::string path, std::string name)
创建新项目。
Definition Create.cpp:38
#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 Clean.cpp:13
int parse(CLI::App &app, Cmdline &cmd) override
Parses arguments and runs the command; returns the exit code.
Definition Clean.cpp:18
One eve <subcommand> handler: CLI setup + argument parsing.
Definition cmdline.h:21