enhancement(test)- complete the install command to install plugins #9342 (#9357)

# Description
<!--
Thank you for improving Nushell. Please, check our [contributing
guide](../CONTRIBUTING.md) and talk to the core team before making major
changes.

Description of your pull request goes here. **Provide examples and/or
screenshots** if your changes affect the user experience.
-->
related to
   closes #9342 
   complete the install command to install plugins
    [
](https://github.com/nushell/nushell/pull/9288)
the issue

    toolkit build only builds in debug mode
    toolkit install only installs Nushell
toolkit register plugins will install any plugins in the path, in debug
or release
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->

# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->

---------

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
This commit is contained in:
Tarun Samanta 2023-06-13 18:58:53 +05:30 committed by GitHub
parent 26c489a0f5
commit 54f8e3442b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,7 @@ export def clippy [
try {
if $dataframe {
cargo clippy --workspace --features=dataframe -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect -A clippy::result_large_err
cargo clippy --workspace --features=dataframe,extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect -A clippy::result_large_err
} else {
cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect -A clippy::result_large_err
}
@ -54,11 +54,11 @@ export def test [
--dataframe: bool # use the dataframe feature
] {
if ($fast and $dataframe) {
cargo nextest run --all --features=dataframe
cargo nextest run --all --features=dataframe,extra
} else if ($fast) {
cargo nextest run --all
} else if ($dataframe) {
cargo test --workspace --features=dataframe
cargo test --workspace --features=dataframe,extra
} else {
cargo test --workspace
}
@ -309,11 +309,36 @@ def "nu-complete list features" [] {
open Cargo.toml | get features | transpose feature dependencies | get feature
}
def install-plugin [] {
let plugin = $in
print $'(char nl)Installing ($plugin)'
print '----------------------------'
cargo install --path $"crates/($plugin)"
}
# install Nushell and features you want
export def install [
...features: string@"nu-complete list features" # a space-separated list of feature to install with Nushell
--all: bool # install all plugins with Nushell
] {
cargo install --path . --features ($features | str join ",")
if not $all {
return
}
let plugins = [
nu_plugin_inc,
nu_plugin_gstat,
nu_plugin_query,
nu_plugin_example,
nu_plugin_custom_values,
nu_plugin_formats,
]
for plugin in $plugins {
$plugin | install-plugin
}
}
def windows? [] {