From 1825e3109ccbb0152c283d21f87cf84254d714d2 Mon Sep 17 00:00:00 2001 From: raphael Date: Mon, 17 Jan 2022 15:00:47 +0100 Subject: [PATCH] updates alert function for cli - alert correctly collects title from server - alert now posts any new incomming messages to the commandline in form of a dict --- bump/bump.py | 6 +++--- bump/cli.py | 8 ++++---- setup.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bump/bump.py b/bump/bump.py index ea298fe..460c1d5 100644 --- a/bump/bump.py +++ b/bump/bump.py @@ -249,9 +249,9 @@ class Bump: while True: time.sleep(sleep_time) messages = self.list() - for message in messages: + for message in messages['messages']: if self._to_log_line(message) not in log and message != {}: - print(message['data']) + print({'title': message['title'], 'data': message['data']}) self._save_log(message) - log = self.load_log() + log = self._load_log() diff --git a/bump/cli.py b/bump/cli.py index dd33099..be7d8e4 100644 --- a/bump/cli.py +++ b/bump/cli.py @@ -6,8 +6,8 @@ import typer def default( message_arg:Optional[str] = typer.Argument(None, help="The message to be bumped"), message:Optional[str] = typer.Option(None, help="The message to be bumped"), - reset:bool = typer.Option(False, help="remove all senders"), - alert:Optional[str] = typer.Option(None, help="check continuously for new messages"), + reset:Optional[bool] = typer.Option(False, help="remove all senders"), + alert:Optional[bool] = typer.Option(False, help="check continuously for new messages"), secret:Optional[str] = typer.Option(None, help="change the sender and e2e keys")): bp = bump.Bump() if message_arg is not None: @@ -19,7 +19,7 @@ def default( elif reset: delete_senders() elif alert is not None: - alert() + alert_process() else: info() @@ -27,7 +27,7 @@ def delete_senders(): bp = bump.Bump() bp.delete_senders() -def alert(): +def alert_process(): bp = bump.Bump() bp.alert() diff --git a/setup.py b/setup.py index 5719074..720ccf0 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( name='bump_python', packages=['bump'], description='Notify your Phone from Python', - version='0.1.3', + version='0.1.4', url='https://git.maenle.tech/raphael/bump_python', author='Raphael Maenle', author_email='raphael@maenle.net',