From 28947ff9a9817c18758c38277b0df60eeba8ba0a Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Thu, 10 Feb 2022 06:29:53 -0600 Subject: [PATCH] fix broken `-w` param for `grid` (#4397) --- crates/nu-command/src/viewers/griddle.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/nu-command/src/viewers/griddle.rs b/crates/nu-command/src/viewers/griddle.rs index 4d3e3a7e9b..ddd9bbf75a 100644 --- a/crates/nu-command/src/viewers/griddle.rs +++ b/crates/nu-command/src/viewers/griddle.rs @@ -31,7 +31,7 @@ impl Command for Griddle { .named( "width", SyntaxShape::Int, - "number of columns wide", + "number of terminal columns wide (not output columns)", Some('w'), ) .switch("color", "draw output with color", Some('c')) @@ -60,7 +60,7 @@ prints out the list properly."# call: &Call, input: PipelineData, ) -> Result { - let width_param: Option = call.get_flag(engine_state, stack, "width")?; + let width_param: Option = call.get_flag(engine_state, stack, "width")?; let color_param: bool = call.has_flag("color"); let separator_param: Option = call.get_flag(engine_state, stack, "separator")?; let config = stack.get_config().unwrap_or_default(); @@ -156,7 +156,7 @@ fn strip_ansi(string: &str) -> Cow { fn create_grid_output( items: Vec<(usize, String, String)>, call: &Call, - width_param: Option, + width_param: Option, color_param: bool, separator_param: Option, env_str: Option, @@ -168,7 +168,7 @@ fn create_grid_output( }; let cols = if let Some(col) = width_param { - col.parse::().unwrap_or(80) + col as u16 } else if let Some((Width(w), Height(_h))) = terminal_size::terminal_size() { w } else {