-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add plugin headers to config #1411
Conversation
It seems |
you are right, and also debug_witness. please check how it is looking now with those 2 additions: https://pastebin.com/raw/8xcGAzSG |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See other comment
I was trying to get something better for points 2 and 3 of your review @pmconrad but i was not able to get anything that will fully convince me and probably you either. Here is what i think:
With all this i think that will make some sense it to move the map construction i added into
Any idea is appreciated as i am a bit stuck with this. |
A simple alternative might be to move |
An alternative approach would be to require plugins to put their configuration options in a section named after the plugin: What I've always wanted to do is have the plugins set their options as they do now, but then bundle up each plugin's options into a section named after the plugin before inserting them into the global template<typename PluginType>
std::shared_ptr<PluginType> register_plugin()
{
auto plug = std::make_shared<PluginType>();
plug->plugin_set_app(this);
boost::program_options::options_description plugin_cli_options(plug->plugin_name() + " plugin. " + plug->plugin_description() + "\nOptions"), plugin_cfg_options;
plug->plugin_set_program_options(plugin_cli_options, plugin_cfg_options);
if( !plugin_cli_options.options().empty() )
_cli_options.add(plugin_cli_options);
if( !plugin_cfg_options.options().empty() )
_cfg_options.add(plugin_cfg_options);
// Instead of _xyz_options.add(options) above,
// something like _xyz_options.add_section("section_name", options)
add_available_plugin( plug );
return plug;
} Unfortunately, I can't find any way to actually do this. I've even looked for ways to transform the options to add the section to the name, but there is no clear way to copy a So instead, an alternative would be to simply require plugins to politely bundle their options into a group internally, and then verify that they did it correctly at the Thoughts? |
Seems to me the section thing is the right way of doing it. I was not aware of the possibility. I am not against a way that will require to add some little code to every plugin we have including |
That sounds like a good solution, if it works. Perhaps also check https://www.boost.org/doc/libs/1_55_0/doc/html/program_options/howto.html#idp163421144 |
See #1641? |
replaced by #1641 |
#1407
Function
create_new_config_file
receives all the available command line options in order but it will not specify from what plugin they came from.Here i add a vector of pairs plugin_name, first_plugin_option in order to place a header. I know it is a bit dirty but i think it can work.
New plugins will need to be added here but if they are not added the header will not be added and nothing more, config will be generated anyways.
Here is how it looks:
https://pastebin.com/raw/whb5UDch