TTY Toolkit- A CLI App’s Best Friend

Pastel

Pastel provides independent coloring component for TTY toolkit.
gem "pastel"$ bundle
pastel = Pastel.new

puts pastel.red("Unicorns!")

Font

font = TTY::Font.new(:doom)
puts font.write("DOOM")
# =>
# ______ _____ _____ ___ ___
# | _ \| _ || _ || \/ |
# | | | || | | || | | || . . |
# | | | || | | || | | || |\/| |
# | |/ / \ \_/ /\ \_/ /| | | |
# |___/ \___/ \___/ \_| |_/

Prompt

prompt = TTY::Prompt.new
prompt.ask("What is your name?")
# => What is your name?
prompt.select("What is your star sign?", %w(Aries Taurus Gemini Cancer Leo Virgo Libra Scorpio Sagittarius Capricorn Aquarius Pisces))# =>
# What is your star sign? (Use ↑/↓ arrow keys, press Enter to select)
# ‣ Aries
# Taurus
# Gemini
# Cancer
# Leo
# Virgo
# Libra
# Scorpio
# Sagittarius
# Capricorn
# Aquarius
# Pisces

Pie

data = [{ name: "Brooklyn", value: 15, color: :bright_yellow, fill: "*" },{ name: "Queens", value: 8, color: :bright_green, fill: "x" },{ name: "Manhattan", value: 5, color: :bright_magenta, fill: "@" },{ name: "Bronx", value: 2, color: :bright_cyan, fill: "+" },{ name: "Jersey", value: 7, color: :bright_white, fill: "+" }]##Data gathered from a Flatiron School poll:
"Which borough do you live in?"
pie_chart = TTY::Pie.new(data: data, radius: 7)
#nyc-mhtn-se-091420 Flatiron School Borough Poll

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store