Repository navigation
feat(chunks, first, last, take, drop and skip): arg can now also be a filesize for binary - #18511
Merged
Merged
Conversation
Member
|
This is a really nice change, surprising that we didn't already have it. Can you split the parser change into a separate PR? While it's also a nice change, it doesn't seem strictly necessary for this PR to work and I would prefer to have it separate since parser changes can have unexpected effects. Other than that I have two suggestions:
|
chunks): chunk size can now also be a filesizechunks, first, last, take, drop and skip): arg can now also be a filesize for binary
Contributor
Author
Bahex
pushed a commit
that referenced
this pull request
Jul 12, 2026
## Description Makes the negative number or short flag detection work with `OneOff` when the options can be negative numbers, necessary for the tests on #18511 to pass. ## User-facing changes (Release notes) Parameters with `int`, `float` and `number` types can be supplied negative arguments: ```nushell def foo [p: int] { $p } foo -2 # => -2 ``` However this didn't work with parameters with types like `oneof<int, ...>`: ```nushell def foo [p: <int, string>] { $p } foo -2 # => Error: nu::parser::unknown_flag # => # => × The `foo` command doesn't have flag `-2`. # => ╭─[repl_entry #1:3:6] # => 2 │ # => 3 │ foo -2 # => · ┬ # => · ╰── unknown flag # => ╰──── # => help: Use `--help` to see available flags ``` This is now fixed: ```nushell def foo [p: <int, string>] { $p } foo -2 # => -2 ``` ## Additional notes N/A
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
chunks,first,last,take,dropandskipnow takesoneof<int, filesize>, making using them with binary easier, previously you could just dochunks (10MiB | into int)but I think this change makes sense for binary data.User-facing changes (Release notes)
dropnow supportsbinaryinputs as wellchunks,first,last,take,skipanddropcan now be used with afilesizeargumentsThese commands can work on
binarydata, it only makes sense for them to work with not justintbutfilesizearguments as well:Additional notes
Needs to be merged from or rebased onto
mainafter #18514 is merged.