NewInitCmd creates a new init command
(f factory.Factory)
| 72 | |
| 73 | // NewInitCmd creates a new init command |
| 74 | func NewInitCmd(f factory.Factory) *cobra.Command { |
| 75 | cmd := &InitCmd{ |
| 76 | log: f.GetLog(), |
| 77 | GlobalFlags: globalFlags, |
| 78 | } |
| 79 | |
| 80 | initCmd := &cobra.Command{ |
| 81 | Use: "init", |
| 82 | Short: "Initializes DevSpace in the current folder", |
| 83 | Long: ` |
| 84 | ####################################################### |
| 85 | #################### devspace init #################### |
| 86 | ####################################################### |
| 87 | Initializes a new devspace project within the current |
| 88 | folder. Creates a devspace.yaml as a starting point. |
| 89 | ####################################################### |
| 90 | `, |
| 91 | Args: cobra.NoArgs, |
| 92 | RunE: func(cobraCmd *cobra.Command, args []string) error { |
| 93 | plugin.SetPluginCommand(cobraCmd, args) |
| 94 | return cmd.Run(f) |
| 95 | }, |
| 96 | } |
| 97 | |
| 98 | initCmd.Flags().BoolVarP(&cmd.Reconfigure, "reconfigure", "r", false, "Change existing configuration") |
| 99 | initCmd.Flags().StringVar(&cmd.Context, "context", "", "Context path to use for intialization") |
| 100 | initCmd.Flags().StringVar(&cmd.Dockerfile, "dockerfile", helper.DefaultDockerfilePath, "Dockerfile to use for initialization") |
| 101 | initCmd.Flags().StringVar(&cmd.Provider, "provider", "", "The cloud provider to use") |
| 102 | |
| 103 | return initCmd |
| 104 | } |
| 105 | |
| 106 | // Run executes the command logic |
| 107 | func (cmd *InitCmd) Run(f factory.Factory) error { |
no test coverage detected