fun main()

in pubsub/src/main/kotlin/PubSub.kt [213:226]


fun main(vararg args: String) {
    when {
        args.isEmpty() -> println("Command incomplete: please provide the pubsub action to execute and its arguments! \n $usage")

        args[0] == "usage" -> println(usage)

        !actions.containsKey(args[0]) -> println("Bad command: action not found! \n $usage")

        else -> {
            val actionArgs = args.copyOfRange(1, args.size)
            actions[args[0]]?.invoke(actionArgs)
        }
    }
}