pub fn run_with_merged_args<A, F>(
setup_fn: F,
) -> Result<Context, Box<dyn Error>>where
A: Args + Serialize + DeserializeOwned + Default,
F: Fn(&mut Context, RunnerArgs<A>) -> Result<(), IxaError>,Expand description
Runs a simulation with merged base and custom arguments from CLI and config.
Values in args from the JSON config override defaults. Explicit CLI flags
override config values. Custom config values are read from args.custom.
Custom merging supports top-level serde fields whose names match clap arg
IDs. A field whose serde name differs from its clap arg id (e.g. via
#[serde(rename)] or #[serde(flatten)]) can still be set from the
config, but an explicit CLI value for it cannot be detected, so the config
value takes precedence for that field.
config itself is CLI-only and is not read from the config file.
Custom args are merged by round-tripping through JSON, so custom path
arguments given on the command line must be valid UTF-8. Base path
arguments (--config, --output) have no such restriction.
ยงErrors
Returns an error if config merging or the setup function fails. Invalid command line arguments print an error and exit the process.