From 3163e6d28d9986a6b0688c83e9b8b2786b4716ef Mon Sep 17 00:00:00 2001 From: Krzysiek Karbowiak Date: Sun, 21 Sep 2025 10:27:51 +0200 Subject: [PATCH 1/4] Cleanup: mark class as final --- include/argparse.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/argparse.hpp b/include/argparse.hpp index 4b2b28c..d80d98f 100644 --- a/include/argparse.hpp +++ b/include/argparse.hpp @@ -508,7 +508,7 @@ namespace argparse }; template - class TypeHandlerT : public TypeHandler + class TypeHandlerT final : public TypeHandler { public: auto from_string(std::string const & string) const -> std::any override From c1c6b550bdcae75dacb5d0a82c36ab9d1a5cbf27 Mon Sep 17 00:00:00 2001 From: Krzysiek Karbowiak Date: Sun, 21 Sep 2025 10:28:28 +0200 Subject: [PATCH 2/4] Cleanup: rename local variable --- include/argparse.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/argparse.hpp b/include/argparse.hpp index d80d98f..daae3fa 100644 --- a/include/argparse.hpp +++ b/include/argparse.hpp @@ -1520,15 +1520,15 @@ namespace argparse for (auto const & argument : arguments | std::views::filter(&Formattable::is_positional)) { - auto arg_line = " " + format_arg(argument); + auto help_line = " " + format_arg(argument); if (auto const & help = argument.get_help(); !help.empty()) { - arg_line += help_string_separation(arg_line.size()); - arg_line += replace_prog(help, prog); + help_line += help_string_separation(help_line.size()); + help_line += replace_prog(help, prog); } - help_text += '\n' + arg_line; + help_text += '\n' + help_line; } return help_text; From 982f10c6f0e913eed6d6f93e05f28cb09da7dcfa Mon Sep 17 00:00:00 2001 From: Krzysiek Karbowiak Date: Sun, 21 Sep 2025 10:28:41 +0200 Subject: [PATCH 3/4] Cleanup: rename local variable --- include/argparse.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/argparse.hpp b/include/argparse.hpp index daae3fa..e6caf95 100644 --- a/include/argparse.hpp +++ b/include/argparse.hpp @@ -1541,27 +1541,27 @@ namespace argparse for (auto const & argument : arguments | std::views::filter([](auto const & a) { return !a.is_positional(); })) { - auto arg_line = std::string(" "); + auto help_line = std::string(" "); auto const formatted_arg = format(argument); for (auto name_it = argument.get_names().begin(); name_it != argument.get_names().end(); ++name_it) { if (name_it != argument.get_names().begin()) { - arg_line += ", "; + help_line += ", "; } - arg_line += *name_it; - arg_line += formatted_arg; + help_line += *name_it; + help_line += formatted_arg; } if (auto const & help = argument.get_help(); !help.empty()) { - arg_line += help_string_separation(arg_line.size()); - arg_line += replace_prog(help, prog); + help_line += help_string_separation(help_line.size()); + help_line += replace_prog(help, prog); } - help_text += '\n' + arg_line; + help_text += '\n' + help_line; } return help_text; From 95c1d5224bae21ca4832847bbbc6d28d60bc1786 Mon Sep 17 00:00:00 2001 From: Krzysiek Karbowiak Date: Sun, 21 Sep 2025 10:28:52 +0200 Subject: [PATCH 4/4] Cleanup: rename function parameter --- include/argparse.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/argparse.hpp b/include/argparse.hpp index e6caf95..b6de356 100644 --- a/include/argparse.hpp +++ b/include/argparse.hpp @@ -1619,11 +1619,11 @@ namespace argparse return result; } - auto help_string_separation(std::size_t arg_line_length) const -> std::string_view + auto help_string_separation(std::size_t help_line_length) const -> std::string_view { constexpr auto fill = std::string_view("\n "); - return arg_line_length < 23 - ? fill.substr(arg_line_length + 1) + return help_line_length < 23 + ? fill.substr(help_line_length + 1) : fill; } };