class ToposPlayground
- ToposPlayground
- Reference
- Object
Defined in:
topos-playground.crtopos-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
- .bind_console_logging(log_config)
- .break_line(lines, line, word, max_line_length, max_word_length, indentation)
-
.break_text(str : String, max_line_length : Int32 = 80) : String
This is a helper function for nicely formatting the text output from topos-playground.
- .calculate_max_word_length(str, max_line_length)
- .command
- .config
- .determine_terminal_width
- .terminal_width
- .terminal_width=(value : Int32)
Instance Method Summary
- #config : Config
- #config=(config : Config)
- #dispatch
- #error_check
- #get_log_file
- #initialize_directories
- #parse_command_line
- #run
- #setup_all_logging
- #setup_console_logging
Constructor Detail
Class Method Detail
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