GitHub release Build Status

cransi

ANSI escape codes for terminal manipulation

Installation

  1. Add the dependency to your shard.yml:
dependencies:
  cransi:
    github: daviscodesbugs/cransi
  1. Run shards install

Usage

require "cransi"

puts "Hello world!\nThanks for checking out cransi!"
print Cransi.cursor_save
wait
print Cransi.cursor_prev_line 2
wait
print Cransi.cursor_col 6
wait
print Cransi.insert_char 7
wait
print " there,"
wait
print Cransi.cursor_restore
wait
puts "Try this example with SLOW = true"
wait

SLOW = false
def wait
  sleep 1.second if SLOW
end

Final output

Hello there, world!
Thanks for checking out cransi!
Try this example with SLOW = true

API

Additional documentation can be found here

Cursor Movement

Erase

For the following, a cell that is "erased" can also be thought of as blank

Insert

Delete

Misc

Contributing

  1. Fork it (<https://github.com/daviscodesbugs/cransi/fork>)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors