diff --git a/src/main.cc b/src/main.cc index 42afd4a..ba43e1a 100644 --- a/src/main.cc +++ b/src/main.cc @@ -24,8 +24,7 @@ static void show_usage(const bool include_help) std::cout << "opustags v" << version << "\n"; std::cout << usage; - if (include_help) - { + if (include_help) { std::cout << "\n"; std::cout << help; } @@ -33,25 +32,20 @@ static void show_usage(const bool include_help) int main(int argc, char **argv) { - if (argc == 1) - { + if (argc == 1) { show_usage(false); return EXIT_SUCCESS; } - try - { + try { const auto options = opustags::parse_args(argc, argv); - if (options.show_help) - { + if (options.show_help) { show_usage(true); return EXIT_SUCCESS; } std::cout << "Working...\n"; - } - catch (const std::exception &e) - { + } catch (const std::exception &e) { std::cerr << e.what(); return EXIT_FAILURE; } diff --git a/src/options.cc b/src/options.cc index a34c906..045916b 100644 --- a/src/options.cc +++ b/src/options.cc @@ -36,12 +36,10 @@ Options opustags::parse_args(const int argc, char **argv) Options options; char c; optind = 0; - while ((c = getopt_long(argc, argv, short_def, long_def, nullptr)) != -1) - { + while ((c = getopt_long(argc, argv, short_def, long_def, nullptr)) != -1) { const std::string arg(optarg == nullptr ? "" : optarg); - switch (c) - { + switch (c) { case 'h': options.show_help = true; break; diff --git a/src/options.h b/src/options.h index d63f8ed..afc4adf 100644 --- a/src/options.h +++ b/src/options.h @@ -21,9 +21,8 @@ namespace opustags std::vector to_delete; }; - class ArgumentError : public std::runtime_error + struct ArgumentError : std::runtime_error { - public: ArgumentError(const std::string &message); };