Skip to content

Commit

Permalink
Merge pull request #46 from AnthonyNixon/CleanupAndUpdatePrompt
Browse files Browse the repository at this point in the history
fix(updater): fix hanging if on the most recent version
  • Loading branch information
AnthonyNixon committed Dec 2, 2022
2 parents c0bab46 + beecce7 commit 53d567b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,26 @@ func init() {
}

func main() {
command := kingpin.MustParse(app.Parse(os.Args[1:]))
// Check for new Minor version. Prompt update if there's a new Major/Minor version

updatemessage := make(chan string)
go func() {
if command == update.FullCommand() {
updatemessage <- ""
return
}

newAvailable, latest := updater.UpdateAvailable(GetVersion())
if newAvailable {
updatemessage <- fmt.Sprintf("\nCurrent Version: %s\nNew minor version (%s) available! Run `aoc update` to automatically update\n", GetVersion(), latest)
return
}

updatemessage <- ""
}()

switch kingpin.MustParse(app.Parse(os.Args[1:])) {
switch command {
case version.FullCommand():
fmt.Printf("%s@%s\n", GetBuild(), GetVersion())
case newDay.FullCommand():
Expand Down

0 comments on commit 53d567b

Please sign in to comment.