From e71eb6f178c77fbe611f66857aeccecf4e8db13b Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Mon, 17 Jun 2019 18:25:43 +0100 Subject: COMPMID-2079: Print positional argument help Change-Id: I7308f36bbc9e3a92c99495b49cd8129d992c38e9 Signed-off-by: Georgios Pinitas Reviewed-on: https://review.mlplatform.org/c/1363 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- utils/command_line/CommandLineParser.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/command_line/CommandLineParser.h b/utils/command_line/CommandLineParser.h index f834af8e9f..f82d21ab19 100644 --- a/utils/command_line/CommandLineParser.h +++ b/utils/command_line/CommandLineParser.h @@ -225,8 +225,17 @@ inline void CommandLineParser::print_help(const std::string &program_name) const for(const auto &option : _positional_options) { - // TODO(COMPMID-2079): Print help string as well - std::cout << option->name() << "\n"; + std::string help_to_print; + + // Extract help sub-string + const std::string help_str = option->help(); + const size_t help_pos = help_str.find(" - "); + if(help_pos != std::string::npos) + { + help_to_print = help_str.substr(help_pos); + } + + std::cout << option->name() << help_to_print << "\n"; } } } // namespace utils -- cgit v1.2.1