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
This commit is contained in:
Raphael Maenle 2022-01-17 15:00:47 +01:00
parent bfd30324e1
commit 1825e3109c
3 changed files with 8 additions and 8 deletions

View File

@ -249,9 +249,9 @@ class Bump:
while True: while True:
time.sleep(sleep_time) time.sleep(sleep_time)
messages = self.list() messages = self.list()
for message in messages: for message in messages['messages']:
if self._to_log_line(message) not in log and message != {}: 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) self._save_log(message)
log = self.load_log() log = self._load_log()

View File

@ -6,8 +6,8 @@ import typer
def default( def default(
message_arg:Optional[str] = typer.Argument(None, help="The message to be bumped"), 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"), message:Optional[str] = typer.Option(None, help="The message to be bumped"),
reset:bool = typer.Option(False, help="remove all senders"), reset:Optional[bool] = typer.Option(False, help="remove all senders"),
alert:Optional[str] = typer.Option(None, help="check continuously for new messages"), 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")): secret:Optional[str] = typer.Option(None, help="change the sender and e2e keys")):
bp = bump.Bump() bp = bump.Bump()
if message_arg is not None: if message_arg is not None:
@ -19,7 +19,7 @@ def default(
elif reset: elif reset:
delete_senders() delete_senders()
elif alert is not None: elif alert is not None:
alert() alert_process()
else: else:
info() info()
@ -27,7 +27,7 @@ def delete_senders():
bp = bump.Bump() bp = bump.Bump()
bp.delete_senders() bp.delete_senders()
def alert(): def alert_process():
bp = bump.Bump() bp = bump.Bump()
bp.alert() bp.alert()

View File

@ -9,7 +9,7 @@ setup(
name='bump_python', name='bump_python',
packages=['bump'], packages=['bump'],
description='Notify your Phone from Python', description='Notify your Phone from Python',
version='0.1.3', version='0.1.4',
url='https://git.maenle.tech/raphael/bump_python', url='https://git.maenle.tech/raphael/bump_python',
author='Raphael Maenle', author='Raphael Maenle',
author_email='raphael@maenle.net', author_email='raphael@maenle.net',