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
921 stars 63 forks source link

provide an environment variable with the temp directory name #146

Open jeff350 opened 5 months ago

jeff350 commented 5 months ago

Describe the solution you'd like add a XARGS_REPO_DIRECTORY variable to access the path of the temporary directory

Describe alternatives you've considered I can't find an easy way to access the path

Additional context I came across this issue while trying to use git-xargs to appy copier templates across a large number of repos. The issue is that copier requires both the template and target directory to be specified. Here copier's target directory needs to be git-args temp directory

osterman commented 4 months ago

Technically, this is already supported.

As you can see here it's just calling ioutil.TempDir which properly handles temp dir environment variables. (In my experience, most syscalls to get temporary directories respect some kind of env)

I was able to export TMPDIR on macOS and clone all repos to that directory, provided I created it first. This variable my differ based on OS.

jeff350 commented 4 months ago

@osterman Thank you for looking at the issue but this is not what I am trying to solve.

I am looking to expose the full path of the directory in /tmp that contains the repo currently being targeted as an environment variable that can be used inside the script that is ran by git-xargs.

I have opened #147 to implemented this feature and I am using it to meet my needs. it is just waiting on a review to get merged in.

osterman commented 4 months ago

Aha, my fault - I didn't catch that.