2021-12-02 06:42:56 +01:00
|
|
|
# Plugin Example
|
|
|
|
|
|
|
|
Crate with a simple example of the Plugin trait that needs to be implemented
|
|
|
|
in order to create a binary that can be registered into nushell declaration list
|
2024-01-15 09:59:47 +01:00
|
|
|
|
|
|
|
## `example config`
|
|
|
|
|
|
|
|
This subcommand demonstrates sending configuration from the nushell `$env.config` to a plugin.
|
|
|
|
|
2024-07-05 14:16:50 +02:00
|
|
|
To make use of the plugin after building `nushell` run:
|
2024-01-15 09:59:47 +01:00
|
|
|
|
|
|
|
```nushell
|
2024-07-05 14:16:50 +02:00
|
|
|
plugin add target/debug/nu_plugin_example
|
|
|
|
# or then either restart your current nushell session or run:
|
|
|
|
plugin use target/debug/nu_plugin_example
|
2024-01-15 09:59:47 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
The configuration for the plugin lives in `$env.config.plugins.example`:
|
|
|
|
|
|
|
|
```nushell
|
|
|
|
$env.config = {
|
|
|
|
plugins: {
|
|
|
|
example: [
|
|
|
|
some
|
|
|
|
values
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
To list plugin values run:
|
|
|
|
|
|
|
|
```nushell
|
2024-03-19 18:36:46 +01:00
|
|
|
example config
|
2024-01-15 09:59:47 +01:00
|
|
|
```
|
|
|
|
|