nushell/crates
Devyn Cairns 01891d637d
Make parsing for unknown args in known externals like normal external calls (#13414)
# Description

This corrects the parsing of unknown arguments provided to known
externals to behave exactly like external arguments passed to normal
external calls.

I've done this by adding a `SyntaxShape::ExternalArgument` which
triggers the same parsing rules.

Because I didn't like how the highlighting looked, I modified the
flattener to emit `ExternalArg` flat shapes for arguments that have that
syntax shape and are plain strings/globs. This is the same behavior that
external calls have.

Aside from passing the tests, I've also checked manually that the
completer seems to work adequately. I can confirm that specified
positional arguments get completion according to their specified type
(including custom completions), and then anything remaining gets
filepath style completion, as you'd expect from an external command.

Thanks to @OJarrisonn for originally finding this issue.

# User-Facing Changes

- Unknown args are now parsed according to their specified syntax shape,
rather than `Any`. This may be a breaking change, though I think it's
extremely unlikely in practice.
- The unspecified arguments of known externals are now highlighted /
flattened identically to normal external arguments, which makes it more
clear how they're being interpreted, and should help the completer
function properly.
- Known externals now have an implicit rest arg if not specified named
`args`, with a syntax shape of `ExternalArgument`.

# Tests + Formatting
Tests added for the new behaviour. Some old tests had to be corrected to
match.

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting
- [ ] release notes (bugfix, and debatable whether it's a breaking
change)
2024-07-21 01:32:36 -07:00
..
nu-cli Use directories for autoloading (#13382) 2024-07-19 03:47:07 -07: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 add --quiet flag to watch command (#13415) 2024-07-20 12:34:27 +02: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 Make parsing for unknown args in known externals like normal external calls (#13414) 2024-07-21 01:32:36 -07: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 parsing for unknown args in known externals like normal external calls (#13414) 2024-07-21 01:32:36 -07: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
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
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.