From 748d23eded748a67f428e61e6020bb81a4139059 Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 25 Mar 2004 14:19:22 +0000 Subject: Add --version option to ri git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/ri/ri_options.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/rdoc/ri/ri_options.rb b/lib/rdoc/ri/ri_options.rb index d9ece2067..aeda25106 100644 --- a/lib/rdoc/ri/ri_options.rb +++ b/lib/rdoc/ri/ri_options.rb @@ -5,7 +5,8 @@ module RI require 'rdoc/ri/ri_display' - VERSION_STRING = "alpha 0.1" + VERSION_STRING = "beta1" + CVS_ID = "$Id"; class Options @@ -64,7 +65,11 @@ module RI ], [ "--width", "-w", "output width", - "set the width of the output" ], + "Set the width of the output" ], + + [ "--version", "-v", nil, + "Display the version of ri" + ], ] @@ -163,6 +168,14 @@ module RI end end + # Show the version and exit + def show_version + cvs_info = CVS_ID.split + puts "ri #{VERSION_STRING} (#{cvs_info[2]} #{cvs_info[3]})" + exit(0) + end + + # Parse command line options. def parse @@ -186,6 +199,7 @@ module RI go.each do |opt, arg| case opt when "--help" then OptionList.usage + when "--version" then show_version when "--list-names" then @list_names = true when "--no-pager" then @use_stdout = true when "--classes" then @list_classes = true -- cgit