Skip to content
Merged
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
  •  
  •  
  •  
10 changes: 3 additions & 7 deletions commands/docs/alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: alias
categories: |
core
version: 0.76.0
version: 0.77.0
core: |
Alias a command (with optional flags) to a new name
Alias a command (with optional flags) to a new name.
usage: |
Alias a command (with optional flags) to a new name
Alias a command (with optional flags) to a new name.
---

# <code>{{ $frontmatter.title }}</code> for core
Expand All @@ -30,9 +30,5 @@ This command is a parser keyword. For details, check:
Alias ll to ls -l
```shell
> alias ll = ls -l
```

Make an alias that makes a list of all custom commands
```shell
> alias customs = ($nu.scope.commands | where is_custom | get command)
```
6 changes: 5 additions & 1 deletion 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.76.0
version: 0.77.0
filters: |
Test if every element of the input fulfills a predicate expression.
usage: |
Expand All @@ -26,19 +26,23 @@ usage: |
Check if each row's status is the string 'UP'
```shell
> [[status]; [UP] [UP]] | all {|el| $el.status == UP }
true
```

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

Check that all values are equal to twice their index
```shell
> [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
```shell
> let cond = {|el| ($el mod 2) == 0 }; [2 4 6 8] | all $cond
true
```
7 changes: 6 additions & 1 deletion 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.76.0
version: 0.77.0
platform: |
Output ANSI codes to change color.
usage: |
Expand Down Expand Up @@ -74,24 +74,29 @@ Format: #
Change color to green
```shell
> ansi green

```

Reset the color
```shell
> ansi reset

```

Use ansi to color text (rb = red bold, gb = green bold, pb = purple bold)
```shell
> $'(ansi rb)Hello (ansi gb)Nu (ansi pb)World(ansi reset)'
Hello Nu World
```

Use ansi to color text (italic bright yellow on red 'Hello' with green bold 'Nu' and purple bold 'World')
```shell
> [(ansi -e '3;93;41m') Hello (ansi reset) " " (ansi gb) Nu " " (ansi pb) World (ansi reset)] | str join
Hello Nu World
```

Use ansi to color text with a style (blue on red in bold)
```shell
> $"(ansi -e { fg: '#0000ff' bg: '#ff0000' attr: b })Hello Nu World(ansi reset)"
Hello Nu World
```
10 changes: 7 additions & 3 deletions commands/docs/ansi_gradient.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: ansi gradient
categories: |
platform
version: 0.76.0
version: 0.77.0
platform: |
Add a color gradient (using ANSI color codes) to the given string
Add a color gradient (using ANSI color codes) to the given string.
usage: |
Add a color gradient (using ANSI color codes) to the given string
Add a color gradient (using ANSI color codes) to the given string.
---

# <code>{{ $frontmatter.title }}</code> for platform
Expand All @@ -30,19 +30,23 @@ usage: |
draw text in a gradient with foreground start and end colors
```shell
> 'Hello, Nushell! This is a gradient.' | ansi gradient --fgstart 0x40c9ff --fgend 0xe81cff

```

draw text in a gradient with foreground start and end colors and background start and end colors
```shell
> 'Hello, Nushell! This is a gradient.' | ansi gradient --fgstart 0x40c9ff --fgend 0xe81cff --bgstart 0xe81cff --bgend 0x40c9ff

```

draw text in a gradient by specifying foreground start color - end color is assumed to be black
```shell
> 'Hello, Nushell! This is a gradient.' | ansi gradient --fgstart 0x40c9ff

```

draw text in a gradient by specifying foreground end color - start color is assumed to be black
```shell
> 'Hello, Nushell! This is a gradient.' | ansi gradient --fgend 0xe81cff

```
9 changes: 6 additions & 3 deletions commands/docs/ansi_link.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: ansi link
categories: |
platform
version: 0.76.0
version: 0.77.0
platform: |
Add a link (using OSC 8 escape sequence) to the given string
Add a link (using OSC 8 escape sequence) to the given string.
usage: |
Add a link (using OSC 8 escape sequence) to the given string
Add a link (using OSC 8 escape sequence) to the given string.
---

# <code>{{ $frontmatter.title }}</code> for platform
Expand All @@ -28,14 +28,17 @@ usage: |
Create a link to open some file
```shell
> 'file:///file.txt' | ansi link --text 'Open Me!'
Open Me!
```

Create a link without text
```shell
> 'https://www.nushell.sh/' | ansi link
https://www.nushell.sh/
```

Format a table column into links
```shell
> [[url text]; [https://example.com Text]] | ansi link url

```
7 changes: 4 additions & 3 deletions commands/docs/ansi_strip.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: ansi strip
categories: |
platform
version: 0.76.0
version: 0.77.0
platform: |
Strip ANSI escape sequences from a string
Strip ANSI escape sequences from a string.
usage: |
Strip ANSI escape sequences from a string
Strip ANSI escape sequences from a string.
---

# <code>{{ $frontmatter.title }}</code> for platform
Expand All @@ -26,4 +26,5 @@ usage: |
Strip ANSI escape sequences from a string
```shell
> $'(ansi green)(ansi cursor_on)hello' | ansi strip
hello
```
6 changes: 5 additions & 1 deletion 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.76.0
version: 0.77.0
filters: |
Tests if any element of the input fulfills a predicate expression.
usage: |
Expand All @@ -26,19 +26,23 @@ usage: |
Check if any row's status is the string 'DOWN'
```shell
> [[status]; [UP] [DOWN] [UP]] | any {|el| $el.status == DOWN }
true
```

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

Check if any value is equal to twice its own index
```shell
> [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
```shell
> let cond = {|e| $e mod 2 == 1 }; [2 4 1 6 8] | any $cond
true
```
27 changes: 26 additions & 1 deletion 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.76.0
version: 0.77.0
filters: |
Append any number of rows to a table.
usage: |
Expand Down Expand Up @@ -31,14 +31,39 @@ only unwrap the outer list, and leave the variable's contents untouched.
Append one Int item
```shell
> [0,1,2,3] | append 4
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
│ 2 │ 2 │
│ 3 │ 3 │
│ 4 │ 4 │
╰───┴───╯

```

Append three Int items
```shell
> [0,1] | append [2,3,4]
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
│ 2 │ 2 │
│ 3 │ 3 │
│ 4 │ 4 │
╰───┴───╯

```

Append Ints and Strings
```shell
> [0,1] | append [2,nu,4,shell]
╭───┬───────╮
│ 0 │ 0 │
│ 1 │ 1 │
│ 2 │ 2 │
│ 3 │ nu │
│ 4 │ 4 │
│ 5 │ shell │
╰───┴───────╯

```
5 changes: 4 additions & 1 deletion 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.76.0
version: 0.77.0
debug: |
Print the abstract syntax tree (ast) for a pipeline.
usage: |
Expand All @@ -26,14 +26,17 @@ usage: |
Print the ast of a string
```shell
> ast 'hello'

```

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

```

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

```
6 changes: 3 additions & 3 deletions commands/docs/bits.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: bits
categories: |
bits
version: 0.76.0
version: 0.77.0
bits: |
Various commands for working with bits
Various commands for working with bits.
usage: |
Various commands for working with bits
Various commands for working with bits.
---

# <code>{{ $frontmatter.title }}</code> for bits
Expand Down
13 changes: 10 additions & 3 deletions commands/docs/bits_and.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: bits and
categories: |
bits
version: 0.76.0
version: 0.77.0
bits: |
Performs bitwise and for integers
Performs bitwise and for integers.
usage: |
Performs bitwise and for integers
Performs bitwise and for integers.
---

# <code>{{ $frontmatter.title }}</code> for bits
Expand All @@ -26,9 +26,16 @@ usage: |
Apply bits and to two numbers
```shell
> 2 | bits and 2
2
```

Apply logical and to a list of numbers
```shell
> [4 3 2] | bits and 2
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 2 │
│ 2 │ 2 │
╰───┴───╯

```
24 changes: 21 additions & 3 deletions commands/docs/bits_not.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: bits not
categories: |
bits
version: 0.76.0
version: 0.77.0
bits: |
Performs logical negation on each bit
Performs logical negation on each bit.
usage: |
Performs logical negation on each bit
Performs logical negation on each bit.
---

# <code>{{ $frontmatter.title }}</code> for bits
Expand All @@ -27,14 +27,32 @@ usage: |
Apply logical negation to a list of numbers
```shell
> [4 3 2] | bits not
╭───┬─────────────────╮
│ 0 │ 140737488355323 │
│ 1 │ 140737488355324 │
│ 2 │ 140737488355325 │
╰───┴─────────────────╯

```

Apply logical negation to a list of numbers, treat input as 2 bytes number
```shell
> [4 3 2] | bits not -n 2
╭───┬───────╮
│ 0 │ 65531 │
│ 1 │ 65532 │
│ 2 │ 65533 │
╰───┴───────╯

```

Apply logical negation to a list of numbers, treat input as signed number
```shell
> [4 3 2] | bits not -s
╭───┬────╮
│ 0 │ -5 │
│ 1 │ -4 │
│ 2 │ -3 │
╰───┴────╯

```
Loading