Repository navigation
Separate partitioning from globbing in cmdutil/args package and consumers - #3
Merged
iamazeem merged 2 commits intoMar 4, 2025
Conversation
…mers In the previous commit, GlobPaths was overloaded, containing logic specific to command use-cases. This commit removes that functionality from GlobPaths and back into the commands that have the special use-cases. To do this, I've introduced a new Partition util in cmdutil/args.go that will separate a slice into two slices given a predicate. This functionality is leveraged by both the special use-cases described above to separate the command-specific syntax from the globable filepaths.
iamazeem
merged commit Mar 4, 2025
0bb92c5
into
iamazeem:5099-gh-release-create-upload-expand-glob-patterns-on-windows
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.
Changes
In the previous commit, I think that
GlobPathswas overloaded, containing logic specific to command use-cases. This removes that functionality fromGlobPathsand puts it back into the commands that have the special use-cases.To do this, I've introduced a new
Partitionutil incmdutil/args.gothat will separate a slice into two slices given a predicate. This functionality is leveraged by both the special use-cases described above to separate the command-specific syntax from the globable filepaths.Notes
This change doesn't preserve the order of arguments in
gh gist create. Specifically, it'll move any passed in"-"to the end of the list of filepaths that are passed in as args. As far as I can tell, this shouldn't matter, and I've written a test to validate that hypothesis.Testing
The need for handling these special use-cases was indicated by failing unit tests. Thus, I'm using the tests as behavior validation in this PR.