зеркало из https://github.com/github/ruby.git
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:
Родитель
b8081c7c4c
Коммит
80000c534c
|
@ -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}'"
|
||||
|
|
Загрузка…
Ссылка в новой задаче