-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
384 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""Main module. Supports python -m geckolib syntax.""" | ||
|
||
# ruff: noqa: T201 | ||
|
||
import logging | ||
from pathlib import Path | ||
from sys import argv | ||
|
||
from geckolib import CUI, GeckoShell, GeckoSimulator | ||
|
||
|
||
def usage() -> None: | ||
"""Print usage.""" | ||
print("Usage: python3 -m geckolib <shell|simulator|cui> [client args]") | ||
|
||
|
||
def install_logging(command: str) -> None: | ||
"""Everyone needs logging, you say when, you say where, you say how much.""" | ||
Path(f"{command}.log").unlink(True) # noqa: FBT003 | ||
file_logger = logging.FileHandler(f"{command}.log") | ||
file_logger.setLevel(logging.DEBUG) | ||
file_logger.setFormatter( | ||
logging.Formatter("%(asctime)s %(name)s %(levelname)s %(message)s") | ||
) | ||
logging.getLogger().addHandler(file_logger) | ||
logging.getLogger().setLevel(logging.DEBUG) | ||
|
||
|
||
if len(argv) == 1: | ||
usage() | ||
elif argv[1] == "shell": | ||
install_logging(argv[1]) | ||
GeckoShell.run(argv[2:]) | ||
elif argv[1] == "simulator": | ||
install_logging(argv[1]) | ||
GeckoSimulator.run(["load ../tests/snapshots/default.snapshot", "start"] + argv[2:]) | ||
elif argv[1] == "cui": | ||
install_logging(argv[1]) | ||
CUI.launch() | ||
else: | ||
usage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
"""Single module version.""" | ||
|
||
VERSION = "1.0.5" | ||
VERSION = "1.0.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
"""GeckoLib utilities.""" | ||
|
||
from .async_command import AsyncCmd | ||
from .cui import CUI | ||
from .shell import GeckoShell | ||
from .simulator import GeckoSimulator | ||
from .snapshot import GeckoSnapshot | ||
|
||
__all__ = ["AsyncCmd", "GeckoShell", "GeckoSimulator", "GeckoSnapshot"] | ||
__all__ = ["CUI", "AsyncCmd", "GeckoShell", "GeckoSimulator", "GeckoSnapshot"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"""Geckolib cui utils.""" | ||
|
||
from .cui import CUI | ||
|
||
__all__ = ["CUI"] |
Oops, something went wrong.