You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/advanced.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ This metadata can be used, for example, to [create custom errors](creating_error
12
12
13
13
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.
14
14
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.
16
16
17
17
Finally, you can extend Nushell's functionality with [plugins](plugins.md).
18
18
Almost anything can be a plugin as long as it communicates with Nushell in a protocol that Nushell understands.
Copy file name to clipboardExpand all lines: book/background_task.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Here is a setup example to make nushell "support" background task:
21
21
22
22
Then you will get some commands to schedule background tasks. (e.g: `job spawn`, `job status`, `job log`)
23
23
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.
25
25
26
26
## Using nu with terminal multiplexer
27
27
You can choose and install a terminal multiplexer and use it.
Copy file name to clipboardExpand all lines: book/coloring_and_theming.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -390,7 +390,7 @@ config {
390
390
391
391
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).
392
392
393
-
## `LS_COLORS` colors for the `ls` command
393
+
## `LS_COLORS` colors for the [`ls`](/commands/docs/ls.md) command
394
394
395
395
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.
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:
4
4
5
5
```
6
6
Signatures(Cell paths are supported):
@@ -11,14 +11,14 @@ The first type name before `|` describes the type of input pipeline. The command
11
11
12
12
`(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'`
13
13
14
-
Here is another one example, `str join`:
14
+
Here is another one example, [`str join`](/commands/docs/str_join.md):
15
15
16
16
```
17
17
Signatures:
18
18
list<string> | str join <string?> -> <string>
19
19
```
20
20
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`.
22
22
23
23
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)).
Copy file name to clipboardExpand all lines: book/configuration.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ These are some important variables to look at for Nushell-specific settings:
54
54
55
55
### Configurations with built-in commands
56
56
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
58
58
59
59
Nushell follows underneath orders to locate the editor:
60
60
@@ -111,9 +111,9 @@ There is an environment variable `$nu.loginshell-path` containing the path to th
111
111
112
112
### macOS: Keeping `/usr/bin/open` as `open`
113
113
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.
115
115
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:
117
117
118
118
```
119
119
def nuopen [arg, --raw (-r)] { if $raw { open -r $arg } else { open $arg } }
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.
132
132
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.
Copy file name to clipboardExpand all lines: book/creating_errors.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,15 @@ Using the [metadata](metadata.md) information, you can create your own custom er
5
5
- The title of the error
6
6
- The label of error message, which includes both the text of the label and the span to underline
7
7
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.
9
9
10
10
First, you can take the span of where the argument is coming from:
11
11
12
12
```
13
13
let span = (metadata $x).span;
14
14
```
15
15
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:
17
17
18
18
```
19
19
error make {msg: "this is fishy", label: {text: "fish right here", start: $span.start, end: $span.end } }
Copy file name to clipboardExpand all lines: book/custom_commands.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,15 +55,15 @@ _Note: It's common practice in Nushell to separate the words of the command with
55
55
56
56
## Sub-commands
57
57
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:
59
59
60
60
```nushell
61
61
def "str mycommand" [] {
62
62
"hello"
63
63
}
64
64
```
65
65
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):
67
67
68
68
```
69
69
> str mycommand
@@ -309,7 +309,7 @@ greet earth mars jupiter venus
309
309
```
310
310
311
311
::: 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`.
313
313
:::
314
314
315
315
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 [
373
373
}
374
374
```
375
375
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.
377
377
378
378
Now, if we run `help greet`, we're given a more helpful help text:
Copy file name to clipboardExpand all lines: book/custom_completions.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ Let's look at an example:
15
15
cat dog eel
16
16
```
17
17
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.
19
19
20
20
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.
21
21
@@ -43,7 +43,7 @@ In our module, we've chosen to export only the custom command `my-command` but n
43
43
44
44
This is possible because custom completion tags using `@` are locked-in as the command is first parsed.
45
45
46
-
## Custom completion and `extern`
46
+
## Custom completion and [`extern`](/commands/docs/extern.md)
47
47
48
48
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`.
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.
46
46
47
47
### [`load-env`](/commands/docs/load-env.html)
48
48
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:
50
50
51
51
```
52
52
> load-env { "BOB": "FOO", "JAY": "BAR" }
@@ -94,7 +94,7 @@ true
94
94
## Changing directory
95
95
96
96
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.
98
98
Therefore, it follows the same rules as other environment variables (for example, scoping).
99
99
100
100
## Single-use environment variables
@@ -129,7 +129,7 @@ let-env FOO = 'BAR'
129
129
## Defining environment from custom commands
130
130
131
131
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:
0 commit comments