Browse Source

fdroidcl: delay looking up a device

This way, we can error e.g. on a bad category without unnecessarily
waiting for a device.

Also gofmt.
pull/17/head
Daniel Martí 10 years ago
parent
commit
286b62f1ab
  1. 10
      cmd/fdroidcl/search.go

10
cmd/fdroidcl/search.go

@ -44,10 +44,6 @@ func runSearch(args []string) {
fmt.Fprintf(os.Stderr, "%v\n", err)
cmdSearch.Flag.Usage()
}
var device *adb.Device
if *installed || *updates {
device = mustOneDevice()
}
apps := mustLoadIndexes()
if len(apps) > 0 && *category != "" {
apps = filterAppsCategory(apps, *category)
@ -59,6 +55,10 @@ func runSearch(args []string) {
if len(apps) > 0 && len(args) > 0 {
apps = filterAppsSearch(apps, args)
}
var device *adb.Device
if *installed || *updates {
device = mustOneDevice()
}
if len(apps) > 0 && *installed {
apps = filterAppsInstalled(apps, device)
}
@ -202,7 +202,7 @@ func filterAppsLastUpdated(apps []fdroidcl.App, days int) []fdroidcl.App {
days = -days
newer = false
}
date := time.Now().Truncate(24 * time.Hour).AddDate(0, 0, 1 - days)
date := time.Now().Truncate(24*time.Hour).AddDate(0, 0, 1-days)
for _, app := range apps {
if app.Updated.Before(date) == newer {
continue

Loading…
Cancel
Save