summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-06-09 14:10:14 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-06-09 14:10:14 +0100
commit27e0407ab61bee10c924182b39f4c3a0b622d420 (patch)
tree5d73aa7421fee3cbd4b8c303e68c0a2accd56806 /src
parentdc646ecd9650eadf65fb5d6f019b5d555289cc66 (diff)
sisyphus-cli : import the backend into the new client, plug the mirror module -> mirror setup works
Diffstat (limited to 'src')
-rw-r--r--src/backend/mirror.py1
-rwxr-xr-xsrc/frontend/cli/sisyphus-cli.py20
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()