This commit is contained in:
Darren Schroeder 2021-10-05 10:30:49 -05:00
parent 3c843f7f61
commit 11b40a6c31

View file

@ -8,7 +8,7 @@ use nu_engine::CallExt;
use nu_protocol::{ use nu_protocol::{
ast::{Call, PathMember}, ast::{Call, PathMember},
engine::{Command, EvaluationContext}, engine::{Command, EvaluationContext},
Example, ShellError, Signature, Span, Spanned, SyntaxShape, Value, Signature, Span, SyntaxShape, Value,
}; };
use terminal_size::{Height, Width}; use terminal_size::{Height, Width};
@ -81,17 +81,17 @@ impl Command for Griddle {
}); });
for h in data { for h in data {
let a_string = format!("{}", &h[1]); // bytes ->, &h[3]); let a_string = (&h[1]).to_string(); // bytes ->, &h[3]);
let mut cell = Cell::from(a_string); let mut cell = Cell::from(a_string);
cell.alignment = Alignment::Right; cell.alignment = Alignment::Right;
grid.add(cell); grid.add(cell);
} }
let cols = if let Some(col) = columns { let cols = if let Some(col) = columns {
col.parse::<u16>().unwrap() col.parse::<u16>().unwrap_or(80)
} else { } else {
// 80usize // 80usize
if let Some((Width(w), Height(h))) = terminal_size::terminal_size() { if let Some((Width(w), Height(_h))) = terminal_size::terminal_size() {
w w
} else { } else {
80u16 80u16
@ -122,7 +122,9 @@ impl Command for Griddle {
Ok(Value::Nothing { span: call.head }) Ok(Value::Nothing { span: call.head })
} }
} }
Value::Record { cols, vals, .. } => { Value::Record {
cols: _, vals: _, ..
} => {
// let mut output = vec![]; // let mut output = vec![];
// for (c, v) in cols.into_iter().zip(vals.into_iter()) { // for (c, v) in cols.into_iter().zip(vals.into_iter()) {