#!/usr/bin/env python

import argparse

from estop.cli.controller import Controller


def main():
    parser = argparse.ArgumentParser(
        description='ESTop : Elasticsearch task monitor',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter
    )

    parser.add_argument(
        '-e', '--endpoint',
        action='store',
        dest='endpoint',
        default='http://127.0.0.1:9200',
        help='Elasticsearch endpoint'
    )

    parser.add_argument(
        '-r', '--refresh',
        action='store',
        dest='refresh',
        type=int,
        default=5,
        help='Refresh time'
    )

    args = parser.parse_args()

    controller = Controller(args.endpoint, args.refresh)
    controller.main()


if __name__ == '__main__':
    main()
