mirror of
https://github.com/nushell/nushell.git
synced 2025-02-08 22:51:42 +01:00
display boolean config options as true/false instead of Yes/No (#3043)
This commit is contained in:
parent
8367f2001c
commit
aa564f5072
@ -251,12 +251,12 @@ impl PrettyDebug for FormatInlineShape {
|
|||||||
InlineShape::GlobPattern(pattern) => DbgDocBldr::primitive(pattern),
|
InlineShape::GlobPattern(pattern) => DbgDocBldr::primitive(pattern),
|
||||||
InlineShape::Boolean(boolean) => DbgDocBldr::primitive(
|
InlineShape::Boolean(boolean) => DbgDocBldr::primitive(
|
||||||
match (boolean, column) {
|
match (boolean, column) {
|
||||||
(true, None) => "Yes",
|
(true, None) => "true",
|
||||||
(false, None) => "No",
|
(false, None) => "false",
|
||||||
(true, Some(Column::String(s))) if !s.is_empty() => s,
|
(true, Some(Column::String(s))) if !s.is_empty() => s,
|
||||||
(false, Some(Column::String(s))) if !s.is_empty() => "",
|
(false, Some(Column::String(s))) if !s.is_empty() => "",
|
||||||
(true, Some(_)) => "Yes",
|
(true, Some(_)) => "true",
|
||||||
(false, Some(_)) => "No",
|
(false, Some(_)) => "false",
|
||||||
}
|
}
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
),
|
),
|
||||||
|
@ -314,12 +314,12 @@ pub fn format_primitive(primitive: &Primitive, field_name: Option<&String>) -> S
|
|||||||
f
|
f
|
||||||
}
|
}
|
||||||
Primitive::Boolean(b) => match (b, field_name) {
|
Primitive::Boolean(b) => match (b, field_name) {
|
||||||
(true, None) => "Yes",
|
(true, None) => "true",
|
||||||
(false, None) => "No",
|
(false, None) => "false",
|
||||||
(true, Some(s)) if !s.is_empty() => s,
|
(true, Some(s)) if !s.is_empty() => s,
|
||||||
(false, Some(s)) if !s.is_empty() => "",
|
(false, Some(s)) if !s.is_empty() => "",
|
||||||
(true, Some(_)) => "Yes",
|
(true, Some(_)) => "true",
|
||||||
(false, Some(_)) => "No",
|
(false, Some(_)) => "false",
|
||||||
}
|
}
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
Primitive::Binary(_) => "<binary>".to_owned(),
|
Primitive::Binary(_) => "<binary>".to_owned(),
|
||||||
|
@ -24,12 +24,12 @@ Given the following meals
|
|||||||
Show the empty contents
|
Show the empty contents
|
||||||
```shell
|
```shell
|
||||||
> echo [[meal size]; [arepa small] [taco '']] | empty? meal size
|
> echo [[meal size]; [arepa small] [taco '']] | empty? meal size
|
||||||
═══╦══════╦══════
|
═══╦═══════╦═══════
|
||||||
# ║ meal ║ size
|
# ║ meal ║ size
|
||||||
═══╬══════╬══════
|
═══╬═══════╬═══════
|
||||||
0 ║ No ║ No
|
0 ║ false ║ false
|
||||||
1 ║ No ║ Yes
|
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
|
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
|
||||||
|
@ -27,6 +27,6 @@ Syntax: `from json {flags}`
|
|||||||
━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━
|
━━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━
|
||||||
title │ type │ flags
|
title │ type │ flags
|
||||||
───────────┼─────────┼───────
|
───────────┼─────────┼───────
|
||||||
from json │ command │ Yes
|
from json │ command │ true
|
||||||
━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━
|
━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━
|
||||||
```
|
```
|
||||||
|
@ -22,7 +22,7 @@ Usage:
|
|||||||
─────────┬─────────────────
|
─────────┬─────────────────
|
||||||
arg │ python
|
arg │ python
|
||||||
path │ /usr/bin/python
|
path │ /usr/bin/python
|
||||||
builtin │ No
|
builtin │ false
|
||||||
─────────┴─────────────────
|
─────────┴─────────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ Usage:
|
|||||||
─────────┬────────────────────────────
|
─────────┬────────────────────────────
|
||||||
arg │ cargo
|
arg │ cargo
|
||||||
path │ /home/bob/.cargo/bin/cargo
|
path │ /home/bob/.cargo/bin/cargo
|
||||||
builtin │ No
|
builtin │ false
|
||||||
─────────┴────────────────────────────
|
─────────┴────────────────────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ Usage:
|
|||||||
─────────┬──────────────────────────
|
─────────┬──────────────────────────
|
||||||
arg │ ls
|
arg │ ls
|
||||||
path │ nushell built-in command
|
path │ nushell built-in command
|
||||||
builtin │ Yes
|
builtin │ true
|
||||||
─────────┴──────────────────────────
|
─────────┴──────────────────────────
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ Usage:
|
|||||||
─────────┬──────────────────────────
|
─────────┬──────────────────────────
|
||||||
arg │ which
|
arg │ which
|
||||||
path │ nushell built-in command
|
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
|
# │ arg │ path │ builtin
|
||||||
───┼─────┼──────────────────────────┼─────────
|
───┼─────┼──────────────────────────┼─────────
|
||||||
0 │ ls │ nushell built-in command │ Yes
|
0 │ ls │ nushell built-in command │ true
|
||||||
1 │ ls │ /bin/ls │ No
|
1 │ ls │ /bin/ls │ false
|
||||||
───┴─────┴──────────────────────────┴─────────
|
───┴─────┴──────────────────────────┴─────────
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ Passing the `all` flag identifies all instances of a command or binary
|
|||||||
─────────┬────────────────────────────────
|
─────────┬────────────────────────────────
|
||||||
arg │ ./foo
|
arg │ ./foo
|
||||||
path │ /Users/josephlyons/Desktop/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
|
# │ arg │ path │ builtin
|
||||||
───┼─────┼───────────────┼─────────
|
───┼─────┼───────────────┼─────────
|
||||||
0 │ e │ Nushell alias │ No
|
0 │ e │ Nushell alias │ false
|
||||||
───┴─────┴───────────────┴─────────
|
───┴─────┴───────────────┴─────────
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -100,6 +100,6 @@ and custom commands
|
|||||||
───┬──────────────┬────────────────────────┬─────────
|
───┬──────────────┬────────────────────────┬─────────
|
||||||
# │ arg │ path │ builtin
|
# │ arg │ path │ builtin
|
||||||
───┼──────────────┼────────────────────────┼─────────
|
───┼──────────────┼────────────────────────┼─────────
|
||||||
0 │ my_cool_echo │ Nushell custom command │ No
|
0 │ my_cool_echo │ Nushell custom command │ false
|
||||||
───┴──────────────┴────────────────────────┴─────────
|
───┴──────────────┴────────────────────────┴─────────
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user