@cli_coursebook_roster.command(name='download', help='Download a CourseBook roster.')
@click.option('--force/--no-force', default=False, help='Overwrite existing file.')
@click.option('--new/--no-new', default=False, help="Get a new file (don't use the cache).")
@click.option('--get-password', default=None, help='Command to evaluate to get password (default is to ask).')
@click.option('--netid', default=None, help='Use this NetID.')
@click.argument('address', nargs=(- 1), type=click.STRING)
def cli_coursebook_roster_download(netid, get_password, new, force, address):

    def _split(x):
        (y, f) = os.path.splitext(x)
        return (y, f[1:])
    for x in address:
        (_, f) = _split(x)
        if (not (f in coursebook.ROSTER_FORMAT)):
            raise click.ClickException("{x}: I don't know how to download a `{f}`, only: {these}.".format(x=x, f=f, these=' '.join(coursebook.ROSTER_FORMAT)))
        if (os.path.exists(x) and (not force)):
            raise click.ClickException(('File exists, maybe use --force?: ' + x))
    if (netid is None):
        netid = config.NETID
    if (get_password is None):
        get_password = config.get_password
    if (netid is None):
        raise click.ClickException('You must either specify a NetID in {config} or with --netid.'.format(config.CONFIG_FILE))
    for x in address:
        (y, f) = _split(x)
        z = coursebook.roster_download(netid=netid, get_password=get_password, address=y, format=f, new=new)
        shutil.copyfile(z, x)
@cli_coursebook_roster.command(name='download', help='Download a CourseBook roster.')
@click.option('--force/--no-force', default=False, help='Overwrite existing file.')
@click.option('--new/--no-new', default=False, help="Get a new file (don't use the cache).")
@click.option('--get-password', default=None, help='Command to evaluate to get password (default is to ask).')
@click.option('--netid', default=None, help='Use this NetID.')
@click.argument('address', nargs=(- 1), type=click.STRING)
def cli_coursebook_roster_download(netid, get_password, new, force, address):

    def _split(x):
        (y, f) = os.path.splitext(x)
        return (y, f[1:])
    for x in address:
        (_, f) = _split(x)
        if (not (f in coursebook.ROSTER_FORMAT)):
            raise click.ClickException("{x}: I don't know how to download a `{f}`, only: {these}.".format(x=x, f=f, these=' '.join(coursebook.ROSTER_FORMAT)))
        if (os.path.exists(x) and (not force)):
            raise click.ClickException(('File exists, maybe use --force?: ' + x))
    if (netid is None):
        netid = config.NETID
    if (get_password is None):
        get_password = config.get_password
    if (netid is None):
        raise click.ClickException('You must either specify a NetID in {config} or with --netid.'.format(config.CONFIG_FILE))
    for x in address:
        (y, f) = _split(x)
        z = coursebook.roster_download(netid=netid, get_password=get_password, address=y, format=f, new=new)
        shutil.copyfile(z, x)