(info: &CreateImageInfo)
| 1664 | } |
| 1665 | |
| 1666 | fn docker_pull_progress_detail(info: &CreateImageInfo) -> Option<String> { |
| 1667 | let status = info.status.as_deref().unwrap_or("Pulling"); |
| 1668 | let layer_id = info.id.as_deref().filter(|id| !id.is_empty()); |
| 1669 | let progress = info |
| 1670 | .progress_detail |
| 1671 | .as_ref() |
| 1672 | .and_then(format_progress_detail); |
| 1673 | |
| 1674 | match (layer_id, progress) { |
| 1675 | (Some(layer_id), Some(progress)) => Some(format!("{status} {layer_id} ({progress})")), |
| 1676 | (Some(layer_id), None) => Some(format!("{status} {layer_id}")), |
| 1677 | (None, Some(progress)) => Some(format!("{status} ({progress})")), |
| 1678 | (None, None) => (!status.is_empty()).then(|| status.to_string()), |
| 1679 | } |
| 1680 | } |
| 1681 | |
| 1682 | fn format_progress_detail(progress: &ProgressDetail) -> Option<String> { |
| 1683 | let current = progress.current.and_then(|value| u64::try_from(value).ok()); |
no test coverage detected