2018-03-22 16:40:33 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2018-06-01 05:20:49 +02:00
|
|
|
"fmt"
|
2018-03-22 16:40:33 +01:00
|
|
|
)
|
|
|
|
|
2018-05-31 21:31:45 +02:00
|
|
|
const gitEmptyTree = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
|
|
|
|
|
2018-05-08 06:06:25 +02:00
|
|
|
func stringSliceEqual(a, b []string) bool {
|
|
|
|
if a == nil && b == nil {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
if a == nil || b == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(a) != len(b) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
for i := 0; i < len(a); i++ {
|
|
|
|
if a[i] != b[i] {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
2018-06-01 05:20:49 +02:00
|
|
|
|
|
|
|
func removeInvalidTargets(targets []string) []string {
|
|
|
|
filteredTargets := make([]string, 0)
|
|
|
|
|
|
|
|
for _, target := range targets {
|
2019-02-04 17:56:02 +01:00
|
|
|
db, _ := splitDBFromName(target)
|
2018-06-01 05:20:49 +02:00
|
|
|
|
2018-09-14 21:18:59 +02:00
|
|
|
if db == "aur" && mode == modeRepo {
|
2018-06-01 05:20:49 +02:00
|
|
|
fmt.Printf("%s %s %s\n", bold(yellow(arrow)), cyan(target), bold("Can't use target with option --repo -- skipping"))
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2018-09-14 21:18:59 +02:00
|
|
|
if db != "aur" && db != "" && mode == modeAUR {
|
2018-06-01 05:20:49 +02:00
|
|
|
fmt.Printf("%s %s %s\n", bold(yellow(arrow)), cyan(target), bold("Can't use target with option --aur -- skipping"))
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
filteredTargets = append(filteredTargets, target)
|
|
|
|
}
|
|
|
|
|
|
|
|
return filteredTargets
|
|
|
|
}
|