Merge stream_example into example plugin and clean up names (#12234)

# Description

As suggested by @WindSoilder, since plugins can now contain both simple
commands that produce `Value` and commands that produce `PipelineData`
without having to choose one or the other for the whole plugin, this
change merges `stream_example` into `example`.

# User-Facing Changes

All of the example plugins are renamed.

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

- [ ] Check nushell/nushell.github.io for any docs that match the
command names changed
This commit is contained in:
Devyn Cairns
2024-03-19 10:36:46 -07:00
committed by GitHub
parent 02551c416c
commit a29efe28f7
28 changed files with 197 additions and 305 deletions

View File

@ -101,12 +101,12 @@ fn plugin_commands_run_without_error() {
cwd: ".",
plugins: [
("nu_plugin_inc"),
("nu_plugin_stream_example"),
("nu_plugin_example"),
("nu_plugin_custom_values"),
],
r#"
"2.0.0" | inc -m | ignore
stream_example seq 1 10 | ignore
example seq 1 10 | ignore
custom-value generate | ignore
"#
);
@ -120,14 +120,14 @@ fn plugin_commands_run_multiple_times_without_error() {
cwd: ".",
plugins: [
("nu_plugin_inc"),
("nu_plugin_stream_example"),
("nu_plugin_example"),
("nu_plugin_custom_values"),
],
r#"
["2.0.0" "2.1.0" "2.2.0"] | each { inc -m } | print
stream_example seq 1 10 | ignore
example seq 1 10 | ignore
custom-value generate | ignore
stream_example seq 1 20 | ignore
example seq 1 20 | ignore
custom-value generate2 | ignore
"#
);
@ -340,9 +340,9 @@ fn plugin_gc_can_be_disabled_by_plugin() {
cwd: ".",
plugin: ("nu_plugin_example"),
r#"
nu-example-disable-gc
example disable-gc
$env.config.plugin_gc = { default: { stop_after: 0sec } }
nu-example-1 1 foo | ignore # ensure we've run the plugin with the new config
example one 1 foo | ignore # ensure we've run the plugin with the new config
sleep 100ms
(plugin list | where name == example).0.is_running
"#
@ -355,11 +355,11 @@ fn plugin_gc_can_be_disabled_by_plugin() {
fn plugin_gc_does_not_stop_plugin_while_stream_output_is_active() {
let out = nu_with_plugins!(
cwd: ".",
plugin: ("nu_plugin_stream_example"),
plugin: ("nu_plugin_example"),
r#"
$env.config.plugin_gc = { default: { stop_after: 10ms } }
# This would exceed the configured time
stream_example seq 1 500 | each { |n| sleep 1ms; $n } | length | print
example seq 1 500 | each { |n| sleep 1ms; $n } | length | print
"#
);
assert!(out.status.success());