2021-12-02 05:42:56 +00: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 08:59:47 +00:00
|
|
|
|
|
|
|
## `example config`
|
|
|
|
|
|
|
|
This subcommand demonstrates sending configuration from the nushell `$env.config` to a plugin.
|
|
|
|
|
2024-07-05 12:16:50 +00:00
|
|
|
To make use of the plugin after building `nushell` run:
|
2024-01-15 08:59:47 +00:00
|
|
|
|
|
|
|
```nushell
|
2024-07-05 12:16:50 +00: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 08:59:47 +00: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 17:36:46 +00:00
|
|
|
example config
|
2024-01-15 08:59:47 +00:00
|
|
|
```
|
|
|
|
|