mirror of
https://github.com/nushell/nushell.git
synced 2025-04-23 04:38:21 +02:00
# Description This PR removes the `register` command which has been [deprecated](https://www.nushell.sh/blog/2024-04-30-nushell_0_93_0.html#register-toc) in favor of [`plugin add`](https://www.nushell.sh/blog/2024-04-30-nushell_0_93_0.html#redesigned-plugin-management-commands-toc) # User-Facing Changes `register` is no longer available
32 lines
773 B
Rust
32 lines
773 B
Rust
use crate::*;
|
|
use nu_protocol::engine::{EngineState, StateWorkingSet};
|
|
|
|
pub fn add_plugin_command_context(mut engine_state: EngineState) -> EngineState {
|
|
let delta = {
|
|
let mut working_set = StateWorkingSet::new(&engine_state);
|
|
|
|
macro_rules! bind_command {
|
|
( $( $command:expr ),* $(,)? ) => {
|
|
$( working_set.add_decl(Box::new($command)); )*
|
|
};
|
|
}
|
|
|
|
bind_command!(
|
|
PluginAdd,
|
|
PluginCommand,
|
|
PluginList,
|
|
PluginRm,
|
|
PluginStop,
|
|
PluginUse,
|
|
);
|
|
|
|
working_set.render()
|
|
};
|
|
|
|
if let Err(err) = engine_state.merge_delta(delta) {
|
|
eprintln!("Error creating default context: {err:?}");
|
|
}
|
|
|
|
engine_state
|
|
}
|