fun main()

in storage/src/main/kotlin/Storage.kt [165:182]


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

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

        args.size == 2 && args[0] == "quickstart" -> quickstart(args[1])

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

        args.size == 1 && args[0] != "info" -> error("Bad command: missing arguments! \n $usage")

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