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
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user