Reputation: 66995
So what I need on developer side is something like
addoption("-use-something", "Use Something instead of Some other thing", localVarName, desiredValue, defauultValue);
While on user side I wish to see 3 things
start my.exe -use-something
)Upvotes: 0
Views: 347
Reputation: 19902
You should use the Boost.Program_options. Example from the tutorial:
// Declare the supported options.
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
("compression", po::value<int>(), "set compression level")
;
po::variables_map vm;
po::store(po::parse_command_line(ac, av, 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";
}
Upvotes: 1