From ba710886793989b17af15aa89d8231efcc36d661 Mon Sep 17 00:00:00 2001 From: TheAwiteb Date: Sun, 24 Dec 2023 20:22:28 +0300 Subject: [PATCH] Exit with 1 status code when there is no passwords to list --- src/cli/list_command.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cli/list_command.rs b/src/cli/list_command.rs index 1035ac6..917770c 100644 --- a/src/cli/list_command.rs +++ b/src/cli/list_command.rs @@ -51,7 +51,9 @@ pub struct List { impl RunCommand for List { fn run(&self, password_manager: Passwords) -> PassrsResult<()> { if password_manager.passwords.is_empty() { - println!("Looks like there is no passwords to list") + Err(PassrsError::Other( + "Looks like there is no passwords to list".to_owned(), + )) } else { if self.get.is_some() && self.search.is_some() { return Err(PassrsError::ArgsConflict( @@ -132,7 +134,7 @@ impl RunCommand for List { table.add_row(row); } println!("{table}"); + Ok(()) } - Ok(()) } }