From 3e7f491b7456464945221cec5116e450c28d8328 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Wed, 27 Aug 2025 18:32:37 -0300 Subject: [PATCH] fix: handle disabled text outputs properly Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- src/meta_plugin/text.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/meta_plugin/text.rs b/src/meta_plugin/text.rs index 8169960..a4e5dcf 100644 --- a/src/meta_plugin/text.rs +++ b/src/meta_plugin/text.rs @@ -48,6 +48,29 @@ impl TextMetaPlugin { outputs, ); + // Set disabled outputs to null based on options + let outputs_to_disable = vec![ + ("text_word_count", "text_word_count"), + ("text_line_count", "text_line_count"), + ("text_line_max_len", "text_line_max_len"), + ("text_line_mean_len", "text_line_mean_len"), + ("text_line_median_len", "text_line_median_len"), + ]; + + for (option_name, output_name) in outputs_to_disable { + if let Some(value) = base.options.get(option_name) { + // Handle both boolean false and string "false" + let should_disable = match value { + serde_yaml::Value::Bool(b) => !b, + serde_yaml::Value::String(s) => s == "false", + _ => false, + }; + if should_disable { + base.outputs.insert(output_name.to_string(), serde_yaml::Value::Null); + } + } + } + // Set default options if not provided let default_options = vec![ ("text_detect_size", serde_yaml::Value::Number(PIPESIZE.into())),