diff --git a/app/core.cpp b/app/core.cpp index 945bd3f2b..4ab066d1c 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -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();