| 1 | #include <boost/program_options.hpp>
|
|---|
| 2 | namespace po = boost::program_options;
|
|---|
| 3 |
|
|---|
| 4 | #include <string>
|
|---|
| 5 | using std::string;
|
|---|
| 6 |
|
|---|
| 7 | #include <iostream>
|
|---|
| 8 | using std::cout;
|
|---|
| 9 |
|
|---|
| 10 | int main (int const argc, char const * const * const argv) {
|
|---|
| 11 | po::options_description opts{"Options"};
|
|---|
| 12 | opts.add_options()
|
|---|
| 13 | ("long-option-with-arg,l", po::value<int>(), "this is rendered in the same line by help2man")
|
|---|
| 14 | ("help,h", "print this help message")
|
|---|
| 15 | ("version,V", "print version information")
|
|---|
| 16 | ;
|
|---|
| 17 | po::variables_map config;
|
|---|
| 18 | store(parse_command_line(argc, argv, opts), config);
|
|---|
| 19 | notify(config);
|
|---|
| 20 |
|
|---|
| 21 | if (config.count("help")) {
|
|---|
| 22 | cout << "Usage: potest [ OPTIONS ]\n";
|
|---|
| 23 | cout << opts;
|
|---|
| 24 | return {};
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | if (config.count("version")) {
|
|---|
| 28 | cout << "potest 0\n";
|
|---|
| 29 | return {};
|
|---|
| 30 | }
|
|---|
| 31 | }
|
|---|