summaryrefslogtreecommitdiff
path: root/tool/lib/output.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/lib/output.rb')
-rw-r--r--tool/lib/output.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/tool/lib/output.rb b/tool/lib/output.rb
index 3a9f3d87ae..b1c4f4a866 100644
--- a/tool/lib/output.rb
+++ b/tool/lib/output.rb
@@ -18,7 +18,7 @@ class Output
@vpath.def_options(opt)
end
- def write(data, overwrite: false)
+ def write(data, overwrite: false, create_only: false)
unless @path
$stdout.print data
return true
@@ -28,8 +28,8 @@ class Output
updated = color.fail("updated")
outpath = nil
- if (@ifchange or overwrite) and
- (@vpath.open(@path, "rb") {|f| outpath = f.path; f.read == data if @ifchange} rescue false)
+ if (@ifchange or overwrite or create_only) and
+ (@vpath.open(@path, "rb") {|f| outpath = f.path; (@ifchange and f.read == data) or (create_only and !f.read.empty?)} rescue false)
puts "#{outpath} #{unchanged}"
written = false
else