Skip to content

Commit ba25de7

Browse files
Book: add links to commands (#810)
* Fix mispelled commands * Book: add links to commands * Update book/advanced.md Co-authored-by: Stefan Holderbach <[email protected]> --------- Co-authored-by: Mate Farkas <[email protected]> Co-authored-by: Stefan Holderbach <[email protected]>
1 parent 9744ee4 commit ba25de7

30 files changed

+114
-114
lines changed

book/advanced.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This metadata can be used, for example, to [create custom errors](creating_error
1212

1313
Thanks to Nushell's strict scoping rules, it is very easy to [iterate over collections in parallel](parallelism.md) which can help you speed up long-running scripts by just typing a few characters.
1414

15-
You can have an overview of `explore` command with [explore](explore.md)
15+
You can [interactively explore data](explore.md) with the [`explore`](/commands/docs/explore.md) command.
1616

1717
Finally, you can extend Nushell's functionality with [plugins](plugins.md).
1818
Almost anything can be a plugin as long as it communicates with Nushell in a protocol that Nushell understands.

book/background_task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Here is a setup example to make nushell "support" background task:
2121

2222
Then you will get some commands to schedule background tasks. (e.g: `job spawn`, `job status`, `job log`)
2323

24-
Cons note: It spawned a fresh nushell to execute the given command, so it doesn't inherit current scope's variables, custom commands, alias definition, except env variables which can convert value to string. Therefore, if you want to use custom commands or variables, you have to `use` or `define` them within the given block.
24+
Cons note: It spawned a fresh nushell to execute the given command, so it doesn't inherit current scope's variables, custom commands, alias definition, except env variables which can convert value to string. Therefore, if you want to use custom commands or variables, you have to [`use`](/commands/docs/use.md) or [`def`](/commands/docs/def.md) them within the given block.
2525

2626
## Using nu with terminal multiplexer
2727
You can choose and install a terminal multiplexer and use it.

book/coloring_and_theming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ config {
390390
391391
Coloring of the prompt is controlled by the `block` in `PROMPT_COMMAND` where you can write your own custom prompt. We've written a slightly fancy one that has git statuses located in the [nu_scripts repo](https://github.com/nushell/nu_scripts/blob/main/prompt/oh-my.nu).
392392
393-
## `LS_COLORS` colors for the `ls` command
393+
## `LS_COLORS` colors for the [`ls`](/commands/docs/ls.md) command
394394
395395
Nushell will respect and use the `LS_COLORS` environment variable setting on Mac, Linux, and Windows. This setting allows you to define the color of file types when you do a [`ls`](/commands/docs/ls.md). For instance, you can make directories one color, _.md markdown files another color, _.toml files yet another color, etc. There are a variety of ways to color your file types.
396396

book/command_signature.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Command signature
22

3-
nu commands contains a signature section, take `str distance` as example, the signature is like this:
3+
nu commands contains a signature section, take [`str distance`](/commands/docs/str_distance.md) as example, the signature is like this:
44

55
```
66
Signatures(Cell paths are supported):
@@ -11,14 +11,14 @@ The first type name before `|` describes the type of input pipeline. The command
1111

1212
`(Cell paths are supported)` indicates that you can provide cell paths for `str distance` to apply an operation at the given cell path(s) in a nested structure or table, and replace the column or field with the result, like: `ls | str distance 'nushell' 'name'`
1313

14-
Here is another one example, `str join`:
14+
Here is another one example, [`str join`](/commands/docs/str_join.md):
1515

1616
```
1717
Signatures:
1818
list<string> | str join <string?> -> <string>
1919
```
2020

21-
It says that `str join` command expect input pipeline is a list of string, and take optional `string` type argument, finally the output type is `string`.
21+
It says that [`str join`](/commands/docs/str_join.md) command expect input pipeline is a list of string, and take optional `string` type argument, finally the output type is `string`.
2222

2323
Some commands don't accept or require data through the input pipeline, thus the input type will be `<nothing>`.
24-
The same is true for the output type if the command returns `null` (e.g. `rm`).
24+
The same is true for the output type if the command returns `null` (e.g. [`rm`](/commands/docs/rm.md)).

book/configuration.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ These are some important variables to look at for Nushell-specific settings:
5454

5555
### Configurations with built-in commands
5656

57-
Starting with release v0.64 of Nushell, we have introduced two new commands(`config nu` and `config env`) which help you quickly edit nu configurations with your preferred text editor/IDE
57+
Starting with release v0.64 of Nushell, we have introduced two new commands([`config nu`](/commands/docs/config_nu.md) and [`config env`](/commands/docs/config_env.md)) which help you quickly edit nu configurations with your preferred text editor/IDE
5858

5959
Nushell follows underneath orders to locate the editor:
6060

@@ -111,9 +111,9 @@ There is an environment variable `$nu.loginshell-path` containing the path to th
111111

112112
### macOS: Keeping `/usr/bin/open` as `open`
113113

114-
Some tools (e.g. Emacs) rely on an `open` command to open files on Mac.
114+
Some tools (e.g. Emacs) rely on an [`open`](/commands/docs/open.md) command to open files on Mac.
115115
As Nushell has its own [`open`](/commands/docs/open.md) command which has different semantics and shadows `/usr/bin/open`, these tools will error out when trying to use it.
116-
One way to work around this is to define a custom command for Nushell's `open` and create an alias for the system's `open` in your `config.nu` file like this:
116+
One way to work around this is to define a custom command for Nushell's [`open`](/commands/docs/open.md) and create an alias for the system's [`open`](/commands/docs/open.md) in your `config.nu` file like this:
117117

118118
```
119119
def nuopen [arg, --raw (-r)] { if $raw { open -r $arg } else { open $arg } }
@@ -130,7 +130,7 @@ let-env PATH = ($env.PATH | split row (char esep) | append '/some/path')
130130

131131
This will append `/some/path` to the end of PATH; you can also use [`prepend`](/commands/docs/prepend.html) to add entries to the start of PATH.
132132

133-
Note the `split row (char esep)` step. We need to add it because in `env.nu`, the environment variables inherited from the host process are still strings. The conversion step of environment variables to Nushell values happens after reading the config files (see also the [Environment](environment.html#environment-variable-conversions) section). After that, for example in the Nushell REPL when `PATH`/`Path` is a list , you can use `append`/`prepend` directly.
133+
Note the `split row (char esep)` step. We need to add it because in `env.nu`, the environment variables inherited from the host process are still strings. The conversion step of environment variables to Nushell values happens after reading the config files (see also the [Environment](environment.html#environment-variable-conversions) section). After that, for example in the Nushell REPL when `PATH`/`Path` is a list , you can use [`append`](/commands/docs/append.md)/[`prepend`](/commands/docs/prepend.md) directly.
134134

135135
### Homebrew
136136

book/creating_errors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ Using the [metadata](metadata.md) information, you can create your own custom er
55
- The title of the error
66
- The label of error message, which includes both the text of the label and the span to underline
77

8-
You can use the `error make` command to create your own error messages. For example, let's say you had your own command called `my-command` and you wanted to give an error back to the caller about something wrong with a parameter that was passed in.
8+
You can use the [`error make`](/commands/docs/error_make.md) command to create your own error messages. For example, let's say you had your own command called `my-command` and you wanted to give an error back to the caller about something wrong with a parameter that was passed in.
99

1010
First, you can take the span of where the argument is coming from:
1111

1212
```
1313
let span = (metadata $x).span;
1414
```
1515

16-
Next, you can create an error using the `error make` command. This command takes in a record that describes the error to create:
16+
Next, you can create an error using the [`error make`](/commands/docs/error_make.md) command. This command takes in a record that describes the error to create:
1717

1818
```
1919
error make {msg: "this is fishy", label: {text: "fish right here", start: $span.start, end: $span.end } }

book/custom_commands.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ _Note: It's common practice in Nushell to separate the words of the command with
5555

5656
## Sub-commands
5757

58-
You can also define subcommands to commands using a space. For example, if we wanted to add a new subcommand to `str`, we can create it by naming our subcommand to start with "str ". For example:
58+
You can also define subcommands to commands using a space. For example, if we wanted to add a new subcommand to [`str`](/commands/docs/str.md), we can create it by naming our subcommand to start with "str ". For example:
5959

6060
```nushell
6161
def "str mycommand" [] {
6262
"hello"
6363
}
6464
```
6565

66-
Now we can call our custom command as if it were a built-in subcommand of `str`:
66+
Now we can call our custom command as if it were a built-in subcommand of [`str`](/commands/docs/str.md):
6767

6868
```
6969
> str mycommand
@@ -309,7 +309,7 @@ greet earth mars jupiter venus
309309
```
310310

311311
::: tip
312-
Each line of a command has its resulting value printed out when run, as long as it isn't `null`. Hence, `"hello all:"` above will be printed out despite not being the return value. To prevent this, you can place `null` (or the `ignore` command) at the end of the pipeline, like so: `"hello all:" | null`. Also note that most file system commands, such as `save` or `cd`, always output `null`.
312+
Each line of a command has its resulting value printed out when run, as long as it isn't `null`. Hence, `"hello all:"` above will be printed out despite not being the return value. To prevent this, you can place `null` (or the [`ignore`](/commands/docs/ignore.md) command) at the end of the pipeline, like so: `"hello all:" | null`. Also note that most file system commands, such as [`save`](/commands/docs/save.md) or [`cd`](/commands/docs/cd.md), always output `null`.
313313
:::
314314

315315
We could call the above definition of the `greet` command with any number of arguments, including none at all. All of the arguments are collected into `$name` as a list.
@@ -373,7 +373,7 @@ def greet [
373373
}
374374
```
375375

376-
The comments that we put on the definition and its parameters then appear as descriptions inside the `help` of the command.
376+
The comments that we put on the definition and its parameters then appear as descriptions inside the [`help`](/commands/docs/help.md) of the command.
377377

378378
Now, if we run `help greet`, we're given a more helpful help text:
379379

book/custom_completions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Let's look at an example:
1515
cat dog eel
1616
```
1717

18-
In the first line, we create a custom command that will return a list of three different animals. These are the values we'd like to use in the completion. Once we've created this command, we can now use it to provide completions for other custom commands and `extern`s.
18+
In the first line, we create a custom command that will return a list of three different animals. These are the values we'd like to use in the completion. Once we've created this command, we can now use it to provide completions for other custom commands and [`extern`](/commands/docs/extern.md)s.
1919

2020
In the second line, we use `string@animals`. This tells Nushell two things: the shape of the argument for type-checking and the custom completion to use if the user wants to complete values at that position.
2121

@@ -43,7 +43,7 @@ In our module, we've chosen to export only the custom command `my-command` but n
4343

4444
This is possible because custom completion tags using `@` are locked-in as the command is first parsed.
4545

46-
## Custom completion and `extern`
46+
## Custom completion and [`extern`](/commands/docs/extern.md)
4747

4848
A powerful combination is adding custom completions to [known `extern` commands](externs.md). These work the same way as adding a custom completion to a custom command: by creating the custom completion and then attaching it with a `@` to the type of one of the positional or flag arguments of the `extern`.
4949

book/dataframes.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The dataset has 5 columns and 5,429,252 rows. We can check that by using the
5858
───┴──────┴─────────┴─────────
5959
```
6060

61-
We can have a look at the first lines of the file using `first`:
61+
We can have a look at the first lines of the file using [`first`](/commands/docs/first.md):
6262

6363
```shell
6464
> $df | first
@@ -332,7 +332,7 @@ that exist in `df` by using the `aggregate` command
332332
333333
As you can see, the aggregate function computes the sum for those columns where
334334
a sum makes sense. If you want to filter out the text column, you can select
335-
the columns you want by using the `select` command
335+
the columns you want by using the [`select`](/commands/docs/select.md) command
336336
337337
```shell
338338
$df | sum | select int_1 int_2 float_1 float_2
@@ -416,8 +416,8 @@ right dataframe
416416
::: tip
417417
In `Nu` when a command has multiple arguments that are expecting
418418
multiple values we use brackets `[]` to enclose those values. In the case of
419-
`join` we can join on multiple columns as long as they have the
420-
same type, for example we could have done `$df | join $df_a [int_1 int_2] [int_1 int_2]`
419+
[`dfr join`](/commands/docs/dfr_join.md) we can join on multiple columns as long as they have the
420+
same type, for example we could have done `$df | dfr join $df_a [int_1 int_2] [int_1 int_2]`
421421
:::
422422
423423
By default, the join command does an inner join, meaning that it will keep the
@@ -428,14 +428,14 @@ in order to use it for further operations.
428428
## DataFrame group-by
429429
430430
One of the most powerful operations that can be performed with a DataFrame is
431-
the `group-by`. This command will allow you to perform aggregation operations
431+
the [`group-by`](/commands/docs/group-by.md). This command will allow you to perform aggregation operations
432432
based on a grouping criteria. In Nushell, a `GroupBy` is a type of object that
433433
can be stored and reused for multiple aggregations. This is quite handy, since
434434
the creation of the grouped pairs is the most expensive operation while doing
435435
group-by and there is no need to repeat it if you are planning to do multiple
436436
operations with the same group condition.
437437
438-
To create a `GroupBy` object you only need to use the `group-by` command
438+
To create a `GroupBy` object you only need to use the [`group-by`](/commands/docs/group-by.md) command
439439
440440
```shell
441441
> let group = ($df | group-by first)
@@ -794,7 +794,7 @@ and this new mask can be used to filter the dataframe
794794
```
795795
796796
Another operation that can be done with masks is setting or replacing a value
797-
from a series. For example, we can change the value in the column `first` where
797+
from a series. For example, we can change the value in the column [`first`](/commands/docs/first.md) where
798798
the value is equal to `a`
799799
800800
```shell
@@ -836,9 +836,9 @@ extract that information
836836
───┴───────┴───────┴─────────┴─────────┴───────┴────────┴───────┴────────
837837
```
838838
839-
The command `take` is very handy, especially if we mix it with other commands.
839+
The command [`take`](/commands/docs/take.md) is very handy, especially if we mix it with other commands.
840840
Let's say that we want to extract all rows for the first duplicated element for
841-
column `first`. In order to do that, we can use the command `arg-unique` as
841+
column [`first`](/commands/docs/first.md). In order to do that, we can use the command `arg-unique` as
842842
shown in the next example
843843
844844
```shell
@@ -859,7 +859,7 @@ We can use the `arg-sort` to accomplish that. In the next example we
859859
can sort the dataframe by the column `word`
860860
861861
::: tip
862-
The same result could be accomplished using the command `sort`
862+
The same result could be accomplished using the command [`sort`](/commands/docs/sort.md)
863863
:::
864864
865865
```shell
@@ -914,7 +914,7 @@ these operations.
914914
The first and most common operation that we have is `value_counts`. This
915915
command calculates a count of the unique values that exist in a Series. For
916916
example, we can use it to count how many occurrences we have in the column
917-
`first`
917+
[`first`](/commands/docs/first.md)
918918
919919
```shell
920920
> $df.first | value-counts

book/environment.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ There are several ways to set an environment variable:
2727

2828
### [`let-env`](/commands/docs/let-env.html)
2929

30-
Using the `let-env` command is the most straightforward method
30+
Using the [`let-env`](/commands/docs/let-env.md) command is the most straightforward method
3131

3232
```
3333
> let-env FOO = 'BAR'
@@ -42,11 +42,11 @@ let-env Path = ($env.Path | prepend 'C:\path\you\want\to\add')
4242
```
4343

4444
Here we've prepended our folder to the existing folders in the Path, so it will have the highest priority.
45-
If you want to give it the lowest priority instead, you can use the `append` command.
45+
If you want to give it the lowest priority instead, you can use the [`append`](/commands/docs/append.md) command.
4646

4747
### [`load-env`](/commands/docs/load-env.html)
4848

49-
If you have more than one environment variable you'd like to set, you can use `load-env` to create a table of name/value pairs and load multiple variables at the same time:
49+
If you have more than one environment variable you'd like to set, you can use [`load-env`](/commands/docs/load-env.md) to create a table of name/value pairs and load multiple variables at the same time:
5050

5151
```
5252
> load-env { "BOB": "FOO", "JAY": "BAR" }
@@ -94,7 +94,7 @@ true
9494
## Changing directory
9595

9696
Common task in a shell is to change directory with the [`cd`](/commands/docs/cd.html) command.
97-
In Nushell, calling `cd` is equivalent to setting the `PWD` environment variable.
97+
In Nushell, calling [`cd`](/commands/docs/cd.md) is equivalent to setting the `PWD` environment variable.
9898
Therefore, it follows the same rules as other environment variables (for example, scoping).
9999

100100
## Single-use environment variables
@@ -129,7 +129,7 @@ let-env FOO = 'BAR'
129129
## Defining environment from custom commands
130130

131131
Due to the scoping rules, any environment variables defined inside a custom command will only exist inside the command's scope.
132-
However, a command defined as [`def-env`](/commands/docs/def-env.html) instead of [`def`](/commands/docs/def.html) (it applies also to `export def`, see [Modules](modules.md)) will preserve the environment on the caller's side:
132+
However, a command defined as [`def-env`](/commands/docs/def-env.html) instead of [`def`](/commands/docs/def.html) (it applies also to [`export def`](/commands/docs/export_def.md), see [Modules](modules.md)) will preserve the environment on the caller's side:
133133

134134
```
135135
> def-env foo [] {

0 commit comments

Comments
 (0)