abstract class Optarg::Model

Overview

The base of model classes.

Defined in:

lib/model.cr
lib/model/dsl/arg.cr
lib/model/dsl/arg_array.cr
lib/model/dsl/array.cr
lib/model/dsl/bool.cr
lib/model/dsl/handler.cr
lib/model/dsl/string.cr
lib/model/dsl/terminator.cr
lib/model/dsl/unknown.cr
lib/model/macros/handler.cr
lib/model/macros/value.cr

Class Method Summary

Instance Method Summary

Macro Summary

Class Method Detail

def self.parse(argv : Array(String), *args) #

Creates a new model instance and parses the argv arguments.

Returns the created instance.


[View source]

Instance Method Detail

def [](klass : String.class) #

Returns a value hash for String-type options and arguments.


[View source]
def [](klass : Bool.class) #

Returns a value hash for Bool-type options and arguments.


[View source]
def [](klass : Array(String).class) #

Returns a value hash for Array(String)-type options and arguments.


[View source]
def [](index : Int32) #

Returns an argument value at the index.


[View source]
def []?(index : Int32) #

Returns an argument value at the index.

Returns nil if the index is out of range.


[View source]
def each(&block) #

Iterates argument values.


[View source]
def nameless_args #

Returns an array that contains nameless argument values.


[View source]
def unparsed_args #

Returns an array that contains unparsed argument values.


[View source]

Macro Detail

macro arg(names, metadata = nil, stop = nil, default = nil, required = nil, any_of = nil, complete = nil, _mixin = nil) #

Defines a String argument model item.


[View source]
macro arg_array(names, metadata = nil, default = nil, min = nil, any_item_of = nil, complete = nil, _mixin = nil) #

Defines an Array(String) argument model item.


[View source]
macro array(names, metadata = nil, default = nil, min = nil, any_item_of = nil, complete = nil, _mixin = nil) #

Defines an Array(String) option model item.


[View source]
macro bool(names, metadata = nil, stop = nil, default = nil, not = nil, _mixin = nil) #

Defines a Bool option model item.


[View source]
macro on(names, metadata = nil, stop = nil) #

Defines a handler model item.


[View source]
macro string(names, metadata = nil, stop = nil, default = nil, required = nil, any_of = nil, complete = nil, _mixin = nil) #

Defines a String option model item.


[View source]
macro terminator(names, metadata = nil) #

Defines a terminator model item.


[View source]
macro unknown(metadata = nil) #

Defines an unknown model item.


[View source]