From 0aec8d62480b752f39d6a377442f9ec0a5a418b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 18 Jun 2015 23:00:39 +0200 Subject: [PATCH] Don't load index if we encountered an error --- cmd/fdroidcl/search.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/cmd/fdroidcl/search.go b/cmd/fdroidcl/search.go index 5ea4f0e..a9bcad1 100644 --- a/cmd/fdroidcl/search.go +++ b/cmd/fdroidcl/search.go @@ -29,21 +29,19 @@ func init() { } func runSearch(args []string) { - index := mustLoadIndex() - apps := filterAppsSearch(index.Apps, args) if *installed && *updates { - fmt.Println("-i and -u at the same time don't make sense") + fmt.Println("-i is redundant if -u is specified") cmdSearch.Flag.Usage() } + index := mustLoadIndex() + apps := filterAppsSearch(index.Apps, args) if *installed { - device := oneDevice() - installed := mustInstalled(device) - apps = filterAppsInstalled(apps, installed) + instPkgs := mustInstalled(oneDevice()) + apps = filterAppsInstalled(apps, instPkgs) } if *updates { - device := oneDevice() - installed := mustInstalled(device) - apps = filterAppsUpdates(apps, installed) + instPkgs := mustInstalled(oneDevice()) + apps = filterAppsUpdates(apps, instPkgs) } if *quiet { for _, app := range apps {