module Athena::Console::Style::Interface

Overview

Represents a "style" that provides a way to abstract how to format console input/output data such that you can reduce the amount of code needed, and to standardize the appearance.

See ACON::Style::Athena.

Custom Styles

Custom styles can also be created by implementing this interface, and optionally extending from ACON::Style::Output which makes the style an ACON::Output::Interface as well as defining part of this interface. Then you could simply instantiate your custom style within a command as you would ACON::Style::Athena.

Direct including types

Defined in:

style/interface.cr

Instance Method Summary

Instance Method Detail

abstract def ask(question : String, default : _) #

Helper method for asking ACON::Question questions.


[View source]
abstract def ask_hidden(question : String) #

Helper method for asking hidden ACON::Question questions.


[View source]
abstract def caution(messages : String | Enumerable(String)) : Nil #

Formats and prints the provided messages within a caution block.


[View source]
abstract def choice(question : String, choices : Indexable | Hash, default = nil) #

Helper method for asking ACON::Question::Choice questions.


[View source]
abstract def comment(messages : String | Enumerable(String)) : Nil #

Formats and prints the provided messages within a comment block.


[View source]
abstract def confirm(question : String, default : Bool = true) : Bool #

Helper method for asking ACON::Question::Confirmation questions.


[View source]
abstract def error(messages : String | Enumerable(String)) : Nil #

Formats and prints the provided messages within a error block.


[View source]
abstract def info(messages : String | Enumerable(String)) : Nil #

Formats and prints the provided messages within a info block.


[View source]
abstract def listing(elements : Enumerable) : Nil #

Formats and prints a bulleted list containing the provided elements.


[View source]
abstract def new_line(count : Int32 = 1) : Nil #

Prints count empty new lines.


[View source]
abstract def note(messages : String | Enumerable(String)) : Nil #

Formats and prints the provided messages within a note block.


[View source]
abstract def progress_advance(by step : Int32 = 1) : Nil #

Advances the internal ACON::Helper::ProgressBar by the provided amount of steps.


[View source]
abstract def progress_finish : Nil #

Completes the internal ACON::Helper::ProgressBar.


[View source]
abstract def progress_start(max : Int32 | Nil = nil) : Nil #

Starts an internal ACON::Helper::ProgressBar, optionally with the provided max amount of steps.


[View source]
abstract def section(message : String) : Nil #

Creates a section header with the provided message.


[View source]
abstract def success(messages : String | Enumerable(String)) : Nil #

Formats and prints the provided messages within a success block.


[View source]
abstract def table(headers : Enumerable, rows : Enumerable) : Nil #

Formats and prints a table based on the provided headers and rows, followed by a new line.


[View source]
abstract def text(messages : String | Enumerable(String)) : Nil #

Formats and prints the provided messages as text.


[View source]
abstract def title(message : String) : Nil #

Formats and prints message as a title.


[View source]
abstract def warning(messages : String | Enumerable(String)) : Nil #

Formats and prints the provided messages within a warning block.


[View source]