1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00
This commit is contained in:
Cedric Beust 2015-11-08 13:05:10 -08:00
parent 70a23f0d27
commit 5be21a7647
2 changed files with 9 additions and 3 deletions

View file

@ -42,7 +42,7 @@ class AsciiArt {
val maxString: String = strings.maxBy { it.length } ?: ""
val max = maxString.length
val result = arrayListOf(ul + r(max + 2, h) + ur)
result.addAll(strings.map { "$v $it ${fill(max - it.length)}$v" })
result.addAll(strings.map { "$v ${center(it, max - 2)} $v" })
result.add(bl + r(max + 2, h) + br)
return result
}
@ -58,7 +58,13 @@ class AsciiArt {
}
fun logBox(s: String, print: (String) -> Unit = defaultLog) {
logBox(listOf(s))
logBox(listOf(s), print)
}
fun center(s: String, width: Int) : String {
val diff = width - s.length
val spaces = diff / 2 + 1
return fill(spaces) + s + fill(spaces + if (diff % 2 == 1) 1 else 0)
}
}
}

View file

@ -27,7 +27,7 @@ class ResolveDependency @Inject constructor(val repoFinder: RepoFinder) {
val repoResult = repoFinder.findCorrectRepo(id)
val simpleDep = SimpleDep(MavenId(id))
val url = "Full URL: " + repoResult.repoUrl + simpleDep.toJarFile(repoResult)
val url = repoResult.repoUrl + simpleDep.toJarFile(repoResult)
AsciiArt.logBox(listOf(id, url), {s -> println(s) })
display(root.children)