struct
Obsctl::Domain::CommandSpec
- Obsctl::Domain::CommandSpec
- Struct
- Value
- Object
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.crConstructors
Instance Method Summary
- #aliases : Array(String)
- #arguments : Array(ArgumentKind)
- #build : Proc(Array(String), Command)
- #cli? : Bool
- #json? : Bool
- #name : String
- #palette? : Bool
- #required_arguments : Int32
-
#spellings : Array(String)
Every spelling that resolves to this command.
- #summary : String
- #surface : CommandSurface
-
#usage : String
name <arg> <arg>as shown in help. -
#validate_arity!(args : Array(String)) : Nil
Validates the supplied argument count against this command's arity.
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)
#
Instance Method Detail
def validate_arity!(args : Array(String)) : Nil
#
Validates the supplied argument count against this command's arity.