From 636d1bac71358f6828ec19f50e288af3bb07786c Mon Sep 17 00:00:00 2001 From: rsteube Date: Thu, 7 Mar 2024 13:21:10 +0100 Subject: [PATCH] macro: pass positional arguments to script --- core.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core.go b/core.go index 1bd2218..95dc459 100644 --- a/core.go +++ b/core.go @@ -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 {