[diffoscope] 03/03: main: add a --always-write-text option, useful for batch scripts

Ximin Luo infinity0 at debian.org
Mon Sep 26 21:08:27 CEST 2016


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository diffoscope.

commit d591267aee6f5f2f0f2bce0014195344dbb5fda0
Author: Ximin Luo <infinity0 at debian.org>
Date:   Mon Sep 26 21:08:06 2016 +0200

    main: add a --always-write-text option, useful for batch scripts
---
 diffoscope/main.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/diffoscope/main.py b/diffoscope/main.py
index 2ddfac8..fd476d9 100644
--- a/diffoscope/main.py
+++ b/diffoscope/main.py
@@ -72,6 +72,9 @@ def create_parser():
     group1 = parser.add_argument_group('output types')
     group1.add_argument('--text', metavar='OUTPUT_FILE', dest='text_output',
                         help='Write plain text output to given file (use - for stdout)')
+    group1.add_argument('--always-write-text', action='store_true',
+                        help='If --text is given and there was no difference, '
+                        'write an empty file to that location.')
     group1.add_argument('--html', metavar='OUTPUT_FILE', dest='html_output',
                         help='Write HTML report to given file (use - for stdout)')
     group1.add_argument('--html-dir', metavar='OUTPUT_DIR', dest='html_output_directory',
@@ -246,6 +249,8 @@ def run_diffoscope(parsed_args):
             with make_printer(parsed_args.text_output or '-') as print_func:
                 output_text(difference, print_func=print_func)
         return 1
+    if parsed_args.always_write_text and parsed_args.text_output:
+        open(parsed_args.text_output, 'w').close()
     return 0
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list