feat(partnerctl): add details output helper for key-value prompt sections

This commit is contained in:
2026-05-04 17:08:20 +08:00
parent 4200df6525
commit 97bf0618f4
2 changed files with 19 additions and 0 deletions

View File

@@ -49,6 +49,18 @@ class Prompt private constructor(
fun info(message: String) = println("[info] $message")
fun details(title: String? = null, items: List<Pair<String, String>>) {
if (items.isEmpty()) return
if (!title.isNullOrBlank()) {
println(title)
}
items.forEach { (key, value) ->
println(" $key: $value")
}
}
fun success(message: String) = println("[ok] $message")
fun warn(message: String) = println("[warn] $message")

View File

@@ -59,6 +59,13 @@ fun main() {
}
prompt.info("Port = $port")
prompt.details(
"Test Details", listOf(
"Tag A" to "Detail A",
"Tag B" to "Detail B"
)
)
prompt.section("Confirm")
val confirmed = prompt.confirm("Continue?", defaultValue = true)
prompt.info("Continue = $confirmed")