# Description
This PR updates the signature of `format` to allow records to be passed
in.
Closes#9897
### Before
```nushell
{name: Downloads} | format "{name}"
× Command does not support record<name: string> input.
╭─[entry #12:1:1]
1 │ {name: Downloads} | format "{name}"
· ───┬──
· ╰── command doesn't support record<name: string> input
╰────
```
### After
```nushell
{name: Downloads} | format "{name}"
Downloads
```
# 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 -- -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.
-->
# Description
`Span` is `Copy`, so we probably should not be passing references of
`Span` around. This PR replaces all instances of `&Span` with `Span`,
copying spans where necessary.
# User-Facing Changes
This alters some public functions to take `Span` instead of `&Span` as
input. Namely, `EngineState::get_span_contents`,
`nu_protocol::extract_value`, a bunch of the math commands, and
`Gstat::gstat`.
# Description
Add `format duration` cmd to choose output unit.
This takes the previous `into duration --convert ...` behavior which
returned a string into its own `format duration` command.
This was suprising and not fitting with the general type signature for
the `into ...` commands.
This command for now lives in the `nu-cmd-extra` nursery.
# User-Facing Changes
## Breaking change
Removes formatting behavior from `into duration`
Now use `format duration` instead of `into duration --convert`
## Usage:
```
1sec | format duration us # Output data in microseconds
"2ms" | into duration | format duration sec # go from string to string
```
# Tests + Formatting
Basic example testing (including basic broadcast)
# Description
With the current typechecking logic this property has no effect.
It was only used in the example testing, and provided some indication of
this vectorizing property.
With #9742 all commands that previously declared it have explicit list
signatures. If we want to get it back in the future we can reconstruct
it from the signature.
Simplifies the example testing a bit.
# User-Facing Changes
Causes a breaking change for plugins that previously declared it. While
this causes a compile fail, this was already broken by our more
stringent type checking.
This will be a good reminder for plugin authors to update their
signature as well to reflect the more stringent type checking.
# Description
The same procedure as for #9778 repeated for records.
# User-Facing Changes
Commands that directly supported applying their work directly to record
fields via cell paths, that worked before #9680 will now work again
# Tests + Formatting
Tried to limit the need to add new `.allow_variants_without_examples()`
by adjusting or adding tests to also use some records with access.
# Description
This bumps nushell to the dev version of 0.83.1 and updates the default
config files with the proper version.
# User-Facing Changes
# Tests + Formatting
# After Submitting
# Description
Bump 0.83
# 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 -- -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.
-->
# Description
Reallow the commands that take cellpaths as rest parameters to operate
on table input data.
Went through all commands returned by
```
scope commands |
filter { |cmd| $cmd.signatures |
values |
any {|sig| $sig |
any {|$sig| $sig.parameter_type == rest and $sig.syntax_shape ==
cellpath }
}
} | get name
```
Only exception to that was `is-empty` that returns a bool.
# User-Facing Changes
Same table operations as in `0.82` should still be possible
Mitigates effects of #9680
# Description
All commands that declared `.vectorizes_over_list(true)` now also
explicitly declare the list form of their scalar types.
- Explicit in/out list signatures for nu-command
- Explicit in/out list signatures for nu-cmd-extra
- Add comments about cellpath behavior that is still unresolved
# User-Facing Changes
Our type signatures will now be more explicit about which commands
support vectorization over lists.
On the downside this is a bit more verbose and less systematic.
# Description
This PR ensures functions exist to extract and create each and every
`Value` case. It also renames `Value::boolean` to `Value::bool` to match
`Value::test_bool`, `Value::as_bool`, and `Value::Bool`. Similarly,
`Value::as_integer` was renamed to `Value::as_int` to be consistent with
`Value::int`, `Value::test_int`, and `Value::Int`. These two renames can
be undone if necessary.
# User-Facing Changes
No user facing changes, but two public functions were renamed which may
affect downstream dependents.
# Description
The working directory doesn't have to be set for those tests (or would
be the default anyways). When appropriate also remove calls to the
`pipeline()` function. In most places kept the diff minimal and only
removed the superfluous part to not pollute the blame view. With simpler
tests also simplified things to make them more readable overall (this
included removal of the raw string literal).
Work for #8670
# Description
This PR tights input/output type-checking a bit more. There are a lot of
commands that don't have correct input/output types, so part of the
effort is updating them.
This PR now contains updates to commands that had wrong input/output
signatures. It doesn't add examples for these new signatures, but that
can be follow-up work.
# User-Facing Changes
BREAKING CHANGE BREAKING CHANGE
This work enforces many more checks on pipeline type correctness than
previous nushell versions. This strictness may uncover incompatibilities
in existing scripts or shortcomings in the type information for internal
commands.
# 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 -- -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.
-->
The following math commands are being moved to nu-cmd-extra
* e (euler)
* exp
* ln
This should conclude moving the extra math commands as discussed in
yesterday's
core team meeting...
The remaining math commands will stay in nu-command (for now)....
# 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
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
# 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
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 converts a string into a raw binary represented by a string of
0s and 1s padded to 8 digits with zeros.
This is useful for encoding data.
![image](https://github.com/nushell/nushell/assets/343840/66864c79-3da1-4007-a62b-306ed85f4df4)
# 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.
-->
# Checklist
- `nu-ansi-term` remains the same
- [x] `reedline` is released and updated
- [x] release scripts are updated for `nu-cmd-base`
- [x] info blog post is online
- [ ] release notes are ready
In the spirit of #9509 we are changing the visibility of the bits
commands
to align with the way they are correctly done in the bytes commands...
Thanks to @sholderbach for pointing out this nice improvement
to me in my PR earlier in the day...
```rust
mod and;
mod bits_;
mod not;
mod or;
mod rotate_left;
mod rotate_right;
mod shift_left;
mod shift_right;
mod xor;
```
This PR reverts https://github.com/nushell/nushell/pull/9391
We try not to revert PRs like this, though after discussion with the
Nushell team, we decided to revert this one.
The main reason is that Nushell, as a codebase, isn't ready for these
kinds of optimisations. It's in the part of the development cycle where
our main focus should be on improving the algorithms inside of Nushell
itself. Once we have matured our algorithms, then we can look for
opportunities to switch out technologies we're using for alternate
forms.
Much of Nushell still has lots of opportunities for tuning the codebase,
paying down technical debt, and making the codebase generally cleaner
and more robust. This should be the focus. Performance improvements
should flow out of that work.
Said another, optimisation that isn't part of tuning the codebase is
premature at this stage. We need to focus on doing the hard work of
making the engine, parser, etc better.
# User-Facing Changes
Reverts the HashMap -> ahash change.
cc @FilipAndersson245
# Description
Make sure that our different crates that contain commands can be
compiled in parallel.
This can under certain circumstances accelerate the compilation with
sufficient multithreading available.
## Details
- Move `help` commands from `nu-cmd-lang` back to `nu-command`
- This also makes sense as the commands are implemented in an
ANSI-terminal specific way
- Make `nu-cmd-lang` only a dev dependency for `nu-command`
- Change context creation helpers for `nu-cmd-extra` and
`nu-cmd-dataframe` to have a consistent api used in
`src/main.rs`:`get_engine_state()`
- `nu-command` now indepedent from `nu-cmd-extra` and `nu-cmd-dataframe`
that are now dependencies of `nu` directly. (change to internal
features)
- Fix tests that previously used `nu-command::create_default_context()`
with replacement functions
## From scratch compilation times:
just debug (dev) build and default features
```
cargo clean --profile dev && cargo build --timings
```
### before
![grafik](https://github.com/nushell/nushell/assets/15833959/e49f1f42-2e53-4a6c-bc23-625b686af1bc)
### after
![grafik](https://github.com/nushell/nushell/assets/15833959/8dec4723-e625-4a86-b91e-e6e808f64726)
# User-Facing Changes
None direct, only change to compilation on multithreaded jobs expected.
# Tests + Formatting
Tests that previously chose to use `nu-command` for their scope will
still use `nu-cmd-lang` + `nu-command` (command list in the granularity
at the time)
cc/ @stormasm
# Description
i was about to start the cratification of the 0% commands and thought i
could refactor and simplify a bit the declaration of the `bits`
commands, having hopefully a simpler structure to work with the other
commands 😌
this PR:
- gives real names to all the `bits` commands, instead of `SubCommand`
- make them publicly available inside the `nu-cmd-extra` crate to
declare them through `add_extra_decls`
- move the declaration code to the top-level `mod.nu` of `nu-cmd-extra`
so that all commands can be declared there as in `default_context` in
`nu-command`
# User-Facing Changes
```
$nothing
```
# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- ⚫ `toolkit test`
- ⚫ `toolkit test stdlib`
# After Submitting
```
$nothing
```
# Description
see https://github.com/nushell/nushell/issues/9390
using `ahash` instead of the default hasher. this will not affect
compile time as we where already building `ahash`.
# 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
<!--
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:
- `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.
-->
I wanted to get the infrastructure in place for starters for our
*nu-cmd-extra* crate...
The plan is to put inside here the following commands...
* bits
* bytes
* math
I thought it would be easier to do one at a time as well as get the
nu-cmd-extra crate out there on crates.io
for this upcoming release...
Once this lands the infrastructure will be in place to move over the
other noted commands for now...
And then add other stuff we do NOT want to be in 1.0.