github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/cmd/state/internal/cmdtree/push.go (about)

     1  package cmdtree
     2  
     3  import (
     4  	"github.com/ActiveState/cli/internal/captain"
     5  	"github.com/ActiveState/cli/internal/locale"
     6  	"github.com/ActiveState/cli/internal/primer"
     7  	"github.com/ActiveState/cli/internal/runners/push"
     8  	"github.com/ActiveState/cli/pkg/project"
     9  )
    10  
    11  func newPushCommand(prime *primer.Values) *captain.Command {
    12  	pushRunner := push.NewPush(prime)
    13  
    14  	params := push.PushParams{
    15  		Namespace: &project.Namespaced{},
    16  	}
    17  
    18  	return captain.NewCommand(
    19  		"push",
    20  		locale.Tl("push_title", "Pushing Local Project"),
    21  		locale.T("push_description"),
    22  		prime,
    23  		[]*captain.Flag{},
    24  		[]*captain.Argument{
    25  			{
    26  				Name:        locale.Tl("arg_state_push_namespace", "org/project"),
    27  				Description: locale.Tl("arg_state_push_namespace_description", "The project to push to (uses project under current dir otherwise)."),
    28  				Value:       params.Namespace,
    29  				Required:    false,
    30  			},
    31  		},
    32  		func(ccmd *captain.Command, args []string) error {
    33  			return pushRunner.Run(params)
    34  		},
    35  	).SetGroup(VCSGroup).SetSupportsStructuredOutput()
    36  }