From aa564f5072005a4fbae15418833c108ba4284b4e Mon Sep 17 00:00:00 2001 From: ammkrn <46387933+ammkrn@users.noreply.github.com> Date: Thu, 11 Feb 2021 02:50:33 -0600 Subject: [PATCH] display boolean config options as true/false instead of Yes/No (#3043) --- crates/nu-data/src/base/shape.rs | 8 ++++---- crates/nu-protocol/src/value/primitive.rs | 8 ++++---- docs/commands/empty.md | 12 ++++++------ docs/commands/from-json.md | 2 +- docs/commands/which.md | 18 +++++++++--------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/crates/nu-data/src/base/shape.rs b/crates/nu-data/src/base/shape.rs index 5d04f8288d..3e7a1cea62 100644 --- a/crates/nu-data/src/base/shape.rs +++ b/crates/nu-data/src/base/shape.rs @@ -251,12 +251,12 @@ impl PrettyDebug for FormatInlineShape { InlineShape::GlobPattern(pattern) => DbgDocBldr::primitive(pattern), InlineShape::Boolean(boolean) => DbgDocBldr::primitive( match (boolean, column) { - (true, None) => "Yes", - (false, None) => "No", + (true, None) => "true", + (false, None) => "false", (true, Some(Column::String(s))) if !s.is_empty() => s, (false, Some(Column::String(s))) if !s.is_empty() => "", - (true, Some(_)) => "Yes", - (false, Some(_)) => "No", + (true, Some(_)) => "true", + (false, Some(_)) => "false", } .to_owned(), ), diff --git a/crates/nu-protocol/src/value/primitive.rs b/crates/nu-protocol/src/value/primitive.rs index 695bbf5392..1561469c74 100644 --- a/crates/nu-protocol/src/value/primitive.rs +++ b/crates/nu-protocol/src/value/primitive.rs @@ -314,12 +314,12 @@ pub fn format_primitive(primitive: &Primitive, field_name: Option<&String>) -> S f } Primitive::Boolean(b) => match (b, field_name) { - (true, None) => "Yes", - (false, None) => "No", + (true, None) => "true", + (false, None) => "false", (true, Some(s)) if !s.is_empty() => s, (false, Some(s)) if !s.is_empty() => "", - (true, Some(_)) => "Yes", - (false, Some(_)) => "No", + (true, Some(_)) => "true", + (false, Some(_)) => "false", } .to_owned(), Primitive::Binary(_) => "".to_owned(), diff --git a/docs/commands/empty.md b/docs/commands/empty.md index 6a96bbd3ae..befb62c06b 100644 --- a/docs/commands/empty.md +++ b/docs/commands/empty.md @@ -24,12 +24,12 @@ Given the following meals Show the empty contents ```shell > echo [[meal size]; [arepa small] [taco '']] | empty? meal size -═══╦══════╦══════ - # ║ meal ║ size -═══╬══════╬══════ - 0 ║ No ║ No - 1 ║ No ║ Yes -═══╩══════╩══════ +═══╦═══════╦═══════ + # ║ meal ║ size +═══╬═══════╬═══════ + 0 ║ false ║ false + 1 ║ false ║ true +═══╩═══════╩═══════ ``` Let's assume we have a report of totals per day. For simplicity we show just for three days `2020/04/16`, `2020/07/10`, and `2020/11/16`. Like so diff --git a/docs/commands/from-json.md b/docs/commands/from-json.md index 5578cc9347..2ca7b823f3 100644 --- a/docs/commands/from-json.md +++ b/docs/commands/from-json.md @@ -27,6 +27,6 @@ Syntax: `from json {flags}` ━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━ title │ type │ flags ───────────┼─────────┼─────── - from json │ command │ Yes + from json │ command │ true ━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━ ``` diff --git a/docs/commands/which.md b/docs/commands/which.md index 2fe86934bc..42526103a0 100644 --- a/docs/commands/which.md +++ b/docs/commands/which.md @@ -22,7 +22,7 @@ Usage: ─────────┬───────────────── arg │ python path │ /usr/bin/python - builtin │ No + builtin │ false ─────────┴───────────────── ``` @@ -31,7 +31,7 @@ Usage: ─────────┬──────────────────────────── arg │ cargo path │ /home/bob/.cargo/bin/cargo - builtin │ No + builtin │ false ─────────┴──────────────────────────── ``` @@ -42,7 +42,7 @@ Usage: ─────────┬────────────────────────── arg │ ls path │ nushell built-in command - builtin │ Yes + builtin │ true ─────────┴────────────────────────── ``` @@ -51,7 +51,7 @@ Usage: ─────────┬────────────────────────── arg │ which path │ nushell built-in command - builtin │ Yes + builtin │ true ─────────┴────────────────────────── ``` @@ -62,8 +62,8 @@ Passing the `all` flag identifies all instances of a command or binary ───┬─────┬──────────────────────────┬───────── # │ arg │ path │ builtin ───┼─────┼──────────────────────────┼───────── - 0 │ ls │ nushell built-in command │ Yes - 1 │ ls │ /bin/ls │ No + 0 │ ls │ nushell built-in command │ true + 1 │ ls │ /bin/ls │ false ───┴─────┴──────────────────────────┴───────── ``` @@ -76,7 +76,7 @@ Passing the `all` flag identifies all instances of a command or binary ─────────┬──────────────────────────────── arg │ ./foo path │ /Users/josephlyons/Desktop/foo - builtin │ No + builtin │ false ─────────┴──────────────────────────────── ``` @@ -88,7 +88,7 @@ Passing the `all` flag identifies all instances of a command or binary ───┬─────┬───────────────┬───────── # │ arg │ path │ builtin ───┼─────┼───────────────┼───────── - 0 │ e │ Nushell alias │ No + 0 │ e │ Nushell alias │ false ───┴─────┴───────────────┴───────── ``` @@ -100,6 +100,6 @@ and custom commands ───┬──────────────┬────────────────────────┬───────── # │ arg │ path │ builtin ───┼──────────────┼────────────────────────┼───────── - 0 │ my_cool_echo │ Nushell custom command │ No + 0 │ my_cool_echo │ Nushell custom command │ false ───┴──────────────┴────────────────────────┴───────── ```