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/plugins.md
+8-13Lines changed: 8 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -32,44 +32,39 @@ If you chose to download the git repository instead, run this when inside the cl
32
32
> cargo install --path .
33
33
```
34
34
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.
36
36
37
37
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.
38
38
39
-
## Registering a plugin
39
+
## Adding a plugin
40
40
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.
42
42
43
43
Please note that the plugin name needs to start with `nu_plugin_`, Nu uses the name prefix to detect plugins.
44
44
45
45
Linux+macOS:
46
46
47
47
```nu
48
-
> register ./my_plugins/nu_plugin_cool
48
+
> plugin add ./my_plugins/nu_plugin_cool
49
49
```
50
50
51
51
Windows:
52
52
53
53
```nu
54
-
> register .\my_plugins\nu_plugin_cool.exe
54
+
> plugin add .\my_plugins\nu_plugin_cool.exe
55
55
```
56
56
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.
58
58
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:
65
60
66
61
```nu
67
62
> help commands | where command_type == "plugin"
68
63
```
69
64
70
65
### Updating a plugin
71
66
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`).
0 commit comments