CLI.Dispatch

is what dispatching an App yields. It answers not just whether parsing succeeded, but whether help was requested and for what, so a caller can show the right usage:

  • Parsed — success. Holds a Pair of the chosen subcommand name and its parsed value Map.
  • AppHelp — top-level --help/-h was given before any subcommand; respond with App.usage.
  • CommandHelp — a subcommand’s own --help/-h was given; carries that subcommand’s name, so respond with App.usage-for.
  • Failure — carries a human-readable error message (a missing, unknown, or option-shaped leading token, or the subcommand’s own parse error).

AppHelp

instantiate

(Fn [] CLI.Dispatch)

creates a AppHelp.

CommandHelp

instantiate

(Fn [String] CLI.Dispatch)

creates a CommandHelp.

Failure

instantiate

(Fn [String] CLI.Dispatch)

creates a Failure.

Parsed

instantiate

(Fn [(Pair String (Map String CLI.Type))] CLI.Dispatch)

creates a Parsed.

copy

instantiate

(Fn [(Ref CLI.Dispatch a)] CLI.Dispatch)

copies a Dispatch.

delete

instantiate

(Fn [CLI.Dispatch] ())

deletes a CLI.Dispatch. This should usually not be called manually.

get-tag

instantiate

(Fn [(Ref CLI.Dispatch a)] Int)

Gets the tag from a Dispatch.

prn

instantiate

(Fn [(Ref CLI.Dispatch a)] String)

converts a CLI.Dispatch to a string.

str

instantiate

(Fn [(Ref CLI.Dispatch a)] String)

converts a CLI.Dispatch to a string.