Skip to content

Refresh commands #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 7, 2022
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
  •  
  •  
  •  
9 changes: 4 additions & 5 deletions book/commands/alias.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: alias
layout: command
version: 0.60.0
version: 0.60.1
usage: |
Alias a command (with optional flags) to a new name
---
Expand All @@ -12,17 +12,16 @@ usage: |

## Signature

`> alias (name) (initial_value)`
```> alias (name) (initial_value)```

## Parameters

- `name`: name of the alias
- `initial_value`: equals sign followed by value
- `name`: name of the alias
- `initial_value`: equals sign followed by value

## Examples

Alias ll to ls -l

```shell
> alias ll = ls -l
```
8 changes: 3 additions & 5 deletions book/commands/all.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: all?
layout: command
version: 0.60.0
version: 0.60.1
usage: |
Test if every element of the input matches a predicate.
---
Expand All @@ -12,22 +12,20 @@ usage: |

## Signature

`> all? (predicate)`
```> all? (predicate)```

## Parameters

- `predicate`: the predicate that must match
- `predicate`: the predicate that must match

## Examples

Find if services are running

```shell
> echo [[status]; [UP] [UP]] | all? status == UP
```

Check that all values are even

```shell
> echo [2 4 6 8] | all? ($it mod 2) == 0
```
17 changes: 6 additions & 11 deletions book/commands/ansi.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: ansi
layout: command
version: 0.60.0
version: 0.60.1
usage: |
Output ANSI codes to change color.
---
Expand All @@ -12,43 +12,38 @@ usage: |

## Signature

`> ansi (code) --escape --osc --list`
```> ansi (code) --escape --osc --list```

## Parameters

- `code`: the name of the code to use like 'green' or 'reset' to reset the color
- `--escape`: escape sequence without the escape character(s)
- `--osc`: operating system command (ocs) escape sequence without the escape character(s)
- `--list`: list available ansi code names
- `code`: the name of the code to use like 'green' or 'reset' to reset the color
- `--escape`: escape sequence without the escape character(s)
- `--osc`: operating system command (ocs) escape sequence without the escape character(s)
- `--list`: list available ansi code names

## Examples

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
> echo [(ansi rb) Hello " " (ansi gb) Nu " " (ansi pb) World (ansi reset)] | str collect
```

Use ansi to color text (italic bright yellow on red 'Hello' with green bold 'Nu' and purple bold 'World')

```shell
> echo [(ansi -e '3;93;41m') Hello (ansi reset) " " (ansi gb) Nu " " (ansi pb) World (ansi reset)] | str collect
```

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)"
```
18 changes: 7 additions & 11 deletions book/commands/ansi_gradient.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: ansi gradient
layout: command
version: 0.60.0
version: 0.60.1
usage: |
draw text with a provided start and end code making a gradient
---
Expand All @@ -12,38 +12,34 @@ usage: |

## Signature

`> ansi gradient ...column path --fgstart --fgend --bgstart --bgend`
```> ansi gradient ...column path --fgstart --fgend --bgstart --bgend```

## Parameters

- `...column path`: optionally, draw gradients using text from column paths
- `--fgstart {string}`: foreground gradient start color in hex (0x123456)
- `--fgend {string}`: foreground gradient end color in hex
- `--bgstart {string}`: background gradient start color in hex
- `--bgend {string}`: background gradient end color in hex
- `...column path`: optionally, draw gradients using text from column paths
- `--fgstart {string}`: foreground gradient start color in hex (0x123456)
- `--fgend {string}`: foreground gradient end color in hex
- `--bgstart {string}`: background gradient start color in hex
- `--bgend {string}`: background gradient end color in hex

## Examples

draw text in a gradient with foreground start and end colors

```shell
> echo '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
> echo '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
> echo '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
> echo 'Hello, Nushell! This is a gradient.' | ansi gradient --fgend 0xe81cff
```
7 changes: 3 additions & 4 deletions book/commands/ansi_strip.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: ansi strip
layout: command
version: 0.60.0
version: 0.60.1
usage: |
strip ansi escape sequences from string
---
Expand All @@ -12,16 +12,15 @@ usage: |

## Signature

`> ansi strip ...column path`
```> ansi strip ...column path```

## Parameters

- `...column path`: optionally, remove ansi sequences by column paths
- `...column path`: optionally, remove ansi sequences by column paths

## Examples

strip ansi escape sequences from string

```shell
> echo [ (ansi green) (ansi cursor_on) "hello" ] | str collect | ansi strip
```
8 changes: 3 additions & 5 deletions book/commands/any.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: any?
layout: command
version: 0.60.0
version: 0.60.1
usage: |
Tests if any element of the input matches a predicate.
---
Expand All @@ -12,22 +12,20 @@ usage: |

## Signature

`> any? (predicate)`
```> any? (predicate)```

## Parameters

- `predicate`: the predicate that must match
- `predicate`: the predicate that must match

## Examples

Find if a service is not running

```shell
> echo [[status]; [UP] [DOWN] [UP]] | any? status == DOWN
```

Check if any of the values is odd

```shell
> echo [2 4 1 6 8] | any? ($it mod 2) == 1
```
11 changes: 4 additions & 7 deletions book/commands/append.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: append
layout: command
version: 0.60.0
version: 0.60.1
usage: |
Append a row to the table.
Append any number of rows to a table.
---

# `{{ $frontmatter.title }}`
Expand All @@ -12,28 +12,25 @@ usage: |

## Signature

`> append (row)`
```> append (row)```

## Parameters

- `row`: the row to append
- `row`: the row, list, or table to append

## Examples

Append one Int item

```shell
> [0,1,2,3] | append 4
```

Append three Int items

```shell
> [0,1] | append [2,3,4]
```

Append Ints and Strings

```shell
> [0,1] | append [2,nu,4,shell]
```
7 changes: 3 additions & 4 deletions book/commands/benchmark.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: benchmark
layout: command
version: 0.60.0
version: 0.60.1
usage: |
Time the running time of a block
---
Expand All @@ -12,16 +12,15 @@ usage: |

## Signature

`> benchmark (block)`
```> benchmark (block)```

## Parameters

- `block`: the block to run
- `block`: the block to run

## Examples

Benchmarks a command within a block

```shell
> benchmark { sleep 500ms }
```
8 changes: 3 additions & 5 deletions book/commands/build-string.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: build-string
layout: command
version: 0.60.0
version: 0.60.1
usage: |
Create a string from the arguments.
---
Expand All @@ -12,22 +12,20 @@ usage: |

## Signature

`> build-string ...rest`
```> build-string ...rest```

## Parameters

- `...rest`: list of string
- `...rest`: list of string

## Examples

Builds a string from letters a b c

```shell
> build-string a b c
```

Builds a string from letters a b c

```shell
> build-string (1 + 2) = one ' ' plus ' ' two
```
19 changes: 8 additions & 11 deletions book/commands/cal.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: cal
layout: command
version: 0.60.0
version: 0.60.1
usage: |
Display a calendar.
---
Expand All @@ -12,33 +12,30 @@ usage: |

## Signature

`> cal --year --quarter --month --full-year --week-start --month-names`
```> cal --year --quarter --month --full-year --week-start --month-names```

## Parameters

- `--year`: Display the year column
- `--quarter`: Display the quarter column
- `--month`: Display the month column
- `--full-year {int}`: Display a year-long calendar for the specified year
- `--week-start {string}`: Display the calendar with the specified day as the first day of the week
- `--month-names`: Display the month names instead of integers
- `--year`: Display the year column
- `--quarter`: Display the quarter column
- `--month`: Display the month column
- `--full-year {int}`: Display a year-long calendar for the specified year
- `--week-start {string}`: Display the calendar with the specified day as the first day of the week
- `--month-names`: Display the month names instead of integers

## Examples

This month's calendar

```shell
> cal
```

The calendar for all of 2012

```shell
> cal --full-year 2012
```

This month's calendar with the week starting on monday

```shell
> cal --week-start monday
```
Loading