gruntwork-io / git-xargs

git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.
https://blog.gruntwork.io/introducing-git-xargs-an-open-source-tool-to-update-multiple-github-repos-753f9f3675ec
Apache License 2.0
935 stars 62 forks source link

git-xargs: consider more unix-y approach, decomposing into pipelines #10

Closed zackproser closed 1 year ago

zackproser commented 3 years ago

Jim's thinking:

"Should this tool do more to be "unix philosophy friendly"? E.g., Normally, you pipe things into the real xargs. Does that make sense to do here?

I'm just thinking out loud if there is some pattern like:

git-xargs list-repos gruntwork-io | xargs <SOME SCRIPT TO RUN IN EACH REPO> | git-xargs open-prs

In the Unix Philosophy spirit of “do one thing and do it well” and handling output via stdin/stdout, would it make sense to have:
A CLI tool called something like multi-git which can perform Git operations on multiple repos.
You run multi-git clone-to-temp and give it a GitHub org or list of repos to clone. It clones them to temp folders and writes the folder paths to stdout.
Pipe the output from multi-git into plain old xargs to execute some script in each of those folders.
Pipe the output from that—actually, I’m not sure what xargs produces as stdout, but let’s assume it’s the same list of temp folder paths—to multi-git commit-and-pr-if-necessary.

Advantages:
clone-to-temp and commit-and-pr-if-necessary might be useful in and of themselves in a variety of contexts.
More Unix-like approach to solving this problem.
Drawbacks:
Much harder to get started with this
Prob doesn’t work on Windows
Prob harder to handle certain corner cases
jphuynh commented 3 years ago

This is an interesting one. I agree that it looks like the number of flags we can pass to git-xargs will increase considerably as the project grows and will hurt the user experience.

I was starting to think we should implement some kind of config file that git-xargs would parse and run the appropriate commands but I like the suggested approach with git-xargs <action/function>.

It will also benefit some other feature requests like https://github.com/gruntwork-io/git-xargs/issues/39 where I thought a --pull-request-force flag could help but also adding to a list of already growing number of flags.

zackproser commented 1 year ago

Closing as I'm no longer working at Gruntwork and this issue is stale.