diff options
| author | thecharlesblake | 2017-10-16 14:15:25 +0100 |
|---|---|---|
| committer | thecharlesblake | 2017-10-26 14:51:33 +0100 |
| commit | 9101c98f951e7b104e6969fd5984379ca04745ea (patch) | |
| tree | 71a154d956da31c55c13402bb8b2f04c6aa36a01 /src/main/main.cpp | |
| parent | Move setup classes to legacy (diff) | |
| download | metasol-9101c98f951e7b104e6969fd5984379ca04745ea.tar.gz metasol-9101c98f951e7b104e6969fd5984379ca04745ea.zip | |
Add demo command line parsing
Diffstat (limited to 'src/main/main.cpp')
| -rw-r--r-- | src/main/main.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/main.cpp b/src/main/main.cpp index e69de29..8c07d1f 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -0,0 +1,29 @@ +#include <boost/program_options.hpp> +#include <iostream> +#include "command_line_helper.h" + +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"; + return 1; + } + + if (vm.count("compression")) { + cout << "Compression level was set to " + << vm["compression"].as<int>() << ".\n"; + } else { + cout << "Compression level was not set.\n"; + } +} + |
