NewUICmd creates a new ui command
(f factory.Factory, globalFlags *flags.GlobalFlags)
| 41 | |
| 42 | // NewUICmd creates a new ui command |
| 43 | func 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 | ####################################################### |
| 56 | Opens 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" |
| 74 | func (cmd *UICmd) RunUI(f factory.Factory) error { |
no test coverage detected