Displaying errors with cli tool

Fixes https://github.com/alexarchambault/coursier/issues/19
This commit is contained in:
Alexandre Archambault 2015-06-18 00:25:14 +02:00
parent 1c1c390439
commit e65ef0ecfe
1 changed files with 15 additions and 2 deletions

View File

@ -91,9 +91,22 @@ case class Coursier(scope: List[String],
def repr(dep: Dependency) =
s"${dep.module.organization}:${dep.module.name}:${dep.`type`}:${Some(dep.classifier).filter(_.nonEmpty).map(_+":").mkString}${dep.module.version}"
val trDeps = res.dependencies.toList.map(repr).sorted
val trDeps = res.dependencies.toList.sortBy(repr)
println("\n" + trDeps.mkString("\n"))
println("\n" + trDeps.map(repr).mkString("\n"))
if (res.conflicts.nonEmpty) {
// Needs test
println(s"${res.conflicts.size} conflict(s):\n ${res.conflicts.toList.map(repr).sorted.mkString(" \n")}")
}
val errDeps = trDeps.filter(dep => res.errors.contains(dep.module))
if (errDeps.nonEmpty) {
println(s"${errDeps.size} error(s):")
for (dep <- errDeps) {
println(s" ${dep.module}:\n ${res.errors(dep.module).mkString("\n").replace("\n", " \n")}")
}
}
if (fetch) {
println()