From 27e0407ab61bee10c924182b39f4c3a0b622d420 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 9 Jun 2020 14:10:14 +0100 Subject: sisyphus-cli : import the backend into the new client, plug the mirror module -> mirror setup works --- src/backend/mirror.py | 1 - src/frontend/cli/sisyphus-cli.py | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/backend/mirror.py b/src/backend/mirror.py index 6843e59..5fcf4eb 100644 --- a/src/backend/mirror.py +++ b/src/backend/mirror.py @@ -46,7 +46,6 @@ def writeList(mirrorList): mirrorFile.write("\n") def setActive(mirror): - mirror = int(mirror[0]) mirrorList = getList() if mirror not in range(1, len(mirrorList) + 1): print("\n" + "Mirror index is wrong, please check with sisyphus --mirror --list" + "\n") diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py index a0ca430..69e95b6 100755 --- a/src/frontend/cli/sisyphus-cli.py +++ b/src/frontend/cli/sisyphus-cli.py @@ -1,11 +1,12 @@ #!/usr/bin/python3 +import sisyphus import typer from typing import List app = typer.Typer() -mirror_cmd = typer.Typer() -app.add_typer(mirror_cmd, name="mirror", help='List/set the active binary repository mirror.') +mirrorSetup = typer.Typer() +app.add_typer(mirrorSetup, name="mirror", help='List/Set the active binary repository mirror.') @app.callback() def app_callback(): @@ -114,16 +115,15 @@ def sysinfo(): """Display information about installed core packages and portage configuration.""" typer.echo("Syncing sisyphus database ...") -@mirror_cmd.command("list") -def mirror_list(): - """List available binary package repository mirrors - (the active one is marked with *)""" - typer.echo("Listing available mirrors ...") +@mirrorSetup.command("list") +def mirrorlist(): + """List available binary package repository mirrors (* means active).""" + sisyphus.mirror.printList() -@mirror_cmd.command("set") -def mirror_set(index: int): +@mirrorSetup.command("set") +def mirrorset(index: int): """Change the binary package repository to the selected mirror.""" - typer.echo(f"Setting mirror to: {index}") + sisyphus.mirror.setActive(index) if __name__ == "__main__": app() -- cgit v1.2.3