PtcRunner.Kernel.CommandDeclaration (PtcRunner v0.14.0)

Copy Markdown View Source

Closed per-command grammar and help declarations.

The strict parser and the public help result both derive their switch lists from this module. A declaration contains no caller input and performs no filesystem or runtime work.

Summary

Types

command()

@type command() ::
  :init
  | :docs
  | :validate
  | :run
  | :doctor
  | :models
  | :transcript
  | :repl
  | :viewer

frontend()

@type frontend() :: :standalone | :mix

topic()

@type topic() :: :root | command()

Functions

accepted_switches(command, frontend \\ :standalone)

@spec accepted_switches(command(), frontend()) :: [binary()]

aliases(command, frontend \\ :standalone)

@spec aliases(command(), frontend()) :: keyword()

canonical_switch(command, frontend, switch)

@spec canonical_switch(command(), frontend(), binary()) :: binary() | nil

command_atom(name)

@spec command_atom(binary()) :: {:ok, command()} | :error

commands()

@spec commands() :: [command()]

frontend_commands()

@spec frontend_commands() :: [command()]

frontend_option_keys(command, frontend)

@spec frontend_option_keys(command(), frontend()) :: [atom()]

help_options(topic, frontend \\ :standalone)

@spec help_options(topic(), frontend()) :: [map()]

option_keys(command, frontend \\ :standalone)

@spec option_keys(command(), frontend()) :: [atom()]

repeatable_switches(command, frontend)

@spec repeatable_switches(command(), frontend()) :: [binary()]

switches(command, frontend \\ :standalone)

@spec switches(command(), frontend()) :: keyword()

topic_atom(name)

@spec topic_atom(binary()) :: {:ok, topic()} | :error

topics()

@spec topics() :: [topic()]

usage(topic)

@spec usage(topic()) :: [binary()]

value_switches(command, frontend)

@spec value_switches(command(), frontend()) :: [binary()]