1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2015-05-23 09:36:22 +00:00
parent b8081c7c4c
commit 80000c534c

View file

@ -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}'"