Fix usage printing for compiler plugins

This commit is contained in:
Yan Zhulanow
2015-04-15 18:24:07 +03:00
parent fdc253b67f
commit dbc0099e6e
2 changed files with 5 additions and 3 deletions
@@ -45,8 +45,10 @@ public fun cliPluginUsageString(pluginId: String, options: Collection<CliOption>
"\n" + " ".repeat(MAX_OPTION_WIDTH + LEFT_INDENT + 1)
} else " ".repeat(1 + MAX_OPTION_WIDTH - name.length())
val modifiers = (if (it.required) "required" else "") + (if (it.allowMultipleOccurrences) "multiple" else "")
val modifiersEnclosed = if (modifiers.isNotEmpty()) " ($modifiers)" else ""
val modifiers = listOf(
if (it.required) "required" else null,
if (it.allowMultipleOccurrences) "multiple" else null).filterNotNull()
val modifiersEnclosed = if (modifiers.isEmpty()) "" else " (${modifiers.joinToString()})"
" ".repeat(LEFT_INDENT) + name + margin + it.description + modifiersEnclosed
}