Skip to content

Commit

Permalink
Refresh command docs for Nu v0.84 (nushell#1016)
Browse files Browse the repository at this point in the history
* Refresh command docs for Nu v0.84

* Remove docs of unexisting commands

* Fix doc building error
  • Loading branch information
hustcer committed Aug 23, 2023
1 parent 3369749 commit b88bc17
Show file tree
Hide file tree
Showing 503 changed files with 6,274 additions and 1,273 deletions.
5 changes: 3 additions & 2 deletions .vuepress/configs/sidebar/command_categories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const commandCategories = [
'/commands/categories/bits.md',
'/commands/categories/bytes.md',
'/commands/categories/chart.md',
'/commands/categories/conversions.md',
'/commands/categories/core.md',
'/commands/categories/database.md',
Expand All @@ -9,9 +10,7 @@ export const commandCategories = [
'/commands/categories/date.md',
'/commands/categories/debug.md',
'/commands/categories/default.md',
'/commands/categories/deprecated.md',
'/commands/categories/env.md',
'/commands/categories/experimental.md',
'/commands/categories/expression.md',
'/commands/categories/filesystem.md',
'/commands/categories/filters.md',
Expand All @@ -22,9 +21,11 @@ export const commandCategories = [
'/commands/categories/math.md',
'/commands/categories/misc.md',
'/commands/categories/network.md',
'/commands/categories/path.md',
'/commands/categories/platform.md',
'/commands/categories/prompt.md',
'/commands/categories/random.md',
'/commands/categories/removed.md',
'/commands/categories/shells.md',
'/commands/categories/strings.md',
'/commands/categories/system.md',
Expand Down
26 changes: 26 additions & 0 deletions commands/categories/chart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Chart

<script>
import pages from '@temp/pages'
export default {
computed: {
commands() {
return pages
.filter(p => p.path.includes('/commands/docs/'))
.filter(p => p.frontmatter.categories.includes('chart'))
.sort((a,b) => (a.title > b.title) ? 1 : ((b.title > a.title) ? -1 : 0));
}
}
}
</script>

<table>
<tr>
<th>Command</th>
<th>Description</th>
</tr>
<tr v-for="command in commands">
<td><a :href="command.path">{{ command.title }}</a></td>
<td style="white-space: pre-wrap;">{{ command.frontmatter.usage }}</td>
</tr>
</table>
26 changes: 26 additions & 0 deletions commands/categories/path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Path

<script>
import pages from '@temp/pages'
export default {
computed: {
commands() {
return pages
.filter(p => p.path.includes('/commands/docs/'))
.filter(p => p.frontmatter.categories.includes('path'))
.sort((a,b) => (a.title > b.title) ? 1 : ((b.title > a.title) ? -1 : 0));
}
}
}
</script>

<table>
<tr>
<th>Command</th>
<th>Description</th>
</tr>
<tr v-for="command in commands">
<td><a :href="command.path">{{ command.title }}</a></td>
<td style="white-space: pre-wrap;">{{ command.frontmatter.usage }}</td>
</tr>
</table>
26 changes: 26 additions & 0 deletions commands/categories/removed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Removed

<script>
import pages from '@temp/pages'
export default {
computed: {
commands() {
return pages
.filter(p => p.path.includes('/commands/docs/'))
.filter(p => p.frontmatter.categories.includes('removed'))
.sort((a,b) => (a.title > b.title) ? 1 : ((b.title > a.title) ? -1 : 0));
}
}
}
</script>

<table>
<tr>
<th>Command</th>
<th>Description</th>
</tr>
<tr v-for="command in commands">
<td><a :href="command.path">{{ command.title }}</a></td>
<td style="white-space: pre-wrap;">{{ command.frontmatter.usage }}</td>
</tr>
</table>
16 changes: 12 additions & 4 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.83.0
version: 0.84.0
core: |
Alias a command (with optional flags) to a new name.
usage: |
Expand All @@ -22,13 +22,21 @@ usage: |
- `name`: name of the alias
- `initial_value`: equals sign followed by value

## Notes
This command is a parser keyword. For details, check:
https://www.nushell.sh/book/thinking_in_nu.html

## Input/output types:

| input | output |
| ------- | ------- |
| nothing | nothing |

## Examples

Alias ll to ls -l
```shell
> alias ll = ls -l

```

## Notes
This command is a parser keyword. For details, check:
https://www.nushell.sh/book/thinking_in_nu.html
9 changes: 8 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.83.0
version: 0.84.0
filters: |
Test if every element of the input fulfills a predicate expression.
usage: |
Expand All @@ -21,6 +21,13 @@ usage: |

- `predicate`: a closure that must evaluate to a boolean


## Input/output types:

| input | output |
| --------- | ------ |
| list\<any\> | bool |
| table | bool |
## Examples

Check if each row's status is the string 'UP'
Expand Down
98 changes: 57 additions & 41 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.83.0
version: 0.84.0
platform: |
Output ANSI codes to change color and style of text.
usage: |
Expand All @@ -24,6 +24,56 @@ usage: |
- `--osc` `(-o)`: operating system command (osc) escape sequence without the escape character(s) ('\x1b]' is not required)
- `--list` `(-l)`: list available ansi code names


## Input/output types:

| input | output |
| ------- | ------ |
| nothing | string |

## Examples

Change color to green (see how the next example text will be green!)
```shell
> ansi green

```

Reset the color
```shell
> ansi reset

```

Use different colors and styles in the same text
```shell
> $'(ansi red_bold)Hello(ansi reset) (ansi green_dimmed)Nu(ansi reset) (ansi purple_italic)World(ansi reset)'
Hello Nu World
```

The same example as above with short names
```shell
> $'(ansi rb)Hello(ansi reset) (ansi gd)Nu(ansi reset) (ansi pi)World(ansi reset)'
Hello Nu World
```

Use escape codes, without the '\x1b['
```shell
> $"(ansi -e '3;93;41m')Hello(ansi reset)" # italic bright yellow on red background
Hello
```

Use structured escape codes
```shell
> let bold_blue_on_red = { # `fg`, `bg`, `attr` are the acceptable keys, all other keys are considered invalid and will throw errors.
fg: '#0000ff'
bg: '#ff0000'
attr: b
}
$"(ansi -e $bold_blue_on_red)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 Expand Up @@ -82,46 +132,12 @@ Operating system commands:
│ 6 │ 11 │ Set background color (x11 color spec) │
│ 7 │ ... │ others │
╰───┴─────┴───────────────────────────────────────╯
```
## Examples

Change color to green (see how the next example text will be green!)
```shell
> ansi green

```

Reset the color
```shell
> ansi reset

```

Use different colors and styles in the same text
```shell
> $'(ansi red_bold)Hello(ansi reset) (ansi green_dimmed)Nu(ansi reset) (ansi purple_italic)World(ansi reset)'
Hello Nu World
```
## Subcommands:

The same example as above with short names
```shell
> $'(ansi rb)Hello(ansi reset) (ansi gd)Nu(ansi reset) (ansi pi)World(ansi reset)'
Hello Nu World
```

Use escape codes, without the '\x1b['
```shell
> $"(ansi -e '3;93;41m')Hello(ansi reset)" # italic bright yellow on red background
Hello
```

Use structured escape codes
```shell
> let bold_blue_on_red = { # `fg`, `bg`, `attr` are the acceptable keys, all other keys are considered invalid and will throw errors.
fg: '#0000ff'
bg: '#ff0000'
attr: b
}
$"(ansi -e $bold_blue_on_red)Hello Nu World(ansi reset)"
Hello Nu World
```
| name | type | usage |
| -------------------------------------------------- | ------- | ------------------------------------------------------------------ |
| [`ansi gradient`](/commands/docs/ansi_gradient.md) | Builtin | Add a color gradient (using ANSI color codes) to the given string. |
| [`ansi link`](/commands/docs/ansi_link.md) | Builtin | Add a link (using OSC 8 escape sequence) to the given string. |
| [`ansi strip`](/commands/docs/ansi_strip.md) | Builtin | Strip ANSI escape sequences from a string. |
14 changes: 13 additions & 1 deletion 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.83.0
version: 0.84.0
platform: |
Add a color gradient (using ANSI color codes) to the given string.
usage: |
Expand All @@ -25,6 +25,15 @@ usage: |
- `--bgstart {string}`: background gradient start color in hex
- `--bgend {string}`: background gradient end color in hex


## Input/output types:

| input | output |
| ------------ | ------------ |
| list\<string\> | list\<string\> |
| record | record |
| string | string |
| table | table |
## Examples

draw text in a gradient with foreground start and end colors
Expand All @@ -50,3 +59,6 @@ draw text in a gradient by specifying foreground end color - start color is assu
> 'Hello, Nushell! This is a gradient.' | ansi gradient --fgend '0xe81cff'

```


**Tips:** Command `ansi gradient` was not included in the official binaries by default, you have to build it with `--features=extra` flag
14 changes: 13 additions & 1 deletion 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.83.0
version: 0.84.0
platform: |
Add a link (using OSC 8 escape sequence) to the given string.
usage: |
Expand All @@ -23,6 +23,15 @@ usage: |
- `--text {string}`: Link text. Uses uri as text if absent. In case of
tables, records and lists applies this text to all elements


## Input/output types:

| input | output |
| ------------ | ------------ |
| list\<string\> | list\<string\> |
| record | record |
| string | string |
| table | table |
## Examples

Create a link to open some file
Expand All @@ -42,3 +51,6 @@ Format a table column into links
> [[url text]; [https://example.com Text]] | ansi link url

```


**Tips:** Command `ansi link` was not included in the official binaries by default, you have to build it with `--features=extra` flag
11 changes: 10 additions & 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.83.0
version: 0.84.0
platform: |
Strip ANSI escape sequences from a string.
usage: |
Expand All @@ -21,6 +21,15 @@ usage: |

- `...rest`: for a data structure input, remove ANSI sequences from strings at the given cell paths


## Input/output types:

| input | output |
| ------------ | ------------ |
| list\<string\> | list\<string\> |
| record | record |
| string | string |
| table | table |
## Examples

Strip ANSI escape sequences from a string
Expand Down
Loading

0 comments on commit b88bc17

Please sign in to comment.