How to use the instawow.cli.Report.generate_and_exit 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
def remove(obj: M, addons: Sequence[Defn]):
    "Remove add-ons."
    results = obj.m.run(obj.m.remove(addons))
    Report(results.items()).generate_and_exit()
github layday / instawow / instawow / cli.py View on Github external
def install(obj: M, addons: Sequence[Defn], replace: bool):
    "Install add-ons."
    if not addons:
        raise click.UsageError(
            'You must provide at least one of "ADDONS", "--with-strategy", '
            '"--version" or "--import"'
        )

    results = obj.m.run(obj.m.install(addons, replace))
    Report(results.items()).generate_and_exit()
github layday / instawow / instawow / cli.py View on Github external
def update(obj: M, addons: Sequence[Defn]):
    "Update installed add-ons."

    def report_filter(result: E.ManagerResult):
        # Hide package from output if up to date and ``update`` was invoked without args
        return cast(bool, addons) or not isinstance(result, E.PkgUpToDate)

    defns = addons or list(map(Defn.from_pkg, obj.m.db_session.query(models.Pkg).all()))
    results = obj.m.run(obj.m.update(defns))
    Report(results.items(), report_filter).generate_and_exit()
github layday / instawow / instawow / cli.py View on Github external
)
    if len(versions) <= 1:
        Report([(addon, E.PkgFileUnavailable('cannot find older versions'))]).generate_and_exit()

    reconstructed_defn = Defn.from_pkg(pkg)
    choices = [
        Choice(
            [('', v.version)],  # type: ignore
            disabled='installed version' if v.version == pkg.version else None,
        )
        for v in versions
    ]
    selection = select(
        f'Select version of {reconstructed_defn} for rollback', choices
    ).unsafe_ask()
    Report(
        chain(
            manager.run(manager.remove([reconstructed_defn])).items(),
            manager.run(
                manager.install([reconstructed_defn.with_version(selection)], replace=False)
            ).items(),