From 99217c631b628a65ba337c2f89a9b4abc7109764 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Fri, 29 Aug 2025 14:26:39 -0300 Subject: [PATCH] fix: allow empty ids and tags for --info and --get modes Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- src/modes/get.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/modes/get.rs b/src/modes/get.rs index e4073fa..ff96ec8 100644 --- a/src/modes/get.rs +++ b/src/modes/get.rs @@ -17,13 +17,12 @@ pub fn mode_get( conn: &mut rusqlite::Connection, data_path: PathBuf, ) -> Result<()> { - if ids.is_empty() && tags.is_empty() { - cmd.error(clap::error::ErrorKind::InvalidValue, "No ID or tags given, you must supply exactly one ID or at least one tag when using --get").exit(); - } else if !ids.is_empty() && !tags.is_empty() { - cmd.error(clap::error::ErrorKind::InvalidValue, "Both ID and tags given, you must supply exactly one ID or at least one tag when using --get").exit(); + if !ids.is_empty() && !tags.is_empty() { + cmd.error(clap::error::ErrorKind::InvalidValue, "Both ID and tags given, you must supply either IDs or tags when using --get").exit(); } else if ids.len() > 1 { - cmd.error(clap::error::ErrorKind::InvalidValue, "More than one ID given, you must supply exactly one ID or at least one tag when using --get").exit(); + cmd.error(clap::error::ErrorKind::InvalidValue, "More than one ID given, you must supply exactly one ID when using --get").exit(); } + // If both are empty, find_item will find the last item let item_service = ItemService::new(data_path.clone()); let item_with_meta = item_service.find_item(conn, ids, tags, &std::collections::HashMap::new())