(revisions: &[openshell_core::proto::SandboxPolicyRevision])
| 7360 | } |
| 7361 | |
| 7362 | fn print_policy_revision_table(revisions: &[openshell_core::proto::SandboxPolicyRevision]) { |
| 7363 | println!( |
| 7364 | "{:<8} {:<14} {:<12} {:<24} ERROR", |
| 7365 | "VERSION", "HASH", "STATUS", "CREATED" |
| 7366 | ); |
| 7367 | for rev in revisions { |
| 7368 | let status = PolicyStatus::try_from(rev.status).unwrap_or(PolicyStatus::Unspecified); |
| 7369 | let hash_short = if rev.policy_hash.len() >= 12 { |
| 7370 | &rev.policy_hash[..12] |
| 7371 | } else { |
| 7372 | &rev.policy_hash |
| 7373 | }; |
| 7374 | let error_short = if rev.load_error.len() > 40 { |
| 7375 | format!("{}...", &rev.load_error[..40]) |
| 7376 | } else { |
| 7377 | rev.load_error.clone() |
| 7378 | }; |
| 7379 | println!( |
| 7380 | "{:<8} {:<14} {:<12} {:<24} {}", |
| 7381 | rev.version, |
| 7382 | hash_short, |
| 7383 | format!("{status:?}"), |
| 7384 | rev.created_at_ms, |
| 7385 | error_short, |
| 7386 | ); |
| 7387 | } |
| 7388 | } |
| 7389 | |
| 7390 | // --------------------------------------------------------------------------- |
| 7391 | // Sandbox logs command |
no test coverage detected