Skip to content

Commit

Permalink
Merge pull request #272 from rsteube/macro-pass-arguments
Browse files Browse the repository at this point in the history
macro: pass positional arguments to script
  • Loading branch information
rsteube authored Mar 9, 2024
2 parents 76c9a66 + 636d1ba commit 0c69201
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ func shell(shell, command string) carapace.Action {
return carapace.ActionMessage("unsupported shell [%v]: %v", runtime.GOOS, shell)
}

return carapace.ActionExecCommand(shell, "-c", command)(func(output []byte) carapace.Action {
args := []string{"-c", command}
if shell != "pwsh" {
args = append(args, "--")
}
args = append(args, c.Args...)
return carapace.ActionExecCommand(shell, args...)(func(output []byte) carapace.Action {
lines := strings.Split(string(output), "\n")
batch := carapace.Batch()
for _, line := range lines {
Expand Down

0 comments on commit 0c69201

Please sign in to comment.