Пример #1
0
def lib_update():
    lm = LibraryManager(get_lib_dir())

    lib_ids = [str(item['id']) for item in lm.get_installed().values()]
    if not lib_ids:
        return

    versions = get_api_result("/lib/version/" + str(",".join(lib_ids)))
    for id_ in lib_ids:
        info = lm.get_info(int(id_))

        click.echo("Updating  [ %s ] %s library:" % (
            click.style(id_, fg="yellow"),
            click.style(info['name'], fg="cyan")))

        current_version = info['version']
        latest_version = versions[id_]

        if latest_version is None:
            click.secho("Unknown library", fg="red")
            continue

        click.echo("Versions: Current=%s, Latest=%s \t " % (
            current_version, latest_version), nl=False)

        if current_version == latest_version:
            click.echo("[%s]" % (click.style("Up-to-date", fg="green")))
            continue
        else:
            click.echo("[%s]" % (click.style("Out-of-date", fg="red")))

        lib_uninstall([int(id_)])
        lib_install([int(id_)])
Пример #2
0
def lib_update():
    lm = LibraryManager(get_lib_dir())

    lib_ids = [str(item['id']) for item in lm.get_installed().values()]
    if not lib_ids:
        return

    versions = get_api_result("/lib/version/" + str(",".join(lib_ids)))
    for id_ in lib_ids:
        info = lm.get_info(int(id_))

        click.echo("Updating  [ %s ] %s library:" % (click.style(
            id_, fg="yellow"), click.style(info['name'], fg="cyan")))

        current_version = info['version']
        latest_version = versions[id_]

        if latest_version is None:
            click.secho("Unknown library", fg="red")
            continue

        click.echo("Versions: Current=%s, Latest=%s \t " %
                   (current_version, latest_version),
                   nl=False)

        if current_version == latest_version:
            click.echo("[%s]" % (click.style("Up-to-date", fg="green")))
            continue
        else:
            click.echo("[%s]" % (click.style("Out-of-date", fg="red")))

        lib_uninstall([int(id_)])
        lib_install([int(id_)])
Пример #3
0
def lib_list():
    lm = LibraryManager(get_lib_dir())
    items = lm.get_installed().values()
    if not items:
        return

    echo_liblist_header()
    for item in items:
        item['authornames'] = [i['name'] for i in item['authors']]
        echo_liblist_item(item)
Пример #4
0
def lib_list():
    lm = LibraryManager(get_lib_dir())
    items = lm.get_installed().values()
    if not items:
        return

    echo_liblist_header()
    for item in items:
        item['authornames'] = [i['name'] for i in item['authors']]
        echo_liblist_item(item)
Пример #5
0
def lib_list(json_output):
    lm = LibraryManager()
    items = lm.get_installed().values()

    if json_output:
        click.echo(json.dumps(items))
        return

    if not items:
        return

    echo_liblist_header()
    for item in sorted(items, key=lambda i: i['id']):
        item['authornames'] = [i['name'] for i in item['authors']]
        echo_liblist_item(item)
Пример #6
0
def lib_list(json_output):
    lm = LibraryManager()
    items = lm.get_installed().values()

    if json_output:
        click.echo(json.dumps(items))
        return

    if not items:
        return

    echo_liblist_header()
    for item in sorted(items, key=lambda i: i['id']):
        item['authornames'] = [i['name'] for i in item['authors']]
        echo_liblist_item(item)