From 3fc4a9f142d22f0ca946f03b7007d1e7a32660ce Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 18 May 2020 04:42:22 -0400 Subject: [PATCH] added config check to disable auto pivoting of single row outputs (#1791) * added config check to disable auto pivoting of single row outputs * fixed change to use built-in boolean values --- crates/nu-cli/src/commands/autoview.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/nu-cli/src/commands/autoview.rs b/crates/nu-cli/src/commands/autoview.rs index 9b655d686..05c886ec9 100644 --- a/crates/nu-cli/src/commands/autoview.rs +++ b/crates/nu-cli/src/commands/autoview.rs @@ -77,6 +77,10 @@ pub fn autoview(context: RunnableContext) -> Result { let binary = context.get_command("binaryview"); let text = context.get_command("textview"); let table = context.get_command("table"); + let no_auto_pivot = match config::config(Tag::unknown())?.get("no_auto_pivot") { + Some(val) => val.is_true(), + _ => false, + }; Ok(OutputStream::new(async_stream! { let (mut input_stream, context) = RunnableContextWithoutInput::convert(context); @@ -214,7 +218,7 @@ pub fn autoview(context: RunnableContext) -> Result { yield Err(e); } - Value { value: UntaggedValue::Row(row), ..} => { + Value { value: UntaggedValue::Row(row), ..} if !no_auto_pivot => { use prettytable::format::{FormatBuilder, LinePosition, LineSeparator}; use prettytable::{color, Attr, Cell, Row, Table}; use crate::data::value::{format_leaf, style_leaf};