1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
use tabular::{Row, Table};

pub mod accounts;
pub mod dns;
pub mod zones;
pub mod config;
pub mod cache;

fn table_from_cols(columns: Vec<&str>) -> Table {
    let cols: Vec<&str> = columns.iter().map(|_| "{:<}").collect();
    let spec: &str = &cols.join("    ").to_owned();
    let mut table = Table::new(spec);

    let mut header = Row::new();
    for c in &columns {
        header.add_cell(c);
    }

    table.add_row(header);
    table
}