format exlcude for gcc12 support

master v0.1.8
cobrapitz 3 years ago
parent 91257c11ee
commit 6bdbbaf182

@ -18,8 +18,6 @@
#endif #endif
//#define CB_EXCLUDE_FORMATTED_PRINTS
#include "cb/test/test.h" #include "cb/test/test.h"
#include "cb/time/time.h" #include "cb/time/time.h"

@ -2,10 +2,6 @@
#include "cb/argparser/argument_parser.h" #include "cb/argparser/argument_parser.h"
#include "cb/argparser/argument.h" #include "cb/argparser/argument.h"
#ifndef CB_EXCLUDE_FORMATTED_PRINTS
#include <format>
#endif
cb::argparser::Argument::Argument(std::string content, cb::argparser::Type type) : content{std::move(content)}, type{type} { cb::argparser::Argument::Argument(std::string content, cb::argparser::Type type) : content{std::move(content)}, type{type} {
if (type == Type::BOOL_TYPE && this->content == "false") { if (type == Type::BOOL_TYPE && this->content == "false") {
this->content = ""; this->content = "";
@ -187,11 +183,7 @@ std::string cb::argparser::ArgumentParser::get_help() {
if (not positional_arguments.empty()) { if (not positional_arguments.empty()) {
help_message += "Positional Arguments:\n"; help_message += "Positional Arguments:\n";
for (auto &&arg: positional_arguments) { for (auto &&arg: positional_arguments) {
#ifndef CB_EXCLUDE_FORMATTED_PRINTS help_message += arg.name + ": " + arg.description + "\n";
help_message += std::format("{:15} {}\n",
arg.name,
arg.description);
#endif
} }
help_message += "\n"; help_message += "\n";
} }
@ -199,12 +191,7 @@ std::string cb::argparser::ArgumentParser::get_help() {
if (not arguments.empty()) { if (not arguments.empty()) {
help_message += "Arguments:\n"; help_message += "Arguments:\n";
for (auto &&arg: arguments) { for (auto &&arg: arguments) {
#ifndef CB_EXCLUDE_FORMATTED_PRINTS help_message += arg.short_name + " " + arg.name + ": " + arg.description + "\n";
help_message += std::format("{:5} {:15} {}\n",
arg.short_name,
arg.name,
arg.description);
#endif
} }
help_message += "\n"; help_message += "\n";
} }

Loading…
Cancel
Save