Skip to content

Commit 5b64e52

Browse files
committed
Documentation for the plugin.msgpackz overhaul
1 parent fa0abf7 commit 5b64e52

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

book/plugins.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,44 +32,39 @@ If you chose to download the git repository instead, run this when inside the cl
3232
> cargo install --path .
3333
```
3434

35-
This will create a binary file that can be used to register the plugin.
35+
This will create a binary file that can be used to add the plugin.
3636

3737
Keep in mind that when installing using crates.io, the binary can be saved in different locations depending on how your system is set up. A typical location is in the users's home directory under .cargo/bin.
3838

39-
## Registering a plugin
39+
## Adding a plugin
4040

41-
To enable an installed plugin, call the [`register`](/commands/docs/register.md) command to tell Nu where to find it. As you do, you'll need to also tell Nushell what encoding the plugin uses.
41+
To add a plugin to the plugin cache file, call the [`plugin add`](/commands/docs/plugin_add.md) command to tell Nu where to find it.
4242

4343
Please note that the plugin name needs to start with `nu_plugin_`, Nu uses the name prefix to detect plugins.
4444

4545
Linux+macOS:
4646

4747
```nu
48-
> register ./my_plugins/nu_plugin_cool
48+
> plugin add ./my_plugins/nu_plugin_cool
4949
```
5050

5151
Windows:
5252

5353
```nu
54-
> register .\my_plugins\nu_plugin_cool.exe
54+
> plugin add .\my_plugins\nu_plugin_cool.exe
5555
```
5656

57-
When [`register`](/commands/docs/register.md) is called:
57+
When [`plugin add`](/commands/docs/plugin_add.md) is called, Nu runs the plugin binary and communicates via the [plugin protocol](plugin_protocol_reference.md) to get the signatures of all of the commands the plugin supports. It then saves information about the plugin, including the command signatures, to the plugin cache file at `$nu.plugin-path` in a custom brotli-compressed MessagePack format. This caching step saves `nu` from having to run all plugins during startup, which could be very slow.
5858

59-
1. Nu launches the plugin, and waits for the plugin to tell Nu which communication encoding it should use
60-
2. Nu sends it a "Signature" message over stdin
61-
3. The plugin responds via stdout with a message containing its signature (name, description, arguments, flags, and more)
62-
4. Nu saves the plugin signature in the file at `$nu.plugin-path`, so registration is persisted across multiple launches
63-
64-
Once registered, the plugin is available as part of your set of commands:
59+
Once added, the next time `nu` is started, the plugin's commands are available as part of your set of commands:
6560

6661
```nu
6762
> help commands | where command_type == "plugin"
6863
```
6964

7065
### Updating a plugin
7166

72-
When updating a plugin, it is important to run `register` again just as above to load the new signatures from the plugin and allow Nu to rewrite them to the plugin file (`$nu.plugin-path`).
67+
When updating a plugin, it is important to run `plugin add` again just as above to load the new signatures from the plugin and allow Nu to rewrite them to the plugin file (`$nu.plugin-path`).
7368

7469
## Managing plugins
7570

0 commit comments

Comments
 (0)