method
create_option_parser
v1_9_3_392 -
Show latest stable
-
0 notes -
Class: Command
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (38)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
create_option_parser()
private
Hide source
# File lib/rubygems/command.rb, line 383 def create_option_parser @parser = OptionParser.new @parser.separator nil regular_options = @option_groups.delete :options configure_options "", regular_options @option_groups.sort_by { |n,_| n.to_s }.each do |group_name, option_list| @parser.separator nil configure_options group_name, option_list end @parser.separator nil configure_options "Common", Gem::Command.common_options unless arguments.empty? @parser.separator nil @parser.separator " Arguments:" arguments.split(/\n/).each do |arg_desc| @parser.separator " #{arg_desc}" end end if @summary then @parser.separator nil @parser.separator " Summary:" wrap(@summary, 80 - 4).split("\n").each do |line| @parser.separator " #{line.strip}" end end if description then formatted = description.split("\n\n").map do |chunk| wrap chunk, 80 - 4 end.join "\n" @parser.separator nil @parser.separator " Description:" formatted.split("\n").each do |line| @parser.separator " #{line.rstrip}" end end unless defaults_str.empty? @parser.separator nil @parser.separator " Defaults:" defaults_str.split(/\n/).each do |line| @parser.separator " #{line}" end end end