Skip to content

Can't pass flags with = into script's main command #5532

@hustcer

Description

@hustcer

Describe the bug

Can't pass flags with = into script's main command

How to reproduce

# b.nu
def main [kernel: string, --version: string] {
    echo $kernel;
    echo $version
}

It's found that nu b.nu linux --version v5.2 works but nu b.nu linux --version=v5.2 does not work:

@hustcer ➜ tmp git(develop) $> nu b.nu linux --version v5.2
linux
v5.2

@hustcer ➜ tmp git(develop) $> nu b.nu linux --version=v5.2
Error: nu::parser::extra_positional (link)

  × Extra positional argument.
   ╭─[<commandline>:1:1]
 1 │ main "linux" "--version=v5.2"
   ·              ────────┬───────
   ·                      ╰── extra positional argument
   ╰────
  help: Usage: main {flags} <kernel>

Expected behavior

Both of them should work in the same way with the same output

Screenshots

No response

Configuration

key value
version 0.62.1
branch develop
tag
short_commit e9826233
commit_hash e98262330ebd1ef1fa7c85095cc0d887adde9b10
commit_date 2022-05-12 02:04:44 +00:00
build_os macos-x86_64
rust_version rustc 1.60.0 (7737e0b5c 2022-04-04)
rust_channel stable-x86_64-apple-darwin
cargo_version cargo 1.60.0 (d1fd9fe2c 2022-03-01)
pkg_version 0.62.1
build_time 2022-05-12 10:14:24 +08:00
build_rust_channel release
features database, dataframe, default, trash, which, zip
installed_plugins gstat, query, query json, query web, query xml

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:bugSomething isn't workingdeprecated:priority(deprecated: used infrequently) these issues are important

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions