Files
nushell/crates/nu_plugin_example/src/commands/mod.rs
Devyn Cairns 00b3a07efe Add GetSpanContents engine call (#12439)
# Description
This allows plugins to view the source code of spans.

Requested by @ayax79 for implementing `polars ls`. Note that this won't
really help you find the location of the span. I'm planning to add
another engine call that will return information more similar to what
shows up in the miette diagnostics, with filename / line number / some
context, but I'll want to refactor some of the existing logic to make
that happen, so it was easier to just do this first. I hope this is
enough to at least have something somewhat useful show up for `polars
ls`.

# User-Facing Changes
- Example plugin: added `example view span` command

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting
- [ ] Add to plugin protocol reference
2024-04-09 10:02:17 -04:00

38 lines
589 B
Rust

// `example` command - just suggests to call --help
mod main;
pub use main::Main;
// Basic demos
mod one;
mod three;
mod two;
pub use one::One;
pub use three::Three;
pub use two::Two;
// Engine interface demos
mod config;
mod disable_gc;
mod env;
mod view_span;
pub use config::Config;
pub use disable_gc::DisableGc;
pub use env::Env;
pub use view_span::ViewSpan;
// Stream demos
mod collect_external;
mod for_each;
mod generate;
mod seq;
mod sum;
pub use collect_external::CollectExternal;
pub use for_each::ForEach;
pub use generate::Generate;
pub use seq::Seq;
pub use sum::Sum;