diff --git a/src/conf/args.rs b/src/conf/args.rs index b18256c..0824fb4 100644 --- a/src/conf/args.rs +++ b/src/conf/args.rs @@ -126,6 +126,10 @@ pub struct Args { #[clap(long, value_name = "project")] pub project: Option, + /// Configuration passed as a TOML string + #[clap(long)] + pub config_toml: Option, + #[clap()] /// What to do: either a job, or a path, or both pub args: Vec, diff --git a/src/conf/settings.rs b/src/conf/settings.rs index 8881baf..027869b 100644 --- a/src/conf/settings.rs +++ b/src/conf/settings.rs @@ -88,6 +88,7 @@ impl Settings { /// * the package level `bacon.toml` file in package-root/.bacon.toml /// * the package level `bacon.toml` file in package-root/.config/.bacon.toml /// * the file whose path is in environment variable `BACON_CONFIG` + /// * the content of the `--config-toml` argument /// * args given as arguments, coming from the cli call pub fn read( args: &Args, @@ -122,6 +123,12 @@ impl Settings { } } + if let Some(toml) = &args.config_toml { + let config = toml::from_str(toml)?; + info!("config loaded from --config-toml: {:#?}", &config); + settings.apply_config(&config); + } + settings.apply_args(args); settings.check()?; info!("settings: {:#?}", &settings);