Count from 0 on upgrade prompt

This commit is contained in:
morganamilo 2018-01-16 10:18:36 +00:00
parent 479e2f0ce0
commit 91662d7e9d
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E

View file

@ -301,8 +301,8 @@ func upgradePkgs(flags []string) error {
var aurNums []int
sort.Sort(repoUp)
fmt.Printf("\x1b[1;34;1m:: \x1b[0m\x1b[1m%d Packages to upgrade.\x1b[0m\n", len(aurUp)+len(repoUp))
repoUp.Print(len(aurUp))
aurUp.Print(0)
repoUp.Print(len(aurUp) + 1)
aurUp.Print(1)
if !config.NoConfirm {
fmt.Print("\x1b[32mEnter packages you don't want to upgrade.\x1b[0m\nNumbers: ")
@ -333,17 +333,17 @@ func upgradePkgs(flags []string) error {
numbers = []int{num}
}
for _, target := range numbers {
if target > len(aurUp)+len(repoUp)-1 || target < 0 {
if target > len(aurUp)+len(repoUp) || target <= 0 {
continue
} else if target < len(aurUp) {
target = len(aurUp) - target - 1
} else if target <= len(aurUp) {
target = len(aurUp) - target
if negate {
excludeAur = append(excludeAur, target)
} else {
aurNums = append(aurNums, target)
}
} else {
target = len(aurUp) + len(repoUp) - target - 1
target = len(aurUp) + len(repoUp) - target
if negate {
excludeRepo = append(excludeRepo, target)
} else {