mirror of
https://github.com/chenasraf/wand.git
synced 2026-05-18 01:38:59 +00:00
21 lines
426 B
Go
21 lines
426 B
Go
package cmd
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func runShellCmd(cfg *Config, command string) func(*cobra.Command, []string) error {
|
|
return func(_ *cobra.Command, args []string) error {
|
|
shell := cfg.GetShell()
|
|
cmdArgs := append([]string{"-c", command}, args...)
|
|
cmd := exec.Command(shell, cmdArgs...)
|
|
cmd.Stdin = os.Stdin
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
return cmd.Run()
|
|
}
|
|
}
|