-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
44 lines (32 loc) · 872 Bytes
/
Main.cpp
File metadata and controls
44 lines (32 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <string>
#include <iostream>
#include "Utils.hpp"
#include "VirtualFileSystem.hpp"
#include "CommandProcessor.hpp"
using std::string;
using std::cout;
void startLoop(VirtualFileSystem* vfs) {
auto* processor = new CommandProcessor(vfs);
while (true) {
cout << "> ";
string input = removeEndOfLine(getLine());
if (input.empty()) {
continue;
}
string trimmed_input = trim_copy(input);
processor->processCommandLine(trimmed_input);
}
}
int main(int argc, const char* argv[]) {
log(SIGNATURE);
log(PROGRAM_INTRODUCTIONS_TEXT);
if (argc == 2) {
string filename = argv[1];
log(LOADING_FILE_TEXT + filename);
auto* vfs = new VirtualFileSystem(filename);
startLoop(vfs);
} else {
log(PROGRAM_ERROR_EXIT_TEXT);
}
return 0;
}