nestable 0.2.1

Unicode-aware text table rendering with support for nested tables
Documentation
use nestable::{Table, Attributes, ansi, attr, styles};
use std::thread::sleep;
use std::time::Duration;

fn cls() {
    print!("\x1b[2J\x1b[H");
}

fn main() {
    for style in vec![
        styles::ASCII_BORDER,
        styles::ASCII_NO_BORDER,
        styles::ASCII_NO_ROW_SEPARATOR,
        styles::GLYPHS_SQUARE,
        styles::GLYPHS_ROUNDED,
        styles::GLYPHS_NO_BORDER,
        styles::GLYPHS_NO_ROW_SEPARATOR,
        styles::GLYPHS_ROUNDED_SPACED,
        styles::SPACE,
        styles::HEAVY,
        styles::DOUBLE,
        styles::DOUBLE_HEAVY,
        styles::HEAVY_MIXED,
    ] {
        cls();

        #[rustfmt::skip]
        let table = Table::new()
            .add_rows([
                ["Language", "Text"],
                ["English", "nestable\nrendering tables\nacross multiple lines"],
                ["Japanese", "ネスタブル\n複数行にわたる\nテーブル表示 🙂"],
                ["Chinese\n(Simplified)", "可嵌套表格\n支持多行文本\n终端显示"],
                ["Korean", "중첩 가능한 테이블\n여러 줄 텍스트\n터미널 출력"],
                ["Persian", "جداول تو در تو\nمتن چند خطی\nخروجی ترمینال"],
                ["Sanskrit", "नेस्टेबल टेबल्स\nबहुपङ्क्तिः पाठः\nटर्मिनल आउटपुट"],
            ])
            .set_table_style(&style)
            .set_border_attr(attr![ansi::GREEN])
            .set_column_attr(0, attr![ansi::CYAN]);

        let cwd = std::env::current_dir()
            .map(|p| p.to_string_lossy().to_string())
            .unwrap_or_else(|_| "<unknown>".to_string());

        let user = std::env::var("USER")
            .map(|p| p.to_string())
            .unwrap_or_else(|_| "<unknown>".to_string());

        #[rustfmt::skip]
        let system = Table::new()
            .add_rows([
                ["Property", "Value"],
                ["OS", std::env::consts::OS],
                ["Architecture", std::env::consts::ARCH],
                ["Directory", &cwd],
                ["User", &user],
            ])
            .set_table_style(&style)
            .set_border_attr(attr![ansi::BLUE])
            .set_column_attr(0, attr![ansi::MAGENTA]);

        #[rustfmt::skip]
        let nested = Table::new()
            .add_rows([
                vec!["System Details", "Unicode Demo"],
                vec![&system.to_string(), &table.to_string()],
            ])
            .set_table_style(&style)
            .set_border_attr(attr![ansi::RED]);

        print!("{}", nested);

        sleep(Duration::from_secs(3));
    }
}