From 28ecc4417abcafe419a2a45c9263743a52248dea Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 14 Jan 2020 20:01:06 +0300 Subject: formatting fixes --- client/settings.hpp | 32 +++++++++++++++----------------- server/main/settings.hpp | 25 +++++++++++++------------ 2 files changed, 28 insertions(+), 29 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>(&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>(&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; } diff --git a/server/main/settings.hpp b/server/main/settings.hpp index 11982da..4cff209 100644 --- a/server/main/settings.hpp +++ b/server/main/settings.hpp @@ -33,27 +33,28 @@ 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()("port,p", - boost::program_options::value(&m_settings.m_port) - ->default_value(Settings::DEFAULT_PORT), - "server port number"); - m_visible.add_options()("threads,n", - boost::program_options::value(&m_settings.m_threads) - ->default_value(Settings::default_threads()), - "number of threads"); + m_visible.add_options()( + "port,p", po::value(&m_settings.m_port)->default_value(Settings::DEFAULT_PORT), + "server port number"); + m_visible.add_options()( + "threads,n", + po::value(&m_settings.m_threads)->default_value(Settings::default_threads()), + "number of threads"); } static const char* get_short_description() { return "[-h|--help] [-p|--port] [-n|--threads]"; } Settings parse(int argc, char* argv[]) { - boost::program_options::store( - boost::program_options::command_line_parser{argc, argv}.options(m_visible).run(), - m_settings.m_vm); + namespace po = boost::program_options; + + po::store(po::command_line_parser{argc, argv}.options(m_visible).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; } -- cgit v1.2.3