Commit Graph

1421 Commits

Author SHA1 Message Date
Antoine Stevan
55edef5dda
create nuon crate from from nuon and to nuon (#12553)
# Description
playing with the NUON format in Rust code in some plugins, we agreed
with the team it was a great time to create a standalone NUON format to
allow Rust devs to use this Nushell file format.

> **Note**
> this PR almost copy-pastes the code from
`nu_commands/src/formats/from/nuon.rs` and
`nu_commands/src/formats/to/nuon.rs` to `nuon/src/from.rs` and
`nuon/src/to.rs`, with minor tweaks to make then standalone functions,
e.g. remove the rest of the command implementations

### TODO
- [x] add tests
- [x] add documentation

# User-Facing Changes
devs will have access to a new crate, `nuon`, and two functions,
`from_nuon` and `to_nuon`
```rust
from_nuon(
    input: &str,
    span: Option<Span>,
) -> Result<Value, ShellError>
```
```rust
to_nuon(
    input: &Value,
    raw: bool,
    tabs: Option<usize>,
    indent: Option<usize>,
    span: Option<Span>,
) -> Result<String, ShellError>
```

# Tests + Formatting
i've basically taken all the tests from
`crates/nu-command/tests/format_conversions/nuon.rs` and converted them
to use `from_nuon` and `to_nuon` instead of Nushell commands
- i've created a `nuon_end_to_end` to run both conversions with an
optional middle value to check that all is fine

> **Note** 
> the `nuon::tests::read_code_should_fail_rather_than_panic` test does
give different results locally and in the CI...
> i've left it ignored with comments to help future us :)

# After Submitting
mention that in the release notes for sure!!
2024-04-19 13:54:16 +02:00
Jack Wright
57b0c722c6
Upgrading nu-cmd-dataframe to polars 0.39 (#12554)
#Description
Upgrading nu-cmd-dataframe to polars 0.39

---------

Co-authored-by: Jack Wright <jack.wright@disqo.com>
2024-04-17 12:50:17 -05:00
Jack Wright
410f3c5c8a
Upgrading nu_plugin_polars to polars 0.39.1 (#12551)
# Description
Upgrading nu_plugin_polars to polars 0.39.1

Co-authored-by: Jack Wright <jack.wright@disqo.com>
2024-04-17 06:35:09 -05:00
dependabot[bot]
9a739d9f0d
Bump rmp-serde from 1.1.2 to 1.2.0 (#12547)
Bumps [rmp-serde](https://github.com/3Hren/msgpack-rust) from 1.1.2 to
1.2.0.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/3Hren/msgpack-rust/commits/rmp-serde/v1.2.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rmp-serde&package-manager=cargo&previous-version=1.1.2&new-version=1.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-17 16:44:54 +08:00
Devyn Cairns
c06ef201b7
Local socket mode and foreground terminal control for plugins (#12448)
# Description

Adds support for running plugins using local socket communication
instead of stdio. This will be an optional thing that not all plugins
have to support.

This frees up stdio for use to make plugins that use stdio to create
terminal UIs, cc @amtoine, @fdncred.

This uses the [`interprocess`](https://crates.io/crates/interprocess)
crate (298 stars, MIT license, actively maintained), which seems to be
the best option for cross-platform local socket support in Rust. On
Windows, a local socket name is provided. On Unixes, it's a path. The
socket name is kept to a relatively small size because some operating
systems have pretty strict limits on the whole path (~100 chars), so on
macOS for example we prefer `/tmp/nu.{pid}.{hash64}.sock` where the hash
includes the plugin filename and timestamp to be unique enough.

This also adds an API for moving plugins in and out of the foreground
group, which is relevant for Unixes where direct terminal control
depends on that.

TODO:

- [x] Generate local socket path according to OS conventions
- [x] Add support for passing `--local-socket` to the plugin executable
instead of `--stdio`, and communicating over that instead
- [x] Test plugins that were broken, including
[amtoine/nu_plugin_explore](https://github.com/amtoine/nu_plugin_explore)
- [x] Automatically upgrade to using local sockets when supported,
falling back if it doesn't work, transparently to the user without any
visible error messages
  - Added protocol feature: `LocalSocket`
- [x] Reset preferred mode to `None` on `register`
- [x] Allow plugins to detect whether they're running on a local socket
and can use stdio freely, so that TUI plugins can just produce an error
message otherwise
  - Implemented via `EngineInterface::is_using_stdio()`
- [x] Clean up foreground state when plugin command exits on the engine
side too, not just whole plugin
- [x] Make sure tests for failure cases work as intended
  - `nu_plugin_stress_internals` added

# User-Facing Changes
- TUI plugins work
- Non-Rust plugins could optionally choose to use this
- This might behave differently, so will need to test it carefully
across different operating systems

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting
- [ ] Document local socket option in plugin contrib docs
- [ ] Document how to do a terminal UI plugin in plugin contrib docs
- [ ] Document: `EnterForeground` engine call
- [ ] Document: `LeaveForeground` engine call
- [ ] Document: `LocalSocket` protocol feature
2024-04-15 18:28:18 +00:00
Devyn Cairns
2ae9ad8676
Copy-on-write for record values (#12305)
# Description
This adds a `SharedCow` type as a transparent copy-on-write pointer that
clones to unique on mutate.

As an initial test, the `Record` within `Value::Record` is shared.

There are some pretty big wins for performance. I'll post benchmark
results in a comment. The biggest winner is nested access, as that would
have cloned the records for each cell path follow before and it doesn't
have to anymore.

The reusability of the `SharedCow` type is nice and I think it could be
used to clean up the previous work I did with `Arc` in `EngineState`.
It's meant to be a mostly transparent clone-on-write that just clones on
`.to_mut()` or `.into_owned()` if there are actually multiple
references, but avoids cloning if the reference is unique.

# User-Facing Changes
- `Value::Record` field is a different type (plugin authors)

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting
- [ ] use for `EngineState`
- [ ] use for `Value::List`
2024-04-14 01:42:03 +00:00
Jack Wright
b9dd47ebb7
Polars 0.38 upgrade (#12506)
# Description
Polars 0.38 upgrade for both the dataframe crate and the polars plugin.

---------

Co-authored-by: Jack Wright <jack.wright@disqo.com>
2024-04-13 13:00:04 -05:00
Jack Wright
f975c9923a
Handle relative paths correctly on polars to-(parquet|jsonl|arrow|etc) commands (#12486)
# Description

All polars commands that output a file were not handling relative paths
correctly.

A command like
``` [[a b]; [6 2] [1 4] [4 1]] | polars into-df | polars to-parquet foo.json``` 
was outputting the foo.json to the directory of the plugin executable. 

This pull request pulls in nu-path and using it for resolving the file paths.

Related discussion
https://discord.com/channels/601130461678272522/1227612017171501136/1227889870358183966

# User-Facing Changes
None

# Tests + Formatting
Done, added tests for each of the polars to-* commands.

---------

Co-authored-by: Jack Wright <jack.wright@disqo.com>
2024-04-12 19:30:37 -05:00
Darren Schroeder
b7fb0af967
bump nushell to latest reedline (#12497)
# Description

This bumps nushell to the latest reedline main brach which includes the
new bashism !term.

# 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 std testing; testing run-tests --path
crates/nu-std"` 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.
-->
2024-04-12 16:56:40 -04:00
Stefan Holderbach
872945ae8e
Bump version to 0.92.3 (#12476) 2024-04-12 08:00:43 -05:00
Jack Wright
efc1cfa939
Move dataframes support to a plugin (#12220)
WIP

This PR covers migration crates/nu-cmd-dataframes to a new plugin
./crates/nu_plugin_polars

## TODO List

Other:
- [X] Fix examples
- [x] Fix Plugin Test Harness
- [X] Move Cache to Mutex<BTreeMap>
- [X] Logic for disabling/enabling plugin GC based off whether items are
cached.
- [x] NuExpression custom values
- [X] Optimize caching (don't cache every object creation). 
- [x] Fix dataframe operations (in NuDataFrameCustomValue::operations)
- [x] Added plugin_debug! macro that for checking an env variable
POLARS_PLUGIN_DEBUG

Fix duplicated commands:
- [x] There are two polars median commands, one for lazy and one for
expr.. there should only be one that works for both. I temporarily
called on polars expr-median (inside expressions_macros.rs)
- [x] polars quantile (lazy, and expr). the expr one is temporarily
expr-median
- [x] polars is-in (renamed one series-is-in)

Commands:
- [x] AppendDF
- [x] CastDF
- [X] ColumnsDF
- [x] DataTypes
- [x] Summary
- [x] DropDF
- [x] DropDuplicates
- [x] DropNulls
- [x] Dummies
- [x] FilterWith
- [X] FirstDF
- [x] GetDF
- [x] LastDF
- [X] ListDF
- [x] MeltDF
- [X] OpenDataFrame
- [x] QueryDf
- [x] RenameDF
- [x] SampleDF
- [x] SchemaDF
- [x] ShapeDF
- [x] SliceDF
- [x] TakeDF
- [X] ToArrow
- [x] ToAvro
- [X] ToCSV
- [X] ToDataFrame
- [X] ToNu
- [x] ToParquet
- [x] ToJsonLines
- [x] WithColumn
- [x] ExprAlias
- [x] ExprArgWhere
- [x] ExprCol
- [x] ExprConcatStr
- [x] ExprCount
- [x] ExprLit
- [x] ExprWhen
- [x] ExprOtherwise
- [x] ExprQuantile
- [x] ExprList
- [x] ExprAggGroups
- [x] ExprCount
- [x] ExprIsIn
- [x] ExprNot
- [x] ExprMax
- [x] ExprMin
- [x] ExprSum
- [x] ExprMean
- [x] ExprMedian
- [x] ExprStd
- [x] ExprVar
- [x] ExprDatePart
- [X] LazyAggregate
- [x] LazyCache
- [X] LazyCollect
- [x] LazyFetch
- [x] LazyFillNA
- [x] LazyFillNull
- [x] LazyFilter
- [x] LazyJoin
- [x] LazyQuantile
- [x] LazyMedian
- [x] LazyReverse
- [x] LazySelect
- [x] LazySortBy
- [x] ToLazyFrame
- [x] ToLazyGroupBy
- [x] LazyExplode
- [x] LazyFlatten
- [x] AllFalse
- [x] AllTrue
- [x] ArgMax
- [x] ArgMin
- [x] ArgSort
- [x] ArgTrue
- [x] ArgUnique
- [x] AsDate
- [x] AsDateTime
- [x] Concatenate
- [x] Contains
- [x] Cumulative
- [x] GetDay
- [x] GetHour
- [x] GetMinute
- [x] GetMonth
- [x] GetNanosecond
- [x] GetOrdinal
- [x] GetSecond
- [x] GetWeek
- [x] GetWeekDay
- [x] GetYear
- [x] IsDuplicated
- [x] IsIn
- [x] IsNotNull
- [x] IsNull
- [x] IsUnique
- [x] NNull
- [x] NUnique
- [x] NotSeries
- [x] Replace
- [x] ReplaceAll
- [x] Rolling
- [x] SetSeries
- [x] SetWithIndex
- [x] Shift
- [x] StrLengths
- [x] StrSlice
- [x] StrFTime
- [x] ToLowerCase
- [x] ToUpperCase
- [x] Unique
- [x] ValueCount

---------

Co-authored-by: Jack Wright <jack.wright@disqo.com>
2024-04-09 19:31:43 -05:00
dependabot[bot]
56c9587cc3
Bump similar from 2.4.0 to 2.5.0 (#12375) 2024-04-07 21:50:11 +00:00
dependabot[bot]
625a9144cf
Bump h2 from 0.3.24 to 0.3.26 (#12413) 2024-04-07 21:48:18 +00:00
Jack Wright
1c5bd21ebc
Added let command to PluginTest (#12431)
# Description
The `let` command is needed for many example tests. This pull request
adds the `let` command to the EngineState of Test Plugin.

cc: @devyn 

# User-Facing Changes
No user changes. Plugin tests can now have examples with the let
keyword.

Co-authored-by: Jack Wright <jack.wright@disqo.com>
2024-04-06 20:11:41 +00:00
dependabot[bot]
ed4927441f
Bump rust-embed from 8.2.0 to 8.3.0 (#12374) 2024-04-06 13:59:01 +00:00
dependabot[bot]
6fba5f5ec7
Bump shadow-rs from 0.26.1 to 0.27.1 (#12372) 2024-04-06 13:58:16 +00:00
pwygab
12b897b149
Make auto-cd check for permissions (#12342)
<!--
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.
-->
I was playing around with auto-cd and realised it didn't check for
permissions before cd'ing. This PR fixes that.

```
~/CodingProjects/nushell> /root                                                                           
Error: nu:🐚:io_error

  × I/O error
  help: Cannot change directory to /root: You are neither the owner, in the group, nor the super user and do not have permission
```

This PR also refactors some of the filesystem utilities to nu-utils,
specifically the permissions checking and users.

# 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 std testing; testing run-tests --path
crates/nu-std"` 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.
-->
2024-04-06 08:56:46 -05:00
Stefan Holderbach
394487b3a7
Bump version to 0.92.2 (#12402) 2024-04-05 10:24:00 -04:00
Stefan Holderbach
c00a05a762
Bump version to 0.92.1 (#12380) 2024-04-04 16:18:54 +02:00
Stefan Holderbach
c3428b891a
Bump version for 0.92.0 release (#12349)
- [x] `cargo hack` feature flag compatibility run
- [x] reedline released and pinned
- [x] `nu-plugin-test-support` added to release script
- [x] dependency tree checked
- [x] release notes
2024-04-02 20:50:26 +03:00
Jakub Žádník
50ad729e45
Bump reedline to 0.31.0 (#12366)
See changelog:
https://github.com/nushell/reedline/releases/tag/v0.31.0
2024-04-02 20:27:16 +03:00
Ian Manske
251599c507
Use safe nix API instead of libc (#12315)
# Description
Where possible, this PR replaces usages of raw `libc` bindings to
instead use safe interfaces from the `nix` crate. Where not possible,
the `libc` version reexported through `nix` was used instead of having a
separate `libc` dependency.
2024-03-30 14:49:54 +01:00
Darren Schroeder
e97368433b
add a few more logging statements for debugging startup (#12316)
# Description

This PR adds a few more `trace!()` and `perf()` statements that allowed
a deeper understanding of the nushell startup process when used with `nu
-n --no-std-lib --log-level trace`.

# 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 std testing; testing run-tests --path
crates/nu-std"` 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.
-->
2024-03-28 11:27:12 -05:00
Darren Schroeder
968926a327
keep sqlparser at 39 until polars is upgraded (#12311)
# Description

This PR reverts sqlparser to 0.39.0. It should stay here until we can
get polars updated so that we don't have to have two versions of
sqlparser.

# 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 std testing; testing run-tests --path
crates/nu-std"` 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.
-->
2024-03-27 19:26:49 -05:00
Stefan Holderbach
e5a52aad9d
Fix #10131 (#12310)
Pull in the changes from nushell/reedline#777
2024-03-27 22:25:21 +01:00
Stefan Holderbach
dfbbacfdf8
Deduplicate nix dependency versions (#12307)
# Description
Now we only use `nix 0.28.0`

Achieved by
- updating `ctrlc` to `3.4.4`
- updating `wl-clipboard-rs` to `0.8.1`
- update our own dependency on `nix` from `0.27` to `0.28`
  - required fixing uses of `nix::unistd::{tcgetpgrp,tcsetpgrp}`
  - now requires an I/O safe file descriptor
  - fake one pointing to `libc::STDIN_FILENO` (we were only accessing
`0` previously, dito for fish)


# User-Facing Changes
Better compile times and less to download as source dependencies
2024-03-27 16:43:37 +01:00
dependabot[bot]
03b5e9d853
Bump sqlparser from 0.43.1 to 0.44.0 (#12302)
Bumps [sqlparser](https://github.com/sqlparser-rs/sqlparser-rs) from
0.43.1 to 0.44.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/sqlparser-rs/sqlparser-rs/blob/main/CHANGELOG.md">sqlparser's
changelog</a>.</em></p>
<blockquote>
<h2>[0.44.0] 2024-03-02</h2>
<h3>Added</h3>
<ul>
<li>Support EXPLAIN / DESCR / DESCRIBE [FORMATTED | EXTENDED] (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1156">#1156</a>)
- Thanks <a
href="https://github.com/jonathanlehtoalamb"><code>@​jonathanlehtoalamb</code></a></li>
<li>Support ALTER TABLE ... SET LOCATION (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1154">#1154</a>)
- Thanks <a
href="https://github.com/jonathanlehto"><code>@​jonathanlehto</code></a></li>
<li>Support <code>ROW FORMAT DELIMITED</code> in Hive (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1155">#1155</a>)
- Thanks <a
href="https://github.com/jonathanlehto"><code>@​jonathanlehto</code></a></li>
<li>Support <code>SERDEPROPERTIES</code> for <code>CREATE TABLE</code>
with Hive (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1152">#1152</a>)
- Thanks <a
href="https://github.com/jonathanlehto"><code>@​jonathanlehto</code></a></li>
<li>Support <code>EXECUTE ... USING</code> for Postgres (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1153">#1153</a>)
- Thanks <a
href="https://github.com/jonathanlehto"><code>@​jonathanlehto</code></a></li>
<li>Support Postgres style <code>CREATE FUNCTION</code> in
GenericDialect (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1159">#1159</a>)
- Thanks <a
href="https://github.com/alamb"><code>@​alamb</code></a></li>
<li>Support <code>SET TBLPROPERTIES</code> (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1151">#1151</a>)
- Thanks <a
href="https://github.com/jonathanlehto"><code>@​jonathanlehto</code></a></li>
<li>Support <code>UNLOAD</code> statement (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1150">#1150</a>)
- Thanks <a
href="https://github.com/jonathanlehto"><code>@​jonathanlehto</code></a></li>
<li>Support <code>MATERIALIZED CTEs</code> (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1148">#1148</a>)
- Thanks <a
href="https://github.com/ReppCodes"><code>@​ReppCodes</code></a></li>
<li>Support <code>DECLARE</code> syntax for snowflake and bigquery (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1122">#1122</a>)
- Thanks <a
href="https://github.com/iffyio"><code>@​iffyio</code></a></li>
<li>Support <code>SELECT AS VALUE</code> and <code>SELECT AS
STRUCT</code> for BigQuery (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1135">#1135</a>)
- Thanks <a
href="https://github.com/lustefaniak"><code>@​lustefaniak</code></a></li>
<li>Support <code>(+)</code> outer join syntax (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1145">#1145</a>)
- Thanks <a
href="https://github.com/jmhain"><code>@​jmhain</code></a></li>
<li>Support <code>INSERT INTO ... SELECT ... RETURNING</code>(<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1132">#1132</a>)
- Thanks <a
href="https://github.com/lovasoa"><code>@​lovasoa</code></a></li>
<li>Support DuckDB <code>INSTALL</code> and <code>LOAD</code> (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1127">#1127</a>)
- Thanks <a
href="https://github.com/universalmind303"><code>@​universalmind303</code></a></li>
<li>Support <code>=</code> operator in function args (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1128">#1128</a>)
- Thanks <a
href="https://github.com/universalmind303"><code>@​universalmind303</code></a></li>
<li>Support <code>CREATE VIEW IF NOT EXISTS</code> (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1118">#1118</a>)
- Thanks <a href="https://github.com/7phs"><code>@​7phs</code></a></li>
<li>Support <code>UPDATE FROM</code> for SQLite (further to <a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/694">#694</a>)
(<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1117">#1117</a>)
- Thanks <a
href="https://github.com/ggaughan"><code>@​ggaughan</code></a></li>
<li>Support optional <code>DELETE FROM</code> statement (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1120">#1120</a>)
- Thanks <a
href="https://github.com/iffyio"><code>@​iffyio</code></a></li>
<li>Support MySQL <code>SHOW STATUS</code> statement (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1119">#1119</a>)
- Thanks invm</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Clean up nightly clippy lints (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1158">#1158</a>)
- Thanks <a
href="https://github.com/alamb"><code>@​alamb</code></a></li>
<li>Handle escape, unicode, and hex in
tokenize_escaped_single_quoted_string (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1146">#1146</a>)
- Thanks <a
href="https://github.com/JasonLi-cn"><code>@​JasonLi-cn</code></a></li>
<li>Fix panic while parsing <code>REPLACE</code> (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1140">#1140</a>)
- THanks <a
href="https://github.com/jjbayer"><code>@​jjbayer</code></a></li>
<li>Fix clippy warning from rust 1.76 (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1130">#1130</a>)
- Thanks <a
href="https://github.com/alamb"><code>@​alamb</code></a></li>
<li>Fix release instructions (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1115">#1115</a>)
- Thanks <a
href="https://github.com/alamb"><code>@​alamb</code></a></li>
</ul>
<h3>Changed</h3>
<ul>
<li>Add <code>parse_keyword_with_tokens</code> for paring keyword and
tokens combination (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1141">#1141</a>)
- Thanks <a
href="https://github.com/viirya"><code>@​viirya</code></a></li>
<li>Add ParadeDB to list of known users (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1142">#1142</a>)
- Thanks <a
href="https://github.com/philippemnoel"><code>@​philippemnoel</code></a></li>
<li>Accept JSON_TABLE both as an unquoted table name and a table-valued
function (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1134">#1134</a>)
- Thanks <a
href="https://github.com/lovasoa"><code>@​lovasoa</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="5da66adda9"><code>5da66ad</code></a>
chore: Release sqlparser version 0.44.0</li>
<li><a
href="1af1a6e87a"><code>1af1a6e</code></a>
Version 0.44.0 CHANGELOG (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1161">#1161</a>)</li>
<li><a
href="ef4668075b"><code>ef46680</code></a>
Support <code>EXPLAIN</code> / <code>DESCR</code> /
<code>DESCRIBE</code> <code>[FORMATTED | EXTENDED]</code> (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1156">#1156</a>)</li>
<li><a
href="991dbab755"><code>991dbab</code></a>
Support <code>ALTER TABLE ... SET LOCATION</code> (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1154">#1154</a>)</li>
<li><a
href="6f090e5547"><code>6f090e5</code></a>
adding delimited (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1155">#1155</a>)</li>
<li><a
href="fb7d4d40cc"><code>fb7d4d4</code></a>
Support <code>serdeproperties</code> for CREATE TABLE with HIVE (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1152">#1152</a>)</li>
<li><a
href="68b52a4ad6"><code>68b52a4</code></a>
Support <code>EXECUTE ... USING</code> for Postgres (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1153">#1153</a>)</li>
<li><a
href="9db9d22480"><code>9db9d22</code></a>
Support postgres style <code>CREATE FUNCTION</code> in
<code>GenericDialect</code> (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1159">#1159</a>)</li>
<li><a
href="a511c47bd0"><code>a511c47</code></a>
set_tblproperties (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1151">#1151</a>)</li>
<li><a
href="10cc54e10e"><code>10cc54e</code></a>
Clean up nightly clippy lints (<a
href="https://redirect.github.com/sqlparser-rs/sqlparser-rs/issues/1158">#1158</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/sqlparser-rs/sqlparser-rs/compare/v0.43.1...v0.44.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=sqlparser&package-manager=cargo&previous-version=0.43.1&new-version=0.44.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-27 14:44:43 +08:00
dependabot[bot]
6542f23ad1
Bump ical from 0.10.0 to 0.11.0 (#12303)
Bumps [ical](https://github.com/Peltoche/ical-rs) from 0.10.0 to 0.11.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/Peltoche/ical-rs/releases">ical's
releases</a>.</em></p>
<blockquote>
<h2>v0.11.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Update the version inside the readme by <a
href="https://github.com/Peltoche"><code>@​Peltoche</code></a> in <a
href="https://redirect.github.com/Peltoche/ical-rs/pull/58">Peltoche/ical-rs#58</a></li>
<li>Fix <a
href="https://redirect.github.com/Peltoche/ical-rs/issues/62">#62</a> by
<a href="https://github.com/ddnomad"><code>@​ddnomad</code></a> in <a
href="https://redirect.github.com/Peltoche/ical-rs/pull/63">Peltoche/ical-rs#63</a></li>
<li>replaced split_line with a multibyte aware version by <a
href="https://github.com/ronnybremer"><code>@​ronnybremer</code></a> in
<a
href="https://redirect.github.com/Peltoche/ical-rs/pull/61">Peltoche/ical-rs#61</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/ddnomad"><code>@​ddnomad</code></a> made
their first contribution in <a
href="https://redirect.github.com/Peltoche/ical-rs/pull/63">Peltoche/ical-rs#63</a></li>
<li><a
href="https://github.com/ronnybremer"><code>@​ronnybremer</code></a>
made their first contribution in <a
href="https://redirect.github.com/Peltoche/ical-rs/pull/61">Peltoche/ical-rs#61</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/Peltoche/ical-rs/compare/v0.10.0...v0.11.0">https://github.com/Peltoche/ical-rs/compare/v0.10.0...v0.11.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c2f6bb3be9"><code>c2f6bb3</code></a>
chore: Release ical version 0.11.0</li>
<li><a
href="e435769c7b"><code>e435769</code></a>
final fix to test for new split_line</li>
<li><a
href="1db49580e1"><code>1db4958</code></a>
fixed incorrect test for new split_line</li>
<li><a
href="248227b08d"><code>248227b</code></a>
added test case with multibyte characters for split_line</li>
<li><a
href="ba696e5c02"><code>ba696e5</code></a>
take 75 chars of the first line and 74 chars of subsequent lines</li>
<li><a
href="28ffa72bb1"><code>28ffa72</code></a>
replaced split_line with a multibyte aware version</li>
<li><a
href="a10a15d571"><code>a10a15d</code></a>
Fix <a
href="https://redirect.github.com/Peltoche/ical-rs/issues/62">#62</a></li>
<li><a
href="7f93147560"><code>7f93147</code></a>
Update the version inside the readme</li>
<li>See full diff in <a
href="https://github.com/Peltoche/ical-rs/compare/v0.10.0...v0.11.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ical&package-manager=cargo&previous-version=0.10.0&new-version=0.11.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-27 14:44:33 +08:00
dependabot[bot]
39ca734873
Bump rayon from 1.9.0 to 1.10.0 (#12301)
Bumps [rayon](https://github.com/rayon-rs/rayon) from 1.9.0 to 1.10.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/rayon-rs/rayon/blob/main/RELEASES.md">rayon's
changelog</a>.</em></p>
<blockquote>
<h1>Release rayon 1.10.0 (2024-03-23)</h1>
<ul>
<li>The new methods <code>ParallelSlice::par_chunk_by</code> and
<code>ParallelSliceMut::par_chunk_by_mut</code> work like the slice
methods <code>chunk_by</code>
and <code>chunk_by_mut</code> added in Rust 1.77.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="4a6e9bf6f3"><code>4a6e9bf</code></a>
Merge <a
href="https://redirect.github.com/rayon-rs/rayon/issues/991">#991</a></li>
<li><a
href="b0008f31b1"><code>b0008f3</code></a>
Release rayon 1.6.0 / rayon-core 1.10.0</li>
<li><a
href="c2dfa5c868"><code>c2dfa5c</code></a>
Merge <a
href="https://redirect.github.com/rayon-rs/rayon/issues/990">#990</a></li>
<li><a
href="17f5b08bb3"><code>17f5b08</code></a>
fix typo</li>
<li><a
href="ca9b279d83"><code>ca9b279</code></a>
Merge <a
href="https://redirect.github.com/rayon-rs/rayon/issues/989">#989</a></li>
<li><a
href="a119f2323a"><code>a119f23</code></a>
Unify <code>chunks</code>, <code>fold_chunks</code>, and
<code>fold_chunks_with</code></li>
<li><a
href="911d6d098c"><code>911d6d0</code></a>
Merge <a
href="https://redirect.github.com/rayon-rs/rayon/issues/492">#492</a></li>
<li><a
href="9ef85cd5d8"><code>9ef85cd</code></a>
Add some documentation about <em>when</em> broadcasts run</li>
<li><a
href="bd7b61ca8b"><code>bd7b61c</code></a>
Add more internal enforcement of static/scope lifetimes</li>
<li><a
href="812ca025ae"><code>812ca02</code></a>
Simplify calls that use the panic_handler</li>
<li>Additional commits viewable in <a
href="https://github.com/rayon-rs/rayon/compare/rayon-core-v1.9.0...rayon-core-v1.10.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rayon&package-manager=cargo&previous-version=1.9.0&new-version=1.10.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-27 14:44:17 +08:00
Wind
a15462fd00
Change default algorithm in detect columns (#12277)
# Description
@fdncred found another histogram based algorithm to detect columns, and
rewrite it in rust: https://github.com/fdncred/guess-width

I have tested it manually, and it works good with `df`, `docker ps`,
`^ps`. This pr is going to use the algorithm in `detect columns`

Fix: #4183

The pitfall of new algorithm:
1. it may not works well if there isn't too much rows of input
2. it may not works well if the length of value is less than the header
to value, e.g:
```
c1 c2 c3 c4 c5
a b c d e
g h i j k
g a a q d
a v c q q | detect columns
```
In this case, users might need to use ~~`--old`~~ `--legacy` to make it
works well.

# User-Facing Changes
User might need to add ~~`--old`~~ `--legacy` to scripts if they find
`detect columns` in their scripts broken.

# Tests + Formatting
Done

# After Submitting
NaN
2024-03-26 13:57:55 +08:00
Devyn Cairns
2ae4408ced
Add example tests (nu-plugin-test-support) for plugins in repo (#12281)
# Description

Uses the new `nu-plugin-test-support` crate to test the examples of
commands provided by plugins in the repo.

Also fixed some of the examples to pass.

# User-Facing Changes

- Examples that are more guaranteed to work

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`
2024-03-25 21:20:35 -05:00
Devyn Cairns
efe1c99a3b
Fix #12280: replace difference crate with similar (#12282)
Fixes #12280.

# Description

This removes the dependency on the `difference` crate, which is
unmaintained, for `nu-plugin-test-support`. The `similar` crate
(Apache-2.0) is used instead, which is a bit larger and more complex,
but still suitable for a dev dep for tests. Also switched to use
`crossterm` for colors, since `similar` doesn't come with any terminal
pretty printing functionality.

# User-Facing Changes

None - output should be identical.

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`
2024-03-25 21:13:12 -05:00
David Matos
838fc7e098
Initial implementation for uutils uname (#11684)
Hi,
This PR aims at implementing the first iteration for `uname` using
`uutils`. Couple of things:
* Currently my [PR](https://github.com/uutils/coreutils/pull/5921) to
make the required changes is pending in `uutils` repo.
* I guess the number of flags has to be investigated. Still the tests
cover all of them.


<!--
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.
-->

# 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:

- [X] `cargo fmt --all -- --check` to check standard code formatting
(`cargo fmt --all` applies these changes)
- [X] `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used`
to check that you're using the standard code style
- [X] `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))
- [X] `cargo run -- -c "use std testing; testing run-tests --path
crates/nu-std"` 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>
2024-03-25 16:51:50 -05:00
Antoine Büsch
4ddc35cdad
Move more dependencies to workspace level (#12270)
# Description
This is a followup to #12043 that moves more dependency versions to
workspace dependencies.

# User-Facing Changes
N/A

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`
2024-03-23 18:46:02 -05:00
Devyn Cairns
78be67f0c6
Support for getting help text from a plugin command (#12243)
# Description
There wasn't really a good way to implement a command group style (e.g.
`from`, `query`, etc.) command in the past that just returns the help
text even if `--help` is not passed. This adds a new engine call that
just does that.

This is actually something I ran into before when developing the dbus
plugin, so it's nice to fix it.

# User-Facing Changes


# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting
- [ ] Document `GetHelp` engine call in proto
2024-03-24 07:30:38 +08:00
Devyn Cairns
c79c43d2f8
Add test support crate for plugin developers (#12259)
# Description

Adds a `nu-plugin-test-support` crate with an interface that supports
testing plugins.

Unlike in reality, these plugins run in the same process on separate
threads. This will allow
testing aspects of the plugin internal state and handling serialized
plugin custom values easily.
We still serialize their custom values and all of the engine to plugin
logic is still in play, so
from a logical perspective this should still expose any bugs that would
have been caused by that.
The only difference is that it doesn't run in a different process, and
doesn't try to serialize
everything to the final wire format for stdin/stdout.

TODO still:

- [x] Clean up warnings about private types exposed in trait definition
- [x] Automatically deserialize plugin custom values in the result so
they can be inspected
- [x] Automatic plugin examples test function
- [x] Write a bit more documentation
- [x] More tests
- [x] Add MIT License file to new crate

# User-Facing Changes

Plugin developers get a nice way to test their plugins.

# Tests + Formatting
Run the tests with `cargo test -p nu-plugin-test-support --
--show-output` to see some examples of what the failing test output for
examples can look like. I used the `difference` crate (MIT licensed) to
make it look nice.

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

# After Submitting

- [ ] Add a section to the book about testing
- [ ] Test some of the example plugins this way
- [ ] Add example tests to nu_plugin_template so plugin developers have
something to start with
2024-03-23 13:29:54 -05:00
Maxim Zhiburt
cc8f2b6419
nu-explore/ Use hex-dump for binary data (#12184)
Hi there

So as 2 minute thing we could show `hex-dump` as it is as a string
(no-coloring).

But I'd do some more things around,.
Probably will take a few days (WIP).

```
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

─────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────
  00000000:   6d 6f 64 20  63 6f 6d 6d  61 6e 64 3b  0a 6d 6f 64   mod command;_mod  │
  00000010:   20 63 6f 6e  66 69 67 5f  66 69 6c 65  73 3b 0a 6d    config_files;_m  │
  00000020:   6f 64 20 69  64 65 3b 0a  6d 6f 64 20  6c 6f 67 67   od ide;_mod logg  │
  00000030:   65 72 3b 0a  6d 6f 64 20  72 75 6e 3b  0a 6d 6f 64   er;_mod run;_mod  │
  00000040:   20 73 69 67  6e 61 6c 73  3b 0a 23 5b  63 66 67 28    signals;_#[cfg(  │
  00000050:   75 6e 69 78  29 5d 0a 6d  6f 64 20 74  65 72 6d 69   unix)]_mod termi  │
  00000060:   6e 61 6c 3b  0a 6d 6f 64  20 74 65 73  74 5f 62 69   nal;_mod test_bi  │
  00000070:   6e 73 3b 0a  23 5b 63 66  67 28 74 65  73 74 29 5d   ns;_#[cfg(test)]  │
  00000080:   0a 6d 6f 64  20 74 65 73  74 73 3b 0a  0a 23 5b 63   _mod tests;__#[c  │
  00000090:   66 67 28 66  65 61 74 75  72 65 20 3d  20 22 6d 69   fg(feature = "mi  │
  000000a0:   6d 61 6c 6c  6f 63 22 29  5d 0a 23 5b  67 6c 6f 62   malloc")]_#[glob  │
  000000b0:   61 6c 5f 61  6c 6c 6f 63  61 74 6f 72  5d 0a 73 74   al_allocator]_st  │
  000000c0:   61 74 69 63  20 47 4c 4f  42 41 4c 3a  20 6d 69 6d   atic GLOBAL: mim  │
  000000d0:   61 6c 6c 6f  63 3a 3a 4d  69 4d 61 6c  6c 6f 63 20   alloc::MiMalloc   │
  000000e0:   3d 20 6d 69  6d 61 6c 6c  6f 63 3a 3a  4d 69 4d 61   = mimalloc::MiMa  │
  000000f0:   6c 6c 6f 63  3b 0a 0a 75  73 65 20 63  72 61 74 65   lloc;__use crate  │
  00000100:   3a 3a 7b 0a  20 20 20 20  63 6f 6d 6d  61 6e 64 3a   ::{_    command:  │
  00000110:   3a 70 61 72  73 65 5f 63  6f 6d 6d 61  6e 64 6c 69   :parse_commandli  │
  00000120:   6e 65 5f 61  72 67 73 2c  0a 20 20 20  20 63 6f 6e   ne_args,_    con  │
  00000130:   66 69 67 5f  66 69 6c 65  73 3a 3a 73  65 74 5f 63   fig_files::set_c  │
  00000140:   6f 6e 66 69  67 5f 70 61  74 68 2c 0a  20 20 20 20   onfig_path,_      │
  00000150:   6c 6f 67 67  65 72 3a 3a  7b 63 6f 6e  66 69 67 75   logger::{configu  │
  00000160:   72 65 2c 20  6c 6f 67 67  65 72 7d 2c  0a 7d 3b 0a   re, logger},_};_  │
  00000170:   75 73 65 20  63 6f 6d 6d  61 6e 64 3a  3a 67 61 74   use command::gat  │
  00000180:   68 65 72 5f  63 6f 6d 6d  61 6e 64 6c  69 6e 65 5f   her_commandline_  │
  00000190:   61 72 67 73  3b 0a 75 73  65 20 6c 6f  67 3a 3a 4c   args;_use log::L  │
  000001a0:   65 76 65 6c  3b 0a 75 73  65 20 6d 69  65 74 74 65   evel;_use miette  │
  000001b0:   3a 3a 52 65  73 75 6c 74  3b 0a 75 73  65 20 6e 75   ::Result;_use nu  │
  000001c0:   5f 63 6c 69  3a 3a 67 61  74 68 65 72  5f 70 61 72   _cli::gather_par  │

```

ref: #12157
cc: @fdncred @lrdickson
2024-03-21 19:02:03 -05:00
dependabot[bot]
6e2c41a5b5
Bump base64 from 0.21.7 to 0.22.0 (#12188)
Bumps [base64](https://github.com/marshallpierce/rust-base64) from
0.21.7 to 0.22.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md">base64's
changelog</a>.</em></p>
<blockquote>
<h1>0.22.0</h1>
<ul>
<li><code>DecodeSliceError::OutputSliceTooSmall</code> is now
conservative rather than precise. That is, the error will only occur if
the decoded output <em>cannot</em> fit, meaning that
<code>Engine::decode_slice</code> can now be used with exactly-sized
output slices. As part of this, <code>Engine::internal_decode</code> now
returns <code>DecodeSliceError</code> instead of
<code>DecodeError</code>, but that is not expected to affect any
external callers.</li>
<li><code>DecodeError::InvalidLength</code> now refers specifically to
the <em>number of valid symbols</em> being invalid (i.e. <code>len % 4
== 1</code>), rather than just the number of input bytes. This avoids
confusing scenarios when based on interpretation you could make a case
for either <code>InvalidLength</code> or <code>InvalidByte</code> being
appropriate.</li>
<li>Decoding is somewhat faster (5-10%)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="5d70ba7576"><code>5d70ba7</code></a>
Merge pull request <a
href="https://redirect.github.com/marshallpierce/rust-base64/issues/269">#269</a>
from marshallpierce/mp/decode-precisely</li>
<li><a
href="efb6c006c7"><code>efb6c00</code></a>
Release notes</li>
<li><a
href="2b91084a31"><code>2b91084</code></a>
Add some tests to boost coverage</li>
<li><a
href="9e9c7abe65"><code>9e9c7ab</code></a>
Engine::internal_decode now returns DecodeSliceError</li>
<li><a
href="a8a60f43c5"><code>a8a60f4</code></a>
Decode main loop improvements</li>
<li><a
href="a25be0667c"><code>a25be06</code></a>
Simplify leftover output writes</li>
<li><a
href="9979cc33bb"><code>9979cc3</code></a>
Keep morsels as separate bytes</li>
<li><a
href="37670c5ec2"><code>37670c5</code></a>
Bump dev toolchain version (<a
href="https://redirect.github.com/marshallpierce/rust-base64/issues/268">#268</a>)</li>
<li>See full diff in <a
href="https://github.com/marshallpierce/rust-base64/compare/v0.21.7...v0.22.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=base64&package-manager=cargo&previous-version=0.21.7&new-version=0.22.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-21 21:17:36 +02:00
dependabot[bot]
bf799ac3ba
Bump heck from 0.4.1 to 0.5.0 (#12187)
Bumps [heck](https://github.com/withoutboats/heck) from 0.4.1 to 0.5.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/withoutboats/heck/blob/master/CHANGELOG.md">heck's
changelog</a>.</em></p>
<blockquote>
<h1>0.5.0</h1>
<ul>
<li>Add <code>no_std</code> support.</li>
<li>Remove non-additive <code>unicode</code> feature. The library now
uses <code>char::is_alphanumeric</code>
instead of the <code>unicode-segmentation</code> library to determine
word boundaries in all cases.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/withoutboats/heck/commits">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=heck&package-manager=cargo&previous-version=0.4.1&new-version=0.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-21 21:17:30 +02:00
dannou812
8237d15683
to json -r not removing whitespaces fix (#11948)
fixes #11900  

# Description
Use `serde_json` instead.

# User-Facing Changes
The problem described in the issue now no longer persists.

No whitespace in the output of `to json --raw`
Output of unicode escape changed to consistent `\uffff`

# Tests + Formatting
I corrected all Tests that were affected by this change.
2024-03-20 22:14:31 +01:00
dependabot[bot]
b267a9c1ba
Bump uuid from 1.7.0 to 1.8.0 (#12246)
Bumps [uuid](https://github.com/uuid-rs/uuid) from 1.7.0 to 1.8.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/uuid-rs/uuid/releases">uuid's
releases</a>.</em></p>
<blockquote>
<h2>1.8.0</h2>
<h2>⚠️ Potential Breakage ⚠️</h2>
<p>A new <code>impl AsRef&lt;Uuid&gt; for Uuid</code> bound has been
added, which can break inference on code like:</p>
<pre lang="rust"><code>let b = uuid.as_ref();
</code></pre>
<p>You can fix these by explicitly typing the result of the
conversion:</p>
<pre lang="rust"><code>let b: &amp;[u8] = uuid.as_ref();
</code></pre>
<p>or by calling <code>as_bytes</code> instead:</p>
<pre lang="rust"><code>let b = uuid.as_bytes();
</code></pre>
<h2>What's Changed</h2>
<ul>
<li>docs: fix small spelling mistake by <a
href="https://github.com/bengsparks"><code>@​bengsparks</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/737">uuid-rs/uuid#737</a></li>
<li>serde serialize_with support by <a
href="https://github.com/dakaizou"><code>@​dakaizou</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/735">uuid-rs/uuid#735</a></li>
<li>Fix up CI builds by <a
href="https://github.com/KodrAus"><code>@​KodrAus</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/744">uuid-rs/uuid#744</a></li>
<li>Only add <code>wasm-bindgen</code> as a dependency on
<code>wasm32-unknown-unknown</code> by <a
href="https://github.com/emilk"><code>@​emilk</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/738">uuid-rs/uuid#738</a></li>
<li>impl AsRef<!-- raw HTML omitted --> for Uuid by <a
href="https://github.com/koshell"><code>@​koshell</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/743">uuid-rs/uuid#743</a></li>
<li>Add v6 to v8 draft link to README by <a
href="https://github.com/KodrAus"><code>@​KodrAus</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/746">uuid-rs/uuid#746</a></li>
<li>Add a workflow for running cargo outdated by <a
href="https://github.com/KodrAus"><code>@​KodrAus</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/745">uuid-rs/uuid#745</a></li>
<li>Prepare for 1.8.0 release by <a
href="https://github.com/KodrAus"><code>@​KodrAus</code></a> in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/747">uuid-rs/uuid#747</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/bengsparks"><code>@​bengsparks</code></a> made
their first contribution in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/737">uuid-rs/uuid#737</a></li>
<li><a href="https://github.com/dakaizou"><code>@​dakaizou</code></a>
made their first contribution in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/735">uuid-rs/uuid#735</a></li>
<li><a href="https://github.com/emilk"><code>@​emilk</code></a> made
their first contribution in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/738">uuid-rs/uuid#738</a></li>
<li><a href="https://github.com/koshell"><code>@​koshell</code></a> made
their first contribution in <a
href="https://redirect.github.com/uuid-rs/uuid/pull/743">uuid-rs/uuid#743</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/uuid-rs/uuid/compare/1.7.0...1.8.0">https://github.com/uuid-rs/uuid/compare/1.7.0...1.8.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="0f2aaaeab9"><code>0f2aaae</code></a>
Merge pull request <a
href="https://redirect.github.com/uuid-rs/uuid/issues/747">#747</a> from
uuid-rs/cargo/1.8.0</li>
<li><a
href="01d16c32ba"><code>01d16c3</code></a>
prepare for 1.8.0 release</li>
<li><a
href="e4746bcbd5"><code>e4746bc</code></a>
Merge pull request <a
href="https://redirect.github.com/uuid-rs/uuid/issues/745">#745</a> from
uuid-rs/ci/outdated</li>
<li><a
href="d0396ad254"><code>d0396ad</code></a>
Merge pull request <a
href="https://redirect.github.com/uuid-rs/uuid/issues/746">#746</a> from
uuid-rs/chore/draft-link</li>
<li><a
href="9415ed4017"><code>9415ed4</code></a>
Merge pull request <a
href="https://redirect.github.com/uuid-rs/uuid/issues/743">#743</a> from
koshell/main</li>
<li><a
href="951e8e325e"><code>951e8e3</code></a>
Merge pull request <a
href="https://redirect.github.com/uuid-rs/uuid/issues/738">#738</a> from
rerun-io/emilk/wasm-bindgen-only-on-web</li>
<li><a
href="101aa84c43"><code>101aa84</code></a>
add v6 to v8 draft link to README</li>
<li><a
href="84dcbba1bd"><code>84dcbba</code></a>
run outdated on a schedule</li>
<li><a
href="ca952b14a8"><code>ca952b1</code></a>
add a workflow for running cargo outdated</li>
<li><a
href="abe995a258"><code>abe995a</code></a>
Make the toml longer, more complicated, and functional</li>
<li>Additional commits viewable in <a
href="https://github.com/uuid-rs/uuid/compare/1.7.0...1.8.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=uuid&package-manager=cargo&previous-version=1.7.0&new-version=1.8.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-20 09:45:18 +08:00
Devyn Cairns
a29efe28f7
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
2024-03-19 12:36:46 -05:00
Tastaturtaste
c7e0d4b1e5
Use the system clipboard only for explicit copy/paste operations. Addresses issue 11907 (#12179)
<!--
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.
-->
With the introduction of the system clipboard to nushell, many commands
changed their behavior from using a local cut buffer to the system
clipboard, perhaps surprisingly for many users. (See #11907)
This PR changes most of them back to using the local cut buffer and
introduces three commands (`CutSelectionSystem`, `CopySelectionSystem`
and `PasteSystem`) to explicitly use the system clipboard.


# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
Users who in the meantime already used the system clipboard now default
back to the local clipboard. To be able to use the system clipboard
again they have to append the suffix `system` to their current edit
command specified in their keybindings.

# 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 std testing; testing run-tests --path
crates/nu-std"` 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
> ```
-->
The commands themselves are tested in `reedline`. The changes introduces
in nushell are minimal and simply forward from a match on the keybinding
name to the command.
# 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>
2024-03-15 08:59:21 -05:00
sarubo
687fbc49c8
Adjust permissions using umask in mkdir (#12207)
<!--
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.
-->

With this change, `mkdir` mirrors coreutils works. Closes #12161

I referred to the implementation of `mkdir` in uutils/coreutils. I add
`uucore` required for implementation to dependencies. Since `uucore` is
already included in dependencies of `uu_mkdir`, I don't think there will
be any additional dependencies.

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

- Directories are created according to `umask` except for Windows.

# 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 std testing; testing run-tests --path
crates/nu-std"` 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
> ```
-->

I add `mkdir` test considering permissions. The test assumes that the
default `umask` is `022`.

# 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.
-->
2024-03-14 16:43:42 -05:00
Stefan Holderbach
d3f22588f0
Disable fmt feature of polars(-core) (#12151)
In normal operations we don't display the dataframes directly.
The `fmt` feature on `polars-core` pulls in the `comfy-table` crate with
its own dependencies on `crossterm` and `strum(_macros)`.
This has the chance to duplicate dependencies. (currently strum version
divergence)

Without this feature only the shapes should be displayed.

May degrade the error output during testing.
2024-03-13 19:42:31 +01:00
dependabot[bot]
8725bd3112
Bump rayon from 1.8.1 to 1.9.0 (#12186)
Bumps [rayon](https://github.com/rayon-rs/rayon) from 1.8.1 to 1.9.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/rayon-rs/rayon/blob/main/RELEASES.md">rayon's
changelog</a>.</em></p>
<blockquote>
<h1>Release rayon 1.9.0 (2024-02-27)</h1>
<ul>
<li>The new methods
<code>IndexedParallelIterator::by_exponential_blocks</code> and
<code>by_uniform_blocks</code> allow processing items in smaller groups
at a time.</li>
<li>The new <code>iter::walk_tree</code>, <code>walk_tree_prefix</code>,
and <code>walk_tree_postfix</code>
functions enable custom parallel iteration over tree-like
structures.</li>
<li>The new method <code>ParallelIterator::collect_vec_list</code>
returns items as a linked
list of vectors, which is an efficient mode of parallel collection used
by
many of the internal implementations of <code>collect</code>.</li>
<li>The new methods
<code>ParallelSliceMut::par_split_inclusive_mut</code>,
<code>ParallelSlice::par_split_inclusive</code>, and
<code>ParallelString::par_split_inclusive</code> all work like a normal
split but
keeping the separator as part of the left slice.</li>
<li>The new <code>ParallelString::par_split_ascii_whitespace</code>
splits only on ASCII
whitespace, which is faster than including Unicode multi-byte
whitespace.</li>
<li><code>OsString</code> now implements
<code>FromParallelIterator&lt;_&gt;</code> and
<code>ParallelExtend&lt;_&gt;</code>
for a few item types similar to the standard <code>FromIterator</code>
and <code>Extend</code>.</li>
<li>The internal <code>Pattern</code> trait for string methods is now
implemented for
<code>[char; N]</code> and <code>&amp;[char; N]</code>, matching any of
the given characters.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="dc13cb7875"><code>dc13cb7</code></a>
Merge <a
href="https://redirect.github.com/rayon-rs/rayon/issues/810">#810</a></li>
<li><a
href="67eeea6f2a"><code>67eeea6</code></a>
Release rayon 1.5.0 / rayon-core 1.9.0</li>
<li><a
href="4828f30eef"><code>4828f30</code></a>
Merge <a
href="https://redirect.github.com/rayon-rs/rayon/issues/808">#808</a></li>
<li><a
href="eeb0d1ad5e"><code>eeb0d1a</code></a>
update ci/compat-Cargo.lock</li>
<li><a
href="12f0d202b8"><code>12f0d20</code></a>
Update glium so that rayon-demo runs on Gnome Wayland</li>
<li><a
href="1f069d7710"><code>1f069d7</code></a>
Merge <a
href="https://redirect.github.com/rayon-rs/rayon/issues/807">#807</a></li>
<li><a
href="9691328a5a"><code>9691328</code></a>
Use Iterator::copied</li>
<li><a
href="e81835c074"><code>e81835c</code></a>
Update crossbeam dependencies (requires Rust 1.36)</li>
<li><a
href="5b3d917d6c"><code>5b3d917</code></a>
Merge <a
href="https://redirect.github.com/rayon-rs/rayon/issues/804">#804</a></li>
<li><a
href="5c55033950"><code>5c55033</code></a>
Release rayon 1.4.1</li>
<li>Additional commits viewable in <a
href="https://github.com/rayon-rs/rayon/compare/rayon-core-v1.8.1...rayon-core-v1.9.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rayon&package-manager=cargo&previous-version=1.8.1&new-version=1.9.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-13 09:36:09 +08:00
dependabot[bot]
32529433fb
Bump miette from 7.1.0 to 7.2.0 (#12189)
Bumps [miette](https://github.com/zkat/miette) from 7.1.0 to 7.2.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/zkat/miette/blob/main/CHANGELOG.md">miette's
changelog</a>.</em></p>
<blockquote>
<h2>7.2.0 (2024-03-07)</h2>
<h3>Features</h3>
<ul>
<li><strong>wasm:</strong> add feature &quot;fancy-no-syscall&quot; for
wasm targets (<a
href="https://redirect.github.com/zkat/miette/issues/349">#349</a>) (<a
href="328bf37922">328bf379</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>label-collections:</strong> Label collection fixes and
cleanup (<a
href="https://redirect.github.com/zkat/miette/issues/343">#343</a>) (<a
href="75fea0935e">75fea093</a>)</li>
<li><strong>invalid span:</strong> skip the snippet when read_span fails
(<a href="https://redirect.github.com/zkat/miette/issues/347">#347</a>)
(<a
href="7d9dfc6e8e">7d9dfc6e</a>)</li>
<li><strong>redundant-import:</strong> fix a warning and CI failure in
nightly (<a
href="https://redirect.github.com/zkat/miette/issues/348">#348</a>) (<a
href="6ea86a2248">6ea86a22</a>)</li>
</ul>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="ca646f3119"><code>ca646f3</code></a>
chore: Release</li>
<li><a
href="ff7baae70c"><code>ff7baae</code></a>
docs: update changelog</li>
<li><a
href="24a7bf4f4e"><code>24a7bf4</code></a>
ci(doc consistency): check that lib.rs and README.md are consistent (<a
href="https://redirect.github.com/zkat/miette/issues/353">#353</a>)</li>
<li><a
href="22b29eec38"><code>22b29ee</code></a>
docs: use <code>cargo readme</code> to update (<a
href="https://redirect.github.com/zkat/miette/issues/351">#351</a>)</li>
<li><a
href="62cfd221ba"><code>62cfd22</code></a>
docs: add <code>severity</code> example (<a
href="https://redirect.github.com/zkat/miette/issues/350">#350</a>)</li>
<li><a
href="328bf37922"><code>328bf37</code></a>
feat(wasm): add feature &quot;fancy-no-syscall&quot; for wasm targets
(<a
href="https://redirect.github.com/zkat/miette/issues/349">#349</a>)</li>
<li><a
href="6ea86a2248"><code>6ea86a2</code></a>
fix(redundant-import): fix a warning and CI failure in nightly (<a
href="https://redirect.github.com/zkat/miette/issues/348">#348</a>)</li>
<li><a
href="7d9dfc6e8e"><code>7d9dfc6</code></a>
fix(invalid span): skip the snippet when read_span fails (<a
href="https://redirect.github.com/zkat/miette/issues/347">#347</a>)</li>
<li><a
href="75fea0935e"><code>75fea09</code></a>
fix(label-collections): Label collection fixes and cleanup (<a
href="https://redirect.github.com/zkat/miette/issues/343">#343</a>)</li>
<li>See full diff in <a
href="https://github.com/zkat/miette/compare/miette-derive-v7.1.0...miette-derive-v7.2.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=miette&package-manager=cargo&previous-version=7.1.0&new-version=7.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-13 09:35:40 +08:00
Stefan Holderbach
bb265c5310
Bump arboard from 3.3.0 to 3.3.2 (#12178)
Reduces the system dependency footprint slightly
2024-03-12 23:10:11 +01:00
Stefan Holderbach
f3a4f10b46
Bump iana-time-zone due to yanked locked version (#12162)
`0.1.59` -> `0.1.60`

e.g. observed in
https://github.com/nushell/nushell/actions/runs/8238152611/job/22528639253#step:4:18
2024-03-11 21:37:34 +01:00
Yash Thakur
f6853fd636
Use XDG_CONFIG_HOME before default config directory (#12118)
<!--
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!
-->

Closes #12103

# 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.
-->

As described in #12103, this PR makes Nushell use `XDG_CONFIG_HOME` as
the config directory if it exists. Otherwise, it uses the old behavior,
which was to use `dirs_next::config_dir()`.

Edit: We discussed choosing between `XDG_CONFIG_HOME` and the default
config directory in Discord and decided against it, at least for now.

<s>@kubouch also suggested letting users choose between
`XDG_CONFIG_HOME` and the default config directory if config files
aren't found on startup and `XDG_CONFIG_HOME` is set to a value
different from the default config directory</s>

On Windows and MacOS, if the `XDG_CONFIG_HOME` variable is set but
`XDG_CONFIG_HOME` is either empty or doesn't exist *and* the old config
directory is non-empty, Nushell will issue a warning on startup saying
that it won't move files from the old config directory to the new one.
To do this, I had to add a `nu_path::config_dir_old()` function. I
assume that at some point, we will remove the warning message and the
function can be removed too. Alternatively, instead of having that
function there, `main.rs` could directly call `dirs_next::config_dir()`.

# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

When `$env.XDG_CONFIG_HOME` is set to an absolute path, Nushell will use
`$"($env.XDG_CONFIG_HOME)/nushell"` as its config directory (previously,
this only worked on Linux).

To use `App Data\Roaming` (Windows) or `Library/Application Support`
(MacOS) instead (the old behavior), one can either leave
`XDG_CONFIG_HOME` unset or set it to an empty string.

If `XDG_CONFIG_HOME` is set, but to a non-absolute/invalid path, Nushell
will report an error on startup and use the default config directory
instead:


![image](https://github.com/nushell/nushell/assets/45539777/a434fe04-b7c8-4e95-b50c-80628008ad08)

On Windows and MacOS, if the `XDG_CONFIG_HOME` variable is set but
`XDG_CONFIG_HOME` is either empty or doesn't exist *and* the old config
directory is non-empty, Nushell will issue a warning on startup saying
that it won't move files from the old config directory to the new one.


![image](https://github.com/nushell/nushell/assets/45539777/1686cc17-4083-4c12-aecf-1d832460ca57)


# 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 std testing; testing run-tests --path
crates/nu-std"` 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
> ```
-->

The existing config path tests have been modified to use
`XDG_CONFIG_HOME` to change the config directory on all OSes, not just
Linux.

# 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.
-->

The documentation will have to be updated to note that Nushell uses
`XDG_CONFIG_HOME` now. As @fdncred pointed out, it's possible for people
to set `XDG_CONFIG_HOME` to, say, `~/.config/nushell` rather than
`~/.config`, so the documentation could warn about that mistake.
2024-03-11 06:15:46 -05:00