一个更高级别的命令行面向的接口。
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.
See: Rubydoc.info for HighLine. Specially HighLine and HighLine::Question.
…
If you want to save some characters, you can inject/import HighLine methods on Kernel by doing the following. Just be sure to avoid name collisions in the top-level namespace.
require 'highline/import'
say "Now you can use #say directly"
For more examples see the examples/ directory of this project.
HighLine from version >= 3.0.0 requires ruby >= 3.0.0
To install HighLine, use the following command:
$ gem install highline
(Add sudo if you're installing under a POSIX system as root)
If you're using Bundler, add this to your Gemfile:
source "https://rubygems.org"
gem 'highline'
And then run:
$ bundle
If you want to build the gem locally, use the following command from the root of the sources:
$ rake package
You can also build and install directly:
$ rake install
git clone [email protected]:YOUR-USERNAME/highline.gitcd highline # to enter the cloned repository directory.git remote add upstream https://github.com/JEG2/highlinegit fetch upstreamgit checkout mastergit merge upstream/mastergit checkout -b your_branchrake testrake acceptancepronto run Alternatively, if you're in a Dockerised environment,
don't care about installing anything locally -- just run bin/test instead.
git commit -am "Your commit message"git pushDetails on:
For a list of people who have contributed to the codebase, see GitHub's list of contributors.
暂无开放 Issues,或尚未同步最近议题。