fix: handle disabled text outputs properly
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -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())),
|
||||
|
||||
Reference in New Issue
Block a user