├── .gitignore ├── images └── probe_demo1.png ├── Makefile ├── CONTRIBUTING.md ├── .github └── ISSUE_TEMPLATE │ └── feature_request.md ├── include ├── CentralDogma.hpp └── TerminalDogma.hpp ├── src ├── main.cpp ├── CentralDogma.cpp └── TerminalDogma.cpp ├── CODE_OF_CONDUCT.md ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | Dockerfile 3 | *.exe -------------------------------------------------------------------------------- /images/probe_demo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spyke7/eva-01/HEAD/images/probe_demo1.png -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CXX = g++ 2 | CXXFLAGS = -Iinclude 3 | LDFLAGS = -lws2_32 -liphlpapi -lPsapi -lkernel32 -ladvapi32 4 | TARGET = eva-01 5 | SRCS = src\main.cpp src\CentralDogma.cpp src\TerminalDogma.cpp 6 | all: 7 | $(CXX) $(CXXFLAGS) $(SRCS) $(LDFLAGS) -o $(TARGET) -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution 2 | All the viewers who want to do some changes in the 3 | code or want to contribute can fork my repository, 4 | then make can make a pull request and can contribute. 5 | The contribution will be checked and will be accepted. 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /include/CentralDogma.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #if defined(_WIN32) || defined(_WIN64) 9 | #include 10 | #else 11 | #include 12 | #include 13 | #endif 14 | 15 | class TerminalDogma; 16 | 17 | class CentralDogma{ 18 | private: 19 | std::unordered_map> registry; 20 | 21 | // history parts 22 | std::vector> historyList; 23 | 24 | std::string username; 25 | 26 | public: 27 | CentralDogma(); 28 | void registerCommand(const std::string& name, std::unique_ptr cmd); 29 | bool executeCommand(const std::string& name, const std::vector& args); 30 | 31 | // to be used by help 32 | const std::unordered_map>& getRegistry() const { 33 | return registry; 34 | } 35 | std::string getUsername(); 36 | std::string workingDirectory(); 37 | bool parseCommand(const std::vector& args); 38 | 39 | // history functions 40 | void addToHistory(const std::vector& args); 41 | std::vector> getHistory(); 42 | void searchHistory(const std::string& cmdName); 43 | }; -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "CentralDogma.hpp" 2 | #include "TerminalDogma.hpp" 3 | #include 4 | #include 5 | #include 6 | 7 | std::vector split(const std::string& command){ 8 | std::vector tokens; 9 | std::string token; 10 | for (size_t i=0; i(core)); 32 | core.registerCommand("say", std::make_unique()); 33 | core.registerCommand("help", std::make_unique(core)); 34 | core.registerCommand("calc", std::make_unique()); 35 | core.registerCommand("time", std::make_unique