Skip to content

Commit

Permalink
feat: Allow empty targets map in egg config
Browse files Browse the repository at this point in the history
  • Loading branch information
elkowar committed Feb 2, 2025
1 parent 1c76d46 commit a972673
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/eggs_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ impl EggConfig {
let Ok(map) = value.as_map_ref() else {
return Err(rhai_error!("egg value must be a string or a map"));
};
let targets = map
.get("targets")
.ok_or_else(|| rhai_error!("egg table must contain a 'target' key"))?;
let empty_map = Dynamic::from(rhai::Map::new());
let targets = map.get("targets").unwrap_or(&empty_map);

let targets = if let Ok(targets) = targets.as_immutable_string_ref() {
maplit::hashmap! { PathBuf::from(".") => PathBuf::from(targets.to_string()) }
Expand Down

0 comments on commit a972673

Please sign in to comment.