summaryrefslogtreecommitdiff
path: root/src/nerdhack.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nerdhack.cc')
-rw-r--r--src/nerdhack.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nerdhack.cc b/src/nerdhack.cc
new file mode 100644
index 0000000..1363096
--- /dev/null
+++ b/src/nerdhack.cc
@@ -0,0 +1,20 @@
+#include <iostream>
+#include <fstream>
+#include "ui.h"
+#include "vm.h"
+
+int main(int argc, char* argv[]) {
+ if (argc != 2) {
+ std::cerr << "Requires path to config as an argument\n";
+ return 1;
+ }
+ vm::clearAllVMs();
+ auto vm = vm::VM();
+ auto ui = ui::UI();
+ // Read config
+ std::ifstream ifs(argv[1]);
+ std::string config((std::istreambuf_iterator<char>(ifs)),(std::istreambuf_iterator<char>()));
+ vm.start(config);
+ ui.registerCallbacks(vm);
+ return 0;
+}