Tests: add command-line options to loadmodule
- The testing-application loadmodule gets -g and -j options for loading configurations (although -g is not implemented yet).
This commit is contained in:
parent
aebe67fde7
commit
a36afc52df
@ -51,6 +51,10 @@ handle_args( QCoreApplication& a )
|
||||
{
|
||||
QCommandLineOption debugLevelOption( QStringLiteral("D"),
|
||||
"Verbose output for debugging purposes (0-8).", "level" );
|
||||
QCommandLineOption globalOption( QStringList() << QStringLiteral( "g" ) << QStringLiteral( "global "),
|
||||
QStringLiteral( "Global settings document" ), "global.yaml" );
|
||||
QCommandLineOption jobOption( QStringList() << QStringLiteral( "j" ) << QStringLiteral( "job"),
|
||||
QStringLiteral( "Job settings document" ), "job.yaml" );
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription( "Calamares module tester" );
|
||||
@ -58,11 +62,16 @@ handle_args( QCoreApplication& a )
|
||||
parser.addVersionOption();
|
||||
|
||||
parser.addOption( debugLevelOption );
|
||||
parser.addOption( globalOption );
|
||||
parser.addOption( jobOption );
|
||||
parser.addPositionalArgument( "module", "Path or name of module to run." );
|
||||
parser.addPositionalArgument( "config", "Path of job-config file to use.", "[config]");
|
||||
|
||||
parser.process( a );
|
||||
|
||||
QString globalSettings( parser.value( globalOption ) );
|
||||
QString jobSettings( parser.value( jobOption ) );
|
||||
|
||||
if ( parser.isSet( debugLevelOption ) )
|
||||
{
|
||||
bool ok = true;
|
||||
@ -89,7 +98,10 @@ handle_args( QCoreApplication& a )
|
||||
return ModuleConfig(); // NOTREACHED
|
||||
}
|
||||
|
||||
return ModuleConfig( args.first(), args.size() == 2 ? args.at(1) : QString() );
|
||||
if ( jobSettings.isEmpty() && ( args.size() == 2 ) )
|
||||
jobSettings = args.at(1);
|
||||
|
||||
return ModuleConfig( args.first(), jobSettings );
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user