ruby-changes:74307
From: Nobuyoshi <ko1@a...>
Date: Tue, 1 Nov 2022 18:05:15 +0900 (JST)
Subject: [ruby-changes:74307] 6bf458eefd (master): file2lastrev.rb: use output.rb for the options
https://git.ruby-lang.org/ruby.git/commit/?id=6bf458eefd From 6bf458eefdac6e03fe4f2989b6cf08ad6a838520 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 1 Nov 2022 12:29:46 +0900 Subject: file2lastrev.rb: use output.rb for the options --- tool/file2lastrev.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb index 68d1b0b4aa..db9e6fec42 100755 --- a/tool/file2lastrev.rb +++ b/tool/file2lastrev.rb @@ -8,6 +8,7 @@ require 'optparse' https://github.com/ruby/ruby/blob/trunk/tool/file2lastrev.rb#L8 # this file run with BASERUBY, which may be older than 1.9, so no # require_relative require File.expand_path('../lib/vcs', __FILE__) +require File.expand_path('../lib/output', __FILE__) Program = $0 @@ -20,6 +21,7 @@ def self.format=(format) https://github.com/ruby/ruby/blob/trunk/tool/file2lastrev.rb#L21 end @suppress_not_found = false @limit = 20 +@output = Output.new time_format = '%Y-%m-%dT%H:%M:%S%z' vcs = nil @@ -51,6 +53,7 @@ OptionParser.new {|opts| https://github.com/ruby/ruby/blob/trunk/tool/file2lastrev.rb#L53 opts.on("-q", "--suppress_not_found") do @suppress_not_found = true end + @output.def_options(opts) opts.order! rescue abort "#{File.basename(Program)}: #{$!}\n#{opts}" begin vcs = VCS.detect(srcdir || ".", vcs_options, opts.new) @@ -69,7 +72,7 @@ formatter = https://github.com/ruby/ruby/blob/trunk/tool/file2lastrev.rb#L72 } when :revision_h Proc.new {|last, changed, modified, branch, title| - vcs.revision_header(last, modified, modified, branch, title, limit: @limit) + vcs.revision_header(last, modified, modified, branch, title, limit: @limit).join("\n") } when :doxygen Proc.new {|last, changed| @@ -86,7 +89,7 @@ formatter = https://github.com/ruby/ruby/blob/trunk/tool/file2lastrev.rb#L89 ok = true (ARGV.empty? ? [nil] : ARGV).each do |arg| begin - puts formatter[*vcs.get_revisions(arg)] + @output.write(formatter[*vcs.get_revisions(arg)]+"\n") rescue => e warn "#{File.basename(Program)}: #{e.message}" ok = false -- cgit v1.2.3 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/