Skip to content

Commit

Permalink
fix: properly handle -v in the new CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Apr 20, 2024
1 parent 7b8d670 commit 53ac470
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cli/src/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
int parseAndRunCliArgsV2(QCoreApplication *app, Profile *profile, bool defaultToGui, QMap<QString, QString> &params, QStringList &positionalArgs)
{
QCommandLineCommandParser parser;
parser.addVersionOption();
QCommandLineOption versionOpt = parser.addVersionOption();
parser.addHelpOptionOnly();

if (defaultToGui) {
Expand Down Expand Up @@ -75,6 +75,12 @@ int parseAndRunCliArgsV2(QCoreApplication *app, Profile *profile, bool defaultTo

// If we're here, that means that help was requested or no command was passed
if (cmd == nullptr) {
// Handle the -v flag
if (parser.isSet(versionOpt)) {
parser.showVersion();
return 0;
}

parser.showHelp();
return 1;
}
Expand Down

0 comments on commit 53ac470

Please sign in to comment.