Skip to content

Commit

Permalink
more error message adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsDoot committed Feb 16, 2020
1 parent 3b6be6e commit a5d6a5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {

allprojects {
group = "pw.dotdash"
version = "0.15.0"
version = "0.16.0"

apply(plugin = "maven")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,7 @@ internal sealed class SimpleCommandTree<S, V : HList<V>, R>(
}

override fun getUsage(source: S): String {
val builder = StringBuilder()

if (this.children.isNotEmpty()) {
this.children.keys.joinTo(builder, separator = "|", postfix = "|")
}

this.argSequence.joinTo(builder, separator = " ") { it.parameter.getUsage(source) }

return builder.toString()
return this.argSequence.joinToString(separator = " ") { it.parameter.getUsage(source) }
}

@Suppress("UNCHECKED_CAST")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ class CommandTreeCallable<V : HList<V>>(
.append(ERROR_FROM, this.rootAlias, COLON, NEW_LINE, Text.of(cause.message))

if (cause is ArgumentParseException) {
builder.append(NEW_LINE, Text.of(cause.annotatedPosition))
val annotated: String = cause.annotatedPosition
if (annotated.isNotBlank()) {
builder.append(NEW_LINE, Text.of(annotated))
}
}

if (e.cause.showUsage) {
Expand Down

0 comments on commit a5d6a5b

Please sign in to comment.