From 95bd3a53a933a7d6331a363ea080e45bb7d51d82 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 23 Aug 2022 13:42:16 +0200 Subject: [PATCH] support skip --- src/utils.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index 7845e11..6a85eff 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -17,7 +17,7 @@ fn err_code(code: i32) -> String { } /// Print a line for the table -pub fn line_table(cell_length: usize, number_cell: usize, pos: models::Position) { +pub fn line_table(cell_length: usize, number_cell: usize, pos: models::Position, skip_with: std::collections::HashMap) { let err_msg = "Unknown position"; // Left side @@ -48,8 +48,11 @@ pub fn line_table(cell_length: usize, number_cell: usize, pos: models::Position) // Print the line print!("\n{}{}{}", ls, line, ms); - for _ in 2..number_cell { - print!("{}{}", line, ms); + for i in 0..number_cell - 2 { + match skip_with.get(&i) { + Some(text) => print!("{:^cell_length$}{}", text, ms), + None => print!("{}{}", line, ms), + } } println!("{}{}", line, rs); }