fix: Correct table cell alignment and string conversion
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -9,7 +9,6 @@ use clap::error::ErrorKind;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::services::item_service::ItemService;
|
||||
use crate::modes::common::get_format_box_chars_no_border_line_separator;
|
||||
use chrono::prelude::*;
|
||||
use is_terminal::IsTerminal;
|
||||
use comfy_table::{Table, ContentArrangement, Cell, Attribute};
|
||||
|
||||
@@ -145,10 +145,10 @@ pub fn mode_list(
|
||||
Cell::new(&string_column(item.id.unwrap_or(0).to_string(), column_width));
|
||||
match column.align {
|
||||
crate::config::ColumnAlignment::Right => {
|
||||
cell = cell.alignment(CellAlignment::Right);
|
||||
cell = cell.set_alignment(CellAlignment::Right);
|
||||
}
|
||||
crate::config::ColumnAlignment::Left => {
|
||||
cell = cell.alignment(CellAlignment::Left);
|
||||
cell = cell.set_alignment(CellAlignment::Left);
|
||||
}
|
||||
}
|
||||
cell
|
||||
@@ -163,10 +163,10 @@ pub fn mode_list(
|
||||
));
|
||||
match column.align {
|
||||
crate::config::ColumnAlignment::Right => {
|
||||
cell.align(Alignment::RIGHT);
|
||||
cell = cell.set_alignment(CellAlignment::Right);
|
||||
}
|
||||
crate::config::ColumnAlignment::Left => {
|
||||
cell.align(Alignment::LEFT);
|
||||
cell = cell.set_alignment(CellAlignment::Left);
|
||||
}
|
||||
}
|
||||
cell
|
||||
@@ -180,10 +180,10 @@ pub fn mode_list(
|
||||
));
|
||||
match column.align {
|
||||
crate::config::ColumnAlignment::Right => {
|
||||
cell.align(Alignment::RIGHT);
|
||||
cell = cell.set_alignment(CellAlignment::Right);
|
||||
}
|
||||
crate::config::ColumnAlignment::Left => {
|
||||
cell.align(Alignment::LEFT);
|
||||
cell = cell.set_alignment(CellAlignment::Left);
|
||||
}
|
||||
}
|
||||
cell
|
||||
@@ -199,10 +199,10 @@ pub fn mode_list(
|
||||
};
|
||||
match column.align {
|
||||
crate::config::ColumnAlignment::Right => {
|
||||
cell.align(Alignment::RIGHT);
|
||||
cell = cell.set_alignment(CellAlignment::Right);
|
||||
}
|
||||
crate::config::ColumnAlignment::Left => {
|
||||
cell.align(Alignment::LEFT);
|
||||
cell = cell.set_alignment(CellAlignment::Left);
|
||||
}
|
||||
}
|
||||
cell
|
||||
@@ -213,10 +213,10 @@ pub fn mode_list(
|
||||
Cell::new(&string_column(item.compression.to_string(), column_width));
|
||||
match column.align {
|
||||
crate::config::ColumnAlignment::Right => {
|
||||
cell.align(Alignment::RIGHT);
|
||||
cell = cell.set_alignment(CellAlignment::Right);
|
||||
}
|
||||
crate::config::ColumnAlignment::Left => {
|
||||
cell.align(Alignment::LEFT);
|
||||
cell = cell.set_alignment(CellAlignment::Left);
|
||||
}
|
||||
}
|
||||
cell
|
||||
@@ -230,10 +230,10 @@ pub fn mode_list(
|
||||
));
|
||||
match column.align {
|
||||
crate::config::ColumnAlignment::Right => {
|
||||
cell.align(Alignment::RIGHT);
|
||||
cell = cell.set_alignment(CellAlignment::Right);
|
||||
}
|
||||
crate::config::ColumnAlignment::Left => {
|
||||
cell.align(Alignment::LEFT);
|
||||
cell = cell.set_alignment(CellAlignment::Left);
|
||||
}
|
||||
}
|
||||
cell
|
||||
@@ -244,10 +244,10 @@ pub fn mode_list(
|
||||
.add_attribute(Attribute::Bold);
|
||||
match column.align {
|
||||
crate::config::ColumnAlignment::Right => {
|
||||
cell.align(Alignment::RIGHT);
|
||||
cell = cell.set_alignment(CellAlignment::Right);
|
||||
}
|
||||
crate::config::ColumnAlignment::Left => {
|
||||
cell.align(Alignment::LEFT);
|
||||
cell = cell.set_alignment(CellAlignment::Left);
|
||||
}
|
||||
}
|
||||
cell
|
||||
@@ -260,10 +260,10 @@ pub fn mode_list(
|
||||
));
|
||||
match column.align {
|
||||
crate::config::ColumnAlignment::Right => {
|
||||
cell.align(Alignment::RIGHT);
|
||||
cell = cell.set_alignment(CellAlignment::Right);
|
||||
}
|
||||
crate::config::ColumnAlignment::Left => {
|
||||
cell.align(Alignment::LEFT);
|
||||
cell = cell.set_alignment(CellAlignment::Left);
|
||||
}
|
||||
}
|
||||
cell
|
||||
@@ -272,10 +272,10 @@ pub fn mode_list(
|
||||
let mut cell = Cell::new(&string_column(tags.join(" "), column_width));
|
||||
match column.align {
|
||||
crate::config::ColumnAlignment::Right => {
|
||||
cell.align(Alignment::RIGHT);
|
||||
cell = cell.set_alignment(CellAlignment::Right);
|
||||
}
|
||||
crate::config::ColumnAlignment::Left => {
|
||||
cell.align(Alignment::LEFT);
|
||||
cell = cell.set_alignment(CellAlignment::Left);
|
||||
}
|
||||
}
|
||||
cell
|
||||
@@ -287,10 +287,10 @@ pub fn mode_list(
|
||||
Cell::new(&string_column(meta_value.to_string(), column_width));
|
||||
match column.align {
|
||||
crate::config::ColumnAlignment::Right => {
|
||||
cell.align(Alignment::RIGHT);
|
||||
cell = cell.set_alignment(CellAlignment::Right);
|
||||
}
|
||||
crate::config::ColumnAlignment::Left => {
|
||||
cell.align(Alignment::LEFT);
|
||||
cell = cell.set_alignment(CellAlignment::Left);
|
||||
}
|
||||
}
|
||||
cell
|
||||
@@ -299,10 +299,10 @@ pub fn mode_list(
|
||||
let mut cell = Cell::new("");
|
||||
match column.align {
|
||||
crate::config::ColumnAlignment::Right => {
|
||||
cell.align(Alignment::RIGHT);
|
||||
cell = cell.set_alignment(CellAlignment::Right);
|
||||
}
|
||||
crate::config::ColumnAlignment::Left => {
|
||||
cell.align(Alignment::LEFT);
|
||||
cell = cell.set_alignment(CellAlignment::Left);
|
||||
}
|
||||
}
|
||||
cell
|
||||
@@ -312,10 +312,10 @@ pub fn mode_list(
|
||||
let mut cell = Cell::new("");
|
||||
match column.align {
|
||||
crate::config::ColumnAlignment::Right => {
|
||||
cell.align(Alignment::RIGHT);
|
||||
cell = cell.set_alignment(CellAlignment::Right);
|
||||
}
|
||||
crate::config::ColumnAlignment::Left => {
|
||||
cell.align(Alignment::LEFT);
|
||||
cell = cell.set_alignment(CellAlignment::Left);
|
||||
}
|
||||
}
|
||||
cell
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use log::debug;
|
||||
|
||||
use crate::modes::common::{get_format_box_chars_no_border_line_separator, OutputFormat};
|
||||
use crate::modes::common::OutputFormat;
|
||||
use crate::config;
|
||||
use crate::common::status::StatusInfo;
|
||||
use serde_json;
|
||||
|
||||
@@ -142,17 +142,14 @@ fn build_compression_table(compression_info: &Vec<CompressionInfo>) -> Table {
|
||||
compression_table.add_row(vec![
|
||||
info.compression_type.clone(),
|
||||
match info.found {
|
||||
true => Cell::new("Yes").fg(Color::Green).to_string(),
|
||||
false => Cell::new("No").fg(Color::Red).to_string(),
|
||||
true => "Yes".to_string(),
|
||||
false => "No".to_string(),
|
||||
},
|
||||
match info.default {
|
||||
true => Cell::new("Yes").fg(Color::Green).to_string(),
|
||||
false => Cell::new("No").to_string(),
|
||||
},
|
||||
match info.binary.as_str() {
|
||||
"<INTERNAL>" => Cell::new(&info.binary).fg(Color::DarkGrey).to_string(),
|
||||
_ => info.binary.clone(),
|
||||
true => "Yes".to_string(),
|
||||
false => "No".to_string(),
|
||||
},
|
||||
info.binary.clone(),
|
||||
info.compress.clone(),
|
||||
info.decompress.clone(),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user