From c6fa3019af3edce53a1d6b00be36d68b327c6933 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Mon, 9 Dec 2013 16:58:13 +0000 Subject: [PATCH] Search will now continue even if packages are found based on tag name. --- babel.nim | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/babel.nim b/babel.nim index b9138fe..28b1a55 100644 --- a/babel.nim +++ b/babel.nim @@ -358,25 +358,25 @@ proc search(action: TAction) = if not existsFile(babelDir / "packages.json"): raise newException(EBabel, "Please run babel update.") let pkgList = getPackageList(babelDir / "packages.json") - var notFound = true + var found: seq[string] = @[] for pkg in pkgList: for word in action.search: for tag in pkg.tags: if word in tag: echoPackage(pkg) echo(" ") - notFound = false + found.add(pkg.name) break - if notFound: - # Search by name. - for pkg in pkgList: - for word in action.search: - if word in pkg.name: - echoPackage(pkg) - echo(" ") - notFound = false + + # Search by name. + for pkg in pkgList: + for word in action.search: + if word in pkg.name and pkg.name notin found: + echoPackage(pkg) + echo(" ") + found.add(pkg.name) - if notFound: + if found.len == 0: echo("No package found.") proc list =