nushell/crates
Wind e281c03403
generate: switch the position of <initial> and <closure>, so the closure can have default parameters (#13393)
# Description
Close: #12083 
Close: #12084 

# User-Facing Changes
It's a breaking change because we have switched the position of
`<initial>` and `<closure>`, after the change, initial value will be
optional. So it's possible to do something like this:

```nushell
> let f = {|fib = [0, 1]| {out: $fib.0, next: [$fib.1, ($fib.0 + $fib.1)]} }
> generate $f | first 5
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
│ 2 │ 1 │
│ 3 │ 2 │
│ 4 │ 3 │
╰───┴───╯
```

It will also raise error if user don't give initial value, and the
closure don't have default parameter.
```nushell
❯ let f = {|fib| {out: $fib.0, next: [$fib.1, ($fib.0 + $fib.1)]} }
❯ generate $f
Error:   × The initial value is missing
   ╭─[entry #5:1:1]
 1 │ generate $f
   · ────┬───
   ·     ╰── Missing intial value
   ╰────
  help: Provide <initial> value in generate, or assigning default value to closure parameter

```

# Tests + Formatting
Added some test cases.

---------

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
2024-07-19 00:22:28 -07:00
..
nu_plugin_custom_values Bumping version to 0.95.1 (#13231) 2024-06-25 18:26:07 -07:00
nu_plugin_example Make plugins able to find and call other commands (#13407) 2024-07-19 13:54:21 +08:00
nu_plugin_formats remove the deprecated register command (#13297) 2024-07-05 07:16:50 -05:00
nu_plugin_gstat remove the deprecated register command (#13297) 2024-07-05 07:16:50 -05:00
nu_plugin_inc remove the deprecated register command (#13297) 2024-07-05 07:16:50 -05:00
nu_plugin_nu_example Bumping version to 0.95.1 (#13231) 2024-06-25 18:26:07 -07:00
nu_plugin_polars Bump uuid from 1.9.1 to 1.10.0 (#13390) 2024-07-17 09:46:59 +08:00
nu_plugin_python remove the deprecated register command (#13297) 2024-07-05 07:16:50 -05:00
nu_plugin_query Use conventional generic bounds (#13360) 2024-07-12 17:13:07 +08:00
nu_plugin_stress_internals Bumping version to 0.95.1 (#13231) 2024-06-25 18:26:07 -07:00
nu-cli Overhaul $in expressions (#13357) 2024-07-17 16:02:42 -05:00
nu-cmd-base Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00
nu-cmd-extra Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00
nu-cmd-lang don't allow break/continue in each and items command (#13398) 2024-07-19 00:21:02 -07:00
nu-cmd-plugin remove the deprecated register command (#13297) 2024-07-05 07:16:50 -05:00
nu-color-config Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00
nu-command generate: switch the position of <initial> and <closure>, so the closure can have default parameters (#13393) 2024-07-19 00:22:28 -07:00
nu-derive-value Bumping version to 0.95.1 (#13231) 2024-06-25 18:26:07 -07:00
nu-engine Overhaul $in expressions (#13357) 2024-07-17 16:02:42 -05:00
nu-explore Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00
nu-glob Bumping version to 0.95.1 (#13231) 2024-06-25 18:26:07 -07:00
nu-json Fix CI test failure on main (nu-json) (#13374) 2024-07-14 10:37:57 +02:00
nu-lsp Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00
nu-parser Overhaul $in expressions (#13357) 2024-07-17 16:02:42 -05:00
nu-path Switch from dirs_next 2.0 to dirs 5.0 (#13384) 2024-07-16 07:16:26 -05:00
nu-plugin Make plugins able to find and call other commands (#13407) 2024-07-19 13:54:21 +08:00
nu-plugin-core Add and use new Signals struct (#13314) 2024-07-07 22:29:01 +00:00
nu-plugin-engine Make plugins able to find and call other commands (#13407) 2024-07-19 13:54:21 +08:00
nu-plugin-protocol Make plugins able to find and call other commands (#13407) 2024-07-19 13:54:21 +08:00
nu-plugin-test-support Add and use new Signals struct (#13314) 2024-07-07 22:29:01 +00:00
nu-pretty-hex Bumping version to 0.95.1 (#13231) 2024-06-25 18:26:07 -07:00
nu-protocol Make plugins able to find and call other commands (#13407) 2024-07-19 13:54:21 +08:00
nu-std Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00
nu-system Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00
nu-table Fix issue with truncation when head on border is used (#13389) 2024-07-16 16:21:42 -05:00
nu-term-grid Add top-level crate documentation/READMEs (#12907) 2024-07-14 10:10:41 +02:00
nu-test-support Fix CI test failure on main (nu-json) (#13374) 2024-07-14 10:37:57 +02:00
nu-utils Make default config more consistent (#13399) 2024-07-17 18:52:47 -05:00
nuon Overhaul $in expressions (#13357) 2024-07-17 16:02:42 -05: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.