From fae55817bd02b9e28dc6e2f42c3334c6545e9187 Mon Sep 17 00:00:00 2001 From: TheAwiteb Date: Sun, 24 Dec 2023 13:27:01 +0300 Subject: [PATCH] Make the index non-zero number --- 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 578ea61..1035ac6 100644 --- a/src/cli/list_command.rs +++ b/src/cli/list_command.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use std::num::NonZeroU64; + use clap::Args; use comfy_table::Table; use regex::Regex; @@ -35,7 +37,7 @@ pub struct List { /// Return the password with spesifc index #[arg(short, long, value_name = "INDEX")] - get: Option, + get: Option, /// Search and display only matching passwords. /// /// The name and username will be searched. And service and note if included @@ -79,7 +81,7 @@ impl RunCommand for List { .enumerate() .filter(|(idx, pass)| { if let Some(index) = self.get { - return (idx + 1) == index; + return (idx + 1) == index.get() as usize; } if let Some(ref pattern) = self.search { if self.regex {