refactor: Fix compilation by adding imports and adjusting table methods

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-09-08 18:31:35 -03:00
parent 8d56120b88
commit 33a9049a1f
5 changed files with 13 additions and 10 deletions

View File

@@ -8,6 +8,7 @@ use log::debug;
use regex::Regex; use regex::Regex;
use std::collections::HashMap; use std::collections::HashMap;
use std::env; use std::env;
use std::io::IsTerminal;
use std::str::FromStr; use std::str::FromStr;
use strum::IntoEnumIterator; use strum::IntoEnumIterator;
#[derive(Debug, Clone, strum::EnumString, strum::Display, PartialEq)] #[derive(Debug, Clone, strum::EnumString, strum::Display, PartialEq)]
@@ -152,7 +153,9 @@ pub fn create_table(use_styling: bool) -> Table {
table.load_preset(comfy_table::presets::NOTHING); table.load_preset(comfy_table::presets::NOTHING);
} }
table.force_no_tty_if(!std::io::stdout().is_terminal()); if !std::io::stdout().is_terminal() {
table.force_no_tty();
}
table table
} }

View File

@@ -9,7 +9,6 @@ use std::path::PathBuf;
use crate::services::item_service::ItemService; use crate::services::item_service::ItemService;
use chrono::prelude::*; use chrono::prelude::*;
use is_terminal::IsTerminal;
use comfy_table::{Cell, Attribute}; use comfy_table::{Cell, Attribute};
pub fn mode_info( pub fn mode_info(

View File

@@ -4,14 +4,14 @@ use crate::services::types::ItemWithMeta;
use crate::modes::common::ColumnType; use crate::modes::common::ColumnType;
use crate::modes::common::{format_size, OutputFormat}; use crate::modes::common::{format_size, OutputFormat};
use anyhow::{Result}; use anyhow::{Result};
use log::debug;
use comfy_table::{Table, ContentArrangement, Cell, Row, Color, Attribute}; use comfy_table::{Table, ContentArrangement, Cell, Row, Color, Attribute};
use comfy_table::presets::NOTHING; use comfy_table::presets::NOTHING;
use comfy_table::CellAlignment; use comfy_table::CellAlignment;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json; use serde_json;
use serde_yaml; use serde_yaml;
use std::io::{stdout, IsTerminal}; use std::io::{stdout};
use std::io::IsTerminal;
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
struct ListItem { struct ListItem {
@@ -55,8 +55,11 @@ pub fn mode_list(
let mut table = Table::new(); let mut table = Table::new();
table table
.load_preset(NOTHING) .load_preset(NOTHING)
.set_content_arrangement(ContentArrangement::Dynamic) .set_content_arrangement(ContentArrangement::Dynamic);
.force_no_tty_if(!stdout().is_terminal());
if !stdout().is_terminal() {
table.force_no_tty();
}
// Create header row // Create header row
let mut header_cells = Vec::new(); let mut header_cells = Vec::new();

View File

@@ -1,5 +1,4 @@
use clap::*; use clap::*;
use is_terminal::IsTerminal;
use std::path::PathBuf; use std::path::PathBuf;
use std::str::FromStr; use std::str::FromStr;
use log::debug; use log::debug;
@@ -9,7 +8,7 @@ use crate::config;
use crate::common::status::StatusInfo; use crate::common::status::StatusInfo;
use serde_json; use serde_json;
use serde_yaml; use serde_yaml;
use comfy_table::{Cell, Attribute}; use comfy_table::{Table, Cell, Attribute};
use crate::common::status::PathInfo; use crate::common::status::PathInfo;
use crate::meta_plugin::MetaPluginType; use crate::meta_plugin::MetaPluginType;

View File

@@ -1,5 +1,4 @@
use clap::*; use clap::*;
use is_terminal::IsTerminal;
use std::path::PathBuf; use std::path::PathBuf;
use std::str::FromStr; use std::str::FromStr;
use log::debug; use log::debug;
@@ -43,7 +42,7 @@ use crate::modes::common::OutputFormat;
use crate::config; use crate::config;
use serde_json; use serde_json;
use serde_yaml; use serde_yaml;
use comfy_table::{Cell, Color, Attribute}; use comfy_table::{Table, Cell, Attribute};
use crate::meta_plugin::{MetaPluginType, get_meta_plugin}; use crate::meta_plugin::{MetaPluginType, get_meta_plugin};
use crate::common::status::{MetaPluginInfo, CompressionInfo}; use crate::common::status::{MetaPluginInfo, CompressionInfo};