mirror of
https://github.com/suaveolent/hoymiles-wifi.git
synced 2024-09-20 03:10:11 +00:00
emit proper exit codes to use in automation and scripts
This commit is contained in:
parent
57439fc14f
commit
c501b48976
@ -5,6 +5,7 @@ from __future__ import annotations
|
|||||||
import argparse
|
import argparse
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
from dataclasses import asdict, dataclass
|
from dataclasses import asdict, dataclass
|
||||||
|
|
||||||
from google.protobuf.json_format import MessageToJson
|
from google.protobuf.json_format import MessageToJson
|
||||||
@ -286,6 +287,8 @@ def print_invalid_command(command: str) -> None:
|
|||||||
"""Print an invalid command message."""
|
"""Print an invalid command message."""
|
||||||
|
|
||||||
print(f"Invalid command: {command}") # noqa: T201
|
print(f"Invalid command: {command}") # noqa: T201
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def main() -> None:
|
async def main() -> None:
|
||||||
@ -366,6 +369,7 @@ async def main() -> None:
|
|||||||
f"No response or unable to retrieve response for "
|
f"No response or unable to retrieve response for "
|
||||||
f"{args.command.replace('_', ' ')}",
|
f"{args.command.replace('_', ' ')}",
|
||||||
)
|
)
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
||||||
def run_main() -> None:
|
def run_main() -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user