Skip to content

options are broken? #10450

@amtoine

Description

@amtoine

related to

Describe the bug

@WindSoilder
i think #10424 did break Nushell options 😢

How to reproduce

  1. define
def foo [--option: bool = false] { $option }

before

> foo
false
> foo --option
Error: nu::parser::missing_flag_param

  × Missing flag argument.
   ╭─[entry #8:1:1]
 1  foo --option
   ·     ────┬───
   ·         ╰── flag missing bool argument
   ╰────
> foo --option true
true

after

> foo
false
> foo --option
false
> foo --option false
Error: nu::parser::extra_positional

  × Extra positional argument.
   ╭─[entry #4:1:1]
 1  foo --option false
   ·              ──┬──
   ·                ╰── extra positional argument
   ╰────
  help: Usage: foo {flags}

Expected behavior

i think i expected

foo --option

to give true and

foo --option false

to not give an error

Screenshots

No response

Configuration

key value
version 0.85.1
branch
commit_hash 989a147
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.70.0 (90c541806 2023-05-31)
rust_channel 1.70.0-x86_64-unknown-linux-gnu
cargo_version cargo 1.70.0 (ec8a8a0ca 2023-04-25)
build_time 2023-09-20 22:42:11 +02:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash, which, zip
installed_plugins gstat, nu_plugin_explore

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:parserIssues related to parsing

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions