Run starts the given command with the arguments in the context and waits for it to complete.
(ctx *cli.Context, file string)
| 54 | // Run starts the given command with the arguments in the context and waits for |
| 55 | // it to complete. |
| 56 | func Run(ctx *cli.Context, file string) error { |
| 57 | args := ctx.Args() |
| 58 | cmdName := file |
| 59 | |
| 60 | // if running on Windows and (likely) a PowerShell script, invoke powershell |
| 61 | // with the arguments instead of the plugin file directly. |
| 62 | if runtime.GOOS == "windows" && strings.ToLower(filepath.Ext(file)) == ".ps1" { |
| 63 | cmdName = "powershell" |
| 64 | args = append([]string{args[0], "-noprofile", "-nologo", file}, args[1:]...) |
| 65 | } |
| 66 | |
| 67 | cmd := exec.Command(cmdName, args[1:]...) |
| 68 | cmd.Stdin = os.Stdin |
| 69 | cmd.Stdout = os.Stdout |
| 70 | cmd.Stderr = os.Stderr |
| 71 | return cmd.Run() |
| 72 | } |
| 73 | |
| 74 | // GetURL returns the project or the download URL of a well-known plugin. |
| 75 | func GetURL(name string) string { |