Specify units for `into filesize`
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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