diff options
Diffstat (limited to '')
-rw-r--r-- | client/settings.hpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/client/settings.hpp b/client/settings.hpp index 8c26a56..56f24f9 100644 --- a/client/settings.hpp +++ b/client/settings.hpp @@ -37,19 +37,18 @@ struct Settings { class SettingsParser { public: explicit SettingsParser(const std::string& argv0) : m_prog_name{extract_filename(argv0)} { + namespace po = boost::program_options; + m_visible.add_options()("help,h", "show this message and exit"); - m_visible.add_options()("command,c", boost::program_options::value(&m_settings.m_input), + m_visible.add_options()("command,c", po::value(&m_settings.m_input), "evaluate the argument expression and exit"); + m_visible.add_options()("host,H", po::value(&m_settings.m_host)->default_value("localhost"), + "server host address"); m_visible.add_options()( - "host,H", boost::program_options::value(&m_settings.m_host)->default_value("localhost"), - "server host address"); - m_visible.add_options()("port,p", - boost::program_options::value(&m_settings.m_port) - ->default_value(NetworkTransport::DEFAULT_PORT), - "server port number"); - m_hidden.add_options()( - "files", boost::program_options::value<std::vector<std::string>>(&m_settings.m_files), - "shouldn't be visible"); + "port,p", po::value(&m_settings.m_port)->default_value(NetworkTransport::DEFAULT_PORT), + "server port number"); + m_hidden.add_options()("files", po::value<std::vector<std::string>>(&m_settings.m_files), + "shouldn't be visible"); m_positional.add("files", -1); } @@ -58,17 +57,16 @@ public: } Settings parse(int argc, char* argv[]) { - boost::program_options::options_description all; + namespace po = boost::program_options; + + po::options_description all; all.add(m_hidden).add(m_visible); - boost::program_options::store(boost::program_options::command_line_parser{argc, argv} - .options(all) - .positional(m_positional) - .run(), - m_settings.m_vm); + po::store(po::command_line_parser{argc, argv}.options(all).positional(m_positional).run(), + m_settings.m_vm); if (m_settings.exit_with_usage()) { return m_settings; } - boost::program_options::notify(m_settings.m_vm); + po::notify(m_settings.m_vm); return m_settings; } |