Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions commands/docs/alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: alias
categories: |
core
version: 0.110.0
version: 0.111.0
core: |
Alias a command (with optional flags) to a new name.
usage: |
Expand Down Expand Up @@ -33,7 +33,7 @@ contributors: false
| nothing | nothing |
## Examples

Alias ll to ls -l
Alias ll to ls -l.
```nu
> alias ll = ls -l

Expand Down
12 changes: 6 additions & 6 deletions commands/docs/all.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: all
categories: |
filters
version: 0.110.0
version: 0.111.0
filters: |
Test if every element of the input fulfills a predicate expression.
usage: |
Expand Down Expand Up @@ -32,31 +32,31 @@ contributors: false
| list<any> | bool |
## Examples

Check if a list contains only true values
Check if a list contains only true values.
```nu
> [false true true false] | all {}
false
```

Check if each row's status is the string 'UP'
Check if each row's status is the string 'UP'.
```nu
> [[status]; [UP] [UP]] | all {|el| $el.status == UP }
true
```

Check that each item is a string
Check that each item is a string.
```nu
> [foo bar 2 baz] | all {|| ($in | describe) == 'string' }
false
```

Check that all values are equal to twice their index
Check that all values are equal to twice their index.
```nu
> [0 2 4 6] | enumerate | all {|i| $i.item == $i.index * 2 }
true
```

Check that all of the values are even, using a stored closure
Check that all of the values are even, using a stored closure.
```nu
> let cond = {|el| ($el mod 2) == 0 }; [2 4 6 8] | all $cond
true
Expand Down
58 changes: 56 additions & 2 deletions commands/docs/ansi.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: ansi
categories: |
platform
version: 0.110.0
version: 0.111.0
platform: |
Output ANSI codes to change color and style of text.
usage: |
Expand All @@ -24,7 +24,7 @@ contributors: false

- `--escape, -e`: escape sequence without the escape character(s) ('\x1b[' is not required)
- `--osc, -o`: operating system command (osc) escape sequence without the escape character(s) ('\x1b]' is not required)
- `--list, -l`: list available ansi code names
- `--list, -l`: List available ansi code names.

## Parameters

Expand Down Expand Up @@ -91,6 +91,60 @@ Use structured escape codes
Hello, Nu World!
```

Use structured escape codes with attribute name
```nu
> let strike_blue_on_red = {
fg: '#0000ff'
bg: '#ff0000'
attr: strike
}
$"(ansi --escape $strike_blue_on_red)Hello, Nu World!(ansi reset)"
Hello, Nu World!
```

Use structured escape codes with multiple attribute names
```nu
> let bold_italic_blue_on_red = {
fg: '#0000ff'
bg: '#ff0000'
attr: 'bold italic'
}
$"(ansi --escape $bold_italic_blue_on_red)Hello, Nu World!(ansi reset)"
Hello, Nu World!
```

Use structured escape codes with concatenated attribute codes
```nu
> let bold_italic_strike_blue_on_red = {
fg: '#0000ff'
bg: '#ff0000'
attr: bis
}
$"(ansi --escape $bold_italic_strike_blue_on_red)Hello, Nu World!(ansi reset)"
Hello, Nu World!
```

Use structured escape codes with attribute list (comma-separated)
```nu
> let bold_underline_blue = {
fg: '#0000ff'
attr: [b,underline]
}
$"(ansi --escape $bold_underline_blue)Hello, Nu World!(ansi reset)"
Hello, Nu World!
```

Use structured escape codes with multiple attributes in list
```nu
> let styled_text = {
fg: '#0000ff'
bg: '#ff0000'
attr: [bold, italic, strike]
}
$"(ansi --escape $styled_text)Hello, Nu World!(ansi reset)"
Hello, Nu World!
```

## Notes
```text
An introduction to what ANSI escape sequences are can be found in the
Expand Down
10 changes: 5 additions & 5 deletions commands/docs/ansi_gradient.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: ansi gradient
categories: |
platform
version: 0.110.0
version: 0.111.0
platform: |
Add a color gradient (using ANSI color codes) to the given string.
usage: |
Expand All @@ -22,10 +22,10 @@ contributors: false

## Flags

- `--fgstart, -a {string}`: foreground gradient start color in hex (0x123456)
- `--fgend, -b {string}`: foreground gradient end color in hex
- `--bgstart, -c {string}`: background gradient start color in hex
- `--bgend, -d {string}`: background gradient end color in hex
- `--fgstart, -a {string}`: Foreground gradient start color in hex (0x123456).
- `--fgend, -b {string}`: Foreground gradient end color in hex.
- `--bgstart, -c {string}`: Background gradient start color in hex.
- `--bgend, -d {string}`: Background gradient end color in hex.

## Parameters

Expand Down
4 changes: 2 additions & 2 deletions commands/docs/ansi_link.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: ansi link
categories: |
platform
version: 0.110.0
version: 0.111.0
platform: |
Add a link (using OSC 8 escape sequence) to the given string.
usage: |
Expand All @@ -23,7 +23,7 @@ contributors: false
## Flags

- `--text, -t {string}`: Link text. Uses uri as text if absent. In case of
tables, records and lists applies this text to all elements
tables, records and lists applies this text to all elements.

## Parameters

Expand Down
2 changes: 1 addition & 1 deletion commands/docs/ansi_strip.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: ansi strip
categories: |
platform
version: 0.110.0
version: 0.111.0
platform: |
Strip ANSI escape sequences from a string.
usage: |
Expand Down
12 changes: 6 additions & 6 deletions commands/docs/any.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: any
categories: |
filters
version: 0.110.0
version: 0.111.0
filters: |
Tests if any element of the input fulfills a predicate expression.
usage: |
Expand Down Expand Up @@ -32,31 +32,31 @@ contributors: false
| list<any> | bool |
## Examples

Check if a list contains any true values
Check if a list contains any true values.
```nu
> [false true true false] | any {}
true
```

Check if any row's status is the string 'DOWN'
Check if any row's status is the string 'DOWN'.
```nu
> [[status]; [UP] [DOWN] [UP]] | any {|el| $el.status == DOWN }
true
```

Check that any item is a string
Check that any item is a string.
```nu
> [1 2 3 4] | any {|| ($in | describe) == 'string' }
false
```

Check if any value is equal to twice its own index
Check if any value is equal to twice its own index.
```nu
> [9 8 7 6] | enumerate | any {|i| $i.item == $i.index * 2 }
true
```

Check if any of the values are odd, using a stored closure
Check if any of the values are odd, using a stored closure.
```nu
> let cond = {|e| $e mod 2 == 1 }; [2 4 1 6 8] | any $cond
true
Expand Down
14 changes: 7 additions & 7 deletions commands/docs/append.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: append
categories: |
filters
version: 0.110.0
version: 0.111.0
filters: |
Append any number of rows to a table.
usage: |
Expand Down Expand Up @@ -32,7 +32,7 @@ contributors: false
| any | list<any> |
## Examples

Append one int to a list
Append one int to a list.
```nu
> [0 1 2 3] | append 4
╭───┬───╮
Expand All @@ -45,7 +45,7 @@ Append one int to a list

```

Append a list to an item
Append a list to an item.
```nu
> 0 | append [1 2 3]
╭───┬───╮
Expand All @@ -57,7 +57,7 @@ Append a list to an item

```

Append a list of string to a string
Append a list of string to a string.
```nu
> "a" | append ["b"]
╭───┬───╮
Expand All @@ -67,7 +67,7 @@ Append a list of string to a string

```

Append three int items
Append three int items.
```nu
> [0 1] | append [2 3 4]
╭───┬───╮
Expand All @@ -80,7 +80,7 @@ Append three int items

```

Append ints and strings
Append ints and strings.
```nu
> [0 1] | append [2 nu 4 shell]
╭───┬───────╮
Expand All @@ -94,7 +94,7 @@ Append ints and strings

```

Append a range of ints to a list
Append a range of ints to a list.
```nu
> [0 1] | append 2..4
╭───┬───╮
Expand Down
24 changes: 12 additions & 12 deletions commands/docs/ast.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: ast
categories: |
debug
version: 0.110.0
version: 0.111.0
debug: |
Print the abstract syntax tree (ast) for a pipeline.
usage: |
Expand All @@ -22,9 +22,9 @@ contributors: false

## Flags

- `--json, -j`: Serialize to json
- `--minify, -m`: Minify the nuon or json output
- `--flatten, -f`: An easier to read version of the ast
- `--json, -j`: Serialize to json.
- `--minify, -m`: Minify the nuon or json output.
- `--flatten, -f`: An easier to read version of the ast.

## Parameters

Expand All @@ -40,37 +40,37 @@ contributors: false
| nothing | string |
## Examples

Print the ast of a string
Print the ast of a string.
```nu
> ast 'hello'

```

Print the ast of a pipeline
Print the ast of a pipeline.
```nu
> ast 'ls | where name =~ README'

```

Print the ast of a pipeline with an error
Print the ast of a pipeline with an error.
```nu
> ast 'for x in 1..10 { echo $x '

```

Print the ast of a pipeline with an error, as json, in a nushell table
Print the ast of a pipeline with an error, as json, in a nushell table.
```nu
> ast 'for x in 1..10 { echo $x ' --json | get block | from json

```

Print the ast of a pipeline with an error, as json, minified
Print the ast of a pipeline with an error, as json, minified.
```nu
> ast 'for x in 1..10 { echo $x ' --json --minify

```

Print the ast of a string flattened
Print the ast of a string flattened.
```nu
> ast "'hello'" --flatten
╭───┬─────────┬──────────────┬───────────────╮
Expand All @@ -84,13 +84,13 @@ Print the ast of a string flattened

```

Print the ast of a string flattened, as json, minified
Print the ast of a string flattened, as json, minified.
```nu
> ast "'hello'" --flatten --json --minify
[{"content":"'hello'","shape":"shape_string","span":{"start":0,"end":7}}]
```

Print the ast of a pipeline flattened
Print the ast of a pipeline flattened.
```nu
> ast 'ls | sort-by type name -i' --flatten
╭───┬─────────┬────────────────────┬────────────────╮
Expand Down
2 changes: 1 addition & 1 deletion commands/docs/attr.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: attr
categories: |
core
version: 0.110.0
version: 0.111.0
core: |
Various attributes for custom commands.
usage: |
Expand Down
Loading