refactor: Trim whitespace from end of each line in table output

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:53:54 -03:00
parent 9a6b0ceced
commit 935f829b42
5 changed files with 16 additions and 8 deletions

View File

@@ -140,6 +140,14 @@ pub fn settings_output_format(settings: &config::Settings) -> OutputFormat {
.unwrap_or(OutputFormat::Table)
}
/// Trim whitespace from the end of each line in a string
pub fn trim_lines_end(s: &str) -> String {
s.lines()
.map(|line| line.trim_end())
.collect::<Vec<&str>>()
.join("\n")
}
/// Create a table with consistent styling and terminal detection
pub fn create_table(use_styling: bool) -> Table {
let mut table = Table::new();