diff options
Diffstat (limited to 'crates/rebel/src/main.rs')
-rw-r--r-- | crates/rebel/src/main.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/crates/rebel/src/main.rs b/crates/rebel/src/main.rs index 76b4551..fe0671b 100644 --- a/crates/rebel/src/main.rs +++ b/crates/rebel/src/main.rs @@ -1,17 +1,13 @@ -mod args; -mod context; mod driver; -mod paths; -mod pin; mod recipe; -mod resolve; -mod task; mod template; -use std::collections::HashSet; +use std::{collections::HashSet, fs::File, path::Path}; use clap::Parser; +use rebel_common::error::*; +use rebel_resolve::{self as resolve, context, pin}; use rebel_runner::{self as runner, Runner}; #[derive(Parser)] @@ -29,6 +25,14 @@ struct Opts { tasks: Vec<String>, } +fn read_pins<P: AsRef<Path>>(path: P) -> Result<pin::Pins> { + let f = File::open(path)?; + let pins: pin::Pins = serde_yaml::from_reader(f) + .map_err(Error::new) + .context("YAML error")?; + Ok(pins) +} + fn main() { let opts: Opts = Opts::parse(); @@ -36,7 +40,7 @@ fn main() { let ctx = context::Context::new( recipe::read_recipes("examples/recipes").unwrap(), - pin::read_pins("examples/pins.yml").unwrap(), + read_pins("examples/pins.yml").unwrap(), ) .unwrap(); |