Skip to content

Commit

Permalink
* [feat] add option to toggle GitHub version usage in checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ysicing committed Jan 13, 2025
1 parent cc485a8 commit 46bbc92
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/upgrade/q.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down

0 comments on commit 46bbc92

Please sign in to comment.