You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As an example this function works both on the toml table and the the actual manifest code. All toml modification should be located in the manifest code.
pubfnadd_task(&mutself,name:implAsRef<str>,task:Task,platform:Option<Platform>,) -> miette::Result<()>{let table = ifletSome(platform) = platform {ifself.target_specific_tasks(platform).contains_key(name.as_ref()){
miette::bail!("task {} already exists", name.as_ref());}ensure_toml_target_table(&mutself.doc, platform,"tasks")?
}else{self.doc["tasks"].or_insert(Item::Table(Table::new())).as_table_mut().ok_or_else(|| {
miette::miette!("target table in {} is malformed", consts::PROJECT_MANIFEST)})?
};let depends_on = task.depends_on();for depends in depends_on {if !self.manifest.tasks.contains_key(depends){
miette::bail!("task '{}' for the depends on for '{}' does not exist",
depends,
name.as_ref(),);}}// Add the task to the table
table.insert(name.as_ref(),task_as_toml(task.clone()));self.manifest.tasks.insert(name.as_ref().to_string(), task);self.save()?;Ok(())}
The text was updated successfully, but these errors were encountered:
As an example this function works both on the toml table and the the actual manifest code. All toml modification should be located in the manifest code.
The text was updated successfully, but these errors were encountered: