/
start.go
48 lines (40 loc) · 914 Bytes
/
start.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package cmd
import (
"context"
"github.com/loft-sh/devpod-provider-civo/pkg/civo"
"github.com/loft-sh/devpod/pkg/log"
"github.com/loft-sh/devpod/pkg/provider"
"github.com/spf13/cobra"
)
// StartCmd holds the cmd flags
type StartCmd struct{}
// NewStartCmd defines a command
func NewStartCmd() *cobra.Command {
cmd := &StartCmd{}
startCmd := &cobra.Command{
Use: "start",
Short: "Start an instance",
RunE: func(_ *cobra.Command, args []string) error {
civoProvider, err := civo.NewProvider(log.Default)
if err != nil {
return err
}
return cmd.Run(
context.Background(),
civoProvider,
provider.FromEnvironment(),
log.Default,
)
},
}
return startCmd
}
// Run runs the command logic
func (cmd *StartCmd) Run(
ctx context.Context,
providerCivo *civo.CivoProvider,
machine *provider.Machine,
logs log.Logger,
) error {
return civo.Start(providerCivo)
}