Giter Site home page Giter Site logo

highline's Introduction

Read Me

by James Edward Gray II

Description

Welcome to HighLine.

HighLine was designed to ease the tedious tasks of doing console input and output with low-level methods like gets() and puts(). HighLine provides a robust system for requesting data from a user, without needing to code all the error checking and validation rules and without needing to convert the typed Strings into what your program really needs. Just tell HighLine what you’re after, and let it do all the work.

Documentation

See HighLine and HighLine::Question for documentation.

Start hacking in your code with HighLine with:

require 'highline/import'

Examples

Basic usage:

ask("Company?  ") { |q| q.default = "none" }

Validation:

ask("Age?  ", Integer) { |q| q.in = 0..105 }
ask("Name?  (last, first)  ") { |q| q.validate = /\A\w+, ?\w+\Z/ }

Type conversion for answers:

ask("Birthday?  ", Date)
ask("Interests?  (comma sep list)  ", lambda { |str| str.split(/,\s*/) })

Reading passwords:

ask("Enter your password:  ") { |q| q.echo = false }
ask("Enter your password:  ") { |q| q.echo = "x" }

ERb based output (with HighLine’s ANSI color tools):

say("This should be <%= color('bold', BOLD) %>!")

Menus:

choose do |menu|
  menu.prompt = "Please choose your favorite programming language?  "

  menu.choice(:ruby) { say("Good choice!") }
  menu.choices(:python, :perl) { say("Not from around here, are you?") }
end

For more examples see the examples/ directory of this project.

Installing

See the INSTALL file for instructions.

Questions and/or Comments

Feel free to email James Edward Gray II or Gregory Brown with any questions.

highline's People

Contributors

jeg2 avatar practicingruby avatar yazgoo avatar rleber avatar presidentbeef avatar davispuh avatar stomar avatar mnzaki avatar stepheneb avatar lachlan avatar kachick avatar iconoclast avatar whiteleaf7 avatar roniegh avatar km4n avatar sax avatar cgorshing avatar rossmeissl avatar mleinart avatar michaeljbishop avatar jacott avatar voxik avatar rubemz avatar rsutphin avatar mjtko avatar bowsersenior avatar jordimassaguerpla avatar johnl avatar jc00ke avatar banzaiman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.