-
Notifications
You must be signed in to change notification settings - Fork 1
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
13 changed files
with
187 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
from datetime import datetime, timezone | ||
from pathlib import Path | ||
from typing import Annotated | ||
|
||
import pydantic | ||
import typer | ||
|
||
from battleship import data_home, get_client_version, tui | ||
from battleship import get_client_version, tui | ||
from battleship.cli import account, logging, play, settings | ||
from battleship.tui import di | ||
|
||
|
@@ -17,16 +15,6 @@ | |
SENTRY_DSN = "https://[email protected]/4507262636654592" | ||
|
||
|
||
def make_log_sink(debug: bool) -> str: | ||
now = datetime.now(tz=timezone.utc) | ||
|
||
if debug: | ||
log_home = Path() | ||
else: | ||
log_home = data_home | ||
return str(log_home / f"client_{now:%Y-%m-%d_%H-%M-%S}.log") | ||
|
||
|
||
@app.callback(invoke_without_command=True) | ||
def main( | ||
ctx: typer.Context, | ||
|
@@ -60,12 +48,11 @@ def main( | |
your terminal. You can play against the computer or a real player via the Internet, | ||
customize game options and appearance, keep track of your achievements, and more. | ||
""" | ||
|
||
ctx.ensure_object(dict) | ||
ctx.obj["server_url"] = server_url | ||
ctx.obj["debug"] = debug | ||
|
||
logging.configure_logger(make_log_sink(debug)) | ||
logging.configure_logger(debug) | ||
logging.configure_sentry(SENTRY_DSN) | ||
|
||
try: | ||
|
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
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
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
Oops, something went wrong.