Search will now continue even if packages are found based on tag name.
This commit is contained in:
parent
94ff509f16
commit
c6fa3019af
1 changed files with 11 additions and 11 deletions
22
babel.nim
22
babel.nim
|
|
@ -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 =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue