diff options
Diffstat (limited to 'src/main/kotlin/com/romangraef/jdacommander/commands/EchoCommand.kt')
-rw-r--r-- | src/main/kotlin/com/romangraef/jdacommander/commands/EchoCommand.kt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/kotlin/com/romangraef/jdacommander/commands/EchoCommand.kt b/src/main/kotlin/com/romangraef/jdacommander/commands/EchoCommand.kt new file mode 100644 index 0000000..edf50ba --- /dev/null +++ b/src/main/kotlin/com/romangraef/jdacommander/commands/EchoCommand.kt @@ -0,0 +1,20 @@ +package com.romangraef.jdacommander.commands + +import com.beust.jcommander.Parameter +import com.romangraef.jdacommander.Command +import com.romangraef.jdacommander.ICommand + +@Command("echo") +class EchoCommand : ICommand() { + @Parameter(names = ["-c", "--caps", "--capitalize"], description = "Convert the text to upper case") + var caps: Boolean = false + + @Parameter(description = "Text to echo back") + lateinit var texts: List<String> + val text get() = texts.joinToString(" ") + + override fun run() = responseChannel.queue { + it.sendMessage(if (caps) text.toUpperCase() else text).queue() + } + +} |