gem version dependencies docs build coverage code climate omniref

CLI Miami

A feature rich alternative for gets and puts for your cli interface

gem install cli_miami


# For the name-spaced methods & CliMiami::S.ay...
gem 'cli_miami'

# For the friendlier global methods & S.ay...
gem 'cli_miami', require: 'cli_miami/global'


S.ay accepts 2 arguments, a string, and a variety of options * see supported options below

S.ay 'Hello World', :color => :red

Sometimes you want to have multiple styles on a single line. There are 2 ways to do this.

The multi-line way using :newline => false

S.ay 'Hello ', :color => :red, :newline => false
S.ay 'World', :color => :blue

Or on a single line using ANSI codes as methods. All the ANSI color and style codes listed below can be used

S.ay "#{'Hello'.red} #{'World'.blue}" accepts the same arguments as S.say, with additional support for a block that passes the users response 'What is your name?', :color => :yellow do |response|
  S.ay "#{response} smells!", :style => :bold


Both S.ay and suport the same options

color:      => [symbol]             # See ansi color codes below
bgcolor:    => [symbol]             # See ansi color codes below
style:      => [symbol]             # See ansi style codes below. Can accept multiple styles as an array
justify:    => [center|left|right]  # The type of justification to use
padding:    => [integer]            # The maximum string size to justify text in
indent:     => [integer]            # The number of characters to indent
newline:    => [boolean]            # True if you want a newline after the output
overwrite:  => [boolean]            # True if you want the next line to overwrite the current line
ANSI Color Codes
  • :black
  • :red
  • :green
  • :yellow
  • :blue
  • :magenta
  • :cyan
  • :white
ANSI Style Codes
  • :bold
  • :bright
  • :underline
  • :negative Swap foreground color with background color

Development & Testing

yuyi -m
bundle install
bundle exec guard