Print the date to STDERR if STDIN is a part of input [ci skip]

This commit is contained in:
Nobuyoshi Nakada 2023-10-28 14:12:10 +09:00
parent 7e6204dd10
commit 6589af52d2
No known key found for this signature in database
GPG key ID: 3582D74E1FEE4465

View file

@ -2,10 +2,11 @@
BEGIN {
require 'rubygems'
date = nil
}
END {
# STDOUT is not usable in inplace edit mode
output = $-i ? STDOUT : STDERR
}
output = STDERR if ARGF.file == STDIN
END {
output.print date.strftime("latest_date=%F") if date
}
unless /^[^#]/ !~ (gem = $F[0])