Merge pull request #448 from jonathandturner/fix_build

Fix the build
This commit is contained in:
Jonathan Turner 2019-08-26 19:10:57 +12:00 committed by GitHub
commit 628da27122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 22 deletions

View File

@ -1,4 +1,3 @@
crate mod consts;
crate mod entries;
crate mod generic;
crate mod list;

View File

@ -1,14 +0,0 @@
use lazy_static::lazy_static;
use prettytable::format::{FormatBuilder, LinePosition, LineSeparator, TableFormat};
lazy_static! {
pub(crate) static ref TABLE_FORMAT: TableFormat =
FormatBuilder::new()
.column_separator('│')
.separator(LinePosition::Top, LineSeparator::new('━', '┯', ' ', ' '))
.separator(LinePosition::Title, LineSeparator::new('─', '┼', ' ', ' '))
.separator(LinePosition::Bottom, LineSeparator::new('━', '┷', ' ', ' '))
.padding(1, 1)
.build();
}

View File

@ -1,9 +1,10 @@
use crate::format::{RenderView, consts};
use crate::format::RenderView;
use crate::object::Value;
use crate::prelude::*;
use derive_new::new;
use textwrap::fill;
use prettytable::format::{FormatBuilder, LinePosition, LineSeparator};
use prettytable::{color, Attr, Cell, Row, Table};
#[derive(Debug, new)]
@ -51,7 +52,10 @@ impl TableView {
.enumerate()
.map(|(i, d)| {
let data = value.get_data(d);
return (data.borrow().format_leaf(Some(&headers[i])), data.borrow().style_leaf());
return (
data.borrow().format_leaf(Some(&headers[i])),
data.borrow().style_leaf(),
);
})
.collect(),
x => vec![(x.format_leaf(None), x.style_leaf())],
@ -191,7 +195,15 @@ impl RenderView for TableView {
}
let mut table = Table::new();
table.set_format(*consts::TABLE_FORMAT);
table.set_format(
FormatBuilder::new()
.column_separator('│')
.separator(LinePosition::Top, LineSeparator::new('━', '┯', ' ', ' '))
.separator(LinePosition::Title, LineSeparator::new('─', '┼', ' ', ' '))
.separator(LinePosition::Bottom, LineSeparator::new('━', '┷', ' ', ' '))
.padding(1, 1)
.build(),
);
let header: Vec<Cell> = self
.headers
@ -206,7 +218,11 @@ impl RenderView for TableView {
table.set_titles(Row::new(header));
for row in &self.entries {
table.add_row(Row::new(row.iter().map(|(v, s)| Cell::new(v).style_spec(s)).collect()));
table.add_row(Row::new(
row.iter()
.map(|(v, s)| Cell::new(v).style_spec(s))
.collect(),
));
}
table.print_term(&mut *host.out_terminal()).unwrap();

View File

@ -1,8 +1,9 @@
use crate::format::{RenderView, consts};
use crate::format::RenderView;
use crate::object::Value;
use crate::prelude::*;
use derive_new::new;
use prettytable::format::{FormatBuilder, LinePosition, LineSeparator};
use prettytable::{color, Attr, Cell, Row, Table};
#[derive(new)]
@ -46,7 +47,15 @@ impl RenderView for VTableView {
}
let mut table = Table::new();
table.set_format(*consts::TABLE_FORMAT);
table.set_format(
FormatBuilder::new()
.column_separator('│')
.separator(LinePosition::Top, LineSeparator::new('━', '┯', ' ', ' '))
.separator(LinePosition::Title, LineSeparator::new('─', '┼', ' ', ' '))
.separator(LinePosition::Bottom, LineSeparator::new('━', '┷', ' ', ' '))
.padding(1, 1)
.build(),
);
for row in &self.entries {
table.add_row(Row::new(