struct Tabular::Tablet

Overview

Represents a parameter whose name and aliases may be suggested and matched during tab completion.

Defined in:

tabular/tablet.cr

Constant Summary

NONE = Tablet.new(:none)

Basically, [Tablet?][Tabular::Tablet] minus the baggage.

Constructors

Instance Method Summary

Constructor Detail

def self.new(kind : Kind, name : String = "", aliases = [] of String, help = "", directives : Directable | Nil = nil, delimiters = Tabular.delimiters) #

Create a new [Tablet][Tabular::Tablet].

  • kind: See [#kind][Tabular::Tablet#kind].
  • name: See [#name][Tabular::Tablet#name].
  • aliases: See [#aliases][Tabular::Tablet#aliases].
  • help: See [#help][Tabular::Tablet#help].
  • directives: See [#directives][Tabular::Tablet#directives].
  • delimiters: Ad hoc delimiters that will override [Tabular.delimiters][Tabular.delimiters].

[View source]

Instance Method Detail

def aliases : Set(String) #

A list of additional names the [Tablet][Tabular::Tablet] will suggest/match.


[View source]
def candidate(arg : String, & : String -> ) #

Yield suggestions for any names that contain arg.


[View source]
def directives : Tabular::Directive #

Additional directives the [Tablet][Tabular::Tablet] will send to the shell if suggested.


[View source]
def form? #

Return true if a nested form exists.


[View source]
def help : String #

The description of the parameter the [Tablet][Tabular::Tablet] represents.


[View source]
def kind : Tabular::Kind #

The representation of the [Tablet][Tabular::Tablet].


[View source]
def match!(arg : String) #

Returns self if arg is an exact match of any names. Otherwise, raise [Error::Match][Tabular::Error::Match].


[View source]
def match?(arg : String) : Bool #

Return true if arg is an exact match of any names.


[View source]
def name : String #

The name of the parameter the [Tablet][Tabular::Tablet] represents.


[View source]
def next(&) #

For an [Option][Tabular::Kind::Option]-flavoured [Tablet][Tabular::Tablet] with #form?, yield the next [Argument][Tabular::Kind::Argument]-flavoured [Tablet][Tabular::Tablet] to the specified &block.


[View source]
def to_s(io : IO) #
Description copied from struct Struct

Same as #inspect(io).


[View source]