def get_parser():
    """ Parses the arguments if script is run directly via console """
    parser = argparse.ArgumentParser(description='Converts HTML from file or url to a clean text version')
    parser.add_argument('input', nargs='?', default=None, help='Html input either from a file or an url (default:stdin)')
    parser.add_argument('-o', '--output', type=str, help='Output file (default:stdout).')
    parser.add_argument('-e', '--encoding', type=str, help='Content encoding for files (default:utf-8)', default='utf-8')
    parser.add_argument('-i', '--display-image-captions', action='store_true', default=False, help='Display image captions (default:false).')
    parser.add_argument('-l', '--display-link-targets', action='store_true', default=False, help='Display link targets (default:false).')
    parser.add_argument('-d', '--deduplicate-image-captions', action='store_true', default=False, help='Deduplicate image captions (default:false).')
    return parser
def get_parser ( ) : parser = argparse . ArgumentParser ( description = 'Converts HTML from file or url to a clean text version' ) parser . add_argument ( 'input' , nargs = '?' , default = None , help = 'Html input either from a file or an url (default:stdin)' ) parser . add_argument ( '-o' , '--output' , type = str , help = 'Output file (default:stdout).' ) parser . add_argument ( '-e' , '--encoding' , type = str , help = 'Content encoding for files (default:utf-8)' , default = 'utf-8' ) parser . add_argument ( '-i' , '--display-image-captions' , action = 'store_true' , default = False , help = 'Display image captions (default:false).' ) parser . add_argument ( '-l' , '--display-link-targets' , action = 'store_true' , default = False , help = 'Display link targets (default:false).' ) parser . add_argument ( '-d' , '--deduplicate-image-captions' , action = 'store_true' , default = False , help = 'Deduplicate image captions (default:false).' ) return parser
Parses the arguments if script is run directly via console