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
This commit is contained in:
Sam 2020-05-18 04:42:22 -04:00 committed by GitHub
parent 1d781e8797
commit 3fc4a9f142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,6 +77,10 @@ pub fn autoview(context: RunnableContext) -> Result<OutputStream, ShellError> {
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<OutputStream, ShellError> {
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};