From 2446a74b76625086cb7b2e24cf834fc9bf2d3c85 Mon Sep 17 00:00:00 2001 From: lulzette Date: Sun, 10 Jul 2022 04:13:54 +0300 Subject: [PATCH] Added '--raw' option to vds start --- twvdscli.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/twvdscli.py b/twvdscli.py index 0609705..b158b66 100644 --- a/twvdscli.py +++ b/twvdscli.py @@ -512,18 +512,27 @@ def vds_goto(vds_id: Optional[int] = typer.Argument(None), @servers_app.command("start") -def vds_start(vds_id: Optional[int] = typer.Argument(None)): +def vds_start(vds_id: Optional[int] = typer.Argument(None), raw: bool = typer.Option(False, help="Get result as raw json")): """ Start 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.start(vds_id) if result is None: print(typer.style("Error", fg=typer.colors.RED)) sys.exit(1) - + if raw: + print(result) + return for frame in cycle(r'-\|/'): state = Server.get_vds(vds_id) if state: