Experiment: Allow both $true/true and $false/false (#4696)

* Change true/false to keywords

* oops, clippy

* Both kinds of bools

* Add in some boolean variables

* disable py virtualenv test for now
This commit is contained in:
JT
2022-03-02 19:55:03 -05:00
committed by GitHub
parent fd88920a9d
commit 96a1bf5f8d
50 changed files with 173 additions and 100 deletions

View File

@ -23,5 +23,5 @@ Print the value of a string
Print the value of a table
```shell
> echo [[version patch]; [0.1.0 $false] [0.1.1 $true] [0.2.0 $false]] | debug
> echo [[version patch]; [0.1.0 false] [0.1.1 true] [0.2.0 false]] | debug
```

View File

@ -14,7 +14,7 @@ Returns true if all values are false
Returns true if all values are false
```shell
> [$false $false $false] | dfr to-df | dfr all-false
> [false false false] | dfr to-df | dfr all-false
```
Checks the result from a comparison

View File

@ -14,7 +14,7 @@ Returns true if all values are true
Returns true if all values are true
```shell
> [$true $true $true] | dfr to-df | dfr all-true
> [true true true] | dfr to-df | dfr all-true
```
Checks the result from a comparison

View File

@ -14,5 +14,5 @@ Returns indexes where values are true
Returns indexes where values are true
```shell
> [$false $true $false] | dfr to-df | dfr arg-true
> [false true false] | dfr to-df | dfr arg-true
```

View File

@ -18,6 +18,6 @@ Filters dataframe using a mask as reference
Filter dataframe using a bool mask
```shell
> let mask = ([$true $false] | dfr to-df);
> let mask = ([true false] | dfr to-df);
[[a b]; [1 2] [3 4]] | dfr to-df | dfr filter-with $mask
```

View File

@ -14,5 +14,5 @@ Inverts boolean mask
Inverts boolean mask
```shell
> [$true $false $true] | dfr to-df | dfr not
> [true false true] | dfr to-df | dfr not
```

View File

@ -29,5 +29,5 @@ Takes a list and creates a dataframe
Takes a list of booleans and creates a dataframe
```shell
> [$true $true $false] | dfr to-df
> [true true false] | dfr to-df
```

View File

@ -49,7 +49,7 @@ Find odd values
Find if a service is not running
```shell
> [[version patch]; [0.1.0 $false] [0.1.1 $true] [0.2.0 $false]] | find -p { |it| $it.patch }
> [[version patch]; [0.1.0 false] [0.1.1 true] [0.2.0 false]] | find -p { |it| $it.patch }
```
Find using regex

View File

@ -40,5 +40,5 @@ Render a list of records to a grid
Render a table with 'name' column in it to a grid
```shell
> [[name patch]; [0.1.0 $false] [0.1.1 $true] [0.2.0 $false]] | grid
> [[name patch]; [0.1.0 false] [0.1.1 true] [0.2.0 false]] | grid
```

View File

@ -28,7 +28,7 @@ convert a number to a nushell binary primitive
convert a boolean to a nushell binary primitive
```shell
> $true | into binary
> true | into binary
```
convert a filesize to a nushell binary primitive

View File

@ -18,12 +18,12 @@ Convert value to boolean
Convert value to boolean in table
```shell
> echo [[value]; ['false'] ['1'] [0] [1.0] [$true]] | into bool value
> echo [[value]; ['false'] ['1'] [0] [1.0] [true]] | into bool value
```
Convert bool to boolean
```shell
> $true | into bool
> true | into bool
```
convert integer to boolean

View File

@ -44,7 +44,7 @@ Convert file size to integer
Convert bool to integer
```shell
> [$false, $true] | into int
> [false, true] | into int
```
Convert to integer from binary

View File

@ -49,7 +49,7 @@ convert string to string
convert boolean to string
```shell
> $true | into string
> true | into string
```
convert date to string

View File

@ -29,5 +29,5 @@ Set a variable to the result of an expression
Set a variable based on the condition
```shell
> let x = if $false { -1 } else { 1 }
> let x = if false { -1 } else { 1 }
```

View File

@ -19,5 +19,5 @@ Enter a new shell at parent path '..' and show all opened shells
Show currently active shell
```shell
> shells | where active == $true
> shells | where active == true
```

View File

@ -14,5 +14,5 @@ Shuffle rows randomly.
Shuffle rows randomly (execute it several times and see the difference)
```shell
> echo [[version patch]; [1.0.0 $false] [3.0.1 $true] [2.0.0 $false]] | shuffle
> echo [[version patch]; [1.0.0 false] [3.0.1 true] [2.0.0 false]] | shuffle
```