8 #ifndef UTILS_PARSER_HPP
9 #define UTILS_PARSER_HPP
13 #include <unordered_map>
32 std::unordered_map<std::string, std::string>
parse(
int argc,
char** argv);
40 commands.push_back(command);
41 helps.push_back(
help);
51 " ___ ____ ________ _| | / (_)___ ___ \n"
52 " / _ \\/ __ `/ ___/ / / / | / / / __ `__ \\\n"
53 "/ __/ /_/ (__ ) /_/ /| |/ / / / / / / /\n"
54 "\\___/\\__,_/____/\\__, / |___/_/_/ /_/ /_/ \n"
56 for (
size_t i = 0; i < commands.size(); i++){
57 if (commands[i].size() > 1){
58 result +=
"--" + commands[i] +
"\t" + helps[i] +
"\n";
60 result +=
"-" + commands[i] +
"\t" + helps[i] +
"\n";
67 std::vector<std::string> commands;
68 std::vector<std::string> helps;
easyVim 解析器类
Definition: parser.hpp:22
std::unordered_map< std::string, std::string > parse(int argc, char **argv)
解析指令
Definition: parser.cpp:21
void addCommand(std::string command, std::string help="")
添加指令
Definition: parser.hpp:39
std::string help()
获取指令列表
Definition: parser.hpp:48