Skip to content

Refactor to allow overriding settings.toml options directly from CLI #1284

@alexdewar

Description

@alexdewar

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions