Skip to content

allow empty string arguments - #9420

Merged
fdncred merged 1 commit into
nushell:mainfrom
fdncred:allow_empty_string_args
Jun 13, 2023
Merged

fdncred merged 1 commit into
nushell:mainfrom
fdncred:allow_empty_string_args

Conversation

@fdncred

@fdncred fdncred commented Jun 12, 2023

Copy link
Copy Markdown
Contributor

Description

I'm not sure if this is a good idea or now but I did it to fix #9418. It allows you to pass empty string arguments like this.

file named foo.nu

def main [--arg: string = dog] {
  if ($arg | is-empty) {
    echo "empty string"
  } else {
   echo $arg
  }
}

> nu foo.nu --arg ""
or
> nu foo.nu --arg=""
this gives an error
> nu foo.nu --arg
this returns the default argument
> nu foo.nu

closes #9418

User-Facing Changes

Tests + Formatting

After Submitting

@fdncred
fdncred merged commit 30f4cc1 into nushell:main Jun 13, 2023
@fdncred
fdncred deleted the allow_empty_string_args branch June 13, 2023 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nushell script call nu cannot parse empty string argument

1 participant