nushell / nushell/nushell

Specify units for `into filesize`

Open
#15,007 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

category:enhancement
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 14h
Merged PRs (30d)
79

Description

Related problem

Some programs report filesize units differently from Nushell. The string "10G" is always interpreted as 10 gigabytes, but some programs (for example, zfs list) intend 10G to instead be interpreted as 10 gibibytes.

Describe the solution you'd like

into filesize should have a flag like --force-binary, or --force=metric and --force=binary to force interpreting ambiguous units as metric or binary

"10MB" | into filesize --force=metric | format filesize B
# => 10000000 B
"10MB" | into filesize --force=binary | format filesize B
# => 10485760 B
Describe alternatives you've considered

Adding iB to the end of a string, but this is a bit hacky

Additional context and details

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the into filesize command and any existing tests for filesize parsing. Compare the current handling of ambiguous units with the metric and binary outcomes shown in the issue. Done means a supported option consistently selects the requested interpretation while preserving explicit units such as iB.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.