class
Tabular::Habit
- Tabular::Habit
- Reference
- Object
Overview
A class that manages the formation of
a set of [Tablets
][Tabular::Tablets] within the block
of [Tabular.form
][Tabular.form].
Defined in:
tabular/habit.crInstance Method Summary
-
#argument(choices : Array(String), help = "", directives : Directable | Nil = nil)
Create a [
Argument
][Tabular::Kind::Argument]-flavoured [Tablet
][Tabular::Tablet]. -
#argument(*choice, help = "", directives : Directable | Nil = nil)
Create a [
Argument
][Tabular::Kind::Argument]-flavoured [Tablet
][Tabular::Tablet]. -
#command(name : String, aliases = [] of String, help = "", directives : Directable | Nil = nil)
Create a [
Command
][Tabular::Kind::Command]-flavoured [Tablet
][Tabular::Tablet]. -
#delimiters(value : String)
Specify the global string of characters that may delimit an [
Option
][Tabular::Kind::Option]-falvour [Tablet
][Tabular::Tablet]. -
#delimiters : String
Return the global string of characters that may delimit an [
Option
][Tabular::Kind::Option]-falvour [Tablet
][Tabular::Tablet]. - #directives(kind : Kind, value : Directable)
- #directives(kind : Kind) : Directive
-
#dispatch(&block : Replier)
Yield control back to the CLI when a [
Command
][Tabular::Kind::Command] is matched. -
#option(name : String, *aliases : String, help = "", directives : Directable | Nil = nil, delimiters = Tabular.delimiters)
Create a [
Option
][Tabular::Kind::Option]-flavoured [Tablet
][Tabular::Tablet]. -
#option(name : String, *aliases, help = "", delimiters = Tabular.delimiters, &)
Create a [
Option
][Tabular::Kind::Option]-flavoured [Tablet
][Tabular::Tablet] with expected [Argument
][Tabular::Kind::Argument]-flavoured [Tablet
]Tabular::Tablet. - #size : Int32
-
#tablet(kind : Kind, *args, **kwargs)
Create a [
Tablet
][Tabular::Tablet].
Instance Method Detail
Create a [Argument
][Tabular::Kind::Argument]-flavoured [Tablet
][Tabular::Tablet].
- choices: A set of possible values for the argument. If
empty?
, any value is accepted. - help: See [
Tablet#help
][Tabular::Tablet#help]. - directives: See [
Directive
][Tabular::Directive].
Create a [Argument
][Tabular::Kind::Argument]-flavoured [Tablet
][Tabular::Tablet].
- choice: Any number of possible values for the argument. If
empty?
, any value is accepted. - help: See [
Tablet#help
][Tabular::Tablet#help]. - directives: See [
Directive
][Tabular::Directive].
Create a [Command
][Tabular::Kind::Command]-flavoured [Tablet
][Tabular::Tablet].
- name: See [
Tablet#name
][Tabular::Tablet#name]. - aliases: See [
Tablet#aliases
][Tabular::Tablet#aliases]. - help: See [
Tablet#help
][Tabular::Tablet#help]. - directives: See [
Directive
][Tabular::Directive].
Specify the global string of characters that may delimit an [Option
][Tabular::Kind::Option]-falvour
[Tablet
][Tabular::Tablet].
Tabular.form do
# Allows for something like `--option=`
delimiters "="
# Allows for something like `-option:`
delimiters ":"
# Allows for all of the above
delimiters ":="
end
Return the global string of characters that may delimit an [Option
][Tabular::Kind::Option]-falvour
[Tablet
][Tabular::Tablet].
Yield control back to the CLI when a [Command
][Tabular::Kind::Command] is matched.
Create a [Option
][Tabular::Kind::Option]-flavoured [Tablet
][Tabular::Tablet].
- name: See [
Tablet#name
][Tabular::Tablet#name]. - aliases: See [
Tablet#aliases
][Tabular::Tablet#aliases]. - help: See [
Tablet#help
][Tabular::Tablet#help]. - directives: See [
Directive
][Tabular::Directive]. - delimiters: Ad hoc delimiters that will override [
Tabular.delimiters
][Tabular.delimiters].
Create a [Option
][Tabular::Kind::Option]-flavoured [Tablet
][Tabular::Tablet] with expected
[Argument
][Tabular::Kind::Argument]-flavoured [Tablet
]Tabular::Tablet.
option "--opt" do
argument "arg1_choice1", "arg1_choice2", "arg1_choice3"
argument "arg2_choice1", "arg2_choice2"
end
- name: See [
Tablet#name
][Tabular::Tablet#name]. - aliases: See [
Tablet#aliases
][Tabular::Tablet#aliases]. - help: See [
Tablet#help
][Tabular::Tablet#help]. - delimiters: Ad hoc delimiters that will override [
Tabular.delimiters
][Tabular.delimiters].