mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 16:33:37 +01:00
092d496ff5
# Description #11492 fixed flags for builtin commands but I missed that plugins don't use the same `has_flag` that builtins do. This PR addresses this. Unfortunately this means that return value of `has_flag` needs to change from `bool` to `Result<bool, ShellError>` to produce an error when explicit value is not a boolean (just like in case of `has_flag` for builtin commands. It is not possible to check this in `EvaluatedCall::try_from_call` because # User-Facing Changes Passing explicit values to flags of plugin commands (like `--flag=true` `--flag=false`) should work now. BREAKING: changed return value of `EvaluatedCall::has_flag` method from `bool` to `Result<bool, ShellError>` # Tests + Formatting Added tests and updated documentation and examples |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |
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
example config
This subcommand demonstrates sending configuration from the nushell $env.config
to a plugin.
To register from after building nushell
run:
register target/debug/nu_plugin_example
The configuration for the plugin lives in $env.config.plugins.example
:
$env.config = {
plugins: {
example: [
some
values
]
}
}
To list plugin values run:
nu-example-config