How to use the instawow.cli.Report function in instawow

To help you get started, we’ve selected a few instawow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github layday / instawow / instawow / cli.py View on Github external
manager: CliManager = ctx.obj.m
    limit = 10

    pkg = manager.get_pkg(addon)
    if not pkg:
        Report([(addon, E.PkgNotInstalled())]).generate_and_exit()
        return  # noop

    resolver = manager.resolvers[pkg.source]
    if not resolver.supports_rollback:
        Report(
            [(addon, E.PkgFileUnavailable('source does not support rollback'))]
        ).generate_and_exit()

    if undo:
        Report(
            chain(
                manager.run(manager.remove([addon])).items(),
                manager.run(manager.install([addon], replace=False)).items(),
            )
        ).generate_and_exit()

    versions: List[models.PkgVersionLog] = (
        manager.db_session.query(models.PkgVersionLog)
        .filter(
            models.PkgVersionLog.pkg_source == pkg.source, models.PkgVersionLog.pkg_id == pkg.id
        )
        .order_by(models.PkgVersionLog.install_time.desc())
        .limit(limit)
        .all()
    )
    if len(versions) <= 1:
github layday / instawow / instawow / cli.py View on Github external
if list_unreconciled:
        table_rows = [('unreconciled',), *((f.name,) for f in sorted(leftovers))]
        click.echo(tabulate(table_rows))
        return
    elif not leftovers:
        click.echo('No add-ons left to reconcile.')
        return
    elif not auto:
        click.echo(preamble)

    matcher = match_all()
    for _ in matcher:  # Skip over consumer yields
        selections = matcher.send(leftovers)
        if selections and (auto or confirm('Install selected add-ons?').unsafe_ask()):
            results = manager.run(manager.install(selections, replace=True))
            Report(results.items()).generate()

        leftovers = get_folders(manager)

    if leftovers:
        click.echo()
        table_rows = [('unreconciled',), *((f.name,) for f in sorted(leftovers))]
        click.echo(tabulate(table_rows))