mirror of
https://github.com/nushell/nushell.git
synced 2025-04-10 14:08:40 +02:00
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:
parent
1d781e8797
commit
3fc4a9f142
@ -77,6 +77,10 @@ pub fn autoview(context: RunnableContext) -> Result<OutputStream, ShellError> {
|
|||||||
let binary = context.get_command("binaryview");
|
let binary = context.get_command("binaryview");
|
||||||
let text = context.get_command("textview");
|
let text = context.get_command("textview");
|
||||||
let table = context.get_command("table");
|
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! {
|
Ok(OutputStream::new(async_stream! {
|
||||||
let (mut input_stream, context) = RunnableContextWithoutInput::convert(context);
|
let (mut input_stream, context) = RunnableContextWithoutInput::convert(context);
|
||||||
@ -214,7 +218,7 @@ pub fn autoview(context: RunnableContext) -> Result<OutputStream, ShellError> {
|
|||||||
yield Err(e);
|
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::format::{FormatBuilder, LinePosition, LineSeparator};
|
||||||
use prettytable::{color, Attr, Cell, Row, Table};
|
use prettytable::{color, Attr, Cell, Row, Table};
|
||||||
use crate::data::value::{format_leaf, style_leaf};
|
use crate::data::value::{format_leaf, style_leaf};
|
||||||
|
Loading…
Reference in New Issue
Block a user