Main command line entry point.

def main(reactor):
    """Main command line entry point."""
    parser = argparse.ArgumentParser(
        description='Fetch a URI or series of URIs and print a title '
                    'or summary for each.',
        epilog='If no URIs are passed on the command line, they are '
               'read from standard input, one per line.')
    parser.add_argument(
        'uris', metavar='URI', nargs='*', help='URI to fetch')
    parser.add_argument(
        '-H', '--hostname-tag', action='store_true',
        help='prefix titles with a hostname tag')
    args = parser.parse_args()
    uris = args.uris or imap(lambda x: x.strip(), sys.stdin)
    finished = DeferredList([
        fetch_title(uri.decode(locale.getpreferredencoding()),
                    hostname_tag=args.hostname_tag, friendly_errors=True)
        for uri in uris])
    finished.addCallback(print_and_exit)
    return finished