From 80000c534c179add12eb91010feaa7b43b6abec1 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 23 May 2015 09:36:22 +0000 Subject: [PATCH] file2lastrev.rb: format for modified * tool/file2lastrev.rb: add optional argument to --modified, for strftime format. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/file2lastrev.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb index 39b3d63567..13f9a3bd1a 100755 --- a/tool/file2lastrev.rb +++ b/tool/file2lastrev.rb @@ -17,6 +17,7 @@ def self.output=(output) end @suppress_not_found = false +format = '%Y-%m-%dT%H:%M:%S%z' srcdir = nil parser = OptionParser.new {|opts| opts.on("--srcdir=PATH", "use PATH as source directory") do |path| @@ -31,8 +32,9 @@ parser = OptionParser.new {|opts| opts.on("--doxygen", "Doxygen format") do self.output = :doxygen end - opts.on("--modified", "modified time") do + opts.on("--modified[=FORMAT]", "modified time") do |fmt| self.output = :modified + format = fmt if fmt end opts.on("-q", "--suppress_not_found") do @suppress_not_found = true @@ -67,7 +69,7 @@ parser.parse! rescue abort "#{File.basename(Program)}: #{$!}\n#{parser}" } when :modified proc {|last, changed, modified| - modified.strftime('%Y-%m-%dT%H:%M:%S%z') + modified.strftime(format) } else raise "unknown output format `#{@output}'"