39 lines
920 B
C++
39 lines
920 B
C++
#ifndef REPL_SHELL_H
|
|
#define REPL_SHELL_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "core/core.h"
|
|
#include "models/ward.h"
|
|
#include "utils/logger.h"
|
|
|
|
class ReplShell {
|
|
public:
|
|
ReplShell();
|
|
void run();
|
|
|
|
private:
|
|
std::string rootPath_;
|
|
std::string dataPath_;
|
|
core::HisCore core_;
|
|
Logger logger_; // 日志系统
|
|
|
|
bool executeLine(const std::string& line);
|
|
static std::vector<std::string> splitTokens(const std::string& line);
|
|
static std::string trim(const std::string& s);
|
|
|
|
void printBanner() const;
|
|
void printHelp() const;
|
|
void printCommandGroup(const std::string &title, const std::vector<std::string> &commands) const;
|
|
void printPrompt() const;
|
|
|
|
void listWards() const;
|
|
void showWard(const std::string& wardId) const;
|
|
static std::string wardTypeToText(WardType t);
|
|
static bool parseWardType(const std::string& s, WardType& outType);
|
|
};
|
|
|
|
#endif
|
|
|