diff --git a/src/modes/status.rs b/src/modes/status.rs index bfcabb3..9bae1d6 100644 --- a/src/modes/status.rs +++ b/src/modes/status.rs @@ -206,41 +206,75 @@ fn build_meta_plugins_configured_table(settings: &config::Settings) -> Option s.clone(), - serde_yaml::Value::Number(n) => n.to_string(), - serde_yaml::Value::Bool(b) => b.to_string(), - serde_yaml::Value::Null => "null".to_string(), - serde_yaml::Value::Sequence(_) => { - serde_yaml::to_string(value).unwrap_or_else(|_| "[]".to_string()) + // Show the merged outputs, but filter based on plugin options + // For hostname plugin, check if specific outputs are disabled + let mut enabled_output_pairs = Vec::new(); + for (key, value) in actual_plugin.outputs() { + // Check if this output should be enabled based on plugin-specific logic + // For hostname plugin, check hostname_short, hostname_full options + if plugin_config.name == "hostname" { + match key.as_str() { + "hostname_short" => { + // Check if hostname_short is disabled + if let Some(serde_yaml::Value::Bool(enabled)) = all_options.get("hostname_short") { + if !enabled { + continue; + } + } } - serde_yaml::Value::Mapping(_) => { - serde_yaml::to_string(value).unwrap_or_else(|_| "{}".to_string()) + "hostname_full" => { + // Check if hostname_full is disabled + if let Some(serde_yaml::Value::Bool(enabled)) = all_options.get("hostname_full") { + if !enabled { + continue; + } + } } - serde_yaml::Value::Tagged(_) => { - serde_yaml::to_string(value).unwrap_or_else(|_| "tagged".to_string()) + "hostname" => { + // Check if hostname is disabled + if let Some(serde_yaml::Value::Bool(enabled)) = all_options.get("hostname") { + if !enabled { + continue; + } + } else if let Some(serde_yaml::Value::String(s)) = all_options.get("hostname") { + if s == "false" { + continue; + } + } } - }; - // Trim any extra whitespace from the serialized values - let value_str = value_str.trim().to_string(); - if key == &value_str { - output_pairs.push(key.clone()); - } else { - output_pairs.push(format!("{}->{}", key, value_str)); + _ => {} } } - if output_pairs.is_empty() { - "{}".to_string() + + // Convert serde_yaml::Value to a string representation + let value_str = match value { + serde_yaml::Value::String(s) => s.clone(), + serde_yaml::Value::Number(n) => n.to_string(), + serde_yaml::Value::Bool(b) => b.to_string(), + serde_yaml::Value::Null => "null".to_string(), + serde_yaml::Value::Sequence(_) => { + serde_yaml::to_string(value).unwrap_or_else(|_| "[]".to_string()) + } + serde_yaml::Value::Mapping(_) => { + serde_yaml::to_string(value).unwrap_or_else(|_| "{}".to_string()) + } + serde_yaml::Value::Tagged(_) => { + serde_yaml::to_string(value).unwrap_or_else(|_| "tagged".to_string()) + } + }; + // Trim any extra whitespace from the serialized values + let value_str = value_str.trim().to_string(); + if key == &value_str { + enabled_output_pairs.push(key.clone()); } else { - output_pairs.join(", ") + enabled_output_pairs.push(format!("{}->{}", key, value_str)); } + } + + let outputs_str = if enabled_output_pairs.is_empty() { + "{}".to_string() + } else { + enabled_output_pairs.join(", ") }; table.add_row(Row::new(vec![