Parse an `OpenShell` policy YAML file into a [`PolicyModel`].
(path: &Path)
| 338 | |
| 339 | /// Parse an `OpenShell` policy YAML file into a [`PolicyModel`]. |
| 340 | pub fn parse_policy(path: &Path) -> Result<PolicyModel> { |
| 341 | let contents = std::fs::read_to_string(path) |
| 342 | .into_diagnostic() |
| 343 | .wrap_err_with(|| format!("reading policy file {}", path.display()))?; |
| 344 | parse_policy_str(&contents) |
| 345 | } |
| 346 | |
| 347 | /// Parse a policy YAML string into a [`PolicyModel`]. |
| 348 | pub fn parse_policy_str(yaml: &str) -> Result<PolicyModel> { |