struct Obsctl::Domain::CommandSpec

Overview

One command, declared once.

This is the single source of truth for the command set. The parser, the --json allowlist, palette completion, --help, and the generated shell completions all read it, so a command cannot exist on one surface and be missing from another.

Defined in:

obsctl/domain/command_registry.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String, summary : String, build : Proc(Array(String), Command), aliases : Array(String) = [] of String, arguments : Array(ArgumentKind) = [] of ArgumentKind, required_arguments : Int32 = -1, surface : CommandSurface = CommandSurface::Cli | CommandSurface::Palette, json : Bool = false) #

[View source]

Instance Method Detail

def aliases : Array(String) #

[View source]
def arguments : Array(ArgumentKind) #

[View source]
def build : Proc(Array(String), Command) #

[View source]
def cli? : Bool #

[View source]
def json? : Bool #

[View source]
def name : String #

[View source]
def palette? : Bool #

[View source]
def required_arguments : Int32 #

[View source]
def spellings : Array(String) #

Every spelling that resolves to this command.


[View source]
def summary : String #

[View source]
def surface : CommandSurface #

[View source]
def usage : String #

name <arg> <arg> as shown in help.


[View source]
def validate_arity!(args : Array(String)) : Nil #

Validates the supplied argument count against this command's arity.


[View source]