diff --git a/src/cxxopts.cpp b/src/cxxopts.cpp index 7f5ac29..df382b2 100644 --- a/src/cxxopts.cpp +++ b/src/cxxopts.cpp @@ -24,6 +24,8 @@ THE SOFTWARE. #include "cxxopts.hpp" +#include + #define OPTION_LONGEST 30 #define OPTION_DESC_GAP 2 @@ -136,8 +138,8 @@ Options::add_options(std::string group) OptionAdder& OptionAdder::operator() -( - const std::string& opts, +( + const std::string& opts, const std::string& desc, std::shared_ptr value ) @@ -162,7 +164,7 @@ void Options::parse_option ( std::shared_ptr value, - const std::string& name, + const std::string& name, const std::string& arg ) { @@ -291,7 +293,7 @@ Options::parse(int& argc, char**& argv) else if (result[1].length() != 0) { std::string name = result[1]; - + auto iter = m_options.find(name); if (iter == m_options.end()) @@ -343,8 +345,8 @@ void Options::add_option ( const std::string& group, - const std::string& s, - const std::string& l, + const std::string& s, + const std::string& l, const std::string& desc, std::shared_ptr value ) @@ -397,7 +399,7 @@ Options::help_one_group(const std::string& g) const size_t longest = 0; std::string result; - + if (!g.empty()) { result += " " + g + " options:\n\n"; @@ -443,7 +445,7 @@ Options::help_one_group(const std::string& g) const std::string Options::help(const std::vector& groups) const { - std::string result = "Usage:\n " + m_program + " [OPTION...] " + std::string result = "Usage:\n " + m_program + " [OPTION...] " + m_help_string + "\n\n"; for (const auto& g : groups) diff --git a/src/cxxopts.hpp b/src/cxxopts.hpp index bfbe7b7..1603db5 100644 --- a/src/cxxopts.hpp +++ b/src/cxxopts.hpp @@ -22,13 +22,13 @@ THE SOFTWARE. */ -#include -#include -#include #include -#include - #include +#include +#include +#include +#include +#include namespace cxxopts { @@ -130,7 +130,7 @@ namespace cxxopts public: option_not_has_argument_exception ( - const std::string& option, + const std::string& option, const std::string& arg ) : OptionParseException( @@ -288,7 +288,7 @@ namespace cxxopts { } - const std::string& + const std::string& description() const { return m_desc; @@ -361,8 +361,8 @@ namespace cxxopts add_option ( const std::string& group, - const std::string& s, - const std::string& l, + const std::string& s, + const std::string& l, const std::string& desc, std::shared_ptr value ); @@ -400,7 +400,7 @@ namespace cxxopts help(const std::vector& groups = {""}) const; private: - + void add_one_option ( @@ -418,10 +418,10 @@ namespace cxxopts parse_option ( std::shared_ptr value, - const std::string& name, + const std::string& name, const std::string& arg = "" ); - + void checked_parse_arg ( @@ -456,8 +456,8 @@ namespace cxxopts OptionAdder& operator() - ( - const std::string& opts, + ( + const std::string& opts, const std::string& desc, std::shared_ptr value = ::cxxopts::value()