Skip to content

cloud-kotlin-extensions#

This module contains extensions to different parts of Cloud.

Installation#

Cloud is available through Maven Central.

<dependencies>
    <dependency>
        <groupId>org.incendo</groupId>
        <artifactId>cloud-kotlin-extensions</artifactId>
        <version>2.0.0-beta.2</version>
    </dependency>
</dependencies>
implementation("org.incendo:cloud-kotlin-extensions:2.0.0-beta.2")
implementation 'org.incendo:cloud-kotlin-extensions:2.0.0-beta.2'

MutableCommandBuilder#

MutableCommandBuilder is a small DSL for Command.Builder which allows for the creation of commands in more idiomatic Kotlin.

You can initiate the mutable command builder using CommandManager#commandBuilder or create and register the command in one step by using CommandManager#buildAndRegister.

Example MutableCommandBuilder usage
manager.buildAndRegister("command") {
    senderType<OverriddenSenderType>()

    required("string", stringParser()) {
        description(argumentDescription("A string argument"))
    }

    handler { ctx ->
        // ...
    }
}

Extension Functions#

The org.incendo.kotlin.extension package contains extensions to:

  • CloudKeyContainer
  • CloudKey
  • Command.Builder
  • CommandManager
  • ExceptionController
  • ArgumentParser
  • ParserDescriptor
  • Either

The extensions exist to make it easier to use Cloud in Kotlin.