func (s *RegisterCommand) askExecutor() { for { names := common.GetExecutors() executors := strings.Join(names, ", ") s.Executor = s.ask("executor", "Please enter the executor: "+executors+":", true) if common.GetExecutor(s.Executor) != nil { return } message := "Invalid executor specified" if s.NonInteractive { log.Panicln(message) } else { log.Errorln(message) } } }
func init() { cmd := &ExecCommand{} flags := clihelpers.GetFlagsFromStruct(cmd) cliCmd := cli.Command{ Name: "exec", Usage: "execute a build locally", } for _, executor := range common.GetExecutors() { subCmd := cli.Command{ Name: executor, Usage: "use " + executor + " executor", Action: cmd.Execute, Flags: flags, } cliCmd.Subcommands = append(cliCmd.Subcommands, subCmd) } common.RegisterCommand(cliCmd) }
func TestVirtualBoxExecutorRegistered(t *testing.T) { executors := common.GetExecutors() assert.Contains(t, executors, "virtualbox") }
func TestParallelsExecutorRegistered(t *testing.T) { executors := common.GetExecutors() assert.Contains(t, executors, "parallels") }