Skip to content

Panick when a call to a custom command with many arguments is typed in interactively #12069

@robaca

Description

@robaca

Describe the bug

When trying to call amcustom command with many arguments via the command line, Nushell is panicking.

How to reproduce

# Start a nested shell
nu 

# Then register a custom command with many args
def "a" [ b: string, c: string, d: string, e: string, f: string, g: string ] {}

# Then type in the following:
a b c d e

When pressing the 'e', you will get a panick error and the subshell is exiting:

thread 'main' panicked at crates/nu-parser/src/parser.rs:777:28:
index out of bounds: the len is 2 but the index is 3
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior

don't panick ;-)

Screenshots

image

Configuration

key value
version 0.90.1
branch
commit_hash
build_os macos-aarch64
build_target aarch64-apple-darwin
rust_version rustc 1.75.0 (82e1608df 2023-12-21) (built from a source tarball)
cargo_version cargo 1.75.0
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash, which, zip
installed_plugins

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:parserIssues related to parsingcategory:bugSomething isn't workingdeprecated:duplicate(deprecated: use GitHub's "close as duplicate" feature) This issue is a duplicate of another issuepanic

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions