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 init() { flags := []cli.Flag{ cli.StringFlag{ Name: "service, n", Value: defaultServiceName, Usage: "Specify service name to use", }, } installFlags := flags installFlags = append(installFlags, cli.StringFlag{ Name: "working-directory, d", Value: helpers.GetCurrentWorkingDirectory(), Usage: "Specify custom root directory where all data are stored", }) installFlags = append(installFlags, cli.StringFlag{ Name: "config, c", Value: getDefaultConfigFile(), Usage: "Specify custom config file", }) if runtime.GOOS == "windows" { installFlags = append(installFlags, cli.StringFlag{ Name: "user, u", Value: "", Usage: "Specify user-name to secure the runner", }) installFlags = append(installFlags, cli.StringFlag{ Name: "password, p", Value: "", Usage: "Specify user password to install service (required)", }) } else if os.Getuid() == 0 { installFlags = append(installFlags, cli.StringFlag{ Name: "user, u", Value: "", Usage: "Specify user-name to secure the runner", }) } common.RegisterCommand(cli.Command{ Name: "install", Usage: "install service", Action: RunServiceControl, Flags: installFlags, }) common.RegisterCommand(cli.Command{ Name: "uninstall", Usage: "uninstall service", Action: RunServiceControl, Flags: flags, }) common.RegisterCommand(cli.Command{ Name: "start", Usage: "start service", Action: RunServiceControl, Flags: flags, }) common.RegisterCommand(cli.Command{ Name: "stop", Usage: "stop service", Action: RunServiceControl, Flags: flags, }) common.RegisterCommand(cli.Command{ Name: "restart", Usage: "restart service", Action: RunServiceControl, Flags: flags, }) common.RegisterCommand(cli.Command{ Name: "status", Usage: "get status of a service", Action: RunServiceControl, Flags: flags, }) }