Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(foreach): supports quoted commands #132

Merged
merged 4 commits into from
May 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmd/foreach/foreach.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,16 @@ func run(c *cobra.Command, args []string) {
}
readCampaignActivity.EndWithSuccess()

for i := range args {
if strings.Contains(args[i], " ") {
args[i] = "\"" + args[i] + "\""
sledigabel marked this conversation as resolved.
Show resolved Hide resolved
}
}
command := strings.Join(args, " ")

var doneCount, skippedCount, errorCount int
for _, repo := range dir.Repos {
repoDirPath := path.Join("work", repo.OrgName, repo.RepoName) // i.e. work/org/repo
command := strings.Join(args, " ")

execActivity := logger.StartActivity("Executing %s in %s", command, repoDirPath)

Expand Down