There are a couple of program options (viz. overwrite and debug_model) which can be set either in settings.toml or with command-line arguments with the latter taking precedence. With the way it's currently implemented, you need to update both the code in two places to add an option like this, which is annoying and bugprone (it would be easy to get the "CLI setting takes precedence" code wrong). It would be nice if we could just set them in one place.
The first thing that comes to mind is that we could just have a single struct representing these options. Both the clap crate (which we use for the CLI) and serde (reading TOML files) provide options for "flattening" structs that are members of other structs, so maybe we can do something this way? This will still involve figuring out how to combine the CLI options with the ones in settings.toml though. Dunno. Maybe worth trying!
We could use proc macros for this too, but that will probably be a pain.
There are a couple of program options (viz.
overwriteanddebug_model) which can be set either insettings.tomlor with command-line arguments with the latter taking precedence. With the way it's currently implemented, you need to update both the code in two places to add an option like this, which is annoying and bugprone (it would be easy to get the "CLI setting takes precedence" code wrong). It would be nice if we could just set them in one place.The first thing that comes to mind is that we could just have a single struct representing these options. Both the
clapcrate (which we use for the CLI) andserde(reading TOML files) provide options for "flattening" structs that are members of other structs, so maybe we can do something this way? This will still involve figuring out how to combine the CLI options with the ones insettings.tomlthough. Dunno. Maybe worth trying!We could use proc macros for this too, but that will probably be a pain.