-
Notifications
You must be signed in to change notification settings - Fork 371
/
Copy pathupgrade.go
46 lines (39 loc) · 1.1 KB
/
upgrade.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
package cmd
import (
"github.com/covexo/devspace/pkg/devspace/upgrade"
"github.com/covexo/devspace/pkg/util/log"
"github.com/spf13/cobra"
)
// UpgradeCmd is a struct that defines a command call for "upgrade"
type UpgradeCmd struct {
flags *UpgradeCmdFlags
}
// UpgradeCmdFlags are the flags available for the upgrade-command
type UpgradeCmdFlags struct {
}
func init() {
cmd := &UpgradeCmd{
flags: &UpgradeCmdFlags{},
}
cobraCmd := &cobra.Command{
Use: "upgrade",
Short: "Upgrade the devspace cli to the newest version",
Long: `
#######################################################
################## devspace upgrade ###################
#######################################################
Upgrades the devspace cli to the newest version
#######################################################`,
Args: cobra.NoArgs,
Run: cmd.Run,
}
rootCmd.AddCommand(cobraCmd)
}
// Run executes the command logic
func (cmd *UpgradeCmd) Run(cobraCmd *cobra.Command, args []string) {
log.StartFileLogging()
err := upgrade.Upgrade()
if err != nil {
log.Fatalf("Couldn't upgrade: %s", err.Error())
}
}