enables piping to bump cli

- sys.stdin is queried for data
  if no message is passed to the
  cli directly
- sys stdin content is then passed
  as the title of a message to the
  senders
This commit is contained in:
Raphael Maenle 2022-01-17 15:09:47 +01:00
parent 1825e3109c
commit eedc1d5679
2 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,8 @@
from typing import Optional
import bump
import typer
import sys
import select
def default(
@ -9,16 +11,23 @@ def default(
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()
pipe = None
if select.select([sys.stdin,],[],[],0.0)[0]:
pipe = sys.stdin.readline()
if message_arg is not None:
push(message_arg)
elif pipe is not None:
push(pipe)
elif message is not None:
push(message)
elif secret is not None:
secrets(secret)
elif reset:
delete_senders()
elif alert is not None:
elif alert:
alert_process()
else:
info()

View File

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