u"""Reads from command line args or stdin and prints a sparkline from the
    data.  Requires at least 2 data points as input.

def main():
    u"""Reads from command line args or stdin and prints a sparkline from the
    data.  Requires at least 2 data points as input.
    """
    import argparse
    from pkg_resources import require

    parser = argparse.ArgumentParser(description=main.__doc__)
    parser.add_argument(
        "data",
        nargs=argparse.REMAINDER,
        help="Floating point data, any delimiter."
    )
    parser.add_argument(
        "--version",
        "-v",
        action="store_true",
        help="Display the version number and exit."
    )
    args = parser.parse_args()
    
    if args.version:
        version = require("pysparklines")[0].version
        print (version)
        sys.exit(0)

    if os.isatty(0) and not args.data:
        parser.print_help()
        sys.exit(1)
    elif args.data:
        arg_string = u' '.join(args.data)
    else:
        arg_string = sys.stdin.read()

    try:
        output = sparkify(guess_series(arg_string))
    except:
        sys.stderr.write("Could not convert input data to valid sparkline\n")
        sys.exit(1)

    print (output.encode('utf-8', 'ignore'))