nushell/src
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
..
tests Deprecate register and add plugin use (#12607) 2024-04-23 06:37:50 -05:00
command.rs Deprecate register and add plugin use (#12607) 2024-04-23 06:37:50 -05:00
config_files.rs Overhaul the plugin cache file with a new msgpack+brotli format (#12579) 2024-04-21 07:36:26 -05:00
ide.rs Fix circular source causing Nushell to crash (#12262) 2024-04-19 09:38:08 +03:00
logger.rs Use variable names directly in the format strings (#7906) 2023-01-29 19:37:54 -06:00
main.rs Deprecate register and add plugin use (#12607) 2024-04-23 06:37:50 -05:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
run.rs Overhaul the plugin cache file with a new msgpack+brotli format (#12579) 2024-04-21 07:36:26 -05:00
signals.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
terminal.rs Deduplicate nix dependency versions (#12307) 2024-03-27 16:43:37 +01:00
test_bins.rs Force timeit to not capture stdout (#12465) 2024-04-10 13:31:29 +00:00
tests.rs Deprecate register and add plugin use (#12607) 2024-04-23 06:37:50 -05:00

Nushell REPL

This directory contains the main Nushell REPL (read eval print loop) as part of the CLI portion of Nushell, which creates the nu binary itself.

Current versions of the nu binary will use the Nu argument parsing logic to parse the commandline arguments passed to nu, leaving the logic here to be a thin layer around what the core libraries.