senders can now be added and removed via cli
- --reset flag (default false) can now be set to remove all senders - multiple senders can be added now
This commit is contained in:
46
bump/cli.py
46
bump/cli.py
@ -1,20 +1,48 @@
|
||||
from typing import Optional
|
||||
import bump
|
||||
import typer
|
||||
|
||||
cli = typer.Typer()
|
||||
|
||||
@cli.command()
|
||||
def default(message = typer.Argument(None, help="The message to be bumped")):
|
||||
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"),
|
||||
secret:Optional[str] = typer.Option(None, help="change the sender and e2e keys")):
|
||||
bp = bump.Bump()
|
||||
if message is None:
|
||||
bp.show_secret()
|
||||
if message_arg is not None:
|
||||
push(message_arg)
|
||||
elif message is not None:
|
||||
push(message)
|
||||
elif secret is not None:
|
||||
secrets(secret)
|
||||
elif reset:
|
||||
delete_senders()
|
||||
elif alert is not None:
|
||||
alert()
|
||||
else:
|
||||
bp.push(message)
|
||||
info()
|
||||
|
||||
@cli.command()
|
||||
def push():
|
||||
def delete_senders():
|
||||
bp = bump.Bump()
|
||||
bp.version()
|
||||
bp.delete_senders()
|
||||
|
||||
def alert():
|
||||
bp = bump.Bump()
|
||||
bp.alert()
|
||||
|
||||
def secrets(secret:str):
|
||||
if secret is not None:
|
||||
bp = bump.Bump(secret)
|
||||
info()
|
||||
|
||||
def push(message:str):
|
||||
bp = bump.Bump()
|
||||
bp.push(message)
|
||||
|
||||
def info():
|
||||
bp = bump.Bump()
|
||||
bp.show_secret()
|
||||
|
||||
def main():
|
||||
typer.run(default)
|
||||
|
Reference in New Issue
Block a user