Format the change for JSON output.
(
&self,
change: &Change,
hash: &Hash,
sequence: Option<u64>,
)
| 676 | |
| 677 | /// Format the change for JSON output. |
| 678 | pub(crate) fn format_json( |
| 679 | &self, |
| 680 | change: &Change, |
| 681 | hash: &Hash, |
| 682 | sequence: Option<u64>, |
| 683 | ) -> String { |
| 684 | let json_change = if self.show_attest { |
| 685 | JsonChange::from_change_with_provenance(change, hash, sequence) |
| 686 | } else { |
| 687 | JsonChange::from_change(change, hash, sequence) |
| 688 | }; |
| 689 | serde_json::to_string_pretty(&json_change) |
| 690 | .unwrap_or_else(|e| format!("{{\"error\": \"Failed to serialize: {}\"}}", e)) |
| 691 | } |
| 692 | |
| 693 | /// Print the change in the configured format. |
| 694 | fn print_change(&self, change: &Change, hash: &Hash, sequence: Option<u64>, repo: &Repository) { |
no outgoing calls