`atomic vault goal show` over GetVaultEntry (kind=GOAL) — the stored goal.md content + frontmatter ride the bundle; the CLI renders the local JSON/plain projection over them.
(args: &super::vault::goal::GoalShow)
| 6577 | /// goal.md content + frontmatter ride the bundle; the CLI renders the |
| 6578 | /// local JSON/plain projection over them. |
| 6579 | pub fn vault_goal_show(args: &super::vault::goal::GoalShow) -> CliResult<bool> { |
| 6580 | let Some(session) = Service::open()? else { |
| 6581 | return Ok(false); |
| 6582 | }; |
| 6583 | let request = pb::GetVaultEntryRequest { |
| 6584 | repository: Some(session.reference.clone()), |
| 6585 | kind: Kind::Goal as i32, |
| 6586 | id: args.goal.clone(), |
| 6587 | path: None, |
| 6588 | include_bundle: true, |
| 6589 | view: None, |
| 6590 | }; |
| 6591 | let response = session.get_vault_entry(request)?; |
| 6592 | let Some(bundle) = response |
| 6593 | .entry_bundle |
| 6594 | .as_ref() |
| 6595 | .map(parse_entry_bundle) |
| 6596 | .transpose()? |
| 6597 | else { |
| 6598 | return Err(CliError::Internal(anyhow::anyhow!( |
| 6599 | "the service returned no entry bundle (include_bundle required)" |
| 6600 | ))); |
| 6601 | }; |
| 6602 | let entry = &bundle.entry; |
| 6603 | if args.json { |
| 6604 | let json = serde_json::json!({ |
| 6605 | "name": args.goal, |
| 6606 | "content": String::from_utf8_lossy(&entry.content_bytes), |
| 6607 | "frontmatter": serde_json::from_str::<serde_json::Value>( |
| 6608 | &entry.frontmatter_json |
| 6609 | ).unwrap_or_default(), |
| 6610 | }); |
| 6611 | println!("{}", serde_json::to_string_pretty(&json).unwrap()); |
| 6612 | } else { |
| 6613 | print!("{}", String::from_utf8_lossy(&entry.content_bytes)); |
| 6614 | } |
| 6615 | Ok(true) |
| 6616 | } |
| 6617 | |
| 6618 | // --------------------------------------------------------------------------- |
| 6619 | // vault materialize / summaries (VaultService) |
no test coverage detected