add program argument for functional testing; simplify execute argument

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-08-26 21:29:00 +00:00
parent ffc41cb01f
commit fcb9d04d9e
2 changed files with 12 additions and 4 deletions

View file

@ -28,6 +28,10 @@ pub(crate) struct Args {
/// Execute console command automatically after startup.
#[arg(long)]
pub(crate) execute: Vec<String>,
/// Set functional testing modes if available. Ex '--test=smoke'
#[arg(long, hide(true))]
pub(crate) test: Vec<String>,
}
/// Parse commandline arguments into structured data
@ -44,9 +48,10 @@ pub(crate) fn update(mut config: Figment, args: &Args) -> Result<Figment> {
}
// Execute commands after any commands listed in configuration file
for command in &args.execute {
config = config.adjoin(("admin_execute", [command]));
}
config = config.adjoin(("admin_execute", &args.execute));
// Update config with names of any functional-tests
config = config.adjoin(("test", &args.test));
// All other individual overrides can go last in case we have options which
// set multiple conf items at once and the user still needs granular overrides.