From 94953ccf16d590e06290478ac4d16312de6336e3 Mon Sep 17 00:00:00 2001 From: lulzette Date: Sun, 10 Jul 2022 04:15:55 +0300 Subject: [PATCH] Added '--raw' option to vds stop --- twvdscli.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/twvdscli.py b/twvdscli.py index b158b66..a43d53d 100644 --- a/twvdscli.py +++ b/twvdscli.py @@ -544,18 +544,26 @@ def vds_start(vds_id: Optional[int] = typer.Argument(None), raw: bool = typer.Op @servers_app.command("stop") -def vds_stop(vds_id: Optional[int] = typer.Argument(None)): +def vds_stop(vds_id: Optional[int] = typer.Argument(None), raw: bool = typer.Option(False, help="Get result as raw json")): """ Stop VDS """ if vds_id is None: + if raw: + print( + dict( + error="No VDS ID provided" + ) + ) + return 1 vds_list() vds_id = input("Enter VDS ID: ") result = Server.stop(vds_id) if result is None: print(typer.style("Error", fg=typer.colors.RED)) sys.exit(1) - + if raw: + print(result) for frame in cycle(r'-\|/'): state = Server.get_vds(vds_id) if state: