Skip to content

Commit

Permalink
新版本提示问题解决
Browse files Browse the repository at this point in the history
  • Loading branch information
Becivells committed Dec 28, 2021
1 parent 7fb12ab commit ee0c02a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 5 additions & 5 deletions internal/cli/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ package cli
import (
"errors"
"fmt"
"fofax/internal/fx"
"fofax/internal/fxparser"
"fofax/internal/printer"
"fofax/internal/utils"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
"strings"
"time"

"fofax/internal/fx"
"fofax/internal/fxparser"
"fofax/internal/goflags"
"fofax/internal/printer"
"fofax/internal/utils"
)

const (
Expand Down Expand Up @@ -336,7 +336,7 @@ func checkUpdateInfo() {
if -time.Until(lastime) > 24*time.Hour {
err := UpdateTips(FoFaXVersion)
if err != nil {
printer.Infof(err.Error())
printer.Info(err.Error())
}
ioutil.WriteFile(lastfile, []byte(time.Now().Format("2006-01-02T15:04:05Z")), os.ModePerm)
}
Expand Down
7 changes: 2 additions & 5 deletions internal/cli/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import (
)

func UpdateTips(tagName string) error {
if !strings.HasPrefix(tagName, "v") {
return fmt.Errorf("%s", "this file does not have a version number")
}

tagName = fmt.Sprintf("v%s", tagName)
if strings.HasSuffix(tagName, "-next") {
printer.Debug("Self-compiled versions do not check for updates")
return nil
Expand All @@ -33,7 +30,7 @@ func UpdateTips(tagName string) error {
if err != nil {
return err
}

printer.Debugf("github current version: %s\n", gVersion)
if gVersion.GreaterThan(bVersion) {
bannerSite(fmt.Sprintf("New:\n\nVersion:%s\n\n%s\n", gtag, ginfo))
bannerSite("Please go to https://github.com/xiecat/fofax/releases to download\n\n")
Expand Down

0 comments on commit ee0c02a

Please sign in to comment.