Commit 9834602a authored by Tanguy Le Carrour's avatar Tanguy Le Carrour
Browse files

Use `typer` instead of `click`.

parent 453e0d1c
import sys
from typing import Tuple
from typing import List
import click
import typer
import splito.interfaces.from_base_types as controllers
import splito.interfaces.to_terminal as presenters
from splito.use_cases.extract_sub_tracks import ExtractSubTracksInteractor
def cli(ctx: click.Context) -> None:
cli = typer.Typer()
def callback():
# Empty call back to trick Typer into adding a single sub-command.
@click.argument("interval", nargs=-1)
def extract(ctx: click.Context, track: str, interval: Tuple[str]) -> None:
def extract(
ctx: typer.Context,
track: str = typer.Argument(..., help="An audio track to process"),
intervals: List[str] = typer.Argument(
"A variable number of space separated intervals. "
"An interval is a start time (in seconds) and an end time (in seconds) "
'separated by a "-" sign, for instance "17-28".'
) -> None:
"""Extract sub-tracks from a track.
A variable number of intervals can be passed. They are separated by a space.
An INTERVAL is a start time (in seconds) and an end time (in seconds)
separated by a "-" sign.
For instance, Splito can be run like this:
The command can be run like this:
$ splito extract my_track.mp3 17-28 40-66
controller = controllers.ExtractSubTracks(track, list(interval))
controller = controllers.ExtractSubTracks(track, intervals)
presenter = presenters.ExtractSubTracks()
interactor = ExtractSubTracksInteractor(presenter, ctx.obj["tracks"])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment