class ToposPlayground

Defined in:

topos-playground.cr
topos-playground/break_text.cr
topos-playground/command.cr
topos-playground/command_registry.cr
topos-playground/console_format.cr
topos-playground/dispatch.cr
topos-playground/env.cr
topos-playground/env/dapp-backend.cr
topos-playground/env/dapp-frontend.cr
topos-playground/env/executor-service.cr
topos-playground/env/secrets.cr
topos-playground/env_registry.cr
topos-playground/error_check.cr
topos-playground/error_log.cr
topos-playground/helptext.cr
topos-playground/initialize_directories.cr
topos-playground/log.cr
topos-playground/option_parser.cr
topos-playground/registry.cr
topos-playground/version.cr

Constant Summary

HelpText = "\ntopos-playground is a CLI tool which handles all of the orchestration necessary to run local Topos devnets with subnets, a TCE network, and apps.\n\n\nExample Usage\n\n $ topos-playground start\n Start the Topos-Playground. This command will output the status of the playground creation to the terminal as it runs, and will log a more detailed status to a log file.\n\n $ topos-playground start --verbose\n This will also start the topos playground, but the terminal output as well as the log file output will contain more information.\n This is useful for debugging if there are errors starting the playground.\n\n $ topos-playground start -q\n This will start the topos playground quietly. Most output will be suppressed.\n\n $ topos-playground clean\n This will clean the topos playground. It will shut down all containers, and remove all filesystem artifacts except for log files.\n\n $ topos-playground version\n This will print the version of the topos playground.\n\n $ topos-playground version -q')\n This will print only the numbers of the topos-playground version, with no other output.\n\nConfiguration\n\n topos-playground follows the XDG Base Directory Specification, which means that data files for use during runs of the playground are stored in $XDG_DATA_HOME/topos-playground, which defaults to $HOME/.local/share/topos-playground and log files are stored in $XDG_STATE_HOME/topos-playground/logs, which defaults to $HOME/.local/state/topos-playground/logs.\n\n These locations can be overridden by setting the environment variables HOME, XDG_DATA_HOME, and XDG_STATE_HOME."
VERSION = {{ (read_file("/home/runner/work/topos-playground.cr/topos-playground.cr/src/topos-playground/../../VERSION")).chomp }}

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Class Method Detail

def self.bind_console_logging(log_config) #

[View source]
def self.break_line(lines, line, word, max_line_length, max_word_length, indentation) #

[View source]
def self.break_text(str : String, max_line_length : Int32 = 80) : String #

This is a helper function for nicely formatting the text output from topos-playground. It takes a string and breaks it into lines of a maximum length, inserting newlines where necessary. It also attempts to break lines at word boundaries, and to avoid breaking lines in the middle of words. It does this by calculating the average word length and standard deviation of word length, and using these to determine the maximum word length to allow before breaking.

Words that are longer than the maximum word length (i.e. a word length that is larger than typical, and which would thus cause the text appearance to be peculiar, with a large end-of-line gap) are broken at a point that is 30-70% of the way through the word, using a hyphen. The algorithm also refuses to break a word that starts with a non-letter character, to avoid breaking things like directory paths.

Finally, the algorithm maintains the indetation at the start of a line, when a line is broken into multiple lines. This maintains text formatting, such as when examples are being provided in an indented section.)

ameba:disable Metrics/CyclomaticComplexity


[View source]
def self.calculate_max_word_length(str, max_line_length) #

[View source]
def self.command #

[View source]
def self.config #

[View source]
def self.determine_terminal_width #

[View source]
def self.terminal_width #

[View source]
def self.terminal_width=(value : Int32) #

[View source]

Instance Method Detail

def config : Config #

[View source]
def config=(config : Config) #

[View source]
def dispatch #

[View source]
def error_check #

[View source]
def get_log_file #

[View source]
def initialize_directories #

[View source]
def parse_command_line #

[View source]
def run #

[View source]
def setup_all_logging #

[View source]
def setup_console_logging #

[View source]