related to a comment in https://github.com/nushell/nushell/pull/9500
> `cargo run -- crates/nu-std/tests/run.nu` Not done - doesn't seem to
work
this is absolutely true because the command in the PR template was
obsolete...
i've also updated the commands in the `CONTRIBUTING` document of the
library 👍
cc/ @fnordpig
# Description
Until we bump our minimal Rust version to `1.70.0` we can't use
`std::io::IsTerminal`. The crate `is-terminal` (depending on `rustix` or
`windows-sys`) can provide the same.
Get's rid of the dependency on the outdated `atty` crate.
We already transitively depend on it (e.g. through `miette`)
As soon as we reach the new Rust version we can supersede this with
@nibon7's #9550
Co-authored-by: nibon7 <nibon7@163.com>
# Description
Update `lru` to `0.11`: `cargo build` will now not need `hashbrown 0.13`
Update `dashmap`: upgrades `hashbrown` for dev-dependency
-1 dependency in the `cargo install` path
# Description
This PR adds `kind` and `state` to other `keybindings listen` presses
like `home` and `end` keys. Before they didn't exist.
```
❯ keybindings listen
Type any key combination to see key details. Press ESC to abort.
code: Enter, modifier: NONE, flags: 0b000000, kind: Release, state: NONE
code: Home, modifier: NONE, flags: 0b000000, kind: Press, state: NONE
code: Home, modifier: NONE, flags: 0b000000, kind: Release, state: NONE
code: End, modifier: NONE, flags: 0b000000, kind: Press, state: NONE
code: End, modifier: NONE, flags: 0b000000, kind: Release, state: NONE
code: End, modifier: CONTROL, flags: 0b000010, kind: Press, state: NONE
code: End, modifier: CONTROL, flags: 0b000010, kind: Release, state: NO
```
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
# Description
- A new one is the removal of unnecessary `#` in raw strings without `"`
inside.
-
https://rust-lang.github.io/rust-clippy/master/index.html#/needless_raw_string_hashes
- The automatically applied removal of `.into_iter()` touched several
places where #9648 will change to the use of the record API. If
necessary I can remove them @IanManske to avoid churn with this PR.
- Manually applied `.try_fold` in two places
- Removed a dead `if`
- Manual: Combat rightward-drift with early return
# Description
This extends the syntax fix for `let` (#9589) to `mut` as well.
Example: `mut x = "hello world" | str length; print $x`
closes#9634
# User-Facing Changes
`mut` now joins `let` in being able to be assigned from a pipeline
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
The following math commands are being moved to nu-cmd-extra
* cos
* cosh
* egamma
* phi
* pi
* sin
* sinh
* tan
* tanh
* tau
For now I think we have most of the obvious commands moved over based on
@sholderbach this should cover moving the "high school" commands..
>>Yeah I think this rough separation into "high school" math in extra
and "middle school"/"programmer" math in the core makes a ton of sense.
And to reference the @fdncred list from
https://github.com/nushell/nushell/pull/9647#issuecomment-1629498812
* arccos
* arccosh
* arcsin
* arcsinh
* arctan
* arctanh
The above commands are being ported over to nu-cmd-extra
I initially moved all of the math commands over but there are some
issues with the tests...
So we will move them over slowly --- and actually I kind of like this
idea better...
Because some of the math commands we might want to leave in the core
nushell...
Stay tuned...
For more details 👍
Read this document:
https://github.com/stormasm/nutmp/blob/main/commands/math.md
- See nushell/reedline#600
- updates to `strum 0.25` which uses the newer more widespread `syn 2.0`
- this deduplicates `syn` for a default build.
- Unlocks #9639
# Description
Apart from `polars` (only used with `--features dataframe`) and the
dev-dependencies our deps use `indexmap 2.0`.
Thus the default or `extra` `cargo build` will reduce deps.
This also will help deduplicating `hashbrown` and `ahash`.
For #8060
- Bump `indexmap` to 2.0
- Remove unneeded `serde` feature from `indexmap`
# User-Facing Changes
None
# Description
`tabled`/`papergrid` already use `ansi-str 0.8` while `nu-explore`
itself was still depending on `0.7`. Single fix necessary to adapt to
the new API.
cc @zhiburt
# User-Facing Changes
None
# Description
this PR is an attempt at making the main CI workflow a bit easier to
read, understand and work with 🤞
## changelog
- remove the deprecated `nu-coverage` job which was taking place for
nothing
- remove useless comments, i.e. comments that just say the same thing as
the line they comment, e.g. the previous `on.push` comment, and comments
that can be explained with a `git blame` inside an IDE, e.g. the comment
about removing `--profile ci` on the `cargo install` in the std job
- rename `nu-fmt-clippy` and `nu-tests` to `fmt-clippy` and `tests` as
we already know we are working with Nushell
- rename the "*style*" to "*feature*" which is exactly what `default`,
`dataframe` and `extra` are
- remove the `strategy.matrix.rust: stable` key: i couldn't find any
documentation for this and it's not used in the jobs => by default, the
toolchain of `actions-rust-lang/setup-rust-toolchain@v1.5.0` is the
stable one (see the
[documentation](https://github.com/actions-rust-lang/setup-rust-toolchain#inputs))
- add a top-level `env` block with all the environment variables, e.g.
`CLIPPY_OPTIONS`, to have them all in one place
hope you'll like that 😇🙏
# User-Facing Changes
# Tests + Formatting
this PR should not change the different jobs being run in PRs and on the
`main` branch.
# After Submitting
<!--
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.
-->
Max amount of threads used by the test runner can now be configured via
the `--threads` flag
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
# Description
follow up to #8529 and #8914
this works very similarly to record annotations, only difference being
that
```sh
table<name: string>
^^^^ ^^^^^^
| |
| represents the type of the items in that column
|
represents the column name
```
more info on the syntax can be found
[here](https://github.com/nushell/nushell/pull/8914#issue-1672113520)
# User-Facing Changes
**[BREAKING CHANGE]**
this change adds a field to `SyntaxShape::Table` so any plugins that
used it will have to update and include the field. though if you are
unsure of the type the table expects, `SyntaxShape::Table(vec![])` will
suffice
<!--
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.
-->
Test-runner performance improved by:
* Not loading user config or stdlib during ide parsing
* Not loading user config during test execution
* Running tests in parallel instead of serially
On my machine `toolkit test stdlib` execution time went from 38s to 15s
(with all code precompiled)
Use regex match for test include/exclude and module exclude to allow for
multiple tests/modules to be excluded.
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
<!--
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.
-->
Fixes: #8479
Co-authored-by: Jan9103 <55753387+Jan9103@users.noreply.github.com>
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
---------
Co-authored-by: Jan9103 <55753387+Jan9103@users.noreply.github.com>
<!--
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
Fixes#9268, the issue was due to the fact that when `history_isolation`
was set to true the engine_state's `session_id` wasn't updated.
This PR mainly refactors the code that updates the line_editor's history
information into one function `update_line_editor_history` and also
updates the engine_state's `session_id` when `history_isolation` is set
to `true` by calling the function `store_history_id_in_engine`.
<!--
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. -->
None since it's a bug fix.
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
I tried to extract the block that was updating the line_editor's
`session_id` to make it easier to add a test.
The test checks that after a call to the function
`update_line_editor_history`, the `engine_state` and the returned
`line_editor` do have the same `session_id`.
# Description
This fixes the `headers` command handling of missing values (issue
#9602). Previously, each row in the table would have its columns set to
be exactly equal to the first row even if it had less columns than the
first row. This would cause to values magically change their column or
cause panics in other commands if rows ended up having more columns than
values.
# Tests
Added a missing values test for the `headers` command
requires
- https://github.com/nushell/nushell/pull/9455
# ⚙️ Description
in this PR i move the commands we've all agreed, in the core team, to
move out of the core Nushell to the `extra` feature.
> **Warning**
> in the first commits here, i've
> - moved the implementations to `nu-cmd-extra`
> - removed the declaration of all the commands below from `nu-command`
> - made sure the commands were not available anymore with `cargo run --
-n`
## the list of commands to move
with the current command table downloaded as `commands.csv`, i've run
```bash
let commands = (
open commands.csv
| where is_plugin == "FALSE" and category != "deprecated"
| select name category "approv. %"
| rename name category approval
| insert treated {|it| (
($it.approval == 100) or # all the core team agreed on them
($it.name | str starts-with "bits") or # see https://github.com/nushell/nushell/pull/9241
($it.name | str starts-with "dfr") # see https://github.com/nushell/nushell/pull/9327
)}
)
```
to preprocess them and then
```bash
$commands | where {|it| (not $it.treated) and ($it.approval == 0)}
```
to get all untreated commands with no approval, which gives
```
╭────┬───────────────┬─────────┬─────────────┬──────────╮
│ # │ name │ treated │ category │ approval │
├────┼───────────────┼─────────┼─────────────┼──────────┤
│ 0 │ fmt │ false │ conversions │ 0 │
│ 1 │ each while │ false │ filters │ 0 │
│ 2 │ roll │ false │ filters │ 0 │
│ 3 │ roll down │ false │ filters │ 0 │
│ 4 │ roll left │ false │ filters │ 0 │
│ 5 │ roll right │ false │ filters │ 0 │
│ 6 │ roll up │ false │ filters │ 0 │
│ 7 │ rotate │ false │ filters │ 0 │
│ 8 │ update cells │ false │ filters │ 0 │
│ 9 │ decode hex │ false │ formats │ 0 │
│ 10 │ encode hex │ false │ formats │ 0 │
│ 11 │ from url │ false │ formats │ 0 │
│ 12 │ to html │ false │ formats │ 0 │
│ 13 │ ansi gradient │ false │ platform │ 0 │
│ 14 │ ansi link │ false │ platform │ 0 │
│ 15 │ format │ false │ strings │ 0 │
╰────┴───────────────┴─────────┴─────────────┴──────────╯
```
# 🖌️ User-Facing Changes
```
$nothing
```
# 🧪 Tests + Formatting
- ⚫ `toolkit fmt`
- ⚫ `toolkit clippy`
- ⚫ `toolkit test`
- ⚫ `toolkit test stdlib`
# 📖 After Submitting
```
$nothing
```
# 🔍 For reviewers
```bash
$commands | where {|it| (not $it.treated) and ($it.approval == 0)} | each {|command|
try {
help $command.name | ignore
} catch {|e|
$"($command.name): ($e.msg)"
}
}
```
should give no output in `cargo run --features extra -- -n` and a table
with 16 lines in `cargo run -- -n`
# Description
This PR adds two additional flags to the test runner `--exclude` and
`--exclude-module` which as the name suggests allow to exclude tests
from a run
The now options only support a single test / module to exclude.
# User-Facing Changes
# Tests + Formatting
# After Submitting
# Description
the current subtyping rule needs you to define the record entries in the
same order as declared in the annotation. this pr improves that
now
```nushell
{ name: 'Him', age: 12 }
# ,
{ age: 100, name: 'It' }
# and
{ name: 'Red', age: 69, height: "5-8" }
# will all match
record<name: string, age: int>
# previously only the first one would match
```
however, something like
```nushell
{ name: 'Her' } # will not
# and
{ name: 'Car', wheels: 5 }
```
EDIT: applied JT's suggestion
# Description
The `users` crate hasn't been updated for a long time, this PR tries to
replace `users` with `nix`.
See [advisory
page](https://rustsec.org/advisories/RUSTSEC-2023-0040.html) for
additional details.
# Description
We previously simply searched all commands in the working set. As our
deprecated/removed subcommands are documented by stub commands that
don't do anything apart from providing a message, they were still
included.
With this change we check the `Signature.category` to not be
`Category::Deprecated`.
## Note on performance
Making this change will exercise `Command.signature()` more
frequently! As the rust-implemented commands include their builders here
this probably will cause a number of extra allocations. There is
actually no valid reason why the commands should construct a new
`Signature` for each call to `Command.signature()`.
This will introduce some overhead to generate the completions for
commands.
# User-Facing Changes
Example: `str <TAB>`
![grafik](https://github.com/nushell/nushell/assets/15833959/4d5ec5fe-aa93-45af-aa60-3854a20fcb04)
# Description
Its purpose and its limitation around statements are not too obvious but
ubiquituous in our `nu!` tests. Document its behavior as we remove it in
many places for #8670
# User-Facing Changes
None
# Description
in most of the tests for `last` and `first`, we do not need to
- give `cwd` to `nu!`
- use pipeline as the tests are all short pipes
- use `r#" ... "#` as the pipes never contain quotes
this PR removes all these points from the tests for the `last` and
`first` commands.
# Description
We're seeing some issues in a few terminals with the shell integration
support. Moving shell_integration to off by default to help with the
default user experience, but it will remain easy to re-enable for folks
who want to have the integration experience and a terminal that supports
it well.
# User-Facing Changes
This turns off shell integration by default, requiring the user to edit
the config and re-enable it.
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
# Description
Add a `keybindings get` command to listen and get individual "keyboard"
events. This includes different keyboard keys (see example of use) on
seemingly all terminals and mouse, resize, focus and paste events on
some special once. The record returned by this command is similar to
crossterm event structure and is documented in help message. For ease of
use, option `--types` can get a list of event types to filter only
desired events automatically. Additionally `--raw` options displays raw
code of char keys and numeric format of modifier flags.
Example of use, moving a character around a grid with arrow keys:
```nu
def test [] {
mut x = 0
mut y = 0
loop {
clear
$x = ([([$x 4] | math min) 0] | math max)
$y = ([([$y 4] | math min) 0] | math max)
for i in 0..4 {
for j in 0..4 {
if $j == $x and $i == $y {
print -n "*"
} else {
print -n "."
}
}
print ""
}
let inp = (input listen-t [ key ])
match $inp.key {
{type: other key: enter} => (break)
{type: other key: up} => ($y = $y - 1)
{type: other key: down} => ($y = $y + 1)
{type: other key: left} => ($x = $x - 1)
{type: other key: right} => ($x = $x + 1)
_ => ()
}
}
}
```
# User-Facing Changes
- New `keybindngs get` command
- `keybindings listen` is left as is
- New `input display` command in std, mirroring functionality of
`keybindings listen`
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
# Description
Hi nushell!
Thanks so much for [adding http headers][headers]! I've been waiting for
this feature for a long time and it's great. However, I found that
`Record` as a return type and using `ureq`'s `response.header` api
results in missing header values when there are multiple with the same
name, as can occur with `set-cookie` and others.
This issue with http has been discussed at length [on
stackoverflow][stackoverflow] and in [`ureq` itself][ureq]. It seems
like concatenating header values with `,` is a common solution, but
tricky especially with `set-cookie` which may contain `,` in the
`Expires` field, as discussed in the former post.
I propose changing the return type to a `List` of `Record` so we can get
all of the header values without relying on ad-hoc mutation. This
solution does not return the headers in the same order as they appear in
the `Response` due to `ureq`'s `Response.all` API, but it's better than
dropping values imo.
This is a **breaking change**. I'm sure `ureq`'s
[`CookieStore`][cookiestore] is a better long-term solution for
returning cookies as a separate record on `http <method>`, but other
headers can be set multiple times as well.
# User-Facing Changes
- Changes the return type of an `http <method>` `header` field from
`Record` to `List` (Table with columns `name` and `value`)
- Returns all values of a header set multiple times instead of just the
first one duplicated
# Implementation
Quick note that running `header_names.dedup()` does not resolve the
necessity to iterate through the previously parsed headers since `dedup`
only removes identical values when they are next to each other in the
`Vec`. You could do a `sort` first, but header ordering can be important
in some cases, so I tried to avoid messing with that more than is
already the case with `Response.all`. Would love to see a better way of
doing this though!
# Tests + Formatting
No tests broke implementing this change. Not sure what endpoint to hit
or mock server to use to verify this in tests. I have some screenshots
to illustrate what I'm talking about.
Before:
![Screenshot 2023-07-03 at 12 50 17
AM](https://github.com/nushell/nushell/assets/39018167/41604bef-54c6-424b-91b2-6b89a020e4ff)
> `set-cookie` has the same value for every record field.
> Even if it did not I'm not sure how you would access the different
values since they all have the same key.
After:
![Screenshot 2023-07-03 at 12 49 45
AM](https://github.com/nushell/nushell/assets/39018167/4ee45e6e-3785-471f-aee7-5af185cd06c2)
> Actual values from the response returned for the same name
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 -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- [x] `cargo test --workspace` to check that all tests pass
- [x] `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library <-- Note: I did not see a `crates/nu-std/test/run.nu`
file so I ran the snippet below which returned without error
```nushell
for $i in (ls crates/nu-std/tests/*.nu) {
cargo run -- $i.name
}
```
# Code of Conduct
Apologies for not opening an issue first. Just did this fix for myself
because it seemed simple enough before deciding to open this 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.
-->
- [ ] update docs
[stackoverflow]:
https://stackoverflow.com/questions/3241326/set-more-than-one-http-header-with-the-same-name
[headers]: https://github.com/nushell/nushell/pull/8571
[ureq]: https://github.com/algesten/ureq/issues/95
[cookiestore]:
https://docs.rs/cookie_store/latest/cookie_store/struct.CookieStore.html
<!--
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
- fixes#9567
I have fixed everything mentioned in the issue, and made their help
messages more similar.
<!--
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. -->
- Previously, `last` on binary data returned an integer. Now it returns
a binary
- Now, `[] | last` and `[] | first` are both errors.
- Now, `ls | table | first` and `ls | table | last` are both errors.
# Description
This changes the default behaviour of `let` to be able to take a
pipeline as its initial value.
For example:
```
> let x = "hello world" | str length
```
This is a change from the existing behaviour, where the right hand side
is assumed to be an expression. Pipelines are more general, and can be
more powerful.
My google foo is failing me, but this also fixes this issue:
```
let x = foo
```
Currently, this reads `foo` as a bareword that gets converted to a
string rather than running the `foo` command. In practice, this is
really annoying and is a really hard to spot bug in a script.
# User-Facing Changes
BREAKING CHANGE BREAKING CHANGE
`let` gains the power to be assigned via a pipeline. However, this
changes the behaviour of `let x = foo` from assigning the string "foo"
to `$x` to being "run the command `foo` and give the result to `$x`"
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
# Description
This PR disallows blocks as first-class values by removing the ability
to create them using the `block` syntax shape or type. Now, the parser
will only ever be able to create closures as first-class values.
This means that `{ 3 }` will always be treated as a closure, unless used
in the specifically supported use case of the literal being given as an
arg to `for`, `if` and other built-in block users.
Note: first-class value here means "value that can be passed into
commands and held in variables"
# User-Facing Changes
This may break some user scripts as `: block` is no longer allows as a
type annotation. Note: these cases were not actually supported before,
as, for example, passing a block that accessed a variable would have
errored when the block was later evaluated.
Closures do not have the restriction mentioned above and are the much
safer value to pass as first-class, so now they are the only block-like
value to be allowed to be passed.
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
<!--
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
This pr is a completion of https://github.com/nushell/reedline/pull/598
After that pr is merged, we no longer need to disable bracketed mode in
nushell
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
<!--
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
Test runner now uses annotations instead of magic function names to pick
up code to run. Additionally skipping tests is now done on annotation
level so skipping and unskipping a test no longer requires changes to
the test code
In order for a function to be picked up by the test runner it needs to
meet following criteria:
* Needs to be private (all exported functions are ignored)
* Needs to contain one of valid annotations (and only the annotation)
directly above the definition, all other comments are ignored
Following are considered valid annotations:
* \# test
* \# test-skip
* \# before-all
* \# before-each
* \# after-each
* \# after-all
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
# Description
Switches the right prompt to use an easier-to-read date format
(YYYY-MM-DD)
It's currently using (MM-DD-YYYY) which is only used in a few countries
but it is unfortunately ambiguous with countries that use (DD-MM-YYYY)
format (most countries). While YYYY-MM-DD is used in fewer countries
than DD-MM-YYYY it's at least unambiguous to MM-DD-YYYY countries.
More info: https://en.wikipedia.org/wiki/Date_format_by_country
Alternatively, we could spell out the month name (even abbreviated) to
make it clear as well.
# User-Facing Changes
Just changes the date in the default right prompt
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
# Description
## Before
![image](https://github.com/nushell/nushell/assets/343840/4618c7b9-693c-4658-80e7-991464b8032f)
## After
![image](https://github.com/nushell/nushell/assets/343840/81305e69-fe47-46d9-b573-d9d1992f5088)
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
# Description
A couple clippy fixes
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect -A clippy::result_large_err` to check that
you're using the standard code style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library
> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->
# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->