Skip to content

into filesize can't handle the + sign #12968

Closed

Description

@Schweber

Describe the bug

$ "+8 KiB" | into filesize                                                                                                         
Error: nu::shell::cant_convert

  × Can't convert to int.
   ╭─[entry #31:1:1]
 1 │ "+8 KiB" | into filesize
   · ────┬───
   ·     ╰── can't convert string to int
   ╰────

@IanManske

How to reproduce

  1. "+8 KiB" | into filesize

Expected behavior

Handle the + sign correctly. The - sign is already handled correctly.

Screenshots

No response

Configuration

key value
version 0.93.0
major 0
minor 93
patch 0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.77.2 (25ef9e3d8 2024-04-09) (built from a source tarball)
cargo_version cargo 1.77.1
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, system-clipboard, trash, which
installed_plugins

Additional context

No response

Activity

  1. added
    status:needs-triage
    on May 25, 2024
  2. added
    good first issue
    polish
    and removed
    status:needs-triage
    on May 25, 2024
  3. hqsz commented on May 26, 2024

    @hqsz
    Contributor

    I made PR to resolve this issue! Thanks for reporting :)

  4. hqsz commented on May 26, 2024

    @hqsz
    Contributor

    While making patch for upper PR, I found explicit plus sign character can't be used with filesize type. Is it expected behavior or should i make another issue?

    $ 3Kib | into filesize
    3.0 KiB
    $ +3Kib | into filesize
    Error: nu::shell::external_command
    
      × External command failed
       ╭─[entry #2:1:1]
     1 │ +3Kib | into filesize
       · ──┬──
       ·   ╰── Command `+3Kib` not found
       ╰────
      help: `+3Kib` is neither a Nushell built-in or a known external command
    
  5. IanManske commented on May 26, 2024

    @IanManske
    Member

    Sure, feel free to open another issue. I see no reason why this should be disallowed.

  6. added this to the v0.95.0 milestone on Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issuepolish

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions