| 1 | #include <iostream>
|
|---|
| 2 | #include <boost/program_options.hpp>
|
|---|
| 3 | namespace po = boost::program_options;
|
|---|
| 4 |
|
|---|
| 5 | int main (int argc, char *argv[])
|
|---|
| 6 | {
|
|---|
| 7 | // 1st group
|
|---|
| 8 | po::options_description groups1 ("Option group 1");
|
|---|
| 9 | groups1.add_options()
|
|---|
| 10 | ("opt1", "Short option 1")
|
|---|
| 11 | ("option 2", "Short option 2\n^\nAligned here");
|
|---|
| 12 |
|
|---|
| 13 | // 2nd group
|
|---|
| 14 | po::options_description groups2 ("Option group 2");
|
|---|
| 15 | groups2.add_options()
|
|---|
| 16 | ("much_longer_option", po::value<int>(), ("Misaligned description "
|
|---|
| 17 | "in 2nd group if option "
|
|---|
| 18 | "column length > magic 23 "
|
|---|
| 19 | "character limit\n^\n"
|
|---|
| 20 | "Aligned here"));
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 | po::options_description cmdline_args("Overall");
|
|---|
| 24 | cmdline_args.add(groups1);
|
|---|
| 25 | cmdline_args.add(groups2);
|
|---|
| 26 | std::cerr << cmdline_args << "\n";
|
|---|
| 27 |
|
|---|
| 28 | return 0;
|
|---|
| 29 | }
|
|---|