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())