List command supports --ver now.
This commit is contained in:
parent
439b05b536
commit
c24627b45c
3 changed files with 5 additions and 4 deletions
|
|
@ -391,12 +391,14 @@ proc search(options: TOptions) =
|
||||||
if not found:
|
if not found:
|
||||||
echo("No package found.")
|
echo("No package found.")
|
||||||
|
|
||||||
proc list =
|
proc list(options: TOptions) =
|
||||||
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")
|
||||||
for pkg in pkgList:
|
for pkg in pkgList:
|
||||||
echoPackage(pkg)
|
echoPackage(pkg)
|
||||||
|
if options.queryVersions:
|
||||||
|
echoPackageVersions(pkg)
|
||||||
echo(" ")
|
echo(" ")
|
||||||
|
|
||||||
type VersionAndPath = tuple[version: TVersion, path: string]
|
type VersionAndPath = tuple[version: TVersion, path: string]
|
||||||
|
|
@ -450,7 +452,7 @@ proc doAction(options: TOptions) =
|
||||||
of ActionSearch:
|
of ActionSearch:
|
||||||
search(options)
|
search(options)
|
||||||
of ActionList:
|
of ActionList:
|
||||||
list()
|
list(options)
|
||||||
of ActionPath:
|
of ActionPath:
|
||||||
listPaths(options.action.optionalName)
|
listPaths(options.action.optionalName)
|
||||||
of ActionBuild:
|
of ActionBuild:
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,6 @@ proc multiSplit(s: string): seq[string] =
|
||||||
if len(result) < 1:
|
if len(result) < 1:
|
||||||
return @[s]
|
return @[s]
|
||||||
|
|
||||||
|
|
||||||
proc readPackageInfo*(path: string): TPackageInfo =
|
proc readPackageInfo*(path: string): TPackageInfo =
|
||||||
result = initPackageInfo()
|
result = initPackageInfo()
|
||||||
result.mypath = path
|
result.mypath = path
|
||||||
|
|
|
||||||
|
|
@ -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"})
|
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")
|
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.2")
|
||||||
#doAssert newVersion("0.1-rc1") < newVersion("0.1")
|
#doAssert newVersion("0.1-rc1") < newVersion("0.1")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue