diff --git a/ChangeLog b/ChangeLog index 2ca099f8f3..819a326bee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Aug 30 10:41:57 2008 Nobuyoshi Nakada + + * lib/rake.rb (Rake::Application#help): fix for OPTIONAL_ARGUMENT and + multiple short options. [ruby-dev:36051] + Sat Aug 30 08:59:25 2008 Nobuyoshi Nakada * include/ruby/intern.h (rb_file_s_absolute_path), diff --git a/lib/rake.rb b/lib/rake.rb index 068a0ceb21..0b21eb7350 100755 --- a/lib/rake.rb +++ b/lib/rake.rb @@ -1984,13 +1984,18 @@ module Rake puts puts "Options are ..." puts - OPTIONS.sort.each do |long, short, mode, desc| - if mode == GetoptLong::REQUIRED_ARGUMENT + OPTIONS.sort.each do |long, *short, mode, desc| + case mode + when GetoptLong::REQUIRED_ARGUMENT if desc =~ /\b([A-Z]{2,})\b/ long = long + "=#{$1}" end + when GetoptLong::OPTIONAL_ARGUMENT + if desc =~ /\b([A-Z]{2,})\b/ + long = long + "[=#{$1}]" + end end - printf " %-20s (%s)\n", long, short + printf " %-20s (%s)\n", long, short.join(", ") printf " %s\n", desc end end