Skip to content

Commit

Permalink
macro: pass positional arguments to script
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Mar 9, 2024
1 parent 76c9a66 commit 636d1ba
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 636d1ba

Please sign in to comment.