This commit is contained in:
grym 2022-05-27 18:00:45 -04:00
parent 36d6a2a87b
commit c2b90f23d7
2 changed files with 10 additions and 4 deletions

View File

@ -24,3 +24,9 @@ repos:
- id: isort
name: Import order
args: ["--profile=black", "./oxo"]
- repo: https://github.com/PyCQA/autoflake
rev: v1.4
hooks:
- id: autoflake
name: Import pruning
args: ["-i", "-r","--remove-unused-variables","--ignore-init-module-imports"]

View File

@ -1,7 +1,6 @@
import typing as t
from pathlib import Path
import httpx
import typer
from oxo import __version__, api
@ -29,7 +28,8 @@ def main(
):
"""A command line utility for 0x0.st compliant pastebins.
To use a different 0x0 site, set `OXO_BASE_URL` in your environment.
To use a different 0x0 site, set `OXO_BASE_URL` in your environment,
or specify it in the relevant subcommand.
"""
@ -45,13 +45,13 @@ def files(
@app.command()
def repost(urls: t.List[str], base_url=BASE_URL):
def repost(urls: t.List[str] = typer.Argument(..., min=1), base_url=BASE_URL):
"""Repost one or more urls."""
typer.echo(api.repost(base_url, urls))
@app.command()
def shorten(urls: t.List[str], base_url=BASE_URL):
def shorten(urls: t.List[str] = typer.Argument(..., min=1), base_url=BASE_URL):
"""Shorten one or more urls."""
if base_url == BASE_URL.default:
typer.secho(