github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/cmd/state/internal/cmdtree/reset.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/reset"
     8  )
     9  
    10  func newResetCommand(prime *primer.Values, globals *globalOptions) *captain.Command {
    11  	runner := reset.New(prime)
    12  	params := &reset.Params{}
    13  
    14  	return captain.NewCommand(
    15  		"reset",
    16  		locale.Tl("reset_title", "Reset to a Commit"),
    17  		locale.Tl("reset_description", "Reset local checkout to a particular commit."),
    18  		prime,
    19  		[]*captain.Flag{},
    20  		[]*captain.Argument{
    21  			{
    22  				Name:        locale.Tl("arg_state_reset_commitid", "CommitID"),
    23  				Description: locale.Tl("arg_state_reset_commitid_description", "Reset to the given commit. If not specified, resets local checkout to be equal to the project on the platform"),
    24  				Value:       &params.CommitID,
    25  			},
    26  		},
    27  		func(ccmd *captain.Command, args []string) error {
    28  			params.Force = globals.NonInteractive
    29  			return runner.Run(params)
    30  		},
    31  	).SetGroup(VCSGroup).SetSupportsStructuredOutput()
    32  }