nushell/tests
Devyn Cairns 1f4131532d
Deprecate register and add plugin use (#12607)
# Description

Adds a new keyword, `plugin use`. Unlike `register`, this merely loads
the signatures from the plugin cache file. The file is configurable with
the `--plugin-config` option either to `nu` or to `plugin use` itself,
just like the other `plugin` family of commands. At the REPL, one might
do this to replace `register`:

```nushell
> plugin add ~/.cargo/bin/nu_plugin_foo
> plugin use foo
```

This will not work in a script, because `plugin use` is a keyword and
`plugin add` does not evaluate at parse time (intentionally). This means
we no longer run random binaries during parse.

The `--plugins` option has been added to allow running `nu` with certain
plugins in one step. This is used especially for the `nu_with_plugins!`
test macro, but I'd imagine is generally useful. The only weird quirk is
that it has to be a list, and we don't really do this for any of our
other CLI args at the moment.

`register` now prints a deprecation parse warning.

This should fix #11923, as we now have a complete alternative to
`register`.

# User-Facing Changes

- Add `plugin use` command
- Deprecate `register`
- Add `--plugins` option to `nu` to replace a common use of `register`

# Tests + Formatting

I think I've tested it thoroughly enough and every existing test passes.
Testing nu CLI options and alternate config files is a little hairy and
I wish there were some more generic helpers for this, so this will go on
my TODO list for refactoring.

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

# After Submitting

- [ ] Update plugins sections of book
- [ ] Release notes
2024-04-23 06:37:50 -05:00
..
assets/nu_json Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
const_ Bump crate-ci/typos and fix typos (#12381) 2024-04-04 09:59:21 +02:00
eval Exit early when encountering parsing errors (#10213) 2023-09-05 14:36:37 +02:00
fixtures Deprecate register and add plugin use (#12607) 2024-04-23 06:37:50 -05:00
hooks Fix hooks on 0.92.0 (#12383) 2024-04-04 09:25:54 +02:00
modules Evaluate string interpolation at parse time (#11562) 2024-01-22 09:13:48 +02:00
overlays Fix overlay_use_main_not_exported hanging when an external spam command exists (#11261) 2023-12-08 06:08:38 -06:00
parsing Avoid panic when pipe a variable to a custom command which have recursive call (#12491) 2024-04-23 06:10:35 +08:00
path ls, rm, cp, open, touch, mkdir: Don't expand tilde if input path is quoted string or a variable. (#12232) 2024-03-25 10:08:38 +08:00
plugin_persistence Merge stream_example into example plugin and clean up names (#12234) 2024-03-19 12:36:46 -05:00
plugins Deprecate register and add plugin use (#12607) 2024-04-23 06:37:50 -05:00
scope Remove the Value::Block case (#12582) 2024-04-21 07:03:33 +02:00
shell Improve with-env robustness (#12523) 2024-04-16 19:08:58 +08:00
main.rs Keep plugins persistently running in the background (#12064) 2024-03-09 17:10:22 -06:00