Update all Cargo.toml files to consistently inherit the `edition` and
`rust-version` from the workspace.
Most crates were missing a declared `rust-version`.
---------
Co-authored-by: Tim 'Piepmatz' Hesse <git+github@cptpiepmatz.de>
<!--
Thank you for improving Nushell!
Please, read our contributing guide:
https://github.com/nushell/nushell/blob/main/CONTRIBUTING.md
-->
This PR enables the clippy lint `needless_raw_strings` to avoid raw
strings where they aren't needed. We have a lot of them and I don't
think that's that nice tbh.
## Release notes summary - What our users need to know
<!--
This section will be included as part of our release notes. See the
contributing guide for more details.
Please include only details relevant for users here. Motivation and
technical details can be added above or below this section.
You may leave this section blank until your PR is finalized. Ask a core
team member if you need help filling this section.
-->
n/a
<!--
Thank you for improving Nushell!
Please, read our contributing guide:
https://github.com/nushell/nushell/blob/main/CONTRIBUTING.md
-->
## Release notes summary - What our users need to know
<!--
This section will be included as part of our release notes. See the
contributing guide for more details.
Please include only details relevant for users here. Motivation and
technical details can be added above or below this section.
You may leave this section blank until your PR is finalized. Ask a core
team member if you need help filling this section.
-->
## Tasks after submitting
<!-- Remove any tasks which aren't relevant for your PR, or add your own
-->
- [ ] Update the
[documentation](https://github.com/nushell/nushell.github.io)
Closes: #15766
It's similar to https://github.com/nushell/nushell/pull/16383, but
allows to generate completion dynamically, which can be useful for
plugin commands.
To implement this, I added a new `get_dynamic_completion` method to
`Command` trait, so nushell gets the ability to ask plugins for a
completion. Here is how it goes when I type `plugin-cmd --flag1 <tab>`.
1. the completion logic detect it's behind a flag, and it should have a
value, then it goes to `ArgValueDynamicCompletion`
2. inside `ArgValueDynamicCompletion` it calls
`get_dynamic_completion(ArgType::Flag(flag1))` on the command, which can
be plugin command, and it will issue a
`get_dynamic_completion(ArgType::Flag(flag1))` call to the plugin
3. the plugin returns `Some(Vec<DynamicSemanticSuggestion>)` if there
are available items.
It also supports dynamic completion for positional arguments, here is
how it goes when I type `plugin-cmd x<tab>`.
1. the completion logic detect it's behind a flag, and it should have a
value, then it goes to `ArgValueDynamicCompletion`
2. inside `ArgValueDynamicCompletion` it calls
`get_dynamic_completion(ArgType::Positional(0))` on the command, which
can be plugin command, and it will issue a
`get_dynamic_completion(ArgType::Positional(0))` call to the plugin
3. the plugin returns `Some(Vec<DynamicSemanticSuggestion>)` if there
are available items.
## Release notes summary - What our users need to know
### Plugin developer: auto completion is available for plugin command
arguments.
User can define auto completions for plugin commands, here is the way to
define this:
```rust
impl PluginCommand for FlagCompletion {
type Plugin = ExamplePlugin;
...
fn get_dynamic_completion(
&self,
_plugin: &Self::Plugin,
_engine: &EngineInterface,
arg_type: ArgType,
) -> Option<Vec<DynamicSemanticSuggestion>> {
match arg_type {
// enable completion for flag.
ArgType::Flag(flag_name) => match flag_name {
"flag1" => Some(vec!["flag_val1".to_string().into(), "flag_val2".to_string().into()]),
"flag2" => Some(vec!["flag_val3".to_string().into(), "flag_val4".to_string().into()]),
// for other flags don't need to provide a completion
_ => None,
},
// enable completion for positional arguments.
ArgType::Positional(index) => None,
}
}
}
```
For the detailed example, you can refer to `get_dynamic_completion` in
`crates/nu_plugin_example/src/commands/arg_completion.rs`.
## Tasks after submitting
- [ ] Update the
[documentation](https://github.com/nushell/nushell.github.io)
# Description
As title: this pr is try to introduce 2 functions to `PipelineData`:
1. PipelineData::list_stream --> create a PipelineData::ListStream
2. PipelineData::byte_stream -> create a PipelineData::ByteStream
And use these functions everywhere.
### Reason behind this change
I tried to implement `pipefail` feature, but this would required to
change `PipelineData` from enum to struct. So use these functions can
reduce diff if I finally change to struct. [Discord message
here](https://discord.com/channels/601130461678272522/615962413203718156/1396999539000479784)
is my plan.
# User-Facing Changes
NaN
# Tests + Formatting
NaN
# After Submitting
NaN
# Description
Bump nushell to development version.
# 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` to
check that you're using the standard code style
- `cargo test --workspace` to check that all tests pass (on Windows make
sure to [enable developer
mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging))
- `cargo run -- -c "use toolkit.nu; toolkit test stdlib"` 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.
-->
<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx
you can also mention related issues, PRs or discussions!
-->
# 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.
-->
Bump dev version to 0.104.2
# Description
List values and list streams have the same type (`list<>`). Rather,
streaming is a separate property of the pipeline/command output. This PR
removes the unnecessary `ListStream` type.
# User-Facing Changes
Should be none, except `random dice` now has a more specific output
type.
<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx
you can also mention related issues, PRs or discussions!
-->
# 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.
-->
Bump version to `0.100.0`
# User-Facing Changes
The new release `v0.100.0` is coming...
# Description
Turns out there are duplicate conversion functions: `as_i64` and
`as_f64`. In most cases, these can be replaced with `as_int` and
`as_float`, respectively.