summaryrefslogtreecommitdiff
path: root/lib/un.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-05 13:43:22 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-05 13:43:22 +0000
commit0fc35416644391b99759cceb7d992d802616b495 ()
tree38dded575d37f0e5780a828f32fa8b597db8c058 /lib/un.rb
parent4d076e91c8ade0015817fc18104b1271e2ac4a40 (diff)
un.rb: help message
* lib/un.rb (setup): show help message by help method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/un.rb15
1 files changed, 14 insertions, 1 deletions
@@ -34,6 +34,7 @@ end
# :nodoc:
def setup(options = "", *long_options)
opt_hash = {}
argv = []
OptionParser.new do |o|
@@ -54,6 +55,10 @@ def setup(options = "", *long_options)
end
end
o.on("-v") do opt_hash[:verbose] = true end
o.order!(ARGV) do |x|
if /[*?\[{]/ =~ x
argv.concat(Dir[x])
@@ -338,12 +343,20 @@ end
def help
setup do |argv,|
all = argv.empty?
open(__FILE__) do |me|
while me.gets("##\n")
if help = me.gets("\n\n")
if all or argv.delete help[/^#\s*ruby\s.*-e\s+(\w+)/, 1]
- print help.gsub(/^# ?/, "")
end
end
end