class Cling::Formatter

Overview

Generates a formatted help template for command components.

Defined in:

cling/formatter.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(options : Options = Options.new) #

[View source]

Instance Method Detail

def format_arguments(command : Command, io : IO) : Nil #

Formats the arguments of the command into the given IO.


[View source]
def format_commands(command : Command, io : IO) : Nil #

Formats the command information including subcommands into the given IO. By default, this does not include hidden commands, but you can override this if you wish.


[View source]
def format_description(command : Command, io : IO) : Nil #

Formats the description of a command into the given IO.


[View source]
def format_footer(command : Command, io : IO) : Nil #

Formats the footer of the command into the given IO.


[View source]
def format_header(command : Command, io : IO) : Nil #

Formats the header of a command into the given IO.


[View source]
def format_options(command : Command, io : IO) : Nil #

Formats the options of the command into the given IO.


[View source]
def format_usage(command : Command, io : IO) : Nil #

Formats the usage strings of a command into the given IO.


[View source]
def generate(command : Command, io : IO) : Nil #

Generates a help template for the specified command. This will attempt to fill fields that have not been set in the command, for example, command usage strings. Values that are not set, such as arguments and options, will not be written to the IO.

Writes to the IO and returns nothing.


[View source]
def generate(command : Command) : String #

Generates a help template for the specified command. This will attempt to fill fields that have not been set in the command, for example, command usage strings. Values that are not set, such as arguments and options, will not be written to the IO.


[View source]