class Opal::CLI::Option

Overview

Represents a command-line flag or option.

Defined in:

opal/cli/option.cr

Constructors

Instance Method Summary

Constructor Detail

def self.from_spec(name : Symbol, spec : String, description : String = "", type : Symbol | Nil = nil, default : OptionValue = nil, required : Bool = false, global : Bool = false, choices : Array(String) | Nil = nil, env_var : String | Nil = nil, group : String | Nil = nil) : Option #

Parses a unified spec string like "-d, --delimiter=CHAR" or "-z, --zebra"


[View source]
def self.new(name : Symbol, long : String, short : String | Nil = nil, description : String = "", type : Symbol = :string, default : OptionValue = nil, required : Bool = false, global : Bool = false, choices : Array(String) | Nil = nil, env_var : String | Nil = nil, group : String | Nil = nil, value_name : String | Nil = nil) #

[View source]

Instance Method Detail

def choices : Array(String) | Nil #

[View source]
def default : OptionValue #

[View source]
def description : String #

[View source]
def env_var : String | Nil #

[View source]
def flag? : Bool #

[View source]
def formatted_flag : String #

Formatted flag representation for help screens (e.g. "-e, --entry=DIR")


[View source]
def global? : Bool #

[View source]
def group : String | Nil #

[View source]
def group=(group : String | Nil) #

[View source]
def long : String #

[View source]
def long_name : String #

Alias for long


[View source]
def name : Symbol #

[View source]
def required? : Bool #

[View source]
def short : String | Nil #

[View source]
def short_name : String | Nil #

Alias for short


[View source]
def type : Symbol #

[View source]
def value_name : String | Nil #

[View source]