Skip to content

Repository files navigation

Curtis

Extremely light wrapper around ncurses-ruby.

Installation

Use the GitHub url in your Gemfile for now. RubyGems coming soon.

Usage

Below is a really simple example:

require'curtis'# The #show method is the starting point.# `screen` here is the standard screen, and is the #parent of other views.Curtis.showdo |screen|
screen.puts'Welcome to Curtis. A simple ncurses-ruby wrapper.',h: :centerscreen.render# Initialize a new View via keyword arguments.# All attributes are optional and can be set at a later time.lower_left=Curtis::View.new(lines: screen.lines / 2,columns: screen.columns / 2,line: screen.lines / 2)# Fill the lower_left view with the letter 'L'0.uptolower_left.linesdo |line|
lower_left.move_cursorline: linelower_left.addstr'L' * lower_left.columnsend# Actually show the contents of `lower_left`lower_left.render# Initialize a new View via block, and using fancy percentageslower_right=Curtis::View.newdo |v|
v.lines=v.parent.lines / 2v.columns=v.parent.columns / 2v.line=v.parent.lines / 2v.column=v.parent.columns / 2end# Fill the `lower_right` view with the letter 'R'0.uptolower_right.linesdo |line|
lower_right.move_cursorline: linelower_right.addstr'R' * lower_right.columnsend# Actually show the contents of `lower_right`lower_right.renderscreen.move_cursorline: screen.lines / 4screen.puts'[Q]uit!',h: :center# Press 'q' to stop the input loopCurtis::Input.getdo |key|
breakifkey == 'q'endend

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

TODO

  • Tests (how? srlsy)
  • Add more Ncurses options
  • Improve readme

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/shuriu/curtis.

License

The gem is available as open source under the terms of the MIT License.

About

Extremely light wrapper around ncurses-ruby.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages