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

Function NewInitCmd

cmd/init.go:74–104  ·  view source on GitHub ↗

NewInitCmd creates a new init command

(f factory.Factory)

Source from the content-addressed store, hash-verified

72
73// NewInitCmd creates a new init command
74func 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#######################################################
87Initializes a new devspace project within the current
88folder. 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
107func (cmd *InitCmd) Run(f factory.Factory) error {

Callers 1

BuildRootFunction · 0.85

Calls 3

RunMethod · 0.95
SetPluginCommandFunction · 0.92
GetLogMethod · 0.65

Tested by

no test coverage detected