Added '--raw' option to vds stop

This commit is contained in:
lulzette 2022-07-10 04:15:55 +03:00
parent 2446a74b76
commit 94953ccf16

View File

@ -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: