mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-08 22:21:45 +00:00
Reuse one CLI config layer during run creation
This commit is contained in:
parent
ed651dcd57
commit
c58ed933bf
3 changed files with 8 additions and 4 deletions
|
|
@ -6,12 +6,13 @@ use crate::args::{GlobalArgs, RunArgs};
|
|||
|
||||
pub(crate) async fn execute(mut args: RunArgs, _globals: &GlobalArgs) -> Result<()> {
|
||||
let styles: &'static Styles = Box::leak(Box::new(Styles::detect_stderr()));
|
||||
let cli_settings = ConfigLayer::cli()?.resolve()?;
|
||||
let cli = ConfigLayer::cli()?;
|
||||
let cli_settings = cli.clone().resolve()?;
|
||||
args.verbose = args.verbose || cli_settings.verbose_enabled();
|
||||
|
||||
let quiet = args.detach;
|
||||
let prevent_idle_sleep = cli_settings.prevent_idle_sleep_enabled();
|
||||
let (run_id, run_dir) = super::create::create_run(&args, styles, quiet)?;
|
||||
let (run_id, run_dir) = super::create::create_run(&args, cli, styles, quiet)?;
|
||||
|
||||
#[cfg(feature = "sleep_inhibitor")]
|
||||
let _sleep_guard = crate::sleep_inhibitor::guard(prevent_idle_sleep);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use super::output::{print_diagnostics_from_error, print_workflow_report_from_per
|
|||
/// This does NOT execute the workflow — it only prepares the run directory.
|
||||
pub(crate) fn create_run(
|
||||
args: &RunArgs,
|
||||
cli_defaults: ConfigLayer,
|
||||
styles: &Styles,
|
||||
quiet: bool,
|
||||
) -> anyhow::Result<(String, PathBuf)> {
|
||||
|
|
@ -24,7 +25,7 @@ pub(crate) fn create_run(
|
|||
let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
|
||||
let settings: FabroSettings = cli_args_config
|
||||
.combine(ConfigLayer::for_workflow(workflow_path, &cwd)?)
|
||||
.combine(ConfigLayer::cli()?)
|
||||
.combine(cli_defaults)
|
||||
.resolve()?;
|
||||
|
||||
let created = match create(CreateRunInput {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use anyhow::Result;
|
||||
use fabro_config::ConfigLayer;
|
||||
use fabro_config::FabroSettingsExt;
|
||||
use fabro_util::terminal::Styles;
|
||||
use fabro_workflows::run_lookup::{resolve_run_combined, runs_base};
|
||||
|
|
@ -34,7 +35,8 @@ pub(crate) async fn dispatch(cmd: RunCommands, globals: &GlobalArgs) -> Result<(
|
|||
RunCommands::Run(args) => command::execute(args, globals).await,
|
||||
RunCommands::Create(args) => {
|
||||
let styles: &'static Styles = Box::leak(Box::new(Styles::detect_stderr()));
|
||||
let (run_id, _run_dir) = create::create_run(&args, styles, true)?;
|
||||
let cli = ConfigLayer::cli()?;
|
||||
let (run_id, _run_dir) = create::create_run(&args, cli, styles, true)?;
|
||||
println!("{run_id}");
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue