diff -r 975f38eb1e12 -r 148f8dd077e8 src/cadMousePro.cpp --- a/src/cadMousePro.cpp Mon Aug 19 15:30:01 2019 +0200 +++ b/src/cadMousePro.cpp Mon Aug 19 17:21:02 2019 +0200 @@ -18,10 +18,13 @@ #include #include "CadMouseConfig.h" +#include "CLI.h" +#include "CLIParser.h" #include "HID.h" int main(int argc, char** argv) { try { + CLI cli(argc, argv); std::wcout << L"cadMousePro" << std::endl; HIDDevice mouse(0x256f, 0xc652, nullptr); @@ -30,13 +33,18 @@ std::wcout << L"product: " << mouse.getProductName() << std::endl; // std::wcout << L"serial number: " << mouse.getSerialNumber() << std::endl; // throws exception - CadMouseConfig config; + CLIParser cliParser; + CLIConfiguration configuration = cliParser.parse(cli.arguments()); - mouse.sendFeatureReport(config.serialize()); + mouse.sendFeatureReport(configuration.cadMouseConfig.serialize()); - return 0; + return CLI::EXIT_CODE_SUCCESS; } catch (const HIDException& e) { std::wcout << L"HIDException: " << e.getMessage() << std::endl; - return 1; + return CLI::EXIT_CODE_UNEXPECTED_ERROR; + } catch (const CLIException& e) { + std::wcout << L"CLIException: " << e.getMessge() << std::endl; + return e.getExitCode(); } + }