attemptCommand

fun attemptCommand(    command: String,     onAmbiguity: (List<AvailBuilder.CompiledCommand>, (AvailBuilder.CompiledCommand?) -> Unit) -> Unit,     onSuccess: (AvailObject, (() -> Unit) -> Unit) -> Unit,     onFailure: () -> Unit)

Attempt to unambiguously parse a command. Each currently loaded module that defines at least one entry point takes a shot at parsing the command. If more than one is successful, report the ambiguity via the onFailure continuation. If none are successful, report the failure. If there was exactly one, compile it into a function and invoke it in a new fiber. If the function evaluation succeeds, run the onSuccess continuation with the function's result, except that if the function has static type ⊤ always pass nil instead of the actual value returned by the function. If the function evaluation failed, report the failure.

Parameters

command

The command to attempt to parse and run.

onAmbiguity

What to do if the entry point is ambiguous. Accepts a List of compiled commands and the function to invoke with the selected command (or null if no command should be run).

onSuccess

What to do if the command parsed and ran to completion. It should be passed both the result of execution and a cleanup function to invoke with a post-cleanup continuation.

onFailure

What to do otherwise.