def run_diffoscope(parsed_args): if not tlsh and Config.general.fuzzy_threshold != parsed_args.fuzzy_threshold: logger.warning('Fuzzy-matching is currently disabled as the “tlsh” module is unavailable.') Config.general.max_diff_block_lines = parsed_args.max_diff_block_lines Config.general.max_diff_input_lines = parsed_args.max_diff_input_lines Config.general.max_report_size = parsed_args.max_report_size Config.general.separate_file_diff_size = parsed_args.separate_file_diff_size Config.general.fuzzy_threshold = parsed_args.fuzzy_threshold Config.general.new_file = parsed_args.new_file if parsed_args.debug: logger.setLevel(logging.DEBUG) set_locale() difference = diffoscope.comparators.compare_root_paths( parsed_args.file1, parsed_args.file2) if difference: # no output desired? print text if not any((parsed_args.text_output, parsed_args.html_output, parsed_args.html_output_directory)): parsed_args.text_output = "-" if parsed_args.html_output: with make_printer(parsed_args.html_output) as print_func: output_html(difference, css_url=parsed_args.css_url, print_func=print_func) if parsed_args.html_output_directory: output_html_directory(parsed_args.html_output_directory, difference, css_url=parsed_args.css_url, jquery_url=parsed_args.jquery_url) if parsed_args.text_output: with make_printer(parsed_args.text_output or '-') as print_func: output_text(difference, print_func=print_func) return 1 return 0
def set_locale(): diffoscope.set_locale()