Skip to content

Commit

Permalink
fix bug in update
Browse files Browse the repository at this point in the history
  • Loading branch information
nbebaw committed Jan 16, 2024
1 parent a378a3e commit 778e3b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions lib/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ func GetLatestVersionFromAUR(packageName string) (string, error) {

version := strings.Split(output[versionIndex:], "\n")[0]
version = strings.TrimPrefix(version, "pkgver=")
if strings.Contains(version, "'") {
version = strings.Trim(version, "'")
}

return version, nil
}
13 changes: 7 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package main
import (
"flag"
"fmt"
"os"

"github.com/nbebaw/archub/lib"
"os"
"strings"
)

var Version = "No Version Provided"
Expand Down Expand Up @@ -95,9 +95,11 @@ func main() {
}
if packageVersion != newVersion {
if len(newVersion) != 0 {
fmt.Println("There is an update for the following packages:")
fmt.Printf("%s%s%s %s -> %s\n", lib.ColorLightRed, packageName, lib.ColorNone, packageVersion, newVersion)
updateExists = true
if !strings.Contains(newVersion, "${") {
fmt.Println("There is an update for the following packages:")
fmt.Printf("%s%s%s %s -> %s\n", lib.ColorLightRed, packageName, lib.ColorNone, packageVersion, newVersion)
updateExists = true
}
}
}
}
Expand All @@ -113,7 +115,6 @@ func main() {
return
// -u || --u [package]
case lib.UpdatePkg || lib.UpdatePkgAlias:
fmt.Println(flag.NArg())
if lib.UpdateAllPkg {
updateExists := false
// If both -u and --all flags are provided without an argument
Expand Down

0 comments on commit 778e3b7

Please sign in to comment.