commit 7e8e8f3d66d11bffcfd7c4d99ac84b91fa86cef1 parent f35303ec28b50839c56b8aac953e95b18379b610 Author: Dimitrije Dobrota <mail@dimitrijedobrota.com> Date: Wed, 12 Jun 2024 18:20:41 +0200 Fix sort issue where no long options are available Diffstat:
M | src/help.cpp | | | 4 | ++-- |
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/help.cpp b/src/help.cpp @@ -26,8 +26,8 @@ bool Parser::help_entry_t::operator<(const help_entry_t &rhs) const { : '0'; if (l1 != l2) return l1 < l2; - - return std::strcmp(opt_long.front(), rhs.opt_long.front()) < 0; + if (!opt_long.empty() || !rhs.opt_long.empty()) return !opt_long.empty(); + return std::strcmp(opt_long.front(), rhs.opt_long.front()) < 0; } void Parser::print_other_usages(FILE *stream) const {