From dc01ab729c749fbfd2421943198a038d126aa66c Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Mon, 16 Oct 2017 22:56:16 +0100 Subject: Add simple black hole cmdline parse & err handling --- src/main/main.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src/main/main.cpp') diff --git a/src/main/main.cpp b/src/main/main.cpp index 8c07d1f..642b27c 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -1,29 +1,27 @@ #include -#include #include "command_line_helper.h" +#include using namespace std; namespace po = boost::program_options; int main(int argc, const char* argv[]) { - // Creates the command line options - po::options_description desc = get_options_desc(); - - po::variables_map vm; - po::store(po::parse_command_line(argc, argv, desc), vm); - po::notify(vm); - - if (vm.count("help")) { - cout << desc << "\n"; + // Parses the command-line options + command_line_helper clh; + bool success = clh.parse(argc, argv); + if (!success) { return 1; } - if (vm.count("compression")) { - cout << "Compression level was set to " - << vm["compression"].as() << ".\n"; - } else { - cout << "Compression level was not set.\n"; + cout << "Random deal: " << clh.get_random_deal() << "\n"; + cout << "Solitaire type: " << clh.get_solitaire_type() << "\n"; + cout << "Filenames: "; + for (auto filename : clh.get_input_files()) { + cout << filename << ", "; } + cout << "\n"; + + return 0; } -- cgit v1.2.1