diff options
Diffstat (limited to 'argument.cpp')
-rw-r--r-- | argument.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/argument.cpp b/argument.cpp index b70a0dd..fd0c50d 100644 --- a/argument.cpp +++ b/argument.cpp @@ -14,11 +14,12 @@ * limitations under the License. */ -#include <iostream> -#include <iterator> +#include "argument.hpp" + #include <algorithm> #include <cassert> -#include "argument.hpp" +#include <iostream> +#include <iterator> namespace phosphor { @@ -29,17 +30,17 @@ const std::string ArgumentParser::true_string = "true"; const std::string ArgumentParser::empty_string = ""; const char* ArgumentParser::optionstr = "p:?h"; -const option ArgumentParser::options[] = -{ - { "path", required_argument, nullptr, 'p' }, - { "help", no_argument, nullptr, 'h' }, - { 0, 0, 0, 0}, +const option ArgumentParser::options[] = { + {"path", required_argument, nullptr, 'p'}, + {"help", no_argument, nullptr, 'h'}, + {0, 0, 0, 0}, }; ArgumentParser::ArgumentParser(int argc, char** argv) { int option = 0; - while(-1 != (option = getopt_long(argc, argv, optionstr, options, nullptr))) + while (-1 != + (option = getopt_long(argc, argv, optionstr, options, nullptr))) { if ((option == '?') || (option == 'h')) { @@ -48,7 +49,8 @@ ArgumentParser::ArgumentParser(int argc, char** argv) } auto i = &options[0]; - while ((i->val != option) && (i->val != 0)) ++i; + while ((i->val != option) && (i->val != 0)) + ++i; if (i->val) arguments[i->name] = (i->has_arg ? optarg : true_string); @@ -74,8 +76,7 @@ void ArgumentParser::usage(char** argv) std::cerr << "Options:" << std::endl; std::cerr << " --help Print this menu" << std::endl; std::cerr << " --path=<path> absolute path of LED in sysfs; like"; - std::cerr << " /sys/class/leds/<name>" - << std::endl; + std::cerr << " /sys/class/leds/<name>" << std::endl; } } // namespace led } // namespace phosphor |