Add first version
[ric-plt/sdl.git] / src / cli / main.cpp
diff --git a/src/cli/main.cpp b/src/cli/main.cpp
new file mode 100644 (file)
index 0000000..9d84536
--- /dev/null
@@ -0,0 +1,22 @@
+#include <iostream>
+#include <exception>
+#include <cstdlib>
+#include "private/cli/commandmap.hpp"
+#include "private/cli/commandparserandexecutor.hpp"
+
+using namespace shareddatalayer;
+using namespace shareddatalayer::cli;
+
+int main(int argc, char** argv)
+{
+    try
+    {
+        return parseAndExecute(argc, argv, std::cout, std::cerr, CommandMap::getCommandMap());
+    }
+    catch (const std::exception& e)
+    {
+        std::cerr << "unexpected error: " << e.what() << std::endl;
+        return EXIT_FAILURE;
+    }
+}
+