Skip to content

Commit b5f2b0d

Browse files
Unify service cache
Move cli commands to cli package
1 parent c0a7f2d commit b5f2b0d

11 files changed

Lines changed: 1007 additions & 700 deletions

File tree

mediux_posters/__main__.py

Lines changed: 2 additions & 651 deletions
Large diffs are not rendered by default.

mediux_posters/cli/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
__all__ = ["settings_app"]
1+
__all__ = ["app", "media_posters", "set_posters", "settings", "sync_posters"]
22

3-
from mediux_posters.cli.settings import app as settings_app
3+
from mediux_posters.cli._typer import app
4+
from mediux_posters.cli.media import media_posters
5+
from mediux_posters.cli.set import set_posters
6+
from mediux_posters.cli.settings import settings
7+
from mediux_posters.cli.sync import sync_posters

mediux_posters/cli/_typer.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
__all__ = ["app"]
2+
3+
from typing import Annotated
4+
5+
from typer import Context, Exit, Option, Typer
6+
7+
from mediux_posters import __version__
8+
from mediux_posters.console import CONSOLE
9+
10+
app = Typer(no_args_is_help=True)
11+
12+
13+
@app.callback(invoke_without_command=True)
14+
def common(
15+
ctx: Context,
16+
version: Annotated[
17+
bool | None, Option("--version", is_eager=True, help="Show the version and exit.")
18+
] = None,
19+
) -> None:
20+
if ctx.invoked_subcommand:
21+
return
22+
if version:
23+
CONSOLE.print(f"Mediux Posters v{__version__}")
24+
raise Exit

0 commit comments

Comments
 (0)