From a24dfee322103ba604b66534a2b2fd982d60820b Mon Sep 17 00:00:00 2001 From: k1nho Date: Tue, 3 Oct 2023 13:08:13 -0400 Subject: [PATCH] fix(rust): improve `ockam space list` output when there are no spaces --- .../rust/ockam/ockam_command/src/space/list.rs | 8 +++++--- .../rust/ockam/ockam_command/src/terminal/mod.rs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/implementations/rust/ockam/ockam_command/src/space/list.rs b/implementations/rust/ockam/ockam_command/src/space/list.rs index c9bc93c9258..3d74d1296aa 100644 --- a/implementations/rust/ockam/ockam_command/src/space/list.rs +++ b/implementations/rust/ockam/ockam_command/src/space/list.rs @@ -63,9 +63,11 @@ async fn run_impl( let (spaces, _) = try_join!(get_spaces, progress_output)?; - let plain = opts - .terminal - .build_list(&spaces, "Spaces", "No spaces found.")?; + let plain = opts.terminal.build_list( + &spaces, + "Spaces", + "No spaces found. Run 'ockam enroll' to get a space and a project", + )?; let json = serde_json::to_string_pretty(&spaces).into_diagnostic()?; for space in spaces { diff --git a/implementations/rust/ockam/ockam_command/src/terminal/mod.rs b/implementations/rust/ockam/ockam_command/src/terminal/mod.rs index 943d1614fd6..645ba75a523 100644 --- a/implementations/rust/ockam/ockam_command/src/terminal/mod.rs +++ b/implementations/rust/ockam/ockam_command/src/terminal/mod.rs @@ -304,7 +304,7 @@ impl Terminal { pub fn build_list( &self, - items: &Vec, + items: &[impl crate::output::Output], header: &str, empty_message: &str, ) -> Result {