summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-25 14:19:22 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-25 14:19:22 +0000
commit7c3d0e10d4e419245801be3d7852f9816823e655 (patch)
tree2ec3861ac48a711a589462f2be2aee7e93832014
parent27cb9ee103d22d4c3afedc355dc3d2b9b2d56e58 (diff)
downloadruby-7c3d0e10d4e419245801be3d7852f9816823e655.tar.gz
ruby-7c3d0e10d4e419245801be3d7852f9816823e655.tar.xz
ruby-7c3d0e10d4e419245801be3d7852f9816823e655.zip
Add --version option to ri
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@6028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/rdoc/ri/ri_options.rb18
2 files changed, 21 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b46bc0fd4..7c3d12fa9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Mar 25 23:15:24 2004 Dave Thomas <dave@pragprog.com>
+
+ * lib/rdoc/ri/ri_options.rb (RI::Options::show_version):
+ Add --version option
+
Thu Mar 25 04:16:18 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/ri/ri_options.rb (RI::Options): Add the --list-names option,
diff --git a/lib/rdoc/ri/ri_options.rb b/lib/rdoc/ri/ri_options.rb
index d9ece2067..b9ee21f07 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