aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-11-01 12:29:46 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-11-01 14:34:05 +0900
commit6bf458eefdac6e03fe4f2989b6cf08ad6a838520 (patch)
tree3af68a2c15e1617ec52600493915dafe59be2138
parent7e6e94262c9c916cb22dc9015be0e99659018c1f (diff)
downloadruby-6bf458eefdac6e03fe4f2989b6cf08ad6a838520.tar.gz
file2lastrev.rb: use output.rb for the options
-rwxr-xr-xtool/file2lastrev.rb7
1 files 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'
# 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)
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|
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 =
}
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 =
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