# Description
- prettify formatting
- move message formatting to a private function
- allow short prefixes for loggers via `--short|-s` flag
# User-Facing Changes
- allow short prefixes for loggers via `--short|-s` flag
# 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: amtoine <stevan.antoine@gmail.com>
# Description
this PR makes `std help` commands return a table no matter the number of
matches when using `--find`.
as proposed by Darren, this would allow users to still rely on things
like
```nushell
let blah = (std help modules -f weather | get name)
```
even if there is a single match.
# User-Facing Changes
`std help ... --find ...` now returns a table as `help ... --find ...`
# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- ⚫ `toolkit test`
- ⚫ `toolkit test stdlib`
# After Submitting
```
$nothing
```
# 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.
-->
Makes in so if you run `std help <external>` it will run `man <command>`
to get help pages. This command is configurable w/ the `$env.NU_HELPER`
var.
This will close#8032
Examples:
`std help rg` will display the ripgrep help pages
Todo:
- [x] Make flags and fallback configurable
- [x] Improve the warning that it is external
- [ ] Implement `--find` for external commands
# User-Facing Changes
Users will now be able to run `std help` on external 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 -- 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
- Log levels are now exported members of `std log`, e.g. `std log
CRITICAL_LEVEL`
- Added `std log custom` command that allows to declare custom message
format (actual message replaces `%MSG%` in the template) with
user-defined log level.
# User-Facing Changes
New possibilities included in description
# 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
as stated in the `0.79` release note, this PR removes the `old-alias`
and `export old-alias` commands, which were deprecated before.
# User-Facing Changes
`old-alias` is gone for good 😌
# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`
# After Submitting
already mentionned in the `0.79` release note.
# Description
the plan of deprecating `source` never really came to conclusion, so i
propose to move it out of the deprecated commands in this PR.
i've moved it to `nu-command::misc`, which can be changed 👍
# User-Facing Changes
```
$nothing
```
# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- ⚫ `toolkit test`
- ⚫ `toolkit test stdlib`
# After Submitting
```
$nothing
```
# Description
- highlight directory separators with light green (for regular user) and
light red (for admin) colors respectively
- highlight colons and slashes in the right prompt with light magenta
- underline AM/PM in the right prompt
- use long options to enhance readability
How it looks in MATE Terminal with Tango color theme:
![image](https://user-images.githubusercontent.com/42812113/236052908-fc80def9-9117-4b87-8ce4-321b937f3339.png)
# User-Facing Changes
- highlight directory separators in light green (for regular user) and
red colors (for admin)
- highlight colons and slashes in the right prompt with light magenta
- underline AM/PM in the 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
Currently, error spans for I/O errors in an `rm` invocation always point
to the `rm` argument. This isn't ideal, because the user loses context
as to which “target” actually had a problem:
![image](https://user-images.githubusercontent.com/658538/235723366-50db727e-9ba2-4d16-afc6-6a2406c584e0.png)
Shadow the existing `span` variable in outer scope in `rm`'s
implementation for the errors that may be detected while handling I/O
results. This is desired, because all failures from this point are
target-specific, and pointing at the argument that generated the target
instead is better. The end user should now see this:
![image](https://user-images.githubusercontent.com/658538/235724345-1d2e98e0-6b20-4bf5-b8a2-8b4368cdfb05.png)
# User-Facing Changes
* When `rm` encounters I/O errors, their spans now point to the “target”
argument associated with the error, rather than the `rm` token.
# Tests + Formatting
No tests currently cover this. I'm open to adding tests, but adding as
follow-up sounds better ATM, since this wasn't covered before.
# After Submitting
Nothing needs to be done here, AFAIK. No I/O errors are currently
demonstrated in official docs, though maybe they should be?
# Description
Follow-up of #8940. As @bobhy pointed out, it makes sense for the
behaviour of flags to match the one for positional arguments, where
default values are of type `Option<Value>` instead of
`Option<Expression>`.
# User-Facing Changes
The same ones from the original PR:
- Flag default values will now be parsed as constants.
- If the default value is not a constant, a parser error is displayed.
# Tests + Formatting
A [new
test](e34e2d35f4/src/tests/test_engine.rs (L338-L344))
has been added to verify the new restriction.
# Description
Before this PR, `math round` ignores the input if it's an `int`. This
results in the following behaviour:
```
> 123 | math round --precision -1
123
```
When the correct result is 120.
Now `int values` are converted to `float values` before actually
rounding up the number in order to take advantage of the float
implementation.
Fixes#9049.
# Description
The previous behaviour broke for me because I didn't have `sh` in my
path for my nu script. I think we shouldn't assume that just because a
file ends with `.sh` it should be executed with `sh`. `sh` might not be
available or the script might contain a hashbang for a different shell.
The idea with this PR is that nushell shouldn't assume anything about
executable files and just execute them. Later on we can think about how
non-executable files should be executed if we detect they are a script.
# User-Facing Changes
This may break some people's scripts or habits if they have wrong
assumptions about `.sh` files. We can tell them to add a hashbang and +x
bit to execute shell scripts, or prepend `bash`. If this a common
assumption something like this should be added to the book
# Tests + Formatting
I only tested manually and that did work
# After Submitting
Co-authored-by: Jelle Besseling <jelle@bigbridge.nl>
cc/ @fdncred
# Description
in the examples of `std bench` there is an expanded table without
explicitely expanding it...
this PR adds a `table -e` to the `std bench` call in the example.
# User-Facing Changes
the help page of `std bench` now does make sense 😌
# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- ⚫ `toolkit test`
- ⚫ `toolkit test stdlib`
# After Submitting
```
$nothing
```
# Description
This PR impacts the nushell sqlite history only.
This is the first PR that enables history isolation in nushell for the
sqlite history. Hopefully, we can continue building on this.
This PR allows "history isolation" which means that other nushell
session's history won't be available in the current session when using
the uparrow/downarrow history navigation. This change only impacts the
uparrow downarrow history navigation.
What remains to be done is making ctrl+r history menu respect this
setting too. Right now, the history menu will still show you all entries
from all sessions.
The history command also shows all history items from all sessions. This
may remain unchanged since you can just filter by history session right
now.
This also fixes a bug where the session id is 0 in the sqlite history
since my April 18th reedline PR.
Closes#9064
# 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.
-->
Should close on of the points in
- https://github.com/nushell/nushell/issues/8813
# Description
this PR uses the new `--columns` option for `find` to filter the results
of the `std help` commands on the `usage`, `name` and `search_terms`
columns.
# User-Facing Changes
the `--find` option of `std help` commands should match more closely the
built-in `help` commands output.
# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- ⚫ `toolkit test`
- ⚫ `toolkit test stdlib`
# After Submitting
```
$nothing
```
Should close on of the points in
- https://github.com/nushell/nushell/issues/8813
# Description
before this PR, we had a problem
```
cargo run -- -c '{
modules: ((help modules | get name) == (std help modules | get name))
aliases: ((help aliases | get name) == (std help aliases | get name))
externs: ((help externs | get name) == (std help externs | get name))
operators: ((help operators | get name) == (std help operators | get name))
commands: ((help commands | get name) == (std help commands | get name))
}'
```
would give
```
╭───────────┬───────╮
│ modules │ false │
│ aliases │ true │
│ externs │ true │
│ operators │ false │
│ commands │ true │
╰───────────┴───────╯
```
this PR removes the `name` sorting so that the orders are the same
between the `std` implementation and the built-in one.
> **Note**
> run the same `cargo run` command as above and see
> ```
> ╭───────────┬──────╮
> │ modules │ true │
> │ aliases │ true │
> │ externs │ true │
> │ operators │ true │
> │ commands │ true │
> ╰───────────┴──────╯
> ```
# User-Facing Changes
the operators in `std help ...` will be sorted just as the built-in
`help ...`.
# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- ⚫ `toolkit test`
- ⚫ `toolkit test stdlib`
# After Submitting
```
$nothing
```
# Description
Add option that combines both output streams to the `run-external`
command.
This allows you to do something like this:
```nushell
let res = do -i { run-external --redirect-combine <command that prints to stdout and stderr> } | complete
if $res.exit_code != 0 {
# Only print output when command has failed.
print "The command has failed, these are the logs:"
print $res.stdout
}
```
# User-Facing Changes
No breaking changes, just an extra option.
# Tests + Formatting
Added a test that checks the new option
# 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: Jelle Besseling <jelle@bigbridge.nl>
# Description
Fix getting the cursor position, when it's at the end of the
commandline.
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
# Tests + Formatting
# After Submitting
This PR just tidies up some tests by removing unused code:
1. If the filesystem is not touched, don't use the filesystem
playground/sandbox
2. If the filesystem is not touched, don't specify the `cwd`
3. If the command is short, don't bother wrapping it in `pipeline()`
4. If the command doesn't have quotes, don't bother with a `r#"..."#`
raw string
Part of #8670.
# Description
i use `std clip` to copy everything from `nushell`.
however i have the auto-expand on tables enabled and when i use `clip`
on large tables, it does not copy what i see but the collapsed data => i
have to edit the line and add `| table --expand` manually, which is a
pain to do regularly 😱
in this PR, i just add `--expand` to `std clip` to automatically expand
the data before copying it 😋
# User-Facing Changes
exploring the `Cargo.toml` of `nushell` with auto-expand, one might see
```
> open Cargo.toml | get package.metadata.binstall.overrides
╭────────────────────────┬───────────────────╮
│ │ ╭─────────┬─────╮ │
│ x86_64-pc-windows-msvc │ │ pkg-fmt │ zip │ │
│ │ ╰─────────┴─────╯ │
╰────────────────────────┴───────────────────╯
```
but then
```
open Cargo.toml | get package.metadata.binstall.overrides | clip
```
would only copy
```
╭────────────────────────┬──────────────────╮
│ x86_64-pc-windows-msvc │ {record 1 field} │
╰────────────────────────┴──────────────────╯
```
...
now
```
open Cargo.toml | get package.metadata.binstall.overrides | clip --expand
```
will copy the expanded record 👍
# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- ⚫ `toolkit test`
- ⚫ `toolkit test stdlib`
# After Submitting
```
$nothing
```
Should address the first point of
- https://github.com/nushell/nushell/issues/8696.
# Description
i've seen a few appearances of this `benchmark` idea in recent works on
`nu-std`, so i thought it would be great to add it finally.
# User-Facing Changes
a new `std bench` command to measure the performance of `nushell`
closures and code blocks.
# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- ⚫ `toolkit test`
- 🟢 `toolkit test stdlib`
# After Submitting
```
$nothing
```
# Description
Extends the `extern` syntax to allow commands that accept raw arguments.
This is mainly added to allow wrapper type scripts for external
commands.
This is an example on how this can be used:
```nushell
extern foo [...rest] {
print ($rest | str join ',' )
}
foo --bar baz -- -q -u -x
# => --bar,baz,--,-q,-u,-x
```
(It's only possible to accept a single ...varargs argument in the
signature)
# User-Facing Changes
No breaking changes, just extra possibilities.
# Tests + Formatting
Added a test for this new behaviour and ran the toolkit pr checker
# After Submitting
This is advanced functionality but it should be documented, I will open
a new PR on the book for that
Co-authored-by: Jelle Besseling <jelle@bigbridge.nl>
# Description
The `members` parameter of `use` is specified as type `any`, but it's
really a string or list of strings or `*`. So add some examples that
mention what you can specify for `members`.
Also mention `help modules` and `help std`, since you probably want to
use the standard library or another defined modules.
Sidenote: I tried to run the examples for `use` as tests like is done
for the other commands. That panics with `missing module command`. I
assume this is known.
# User-Facing Changes
`help use` now looks like this:
```nushell
Use definitions from a module, making them available in your shell.
See `help std` for the standard library module.
See `help modules` to list all available modules.
This command is a parser keyword. For details, check:
https://www.nushell.sh/book/thinking_in_nu.html
Usage:
> use <module> (members)
Flags:
-h, --help - Display the help message for this command
Parameters:
module <string>: Module or module file
(optional) members <any>: Which members of the module to import
Examples:
Define a custom command in a module and call it
> module spam { export def foo [] { "foo" } }; use spam foo; foo
foo
Define a custom command that participates in the environment in a module and call it
> module foo { export def-env bar [] { let-env FOO_BAR = "BAZ" } }; use foo bar; bar; $env.FOO_BAR
BAZ
Use a plain module name to import its definitions qualified by the module name
> module spam { export def foo [] { "foo" }; export def bar [] { "bar" } }; use spam; (spam foo) + (spam bar)
foobar
Specify * to use all definitions in a module
> module spam { export def foo [] { "foo" }; export def bar [] { "bar" } }; use spam *; (foo) + (bar)
foobar
To use commands with spaces, like subcommands, surround them with quotes
> module spam { export def 'foo bar' [] { "baz" } }; use spam 'foo bar'; foo bar
baz
To use multiple definitions from a module, wrap them in a list
> module spam { export def foo [] { "foo" }; export def 'foo bar' [] { "baz" } }; use spam ['foo', 'foo bar']; (foo) + (foo bar)
foobaz
```
# Description
This PR bumps the rust toolchain from 1.66.1 to 1.67.1
# 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` 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
Previously, `par-each` acted like a `flatmap`: first mapping the data,
then applying a `flatten`. This is unlike `each`, which just maps the
data. Now `par-each` works like `each` in this regard, leaving nested
data unflattened.
Fixes#8497
# User-Facing Changes
Previously:
`[1 2 3] | par-each {|e| [$e, $e] }` --> `[1,1,2,2,3,3]`
Now:
`[1 2 3] | par-each {|e| [$e, $e] }` --> `[[1,1],[2,2],[3,3]]`
# Tests
This adds one test that verifies the lack of flattening for `par-each`.
# Description
This PR fixes a problem due to me landing an out of date PR that stopped
nushell from compiling.
# 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` 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.
-->
close? #8060
Quite a bit of refactoring took place.
I believe a few improvements to collapse/expand were made.
I've tried to track any performance regressions and seems like it is
fine.
I've noticed something different now with default configuration path or
something in this regard?
So I might missed something while testing because of this.
Requires some oversight.
---------
Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
I'm still new to nushell and Rust, so please let me know if there are
any omissions and/or mistakes.
# Description
fixed#8863
`$nu` completion shows wrong completion menus at this time.
This PR fixes the problem to show the correct ones.
# User-Facing Changes
Users can use the correct menus on `$nu` completion like this
[recording](https://asciinema.org/a/KCwfpdAoMFsQODFBnb3NwmufC).
# Tests + Formatting
```
$ use toolkit.nu
$ toolkit check pr
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`
```
# After Submitting
nothing
# Description
Fixes#8939.
# User-Facing Changes
- Parameter default values will now be parsed as constants.
- If the default value is not a constant, a parser error is displayed.
# Tests + Formatting
The [only affected
test](d42c2b2dbc/src/tests/test_engine.rs (L325-L328))
has been updated to reflect the new behavior.
# Description
follow up to #8529
cleaned up version of #8892
- the original syntax is okay
```nu
def okay [rec: record] {}
```
- you can now add type annotations for fields if you know
them before hand
```nu
def okay [rec: record<name: string>] {}
```
- you can specify multiple fields
```nu
def okay [person: record<name: string age: int>] {}
# an optional comma is allowed
def okay [person: record<name: string, age: int>] {}
```
- if annotations are specified, any use of the command will be type
checked against the specified type
```nu
def unwrap [result: record<ok: bool, value: any>] {}
unwrap {ok: 2, value: "value"}
# errors with
Error: nu::parser::type_mismatch
× Type mismatch.
╭─[entry #4:1:1]
1 │ unwrap {ok: 2, value: "value"}
· ───────┬─────
· ╰── expected record<ok: bool, value: any>, found record<ok: int, value: string>
╰────
```
> here the error is in the `ok` field, since `any` is coerced into any
type
> as a result `unwrap {ok: true, value: "value"}` is okay
- the key must be a string, either quoted or unquoted
```nu
def err [rec: record<{}: list>] {}
# errors with
Error:
× `record` type annotations key not string
╭─[entry #7:1:1]
1 │ def unwrap [result: record<{}: bool, value: any>] {}
· ─┬
· ╰── must be a string
╰────
```
- a key doesn't have to have a type in which case it is assumed to be
`any`
```nu
def okay [person: record<name age>] {}
def okay [person: record<name: string age>] {}
```
- however, if you put a colon, you have to specify a type
```nu
def err [person: record<name: >] {}
# errors with
Error: nu::parser::parse_mismatch
× Parse mismatch during operation.
╭─[entry #12:1:1]
1 │ def unwrap [res: record<name: >] { $res }
· ┬
· ╰── expected type after colon
╰────
```
# User-Facing Changes
**[BREAKING CHANGES]**
- this change adds a field to `SyntaxShape::Record` so any plugins that
used it will have to update and include the field. though if you are
unsure of the type the record expects, `SyntaxShape::Record(vec![])`
will suffice
# Description
This PR changes the `ast` command to be able to output `--json` as well
as `nuon` (default) with "pretty" and "minified" output. I'm hoping this
functionality will be usable in the vscode extension for semantic
tokenization and highlighting.
# User-Facing Changes
There's a new `--json`/`-j` option. Prior version output of nuon is
maintained as default.
# 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` 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
Close: #8988
Thanks to new crossterm version, nushell can support blink cursor shape.
It can be config with the following value:
1. blink_block
2. blink_line
3. blink_underscore
And original block, line, underscore will be steady. It also fixes wrong
shape of `underscore`.
# User-Facing Changes
Here is a little breaking change, before the change: `line` cursor shape
is blinking line, but after this pr, it will be `steady line`. To make a
blink line, we need to change the value to `blink_line`.
But I think it's ok, because after the change, we have a good naming
convention about the name of shape
# 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` 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
Set the initial repl cursor pos, so running `commandline --insert`
inserts at the current cursor position of the input buffer.
Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
Tiny fix: clarify in `run-external`'s signature that the external
command must be a string.
### Before
```
Signatures:
<any> | run-external <any> -> <any>
Parameters:
command <any>: external command to run
...args <any>: arguments for external command
```
### After
```
Signatures:
<any> | run-external <string> -> <any>
Parameters:
command <string>: external command to run
...args <any>: arguments for external command
```
### Notes
I was hoping to change more `any`s to more specific types, but alas I
think we can only change `command` right now. The input can be any type
and it gets rendered to a string before being passed to the external.
The args can be any value type and they get converted to strings. The
output can be either binary or a string.
# Description
This does a lookup in the cache of parsed files to see if a span can be
found for a file that was previously loaded with the same contents, then
uses that span to find the parsed block for that file. The end result
should, in theory, be identical but doesn't require any reparsing or
creating new blocks/new definitions that aren't needed.
This drops the sg.nu benchmark from:
```
╭───┬───────────────────╮
│ 0 │ 280ms 606µs 208ns │
│ 1 │ 282ms 654µs 416ns │
│ 2 │ 252ms 640µs 541ns │
│ 3 │ 250ms 940µs 41ns │
│ 4 │ 241ms 216µs 375ns │
│ 5 │ 257ms 310µs 583ns │
│ 6 │ 196ms 739µs 416ns │
╰───┴───────────────────╯
```
to:
```
╭───┬───────────────────╮
│ 0 │ 118ms 698µs 125ns │
│ 1 │ 121ms 327µs │
│ 2 │ 121ms 873µs 500ns │
│ 3 │ 124ms 94µs 708ns │
│ 4 │ 113ms 733µs 291ns │
│ 5 │ 108ms 663µs 125ns │
│ 6 │ 63ms 482µs 625ns │
╰───┴───────────────────╯
```
I was hoping to also see some startup time improvements, but I didn't
notice much there.
# 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` 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.
-->
As described in #8893, switch `std run-tests --module` is ambiguous, but
`--command` is misleading. Fix that, and rename `--list` output column
to match.
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
* `std run-tests --command test_foo_1` changes to `std run-tests --test
test_foo_1`, users may have to change existing scripts (or muscle
memory).
*
```
〉std run-tests --list | columns
╭───┬────────╮
│ 0 │ module │
│ 1 │ name │
│ 2 │ file │
╰───┴────────╯
```
Changes to:
```
〉std run-tests --list | columns
╭───┬────────╮
│ 0 │ module │
│ 1 │ test │
│ 2 │ file │
╰───┴────────╯
```
# 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` 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 condenses `MutBuiltinVar`, `LetBuiltinVar` and `ConstBuiltinVar`
into one error:
```nu
Error: nu::parser::name_is_builtin_var
× `in` used as variable name.
╭─[entry #69:1:1]
1 │ let in = 420
· ─┬
· ╰── already a builtin variable
╰────
help: 'in' is the name of a builtin Nushell variable and cannot be used
as a variable name
```
it also fixes this case which was previously not handled
```nu
let $nu = 420 # this variable would have been 'lost'
```