Skip to content

class Athena::Console::Commands::Group
inherits Athena::Console::Command #

A command that groups the sub-commands registered below its name, listing them when invoked without one.

It can be used as is, or extended in order to define options that apply to the group itself. See Sub-commands for more information.

@[ACONA::AsCommand("docker", description: "Manage containers")]
class DockerCommand < ACON::Commands::Group
  protected def configure : Nil
    self
      .option("context", "c", :required, "The context to use")
  end
end

# Or without a dedicated type
application.add ACON::Commands::Group.new("docker").option("context", "c", :required, "The context to use")

Invoking the group directly, e.g. ./console docker, writes the list of its sub-commands to the error output and returns ACON::Command::Status::FAILURE. The same happens when invoking a namespace without a registered command, such as ./console docker:compose.