Search will now continue even if packages are found based on tag name.

This commit is contained in:
Dominik Picheta 2013-12-09 16:58:13 +00:00
commit c6fa3019af

View file

@ -358,25 +358,25 @@ proc search(action: TAction) =
if not existsFile(babelDir / "packages.json"): if not existsFile(babelDir / "packages.json"):
raise newException(EBabel, "Please run babel update.") raise newException(EBabel, "Please run babel update.")
let pkgList = getPackageList(babelDir / "packages.json") let pkgList = getPackageList(babelDir / "packages.json")
var notFound = true var found: seq[string] = @[]
for pkg in pkgList: for pkg in pkgList:
for word in action.search: for word in action.search:
for tag in pkg.tags: for tag in pkg.tags:
if word in tag: if word in tag:
echoPackage(pkg) echoPackage(pkg)
echo(" ") echo(" ")
notFound = false found.add(pkg.name)
break break
if notFound:
# Search by name. # Search by name.
for pkg in pkgList: for pkg in pkgList:
for word in action.search: for word in action.search:
if word in pkg.name: if word in pkg.name and pkg.name notin found:
echoPackage(pkg) echoPackage(pkg)
echo(" ") echo(" ")
notFound = false found.add(pkg.name)
if notFound: if found.len == 0:
echo("No package found.") echo("No package found.")
proc list = proc list =