#include "Terminal.h"
#include "Types/EventArgs.h"
#include "string"
using namespace std;
void BasicTerminal::AddNewCommand(string command, TFunction exe_function, string description)
{
functions.push_back(exe_function);
commands.push_back(command);
descriptions.push_back(description);
}
EventArgs BasicTerminal::Execute(string input_command, CmdEventArgs args)
{
int index;
for(int i = 0; i < commands.size(); i++)
{
if (input_command == commands[i]) index = i;
}
return functions[index](args);
}
BasicTerminal term;
EventArgs Hello(CmdEventArgs args)
{
cout << "hello" << endl;
return EventArgs::Empty;
}
int main()
{
term.AddNewCommand("hello", Hello, "prints hello");
term.Execute("hello", CmdEventArgs::Empty);
}
"profiles": {
"DemoApplication.Server.Server": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7005;http://localhost:5005",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
.h
.cpp
const EventArgs EventArgs::Empty = EventArgs();
---
в cmd наследнике все также