Use cli.display for path command.
This commit is contained in:
parent
971dc300bb
commit
34af12a326
1 changed files with 10 additions and 4 deletions
|
|
@ -651,7 +651,6 @@ proc compile(options: Options) =
|
||||||
for option in options.action.compileOptions:
|
for option in options.action.compileOptions:
|
||||||
args.add(option & " ")
|
args.add(option & " ")
|
||||||
|
|
||||||
|
|
||||||
let backend =
|
let backend =
|
||||||
if options.action.backend.len > 0:
|
if options.action.backend.len > 0:
|
||||||
options.action.backend
|
options.action.backend
|
||||||
|
|
@ -726,7 +725,7 @@ proc listInstalled(options: Options) =
|
||||||
type VersionAndPath = tuple[version: Version, path: string]
|
type VersionAndPath = tuple[version: Version, path: string]
|
||||||
|
|
||||||
proc listPaths(options: Options) =
|
proc listPaths(options: Options) =
|
||||||
## Loops over installing packages displaying their installed paths.
|
## Loops over the specified packages displaying their installed paths.
|
||||||
##
|
##
|
||||||
## If there are several packages installed, only the last one (the version
|
## If there are several packages installed, only the last one (the version
|
||||||
## listed in the packages.json) will be displayed. If any package name is not
|
## listed in the packages.json) will be displayed. If any package name is not
|
||||||
|
|
@ -736,6 +735,10 @@ proc listPaths(options: Options) =
|
||||||
## On success the proc returns normally.
|
## On success the proc returns normally.
|
||||||
assert options.action.typ == actionPath
|
assert options.action.typ == actionPath
|
||||||
assert(not options.action.packages.isNil)
|
assert(not options.action.packages.isNil)
|
||||||
|
|
||||||
|
if options.action.packages.len == 0:
|
||||||
|
raise newException(NimbleError, "A package name needs to be specified")
|
||||||
|
|
||||||
var errors = 0
|
var errors = 0
|
||||||
for name, version in options.action.packages.items:
|
for name, version in options.action.packages.items:
|
||||||
var installed: seq[VersionAndPath] = @[]
|
var installed: seq[VersionAndPath] = @[]
|
||||||
|
|
@ -757,13 +760,16 @@ proc listPaths(options: Options) =
|
||||||
v.path = options.getPkgsDir / (pkgInfo.name & '-' & pkgInfo.version)
|
v.path = options.getPkgsDir / (pkgInfo.name & '-' & pkgInfo.version)
|
||||||
installed.add(v)
|
installed.add(v)
|
||||||
else:
|
else:
|
||||||
echo "Warning: No .nimble file found for ", path
|
display("Warning:", "No .nimble file found for " & path, Warning,
|
||||||
|
MediumPriority)
|
||||||
|
|
||||||
if installed.len > 0:
|
if installed.len > 0:
|
||||||
sort(installed, system.cmp[VersionAndPath], Descending)
|
sort(installed, system.cmp[VersionAndPath], Descending)
|
||||||
|
# The output for this command is used by tools so we do not use display().
|
||||||
echo installed[0].path
|
echo installed[0].path
|
||||||
else:
|
else:
|
||||||
echo "Warning: Package '" & name & "' not installed"
|
display("Warning:", "Package '$1' is not installed" % name, Warning,
|
||||||
|
MediumPriority)
|
||||||
errors += 1
|
errors += 1
|
||||||
if errors > 0:
|
if errors > 0:
|
||||||
raise newException(NimbleError,
|
raise newException(NimbleError,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue