|
"""Prep __main__.py.""" |
|
|
|
from pathlib import Path |
|
from typing import Optional |
|
|
|
import logzero |
|
import typer |
|
from logzero import logger |
|
from set_loglevel import set_loglevel |
|
|
|
from bloom_tr import __version__, bloom_tr |
|
|
|
logzero.loglevel(set_loglevel()) |
|
|
|
app = typer.Typer( |
|
name="bloom_tr", |
|
add_completion=False, |
|
help="bloom_tr help", |
|
) |
|
|
|
|
|
def _version_callback(value: bool) -> None: |
|
if value: |
|
typer.echo(f"{app.info.name} v.{__version__} -- ...") |
|
raise typer.Exit() |
|
|
|
|
|
@app.command() |
|
def main( |
|
version: Optional[bool] = typer.Option( |
|
None, |
|
"--version", |
|
"-v", |
|
"-V", |
|
help="Show version info and exit.", |
|
callback=_version_callback, |
|
is_eager=True, |
|
), |
|
): |
|
"""Define.""" |
|
|
|
|
|
if __name__ == "__main__": |
|
app() |
|
|