mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
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:
@ -459,15 +459,15 @@ let base16_theme = {
|
||||
# now let's apply our regular config settings but also apply the "color_config:" theme that we specified above.
|
||||
|
||||
let config = {
|
||||
filesize_metric: $true
|
||||
filesize_metric: true
|
||||
table_mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
|
||||
use_ls_colors: $true
|
||||
use_ls_colors: true
|
||||
color_config: $base16_theme # <-- this is the theme
|
||||
use_grid_icons: $true
|
||||
use_grid_icons: true
|
||||
footer_mode: always #always, never, number_of_rows, auto
|
||||
animate_prompt: $false
|
||||
animate_prompt: false
|
||||
float_precision: 2
|
||||
without_color: $false
|
||||
without_color: false
|
||||
filesize_format: "b" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto
|
||||
edit_mode: emacs # vi
|
||||
max_history_size: 10000
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -49,7 +49,7 @@ convert string to string
|
||||
|
||||
convert boolean to string
|
||||
```shell
|
||||
> $true | into string
|
||||
> true | into string
|
||||
```
|
||||
|
||||
convert date to string
|
||||
|
@ -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 }
|
||||
```
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -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
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
let vers = (version).version
|
||||
|
||||
for command in ($scope.commands | where is_custom == $false && is_extern == $false) {
|
||||
for command in ($scope.commands | where is_custom == false && is_extern == false) {
|
||||
let top = $"---
|
||||
title: ($command.command)
|
||||
layout: command
|
||||
|
@ -139,9 +139,9 @@ function end_filter {
|
||||
function Write-TraceMessage {
|
||||
Param
|
||||
(
|
||||
[Parameter(Mandatory = $false, Position = 0)]
|
||||
[Parameter(Mandatory = false, Position = 0)]
|
||||
[string] $label,
|
||||
[Parameter(Mandatory = $false, Position = 1)]
|
||||
[Parameter(Mandatory = false, Position = 1)]
|
||||
[string] $message
|
||||
)
|
||||
|
||||
@ -196,9 +196,9 @@ function Get-PipedData {
|
||||
param(
|
||||
[Parameter(
|
||||
Position = 0,
|
||||
Mandatory = $true,
|
||||
ValueFromPipeline = $true,
|
||||
ValueFromPipelineByPropertyName = $true)
|
||||
Mandatory = true,
|
||||
ValueFromPipeline = true,
|
||||
ValueFromPipelineByPropertyName = true)
|
||||
]
|
||||
[Alias('piped')]
|
||||
[String]$piped_input
|
||||
|
Reference in New Issue
Block a user