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: