feat: update table formatting and meta plugins display order
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
564d593f04
commit
bc90085f05
@@ -10,7 +10,7 @@ use serde_json;
|
|||||||
use serde_yaml;
|
use serde_yaml;
|
||||||
use prettytable::row;
|
use prettytable::row;
|
||||||
use prettytable::{Attr, Cell, Row, Table};
|
use prettytable::{Attr, Cell, Row, Table};
|
||||||
use prettytable::format::consts::FORMAT_NO_BORDER_LINE_SEPARATOR;
|
use prettytable::format::consts::{FORMAT_BOX_CHARS, FORMAT_NO_BORDER_LINE_SEPARATOR};
|
||||||
|
|
||||||
use crate::meta_plugin::{MetaPluginType, get_meta_plugin};
|
use crate::meta_plugin::{MetaPluginType, get_meta_plugin};
|
||||||
use crate::common::status::{generate_status_info, PathInfo, CompressionInfo, MetaPluginInfo};
|
use crate::common::status::{generate_status_info, PathInfo, CompressionInfo, MetaPluginInfo};
|
||||||
@@ -136,7 +136,8 @@ fn build_meta_plugins_configured_table(settings: &config::Settings) -> Option<Ta
|
|||||||
|
|
||||||
let mut table = Table::new();
|
let mut table = Table::new();
|
||||||
if std::io::stdout().is_terminal() {
|
if std::io::stdout().is_terminal() {
|
||||||
table.set_format(get_format_box_chars_no_border_line_separator());
|
//table.set_format(get_format_box_chars_no_border_line_separator());
|
||||||
|
table.set_format(*FORMAT_BOX_CHARS);
|
||||||
} else {
|
} else {
|
||||||
table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
||||||
}
|
}
|
||||||
@@ -270,7 +271,8 @@ fn build_meta_plugins_configured_table(settings: &config::Settings) -> Option<Ta
|
|||||||
fn build_meta_plugin_table(meta_plugin_info: &Vec<MetaPluginInfo>) -> Table {
|
fn build_meta_plugin_table(meta_plugin_info: &Vec<MetaPluginInfo>) -> Table {
|
||||||
let mut meta_plugin_table = Table::new();
|
let mut meta_plugin_table = Table::new();
|
||||||
if std::io::stdout().is_terminal() {
|
if std::io::stdout().is_terminal() {
|
||||||
meta_plugin_table.set_format(get_format_box_chars_no_border_line_separator());
|
//meta_plugin_table.set_format(get_format_box_chars_no_border_line_separator());
|
||||||
|
meta_plugin_table.set_format(*FORMAT_BOX_CHARS);
|
||||||
} else {
|
} else {
|
||||||
meta_plugin_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
meta_plugin_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
||||||
}
|
}
|
||||||
@@ -323,15 +325,6 @@ fn build_meta_plugin_table(meta_plugin_info: &Vec<MetaPluginInfo>) -> Table {
|
|||||||
Cell::new(&options_str),
|
Cell::new(&options_str),
|
||||||
Cell::new(&outputs_display),
|
Cell::new(&outputs_display),
|
||||||
]));
|
]));
|
||||||
|
|
||||||
// Add a separator line after each row except the last one
|
|
||||||
if i < meta_plugin_info.len() - 1 {
|
|
||||||
meta_plugin_table.add_row(Row::new(vec![
|
|
||||||
Cell::new("").with_style(Attr::ForegroundColor(color::BRIGHT_BLACK)),
|
|
||||||
Cell::new("").with_style(Attr::ForegroundColor(color::BRIGHT_BLACK)),
|
|
||||||
Cell::new("").with_style(Attr::ForegroundColor(color::BRIGHT_BLACK)),
|
|
||||||
]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_plugin_table
|
meta_plugin_table
|
||||||
@@ -373,13 +366,6 @@ pub fn mode_status(
|
|||||||
build_config_table(settings).printstd();
|
build_config_table(settings).printstd();
|
||||||
println!();
|
println!();
|
||||||
|
|
||||||
// Print META PLUGINS CONFIGURED if they exist
|
|
||||||
if let Some(meta_plugins_table) = build_meta_plugins_configured_table(settings) {
|
|
||||||
println!("META PLUGINS CONFIGURED:");
|
|
||||||
meta_plugins_table.printstd();
|
|
||||||
println!();
|
|
||||||
}
|
|
||||||
|
|
||||||
println!("PATHS:");
|
println!("PATHS:");
|
||||||
build_path_table(&status_info.paths).printstd();
|
build_path_table(&status_info.paths).printstd();
|
||||||
println!();
|
println!();
|
||||||
@@ -388,6 +374,14 @@ pub fn mode_status(
|
|||||||
println!();
|
println!();
|
||||||
println!("META PLUGINS AVAILABLE:");
|
println!("META PLUGINS AVAILABLE:");
|
||||||
build_meta_plugin_table(&status_info.meta_plugins).printstd();
|
build_meta_plugin_table(&status_info.meta_plugins).printstd();
|
||||||
|
|
||||||
|
// Print META PLUGINS CONFIGURED if they exist
|
||||||
|
if let Some(meta_plugins_table) = build_meta_plugins_configured_table(settings) {
|
||||||
|
println!("META PLUGINS CONFIGURED:");
|
||||||
|
meta_plugins_table.printstd();
|
||||||
|
println!();
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
OutputFormat::Json => {
|
OutputFormat::Json => {
|
||||||
|
|||||||
Reference in New Issue
Block a user