From 33a9049a1f5fc073739d9442fdf40dd69f9b0770 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Mon, 8 Sep 2025 18:31:35 -0300 Subject: [PATCH] refactor: Fix compilation by adding imports and adjusting table methods Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- src/modes/common.rs | 5 ++++- src/modes/info.rs | 1 - src/modes/list.rs | 11 +++++++---- src/modes/status.rs | 3 +-- src/modes/status_plugins.rs | 3 +-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/modes/common.rs b/src/modes/common.rs index 59ee2b4..9690021 100644 --- a/src/modes/common.rs +++ b/src/modes/common.rs @@ -8,6 +8,7 @@ use log::debug; use regex::Regex; use std::collections::HashMap; use std::env; +use std::io::IsTerminal; use std::str::FromStr; use strum::IntoEnumIterator; #[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.force_no_tty_if(!std::io::stdout().is_terminal()); + if !std::io::stdout().is_terminal() { + table.force_no_tty(); + } table } diff --git a/src/modes/info.rs b/src/modes/info.rs index 2b8d41e..c08d7e5 100644 --- a/src/modes/info.rs +++ b/src/modes/info.rs @@ -9,7 +9,6 @@ use std::path::PathBuf; use crate::services::item_service::ItemService; use chrono::prelude::*; -use is_terminal::IsTerminal; use comfy_table::{Cell, Attribute}; pub fn mode_info( diff --git a/src/modes/list.rs b/src/modes/list.rs index 2d09995..0c6d588 100644 --- a/src/modes/list.rs +++ b/src/modes/list.rs @@ -4,14 +4,14 @@ use crate::services::types::ItemWithMeta; use crate::modes::common::ColumnType; use crate::modes::common::{format_size, OutputFormat}; use anyhow::{Result}; -use log::debug; use comfy_table::{Table, ContentArrangement, Cell, Row, Color, Attribute}; use comfy_table::presets::NOTHING; use comfy_table::CellAlignment; use serde::{Deserialize, Serialize}; use serde_json; use serde_yaml; -use std::io::{stdout, IsTerminal}; +use std::io::{stdout}; +use std::io::IsTerminal; #[derive(Serialize, Deserialize)] struct ListItem { @@ -55,8 +55,11 @@ pub fn mode_list( let mut table = Table::new(); table .load_preset(NOTHING) - .set_content_arrangement(ContentArrangement::Dynamic) - .force_no_tty_if(!stdout().is_terminal()); + .set_content_arrangement(ContentArrangement::Dynamic); + + if !stdout().is_terminal() { + table.force_no_tty(); + } // Create header row let mut header_cells = Vec::new(); diff --git a/src/modes/status.rs b/src/modes/status.rs index 3063549..3174ef2 100644 --- a/src/modes/status.rs +++ b/src/modes/status.rs @@ -1,5 +1,4 @@ use clap::*; -use is_terminal::IsTerminal; use std::path::PathBuf; use std::str::FromStr; use log::debug; @@ -9,7 +8,7 @@ use crate::config; use crate::common::status::StatusInfo; use serde_json; use serde_yaml; -use comfy_table::{Cell, Attribute}; +use comfy_table::{Table, Cell, Attribute}; use crate::common::status::PathInfo; use crate::meta_plugin::MetaPluginType; diff --git a/src/modes/status_plugins.rs b/src/modes/status_plugins.rs index 14be4a5..6ae2900 100644 --- a/src/modes/status_plugins.rs +++ b/src/modes/status_plugins.rs @@ -1,5 +1,4 @@ use clap::*; -use is_terminal::IsTerminal; use std::path::PathBuf; use std::str::FromStr; use log::debug; @@ -43,7 +42,7 @@ use crate::modes::common::OutputFormat; use crate::config; use serde_json; 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::common::status::{MetaPluginInfo, CompressionInfo};