Format the change for JSON output.
(
&self,
change: &Change,
hash: &Hash,
sequence: Option<u64>,
)
| 690 | |
| 691 | /// Format the change for JSON output. |
| 692 | pub(crate) fn format_json( |
| 693 | &self, |
| 694 | change: &Change, |
| 695 | hash: &Hash, |
| 696 | sequence: Option<u64>, |
| 697 | ) -> String { |
| 698 | let json_change = if self.show_attest { |
| 699 | JsonChange::from_change_with_provenance(change, hash, sequence) |
| 700 | } else { |
| 701 | JsonChange::from_change(change, hash, sequence) |
| 702 | }; |
| 703 | serde_json::to_string_pretty(&json_change) |
| 704 | .unwrap_or_else(|e| format!("{{\"error\": \"Failed to serialize: {}\"}}", e)) |
| 705 | } |
| 706 | |
| 707 | /// Print the change in the configured format. |
| 708 | fn print_change(&self, change: &Change, hash: &Hash, sequence: Option<u64>, repo: &Repository) { |
no outgoing calls