say 'anything' say '!txtred!anything in red' say 'only one !txtred!word!txtrst! in red' resay 'go back to the beginning of the line' say_status :download, 'Download in progress' say_status :download, 'Download in progress', :txtblu word_wrap ' Indent a potentially wrapping line by two spaces' say word_wrap ' Indent a potentially wrapping line by two spaces and say it'
All these commands can be used inside your
These commands are provided by the Colsole gem which is already bundled with Runfile.
Print a message to screen, with support for color markers and partial strings.
End the string with a space to force the cursor to stay at the same line (otherwise, a newline is added).
say "Hello world" say "!txtgrn!I am green" say "Legen... wait for it... " say "dary"
Erase the current output line and print a new message. Should be
called only after a space terminated call to
say to ensure the
cursor is at the same line.
say "Downloading... " resay "Downloaded"
Print a message to screen, with a colored status tag.
say_status :success, "Task completed" say_status :error, "Task failed", :txtred
If you wish to print a string and make it wrap automatically based
on the width of the terminal, use
The function is also sensitive to any leading spaces. These will be preserved in any wrapped line, so it is easy to print indented long strings.
say word_wrap("one two three four", 10) say word_wrap(" one two three four", 10) say word_wrap "Some long line ... that ends here"