def build_command_parser():
    """Build command parser using ``argparse`` module."""
    parser = argparse.ArgumentParser(
        description='Transform Pylint JSON report to HTML')
    parser.add_argument(
        'filename',
        metavar='FILENAME',
        type=argparse.FileType('r'),
        nargs='?',
        default=sys.stdin,
        help='Pylint JSON report input file (or stdin)')
    parser.add_argument(
        '-o', '--output',
        metavar='FILENAME',
        type=argparse.FileType('w'),
        default=sys.stdout,
        help='Pylint HTML report output file (or stdout)')
    parser.add_argument(
        '-f', '--input-format',
        metavar='FORMAT',
        choices=[SIMPLE_JSON, EXTENDED_JSON],
        action='store',
        dest='input_format',
        default='json',
        help='Pylint JSON Report input type (json or jsonextended)')

    return parser
def build_command_parser ( ) : parser = argparse . ArgumentParser ( description = 'Transform Pylint JSON report to HTML' ) parser . add_argument ( 'filename' , metavar = 'FILENAME' , type = argparse . FileType ( 'r' ) , nargs = '?' , default = sys . stdin , help = 'Pylint JSON report input file (or stdin)' ) parser . add_argument ( '-o' , '--output' , metavar = 'FILENAME' , type = argparse . FileType ( 'w' ) , default = sys . stdout , help = 'Pylint HTML report output file (or stdout)' ) parser . add_argument ( '-f' , '--input-format' , metavar = 'FORMAT' , choices = [ SIMPLE_JSON , EXTENDED_JSON ] , action = 'store' , dest = 'input_format' , default = 'json' , help = 'Pylint JSON Report input type (json or jsonextended)' ) return parser
Build command parser using ``argparse`` module.