Add blueprint file input as option for blueprint apply

This commit is contained in:
Riley-Kilgore
2024-10-24 09:24:04 -07:00
committed by Lucas
parent a7741ec286
commit 8d8f91b76e
2 changed files with 13 additions and 2 deletions

View File

@@ -565,6 +565,7 @@ where
pub fn construct_parameter_incrementally<F>(
&self,
title: Option<&String>,
blueprint_input: &Option<PathBuf>,
ask: F,
) -> Result<PlutusData, Error>
where
@@ -574,7 +575,12 @@ where
) -> Result<PlutusData, blueprint::error::Error>,
{
// Read blueprint
let blueprint = File::open(self.blueprint_path())
let project_blueprint_path = self.blueprint_path();
let blueprint_path = blueprint_input
.as_ref()
.map(|p| p.as_path())
.unwrap_or_else(|| &project_blueprint_path);
let blueprint = File::open(blueprint_path)
.map_err(|_| blueprint::error::Error::InvalidOrMissingFile)?;
let blueprint: Blueprint = serde_json::from_reader(BufReader::new(blueprint))?;