// NewCommand ready to run
188974
func NewCommand(cmd *exec.Cmd) Command {
	return Command{
		Command: cmd,
		Should:  nullShould,
	}
}
959210
func (a *Application) AddCommand(command Command) {
	a.Commands = append(a.Commands, command)

	newCmd := &a.Commands[len(a.Commands)-1]
	if newCmd.Group != "" {
		group := a.groupByName(newCmd.Group)
		if group == nil {
			panic("group doesn't exist")
		}

		group.Commands = append(group.Commands, newCmd)
	} else {
		a.ungroupedCmdsCount++
	}
}
240262
func NewCommand(ctx *plan.Context, p *plan.Command) *Command {
	m := &Command{
		TaskBase: NewTaskBase(ctx),
		p:        p,
	}
	return m
}
149334
func Ready(count int) *Command {
	var params = [][]byte{[]byte(strconv.Itoa(count))}
	return &Command{[]byte("RDY"), params, nil}
}
318502
func NewCommand(p *Program) *cobra.Command {
	var cmd = &cobra.Command{
		Use:  p.Name,
		Args: cobra.NoArgs,
		RunE: func(_ *cobra.Command, _ []string) error {
			return p.Run()
		},
	}

	viper.SetEnvPrefix(strings.ToUpper(p.Name))
	viper.AutomaticEnv()
	// This normalizes "-" to an underscore in env names.
	viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))

	for _, o := range p.Opts {
		switch o.DestP.(type) {
		case *string:
			if o.Default == nil {
				o.Default = ""
			}
			cmd.Flags().StringVar(o.DestP.(*string), o.Flag, o.Default.(string), o.Desc)
			viper.BindPFlag(o.Flag, cmd.Flags().Lookup(o.Flag))
			*o.DestP.(*string) = viper.GetString(o.Flag)
		case *int:
			if o.Default == nil {
				o.Default = 0
			}
			cmd.Flags().IntVar(o.DestP.(*int), o.Flag, o.Default.(int), o.Desc)
			viper.BindPFlag(o.Flag, cmd.Flags().Lookup(o.Flag))
			*o.DestP.(*int) = viper.GetInt(o.Flag)
		case *bool:
			if o.Default == nil {
				o.Default = false
			}
			cmd.Flags().BoolVar(o.DestP.(*bool), o.Flag, o.Default.(bool), o.Desc)
			viper.BindPFlag(o.Flag, cmd.Flags().Lookup(o.Flag))
			*o.DestP.(*bool) = viper.GetBool(o.Flag)
		case *time.Duration:
			if o.Default == nil {
				o.Default = time.Duration(0)
			}
			cmd.Flags().DurationVar(o.DestP.(*time.Duration), o.Flag, o.Default.(time.Duration), o.Desc)
			viper.BindPFlag(o.Flag, cmd.Flags().Lookup(o.Flag))
			*o.DestP.(*time.Duration) = viper.GetDuration(o.Flag)
		case *[]string:
			if o.Default == nil {
				o.Default = []string{}
			}
			cmd.Flags().StringSliceVar(o.DestP.(*[]string), o.Flag, o.Default.([]string), o.Desc)
			viper.BindPFlag(o.Flag, cmd.Flags().Lookup(o.Flag))
			*o.DestP.(*[]string) = viper.GetStringSlice(o.Flag)
		default:
			// if you get a panic here, sorry about that!
			// anyway, go ahead and make a PR and add another type.
			panic(fmt.Errorf("unknown destination type %t", o.DestP))
		}
	}

	return cmd
}
391690
func NewCmd(traefikConfiguration *cmd.TraefikConfiguration, traefikPointersConfiguration *cmd.TraefikConfiguration) *flaeg.Command {
	return &flaeg.Command{
		Name:                  "healthcheck",
		Description:           `Calls traefik /ping to check health (web provider must be enabled)`,
		Config:                traefikConfiguration,
		DefaultPointersConfig: traefikPointersConfiguration,
		Run:                   runCmd(traefikConfiguration),
		Metadata: map[string]string{
			"parseAllSources": "true",
		},
	}
}
149773
func NewDeleteCommand() *cobra.Command {
	var (
		all       bool
		completed bool
		older     string
	)

	var command = &cobra.Command{
		Use:   "delete WORKFLOW",
		Short: "delete a workflow and its associated pods",
		Run: func(cmd *cobra.Command, args []string) {
			wfClient = InitWorkflowClient()
			if all {
				deleteWorkflows(metav1.ListOptions{}, nil)
			} else if older != "" {
				olderTime, err := argotime.ParseSince(older)
				if err != nil {
					log.Fatal(err)
				}
				deleteWorkflows(completedWorkflowListOption, olderTime)
			} else if completed {
				deleteWorkflows(completedWorkflowListOption, nil)
			} else {
				if len(args) == 0 {
					cmd.HelpFunc()(cmd, args)
					os.Exit(1)
				}
				for _, wfName := range args {
					deleteWorkflow(wfName)
				}
			}
		},
	}

	command.Flags().BoolVar(&all, "all", false, "Delete all workflows")
	command.Flags().BoolVar(&completed, "completed", false, "Delete completed workflows")
	command.Flags().StringVar(&older, "older", "", "Delete completed workflows older than the specified duration (e.g. 10m, 3h, 1d)")
	return command
}
1263414
func (o *NSGateway) CreateCommand(child *Command) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
873029
func NewCmd(cmdLine string) (*Cmd, error) {

	parseCmd, err := shellwords.Parse(cmdLine)
	if err != nil {
		return nil, err
	}
	return &Cmd{Cmd: exec.Command(parseCmd[0], parseCmd[1:]...)}, nil
}
581910
func NewCmd(cmd *exec.Cmd) *Cmd {
	c := &Cmd{
		Cmd:     cmd,
		stopped: make(chan struct{}, 1),
	}
	c.stoppingValue.Store(false)
	c.Stdout = os.Stdout
	c.Stderr = os.Stderr
	return c
}
419580
func NewCommand() *cobra.Command {
	var (
		clientOpts argocdclient.ClientOptions
		pathOpts   = clientcmd.NewDefaultPathOptions()
	)

	var command = &cobra.Command{
		Use:   cliName,
		Short: "argocd controls a Argo CD server",
		Run: func(c *cobra.Command, args []string) {
			c.HelpFunc()(c, args)
		},
	}

	command.AddCommand(NewVersionCmd(&clientOpts))
	command.AddCommand(NewClusterCommand(&clientOpts, pathOpts))
	command.AddCommand(NewApplicationCommand(&clientOpts))
	command.AddCommand(NewLoginCommand(&clientOpts))
	command.AddCommand(NewReloginCommand(&clientOpts))
	command.AddCommand(NewRepoCommand(&clientOpts))
	command.AddCommand(NewContextCommand(&clientOpts))
	command.AddCommand(NewProjectCommand(&clientOpts))
	command.AddCommand(NewAccountCommand(&clientOpts))

	defaultLocalConfigPath, err := localconfig.DefaultLocalConfigPath()
	errors.CheckError(err)
	command.PersistentFlags().StringVar(&clientOpts.ConfigPath, "config", config.GetFlag("config", defaultLocalConfigPath), "Path to Argo CD config")
	command.PersistentFlags().StringVar(&clientOpts.ServerAddr, "server", config.GetFlag("server", ""), "Argo CD server address")
	command.PersistentFlags().BoolVar(&clientOpts.PlainText, "plaintext", config.GetBoolFlag("plaintext"), "Disable TLS")
	command.PersistentFlags().BoolVar(&clientOpts.Insecure, "insecure", config.GetBoolFlag("insecure"), "Skip server certificate and domain verification")
	command.PersistentFlags().StringVar(&clientOpts.CertFile, "server-crt", config.GetFlag("server-crt", ""), "Server certificate file")
	command.PersistentFlags().StringVar(&clientOpts.AuthToken, "auth-token", config.GetFlag("auth-token", ""), "Authentication token")
	command.PersistentFlags().BoolVar(&clientOpts.GRPCWeb, "grpc-web", config.GetBoolFlag("grpc-web"), "Enables gRPC-web protocol. Useful if Argo CD server is behind proxy which does not support HTTP2.")
	command.PersistentFlags().StringVar(&logLevel, "loglevel", config.GetFlag("loglevel", "info"), "Set the logging level. One of: debug|info|warn|error")
	return command
}
255422
func newBenchCommand(m *Main) *BenchCommand {
	return &BenchCommand{
		Stdin:  m.Stdin,
		Stdout: m.Stdout,
		Stderr: m.Stderr,
	}
}
1336854
func NewCommand(text string, description string, handler Handler) Command {
	cmd := Command{}
	cmd.Set(allot.New(text))
	cmd.SetDescription(description)
	cmd.SetHandler(handler)

	return cmd
}
609690
func (c *commander) AddCommand(name string, command func(map[string]interface{}) interface{}) {
	c.commands[name] = command
}
1261260
func NewCommand(ctx Context, name string) (cmd.Command, error) {
	f := allEnabledCommands()[name]
	if f == nil {
		return nil, errors.Errorf("unknown command: %s", name)
	}
	command, err := f(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return command, nil
}
701694
func NewPoolCreateCommand() cmd.Command {
	cmd := &poolCreateCommand{}
	cmd.newAPIFunc = func() (PoolCreateAPI, error) {
		return cmd.NewStorageAPI()
	}
	return modelcmd.Wrap(cmd)
}
988768
func NewConfigCommand(stdin io.Reader, stdout, stderr io.Writer) *ConfigCommand {
	return &ConfigCommand{
		CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr),
	}
}