Commit d8113a84 authored by Chris Lamb's avatar Chris Lamb 👀
Browse files

Indent and wrap the list of supported file formats in the --help output.

parent cb6da078
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import sys
import json
import signal
import logging
import textwrap
import argparse
import traceback

@@ -469,10 +470,21 @@ 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]
            ),
        )

        return val