1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

redmine-backporter.rb: try Readline

* tool/redmine-backporter.rb (readline): try Readline.readline if
  available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-01-20 04:09:24 +00:00
parent 87bb3275aa
commit aa6b7b0701

View file

@ -8,6 +8,12 @@ require 'stringio'
require 'strscan'
require 'optparse'
require 'pp'
begin
require 'readline'
rescue LoadError
else
include Readline
end
VERSION = '0.0.1'
@ -195,7 +201,7 @@ def more(sio)
end
end
def readline(prompt = '')
def Readline.readline(prompt = '')
console = IO.console
console.binmode
ly, lx = console.winsize
@ -226,7 +232,7 @@ def readline(prompt = '')
line << c
end
end
end
end unless defined?(Readline.readline)
def mergeinfo
`svn propget svn:mergeinfo #{RUBY_REPO_PATH}`
@ -266,7 +272,7 @@ puts "Backporter #{VERSION}".color(bold: true) + " for #{TARGET_VERSION}"
@changesets = nil
while true
begin
l = readline '> '
l = Readline.readline '> '
rescue Interrupt
break
end