Skip to content

Broken commandline arg types #5753

@sophiajt

Description

@sophiajt

Describe the bug

One of the features we added with 0.60 is to be able to run scripts against values the user passes, including support for the types that Nushell allows. This lets you run something like this:

def main [x: int] {
  $x + 10
}

With:

nu myscript 100

Recent Nushell versions currently wrap the 100 in quotes, which breaks the the support.

Bisect points to:
Date: Sun May 1 03:23:05 2022 +0900

Fix quoting for command line args (#5384)

* Fix quoting for command line args

* Replace custom quoting with escape_quote_string

* Use raw string for now

How to reproduce

See above

Expected behavior

We should not wrap quotes around everything and lose the original type information. Quotes should only wrap around values that would otherwise be invalid without them.

Screenshots

No response

Configuration

key value
version 0.63.1
branch main
commit_hash d44059c
build_os macos-aarch64
build_target aarch64-apple-darwin
rust_version rustc 1.61.0 (fe5b13d68 2022-05-18)
rust_channel stable-aarch64-apple-darwin
cargo_version cargo 1.61.0 (a028ae42f 2022-04-29)
pkg_version 0.63.1
build_time 2022-06-11 07:40:17 +12:00
build_rust_channel debug
features default, trash, which, zip
installed_plugins gstat

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