Skip to content
Commits on Source (3)
......@@ -25,6 +25,7 @@ import sys
import json
import signal
import logging
import textwrap
import argparse
import traceback
......@@ -428,15 +429,17 @@ def create_parser():
parser.epilog = (
'File renaming detection based on fuzzy-matching is currently '
'disabled. It can be enabled by installing the "tlsh" module '
'available at https://github.com/trendmicro/tlsh'
'available from https://github.com/trendmicro/tlsh or in the '
'python3-tlsh package.'
)
if argcomplete:
argcomplete.autocomplete(parser)
elif '_ARGCOMPLETE' in os.environ:
logger.error(
'Argument completion requested but the "argcomplete" module is '
'not installed. It can be obtained at '
'https://pypi.python.org/pypi/argcomplete'
'not installed. It can be obtained from '
'https://pypi.python.org/pypi/argcomplete or in the '
'python3-argcomplete package.'
)
sys.exit(1)
......@@ -467,10 +470,29 @@ class HelpFormatter(argparse.HelpFormatter):
if not set(sys.argv) & {'--help', '-h'}:
return val
def append(title, content, indent=24, max_width=78):
nonlocal val
wrapped = textwrap.fill(content, max_width - indent)
val += '\n{}:\n{}\n'.format(
title, textwrap.indent(wrapped, ' ' * indent)
)
descriptions = list(sorted(ComparatorManager().get_descriptions()))
val = '{}\n\nfile formats supported:\n{}{} and {}.\n'.format(
val, ' ' * 24, ', '.join(descriptions[:-1]), descriptions[-1]
append(
'file formats supported',
'{} and {}.\n'.format(
', '.join(descriptions[:-1]), descriptions[-1]
),
)
append('diffoscope homepage', '<https://diffoscope.org/>')
append(
'bugs/issues',
'<https://salsa.debian.org/reproducible-builds/diffoscope/issues>',
max_width=sys.maxsize,
)
return val
......