@@ -24,7 +24,7 @@ auto helpOption =
2424 CommandOption ({ " h" , " help" }, QStringLiteral(" Displays this help" ));
2525
2626QString optionsToString (const QList<CommandOption>& options,
27- const QList<CommandArgument>& arguments )
27+ const QList<CommandArgument>& subcommands )
2828{
2929 int size = 0 ; // track the largest size
3030 QStringList dashedOptionList;
@@ -42,10 +42,10 @@ QString optionsToString(const QList<CommandOption>& options,
4242 }
4343 dashedOptionList << joinedDashedOptions;
4444 }
45- // check the length of the arguments
46- for (auto const & arg : arguments ) {
47- if (arg .name ().length () > size) {
48- size = arg .name ().length ();
45+ // check the length of the subcommands
46+ for (auto const & subcommand : subcommands ) {
47+ if (subcommand .name ().length () > size) {
48+ size = subcommand .name ().length ();
4949 }
5050 }
5151 // generate the text
@@ -60,17 +60,17 @@ QString optionsToString(const QList<CommandOption>& options,
6060 .arg (options.at (i).description ().replace (
6161 QLatin1String (" \n " ), linePadding));
6262 }
63- if (!arguments .isEmpty ()) {
63+ if (!subcommands .isEmpty ()) {
6464 result += QLatin1String (" \n " );
6565 }
6666 }
67- if (!arguments .isEmpty ()) {
68- result += QObject::tr (" Arguments " ) + " :\n " ;
67+ if (!subcommands .isEmpty ()) {
68+ result += QObject::tr (" Subcommands " ) + " :\n " ;
6969 }
70- for (const auto & argument : arguments ) {
70+ for (const auto & subcommand : subcommands ) {
7171 result += QStringLiteral (" %1 %2\n " )
72- .arg (argument .name ().leftJustified (size, ' ' ))
73- .arg (argument .description ());
72+ .arg (subcommand .name ().leftJustified (size, ' ' ))
73+ .arg (subcommand .description ());
7474 }
7575 return result;
7676}
@@ -326,7 +326,7 @@ void CommandLineParser::printHelp(QStringList args, const Node* node)
326326 argName = qApp->applicationName ();
327327 }
328328 QString argText =
329- node->subNodes .isEmpty () ? " " : " [" + QObject::tr (" arguments " ) + " ]" ;
329+ node->subNodes .isEmpty () ? " " : " [" + QObject::tr (" subcommands " ) + " ]" ;
330330 helpText += (QObject::tr (" Usage" ) + " : %1 [%2-" + QObject::tr (" options" ) +
331331 QStringLiteral (" ] %3\n\n " ))
332332 .arg (args.join (QStringLiteral (" " )))
@@ -339,9 +339,9 @@ void CommandLineParser::printHelp(QStringList args, const Node* node)
339339 helpText += " \n\n " ;
340340
341341 // add command options and subarguments
342- QList<CommandArgument> subArgs ;
342+ QList<CommandArgument> subcommands ;
343343 for (const Node& n : node->subNodes ) {
344- subArgs .append (n.argument );
344+ subcommands .append (n.argument );
345345 }
346346 auto modifiedOptions = node->options ;
347347 if (m_withHelp) {
@@ -350,7 +350,7 @@ void CommandLineParser::printHelp(QStringList args, const Node* node)
350350 if (m_withVersion && node == &m_parseTree) {
351351 modifiedOptions << versionOption;
352352 }
353- helpText += optionsToString (modifiedOptions, subArgs );
353+ helpText += optionsToString (modifiedOptions, subcommands );
354354 // print it
355355 out << helpText;
356356}
0 commit comments