Skip to content
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

change application cli/ config options to member variable #67

Merged
merged 2 commits into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class application_impl {
}
options_description _app_options;
options_description _cfg_options;
variables_map _options;

bfs::path _data_dir{"data-dir"};
bfs::path _config_dir{"config-dir"};
Expand Down Expand Up @@ -194,7 +195,7 @@ void application::set_program_options()
bool application::initialize_impl(int argc, char** argv, vector<abstract_plugin*> autostart_plugins) {
set_program_options();

bpo::variables_map options;
bpo::variables_map& options = my->_options;
bpo::store(bpo::parse_command_line(argc, argv, my->_app_options), options);

if( options.count( "help" ) ) {
Expand Down Expand Up @@ -462,4 +463,8 @@ void application::set_sighup_callback(std::function<void()> callback) {
sighup_callback = callback;
}

const bpo::variables_map& application::get_options() const{
return my->_options;
}

} /// namespace appbase
2 changes: 2 additions & 0 deletions include/appbase/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ namespace appbase {
return pri_queue;
}

const bpo::variables_map& get_options() const;

/**
* Set the current thread schedule priority to maximum.
* Works for pthreads.
Expand Down