feat: handle disabled hostname outputs in plugin and simplify status display
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -219,38 +219,48 @@ impl MetaPlugin for HostnameMetaPlugin {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add hostname output if enabled
|
// Always process all outputs, setting disabled ones to Null
|
||||||
if hostname_enabled {
|
// Handle hostname output
|
||||||
|
let hostname_output_value = if hostname_enabled {
|
||||||
|
serde_yaml::Value::String(hostname_value)
|
||||||
|
} else {
|
||||||
|
serde_yaml::Value::Null
|
||||||
|
};
|
||||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||||
"hostname",
|
"hostname",
|
||||||
serde_yaml::Value::String(hostname_value),
|
hostname_output_value,
|
||||||
&self.outputs
|
&self.outputs
|
||||||
) {
|
) {
|
||||||
metadata.push(meta_data);
|
metadata.push(meta_data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Add hostname_full output if enabled
|
// Handle hostname_full output
|
||||||
if hostname_full_enabled {
|
let hostname_full_output_value = if hostname_full_enabled {
|
||||||
|
serde_yaml::Value::String(full_hostname.clone())
|
||||||
|
} else {
|
||||||
|
serde_yaml::Value::Null
|
||||||
|
};
|
||||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||||
"hostname_full",
|
"hostname_full",
|
||||||
serde_yaml::Value::String(full_hostname.clone()),
|
hostname_full_output_value,
|
||||||
&self.outputs
|
&self.outputs
|
||||||
) {
|
) {
|
||||||
metadata.push(meta_data);
|
metadata.push(meta_data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Add hostname_short output if enabled
|
// Handle hostname_short output
|
||||||
if hostname_short_enabled {
|
let hostname_short_output_value = if hostname_short_enabled {
|
||||||
|
serde_yaml::Value::String(short_hostname)
|
||||||
|
} else {
|
||||||
|
serde_yaml::Value::Null
|
||||||
|
};
|
||||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||||
"hostname_short",
|
"hostname_short",
|
||||||
serde_yaml::Value::String(short_hostname),
|
hostname_short_output_value,
|
||||||
&self.outputs
|
&self.outputs
|
||||||
) {
|
) {
|
||||||
metadata.push(meta_data);
|
metadata.push(meta_data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Mark as finalized since this plugin only needs to run once
|
// Mark as finalized since this plugin only needs to run once
|
||||||
self.is_finalized = true;
|
self.is_finalized = true;
|
||||||
|
|||||||
@@ -206,51 +206,13 @@ fn build_meta_plugins_configured_table(settings: &config::Settings) -> Option<Ta
|
|||||||
.to_string()
|
.to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Show the merged outputs, but filter based on plugin options
|
// Show only non-null outputs
|
||||||
// For hostname plugin, check if specific outputs are disabled
|
|
||||||
let mut enabled_output_pairs = Vec::new();
|
let mut enabled_output_pairs = Vec::new();
|
||||||
for (key, value) in actual_plugin.outputs() {
|
for (key, value) in actual_plugin.outputs() {
|
||||||
// Check if this output should be enabled based on plugin-specific logic
|
// Skip null values (disabled outputs)
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"hostname_full" => {
|
|
||||||
// Check if hostname_full is disabled
|
|
||||||
if let Some(serde_yaml::Value::Bool(enabled)) = all_options.get("hostname_full") {
|
|
||||||
if !enabled {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// For digest plugin, check if the output is None (disabled)
|
|
||||||
else if plugin_config.name == "digest" {
|
|
||||||
if value.is_null() {
|
if value.is_null() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Convert serde_yaml::Value to a string representation
|
// Convert serde_yaml::Value to a string representation
|
||||||
let value_str = match value {
|
let value_str = match value {
|
||||||
|
|||||||
Reference in New Issue
Block a user