Skip to content

Commit 6d9f87b

Browse files
committed
Cleanup __main__.py even further
1 parent ce87374 commit 6d9f87b

File tree

4 files changed

+22
-81
lines changed

4 files changed

+22
-81
lines changed

streamdeck/__main__.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@
55
import sys
66
from argparse import ArgumentParser
77
from pathlib import Path
8-
from typing import cast
9-
10-
from streamdeck.cli.errors import (
11-
DirectoryNotFoundError,
12-
)
13-
from streamdeck.cli.models import (
14-
CliArgsNamespace,
15-
)
8+
from typing import Protocol, cast
9+
1610
from streamdeck.manager import PluginManager
1711
from streamdeck.models.configs import PyProjectConfigs
1812
from streamdeck.utils.logging import configure_streamdeck_logger
@@ -22,6 +16,25 @@
2216

2317

2418

19+
class DirectoryNotFoundError(FileNotFoundError):
20+
"""Custom exception to indicate that a specified directory was not found."""
21+
def __init__(self, *args: object, directory: Path):
22+
super().__init__(*args)
23+
self.directory = directory
24+
25+
26+
class CliArgsNamespace(Protocol):
27+
"""Represents the command-line arguments namespace."""
28+
plugin_dir: Path | None
29+
action_scripts: list[str] | None
30+
31+
# Args always passed in by StreamDeck software
32+
port: int
33+
pluginUUID: str # noqa: N815
34+
registerEvent: str # noqa: N815
35+
info: str # Actually a string representation of json object
36+
37+
2538
def setup_cli() -> ArgumentParser:
2639
"""Set up the command-line interface for the script.
2740
@@ -56,7 +69,7 @@ def setup_cli() -> ArgumentParser:
5669
return parser
5770

5871

59-
def main():
72+
def main() -> None:
6073
"""Main function to parse arguments, load actions, and execute them."""
6174
parser = setup_cli()
6275
args = cast(CliArgsNamespace, parser.parse_args())

streamdeck/cli/__init__.py

Whitespace-only changes.

streamdeck/cli/errors.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

streamdeck/cli/models.py

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)