pub async fn extract_patch_displays(
resource: &LockedResource,
cache: &Cache,
) -> Vec<PatchDisplay>Expand description
Extract patch display information for a locked resource.
This function:
- Reads the original file from the source worktree
- Parses it to extract original field values
- Combines with the overridden values from the applied patches
- Returns formatted patch display information
§Arguments
resource- The locked resource with patch informationcache- Repository cache to access source worktrees
§Returns
A vector of PatchDisplay entries with original and overridden values.
If the source file cannot be read or parsed, displays show only overridden values
with “(none)” for the original value.
§Examples
use agpm_cli::lockfile::patch_display::extract_patch_displays;
use agpm_cli::lockfile::LockedResourceBuilder;
use agpm_cli::cache::Cache;
use agpm_cli::core::ResourceType;
let cache = Cache::new()?;
let resource = LockedResourceBuilder::new(
"test".to_string(),
"agents/test.md".to_string(),
"sha256:def456".to_string(),
"agents/test.md".to_string(),
ResourceType::Agent,
)
let displays = extract_patch_displays(&resource, &cache).await;
for display in displays {
println!("{}", display.format());
}