From af0088bf956b5f8a532de2356e2dd848d80e21d6 Mon Sep 17 00:00:00 2001 From: Yassir Najmaoui <43155068+yassirnajmaoui@users.noreply.github.com> Date: Mon, 25 Jul 2022 12:08:37 -0400 Subject: [PATCH] Update cxxopts.hpp Make the usage displaying optional --- include/cxxopts.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index 284ddf8..2afad9b 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -2725,10 +2725,13 @@ Options::generate_all_groups_help(String& result) const inline std::string -Options::help(const std::vector& help_groups) const +Options::help(const std::vector& help_groups, bool print_usage=true) const { - String result = m_help_string + "\nUsage:\n " + - toLocalString(m_program) + " " + toLocalString(m_custom_help); + String result = m_help_string; + if(print_usage) + { + result+= "\nUsage:\n " + toLocalString(m_program) + " " + toLocalString(m_custom_help); + } if (!m_positional.empty() && !m_positional_help.empty()) { result += " " + toLocalString(m_positional_help);