2
我希望在打印我的options_description时允许选项的描述之前打印文本。喜欢的东西:boost :: program_options:如何添加程序描述文本
This program counts from 1 to 10. <--- this is what is missing
Generic options:
-h [ --help ] Produce help message.
-v [ --version ] Show program name/version banner and exit.
目前我的手添加:
if (vm.count("help")) {
cout << "options_description\n\n" << my_options_description << endl;
return 1;
}
是否有可能直接在options_description对象存储呢?
似乎将符合该法案,但你会碰到的问题用[多个选项的说明](当http://www.boost.org /doc/libs/1_48_0/doc/html/program_options/howto.html#id2444931)。但是,不过,+1。 – rcollyer
稍微简单一点就是'if(vm.count(“help”))'在写入选项之前打印包含格式化用法+概要的单独字符串。 – TemplateRex
这就是问题中已经显示的@Template。正如你所说,我不确定那是“容易”的;看起来大致相同的工作量。 –