mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-30 10:55:37 -04:00
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
1 changed files with 13 additions and 1 deletions
|
@ -51,6 +51,10 @@ handle_args( QCoreApplication& a )
|
||||||
{
|
{
|
||||||
QCommandLineOption debugLevelOption( QStringLiteral("D"),
|
QCommandLineOption debugLevelOption( QStringLiteral("D"),
|
||||||
"Verbose output for debugging purposes (0-8).", "level" );
|
"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;
|
QCommandLineParser parser;
|
||||||
parser.setApplicationDescription( "Calamares module tester" );
|
parser.setApplicationDescription( "Calamares module tester" );
|
||||||
|
@ -58,11 +62,16 @@ handle_args( QCoreApplication& a )
|
||||||
parser.addVersionOption();
|
parser.addVersionOption();
|
||||||
|
|
||||||
parser.addOption( debugLevelOption );
|
parser.addOption( debugLevelOption );
|
||||||
|
parser.addOption( globalOption );
|
||||||
|
parser.addOption( jobOption );
|
||||||
parser.addPositionalArgument( "module", "Path or name of module to run." );
|
parser.addPositionalArgument( "module", "Path or name of module to run." );
|
||||||
parser.addPositionalArgument( "config", "Path of job-config file to use.", "[config]");
|
parser.addPositionalArgument( "config", "Path of job-config file to use.", "[config]");
|
||||||
|
|
||||||
parser.process( a );
|
parser.process( a );
|
||||||
|
|
||||||
|
QString globalSettings( parser.value( globalOption ) );
|
||||||
|
QString jobSettings( parser.value( jobOption ) );
|
||||||
|
|
||||||
if ( parser.isSet( debugLevelOption ) )
|
if ( parser.isSet( debugLevelOption ) )
|
||||||
{
|
{
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
@ -89,7 +98,10 @@ handle_args( QCoreApplication& a )
|
||||||
return ModuleConfig(); // NOTREACHED
|
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…
Add table
Add a link
Reference in a new issue