From d32a460e3848af6634a8e5ee58a7830f255540dc Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Fri, 29 Aug 2025 14:09:12 -0300 Subject: [PATCH] refactor: remove KEEP_META_* environment variable parsing Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- src/modes/get.rs | 11 +---------- src/modes/info.rs | 11 +---------- src/modes/list.rs | 11 +---------- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/modes/get.rs b/src/modes/get.rs index 62ad311..3b18c34 100644 --- a/src/modes/get.rs +++ b/src/modes/get.rs @@ -23,17 +23,8 @@ pub fn mode_get( 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(); } - let mut meta: std::collections::HashMap = std::collections::HashMap::new(); - // Collect metadata from environment variables - for (key, value) in std::env::vars() { - if key.starts_with("KEEP_META_") && key != "KEEP_META_PLUGINS" { - let meta_name = key.strip_prefix("KEEP_META_").unwrap(); - meta.insert(meta_name.to_string(), value); - } - } - let item_service = ItemService::new(data_path.clone()); - let item_with_meta = item_service.find_item(conn, ids, tags, &meta) + let item_with_meta = item_service.find_item(conn, ids, tags, &std::collections::HashMap::new()) .map_err(|e| anyhow!("Unable to find matching item in database: {}", e))?; let item_id = item_with_meta.item.id.unwrap(); diff --git a/src/modes/info.rs b/src/modes/info.rs index bc755af..4f07ae9 100644 --- a/src/modes/info.rs +++ b/src/modes/info.rs @@ -31,19 +31,10 @@ pub fn mode_info( cmd.error(ErrorKind::InvalidValue, "More than one ID given, you must supply exactly one ID when using --info").exit(); } - let mut meta: std::collections::HashMap = std::collections::HashMap::new(); - // Collect metadata from environment variables - for (key, value) in std::env::vars() { - if key.starts_with("KEEP_META_") && key != "KEEP_META_PLUGINS" { - let meta_name = key.strip_prefix("KEEP_META_").unwrap(); - meta.insert(meta_name.to_string(), value); - } - } - let item_service = ItemService::new(data_path.clone()); // Use empty tags vector since --info only works with IDs let item_with_meta = item_service - .find_item(conn, ids, &Vec::new(), &meta) + .find_item(conn, ids, &Vec::new(), &std::collections::HashMap::new()) .map_err(|e| anyhow!("Unable to find matching item in database: {}", e))?; show_item(item_with_meta, settings, data_path) diff --git a/src/modes/list.rs b/src/modes/list.rs index f402fe6..24c3c3d 100644 --- a/src/modes/list.rs +++ b/src/modes/list.rs @@ -44,17 +44,8 @@ pub fn mode_list( .exit(); } - let mut meta: std::collections::HashMap = std::collections::HashMap::new(); - // Collect metadata from environment variables - for (key, value) in std::env::vars() { - if key.starts_with("KEEP_META_") && key != "KEEP_META_PLUGINS" { - let meta_name = key.strip_prefix("KEEP_META_").unwrap(); - meta.insert(meta_name.to_string(), value); - } - } - let item_service = ItemService::new(data_path.clone()); - let items_with_meta = item_service.list_items(conn, tags, &meta)?; + let items_with_meta = item_service.list_items(conn, tags, &std::collections::HashMap::new())?; let output_format = crate::modes::common::settings_output_format(settings);