core: don't start if help or version args are used
This commit is contained in:
+10
-7
@@ -84,16 +84,13 @@ int Core::execute(QCoreApplication* a)
|
||||
{
|
||||
int exit_code = 1;
|
||||
|
||||
// Start core
|
||||
OLIVE_NAMESPACE::Core::instance()->Start();
|
||||
|
||||
//
|
||||
// Parse command line arguments
|
||||
//
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
QCommandLineOption help_option = parser.addHelpOption();
|
||||
QCommandLineOption version_option = parser.addVersionOption();
|
||||
|
||||
// Project from command line option
|
||||
// FIXME: What's the correct way to make a visually "optional" positional argument, or is manually adding square
|
||||
@@ -111,6 +108,14 @@ int Core::execute(QCoreApplication* a)
|
||||
// Parse options
|
||||
parser.process(*a);
|
||||
|
||||
if (parser.isSet(help_option) || parser.isSet(version_option)) {
|
||||
// These options don't launch any of the application proper
|
||||
return a->exec();
|
||||
}
|
||||
|
||||
// Start core
|
||||
OLIVE_NAMESPACE::Core::instance()->Start();
|
||||
|
||||
QStringList args = parser.positionalArguments();
|
||||
|
||||
// Detect project to load on startup
|
||||
@@ -142,8 +147,6 @@ int Core::execute(QCoreApplication* a)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Clear core memory
|
||||
OLIVE_NAMESPACE::Core::instance()->Stop();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user