From dfeeffc60695ffb0c7bbfb148d3e61356d17ccae Mon Sep 17 00:00:00 2001 From: AmirHossein Sojoodi Date: Thu, 30 Nov 2023 13:54:41 -0500 Subject: [PATCH] Print long names in help option Related to #240, #363, and #349 --- include/cxxopts.hpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index cbbef80..7596e8d 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -2088,9 +2088,21 @@ format_option result += " "; } - if (!l.empty()) + auto is_first_name = true; + for (const auto& name : o.l) { - result += " --" + toLocalString(l); + if (!name.empty()) + { + if (is_first_name) + { + result += " --" + toLocalString(name); + is_first_name = false; + } + else + { + result += ", --" + toLocalString(name); + } + } } auto arg = !o.arg_help.empty() ? toLocalString(o.arg_help) : "arg";