summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-05 13:43:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-05 13:43:25 +0000
commiteb06e8d3ad21f60e9e0c499f9d70050f79ff5de0 ()
tree25300aa599ad48996d0c4a32ade4370da901ea81 /lib
parent0fc35416644391b99759cceb7d992d802616b495 (diff)
un.rb: help order
* lib/un.rb (UN#help): show help messages in the given order. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/un.rb16
1 files changed, 13 insertions, 3 deletions
@@ -351,15 +351,25 @@ module UN # :nodoc:
module_function
def help(argv, output: $stdout)
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]
- output << help.gsub(/^# ?/, "")
- break if !all and argv.empty?
end
end
end
end
end
end