By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,130 Members | 1,365 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,130 IT Pros & Developers. It's quick & easy.

the usage message generated by boost::program_options.

P: n/a
I wrote the following simple program:

//some includes here.
int main(int argc, char* argv[]) {
options_description desc("Usage");
desc.add_options()("help", "Show this message.");
desc.add_options()("config,c", value<string>(), "Specify the
configuration file.");

variables_map vm;
store(parse_command_line(argc, argv, desc), vm);
notify(vm);

if(vm.count("help")) {
cout << desc << endl;
return 0;
}

return 0;
}

And using the "--help" command line argument, it genrated the
following program usage:
Usage:
--help Show this message.
-c [ --config ] arg Specify the configuration file.

Who knows how to turn the "arg" in the last line into something more
meaningful, say, "file"?.
In other words, how to generate the last line as:
-c [ --config ] <fileSpecify the configuration file.

Mar 22 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mar 22, 9:32 am, "MorningStar" <steedho...@163.netwrote:
I wrote the following simple program:

//some includes here.
int main(int argc, char* argv[]) {
options_description desc("Usage");
desc.add_options()("help", "Show this message.");
desc.add_options()("config,c", value<string>(), "Specify the
configuration file.");

variables_map vm;
store(parse_command_line(argc, argv, desc), vm);
notify(vm);

if(vm.count("help")) {
cout << desc << endl;
return 0;
}

return 0;

}

And using the "--help" command line argument, it genrated the
following program usage:
Usage:
--help Show this message.
-c [ --config ] arg Specify the configuration file.

Who knows how to turn the "arg" in the last line into something more
meaningful, say, "file"?.
In other words, how to generate the last line as:
-c [ --config ] <fileSpecify the configuration file.
I bet the folks on the Boost User List do (see http://boost.org/more/mailing_lists.htm#users).
Your question as stated is off-topic here (http://www.parashift.com/c+
+-faq-lite/how-to-post.html#faq-5.9).

Cheers! --M

Mar 22 '07 #2

P: n/a
On 3月22日, 下午10时07分, "mlimber" <mlim...@gmail.comwrote:
On Mar 22, 9:32 am, "MorningStar" <steedho...@163.netwrote:


I wrote the following simple program:
//some includes here.
int main(int argc, char* argv[]) {
options_description desc("Usage");
desc.add_options()("help", "Show this message.");
desc.add_options()("config,c", value<string>(), "Specify the
configuration file.");
variables_map vm;
store(parse_command_line(argc, argv, desc), vm);
notify(vm);
if(vm.count("help")) {
cout << desc << endl;
return 0;
}
return 0;
}
And using the "--help" command line argument, it genrated the
following program usage:
Usage:
--help Show this message.
-c [ --config ] arg Specify the configuration file.
Who knows how to turn the "arg" in the last line into something more
meaningful, say, "file"?.
In other words, how to generate the last line as:
-c [ --config ] <fileSpecify the configuration file.

I bet the folks on the Boost User List do (seehttp://boost.org/more/mailing_lists.htm#users).
Your question as stated is off-topic here (http://www.parashift.com/c+
+-faq-lite/how-to-post.html#faq-5.9).

Cheers! --M- 隐藏被引用文字 -

- 显示引用的文字 -
Thanks.

Mar 23 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.