MCPcopy Index your code
hub / github.com/devspace-sh/devspace / NewUICmd

Function NewUICmd

cmd/ui.go:43–71  ·  view source on GitHub ↗

NewUICmd creates a new ui command

(f factory.Factory, globalFlags *flags.GlobalFlags)

Source from the content-addressed store, hash-verified

41
42// NewUICmd creates a new ui command
43func NewUICmd(f factory.Factory, globalFlags *flags.GlobalFlags) *cobra.Command {
44 cmd := &UICmd{
45 GlobalFlags: globalFlags,
46 log: log.GetInstance(),
47 }
48
49 uiCmd := &cobra.Command{
50 Use: "ui",
51 Short: "Opens the localhost UI in the browser",
52 Long: `
53#######################################################
54##################### devspace ui #####################
55#######################################################
56Opens the localhost UI in the browser
57#######################################################
58 `,
59 Args: cobra.NoArgs,
60 RunE: func(cobraCmd *cobra.Command, args []string) error {
61 plugin.SetPluginCommand(cobraCmd, args)
62 return cmd.RunUI(f)
63 },
64 }
65
66 uiCmd.Flags().StringVar(&cmd.Host, "host", "localhost", "The host to use when opening the ui server")
67 uiCmd.Flags().IntVar(&cmd.Port, "port", 0, "The port to use when opening the ui server")
68 uiCmd.Flags().BoolVar(&cmd.ForceServer, "server", false, "If enabled will force start a server (otherwise an existing UI server is searched)")
69 uiCmd.Flags().BoolVar(&cmd.Dev, "dev", false, "Ignore errors when downloading UI")
70 return uiCmd
71}
72
73// RunUI executes the functionality "devspace ui"
74func (cmd *UICmd) RunUI(f factory.Factory) error {

Callers 1

BuildRootFunction · 0.85

Calls 3

RunUIMethod · 0.95
GetInstanceFunction · 0.92
SetPluginCommandFunction · 0.92

Tested by

no test coverage detected