@@ -1130,27 +1130,35 @@ proc listPaths(options: Options) =
11301130 if options.action.packages.len == 0 :
11311131 raise nimbleError (" A package name needs to be specified" )
11321132
1133- var errors = 0
1134- let pkgs = getInstalledPkgsMin (options.getPkgsDir (), options)
1135- for name, version in options.action.packages.items:
1136- var installed: seq [VersionAndPath ] = @ []
1137- # There may be several, list all available ones and sort by version.
1138- for pkg in pkgs:
1139- if name == pkg.basicInfo.name and withinRange (pkg.basicInfo.version, version):
1140- installed.add ((pkg.basicInfo.version, pkg.getRealDir))
1141-
1142- if installed.len > 0 :
1143- sort (installed, cmp[VersionAndPath ], Descending )
1144- # The output for this command is used by tools so we do not use display().
1145- for pkg in installed:
1146- echo pkg.path
1147- else :
1148- display (" Warning:" , " Package '$1' is not installed" % name, Warning ,
1149- MediumPriority )
1150- errors += 1
1151- if errors > 0 :
1152- raise nimbleError (
1153- " At least one of the specified packages was not found" )
1133+ let pkgInfo = maybeGetPkgInfo (getCurrentDir (), options)
1134+ if pkgInfo.isSome:
1135+ let searchNames = options.action.packages.mapIt (it.name).toHashSet
1136+ for dep in pkgInfo.get.processAllDependencies (options):
1137+ if dep.basicInfo.name in searchNames:
1138+ for path in dep.expandPaths (options):
1139+ echo path
1140+ else :
1141+ var errors = 0
1142+ let pkgs = getInstalledPkgsMin (options.getPkgsDir (), options)
1143+ for name, version in options.action.packages.items:
1144+ var installed: seq [VersionAndPath ] = @ []
1145+ # There may be several, list all available ones and sort by version.
1146+ for pkg in pkgs:
1147+ if name == pkg.basicInfo.name and withinRange (pkg.basicInfo.version, version):
1148+ installed.add ((pkg.basicInfo.version, pkg.getRealDir))
1149+
1150+ if installed.len > 0 :
1151+ sort (installed, cmp[VersionAndPath ], Descending )
1152+ # The output for this command is used by tools so we do not use display().
1153+ for pkg in installed:
1154+ echo pkg.path
1155+ else :
1156+ display (" Warning:" , " Package '$1' is not installed" % name, Warning ,
1157+ MediumPriority )
1158+ errors += 1
1159+ if errors > 0 :
1160+ raise nimbleError (
1161+ " At least one of the specified packages was not found" )
11541162
11551163proc join (x: seq [PkgTuple ]; y: string ): string =
11561164 if x.len == 0 : return " "
0 commit comments