struct Obsctl::CLI::FlagSpec

Overview

One global option, declared once.

The argv splitter has to know whether a flag consumes the following token before OptionParser ever sees it, because everything from the first positional onwards belongs to the subcommand and may contain flags this parser knows nothing about (--topics, --headless, --dry-run). Declaring the flags as data keeps the splitter and the parser from disagreeing about where the global section ends.

Defined in:

obsctl/cli/options.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(long : String, value : String | Nil = nil, short : String | Nil = nil, description : String = "") #

[View source]

Instance Method Detail

def clone #

[View source]
def copy_with(long _long = @long, value _value = @value, short _short = @short, description _description = @description) #

[View source]
def description : String #

def long : String #

def short : String | Nil #

def takes_value? : Bool #

True when this flag takes a separate following token.


[View source]
def to_flag : String #

Renders the flag in the form OptionParser#on expects.


[View source]
def value : String | Nil #