mirror of
https://github.com/nushell/nushell.git
synced 2024-11-24 17:34:00 +01:00
399a7c8836
# Description This PR introduces a new `Signals` struct to replace our adhoc passing around of `ctrlc: Option<Arc<AtomicBool>>`. Doing so has a few benefits: - We can better enforce when/where resetting or triggering an interrupt is allowed. - Consolidates `nu_utils::ctrl_c::was_pressed` and other ad-hoc re-implementations into a single place: `Signals::check`. - This allows us to add other types of signals later if we want. E.g., exiting or suspension. - Similarly, we can more easily change the underlying implementation if we need to in the future. - Places that used to have a `ctrlc` of `None` now use `Signals::empty()`, so we can double check these usages for correctness in the future. |
||
---|---|---|
.. | ||
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 make use of the plugin after building nushell
run:
plugin add target/debug/nu_plugin_example
# or then either restart your current nushell session or run:
plugin use 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:
example config