From da5f2b2fa441f649fc387b0e2bd8409c16aef71c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 16 Jun 2015 13:22:17 +0200 Subject: [PATCH] Support finding apps by partial package name If only one matches, that is. --- cmd/fdroidcl/show.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/cmd/fdroidcl/show.go b/cmd/fdroidcl/show.go index ecd85d5..10ede53 100644 --- a/cmd/fdroidcl/show.go +++ b/cmd/fdroidcl/show.go @@ -30,8 +30,23 @@ func findApps(ids []string) []*fdroidcl.App { } result := make([]*fdroidcl.App, len(ids)) for i, id := range ids { - app, _ := apps[id] - result[i] = app + app, e := apps[id] + if e { + result[i] = app + continue + } + var found *fdroidcl.App + for j := range index.Apps { + app = &index.Apps[j] + if strings.Contains(strings.ToLower(app.ID), id) { + if found != nil { + found = nil + break + } + found = app + } + } + result[i] = found } return result }