diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-20 03:14:21 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-20 03:14:21 +0000 |
commit | 506cb40667fa5d5786dad18a21df824d9b2f66c6 (patch) | |
tree | 889f522e96b0a1352fe8c6181abef2990e5517a7 /tool | |
parent | 6cb0b95fe3edea270cb424e4ccaeed65febb0d63 (diff) | |
download | ruby-506cb40667fa5d5786dad18a21df824d9b2f66c6.tar.gz |
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
Diffstat (limited to 'tool')
-rwxr-xr-x | tool/redmine-backporter.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tool/redmine-backporter.rb b/tool/redmine-backporter.rb index ea56dc19c2..bda4abcc56 100755 --- a/tool/redmine-backporter.rb +++ b/tool/redmine-backporter.rb @@ -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)) |