List command supports --ver now.

This commit is contained in:
Dominik Picheta 2013-12-14 23:24:06 +00:00
commit c24627b45c
3 changed files with 5 additions and 4 deletions

View file

@ -391,12 +391,14 @@ proc search(options: TOptions) =
if not found:
echo("No package found.")
proc list =
proc list(options: TOptions) =
if not existsFile(babelDir / "packages.json"):
raise newException(EBabel, "Please run babel update.")
let pkgList = getPackageList(babelDir / "packages.json")
for pkg in pkgList:
echoPackage(pkg)
if options.queryVersions:
echoPackageVersions(pkg)
echo(" ")
type VersionAndPath = tuple[version: TVersion, path: string]
@ -450,7 +452,7 @@ proc doAction(options: TOptions) =
of ActionSearch:
search(options)
of ActionList:
list()
list(options)
of ActionPath:
listPaths(options.action.optionalName)
of ActionBuild:

View file

@ -98,7 +98,6 @@ proc multiSplit(s: string): seq[string] =
if len(result) < 1:
return @[s]
proc readPackageInfo*(path: string): TPackageInfo =
result = initPackageInfo()
result.mypath = path

View file

@ -253,7 +253,7 @@ when isMainModule:
var versions = toTable[TVersion, string]({newVersion("0.1.1"): "v0.1.1", newVersion("0.2.3"): "v0.2.3", newVersion("0.5"): "v0.5"})
doAssert findLatest(parseVersionRange(">= 0.1 & <= 0.4"), versions) == (newVersion("0.2.3"), "v0.2.3")
# TODO: These fail.
# TODO: Allow these in later versions?
#doAssert newVersion("0.1-rc1") < newVersion("0.2")
#doAssert newVersion("0.1-rc1") < newVersion("0.1")