nushell/crates/nu-cmd-extra
Ian Manske c747ec75c9
Add command_prelude module (#12291)
# Description
When implementing a `Command`, one must also import all the types
present in the function signatures for `Command`. This makes it so that
we often import the same set of types in each command implementation
file. E.g., something like this:
```rust
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
    record, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData,
    ShellError, Signature, Span, Type, Value,
};
```

This PR adds the `nu_engine::command_prelude` module which contains the
necessary and commonly used types to implement a `Command`:
```rust
// command_prelude.rs
pub use crate::CallExt;
pub use nu_protocol::{
    ast::{Call, CellPath},
    engine::{Command, EngineState, Stack},
    record, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, IntoSpanned,
    PipelineData, Record, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value,
};
```

This should reduce the boilerplate needed to implement a command and
also gives us a place to track the breadth of the `Command` API. I tried
to be conservative with what went into the prelude modules, since it
might be hard/annoying to remove items from the prelude in the future.
Let me know if something should be included or excluded.
2024-03-26 21:17:30 +00:00
..
assets REFACTOR: move the 0% commands to nu-cmd-extra (#9404) 2023-07-06 08:31:31 -07:00
src Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
tests Remove feat extra and include in default (#12140) 2024-03-10 17:29:02 +01:00
Cargo.toml Move more dependencies to workspace level (#12270) 2024-03-23 18:46:02 -05:00
LICENSE nu-cmd-extra crate infrastructure in place with the Bits command as the model for adding other commands (#9327) 2023-06-01 10:46:16 -07:00
README.md Remove feat extra and include in default (#12140) 2024-03-10 17:29:02 +01:00

nu-cmd-extra

The commands in this crate are the extra commands of Nushell. These commands are not in a state to be guaranteed to be part of the 1.0 API; meaning that there is no guarantee longer term that these commands will be around into the future.

For a while we did exclude them behind the --features extra compile time flag, meaning that the default release did not contain them. As we (the Nushell team) shipped a full build including both extra and dataframe for some time, we chose to sunset the extra feature but keep the commands in this crate for now. In the future the commands may be moved to more topical crates or discarded into plugins.