from .discover import *


def main(parser, args):
    command = CommandManager()
    command.set_args(args)
    command.scan()


def build_arg_parser(parser, desc):
    label = desc['label']
    hlp = desc['help']

    parser.description = desc['description']
    parser.add_argument(
        'hostname', nargs='+', metavar=label['hostname'], help=hlp['hostname']
    )
    parser.add_argument(
        '--passwords',
        metavar=label['passwords'],
        help=hlp['passwords'],
        widget='FileChooser',
    )
    parser.add_argument(
        '-o',
        '--output',
        type=str,
        metavar=label['output'],
        help=hlp['output'],
        widget='FileChooser',
    )
    parser.add_argument(
        '-v',
        '--verbose',
        action='store_true',
        metavar=label['verbose'],
        help=hlp['verbose'],
    )

    parser.add_argument(
        '-j',
        '--jobs',
        type=int,
        default=50,
        metavar=label['jobs'],
        help=hlp['jobs'],
        gooey_options={'visible': False},
    )
