Skip to content

Separate partitioning from globbing in cmdutil/args package and consumers - #3

Merged
iamazeem merged 2 commits into
iamazeem:5099-gh-release-create-upload-expand-glob-patterns-on-windowsfrom
cli:jtmcg/isolate-globbing-and-partitioning
Mar 4, 2025
Merged

iamazeem merged 2 commits into
iamazeem:5099-gh-release-create-upload-expand-glob-patterns-on-windowsfrom
cli:jtmcg/isolate-globbing-and-partitioning

Conversation

@jtmcg

@jtmcg jtmcg commented Feb 26, 2025

Copy link
Copy Markdown

Changes

In the previous commit, I think that GlobPaths was overloaded, containing logic specific to command use-cases. This removes that functionality from GlobPaths and puts it 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.

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.

…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
iamazeem merged commit 0bb92c5 into iamazeem:5099-gh-release-create-upload-expand-glob-patterns-on-windows Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants