Skip to content

Commit

Permalink
Merge pull request #4 from GoToUse/main
Browse files Browse the repository at this point in the history
Change the result display when no dependencies are outdated.
  • Loading branch information
kevwan authored May 26, 2022
2 parents ff81284 + 3576790 commit c523982
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
"os"
"os/exec"
"time"
Expand Down Expand Up @@ -30,9 +31,8 @@ func main() {
}

spin.Stop()
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Package", "Current", "Latest", "GoVersion"})
table.SetBorder(false)

var tableRows [][]string
for _, mod := range modules {
if mod.Update == nil {
continue
Expand All @@ -42,14 +42,23 @@ func main() {
continue
}

table.Append([]string{
tableRows = append(tableRows, []string{
mod.Path,
mod.Version,
mod.Update.Version,
mod.GoVersion,
})
}
table.Render()

if len(tableRows) == 0 {
fmt.Println("\U0001f4ab\033[1;32m Complete!\033[0m All of your dependencies are up to date.")
} else {
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Package", "Current", "Latest", "GoVersion"})
table.SetBorder(false)
table.AppendBulk(tableRows)
table.Render()
}
}

// contains checks if str is in list.
Expand Down

0 comments on commit c523982

Please sign in to comment.