Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cobra.Command{ Use: "update <version>", Short: "update FuncEasy in kubernetes", Long: `update command allows user to update FuncEasy Resources to a available version`, Run: func(cmd *cobra.Command, args []string) { t := terminal.NewTerminalPrint() filePath, err := cmd.Flags().GetString("file") if err != nil { t.PrintErrorOneLineWithExit(err) } currentVersion := pkg.GetCurrentVersion() if currentVersion == "" { t.PrintWarnOneLine("Not Install") t.LineEnd() return } var fileByte []byte if filePath != "" && len(args) == 0 { fileByte, err = ioutil.ReadFile(filePath) if err != nil { t.PrintErrorOneLineWithExit("Read Yaml File Error: ", err) } } else if filePath == "" && len(args) == 1 { version := args[0] downloadUrl := "" r, _ := regexp.Compile("^(.+).yaml$") if version == "latest" { release := release.GetLatestRelease() for _, asset := range release.Assets { if r.MatchString(asset.Name) { downloadUrl = asset.Download } } } else { list := release.GetRelease() for _, item := range list { if item.Name == version { for _, asset := range item.Assets { if r.MatchString(asset.Name) { downloadUrl = asset.Download } } } } } if downloadUrl == "" { t.PrintErrorOneLineWithExit("Version Not Found: ", version) } fileByte = release.Download(downloadUrl) } else { t.PrintErrorOneLineWithExit("Use arg <version> or flags [--file] ") } err = pkg.UpdateFuncEasyResources(fileByte) if err != nil { t.PrintErrorOneLineWithExit(err) } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.