CommandsInterpreter variables

This commit is contained in:
MihailRis
2024-05-10 16:37:10 +03:00
parent b38128ef39
commit 88d0553eda
2 changed files with 19 additions and 9 deletions
+5
View File
@@ -87,12 +87,17 @@ namespace cmd {
class CommandsInterpreter {
std::unique_ptr<CommandsRepository> repository;
std::unordered_map<std::string, dynamic::Value> variables;
public:
CommandsInterpreter(std::unique_ptr<CommandsRepository> repository)
: repository(std::move(repository)){}
Prompt parse(std::string_view text);
dynamic::Value& operator[](const std::string& name) {
return variables[name];
}
CommandsRepository* getRepository() const {
return repository.get();
}