nushell/crates
Wind 5596190377
do command: Make closure support default parameters and type checking (#12056)
# Description
Fixes: #11287
Fixes: #11318

It's implemented by porting the similar logic in `eval_call`, I've tried
to reduce duplicate code, but it seems that it's hard without using
macros.

3ee2fc60f9/crates/nu-engine/src/eval.rs (L60-L130)

It only works for `do` command.

# User-Facing Changes
## Closure supports optional parameter
```nushell
let code = {|x?| print ($x | default "i'm the default")}
do $code
```
Previously it raises an error, after this change, it prints `i'm the
default`.

## Closure supports type checking
```nushell
let code = {|x: int| echo $x}
do $code "aa"
```
After this change, it will raise an error with a message: `can't convert
string to int`

# Tests + Formatting
Done

# After Submitting
NaN
2024-03-11 18:11:08 +08:00
..
nu-cli Canonicalize config dir (#12136) 2024-03-10 11:07:31 +01:00
nu-cmd-base Allow for stacks to have parents (#11654) 2024-03-09 17:55:39 +01:00
nu-cmd-dataframe Debugger experiments (#11441) 2024-03-08 20:21:35 +02:00
nu-cmd-extra Remove feat extra and include in default (#12140) 2024-03-10 17:29:02 +01:00
nu-cmd-lang do command: Make closure support default parameters and type checking (#12056) 2024-03-11 18:11:08 +08:00
nu-color-config Restructure nu-protocol in more meaningful units (#11917) 2024-03-10 18:45:45 +01:00
nu-command Improve error message for into sqlite with empty records (#12149) 2024-03-10 14:14:21 -05:00
nu-engine Keep plugins persistently running in the background (#12064) 2024-03-09 17:10:22 -06:00
nu-explore Debugger experiments (#11441) 2024-03-08 20:21:35 +02:00
nu-glob Bump version to 0.91.1 (#12085) 2024-03-06 23:08:14 +01:00
nu-json remove repetitive word (#12117) 2024-03-08 15:29:20 +08:00
nu-lsp Introduce workspace dependencies (#12043) 2024-03-07 14:40:31 -08:00
nu-parser Restructure nu-protocol in more meaningful units (#11917) 2024-03-10 18:45:45 +01:00
nu-path Canonicalize config dir (#12136) 2024-03-10 11:07:31 +01:00
nu-plugin Keep plugins persistently running in the background (#12064) 2024-03-09 17:10:22 -06:00
nu-pretty-hex Introduce workspace dependencies (#12043) 2024-03-07 14:40:31 -08:00
nu-protocol Bump reedline to dev (and strum) (#12150) 2024-03-10 20:31:54 +01:00
nu-std Debugger experiments (#11441) 2024-03-08 20:21:35 +02:00
nu-system Bump windows from 0.52.0 to 0.54.0 (#12037) 2024-03-07 16:36:28 -08:00
nu-table Introduce workspace dependencies (#12043) 2024-03-07 14:40:31 -08:00
nu-term-grid Bump version to 0.91.1 (#12085) 2024-03-06 23:08:14 +01:00
nu-test-support Update tests Playground (#12134) 2024-03-08 20:31:21 -08:00
nu-utils Keep plugins persistently running in the background (#12064) 2024-03-09 17:10:22 -06:00
nu_plugin_custom_values Add support for engine calls from plugins (#12029) 2024-03-09 11:26:30 -06:00
nu_plugin_example Keep plugins persistently running in the background (#12064) 2024-03-09 17:10:22 -06:00
nu_plugin_formats Add support for engine calls from plugins (#12029) 2024-03-09 11:26:30 -06:00
nu_plugin_gstat Add support for engine calls from plugins (#12029) 2024-03-09 11:26:30 -06:00
nu_plugin_inc Add support for engine calls from plugins (#12029) 2024-03-09 11:26:30 -06:00
nu_plugin_python Improve the error message for a plugin version mismatch (#12122) 2024-03-08 06:04:22 -06:00
nu_plugin_query Add support for engine calls from plugins (#12029) 2024-03-09 11:26:30 -06:00
nu_plugin_stream_example Add support for engine calls from plugins (#12029) 2024-03-09 11:26:30 -06:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00

Nushell core libraries and plugins

These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.

Foundational libraries are split into two kinds of crates:

  • Core crates - those crates that work together to build the Nushell language engine
  • Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.

Plugins are likewise also split into two types:

  • Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
  • Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.