mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
redmine-backporter.rb: like Readline.readline
* tool/redmine-backporter.rb (readline): rename and add optional argument prompt, like Readline.readline. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6cb0b95fe3
commit
506cb40667
1 changed files with 5 additions and 6 deletions
|
@ -195,16 +195,17 @@ def more(sio)
|
|||
end
|
||||
end
|
||||
|
||||
def mygets
|
||||
def readline(prompt = '')
|
||||
console = IO.console
|
||||
ly, lx = console.winsize
|
||||
cls = "\r" + (" " * lx) + "\r> "
|
||||
cls = "\r" + (" " * lx) + "\r" + prompt
|
||||
console.print prompt
|
||||
console.flush
|
||||
line = ''
|
||||
while 1
|
||||
case c = console.getch
|
||||
when "\r", "\n"
|
||||
puts
|
||||
line << c
|
||||
return line
|
||||
when "\C-?", "\b" # DEL/BS
|
||||
print "\b \b" if line.chop!
|
||||
|
@ -258,13 +259,11 @@ puts "Backporter #{VERSION}".color(bold: true) + " for #{TARGET_VERSION}"
|
|||
@issue = nil
|
||||
@changesets = nil
|
||||
while true
|
||||
print '> '
|
||||
begin
|
||||
l = mygets
|
||||
l = readline '> '
|
||||
rescue Interrupt
|
||||
break
|
||||
end
|
||||
l.strip! if l
|
||||
case l
|
||||
when 'ls'
|
||||
uri = URI(REDMINE_BASE+'/projects/ruby-trunk/issues.json?'+URI.encode_www_form(@query))
|
||||
|
|
Loading…
Reference in a new issue