Skip to content

Instantly share code, notes, and snippets.

@werner291
Created April 17, 2016 10:13
Show Gist options
  • Save werner291/86936f6cbc0ffffb9c104f3f66de38bb to your computer and use it in GitHub Desktop.
Save werner291/86936f6cbc0ffffb9c104f3f66de38bb to your computer and use it in GitHub Desktop.
int main(int argc, char **argv) {
po::options_description config_options("GeoMesh configuration");
config_options.add_options()
("udp_peers", po::value<std::vector<std::string> >()->multitoken(), "List of UDP peers in IPAddress:Port format.")
("udp_port", /*po::value<int>()->default_value(10976),*/ "UDP port on which to listen for UDP bridge packets.")
("udp_bridge_enable", /*po::value<bool>()->default_value(true),*/ "Whether to enable the UDP bridge.");
po::options_description cli_options;
cli_options.add_options()
("help,h", "Display help.")
("config,c", /*po::value<std::string>()->default_value("/etc/geomesh.conf"),*/ "Config file location.")
("version,v", "Show version and exit.")
("daemon,d", /*po::value<bool>()->default_value(true),*/ "Whether to fork into the background, or remain in the foreground.");
cli_options.add(config_options);
// Parse command line arguments into program options
po::variables_map vm;
po::store(po::parse_command_line(argc,argv,cli_options), vm);
po::notify(vm);
if (vm.count("help")) {
std::cout << cli_options << std::endl;
return 0;
}
if (vm.count("version")) {
std::cout << "Early development version. Refer to git for exact version information." << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment