Skip to content

Instantly share code, notes, and snippets.

@mostsignificant
Created October 19, 2021 22:22
Show Gist options
  • Save mostsignificant/4dbff3a71d85171f87d5f1285f49265e to your computer and use it in GitHub Desktop.
Save mostsignificant/4dbff3a71d85171f87d5f1285f49265e to your computer and use it in GitHub Desktop.
blog-cxxopts-example
#include <cxxopts.hpp>
// ...
cxxopts::Options options("MyProgram", "One line description of MyProgram");
options.add_options()
("d,debug", "Enable debugging") // a bool parameter
("i,integer", "Int param", cxxopts::value<int>())
("f,file", "File name", cxxopts::value<std::string>())
("v,verbose", "Verbose output", cxxopts::value<bool>()->default_value("false"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment