Skip to content

Commit

Permalink
feat: add main script and version module
Browse files Browse the repository at this point in the history
Signed-off-by: jingfelix <[email protected]>
  • Loading branch information
jingfelix committed Jul 25, 2024
1 parent a64a27d commit 38fc92c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bilifm/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .command import app

app()
9 changes: 9 additions & 0 deletions src/bilifm/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import sys

if sys.version_info >= (3, 10):
import importlib.metadata as importlib_metadata
else:
import importlib_metadata


__version__ = importlib_metadata.version("bilifm")
12 changes: 12 additions & 0 deletions src/bilifm/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import typer

from .__version__ import __version__
from .audio import Audio
from .fav import Fav
from .season import Season
Expand All @@ -12,6 +13,17 @@
app = typer.Typer()


@app.callback(invoke_without_command=True)
def callback(version: bool = False):
"""
Entry for public options
"""

if version:
typer.echo(f"ppatch, version {__version__}")
raise typer.Exit()


@app.command()
def bv(
bv: str,
Expand Down

0 comments on commit 38fc92c

Please sign in to comment.