diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-10-05 07:46:45 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-10-05 07:46:45 +0100 |
commit | 3686bbcd8d465fdd79782d3da8285930b679db02 (patch) | |
tree | 21dd88e992900d818e279a5e0b90946be6daa7a8 /src/frontend/cli/sisyphus-cli.py | |
parent | 1d0d37324a8fbdd0a3587698af577fcd39a25b08 (diff) |
implement a news system
Diffstat (limited to 'src/frontend/cli/sisyphus-cli.py')
-rwxr-xr-x | src/frontend/cli/sisyphus-cli.py | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/src/frontend/cli/sisyphus-cli.py b/src/frontend/cli/sisyphus-cli.py index 33c45ff..053f111 100755 --- a/src/frontend/cli/sisyphus-cli.py +++ b/src/frontend/cli/sisyphus-cli.py @@ -8,8 +8,11 @@ import sys app = typer.Typer() mirrorSetup = typer.Typer() +getNews = typer.Typer() app.add_typer(mirrorSetup, name="mirror", help='List/Set the active binhost (binary repository) mirror.') +app.add_typer(getNews, name="news", + help='Check/List/Mark Read/Mark Unread news articles.') @app.callback() @@ -324,7 +327,7 @@ def sysinfo(): @mirrorSetup.command("list") -def mirrorlist(): +def listmirrors(): """ List available binary package repository mirrors (the active one is marked with *).\n \n @@ -335,7 +338,7 @@ def mirrorlist(): @mirrorSetup.command("set") -def mirrorset(index: int): +def setmirror(index: int): """ Change the binary package repository to the selected mirror.\n \n @@ -346,6 +349,50 @@ def mirrorset(index: int): sisyphus.setmirror.setActive(index) +@getNews.command("check") +def checknews(): + """ + Check for unread news articles,\n + \n + * Example:\n + sisyphus news check\n + """ + sisyphus.getnews.start(check=True) + + +@getNews.command("list") +def listnews(): + """ + List all news articles.\n + \n + * Example:\n + sisyphus news list\n + """ + sisyphus.getnews.start(list=True) + + +@getNews.command("read") +def readnews(index: int): + """ + Mark a news article as read.\n + \n + * Example:\n + sisyphus news read 1\n + """ + sisyphus.getnews.start(read=True, article_nr=index) + + +@getNews.command("unread") +def unreadnews(index: int): + """ + Mark a news article as unread.\n + \n + * Example:\n + sisyphus news unread 2\n + """ + sisyphus.getnews.start(unread=True, article_nr=index) + + if __name__ == "__main__": if len(sys.argv) > 1 and not '--help' in sys.argv: sisyphus.setjobs.start() |