Browse Source

Merge branch 'dev' of https://github.com/jguer/yay into dev

Jguer 8 years ago
parent
commit
2c458a42a1
1 changed files with 9 additions and 5 deletions
  1. 9 5
      aur/aur.go

+ 9 - 5
aur/aur.go

@@ -2,6 +2,7 @@ package aur
 
 import (
 	"bufio"
+	"bytes"
 	"fmt"
 	"net/http"
 	"os"
@@ -158,28 +159,31 @@ func Upgrade(flags []string) error {
 		return err
 	}
 
+	var buffer bytes.Buffer
+	buffer.WriteString("\n")
 	outdated := q[:0]
 	for i, res := range q {
 		fmt.Printf("\r Checking %d/%d packages...", i+1, len(q))
 
 		if _, ok := foreign[res.Name]; ok {
 			// Leaving this here for now, warn about downgrades later
-			if int64(res.LastModified) > foreign[res.Name].BuildDate().UnixNano() {
-				fmt.Printf("\x1b[1m\x1b[32m==>\x1b[33;1m %s: \x1b[0m%s \x1b[33;1m-> \x1b[0m%s\n",
-					res.Name, foreign[res.Name].Version(), res.Version)
+			if int64(res.LastModified) > foreign[res.Name].BuildDate().Unix() {
+				buffer.WriteString(fmt.Sprintf("\x1b[1m\x1b[32m==>\x1b[33;1m %s: \x1b[0m%s \x1b[33;1m-> \x1b[0m%s\n",
+					res.Name, foreign[res.Name].Version(), res.Version))
 				outdated = append(outdated, res)
 			}
 		}
 	}
+	fmt.Println(buffer.String())
 
 	//If there are no outdated packages, don't prompt
 	if len(outdated) == 0 {
-		fmt.Println("\n there is nothing to do")
+		fmt.Println("there is nothing to do")
 		return nil
 	}
 
 	// Install updated packages
-	if !config.ContinueTask("\nProceed with upgrade?", "nN") {
+	if !config.ContinueTask("Proceed with upgrade?", "nN") {
 		return nil
 	}