mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
Update some examples and docs (#4682)
* Update some examples and docs * Update now.rs * Update date_now.md Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
This commit is contained in:
@ -26,3 +26,8 @@ Get the time duration since a more accurate time
|
||||
```shell
|
||||
> (date now) - 2019-05-01T04:12:05.20+08:00
|
||||
```
|
||||
|
||||
Get current time in full RFC3339 format with timezone
|
||||
```shell
|
||||
> date now | debug
|
||||
```
|
||||
|
@ -16,7 +16,12 @@ Debug print the value(s) piped in.
|
||||
|
||||
## Examples
|
||||
|
||||
Describe the type of a string
|
||||
Print the value of a string
|
||||
```shell
|
||||
> 'hello' | debug
|
||||
```
|
||||
|
||||
Print the value of a table
|
||||
```shell
|
||||
> echo [[version patch]; [0.1.0 $false] [0.1.1 $true] [0.2.0 $false]] | debug
|
||||
```
|
||||
|
@ -28,6 +28,11 @@ Iterate over each element, keeping only values that succeed
|
||||
> [1 2 3] | each { |it| if $it == 2 { echo "found 2!"} }
|
||||
```
|
||||
|
||||
Iterate over each element, print the matching value and it's index
|
||||
```shell
|
||||
> [1 2 3] | each -n { |it| if $it.item == 2 { echo $"found 2 at ($it.index)!"} }
|
||||
```
|
||||
|
||||
Iterate over each element, keeping all results
|
||||
```shell
|
||||
> [1 2 3] | each --keep-empty { |it| if $it == 2 { echo "found 2!"} }
|
||||
|
@ -26,7 +26,7 @@ Convert bool to boolean
|
||||
> $true | into bool
|
||||
```
|
||||
|
||||
convert decimal to boolean
|
||||
convert integer to boolean
|
||||
```shell
|
||||
> 1 | into bool
|
||||
```
|
||||
|
@ -21,3 +21,8 @@ Multiplies elements in list
|
||||
```shell
|
||||
> [1 2 3] | par-each { |it| 2 * $it }
|
||||
```
|
||||
|
||||
Iterate over each element, print the matching value and it's index
|
||||
```shell
|
||||
> [1 2 3] | par-each -n { |it| if $it.item == 2 { echo $"found 2 at ($it.index)!"} }
|
||||
```
|
||||
|
Reference in New Issue
Block a user