github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/cmd/state/internal/cmdtree/refresh.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/refresh" 8 "github.com/ActiveState/cli/pkg/project" 9 ) 10 11 func newRefreshCommand(prime *primer.Values) *captain.Command { 12 runner := refresh.New(prime) 13 14 params := &refresh.Params{ 15 Namespace: &project.Namespaced{AllowOmitOwner: true}, 16 } 17 18 cmd := captain.NewCommand( 19 "refresh", 20 "", 21 locale.Tl("refresh_description", "Updates the given project runtime based on its current configuration"), 22 prime, 23 []*captain.Flag{}, 24 []*captain.Argument{ 25 { 26 Name: locale.T("arg_state_activate_namespace"), 27 Description: locale.Tl("arg_state_refresh_namespace_description", "The namespace of the project to update, or just the project name if previously used"), 28 Value: params.Namespace, 29 }, 30 }, 31 func(_ *captain.Command, _ []string) error { 32 return runner.Run(params) 33 }, 34 ) 35 cmd.SetGroup(EnvironmentUsageGroup) 36 cmd.SetSupportsStructuredOutput() 37 return cmd 38 }