From 46bbc9273f52a922c6071d43dd1f7a7e538d8a81 Mon Sep 17 00:00:00 2001 From: ysicing Date: Mon, 13 Jan 2025 11:32:04 +0800 Subject: [PATCH] * [feat] add option to toggle GitHub version usage in checks --- cmd/upgrade/q.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/upgrade/q.go b/cmd/upgrade/q.go index 4b0a2396..6ab01574 100644 --- a/cmd/upgrade/q.go +++ b/cmd/upgrade/q.go @@ -25,8 +25,9 @@ import ( ) type option struct { - log log.Logger - dev bool + log log.Logger + dev bool + useGithub bool } func NewUpgradeQ(f factory.Factory) *cobra.Command { @@ -43,12 +44,17 @@ func NewUpgradeQ(f factory.Factory) *cobra.Command { }, } upq.Flags().BoolVarP(&up.dev, "dev", "", false, "upgrade to dev version") + upq.Flags().BoolVarP(&up.useGithub, "github", "", false, "upgrade to github version") return upq } func (up option) DoQcadmin() { up.log.StartWait("fetch latest version from remote...") - lastVersion, lastType, err := version.PreCheckLatestVersion(up.log, up.dev, "") + st := "" + if up.useGithub { + st = "github" + } + lastVersion, lastType, err := version.PreCheckLatestVersion(up.log, up.dev, st) up.log.StopWait() if err != nil { up.log.Errorf("fetch latest version err, reason: %v", err)