Add version callback and more help text
This commit is contained in:
parent
1e741ef76f
commit
aaf379e774
|
@ -1 +1 @@
|
|||
__version__ = "0.1.0"
|
||||
from oxo._version import __version__
|
||||
|
|
|
@ -4,11 +4,31 @@ from pathlib import Path
|
|||
import httpx
|
||||
import typer
|
||||
|
||||
from oxo import __version__
|
||||
|
||||
app = typer.Typer()
|
||||
|
||||
base_url = typer.Option("http://0x0.st", envvar="OXO_BASE_URL")
|
||||
|
||||
|
||||
def version_callback(value: bool):
|
||||
if value:
|
||||
typer.echo(f"{__version__}")
|
||||
raise typer.Exit()
|
||||
|
||||
|
||||
@app.callback()
|
||||
def main(
|
||||
version: t.Optional[bool] = typer.Option(
|
||||
None, "--version", callback=version_callback, is_eager=True
|
||||
),
|
||||
):
|
||||
"""A command line utility for 0x0.st compliant pastebins.
|
||||
|
||||
Set `OXO_BASE_URL` if the base URL is not http://0x0.st.
|
||||
"""
|
||||
|
||||
|
||||
@app.command()
|
||||
def files(
|
||||
files: t.List[Path] = typer.Argument(
|
||||
|
|
Loading…
Reference in New Issue