def main(args=None):
    """This is the main function called by the `fitsheader` script."""

    parser = argparse.OptionParser(
        description=('Print the header(s) of a FITS file. '
                     'Optional arguments allow the desired extension(s), '
                     'keyword(s), and output format to be specified. '
                     'Note that in the case of a compressed image, '
                     'the decompressed header is shown by default.'))
    parser.add_option('-e', '--ext', metavar='HDU',
                      action='append', dest='extensions',
                      help='specify the extension by name or number; '
                           'this argument can be repeated '
                           'to select multiple extensions')
    parser.add_option('-k', '--keyword', metavar='KEYWORD',
                      action='append', dest='keywords',
                      help='specify a keyword; this argument can be '
                           'repeated to select multiple keywords; '
                           'also supports wildcards')
    parser.add_option('-c', '--compressed', action='store_true',
                      help='for compressed image data, '
                           'show the true header which describes '
                           'the compression rather than the data')
    parser.add_option('filename', nargs='+',
                      help='path to one or more files; '
                           'wildcards are supported')
    args = parser.parse_args(args)

    # Now print the desired headers
    try:
        print_headers_traditional(args)
    except __HOLE__ as e:
        # A 'Broken pipe' IOError may occur when stdout is closed prematurely,
        # eg. when calling `fitsheader file.fits | head`. We let this pass.
        pass
dataset/ETHPy150Open spacetelescope/PyFITS/pyfits/scripts/fitsheader.py/main