Comments (2)
I would like to expand upon @carusooo's idea (hello, fellow Andy 👋) by also exposing --dry-run
flag as environment variable, too. This is essential in order to build safe processes beyond changing content to know whether to affect change or not.
Looking at the code in repo-operations.go
, this should be fairly straight forward to include after setting cmd.Dir
:
git-xargs/repository/repo-operations.go
Lines 104 to 120 in c630589
Maybe this looks something like:
func executeCommandWithLogger(config *config.GitXargsConfig, repositoryDir string, repo *github.Repository, logger *logrus.Logger) error {
if len(config.Args) < 1 {
return errors.WithStackTrace(types.NoCommandSuppliedErr{})
}
cmdArgs := config.Args
cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...)
cmd.Dir = repositoryDir
cmd.Env = os.Environ()
cmd.Env = append(cmd.Environ(), fmt.Sprintf("XARGS_REPO_NAME=%s", repo.GetName()))
cmd.Env = append(cmd.Environ(), fmt.Sprintf("XARGS_DRY_RUN=%s", config.DryRun))
logger.WithFields(logrus.Fields{
"Repo": repo.GetName(),
"Directory": repositoryDir,
"Command": config.Args,
}).Debug("Executing command against local clone of repo...")
stdoutStdErr, err := cmd.CombinedOutput()
git-xargs --help
usage statement
$ git-xargs.exe --help
Usage: git-xargs.exe [--loglevel] [--github-org] [--draft] [--dry-run] [--skip-pull-requests] [--skip-archived-repos]
[--repo] [--repos] [--branch-name] [--base-branch-name] [--commit-message] [--pull-request-title]
[--pull-request-description] [--reviewers] [--team-reviewers] [--seconds-between-prs] [--max-pr-retries]
[--seconds-to-wait-when-rate-limited] [--no-skip-ci] [--keep-cloned-repositories] [--help] command [options] [args]
git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.
Commands:
help, h Shows a list of commands or help for one command
@zackproser : any particular concerns with this approach ☝️? should there be a prefix / namespace for the env vars to avoid clashing with other concerns?
from git-xargs.
from git-xargs.
Related Issues (20)
- Feature Request: Add option to change clone depth HOT 2
- Simplify re-running on repos that failed HOT 1
- git-xargs doesn't update existing PRs HOT 1
- New Parameter: wait time between pushes HOT 1
- Windows executable not working HOT 1
- panic: runtime error: invalid memory address or nil pointer dereference HOT 2
- Binaries not included in assets for latest release (v0.1.4) HOT 1
- Error "reference delta not found" when cloning repositories HOT 3
- Incorrect Usage. flag provided but not defined: -version
- Always generate the a summary of pull requests even if ones exist for the branch
- latest release missing binaries HOT 1
- Allow pushing branches to forks HOT 1
- use SSH for operations HOT 1
- The script succeeds but no changes on the actual repo. HOT 1
- Question: can specify a different directory to /tmp to clone? HOT 1
- Add the option for label(s)
- Feature request: Push to default branch if no --branch-name flag is supplied HOT 1
- Git-xargs execution hangs with no error message HOT 2
- Improve handling of Clone Repositories into temporary folders HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git-xargs.