From c737e6d90dfbf14b3d3701a67fc2f478cff00794 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 1 Feb 2009 07:14:38 +0000 Subject: [PATCH] * lib/optparse.rb (Switch#summarize): strips an equal sign from short option, and fills right sides in shorter lines. [ruby-talk:326414] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ lib/optparse.rb | 8 +++++++- version.h | 8 ++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65288ef9ec..f37b8c5ea5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Feb 1 16:14:37 2009 Nobuyoshi Nakada + + * lib/optparse.rb (Switch#summarize): strips an equal sign from + short option, and fills right sides in shorter lines. + [ruby-talk:326414] + Sat Jan 31 16:04:38 2009 Tanaka Akira * io.c (io_getpartial): fflush after read for updating pos in FILE. diff --git a/lib/optparse.rb b/lib/optparse.rb index b71157f7da..d19e940067 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -384,10 +384,16 @@ class OptionParser left[-1] << if left[-1].empty? then ' ' * 4 else ', ' end << s end - left[0] << arg if arg + if arg + left[0] << (left[1] ? arg.sub(/\A(\[?)=/, '\1') + ',' : arg) + end mlen = left.collect {|s| s.length}.max.to_i while mlen > width and l = left.shift mlen = left.collect {|s| s.length}.max.to_i if l.length == mlen + if l.length < width and (r = right[0]) and !r.empty? + l = l.to_s.ljust(width) + ' ' + r + right.shift + end yield(indent + l) end diff --git a/version.h b/version.h index 8aa6f3bfbe..8b0a0c7594 100644 --- a/version.h +++ b/version.h @@ -1,15 +1,15 @@ #define RUBY_VERSION "1.8.7" -#define RUBY_RELEASE_DATE "2009-01-31" +#define RUBY_RELEASE_DATE "2009-02-01" #define RUBY_VERSION_CODE 187 -#define RUBY_RELEASE_CODE 20090131 +#define RUBY_RELEASE_CODE 20090201 #define RUBY_PATCHLEVEL 5000 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 #define RUBY_VERSION_TEENY 7 #define RUBY_RELEASE_YEAR 2009 -#define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 31 +#define RUBY_RELEASE_MONTH 2 +#define RUBY_RELEASE_DAY 1 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[];