def main(args=None):
    """
    Execute graf console program
    """
    import graf
    from argparse import ArgumentParser
    parser = ArgumentParser()
    parser.add_argument('-i', '--interactive', default=False, action=
        'store_true', help=
        'Drop to interactive shell after running file instead of exiting')
    parser.add_argument('script_files', nargs='*')
    args = parser.parse_args(args)
    for script_file in args.script_files:
        graf.call(script_file)
    if len(args.script_files) == 0:
        args.interactive = True
    if args.interactive:
        try:
            import readline
        except ImportError:
            pass
        import code
        local = globals().copy()
        graf.use(local)
        code.interact(local=local)
