Commit Graph

4386 Commits

Author SHA1 Message Date
dependabot[bot]
f152858d83
Bump dtparse from 1.4.0 to 1.5.0 (#9412) 2023-06-12 14:52:49 +00:00
Maxim Zhiburt
85fbacb197
nu-table: Bump tabled to 0.12.1 (#9341)
close #9335 

I am not sure whether the fix was better to be delived as a minor bump
but it is what is is.

Could you @fdncred test it somehow?
I did it by checking out back the the original commit before the PR
refered in the issue.

---------

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2023-06-11 17:33:54 -05:00
Amirhossein Akhlaghpour
73921f4bd7
chore: rename uid to user column in ls --long (#9407)
Fixes: #9389
2023-06-11 18:02:08 +02:00
Steven Xu
be53ecbbaa
refactor: merge repl_buffer_state, repl_cursor_pos into one mutex (#9031)
# Description
Merge `repl_buffer_state`, `repl_cursor_pos` into one mutex.

# User-Facing Changes

# Tests + Formatting

# After Submitting
2023-06-10 17:38:11 -05:00
Stefan Holderbach
374df9d69f
Enable history entry exclusion with leading space (#9371)
# Description
Makes use of the feature introduced by nushell/reedline#566

If we consider this to be problematic we can decide to add a config
point for this behavior, but at first I was a bit hesistant expanding
the config in this area.


# User-Facing Changes
Follows precedent found in bash/zsh/fish to exclude lines starting with
a space from the history.
Like in fish you can still recall the last entry once but it will not be
stored and will be forgotten after the next submitted entry.


# Tests + Formatting
(-)
2023-06-10 17:15:46 -05:00
ja-cop
9c84c01aef
Add "regex" search term to commands with regex functionality (#9402)
Just makes it easier to find these commands when using the `help` system
- the `find` command already has the "regex" search term.

Co-authored-by: ja_cop <ja_cop@hoshi>
2023-06-11 00:02:00 +02:00
Astrick
e9508b578a
Fix find puts extra cols into record (#9397)
# 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.
-->

Trying to fix #9394. 

The problem with PR #9159 seems to be when searching for multiple terms,
each term is checked against the original values. It outputs a new value
for each such check, thus introducing replication for each search term.
As a result, it works fine with num of search term = 1.
2023-06-10 16:57:26 -05:00
Yethal
0bdc362e13
std: refactor test-runner to no longer require tests to be exported (#9355)
# Description
Test runner now performs following actions in order to run tests:
* Module file is opened
* Public function with random name is added to the source code, this
function calls user-specified private function
* Modified module file is saved under random name in $nu.temp-path
* Modified module file is imported in subprocess, injected function is
called by the test runner
# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
* Test functions no longer need to be exported
* test functions no longer need to reside in separate test_ files
* setup and teardown renamed to before-each and after-each respectively
* before-all and after-all functions added that run before all tests in
given module. This matches the behavior of test runners used by other
languages such as JUnit/TestNG or Mocha
# Tests + Formatting

# After Submitting

---------

Co-authored-by: Kamil <skelly37@protonmail.com>
Co-authored-by: amtoine <stevan.antoine@gmail.com>
2023-06-10 20:16:17 +02:00
Astrick
a86f34d0ad
Add zip-into-record to std iter (#9395)
# Description
Adds a new iter feature `zip-into-record` (#9380)

# User-Facing Changes
User can use `[1 2] | iter zip-into-record [3 4]` to create a table `[[1
2]; [3 4]]`

# Tests + Formatting

I noticed trailing spaces in std library that may wish to be cleaned in
the future.

Co-authored-by: amtoine <stevan.antoine@gmail.com>
2023-06-10 20:15:30 +02:00
Antoine Stevan
9fcc49e556
REFACTOR: simplify the declaration of extra commands (#9398)
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
```
2023-06-10 10:33:33 -07:00
Filip Andersson
1433f4a520
Changes HashMap to use aHash instead, giving a performance boost. (#9391)
# 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.
-->
2023-06-10 11:41:58 -05:00
WindSoilder
6e638ab381
disable bracketed paste during evaluation (#9399)
# Description
Fixes: #9218

When user execute some commands involve user input, currently if we
enable `bracketed_paste`, it will results strange behavior (Pasting `0~`
and `1~` around texts, e.g: `aaa` -> `0~aaa1~`) And this is why `gpg`
with paste failed.

Sorry that it's hard to make relative testing...

# 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.
-->
2023-06-10 09:42:13 -05:00
WindSoilder
5afd74f0b9
don't allow save command to save both stdout and stderr to the same file (#9368)
# Description
It's not a good idea to save `stdout` and `stderr` to the same file from
`save` command directly.

Because it saves `stdout` and `stderr` in different thread, which leads
to in-consistent output. As replace, we can use `o+e` redirection to fix
the issue

# User-Facing Changes
```
❯ do -i { "aa" } | save foo.txt -e foo.txt
Error:   × input and stderr input to same file
   ╭─[entry #3:1:1]
 1 │ do -i { "aa" } | save foo.txt -e foo.txt
   ·                                  ───┬───
   ·                                     ╰── can't save both input and stderr input to the same file
   ╰────
  help: you should use `o+e> file` instead
```

# 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.
-->
2023-06-10 10:09:19 +02:00
WindSoilder
191cd2c970
save command: Don't use BufWriter to write external strem to a file (#9377)
# Description
Fixes: #9293

The problem is caused by `save` makes a `BufferWriter` for output file,
when external commands redirect it's output to a file, the content is
bufferred first...

To fix the issue, I'd like to introduce a `--no-buf` flag for `save`
command, and it's only used in redirection scenario.

Sorry it's hard to test against it in test, because it requires external
command to sleep or pause...

# 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: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2023-06-10 10:07:26 +02:00
WindSoilder
1edd3e7c3b
add http options command (#9365)
# Description
closes: #9344

Different to other http commands, `http options` command always returns
header, according to
[MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS),
the response information is included in header.

# 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.
-->
2023-06-09 08:00:40 -05:00
Stefan Holderbach
a5dd93d154
Apply nightly clippy fixes (#9381)
# Description
New lints coming from `cargo +nightly clippy`

Manually checked for problems.


# User-Facing Changes
None

# Tests + Formatting
(-)
2023-06-08 18:49:58 +02:00
Gurpreet Singh
15a15c123e
Add a check for empty params for url join (#9356)
# 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.
-->

Fix for #9347 

# 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
> ```
-->
- [x] Add unit tests
- [x] Run all cargo tests + fmt commands

# 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.
-->
2023-06-07 19:08:21 +02:00
Stefan Holderbach
20b697f722
Fix internal module reexports (#9378)
# Description
`cargo +stable check` was complaining about ambiguous wildcard
reexports. Fixed by making the reexport of modules not pub as only the
explicitly named symbols are actually needed in the current state.


# User-Facing Changes
None
2023-06-07 16:36:34 +02:00
nibon7
a1a3ef4608
Fix typos (#9372)
# Description
Fix typo
2023-06-07 15:07:14 +02:00
Stefan Holderbach
d15859dd86
Bump to 0.81.1 as development version (#9379)
# Description
Primarily used as a marker on issues and if necessary as a patch release
version.
2023-06-07 15:06:42 +02:00
JT
63cb01e83b
bump to 0.81 (#9374)
# 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.
-->
2023-06-07 10:08:11 +12:00
Stefan Holderbach
ef38805ef9
Pin reedline to 0.20.0 release (#9370)
# Description
See release notes

https://github.com/nushell/reedline/releases/tag/v0.20.0
2023-06-06 13:16:18 +02:00
Jakub Žádník
82e6873702
Fix config creation during printing (#9353) 2023-06-04 22:04:28 +03:00
Kamil
df15fc24fe
Logger constants refactored, format argument added, better formatting of failed (non) equality assertions (#9315)
# Description
I have (hopefully) simplified the `log.nu` internal structure and added
customizable log format for all `log` commands

# User-Facing Changes
- [x] Replaced constants with env records for: 
    - ansi (newly added)
    - log level
    - prefix
    - short prefix
- [x] Added `format` argument to all log commands
- [x] Assertions for (not) equality (equal, not equal, greater,
lesser...) now put left and right values inside `'` quotes, so the
assertions for strings are more meaningful
- [x] Documented the %-formatting of log messages

# 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>
2023-06-04 10:43:40 +02:00
Darren Schroeder
7ca62b7b35
fix is-admin example (#9350)
# Description

closes #9348 

# 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.
-->
2023-06-03 15:11:14 -05:00
Alex Saveau
8f4c182a0c
Explain how to do time based bash watch (#9345) 2023-06-03 11:15:47 -05:00
Darren Schroeder
acd2fe8c51
bump rust toolchain to 1.68.2 (#9346)
# Description

In keeping with our tradition of staying 2 versions behind the latest
rust compiler version, this PR bump the toolchain to 1.68.2.

# 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.
-->
2023-06-02 17:30:15 -05:00
Darren Schroeder
5c57d6a74d
add the ability to have a list of glob excludes (#9343)
# Description

This change allows you to have a list of exclude globs such as:
```
glob **/* --not [**/target/** **/.git/**]
```

TODO: Allow the input glob to be multiples too with
`wax::any(patterns)?`

The breaking change part is that the excludes have to be supplied as a
list, between [ and ].

# 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.
-->
2023-06-02 12:37:17 -05:00
ShinyZero0
2ac63910f6
stdlib: add termux clipboard suport for clip (#9334)
# Description

Added `termux-clipboard-set` to `std clip`
2023-06-01 16:26:22 -05:00
solodov
55689ddb50
use "search_result" style to colorize matching strings (fixes #9275) (#9326)
This change introduces new `search_result` style supported in the color
config. The change also removes obsolete check for `config.ls_colors`
for computing the style. `config.ls_colors` has been removed last year,
so this removes the reference to the obsolete flag, along with a cleanup
that removes all the code that used to rely on ls_colors for
highlighting search results.


# 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.
-->
2023-06-01 15:51:18 -05:00
Darren Schroeder
3aab69110e
Some tests added with github copilot preview (#9332)
# Description

This PR adds some tests that were generated in GitHub Copilot Chat
Preview. I was just playing around and figured that more tests couldn't
hurt.

# 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.
-->
2023-06-01 15:24:36 -05:00
Michael Angerman
b9e65e35b8
include the nu-cmd-extra crate in the version command features (#9333)
We needed to include the nu-cmd-extra crate in the version command's
features...

In the style of this PR which fixed the dataframe feature upon adding
the nu-cmd-dataframe crate...

https://github.com/nushell/nushell/pull/9262
2023-06-01 13:10:39 -07:00
Michael Angerman
356e05177c
nu-cmd-extra crate infrastructure in place with the Bits command as the model for adding other commands (#9327)
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.
2023-06-01 10:46:16 -07:00
simdimdim
2f731fa1ae
Adding more math constants (and a small correction to the description of an existing one) (#9181)
Adding more float constants for when
https://github.com/rust-lang/rust/issues/103883 is accepted and merged.
And fixing a small conflation in the description of the Euler number.
Please take a look and let me know if I've missed or screwed up
anything.
2023-05-31 20:28:08 -05:00
Carter Reeb
e6be167797
fix padding when running input list on tables (#9316)
# Description
Improves the output when running `input list` on tabular data by
aligning each column.

# User-Facing Changes
## Before

![before](https://github.com/nushell/nushell/assets/39879966/b6a93568-f37c-4bd3-93eb-efa41cac1baf)
## After

![after](https://github.com/nushell/nushell/assets/39879966/35d74bc7-6f72-42c4-89e7-f54692ccd3ff)

<!-- 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.
-->
2023-05-31 18:31:46 +02:00
WindSoilder
bfe7133e7c
make insert, update, upsert support lazy records (#9323)
# Description
Fixes: #9165
It's because `sys` returns a lazy record, and `insert`, `update`,
`upsert` can't operate on lazy record yet.

# User-Facing 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.
-->
2023-05-31 06:27:55 -05:00
Maxim Zhiburt
5f8d8b4a4b
nu-explore/ Fix recursive table issue; (#9321)
close #9318

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
2023-05-30 09:59:56 -05:00
WMR
b67b6f7fc5
Add a datepart expression for dfr to be used with dfr with-column (#9285)
# Description

Today the only way to extract date parts from a dfr series is the dfr
get-* set of commands. These create a new dataframe with just the
datepart in it, which is almost entirely useless. As far as I can tell
there's no way to append it as a series in the original dataframe. In
discussion with fdncred on Discord we decided the best route was to add
an expression for modifying columns created in dfr with-column. These
are the way you manipulate series within a data frame.

I'd like feedback on this approach - I think it's a fair way to handle
things. An example to test it would be:

```[[ record_time]; [ (date now)]]  | dfr into-df | dfr with-column [ ((dfr col record_time) | dfr datepart nanosecond | dfr as "ns" ), (dfr col record_time | dfr datepart second | dfr as "s"), (dfr col record_time | dfr datepart minute | dfr as "m"), (dfr col record_time | dfr datepart hour | dfr as "h") ]```

I'm also proposing we deprecate the dfr get-* commands.  I've not been able to figure out any meaningful way they could ever be useful, and this approach makes more sense by attaching the extracted date part to the row in the original dataframe as a new column.

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

add in dfr datepart as an expression
<!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. -->

# Tests + Formatting
Need to add some better assertive tests.  I'm also not sure how to properly write the test_dataframe at the bottom, but will revisit as part of this PR.  Wanted to get feedback early.

<!--
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: Robert Waugh <robert@waugh.io>
2023-05-30 09:41:18 -05:00
nibon7
560c2e63ac
restore cursor shape when exits (#9314)
# Description
This PR restores cursor shape when nushell exists.

Fixes #9243 

Related
[nushell/reedline#574](https://github.com/nushell/reedline/pull/574)

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

* windows


https://github.com/nushell/nushell/assets/15247421/ede8d1c0-ecd1-40b0-87b0-6393c1a7160f


* linux


https://github.com/nushell/nushell/assets/15247421/b428f17e-05cb-45ad-aa5f-3a9753fd9176

* macos


https://github.com/nushell/nushell/assets/15247421/5170dabd-8b9f-4bad-a7a2-bdabfca45cca

# 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.
-->
2023-05-30 09:38:45 -05:00
Maxim Zhiburt
7f758d3e51
Merge stack before printing (#9304)
Could you @fdncred try it?

close?: #9264

---------

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2023-05-29 19:03:00 -05:00
mike
cc04b9a916
fix conflict between filesize and hexadecimal numbers (#9309)
closes #9278 

# Description

removes ambiguity between the `b` the filesize `bytes` unit and `b` the
hex digit
2023-05-28 12:56:58 +02:00
Antoine Stevan
3005fe10e5
REFACTOR: move run-tests and fix the std assert namespace (#9303)
related to the namespace bullet point in
- https://github.com/nushell/nushell/issues/8450

# Description
this was the last module of the standard library with a broken
namespace, this PR takes care of this.

- `run-tests` has been moved to `std/mod.nu`
- `std/testing.nu` has been moved to `std/assert.nu`
- the namespace has been fixed
- `assert` is now called `main` and used in all the other `std assert`
commands
- for `std assert length` and `std assert str contains`, in order not to
shadow the built-in `length` and `str contains` commands, i've used
`alias "core ..." = ...` to (1) define `foo` in `assert.nu` and (2)
still use the builtin `foo` with `core foo` (replace `foo` by `length`
or `str contains`)
  - tests have been fixed accordingly

# User-Facing Changes
one can not use
```
use std "assert equal"
```
anymore because `assert ...` is not exported from `std`.
`std assert` is now a *real* module.

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

# After Submitting
```
$nothing
```

# Notes for reviewers
to test this, i think the easiest is to
- run `toolkit test stdlib` and see all the tests pass
- run `cargo run -- -n` and try `use std assert` => are all the commands
available in scope?
2023-05-27 07:45:04 -05:00
Michel Alexandre Salim
34b3a49cae
[nu-explore] fix Cargo description (#9297)
# Description
The old description ("Nushell table printing") is identical to that of
`nu-table`. Per `explore --help` it is probably more accurate to say
"Nushell table pager".

# User-Facing Changes
N/A

# Tests + Formatting
```
❯ cargo metadata --no-deps | from json | get packages | get 14 | get description
warning: please specify `--format-version` flag explicitly to avoid compatibility problems
Nushell table pager
```

# After Submitting
N/A - change will go out when `0.82.0` is released

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
2023-05-27 10:18:39 +02:00
Jack Wright
8144926dc7
Adding JSON lines file support to dataframes (#9291)
# Description
Provides the ability to read and write [JSON
lines](https://jsonlines.org/) files. This is accomplished by exposing
the support already in Polars.

## Opening a JSON lines file 
<img width="1668" alt="Screenshot 2023-05-25 at 5 25 30 PM"
src="https://github.com/nushell/nushell/assets/56345/3b213c3d-eea1-440a-8425-4ce4b39ab7d1">

## Saving a dataframe to a JSON lines file
<img width="848" alt="Screenshot 2023-05-25 at 5 15 57 PM"
src="https://github.com/nushell/nushell/assets/56345/56089990-e14b-4f01-b676-5abab9333d7e">
2023-05-26 16:32:37 -05:00
Darren Schroeder
5f92fd20e9
update most dependencies except where deeper code changes are needed (#9296)
# Description

This PR updates most dependencies and tries to get in sync with
reedline.

# 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.
-->
2023-05-26 10:32:48 -05:00
Antoine Stevan
6481bf272c
REFACTOR: build help pages instead of printing them (#9253)
# Description
in order to write tests for the `std help` commands, as we currently
have in the Rust source base, we need to be able to manipulate the
output of the `std help` commands.

however, until now they've all been directly printing the help pages as
they go...

this PR tries to build the help pages and return them at the end instead
of printing them on the fly 👍

> **Note**
> this is quite a rewrite of the `help.nu` module 🤔 
> i think it might be best to either
> - look at the commits in order
> - test the changes by testing the commands in the REPL and comparing
them to their previous `std help` versions

# User-Facing Changes
```
$nothing
```

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

# After Submitting
```
$nothing
```
2023-05-26 11:22:51 +02:00
Mel Massadian
9e667cc879
feat: (stdlib) add os record support to path add (#9238)
# 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.
-->
Add "os record" support.


# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->
This don't change how path add works but just adds support for "os
records" aka records whose key are at least one of:
- linux
- macos
- windows

Check the
[test](a917f1a924/crates/nu-std/tests/test_std.nu (L31-L32))
if that's not clear enough

# 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>
2023-05-26 09:24:53 +02:00
Antoine Stevan
3e55addbdd
refactor the lib.rs of nu-std after the new virtual files PR (#9289) 2023-05-25 22:43:07 +03:00
Access
e5ff72120a
check if is homedir first when rm (#9117)
I don't want to rm my home again.. sadly..


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

check if there is unique argument

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

user will not easily rm their home

# 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: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2023-05-25 09:45:50 -05:00
JT
43108de547
move over to reedline git version (#9283)
# Description
Moves us over to dogfooding the git version of reedline ahead of the
next release.

# User-Facing Changes

With luck, you should see fewer bugs :D

# 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.
-->
2023-05-25 11:53:57 +12:00