Command#

class graftkit.Command[source]#

Bases: FrozenModel

One command.

Attributes:
namestr

The command’s name on the command line.

helpstr

One-line help.

optionstuple[Option, …]

Plain options and positionals.

interviewInterview

Questions and consents. A command with any gets --yes.

runCallable[[Invocation], None] | None

What the command does; None for a group of subcommands.

subcommandstuple[Command, …]

Nested commands.

examplestuple[Example, …]

Command lines that run the command, checked when the app is built.

annotationsdict[str, str]

Free-form metadata for the app built on the kit, such as whether an assistant may run the command. The kit stores it and includes it in --describe, but never interprets it; namespace keys by the app, e.g. {"myapp.agent": "hand-off"}.

interactivebool

Whether the command has questions or consents.

Methods

document(command_line)

Return what --describe prints: everything needed to run the command.

property interactive: bool#

Whether the command has questions or consents.

document(command_line: str) → dict[str, Any][source]#

Return what --describe prints: everything needed to run the command.

Parameters:
command_linestr

How the command is invoked, e.g. mytool deploy.

Returns:
dict[str, Any]

The document: the command’s help, examples, options and annotations; for a command that asks, also its questions and consents with the procedure an assistant follows.