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