def cmd_extract_email(infile, verbose, jsonout):
    """Extract email addresses from a file or stdin.

    Example:

    \b
    $ cat /var/log/auth.log | habu.extract.email
    john@securetia.com
    raven@acmecorp.net
    nmarks@fimax.com
    """

    if verbose:
        logging.basicConfig(level=logging.INFO, format='%(message)s')

    data = infile.read()

    result = []

    result = extract_email(data)

    if jsonout:
        print(json.dumps(result, indent=4))
    else:
        print('\n'.join(result))