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:
parent
1825e3109c
commit
eedc1d5679
11
bump/cli.py
11
bump/cli.py
@ -1,6 +1,8 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
import bump
|
import bump
|
||||||
import typer
|
import typer
|
||||||
|
import sys
|
||||||
|
import select
|
||||||
|
|
||||||
|
|
||||||
def default(
|
def default(
|
||||||
@ -9,16 +11,23 @@ def default(
|
|||||||
reset:Optional[bool] = typer.Option(False, help="remove all senders"),
|
reset:Optional[bool] = typer.Option(False, help="remove all senders"),
|
||||||
alert:Optional[bool] = typer.Option(False, 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()
|
||||||
|
|
||||||
|
pipe = None
|
||||||
|
if select.select([sys.stdin,],[],[],0.0)[0]:
|
||||||
|
pipe = sys.stdin.readline()
|
||||||
if message_arg is not None:
|
if message_arg is not None:
|
||||||
push(message_arg)
|
push(message_arg)
|
||||||
|
elif pipe is not None:
|
||||||
|
push(pipe)
|
||||||
elif message is not None:
|
elif message is not None:
|
||||||
push(message)
|
push(message)
|
||||||
elif secret is not None:
|
elif secret is not None:
|
||||||
secrets(secret)
|
secrets(secret)
|
||||||
elif reset:
|
elif reset:
|
||||||
delete_senders()
|
delete_senders()
|
||||||
elif alert is not None:
|
elif alert:
|
||||||
alert_process()
|
alert_process()
|
||||||
else:
|
else:
|
||||||
info()
|
info()
|
||||||
|
2
setup.py
2
setup.py
@ -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.4',
|
version='0.1.5',
|
||||||
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',
|
||||||
|
Loading…
Reference in New Issue
Block a user