boost-program-options

How do you manually insert options into boost.Program_options?

I have an application that uses Boost.Program_options to store and manage its configuration options. We are currently moving away from configuration files and using database loaded configuration instead. I've written an API that reads configuration options from the database by hostname and instance name. (cool!) However, as far as I...

What is the Preferred Cross-platform 'main' Definition Using boost::program_options?

I'm trying to develop a cross-platform application using C++ with boost. I typically program in a *nix environment, where I've always defined 'main' as follows: int main( const int argc, const char* argv[] ) { ... } For this application, I'm starting in the Windows environment, using Visual Studio 2003. When I try to use boost::pro...

When using boost::program_options, how does one set the name of the argument?

When using boost::program_options, how do I set the name of an argument for boost::program_options::value<>()? #include <iostream> #include <boost/program_options.hpp> int main() { boost::program_options::options_description desc; desc.add_options() ("width", boost::program_options::value<int>(), "Give width"); std::co...

how do I get the non-flag and non-option tokens after boost::program_options parses my command line args

In python, I can construct my optparse instance such that it will automatically filter out the options and non-option/flags into two different buckets: (options, args) = parser.parse_args() With boost::program_options, how do I retrieve a list of tokens which are the remaining non-option and non-flag tokens? e.g. If my program has fl...

How do I get a handle to split_winmain

I am trying to get a get the boost library program_options working on a simple windows console library. I have linked in the library C:\Program Files\boost\boost_1_40\lib\libboost_program_options-vc90-s-1_40.lib Included the header files #include <boost/program_options.hpp> #include <boost/program_options/config.hpp> #include <boost/pro...

Limit the precision on std::cout of default values in boost::options_description

When I construct a boost::options_description instance like options.add_options() ("double_val", value(&config.my_double)->default_value(0.2), "it's a double"); and later want to have the automated output of the options that are available for my program, and put std::cout << options << std::endl; the default value 0.2 is shown wi...

How to accept empty value in boost::program_options

I'm using boost::program_options library to process command line params. I need to accept a file name via -r option, in case if it is empty (-r given without params) I need to use stdin. desc.add_options() ("replay,r", boost::program_options::value<std::string>(), "bla bla bla") In this case boost wouldn't accept -r without params an...

Reload option values in boost::program_options from new source

I'm just starting to dig into boost::program_options for the first time. I like it quite a bit. However, what I'm trying to accomplish with it doesn't seem to be something its designers have accounted for. I want to use boost::program_options to parse both command line options as well as config files. So far so good. Additionally, t...

Parameters with and without arguments in boost::program_options

I wrote a small app that uses boost::program_options for command-line parsing. I'd like to have some options that set a value if the argument is present, and alternately prints the current value if the parameter is given but no argument is present. So "set-mode" would look like: dc-ctl --brightness 15 and "get mode" would be: dc-ctl ...

Boost.Program_options fixed number of tokens

Boost.Program_options provides a facility to pass multiple tokens via command line arguments as follows: std::vector<int> nums; po::options_description desc("Allowed options"); desc.add_options() ("help", "Produce help message.") ("nums", po::value< std::vector<int> >(&nums)->multitoken(), "Numbers.") ; po::variables_map v...

BOOST program_options: parsing multiple argument list.

Hello, I would like to pass the multiple arguments with positive or negative values. Is it possible to parse it? Currently I have a following initialization: vector<int> IDlist; namespace po = boost::program_options; po::options_description commands("Allowed options"); commands.add_options() ...

boost::program_options bug or feature?

Very simple example: #include <string> #include <boost/program_options.hpp> namespace po = boost::program_options; int main(int argc, char* argv[]) { po::options_description recipients("Recipient(s)"); recipients.add_options() ("csv", po::value<std::string>(), "" ) ("csv_name", po::value<unsi...

What is the difference between default_value and implicit_value in boost::program_options?

That's the question. Why would I use implicit_value over default_value and vice versa? Thanks! ...

Boost.Program_Options not working with short options

I have the following options_description: po::options_description config("Configuration File or Command Line"); config.add_options() ("run-time,t", po::value<double>(&runTime_)->default_value(1440.0), "set max simulation duration") ("starting-iteration,i", po::value<long>(&startingIteration_)->default_value(1), "set starting simulat...

Can boost::program_options Use A Delimiter Other Than "-"?

I am using boost::program_options like this: namespace po = boost::program_options; po::options_description desc("Options"); desc.add_options() ("help,?", "Show Options") ("capture-file,I", po::value<string>(), "Capture File") ("capture-format,F", po::value<string>()->default_value("pcap"), "Capture File Format") ("output-fil...

Handle complex options with Boost's program_options

I have a program that generates graphs using different multi-level models. Each multi-level model consists of a generation of a smaller seed graph (say, 50 nodes) which can be created from several models (for example - for each possible edge, choose to include it with probability p). After the seed graph generation, the graph is expande...

buffer overflow with boost::program_options

Hello, I have a problem using boost:program_options this simple program, copy-pasted from boosts' documentation : #include <boost/program_options.hpp> int main( int argc, char** argv ) { namespace po = boost::program_options; po::options_description desc("Allowed options"); desc.add_options() ("help", "produce h...

Can Boost Program_options separate comma separated argument values

If my command line is: > prog --mylist=a,b,c Can Boost's program_options be setup to see three distinct argument values for the mylist argument? I have configured program_options as: namespace po = boost::program_options; po::options_description opts("blah") opts.add_options() ("mylist", std::vector<std::string>>()->multitoken, ...

boost program_options multiple values problem

So I'm working off one of the examples for Boost program_options library, and I wanted to try setting a default value for one of the multiple-values/ vector-values, but it doesn't seem to work. As I think is suggested here to work. What I've modified is on about line 40: po::options_description config("Configuration"); config.a...

Allow limited number of possibilities for a option in boost program_options

Hi, Can I tell boost program_options somehow, that a specific options has a limited number of values? For example, the option "--verbosity" may only be debug,high or low?!? Thanks! Nathan ...